@anuma/sdk 6.32.0 → 6.33.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.
@@ -5051,6 +5051,13 @@ declare class MemoryEntity extends Model {
5051
5051
  declare const ENTITY_KINDS: readonly ["person", "organization", "place", "event", "product", "thing", "concept", "other"];
5052
5052
  /** @public */
5053
5053
  type EntityKind = (typeof ENTITY_KINDS)[number];
5054
+ interface StoredEntity {
5055
+ uniqueId: string;
5056
+ canonicalName: string;
5057
+ kind: string | null;
5058
+ createdAt: Date;
5059
+ updatedAt: Date;
5060
+ }
5054
5061
  /**
5055
5062
  * Who put a topic on a memory. Written to `memory_vault.topics` but not yet
5056
5063
  * READ anywhere — it exists so a later improvement can refresh the `auto`
@@ -5079,6 +5086,16 @@ interface StoredTopic {
5079
5086
  source: TopicSource;
5080
5087
  }
5081
5088
 
5089
+ /**
5090
+ * Accepted entity shape for {@link linkMemoryEntitiesOp}. A bare string is
5091
+ * a name with no kind (back-compat with the original signature); the object
5092
+ * form carries an optional classification.
5093
+ * @public
5094
+ */
5095
+ type EntityInput = string | {
5096
+ name: string;
5097
+ kind?: EntityKind | (string & {});
5098
+ };
5082
5099
  interface EntityOperationsContext {
5083
5100
  database: Database;
5084
5101
  entityCollection: Collection<Entity>;
@@ -7095,9 +7112,13 @@ interface VaultMemoryOperationsContext {
7095
7112
  */
7096
7113
  entityCtx?: EntityOperationsContext;
7097
7114
  }
7115
+ /** @deprecated App code: use `MemoryStore.create` (`createLocalMemoryStore`). */
7098
7116
  declare function createVaultMemoryOp(ctx: VaultMemoryOperationsContext, opts: CreateVaultMemoryOptions): Promise<StoredVaultMemory>;
7117
+ /** @deprecated App code: use `MemoryStore.createMany` (`createLocalMemoryStore`). */
7099
7118
  declare function createVaultMemoriesBatchOp(ctx: VaultMemoryOperationsContext, optionsArray: CreateVaultMemoryOptions[]): Promise<StoredVaultMemory[]>;
7119
+ /** @deprecated App code: use `MemoryStore.get` (`createLocalMemoryStore`). */
7100
7120
  declare function getVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string): Promise<StoredVaultMemory | null>;
7121
+ /** @deprecated App code: use `MemoryStore.list` (`createLocalMemoryStore`). */
7101
7122
  declare function getAllVaultMemoriesOp(ctx: VaultMemoryOperationsContext, options?: {
7102
7123
  scopes?: string[];
7103
7124
  since?: Date;
@@ -7164,6 +7185,8 @@ declare function getVaultRankingProjectionsOp(ctx: VaultMemoryOperationsContext,
7164
7185
  * Reuses `baseVaultConditions`, so deleted / superseded / cross-user rows are
7165
7186
  * excluded exactly as they are from recall — a caller can pass any id list and
7166
7187
  * only its own live rows come back.
7188
+ *
7189
+ * @deprecated App code: use `MemoryStore.list({ memoryIds })` (`createLocalMemoryStore`).
7167
7190
  */
7168
7191
  declare function getVaultMemoriesByIdsOp(ctx: VaultMemoryOperationsContext, ids: string[],
7169
7192
  /** See {@link getVaultEmbeddingsByIdsOp} — must match what admitted these ids. */
@@ -7173,6 +7196,7 @@ options?: {
7173
7196
  declare function getAllVaultMemoryContentsOp(ctx: VaultMemoryOperationsContext, options?: {
7174
7197
  since?: Date;
7175
7198
  }): Promise<string[]>;
7199
+ /** @deprecated App code: use `MemoryStore.update` (`createLocalMemoryStore`). */
7176
7200
  declare function updateVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string, opts: UpdateVaultMemoryOptions): Promise<StoredVaultMemory | null>;
7177
7201
  /**
7178
7202
  * Set a memory's People Nearby visibility (and optionally its twin opt-in).
@@ -7186,12 +7210,15 @@ declare function updateVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: stri
7186
7210
  * Preserves `updated_at`: a visibility change is metadata, not a
7187
7211
  * re-observation, so it must not inflate the recency multiplier (mirrors
7188
7212
  * {@link setMemoryEntitiesOp}).
7213
+ *
7214
+ * @deprecated App code: use `MemoryStore.setVisibility` (`createLocalMemoryStore`).
7189
7215
  */
7190
7216
  declare function setMemoryVisibilityOp(ctx: VaultMemoryOperationsContext, id: string, opts: {
7191
7217
  visibility: VaultMemoryVisibility;
7192
7218
  /** If provided, sets the twin opt-in flag alongside the visibility. */
7193
7219
  twinOptIn?: boolean;
7194
7220
  }): Promise<StoredVaultMemory | null>;
7221
+ /** @deprecated App code: use `MemoryStore.delete` (`createLocalMemoryStore`). */
7195
7222
  declare function deleteVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string): Promise<boolean>;
7196
7223
  /**
7197
7224
  * Mark a memory as superseded by a newer one (A2 write-time supersession).
@@ -7203,6 +7230,8 @@ declare function deleteVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: stri
7203
7230
  *
7204
7231
  * @param id - the memory being retired (e.g. "Lives in Portland")
7205
7232
  * @param supersededById - the newer memory that replaced it (e.g. "Lives in SF")
7233
+ *
7234
+ * @deprecated App code: use `MemoryStore.supersede` (`createLocalMemoryStore`).
7206
7235
  */
7207
7236
  declare function supersedeVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string, supersededById: string): Promise<boolean>;
7208
7237
  /**
@@ -7293,6 +7322,8 @@ interface MemoriesNeedingTopicExtraction {
7293
7322
  * a contradiction only a pre-v42 restore produces, and this is the one place
7294
7323
  * that can see all three facts at once, so it clears the flag there (capped by
7295
7324
  * `limit`) before returning. See the branch for why that's safe.
7325
+ *
7326
+ * @deprecated App code: use `MemoryStore.maintenance.getTopicBacklog` (`createLocalMemoryStore`).
7296
7327
  */
7297
7328
  declare function getMemoriesNeedingTopicExtractionOp(ctx: VaultMemoryOperationsContext, options?: {
7298
7329
  limit?: number;
@@ -7322,6 +7353,8 @@ declare function getMemoriesNeedingTopicExtractionOp(ctx: VaultMemoryOperationsC
7322
7353
  * Callers bound the input via `getMemoriesNeedingTopicExtractionOp`'s `limit`
7323
7354
  * (both `pending` and `linkedUnstamped` are capped), so the per-row Model load
7324
7355
  * needed to `prepareUpdate` stays bounded and never spikes the RecordCache.
7356
+ *
7357
+ * @deprecated App code: use `MemoryStore.maintenance.stampTopicsExtracted` (`createLocalMemoryStore`).
7325
7358
  */
7326
7359
  declare function stampTopicsExtractedAtOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[], extractedAt: number, version?: number): Promise<string[]>;
7327
7360
  /**
@@ -7338,6 +7371,8 @@ declare function stampTopicsExtractedAtOp(ctx: VaultMemoryOperationsContext, mem
7338
7371
  *
7339
7372
  * Skips deleted rows, foreign-user rows, and rows with null topics.
7340
7373
  * Empty topics remove stale links. Returns the relinked IDs.
7374
+ *
7375
+ * @deprecated App code: use `MemoryStore.maintenance.relinkTopics` (`createLocalMemoryStore`).
7341
7376
  */
7342
7377
  declare function relinkMemoryTopicsOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[]): Promise<string[]>;
7343
7378
  /**
@@ -7362,6 +7397,8 @@ declare function relinkMemoryTopicsOp(ctx: VaultMemoryOperationsContext, memoryI
7362
7397
  * per memory (~107 on a single dev launch, sdk#891); it also cost N writes.
7363
7398
  * Same treatment as {@link stampTopicsExtractedAtOp}, including its
7364
7399
  * transpilation hazard — the prepare pass MUST stay a `.map()`.
7400
+ *
7401
+ * @deprecated App code: use `MemoryStore.maintenance.backfillTopics` (`createLocalMemoryStore`).
7365
7402
  */
7366
7403
  declare function backfillMemoryTopicsOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[]): Promise<string[]>;
7367
7404
  declare function deleteAllVaultMemoriesForUserOp(ctx: VaultMemoryOperationsContext, userId: string): Promise<number>;
@@ -7416,6 +7453,8 @@ declare function getDecayCandidatesRawOp(ctx: VaultMemoryOperationsContext): Pro
7416
7453
  *
7417
7454
  * @returns `true` if this call archived the row; `false` if it was stale
7418
7455
  * (deleted / not owned / already archived / refreshed under us).
7456
+ *
7457
+ * @deprecated App code: use `MemoryStore.archive` (`createLocalMemoryStore`).
7419
7458
  */
7420
7459
  declare function archiveVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string, opts?: {
7421
7460
  /** Timestamp to stamp into `archived_at`. Default `Date.now()`. */
@@ -7433,6 +7472,8 @@ declare function archiveVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: str
7433
7472
  *
7434
7473
  * @returns `true` if the row was restored (or already active); `false` if it was
7435
7474
  * deleted / not owned / missing.
7475
+ *
7476
+ * @deprecated App code: use `MemoryStore.restore` (`createLocalMemoryStore`).
7436
7477
  */
7437
7478
  declare function restoreVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string): Promise<boolean>;
7438
7479
  /**
@@ -8947,6 +8988,397 @@ declare class RerankerUnavailableError extends Error {
8947
8988
  */
8948
8989
  declare function isRerankerAvailable(): boolean | undefined;
8949
8990
 
8991
+ /**
8992
+ * Standalone topic (entity) extraction for EXISTING memories.
8993
+ *
8994
+ * The conversation pipeline (autoExtract.ts) assigns entities only to facts it
8995
+ * extracts from a live transcript — manually created, imported, and edited
8996
+ * memories never get LLM topics and used to fall back to a client-side regex.
8997
+ * This module is the LLM half of "continuously LLM-managed topics": a batched
8998
+ * pass that takes memories already in the vault, asks the extraction model for
8999
+ * their named entities, REPLACES their auto-managed links (guarded — a manual
9000
+ * edit or delete always wins), and stamps `topics_extracted_at` so the sweep
9001
+ * query (`getMemoriesNeedingTopicExtractionOp`) only revisits edited memories.
9002
+ *
9003
+ * Batching: memories are classified ~10 per LLM call (mirroring the folder
9004
+ * Auto-Sort harness) with per-memory content truncation, so a whole-vault
9005
+ * backfill or a bulk import costs ceil(n/10) requests, not n.
9006
+ */
9007
+
9008
+ /** Memories per LLM call. Mirrors the folder Auto-Sort batch size — the cost
9009
+ * lever that makes a whole-vault backfill viable. */
9010
+ declare const TOPIC_EXTRACTION_BATCH_SIZE = 10;
9011
+ /** One memory to extract topics for. `content` must be the DECRYPTED text. */
9012
+ interface TopicExtractionInput {
9013
+ id: string;
9014
+ content: string;
9015
+ }
9016
+ /**
9017
+ * Options for the topic-extraction LLM call. Auth follows the portal dual
9018
+ * pattern — one of `apiKey` / `getToken` is required (see {@link PortalLlmAuth}).
9019
+ */
9020
+ interface TopicExtractOptions extends PortalLlmAuth {
9021
+ baseUrl?: string;
9022
+ /**
9023
+ * Optional per-call request path override, forwarded to
9024
+ * {@link callPortalJsonCompletion}. When set, topic extraction POSTs to
9025
+ * `baseUrl + endpointOverride` instead of the default
9026
+ * `/api/v1/chat/completions`. The body follows the transport, not the path: a
9027
+ * model that needs the Responses API is moved from a `.../chat/completions`
9028
+ * override to its sibling `.../responses` with a Responses-shaped body. Lets callers route
9029
+ * this internal-utility pass to a dedicated endpoint. Invalid values throw at
9030
+ * call time (see {@link validateEndpointOverride}).
9031
+ */
9032
+ endpointOverride?: string;
9033
+ /** Defaults to {@link DEFAULT_EXTRACTION_MODEL} — the sanctioned extraction
9034
+ * model. Don't point this at a second model without an eval. */
9035
+ model?: string;
9036
+ /** Override the global fetch implementation (useful for tests). */
9037
+ fetchFn?: typeof fetch;
9038
+ maxAttempts?: number;
9039
+ timeoutMs?: number;
9040
+ totalTimeoutMs?: number;
9041
+ backoffMs?: (attempt: number) => number;
9042
+ /**
9043
+ * The user's existing entity vocabulary (canonical names). Included in the
9044
+ * prompt so independent batches reuse canonical names instead of fragmenting
9045
+ * ("ZetaChain" / "Zetachain" / "zeta chain" as three graph nodes). Truncated
9046
+ * to the first {@link MAX_VOCABULARY_NAMES} names — pass the most-linked
9047
+ * names first.
9048
+ */
9049
+ existingEntityNames?: readonly string[];
9050
+ /**
9051
+ * When set, PII in memory contents is replaced with tagged placeholders
9052
+ * before the LLM call and returned entity names are de-anonymized (entities
9053
+ * whose placeholders can't be restored are dropped) — mirrors
9054
+ * `ExtractFactsOptions.piiRedaction`. Vault contents hold REAL values, so
9055
+ * callers that redact the conversation pipeline must redact this pass too.
9056
+ */
9057
+ piiRedaction?: boolean | PiiRedactor;
9058
+ }
9059
+ /**
9060
+ * Ask the extraction LLM for the named entities of each memory, in batches of
9061
+ * {@link TOPIC_EXTRACTION_BATCH_SIZE}. Pure LLM step — no persistence.
9062
+ *
9063
+ * Returns memoryId → entities. A memory PRESENT with an empty array is a
9064
+ * successful, explicit "no named entities" answer; a memory ABSENT from the
9065
+ * map is UNANSWERED — its batch failed after retries, returned an unusable
9066
+ * shape, or the model omitted its id. Callers must retry absent ids in a
9067
+ * later sweep, never stamp them.
9068
+ */
9069
+ declare function extractEntitiesForMemories(memories: readonly TopicExtractionInput[], options: TopicExtractOptions): Promise<Map<string, ExtractedEntity[]>>;
9070
+ /**
9071
+ * Why one memory was skipped by a topic sweep.
9072
+ *
9073
+ * Split along the line that actually matters operationally — did the sweep
9074
+ * DECLINE this row on purpose, or did something BREAK:
9075
+ *
9076
+ * Deliberate (healthy; a sweep of nothing but these is a success):
9077
+ * - `excluded` — deleted, owned by another user, or `topicsUserManaged`.
9078
+ * - `link-declined` — the entity-link write's in-row guard declined (the row
9079
+ * became user-managed / deleted / absent mid-run).
9080
+ * - `stamp-declined` — same, caught by the stamp op's own re-check.
9081
+ *
9082
+ * Degraded (something is wrong; see {@link isDegradedTopicSkip}):
9083
+ * - `llm-unanswered` — the batch failed or the model omitted this id. THE one
9084
+ * to alarm on: it is how a wholly broken sweep looks.
9085
+ * - `unreadable` — the row could not be loaded/decrypted.
9086
+ * - `not-found` — the lookup threw (absent row or read fault).
9087
+ * - `link-failed` — the entity-link write threw.
9088
+ *
9089
+ * @public
9090
+ */
9091
+ type TopicSkipReason = "excluded" | "link-declined" | "stamp-declined" | "llm-unanswered" | "unreadable" | "not-found" | "link-failed";
9092
+ /**
9093
+ * Whether a skip reason means the sweep FAILED on that row, rather than
9094
+ * deliberately passing over it.
9095
+ *
9096
+ * Exported so callers classify identically instead of each re-deriving the
9097
+ * split — the reason this type exists is that one wrong grouping turns a broken
9098
+ * sweep back into a healthy-looking one.
9099
+ *
9100
+ * @public
9101
+ */
9102
+ declare function isDegradedTopicSkip(reason: TopicSkipReason): boolean;
9103
+ /** Outcome of one {@link extractAndLinkEntitiesForMemoriesOp} run. */
9104
+ interface TopicExtractionRunResult {
9105
+ /** memoryId → entities the LLM returned (post-validation, post-linking). */
9106
+ entitiesByMemory: Map<string, ExtractedEntity[]>;
9107
+ /** Memories stamped `topics_extracted_at` this run — includes zero-entity
9108
+ * results so quiet memories aren't re-asked every sweep. */
9109
+ stampedIds: string[];
9110
+ /** Memories NOT processed: missing/deleted/foreign rows, user-managed rows
9111
+ * (including ones that became user-managed mid-run), and members of failed
9112
+ * LLM batches. Skipped ids are not stamped, so failed batches are retried
9113
+ * by a later sweep — callers should apply their own attempt caps. */
9114
+ skippedIds: string[];
9115
+ /**
9116
+ * Why each id in {@link skippedIds} was skipped.
9117
+ *
9118
+ * `skippedIds` alone cannot distinguish a sweep that deliberately declined
9119
+ * work from one that FAILED: a run where every LLM batch errored and a run
9120
+ * over rows the user has taken manual control of produce an identical array.
9121
+ * That is the same blindness `outcome: 'empty-after-retry'` had before #888 —
9122
+ * a degradation wearing the shape of normal control flow.
9123
+ *
9124
+ * It matters here because topics feed the entity recall lane, so a silently
9125
+ * failing sweep means memories that exist but cannot be found by entity, with
9126
+ * nothing in production saying so.
9127
+ *
9128
+ * Populated in lockstep with `skippedIds` (single `skip()` helper), so the two
9129
+ * cannot drift. Group by {@link isDegradedTopicSkip} to separate "declined" from
9130
+ * "broke".
9131
+ */
9132
+ skippedReasons: Map<string, TopicSkipReason>;
9133
+ }
9134
+ /**
9135
+ * Run LLM topic extraction over existing vault memories and persist the
9136
+ * results: REPLACE each memory's auto-managed entity links with the extracted
9137
+ * set (via {@link replaceMemoryEntitiesGuardedOp} — an edited memory drops the
9138
+ * entities its previous content mentioned) and stamp `topics_extracted_at`.
9139
+ *
9140
+ * User intent is enforced twice: rows already user-managed are skipped up
9141
+ * front, and the replace write re-checks the vault row INSIDE its writer
9142
+ * (user-managed / deleted / absent ⇒ null, and the memory is neither linked
9143
+ * nor stamped) so a manual topic edit or delete landing during the LLM
9144
+ * round-trip wins — a manual edit's own replace semantics also erase anything
9145
+ * this pass linked just before it. The watermark is captured BEFORE contents
9146
+ * are read: an edit landing mid-run keeps `updated_at` > stamp, so the next
9147
+ * sweep re-extracts it rather than trusting this run's stale read.
9148
+ *
9149
+ * Requires `ctx.entityCtx`. Contents are decrypted via the ctx's wallet
9150
+ * fields, exactly like the vault read ops; a memory whose decryption fails is
9151
+ * skipped (retried next sweep), not fatal to the run.
9152
+ *
9153
+ * @deprecated App code: use `MemoryStore.maintenance.extractTopics` (`createLocalMemoryStore`).
9154
+ */
9155
+ declare function extractAndLinkEntitiesForMemoriesOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[], options: TopicExtractOptions & {
9156
+ /** Watermark timestamp (Unix ms) recorded as `topics_extracted_at`.
9157
+ * Defaults to now; tests pass a fixed value. */
9158
+ now?: number;
9159
+ }): Promise<TopicExtractionRunResult>;
9160
+
9161
+ /**
9162
+ * Read filter for {@link MemoryStore.list}. Same semantics as the vault read
9163
+ * ops: every non-visible state (deleted, archived, quarantined, superseded) is
9164
+ * hidden by default and has its own opt-in flag.
9165
+ * @public
9166
+ */
9167
+ interface MemoryListOptions {
9168
+ scopes?: string[];
9169
+ /** Only memories updated after this instant (results then sort by `updatedAt`). */
9170
+ since?: Date;
9171
+ limit?: number;
9172
+ /** Restrict to these ids. Absent or foreign ids are dropped, never an error. */
9173
+ memoryIds?: string[];
9174
+ factTypes?: string[];
9175
+ /** People Nearby visibility filter; a legacy NULL column reads as "private". */
9176
+ visibility?: VaultMemoryVisibility[];
9177
+ /** Memory Graph "forgotten" nodes — rows carry `isDeleted: true`. */
9178
+ includeDeleted?: boolean;
9179
+ includeArchived?: boolean;
9180
+ includeQuarantined?: boolean;
9181
+ /** Memory history — rows carry `supersededBy`. */
9182
+ includeSuperseded?: boolean;
9183
+ }
9184
+ /**
9185
+ * A manual memory save. Creation uses private visibility, manual provenance
9186
+ * and a proof count of one. Missing embeddings are filled in the background.
9187
+ * Publication uses `setVisibility`; extraction uses `retain`. Migration and
9188
+ * restore use the dedicated lower-level vault/import operations rather than
9189
+ * passing provenance, trust or publication metadata through manual creation.
9190
+ * @public
9191
+ */
9192
+ type MemoryCreate = Pick<CreateVaultMemoryOptions, "content" | "scope" | "factType" | "eventTime" | "embedding" | "embeddingModel" | "geohash">;
9193
+ /**
9194
+ * The edits an app makes to an existing memory. Deliberately narrower than
9195
+ * {@link UpdateVaultMemoryOptions}: the re-observation knobs (`proofCountIncrement`,
9196
+ * `observationSourceIds`, `preserveUpdatedAt`, `restore`, `lastObservedAt`, …)
9197
+ * belong to `retain()` and backup sync, and an HTTP backend should never have
9198
+ * to accept them from a client. No `folderId` either: vault folders are gone
9199
+ * from the server surface (they leaked across tenants), so a remote backend
9200
+ * could not honour it.
9201
+ *
9202
+ * Omitting `embedding` drops the stored vector (and its model tag) and the
9203
+ * store re-embeds the new content in the background — useChatStorage's edit
9204
+ * behaviour, so an edit never keeps a vector for text that is gone. Pass
9205
+ * `embedding` (with `embeddingModel`) only when you already have the new one.
9206
+ * @public
9207
+ */
9208
+ type MemoryUpdate = Pick<UpdateVaultMemoryOptions, "content" | "scope" | "factType" | "eventTime" | "embedding" | "embeddingModel">;
9209
+ /**
9210
+ * Fact-only recall. Conversation chunks are message storage, not memory, so
9211
+ * the chunk-lane knobs are not part of this surface; nor is `folderId` (see
9212
+ * {@link MemoryUpdate}).
9213
+ *
9214
+ * DEVICE-LOCAL: `decomposeOptions` (portal credentials) and `onDiagnostics` (a
9215
+ * callback) configure work on the device, including with a remote store.
9216
+ * Query embedding/decomposition and the decrypted recall pipeline stay on the
9217
+ * device. Nearby ranks encrypted rows using embeddings and metadata; credentials
9218
+ * and callbacks are never forwarded to it.
9219
+ * @public
9220
+ */
9221
+ type MemoryRecallOptions = Omit<RecallOptions, "types" | "includeChunks" | "conversationId" | "excludeConversationId" | "folderId">;
9222
+ /**
9223
+ * `retain()` options minus `folderId` (see {@link MemoryUpdate}).
9224
+ *
9225
+ * DEVICE-LOCAL: `consolidateOptions` carries portal credentials, an `onFallback`
9226
+ * callback and possibly a `PiiRedactor` instance — it configures the
9227
+ * consolidation LLM call on the device. A remote store fetches encrypted
9228
+ * candidates, decrypts and consolidates them on the device, then persists
9229
+ * encrypted results through versioned writes. Nearby holds no decryption key
9230
+ * and never receives these credentials, callbacks or redactor instances.
9231
+ * @public
9232
+ */
9233
+ type MemoryRetainOptions = Omit<RetainOptions, "folderId">;
9234
+ /** @public */
9235
+ interface MemorySubscribeOptions {
9236
+ /**
9237
+ * Watch the whole table, soft-deleted rows included, and fire on row-SET
9238
+ * changes only (create / delete / undelete) — the Memory Graph's mode. A
9239
+ * column-aware watch would re-fire on every row a decay sweep archives.
9240
+ * Default `false`: watch live rows for user-visible edits and list membership
9241
+ * changes. Background embedding, proof and watermark bookkeeping does not
9242
+ * trigger default notifications.
9243
+ */
9244
+ includeDeleted?: boolean;
9245
+ /** Also fire when topic (entity / link) state changes. Default `false`. */
9246
+ topics?: boolean;
9247
+ /**
9248
+ * Also fire for embedding vector/model changes. Default `false`.
9249
+ * Ignored when `includeDeleted` is `true`, which remains membership-only.
9250
+ */
9251
+ embeddings?: boolean;
9252
+ }
9253
+ /**
9254
+ * Background jobs that keep a LOCAL store healthy.
9255
+ *
9256
+ * TRANSITIONAL local-vault plumbing. A remote store may omit these hooks, but
9257
+ * their absence does not mean plaintext-dependent work moves to nearby.
9258
+ * Topic extraction and other jobs that need decrypted memory content remain
9259
+ * on the device and persist encrypted rows/metadata through the remote store.
9260
+ * Metadata-only maintenance can run server-side. Nothing here should gain a
9261
+ * new caller that isn't a background worker.
9262
+ *
9263
+ * Not here on purpose: the client's quality sweep (`list` + `delete`) and
9264
+ * folder→topic migration (`list` + `topicsByMemories` + `addTopics`) compose
9265
+ * from the main interface.
9266
+ * @public
9267
+ */
9268
+ interface MemoryMaintenance {
9269
+ /** Decay sweeper bound to this store's vault (see `createDecaySweeper`). */
9270
+ createDecaySweeper(options?: Omit<CreateDecaySweeperOptions, "vaultCtx">): DecaySweeper;
9271
+ /** One page of the topic-extraction backlog (see `getMemoriesNeedingTopicExtractionOp`). */
9272
+ getTopicBacklog(options?: {
9273
+ limit?: number;
9274
+ }): Promise<MemoriesNeedingTopicExtraction>;
9275
+ /** LLM topic extraction + link + stamp for these memories. */
9276
+ extractTopics(memoryIds: readonly string[], options: TopicExtractOptions & {
9277
+ now?: number;
9278
+ }): Promise<TopicExtractionRunResult>;
9279
+ /** Grandfather already-linked rows without an LLM call. Returns the ids stamped. */
9280
+ stampTopicsExtracted(memoryIds: readonly string[], extractedAt: number, version?: number): Promise<string[]>;
9281
+ /** Rebuild the local link index from each row's synced `topics`. Returns the ids relinked. */
9282
+ relinkTopics(memoryIds: readonly string[]): Promise<string[]>;
9283
+ /** Fill `topics` on pre-v42 rows from their existing links. Returns the ids filled. */
9284
+ backfillTopics(memoryIds: readonly string[]): Promise<string[]>;
9285
+ }
9286
+ /**
9287
+ * One user's memories, pitched at what the apps do with them rather than at
9288
+ * the storage ops underneath. Two backends are intended: the on-device
9289
+ * WatermelonDB vault ({@link createLocalMemoryStore}) and, later, an HTTP
9290
+ * client for the server-side store.
9291
+ *
9292
+ * Every value crossing this interface is plain data — no WatermelonDB Model,
9293
+ * Query or Collection — so a remote backend can serialize it. The one
9294
+ * exception is the DEVICE-LOCAL LLM-call knobs on {@link MemoryRecallOptions}
9295
+ * and {@link MemoryRetainOptions}, which a remote store uses on the device
9296
+ * rather than forwarding to nearby. Server persistence is authoritative;
9297
+ * content decryption and plaintext-dependent processing remain on the device. Reads are
9298
+ * whole-result rather than per-row so a chat turn costs a handful of calls
9299
+ * (`recall`, then `retain` per fact), not one per memory.
9300
+ *
9301
+ * Writes resolve `null` / `false` for a memory that is missing, deleted or
9302
+ * not owned by this store's user; they don't throw for it.
9303
+ * @public
9304
+ */
9305
+ interface MemoryStore {
9306
+ /** Memories newest-first, decrypted, WITH `embedding` (Memory Graph edges read it). */
9307
+ list(options?: MemoryListOptions): Promise<StoredVaultMemory[]>;
9308
+ get(id: string): Promise<StoredVaultMemory | null>;
9309
+ /** Decay-archived memories (not deleted, quarantined or superseded), most recently archived first. */
9310
+ listArchived(): Promise<StoredVaultMemory[]>;
9311
+ /** Memory id → which of `names` it is linked to. Names are matched case-insensitively. */
9312
+ memoriesByTopics(names: readonly string[]): Promise<Map<string, Set<string>>>;
9313
+ /** Memory id → its canonical (lowercased) topic names. Unlinked ids are absent. */
9314
+ topicsByMemories(memoryIds: readonly string[]): Promise<Map<string, Set<string>>>;
9315
+ /** Manual save; missing embeddings are filled in the background. */
9316
+ create(input: MemoryCreate): Promise<StoredVaultMemory>;
9317
+ /** One write for a batch of manual saves; migration/restore uses lower-level operations. */
9318
+ createMany(inputs: MemoryCreate[]): Promise<StoredVaultMemory[]>;
9319
+ update(id: string, patch: MemoryUpdate): Promise<StoredVaultMemory | null>;
9320
+ /** Soft delete; also drops the memory's topic links. */
9321
+ delete(id: string): Promise<boolean>;
9322
+ /** Retire `id` behind the newer `supersededById` (both must be live and owned). */
9323
+ supersede(id: string, supersededById: string): Promise<boolean>;
9324
+ archive(id: string): Promise<boolean>;
9325
+ restore(id: string): Promise<boolean>;
9326
+ /** Replace the memory's topics with a user-chosen set and stop auto-tagging it. */
9327
+ setTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredVaultMemory | null>;
9328
+ /** Add topics alongside the existing ones (auto-tagging stays on). */
9329
+ addTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredEntity[]>;
9330
+ setVisibility(id: string, visibility: VaultMemoryVisibility, options?: {
9331
+ twinOptIn?: boolean;
9332
+ }): Promise<StoredVaultMemory | null>;
9333
+ recall(query: string, options?: MemoryRecallOptions): Promise<RecallResult>;
9334
+ retain(content: string, options?: MemoryRetainOptions): Promise<RetainResult>;
9335
+ /**
9336
+ * Call `onChange` after the store's memories change; re-read to see what
9337
+ * changed. Does not fire for the state at subscription time — read once
9338
+ * after subscribing. Returns the unsubscribe function.
9339
+ */
9340
+ subscribe(onChange: () => void, options?: MemorySubscribeOptions): () => void;
9341
+ /** TRANSITIONAL — see {@link MemoryMaintenance}. Absent on a remote backend. */
9342
+ maintenance?: MemoryMaintenance;
9343
+ }
9344
+
9345
+ /** @public */
9346
+ interface LocalMemoryStoreOptions {
9347
+ /** A database built from `sdkSchema` (memory_vault + entity + memory_entity). */
9348
+ database: Database;
9349
+ /** With `signMessage`, encrypts content on write and decrypts on read. */
9350
+ walletAddress?: string;
9351
+ signMessage?: SignMessageFn;
9352
+ embeddedWalletSigner?: EmbeddedWalletSignerFn;
9353
+ /**
9354
+ * Scope every read/write to this user — for a shared, multi-tenant database
9355
+ * whose rows all carry their `user_id`. Rows with no `user_id` are invisible
9356
+ * to a scoped store, so the per-wallet client DBs (every useChatStorage row is
9357
+ * `user_id = null`) use `singleTenant` instead, exactly like useChatStorage's
9358
+ * vault ctx.
9359
+ */
9360
+ userId?: string;
9361
+ /**
9362
+ * The database holds exactly one owner's rows (the per-wallet client DBs).
9363
+ * Required for the decay sweep to run without `userId` — see
9364
+ * `VaultMemoryOperationsContext.singleTenant`.
9365
+ */
9366
+ singleTenant?: boolean;
9367
+ /** Admit pre-v31 `user_id = null` link rows alongside `userId`'s (LokiJS web). */
9368
+ allowUnscopedRows?: boolean;
9369
+ /** Embedding API options for `recall` / `retain`. */
9370
+ embeddingOptions: EmbeddingOptions;
9371
+ /** Share a warm cache with other recall surfaces; one is created when omitted. */
9372
+ vaultCache?: VaultEmbeddingCache;
9373
+ }
9374
+ /**
9375
+ * {@link MemoryStore} over the on-device WatermelonDB vault. Builds the vault +
9376
+ * entity contexts once and delegates every method to the existing ops, so
9377
+ * behavior is exactly theirs.
9378
+ * @public
9379
+ */
9380
+ declare function createLocalMemoryStore(options: LocalMemoryStoreOptions): MemoryStore;
9381
+
8950
9382
  /**
8951
9383
  * synthesizeProfile — client-side profile synthesis for People Nearby (C1).
8952
9384
  *
@@ -9131,174 +9563,6 @@ interface SynthesizeProfileOptions extends PortalLlmAuth {
9131
9563
  */
9132
9564
  declare function synthesizeProfile(ctx: RecallContext, options?: SynthesizeProfileOptions): Promise<ProfileDoc>;
9133
9565
 
9134
- /**
9135
- * Standalone topic (entity) extraction for EXISTING memories.
9136
- *
9137
- * The conversation pipeline (autoExtract.ts) assigns entities only to facts it
9138
- * extracts from a live transcript — manually created, imported, and edited
9139
- * memories never get LLM topics and used to fall back to a client-side regex.
9140
- * This module is the LLM half of "continuously LLM-managed topics": a batched
9141
- * pass that takes memories already in the vault, asks the extraction model for
9142
- * their named entities, REPLACES their auto-managed links (guarded — a manual
9143
- * edit or delete always wins), and stamps `topics_extracted_at` so the sweep
9144
- * query (`getMemoriesNeedingTopicExtractionOp`) only revisits edited memories.
9145
- *
9146
- * Batching: memories are classified ~10 per LLM call (mirroring the folder
9147
- * Auto-Sort harness) with per-memory content truncation, so a whole-vault
9148
- * backfill or a bulk import costs ceil(n/10) requests, not n.
9149
- */
9150
-
9151
- /** Memories per LLM call. Mirrors the folder Auto-Sort batch size — the cost
9152
- * lever that makes a whole-vault backfill viable. */
9153
- declare const TOPIC_EXTRACTION_BATCH_SIZE = 10;
9154
- /** One memory to extract topics for. `content` must be the DECRYPTED text. */
9155
- interface TopicExtractionInput {
9156
- id: string;
9157
- content: string;
9158
- }
9159
- /**
9160
- * Options for the topic-extraction LLM call. Auth follows the portal dual
9161
- * pattern — one of `apiKey` / `getToken` is required (see {@link PortalLlmAuth}).
9162
- */
9163
- interface TopicExtractOptions extends PortalLlmAuth {
9164
- baseUrl?: string;
9165
- /**
9166
- * Optional per-call request path override, forwarded to
9167
- * {@link callPortalJsonCompletion}. When set, topic extraction POSTs to
9168
- * `baseUrl + endpointOverride` instead of the default
9169
- * `/api/v1/chat/completions`. The body follows the transport, not the path: a
9170
- * model that needs the Responses API is moved from a `.../chat/completions`
9171
- * override to its sibling `.../responses` with a Responses-shaped body. Lets callers route
9172
- * this internal-utility pass to a dedicated endpoint. Invalid values throw at
9173
- * call time (see {@link validateEndpointOverride}).
9174
- */
9175
- endpointOverride?: string;
9176
- /** Defaults to {@link DEFAULT_EXTRACTION_MODEL} — the sanctioned extraction
9177
- * model. Don't point this at a second model without an eval. */
9178
- model?: string;
9179
- /** Override the global fetch implementation (useful for tests). */
9180
- fetchFn?: typeof fetch;
9181
- maxAttempts?: number;
9182
- timeoutMs?: number;
9183
- totalTimeoutMs?: number;
9184
- backoffMs?: (attempt: number) => number;
9185
- /**
9186
- * The user's existing entity vocabulary (canonical names). Included in the
9187
- * prompt so independent batches reuse canonical names instead of fragmenting
9188
- * ("ZetaChain" / "Zetachain" / "zeta chain" as three graph nodes). Truncated
9189
- * to the first {@link MAX_VOCABULARY_NAMES} names — pass the most-linked
9190
- * names first.
9191
- */
9192
- existingEntityNames?: readonly string[];
9193
- /**
9194
- * When set, PII in memory contents is replaced with tagged placeholders
9195
- * before the LLM call and returned entity names are de-anonymized (entities
9196
- * whose placeholders can't be restored are dropped) — mirrors
9197
- * `ExtractFactsOptions.piiRedaction`. Vault contents hold REAL values, so
9198
- * callers that redact the conversation pipeline must redact this pass too.
9199
- */
9200
- piiRedaction?: boolean | PiiRedactor;
9201
- }
9202
- /**
9203
- * Ask the extraction LLM for the named entities of each memory, in batches of
9204
- * {@link TOPIC_EXTRACTION_BATCH_SIZE}. Pure LLM step — no persistence.
9205
- *
9206
- * Returns memoryId → entities. A memory PRESENT with an empty array is a
9207
- * successful, explicit "no named entities" answer; a memory ABSENT from the
9208
- * map is UNANSWERED — its batch failed after retries, returned an unusable
9209
- * shape, or the model omitted its id. Callers must retry absent ids in a
9210
- * later sweep, never stamp them.
9211
- */
9212
- declare function extractEntitiesForMemories(memories: readonly TopicExtractionInput[], options: TopicExtractOptions): Promise<Map<string, ExtractedEntity[]>>;
9213
- /**
9214
- * Why one memory was skipped by a topic sweep.
9215
- *
9216
- * Split along the line that actually matters operationally — did the sweep
9217
- * DECLINE this row on purpose, or did something BREAK:
9218
- *
9219
- * Deliberate (healthy; a sweep of nothing but these is a success):
9220
- * - `excluded` — deleted, owned by another user, or `topicsUserManaged`.
9221
- * - `link-declined` — the entity-link write's in-row guard declined (the row
9222
- * became user-managed / deleted / absent mid-run).
9223
- * - `stamp-declined` — same, caught by the stamp op's own re-check.
9224
- *
9225
- * Degraded (something is wrong; see {@link isDegradedTopicSkip}):
9226
- * - `llm-unanswered` — the batch failed or the model omitted this id. THE one
9227
- * to alarm on: it is how a wholly broken sweep looks.
9228
- * - `unreadable` — the row could not be loaded/decrypted.
9229
- * - `not-found` — the lookup threw (absent row or read fault).
9230
- * - `link-failed` — the entity-link write threw.
9231
- *
9232
- * @public
9233
- */
9234
- type TopicSkipReason = "excluded" | "link-declined" | "stamp-declined" | "llm-unanswered" | "unreadable" | "not-found" | "link-failed";
9235
- /**
9236
- * Whether a skip reason means the sweep FAILED on that row, rather than
9237
- * deliberately passing over it.
9238
- *
9239
- * Exported so callers classify identically instead of each re-deriving the
9240
- * split — the reason this type exists is that one wrong grouping turns a broken
9241
- * sweep back into a healthy-looking one.
9242
- *
9243
- * @public
9244
- */
9245
- declare function isDegradedTopicSkip(reason: TopicSkipReason): boolean;
9246
- /** Outcome of one {@link extractAndLinkEntitiesForMemoriesOp} run. */
9247
- interface TopicExtractionRunResult {
9248
- /** memoryId → entities the LLM returned (post-validation, post-linking). */
9249
- entitiesByMemory: Map<string, ExtractedEntity[]>;
9250
- /** Memories stamped `topics_extracted_at` this run — includes zero-entity
9251
- * results so quiet memories aren't re-asked every sweep. */
9252
- stampedIds: string[];
9253
- /** Memories NOT processed: missing/deleted/foreign rows, user-managed rows
9254
- * (including ones that became user-managed mid-run), and members of failed
9255
- * LLM batches. Skipped ids are not stamped, so failed batches are retried
9256
- * by a later sweep — callers should apply their own attempt caps. */
9257
- skippedIds: string[];
9258
- /**
9259
- * Why each id in {@link skippedIds} was skipped.
9260
- *
9261
- * `skippedIds` alone cannot distinguish a sweep that deliberately declined
9262
- * work from one that FAILED: a run where every LLM batch errored and a run
9263
- * over rows the user has taken manual control of produce an identical array.
9264
- * That is the same blindness `outcome: 'empty-after-retry'` had before #888 —
9265
- * a degradation wearing the shape of normal control flow.
9266
- *
9267
- * It matters here because topics feed the entity recall lane, so a silently
9268
- * failing sweep means memories that exist but cannot be found by entity, with
9269
- * nothing in production saying so.
9270
- *
9271
- * Populated in lockstep with `skippedIds` (single `skip()` helper), so the two
9272
- * cannot drift. Group by {@link isDegradedTopicSkip} to separate "declined" from
9273
- * "broke".
9274
- */
9275
- skippedReasons: Map<string, TopicSkipReason>;
9276
- }
9277
- /**
9278
- * Run LLM topic extraction over existing vault memories and persist the
9279
- * results: REPLACE each memory's auto-managed entity links with the extracted
9280
- * set (via {@link replaceMemoryEntitiesGuardedOp} — an edited memory drops the
9281
- * entities its previous content mentioned) and stamp `topics_extracted_at`.
9282
- *
9283
- * User intent is enforced twice: rows already user-managed are skipped up
9284
- * front, and the replace write re-checks the vault row INSIDE its writer
9285
- * (user-managed / deleted / absent ⇒ null, and the memory is neither linked
9286
- * nor stamped) so a manual topic edit or delete landing during the LLM
9287
- * round-trip wins — a manual edit's own replace semantics also erase anything
9288
- * this pass linked just before it. The watermark is captured BEFORE contents
9289
- * are read: an edit landing mid-run keeps `updated_at` > stamp, so the next
9290
- * sweep re-extracts it rather than trusting this run's stale read.
9291
- *
9292
- * Requires `ctx.entityCtx`. Contents are decrypted via the ctx's wallet
9293
- * fields, exactly like the vault read ops; a memory whose decryption fails is
9294
- * skipped (retried next sweep), not fatal to the run.
9295
- */
9296
- declare function extractAndLinkEntitiesForMemoriesOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[], options: TopicExtractOptions & {
9297
- /** Watermark timestamp (Unix ms) recorded as `topics_extracted_at`.
9298
- * Defaults to now; tests pass a fixed value. */
9299
- now?: number;
9300
- }): Promise<TopicExtractionRunResult>;
9301
-
9302
9566
  /**
9303
9567
  * Post-hoc support verification for extracted memories (#707).
9304
9568
  *
@@ -11401,4 +11665,4 @@ declare function createNotionTools(getAccessToken: () => string | null, requestN
11401
11665
  */
11402
11666
  declare function createNotionProxyTools(callMcp: NotionMcpCaller): ToolConfig[];
11403
11667
 
11404
- export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DurableAutoExtractorOptions, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionMcpCaller, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, 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 StreamSmoothingConfig, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryTopicsOp, buildAttachedFilesText, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
11668
+ export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DurableAutoExtractorOptions, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCreate, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryListOptions, type MemoryMaintenance, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionMcpCaller, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, 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 StreamSmoothingConfig, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryTopicsOp, buildAttachedFilesText, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };