@anuma/sdk 10.3.1 → 10.4.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.
@@ -1,4 +1,4 @@
1
- import { Database, Model, Collection } from '@nozbe/watermelondb';
1
+ import { Model, Database, Collection } from '@nozbe/watermelondb';
2
2
  import Model$1, { Associations } from '@nozbe/watermelondb/Model';
3
3
  import * as _nozbe_watermelondb_Schema_migrations from '@nozbe/watermelondb/Schema/migrations';
4
4
  import * as _nozbe_watermelondb_Schema from '@nozbe/watermelondb/Schema';
@@ -3063,6 +3063,213 @@ declare function createWebSearchPreProcessor(options?: WebSearchPreProcessorOpti
3063
3063
  */
3064
3064
  declare const xhrTransport: StreamingTransport;
3065
3065
 
3066
+ declare class VaultMemory extends Model {
3067
+ static table: string;
3068
+ content: string;
3069
+ scope: string;
3070
+ /** Profile kind, or null for a free-form memory. */
3071
+ kind: string | null;
3072
+ /** Canonical JSON value of a kinded memory, encrypted at rest. */
3073
+ kindValue: string | null;
3074
+ /** private | matching | profile. */
3075
+ level: string | null;
3076
+ folderId: string | null;
3077
+ userId: string | null;
3078
+ embedding: string | null;
3079
+ /** Model that produced `embedding`. Null on legacy rows (grandfathered). */
3080
+ embeddingModel: string | null;
3081
+ sourceChunkIds: string | null;
3082
+ proofCount: number | null;
3083
+ source: string | null;
3084
+ /** W6 temporal lane — Unix ms timestamp of when the event occurred. */
3085
+ eventTimeStart: number | null;
3086
+ /** W6 temporal lane — Unix ms timestamp of event end (range/ongoing). */
3087
+ eventTimeEnd: number | null;
3088
+ /** W6 temporal lane — `point | range | ongoing | null`. */
3089
+ eventTimeKind: string | null;
3090
+ /** When true, the user has manually set this memory's topics; auto-extraction
3091
+ * leaves its entity links alone. Null on legacy rows (treated as false). */
3092
+ topicsUserManaged: boolean | null;
3093
+ /** The durable, synced record of this memory's topics — JSON `StoredTopic[]`.
3094
+ * `entity` / `memory_entity` are a device-local index over it. Null = pre-v42
3095
+ * (backfilled from the row's current links by the sweep). */
3096
+ topics: string | null;
3097
+ /** Unix ms of the last `topics` write. Separate from `updated_at`, which every
3098
+ * topic writer pins on purpose (recall recency) — see the schema note. */
3099
+ topicsUpdatedAt: number | null;
3100
+ /** The photo(s) a SERVER-EXTRACTED memory came from — JSON
3101
+ * `[{feed_item_id, object_key}]`, exactly the shape
3102
+ * GET /api/memories/published returns. Null on anything not from a photo. */
3103
+ media: string | null;
3104
+ /** Unix ms of the last LLM topic-extraction pass. Null = never extracted
3105
+ * standalone (linked legacy rows are grandfathered as extracted).
3106
+ * DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
3107
+ topicsExtractedAt: number | null;
3108
+ /** A2 supersession: newer memory id that replaced this one, or null if live. */
3109
+ supersededBy: string | null;
3110
+ supersededAt: number | null;
3111
+ /** Extraction-logic version this memory was last stamped under. Null (pre-v38)
3112
+ * reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows.
3113
+ * DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
3114
+ topicsExtractedVersion: number | null;
3115
+ /** C3 re-observation watermark: Unix ms of the last retain() merge, or null. */
3116
+ lastObservedAt: number | null;
3117
+ /** Typed memory (PR1) — the extractor's FactType. Null on legacy/manual rows. */
3118
+ factType: string | null;
3119
+ /** Decay archive state (PR2) — Unix ms when archived, null when active. */
3120
+ archivedAt: number | null;
3121
+ /** Tier-0 security (PR3) — "quarantined" | "trusted" | null. */
3122
+ trustTier: string | null;
3123
+ /** People Nearby visibility: 'private' | 'public'. Null on legacy rows, and
3124
+ * any unrecognised value, read as 'private' — never published without opt-in. */
3125
+ visibility: string | null;
3126
+ /** Owner opted this memory into their own digital twin (twin-scoped only). */
3127
+ twinOptIn: boolean | null;
3128
+ /** Unix ms when visibility last became non-private; null while private. */
3129
+ publishedAt: number | null;
3130
+ /** Reserved coarse-geohash slot for landmark/Trail memories. */
3131
+ geohash: string | null;
3132
+ createdAt: Date;
3133
+ updatedAt: Date;
3134
+ isDeleted: boolean;
3135
+ }
3136
+
3137
+ /**
3138
+ * A canonical entity (person, place, thing) extracted from the user's
3139
+ * conversations. Many-to-many with vault memories via {@link MemoryEntity}.
3140
+ *
3141
+ * Created on the write path by the auto-extraction worker (W2) when a
3142
+ * candidate fact arrives with non-empty `entities[]`. Used at retrieval
3143
+ * time as a 3rd RRF lane (W5 graph traversal): query entity overlap
3144
+ * with stored memories surfaces topically-related facts that pure
3145
+ * semantic search misses.
3146
+ */
3147
+ declare class Entity extends Model {
3148
+ static table: string;
3149
+ /** Lowercased, trimmed name used for dedup and lookup. */
3150
+ canonicalName: string;
3151
+ /** Optional category — "person" | "place" | "thing" | "concept" | etc. */
3152
+ kind: string | null;
3153
+ createdAt: Date;
3154
+ updatedAt: Date;
3155
+ }
3156
+ /**
3157
+ * Join row: a memory references an entity (and vice versa). Multiple
3158
+ * rows per memory (one per entity) and per entity (one per memory).
3159
+ */
3160
+ declare class MemoryEntity extends Model {
3161
+ static table: string;
3162
+ memoryId: string;
3163
+ entityId: string;
3164
+ /**
3165
+ * User-scope for the W5 graph lane. Optional because client-side
3166
+ * (single-user) deployments may leave it null; server-side multi-user
3167
+ * deployments must set it so retrieval can filter cross-user IDs.
3168
+ */
3169
+ userId: string | null;
3170
+ createdAt: Date;
3171
+ }
3172
+
3173
+ /**
3174
+ * The recognized entity classifications. Runtime list + derived type kept
3175
+ * in one place so the extractor's validation and the `EntityKind` union
3176
+ * can't drift apart.
3177
+ * @public
3178
+ */
3179
+ declare const ENTITY_KINDS: readonly ["person", "organization", "place", "event", "product", "thing", "concept", "other"];
3180
+ /** @public */
3181
+ type EntityKind = (typeof ENTITY_KINDS)[number];
3182
+ interface StoredEntity {
3183
+ uniqueId: string;
3184
+ canonicalName: string;
3185
+ kind: string | null;
3186
+ createdAt: Date;
3187
+ updatedAt: Date;
3188
+ }
3189
+ /**
3190
+ * Who put a topic on a memory. Written to `memory_vault.topics` but not yet
3191
+ * READ anywhere — it exists so a later improvement can refresh the `auto`
3192
+ * entries of a curated memory while leaving `user` entries alone (today
3193
+ * `topics_user_managed` is all-or-nothing per memory) without needing a second
3194
+ * migration or backfill. Don't build that behavior off it yet.
3195
+ *
3196
+ * When you do: a value written by the v42 backfill is NOT ground truth. Pre-v42
3197
+ * rows carry no per-topic provenance, so `backfillMemoryTopicsOp` derives it
3198
+ * from the per-memory `topics_user_managed` flag and stamps a curated legacy
3199
+ * row's every topic `user` — see the note at that derivation.
3200
+ * @public
3201
+ */
3202
+ type TopicSource = "user" | "auto";
3203
+ /**
3204
+ * One entry in `memory_vault.topics` — the durable, synced record of a memory's
3205
+ * topics. `name` carries the CALLER's display casing, unlike
3206
+ * {@link StoredEntity.canonicalName}, which {@link normalizeEntityName}
3207
+ * lowercases and which has no display column: preserving casing here is the
3208
+ * point of storing names on the memory row.
3209
+ * @public
3210
+ */
3211
+ interface StoredTopic {
3212
+ name: string;
3213
+ kind?: string;
3214
+ source: TopicSource;
3215
+ /** How central the topic is to the memory, in (0, 1]; read it with {@link topicWeight}. */
3216
+ weight?: number;
3217
+ }
3218
+ /**
3219
+ * Fixed weight per salience level the topic extractor assigns.
3220
+ * @public
3221
+ */
3222
+ declare const TOPIC_SALIENCE_WEIGHTS: {
3223
+ readonly primary: 1;
3224
+ readonly secondary: 0.6;
3225
+ readonly mention: 0.3;
3226
+ };
3227
+ /** @public */
3228
+ type TopicSalience = keyof typeof TOPIC_SALIENCE_WEIGHTS;
3229
+ /**
3230
+ * A topic's weight: 1 when it is user-set or carries no weight.
3231
+ * @public
3232
+ */
3233
+ declare function topicWeight(topic: StoredTopic): number;
3234
+ /**
3235
+ * The first topic with the highest weight, or null when there are none.
3236
+ * @public
3237
+ */
3238
+ declare function primaryTopic(topics: readonly StoredTopic[] | null | undefined): StoredTopic | null;
3239
+
3240
+ /**
3241
+ * Accepted entity shape for {@link linkMemoryEntitiesOp}. A bare string is
3242
+ * a name with no kind (back-compat with the original signature); the object
3243
+ * form carries an optional classification.
3244
+ * @public
3245
+ */
3246
+ type EntityInput = string | {
3247
+ name: string;
3248
+ kind?: EntityKind | (string & {});
3249
+ weight?: number;
3250
+ };
3251
+ interface EntityOperationsContext {
3252
+ database: Database;
3253
+ entityCollection: Collection<Entity>;
3254
+ memoryEntityCollection: Collection<MemoryEntity>;
3255
+ /**
3256
+ * Optional user-scope. When provided, `linkMemoryEntitiesOp` stamps
3257
+ * `user_id` on new memory_entity rows and `getMemoriesByEntityNamesOp`
3258
+ * filters lookups by it. Leave undefined for single-user clients.
3259
+ */
3260
+ userId?: string;
3261
+ /**
3262
+ * When `true`, `getMemoriesByEntityNamesOp` admits rows with
3263
+ * `user_id = null` alongside the strict `userId` match. Set this on
3264
+ * LokiJS (web) adapters where the v31 `unsafeExecuteSql` backfill
3265
+ * is a no-op — pre-v31 rows otherwise become invisible to the W5
3266
+ * lane until `backfillMemoryEntityUserIdsOp` runs. Default `false`
3267
+ * (server / SQLite, where the migration backfill is authoritative).
3268
+ */
3269
+ allowUnscopedRows?: boolean;
3270
+ canWrite?: () => Promise<boolean>;
3271
+ }
3272
+
3066
3273
  /**
3067
3274
  * Encryption key version type.
3068
3275
  * - "v2": Legacy SHA-256 derived key (for reading enc:v2: data)
@@ -3363,439 +3570,34 @@ interface UseEncryptionResult {
3363
3570
  * // This will prompt user to sign if key doesn't exist
3364
3571
  * await requestEncryptionKey(user.wallet.address);
3365
3572
  * }
3366
- * }, [user]);
3367
- * }
3368
- * ```
3369
- *
3370
- * @example
3371
- * ```tsx
3372
- * // ECDH key pair generation for end-to-end encryption
3373
- * import { usePrivy } from "@privy-io/react-auth";
3374
- * import { useEncryption } from "@anuma/sdk/react";
3375
- *
3376
- * function E2EEComponent() {
3377
- * const { signMessage } = usePrivy();
3378
- * const { requestKeyPair, exportPublicKey } = useEncryption(signMessage);
3379
- *
3380
- * const setupEncryption = async (walletAddress: string) => {
3381
- * // Generate deterministic ECDH key pair from wallet signature
3382
- * await requestKeyPair(walletAddress);
3383
- *
3384
- * // Export public key to share with others
3385
- * const publicKey = await exportPublicKey(walletAddress);
3386
- * console.log("Share this public key:", publicKey);
3387
- * };
3388
- * }
3389
- * ```
3390
- *
3391
- * @category Hooks
3392
- */
3393
- declare function useEncryption(signMessage: SignMessageFn, embeddedWalletSigner?: EmbeddedWalletSignerFn): UseEncryptionResult;
3394
-
3395
- type ChatRecordKind = "conversation" | "message" | "summary" | "project" | "memory_links";
3396
- type ChatJson = null | boolean | number | string | ChatJson[] | {
3397
- [key: string]: ChatJson;
3398
- };
3399
- /** Whole-record JSON data is encrypted on the device, including all text, vectors and tool events. */
3400
- interface ChatRecord {
3401
- kind: ChatRecordKind;
3402
- id: string;
3403
- conversationId: string;
3404
- sortKey: number;
3405
- createdAt: number;
3406
- updatedAt: number;
3407
- isDeleted: boolean;
3408
- data: {
3409
- [key: string]: ChatJson;
3410
- };
3411
- }
3412
- interface ChatSnapshot {
3413
- record: ChatRecord;
3414
- version: number;
3415
- serverUpdatedAt: string;
3416
- }
3417
- interface ChatWrite {
3418
- record: ChatRecord;
3419
- expectedVersion: number;
3420
- /** Sent and stored unencrypted so vault can run vector search. */
3421
- embeddings?: number[][];
3422
- embeddingModel?: string;
3423
- }
3424
- interface ChatRef {
3425
- kind: ChatRecordKind;
3426
- id: string;
3427
- }
3428
- type ChatAccountState = "none" | "migrating" | "active";
3429
- interface ChatAccount {
3430
- keyId: string;
3431
- state: ChatAccountState;
3432
- recordCount: number;
3433
- storageBytes: number;
3434
- vectorCount: number;
3435
- /** The newest change; read it before loading history and poll `changes` from it. Absent before the first record. */
3436
- changesCursor?: string;
3437
- }
3438
- interface ChatImport {
3439
- record: ChatRecord;
3440
- /** Sent and stored unencrypted so vault can run vector search. */
3441
- embeddings?: number[][];
3442
- embeddingModel?: string;
3443
- }
3444
- interface ChatRevision {
3445
- kind: ChatRecordKind;
3446
- id: string;
3447
- updatedAt: number;
3448
- isDeleted: boolean;
3449
- }
3450
- interface ChatChanges {
3451
- items: ChatSnapshot[];
3452
- nextCursor?: string;
3453
- changesCursor: string;
3454
- }
3455
- interface ChatSearchOptions {
3456
- limit?: number;
3457
- kinds?: ("message" | "summary")[];
3458
- conversationId?: string;
3459
- excludeConversationId?: string;
3460
- /** Ranks only vectors from this model; vectors stored without one always count. */
3461
- embeddingModel?: string;
3462
- signal?: AbortSignal;
3463
- }
3464
- interface ChatSearchHit extends ChatSnapshot {
3465
- chunk: number;
3466
- score: number;
3467
- }
3468
- interface ChatAttachment {
3469
- id: string;
3470
- sizeBytes: number;
3471
- state: "pending" | "committed";
3472
- ownerKind?: "message" | "summary";
3473
- ownerId?: string;
3474
- createdAt: string;
3475
- committedAt?: string;
3476
- }
3477
- interface ChatPresignedUrl {
3478
- url: string;
3479
- method: string;
3480
- headers: Record<string, string>;
3481
- expiresAt: string;
3482
- }
3483
- interface ChatAttachments {
3484
- create(sizeBytes: number, signal?: AbortSignal): Promise<{
3485
- attachment: ChatAttachment;
3486
- upload: ChatPresignedUrl;
3487
- }>;
3488
- commit(attachmentId: string, owner: {
3489
- kind: "message" | "summary";
3490
- id: string;
3491
- }, signal?: AbortSignal): Promise<ChatAttachment>;
3492
- get(attachmentId: string, signal?: AbortSignal): Promise<{
3493
- attachment: ChatAttachment;
3494
- download?: ChatPresignedUrl;
3495
- } | null>;
3496
- delete(attachmentId: string, signal?: AbortSignal): Promise<void>;
3497
- }
3498
- interface ChatListOptions {
3499
- kind: ChatRecordKind;
3500
- conversationId?: string;
3501
- includeDeleted?: boolean;
3502
- cursor?: string;
3503
- limit?: number;
3504
- signal?: AbortSignal;
3505
- }
3506
- interface ChatPage {
3507
- items: ChatSnapshot[];
3508
- nextCursor?: string;
3509
- total?: number;
3510
- }
3511
- /** Explicit versions protect edits; ambiguous writes are never replayed automatically. */
3512
- interface ChatStore {
3513
- get(kind: ChatRecordKind, id: string, signal?: AbortSignal): Promise<ChatSnapshot | null>;
3514
- list(options: ChatListOptions): Promise<ChatPage>;
3515
- putMany(writes: readonly ChatWrite[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
3516
- getMany(refs: readonly ChatRef[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
3517
- account(signal?: AbortSignal): Promise<ChatAccount>;
3518
- importRecords(records: readonly ChatImport[], signal?: AbortSignal): Promise<number>;
3519
- verify(revisions: readonly ChatRevision[], signal?: AbortSignal): Promise<ChatRef[]>;
3520
- activate(signal?: AbortSignal): Promise<boolean>;
3521
- changes(cursor?: string, options?: {
3522
- limit?: number;
3523
- signal?: AbortSignal;
3524
- }): Promise<ChatChanges>;
3525
- search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
3526
- deleteAll(signal?: AbortSignal): Promise<number>;
3527
- attachments: ChatAttachments;
3528
- }
3529
- interface RemoteChatStoreOptions {
3530
- baseUrl: string;
3531
- getToken: () => Promise<string | null>;
3532
- keyId: string;
3533
- encrypt: (plaintext: string) => Promise<string>;
3534
- decrypt: (ciphertext: string) => Promise<string>;
3535
- fetch?: typeof globalThis.fetch;
3536
- timeoutMs?: number;
3537
- signal?: AbortSignal;
3538
- }
3539
- declare class ChatStoreError extends Error {
3540
- readonly status: number;
3541
- readonly code?: string | undefined;
3542
- readonly retryAfterMs?: number | undefined;
3543
- constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
3544
- }
3545
-
3546
- interface ChatMigrationOptions {
3547
- /** The device's local chat database. */
3548
- database: Database;
3549
- /** Vault, opened with the account's canonical key. */
3550
- store: ChatStore;
3551
- walletAddress?: string;
3552
- signMessage?: SignMessageFn;
3553
- embeddedWalletSigner?: EmbeddedWalletSignerFn;
3554
- /** Runs the final pass while local chat writers are held, so nothing lands locally after it. */
3555
- withWriteBarrier: (task: () => Promise<ChatMigrationResult>) => Promise<ChatMigrationResult>;
3556
- /** Called once vault holds everything; hand the device over to vault here. */
3557
- onActivated: () => void | Promise<void>;
3558
- /** Activate even when some rows could not be read; they stay on the device. */
3559
- allowSkipped?: boolean;
3560
- maxVectors?: number;
3561
- maxStorageBytes?: number;
3562
- signal?: AbortSignal;
3563
- onProgress?: (progress: ChatMigrationProgress) => void;
3564
- }
3565
- interface ChatMigrationProgress {
3566
- imported: number;
3567
- toImport: number;
3568
- }
3569
- interface ChatMigrationSkip {
3570
- kind: ChatRecordKind;
3571
- id: string;
3572
- reason: "unreadable" | "invalid";
3573
- }
3574
- interface ChatMigrationResult {
3575
- state: "migrating" | "active";
3576
- conversations: number;
3577
- messages: number;
3578
- imported: number;
3579
- skipped: ChatMigrationSkip[];
3580
- /** Conversations whose title could not be decrypted and went up untitled. */
3581
- untitled: number;
3582
- /** Messages sent without vectors to stay inside the account's vector quota. */
3583
- unembedded: number;
3584
- /** Messages shrunk to fit vault's record limit. */
3585
- truncated: number;
3586
- }
3587
- /** Copies this device's chats to vault, verifies them under the write barrier, then activates vault and hands the device over. */
3588
- declare function migrateChatsToRemote(options: ChatMigrationOptions): Promise<ChatMigrationResult>;
3589
-
3590
- /** Connect to owner-scoped server storage using the account's canonical device-held cipher. */
3591
- declare function createRemoteChatStore(options: RemoteChatStoreOptions): Promise<ChatStore>;
3592
-
3593
- declare class VaultMemory extends Model {
3594
- static table: string;
3595
- content: string;
3596
- scope: string;
3597
- /** Profile kind, or null for a free-form memory. */
3598
- kind: string | null;
3599
- /** Canonical JSON value of a kinded memory, encrypted at rest. */
3600
- kindValue: string | null;
3601
- /** private | matching | profile. */
3602
- level: string | null;
3603
- folderId: string | null;
3604
- userId: string | null;
3605
- embedding: string | null;
3606
- /** Model that produced `embedding`. Null on legacy rows (grandfathered). */
3607
- embeddingModel: string | null;
3608
- sourceChunkIds: string | null;
3609
- proofCount: number | null;
3610
- source: string | null;
3611
- /** W6 temporal lane — Unix ms timestamp of when the event occurred. */
3612
- eventTimeStart: number | null;
3613
- /** W6 temporal lane — Unix ms timestamp of event end (range/ongoing). */
3614
- eventTimeEnd: number | null;
3615
- /** W6 temporal lane — `point | range | ongoing | null`. */
3616
- eventTimeKind: string | null;
3617
- /** When true, the user has manually set this memory's topics; auto-extraction
3618
- * leaves its entity links alone. Null on legacy rows (treated as false). */
3619
- topicsUserManaged: boolean | null;
3620
- /** The durable, synced record of this memory's topics — JSON `StoredTopic[]`.
3621
- * `entity` / `memory_entity` are a device-local index over it. Null = pre-v42
3622
- * (backfilled from the row's current links by the sweep). */
3623
- topics: string | null;
3624
- /** Unix ms of the last `topics` write. Separate from `updated_at`, which every
3625
- * topic writer pins on purpose (recall recency) — see the schema note. */
3626
- topicsUpdatedAt: number | null;
3627
- /** The photo(s) a SERVER-EXTRACTED memory came from — JSON
3628
- * `[{feed_item_id, object_key}]`, exactly the shape
3629
- * GET /api/memories/published returns. Null on anything not from a photo. */
3630
- media: string | null;
3631
- /** Unix ms of the last LLM topic-extraction pass. Null = never extracted
3632
- * standalone (linked legacy rows are grandfathered as extracted).
3633
- * DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
3634
- topicsExtractedAt: number | null;
3635
- /** A2 supersession: newer memory id that replaced this one, or null if live. */
3636
- supersededBy: string | null;
3637
- supersededAt: number | null;
3638
- /** Extraction-logic version this memory was last stamped under. Null (pre-v38)
3639
- * reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows.
3640
- * DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
3641
- topicsExtractedVersion: number | null;
3642
- /** C3 re-observation watermark: Unix ms of the last retain() merge, or null. */
3643
- lastObservedAt: number | null;
3644
- /** Typed memory (PR1) — the extractor's FactType. Null on legacy/manual rows. */
3645
- factType: string | null;
3646
- /** Decay archive state (PR2) — Unix ms when archived, null when active. */
3647
- archivedAt: number | null;
3648
- /** Tier-0 security (PR3) — "quarantined" | "trusted" | null. */
3649
- trustTier: string | null;
3650
- /** People Nearby visibility: 'private' | 'public'. Null on legacy rows, and
3651
- * any unrecognised value, read as 'private' — never published without opt-in. */
3652
- visibility: string | null;
3653
- /** Owner opted this memory into their own digital twin (twin-scoped only). */
3654
- twinOptIn: boolean | null;
3655
- /** Unix ms when visibility last became non-private; null while private. */
3656
- publishedAt: number | null;
3657
- /** Reserved coarse-geohash slot for landmark/Trail memories. */
3658
- geohash: string | null;
3659
- createdAt: Date;
3660
- updatedAt: Date;
3661
- isDeleted: boolean;
3662
- }
3663
-
3664
- /**
3665
- * A canonical entity (person, place, thing) extracted from the user's
3666
- * conversations. Many-to-many with vault memories via {@link MemoryEntity}.
3667
- *
3668
- * Created on the write path by the auto-extraction worker (W2) when a
3669
- * candidate fact arrives with non-empty `entities[]`. Used at retrieval
3670
- * time as a 3rd RRF lane (W5 graph traversal): query entity overlap
3671
- * with stored memories surfaces topically-related facts that pure
3672
- * semantic search misses.
3673
- */
3674
- declare class Entity extends Model {
3675
- static table: string;
3676
- /** Lowercased, trimmed name used for dedup and lookup. */
3677
- canonicalName: string;
3678
- /** Optional category — "person" | "place" | "thing" | "concept" | etc. */
3679
- kind: string | null;
3680
- createdAt: Date;
3681
- updatedAt: Date;
3682
- }
3683
- /**
3684
- * Join row: a memory references an entity (and vice versa). Multiple
3685
- * rows per memory (one per entity) and per entity (one per memory).
3686
- */
3687
- declare class MemoryEntity extends Model {
3688
- static table: string;
3689
- memoryId: string;
3690
- entityId: string;
3691
- /**
3692
- * User-scope for the W5 graph lane. Optional because client-side
3693
- * (single-user) deployments may leave it null; server-side multi-user
3694
- * deployments must set it so retrieval can filter cross-user IDs.
3695
- */
3696
- userId: string | null;
3697
- createdAt: Date;
3698
- }
3699
-
3700
- /**
3701
- * The recognized entity classifications. Runtime list + derived type kept
3702
- * in one place so the extractor's validation and the `EntityKind` union
3703
- * can't drift apart.
3704
- * @public
3705
- */
3706
- declare const ENTITY_KINDS: readonly ["person", "organization", "place", "event", "product", "thing", "concept", "other"];
3707
- /** @public */
3708
- type EntityKind = (typeof ENTITY_KINDS)[number];
3709
- interface StoredEntity {
3710
- uniqueId: string;
3711
- canonicalName: string;
3712
- kind: string | null;
3713
- createdAt: Date;
3714
- updatedAt: Date;
3715
- }
3716
- /**
3717
- * Who put a topic on a memory. Written to `memory_vault.topics` but not yet
3718
- * READ anywhere — it exists so a later improvement can refresh the `auto`
3719
- * entries of a curated memory while leaving `user` entries alone (today
3720
- * `topics_user_managed` is all-or-nothing per memory) without needing a second
3721
- * migration or backfill. Don't build that behavior off it yet.
3573
+ * }, [user]);
3574
+ * }
3575
+ * ```
3722
3576
  *
3723
- * When you do: a value written by the v42 backfill is NOT ground truth. Pre-v42
3724
- * rows carry no per-topic provenance, so `backfillMemoryTopicsOp` derives it
3725
- * from the per-memory `topics_user_managed` flag and stamps a curated legacy
3726
- * row's every topic `user` — see the note at that derivation.
3727
- * @public
3728
- */
3729
- type TopicSource = "user" | "auto";
3730
- /**
3731
- * One entry in `memory_vault.topics` — the durable, synced record of a memory's
3732
- * topics. `name` carries the CALLER's display casing, unlike
3733
- * {@link StoredEntity.canonicalName}, which {@link normalizeEntityName}
3734
- * lowercases and which has no display column: preserving casing here is the
3735
- * point of storing names on the memory row.
3736
- * @public
3737
- */
3738
- interface StoredTopic {
3739
- name: string;
3740
- kind?: string;
3741
- source: TopicSource;
3742
- /** How central the topic is to the memory, in (0, 1]; read it with {@link topicWeight}. */
3743
- weight?: number;
3744
- }
3745
- /**
3746
- * Fixed weight per salience level the topic extractor assigns.
3747
- * @public
3748
- */
3749
- declare const TOPIC_SALIENCE_WEIGHTS: {
3750
- readonly primary: 1;
3751
- readonly secondary: 0.6;
3752
- readonly mention: 0.3;
3753
- };
3754
- /** @public */
3755
- type TopicSalience = keyof typeof TOPIC_SALIENCE_WEIGHTS;
3756
- /**
3757
- * A topic's weight: 1 when it is user-set or carries no weight.
3758
- * @public
3759
- */
3760
- declare function topicWeight(topic: StoredTopic): number;
3761
- /**
3762
- * The first topic with the highest weight, or null when there are none.
3763
- * @public
3764
- */
3765
- declare function primaryTopic(topics: readonly StoredTopic[] | null | undefined): StoredTopic | null;
3766
-
3767
- /**
3768
- * Accepted entity shape for {@link linkMemoryEntitiesOp}. A bare string is
3769
- * a name with no kind (back-compat with the original signature); the object
3770
- * form carries an optional classification.
3771
- * @public
3577
+ * @example
3578
+ * ```tsx
3579
+ * // ECDH key pair generation for end-to-end encryption
3580
+ * import { usePrivy } from "@privy-io/react-auth";
3581
+ * import { useEncryption } from "@anuma/sdk/react";
3582
+ *
3583
+ * function E2EEComponent() {
3584
+ * const { signMessage } = usePrivy();
3585
+ * const { requestKeyPair, exportPublicKey } = useEncryption(signMessage);
3586
+ *
3587
+ * const setupEncryption = async (walletAddress: string) => {
3588
+ * // Generate deterministic ECDH key pair from wallet signature
3589
+ * await requestKeyPair(walletAddress);
3590
+ *
3591
+ * // Export public key to share with others
3592
+ * const publicKey = await exportPublicKey(walletAddress);
3593
+ * console.log("Share this public key:", publicKey);
3594
+ * };
3595
+ * }
3596
+ * ```
3597
+ *
3598
+ * @category Hooks
3772
3599
  */
3773
- type EntityInput = string | {
3774
- name: string;
3775
- kind?: EntityKind | (string & {});
3776
- weight?: number;
3777
- };
3778
- interface EntityOperationsContext {
3779
- database: Database;
3780
- entityCollection: Collection<Entity>;
3781
- memoryEntityCollection: Collection<MemoryEntity>;
3782
- /**
3783
- * Optional user-scope. When provided, `linkMemoryEntitiesOp` stamps
3784
- * `user_id` on new memory_entity rows and `getMemoriesByEntityNamesOp`
3785
- * filters lookups by it. Leave undefined for single-user clients.
3786
- */
3787
- userId?: string;
3788
- /**
3789
- * When `true`, `getMemoriesByEntityNamesOp` admits rows with
3790
- * `user_id = null` alongside the strict `userId` match. Set this on
3791
- * LokiJS (web) adapters where the v31 `unsafeExecuteSql` backfill
3792
- * is a no-op — pre-v31 rows otherwise become invisible to the W5
3793
- * lane until `backfillMemoryEntityUserIdsOp` runs. Default `false`
3794
- * (server / SQLite, where the migration backfill is authoritative).
3795
- */
3796
- allowUnscopedRows?: boolean;
3797
- canWrite?: () => Promise<boolean>;
3798
- }
3600
+ declare function useEncryption(signMessage: SignMessageFn, embeddedWalletSigner?: EmbeddedWalletSignerFn): UseEncryptionResult;
3799
3601
 
3800
3602
  /**
3801
3603
  * Checks if a string value is encrypted (has the enc:v2: or enc:v3: prefix with valid hex payload).
@@ -7560,6 +7362,14 @@ interface FileMetadata {
7560
7362
  */
7561
7363
  sourceUrl?: string;
7562
7364
  }
7365
+ /** Points a message's local file (`FileMetadata.id` or a `fileIds` media id) at its encrypted copy in vault, so any device can fetch it. */
7366
+ interface VaultAttachmentRef {
7367
+ attachmentId: string;
7368
+ fileId: string;
7369
+ name: string;
7370
+ type: string;
7371
+ size: number;
7372
+ }
7563
7373
  interface ChatCompletionUsage {
7564
7374
  promptTokens?: number;
7565
7375
  completionTokens?: number;
@@ -7663,6 +7473,7 @@ interface StoredMessage {
7663
7473
  files?: FileMetadata[];
7664
7474
  /** Array of media_id references for direct lookup in media table */
7665
7475
  fileIds?: string[];
7476
+ vaultAttachments?: VaultAttachmentRef[];
7666
7477
  createdAt: Date;
7667
7478
  updatedAt: Date;
7668
7479
  vector?: number[];
@@ -7839,6 +7650,7 @@ interface CreateMessageOptions {
7839
7650
  files?: FileMetadata[];
7840
7651
  /** Array of media_id references for direct lookup in media table */
7841
7652
  fileIds?: string[];
7653
+ vaultAttachments?: VaultAttachmentRef[];
7842
7654
  usage?: ChatCompletionUsage;
7843
7655
  sources?: SearchSource[];
7844
7656
  responseDuration?: number;
@@ -8389,68 +8201,375 @@ interface BaseSendMessageWithStorageArgs {
8389
8201
  */
8390
8202
  assistantUniqueId?: string;
8391
8203
  }
8392
- interface BaseSendMessageSuccessResult {
8393
- data: ApiResponse;
8394
- error: null;
8395
- userMessage: StoredMessage;
8396
- assistantMessage: StoredMessage;
8397
- /** Results from tools the SDK auto-executed this turn (e.g. display tools). */
8398
- autoExecutedToolResults?: {
8399
- name: string;
8400
- result: unknown;
8401
- }[];
8402
- /**
8403
- * The synthetic `[Tool Execution Results]` row those results were persisted as.
8404
- *
8405
- * Returned so a caller can key its transient overlay on the id the SDK actually wrote instead of
8406
- * deriving one and hoping the two agree — that guesswork is what mobile's per-card persist
8407
- * workarounds existed to do (#5519). Absent when the turn executed no tools, or when the row write
8408
- * failed (non-fatal: the assistant reply is already stored).
8409
- */
8410
- toolResultsMessage?: StoredMessage;
8204
+ interface BaseSendMessageSuccessResult {
8205
+ data: ApiResponse;
8206
+ error: null;
8207
+ userMessage: StoredMessage;
8208
+ assistantMessage: StoredMessage;
8209
+ /** Results from tools the SDK auto-executed this turn (e.g. display tools). */
8210
+ autoExecutedToolResults?: {
8211
+ name: string;
8212
+ result: unknown;
8213
+ }[];
8214
+ /**
8215
+ * The synthetic `[Tool Execution Results]` row those results were persisted as.
8216
+ *
8217
+ * Returned so a caller can key its transient overlay on the id the SDK actually wrote instead of
8218
+ * deriving one and hoping the two agree — that guesswork is what mobile's per-card persist
8219
+ * workarounds existed to do (#5519). Absent when the turn executed no tools, or when the row write
8220
+ * failed (non-fatal: the assistant reply is already stored).
8221
+ */
8222
+ toolResultsMessage?: StoredMessage;
8223
+ }
8224
+ interface BaseSendMessageSkippedResult {
8225
+ data: ApiResponse;
8226
+ error: null;
8227
+ userMessage?: undefined;
8228
+ assistantMessage?: undefined;
8229
+ autoExecutedToolResults?: {
8230
+ name: string;
8231
+ result: unknown;
8232
+ }[];
8233
+ /** Indicates this was a skipStorage request - no messages were persisted */
8234
+ skipped: true;
8235
+ }
8236
+ interface BaseSendMessageErrorResult {
8237
+ data: null;
8238
+ error: string;
8239
+ userMessage?: StoredMessage;
8240
+ assistantMessage?: undefined;
8241
+ }
8242
+ type BaseSendMessageWithStorageResult = BaseSendMessageSuccessResult | BaseSendMessageSkippedResult | BaseSendMessageErrorResult;
8243
+ interface BaseUseChatStorageResult {
8244
+ isLoading: boolean;
8245
+ stop: () => void;
8246
+ conversationId: string | null;
8247
+ setConversationId: (id: string | null) => void;
8248
+ createConversation: (options?: CreateConversationOptions) => Promise<StoredConversation>;
8249
+ getConversation: (id: string) => Promise<StoredConversation | null>;
8250
+ getConversations: () => Promise<StoredConversation[]>;
8251
+ updateConversationTitle: (id: string, title: string) => Promise<boolean>;
8252
+ updateConversationPinned: (id: string, pinned: boolean) => Promise<boolean>;
8253
+ deleteConversation: (id: string) => Promise<boolean>;
8254
+ getMessages: (conversationId: string) => Promise<StoredMessage[]>;
8255
+ /**
8256
+ * Paginated display read: the newest `limit` messages (optionally below
8257
+ * `beforeMessageId`), ascending, with embedding columns skipped.
8258
+ */
8259
+ getMessagesPage: (conversationId: string, options: GetMessagesPageOptions) => Promise<StoredMessage[]>;
8260
+ /** Whole-thread branch-tree skeleton — no field decryption. */
8261
+ getMessageSkeletons: (conversationId: string) => Promise<MessageSkeleton[]>;
8262
+ /** Total message count for a conversation. */
8263
+ getMessageCount: (conversationId: string) => Promise<number>;
8264
+ }
8265
+ declare function generateConversationId(): string;
8266
+
8267
+ type ChatRecordKind = "conversation" | "message" | "summary" | "project" | "memory_links";
8268
+ type ChatJson = null | boolean | number | string | ChatJson[] | {
8269
+ [key: string]: ChatJson;
8270
+ };
8271
+ /** Whole-record JSON data is encrypted on the device, including all text, vectors and tool events. */
8272
+ interface ChatRecord {
8273
+ kind: ChatRecordKind;
8274
+ id: string;
8275
+ conversationId: string;
8276
+ sortKey: number;
8277
+ createdAt: number;
8278
+ updatedAt: number;
8279
+ isDeleted: boolean;
8280
+ data: {
8281
+ [key: string]: ChatJson;
8282
+ };
8283
+ }
8284
+ interface ChatSnapshot {
8285
+ record: ChatRecord;
8286
+ version: number;
8287
+ serverUpdatedAt: string;
8288
+ }
8289
+ interface ChatWrite {
8290
+ record: ChatRecord;
8291
+ expectedVersion: number;
8292
+ /** Sent and stored unencrypted so vault can run vector search. */
8293
+ embeddings?: number[][];
8294
+ embeddingModel?: string;
8295
+ }
8296
+ interface ChatRef {
8297
+ kind: ChatRecordKind;
8298
+ id: string;
8299
+ }
8300
+ type ChatAccountState = "none" | "migrating" | "active";
8301
+ interface ChatAccount {
8302
+ keyId: string;
8303
+ state: ChatAccountState;
8304
+ recordCount: number;
8305
+ storageBytes: number;
8306
+ vectorCount: number;
8307
+ /** The newest change; read it before loading history and poll `changes` from it. Absent before the first record. */
8308
+ changesCursor?: string;
8309
+ }
8310
+ interface ChatImport {
8311
+ record: ChatRecord;
8312
+ /** Sent and stored unencrypted so vault can run vector search. */
8313
+ embeddings?: number[][];
8314
+ embeddingModel?: string;
8315
+ }
8316
+ interface ChatRevision {
8317
+ kind: ChatRecordKind;
8318
+ id: string;
8319
+ updatedAt: number;
8320
+ isDeleted: boolean;
8321
+ }
8322
+ interface ChatChanges {
8323
+ items: ChatSnapshot[];
8324
+ nextCursor?: string;
8325
+ changesCursor: string;
8326
+ }
8327
+ interface ChatSearchOptions {
8328
+ limit?: number;
8329
+ kinds?: ("message" | "summary")[];
8330
+ conversationId?: string;
8331
+ excludeConversationId?: string;
8332
+ /** Ranks only vectors from this model; vectors stored without one always count. */
8333
+ embeddingModel?: string;
8334
+ signal?: AbortSignal;
8335
+ }
8336
+ interface ChatSearchHit extends ChatSnapshot {
8337
+ chunk: number;
8338
+ score: number;
8339
+ }
8340
+ interface ChatAttachment {
8341
+ id: string;
8342
+ sizeBytes: number;
8343
+ state: "pending" | "committed";
8344
+ ownerKind?: "message" | "summary";
8345
+ ownerId?: string;
8346
+ createdAt: string;
8347
+ committedAt?: string;
8348
+ }
8349
+ interface ChatPresignedUrl {
8350
+ url: string;
8351
+ method: string;
8352
+ headers: Record<string, string>;
8353
+ expiresAt: string;
8354
+ }
8355
+ interface ChatAttachments {
8356
+ create(sizeBytes: number, signal?: AbortSignal): Promise<{
8357
+ attachment: ChatAttachment;
8358
+ upload: ChatPresignedUrl;
8359
+ }>;
8360
+ commit(attachmentId: string, owner: {
8361
+ kind: "message" | "summary";
8362
+ id: string;
8363
+ }, signal?: AbortSignal): Promise<ChatAttachment>;
8364
+ get(attachmentId: string, signal?: AbortSignal): Promise<{
8365
+ attachment: ChatAttachment;
8366
+ download?: ChatPresignedUrl;
8367
+ } | null>;
8368
+ delete(attachmentId: string, signal?: AbortSignal): Promise<void>;
8411
8369
  }
8412
- interface BaseSendMessageSkippedResult {
8413
- data: ApiResponse;
8414
- error: null;
8415
- userMessage?: undefined;
8416
- assistantMessage?: undefined;
8417
- autoExecutedToolResults?: {
8418
- name: string;
8419
- result: unknown;
8420
- }[];
8421
- /** Indicates this was a skipStorage request - no messages were persisted */
8422
- skipped: true;
8370
+ interface ChatListOptions {
8371
+ kind: ChatRecordKind;
8372
+ conversationId?: string;
8373
+ includeDeleted?: boolean;
8374
+ cursor?: string;
8375
+ limit?: number;
8376
+ signal?: AbortSignal;
8423
8377
  }
8424
- interface BaseSendMessageErrorResult {
8425
- data: null;
8426
- error: string;
8427
- userMessage?: StoredMessage;
8428
- assistantMessage?: undefined;
8378
+ interface ChatPage {
8379
+ items: ChatSnapshot[];
8380
+ nextCursor?: string;
8381
+ total?: number;
8429
8382
  }
8430
- type BaseSendMessageWithStorageResult = BaseSendMessageSuccessResult | BaseSendMessageSkippedResult | BaseSendMessageErrorResult;
8431
- interface BaseUseChatStorageResult {
8432
- isLoading: boolean;
8433
- stop: () => void;
8434
- conversationId: string | null;
8435
- setConversationId: (id: string | null) => void;
8436
- createConversation: (options?: CreateConversationOptions) => Promise<StoredConversation>;
8437
- getConversation: (id: string) => Promise<StoredConversation | null>;
8438
- getConversations: () => Promise<StoredConversation[]>;
8439
- updateConversationTitle: (id: string, title: string) => Promise<boolean>;
8440
- updateConversationPinned: (id: string, pinned: boolean) => Promise<boolean>;
8441
- deleteConversation: (id: string) => Promise<boolean>;
8442
- getMessages: (conversationId: string) => Promise<StoredMessage[]>;
8443
- /**
8444
- * Paginated display read: the newest `limit` messages (optionally below
8445
- * `beforeMessageId`), ascending, with embedding columns skipped.
8446
- */
8447
- getMessagesPage: (conversationId: string, options: GetMessagesPageOptions) => Promise<StoredMessage[]>;
8448
- /** Whole-thread branch-tree skeleton — no field decryption. */
8449
- getMessageSkeletons: (conversationId: string) => Promise<MessageSkeleton[]>;
8450
- /** Total message count for a conversation. */
8451
- getMessageCount: (conversationId: string) => Promise<number>;
8383
+ /** Explicit versions protect edits; ambiguous writes are never replayed automatically. */
8384
+ interface ChatStore {
8385
+ get(kind: ChatRecordKind, id: string, signal?: AbortSignal): Promise<ChatSnapshot | null>;
8386
+ list(options: ChatListOptions): Promise<ChatPage>;
8387
+ putMany(writes: readonly ChatWrite[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
8388
+ getMany(refs: readonly ChatRef[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
8389
+ account(signal?: AbortSignal): Promise<ChatAccount>;
8390
+ importRecords(records: readonly ChatImport[], signal?: AbortSignal): Promise<number>;
8391
+ verify(revisions: readonly ChatRevision[], signal?: AbortSignal): Promise<ChatRef[]>;
8392
+ activate(signal?: AbortSignal): Promise<boolean>;
8393
+ changes(cursor?: string, options?: {
8394
+ limit?: number;
8395
+ signal?: AbortSignal;
8396
+ }): Promise<ChatChanges>;
8397
+ search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
8398
+ deleteAll(signal?: AbortSignal): Promise<number>;
8399
+ attachments: ChatAttachments;
8452
8400
  }
8453
- declare function generateConversationId(): string;
8401
+ interface RemoteChatStoreOptions {
8402
+ baseUrl: string;
8403
+ getToken: () => Promise<string | null>;
8404
+ keyId: string;
8405
+ encrypt: (plaintext: string) => Promise<string>;
8406
+ decrypt: (ciphertext: string) => Promise<string>;
8407
+ fetch?: typeof globalThis.fetch;
8408
+ timeoutMs?: number;
8409
+ signal?: AbortSignal;
8410
+ }
8411
+ declare class ChatStoreError extends Error {
8412
+ readonly status: number;
8413
+ readonly code?: string | undefined;
8414
+ readonly retryAfterMs?: number | undefined;
8415
+ constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
8416
+ }
8417
+
8418
+ interface ChatMigrationOptions {
8419
+ /** The device's local chat database. */
8420
+ database: Database;
8421
+ /** Vault, opened with the account's canonical key. */
8422
+ store: ChatStore;
8423
+ walletAddress?: string;
8424
+ signMessage?: SignMessageFn;
8425
+ embeddedWalletSigner?: EmbeddedWalletSignerFn;
8426
+ /** Runs the final pass while local chat writers are held, so nothing lands locally after it. */
8427
+ withWriteBarrier: (task: () => Promise<ChatMigrationResult>) => Promise<ChatMigrationResult>;
8428
+ /** Called once vault holds everything; hand the device over to vault here. */
8429
+ onActivated: () => void | Promise<void>;
8430
+ /** Activate even when some rows could not be read; they stay on the device. */
8431
+ allowSkipped?: boolean;
8432
+ maxVectors?: number;
8433
+ maxStorageBytes?: number;
8434
+ signal?: AbortSignal;
8435
+ onProgress?: (progress: ChatMigrationProgress) => void;
8436
+ }
8437
+ interface ChatMigrationProgress {
8438
+ imported: number;
8439
+ toImport: number;
8440
+ }
8441
+ interface ChatMigrationSkip {
8442
+ kind: ChatRecordKind;
8443
+ id: string;
8444
+ reason: "unreadable" | "invalid";
8445
+ }
8446
+ interface ChatMigrationResult {
8447
+ state: "migrating" | "active";
8448
+ conversations: number;
8449
+ messages: number;
8450
+ imported: number;
8451
+ skipped: ChatMigrationSkip[];
8452
+ /** Conversations whose title could not be decrypted and went up untitled. */
8453
+ untitled: number;
8454
+ /** Messages sent without vectors to stay inside the account's vector quota. */
8455
+ unembedded: number;
8456
+ /** Messages shrunk to fit vault's record limit. */
8457
+ truncated: number;
8458
+ }
8459
+ /** Copies this device's chats to vault, verifies them under the write barrier, then activates vault and hands the device over. */
8460
+ declare function migrateChatsToRemote(options: ChatMigrationOptions): Promise<ChatMigrationResult>;
8461
+
8462
+ /** Connect to owner-scoped server storage using the account's canonical device-held cipher. */
8463
+ declare function createRemoteChatStore(options: RemoteChatStoreOptions): Promise<ChatStore>;
8464
+
8465
+ /**
8466
+ * AES-GCM keys derived from one wallet signature over `SIGN_MESSAGE`.
8467
+ * @public
8468
+ */
8469
+ interface MemoryKeyRing {
8470
+ keyId: string;
8471
+ v3: CryptoKey;
8472
+ v2: CryptoKey;
8473
+ }
8474
+ /**
8475
+ * Thrown when no supplied key decrypts a field.
8476
+ * @public
8477
+ */
8478
+ declare class MemoryKeyError extends Error {
8479
+ constructor(message: string);
8480
+ }
8481
+ /**
8482
+ * Derive the v3 and legacy v2 memory keys from a hex wallet signature.
8483
+ * @public
8484
+ */
8485
+ declare function deriveMemoryKeyRing(signatureHex: string): Promise<MemoryKeyRing>;
8486
+ /**
8487
+ * Encrypt and decrypt callbacks for `createRemoteMemoryPersistence` under the canonical key.
8488
+ * @public
8489
+ */
8490
+ declare function memoryCipher(canonical: MemoryKeyRing): {
8491
+ encrypt: (plaintext: string) => Promise<string>;
8492
+ decrypt: (ciphertext: string) => Promise<string>;
8493
+ };
8494
+ /**
8495
+ * Re-encrypt a local field under the canonical key.
8496
+ * @throws MemoryKeyError when no key decrypts the field.
8497
+ * @public
8498
+ */
8499
+ declare function reencryptMemoryField(value: string, canonical: MemoryKeyRing, fallbacks?: readonly MemoryKeyRing[]): Promise<string>;
8500
+
8501
+ /** The largest file vault stores, after the encryption frame is added. */
8502
+ declare const maxVaultAttachmentBytes: number;
8503
+ /** Device-side store for decrypted attachment bytes, keyed by vault attachment id. */
8504
+ interface VaultAttachmentCache {
8505
+ get(attachmentId: string): Promise<Uint8Array | null>;
8506
+ set(attachmentId: string, bytes: Uint8Array): Promise<void>;
8507
+ delete(attachmentId: string): Promise<void>;
8508
+ }
8509
+ interface VaultAttachmentOwner {
8510
+ kind: "message" | "summary";
8511
+ id: string;
8512
+ }
8513
+ interface VaultAttachmentsOptions {
8514
+ store: ChatStore;
8515
+ keyRing: MemoryKeyRing;
8516
+ cache?: VaultAttachmentCache;
8517
+ fetch?: typeof globalThis.fetch;
8518
+ retries?: number;
8519
+ retryDelayMs?: number;
8520
+ now?: () => number;
8521
+ }
8522
+ interface VaultAttachmentUploadOptions {
8523
+ signal?: AbortSignal;
8524
+ /** Runs before any bytes leave the device, again for each new reservation. */
8525
+ onReserved?: (attachmentId: string) => void | Promise<void>;
8526
+ }
8527
+ /** Encrypted chat attachments in vault: upload, bind to a message, read back on any device, delete. */
8528
+ interface VaultAttachments {
8529
+ /** Encrypts and uploads `bytes`; the attachment stays pending until `commit`, and vault drops it after 24h. */
8530
+ upload(bytes: Uint8Array, options?: VaultAttachmentUploadOptions): Promise<string>;
8531
+ /** Binds an uploaded attachment to a message or summary that vault already holds. */
8532
+ commit(attachmentId: string, owner: VaultAttachmentOwner, signal?: AbortSignal): Promise<ChatAttachment>;
8533
+ /** The decrypted bytes, or null when the attachment is gone or not yet committed. */
8534
+ read(attachmentId: string, signal?: AbortSignal): Promise<Uint8Array | null>;
8535
+ delete(attachmentId: string, signal?: AbortSignal): Promise<void>;
8536
+ }
8537
+ /** Creates the attachment client for one account and key; bytes are AES-GCM sealed with the ring's v3 key before upload. */
8538
+ declare function createVaultAttachments(options: VaultAttachmentsOptions): VaultAttachments;
8539
+ /** Where a migration run keeps the reservation it is working on, so a rerun resumes it instead of uploading again. */
8540
+ interface VaultAttachmentJournal {
8541
+ get(key: string): Promise<string | null>;
8542
+ set(key: string, attachmentId: string | null): Promise<void>;
8543
+ }
8544
+ interface LocalMessageAttachment {
8545
+ /** `FileMetadata.id` or the media id listed in `fileIds`. */
8546
+ fileId: string;
8547
+ name: string;
8548
+ type: string;
8549
+ read(): Promise<Uint8Array | null>;
8550
+ }
8551
+ interface MessageAttachmentMigrationOptions {
8552
+ store: ChatStore;
8553
+ attachments: VaultAttachments;
8554
+ journal: VaultAttachmentJournal;
8555
+ /** The message's vault id (`StoredMessage.uniqueId`); vault must already hold it. */
8556
+ messageId: string;
8557
+ files: readonly LocalMessageAttachment[];
8558
+ now?: () => number;
8559
+ signal?: AbortSignal;
8560
+ }
8561
+ interface MessageAttachmentMigrationResult {
8562
+ refs: VaultAttachmentRef[];
8563
+ uploaded: number;
8564
+ missing: string[];
8565
+ oversized: string[];
8566
+ /** File ids another run may still be uploading; rerun after 16 minutes. */
8567
+ deferred: string[];
8568
+ }
8569
+ /** The vault attachment refs a message record carries; malformed entries are left out. */
8570
+ declare function vaultAttachmentRefs(record: Pick<ChatRecord, "data">): VaultAttachmentRef[];
8571
+ /** Copies a message's local files into vault and records their ids on the message; safe to rerun after a crash without uploading a file twice. */
8572
+ declare function migrateMessageAttachments(options: MessageAttachmentMigrationOptions): Promise<MessageAttachmentMigrationResult>;
8454
8573
 
8455
8574
  /** Durable home for each account's sealed chat cache; `set(account, null)` deletes that account's entry. */
8456
8575
  interface ChatCacheStorage {
@@ -10109,42 +10228,6 @@ interface LocalMemoryStoreOptions {
10109
10228
  */
10110
10229
  declare function createLocalMemoryStore(options: LocalMemoryStoreOptions): MemoryStore;
10111
10230
 
10112
- /**
10113
- * AES-GCM keys derived from one wallet signature over `SIGN_MESSAGE`.
10114
- * @public
10115
- */
10116
- interface MemoryKeyRing {
10117
- keyId: string;
10118
- v3: CryptoKey;
10119
- v2: CryptoKey;
10120
- }
10121
- /**
10122
- * Thrown when no supplied key decrypts a field.
10123
- * @public
10124
- */
10125
- declare class MemoryKeyError extends Error {
10126
- constructor(message: string);
10127
- }
10128
- /**
10129
- * Derive the v3 and legacy v2 memory keys from a hex wallet signature.
10130
- * @public
10131
- */
10132
- declare function deriveMemoryKeyRing(signatureHex: string): Promise<MemoryKeyRing>;
10133
- /**
10134
- * Encrypt and decrypt callbacks for `createRemoteMemoryPersistence` under the canonical key.
10135
- * @public
10136
- */
10137
- declare function memoryCipher(canonical: MemoryKeyRing): {
10138
- encrypt: (plaintext: string) => Promise<string>;
10139
- decrypt: (ciphertext: string) => Promise<string>;
10140
- };
10141
- /**
10142
- * Re-encrypt a local field under the canonical key.
10143
- * @throws MemoryKeyError when no key decrypts the field.
10144
- * @public
10145
- */
10146
- declare function reencryptMemoryField(value: string, canonical: MemoryKeyRing, fallbacks?: readonly MemoryKeyRing[]): Promise<string>;
10147
-
10148
10231
  /** @public */
10149
10232
  interface RemoteMemoryTopic {
10150
10233
  name: string;
@@ -12216,4 +12299,4 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
12216
12299
  */
12217
12300
  declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
12218
12301
 
12219
- export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, type ChatAccount, type ChatAccountState, type ChatAttachment, type ChatAttachments, type ChatBackend, type ChatBackendFactory, type ChatBackendSigner, type ChatCacheStorage, type ChatChanges, type ChatChunkSearchOptions, Conversation as ChatConversation, type ChatImport, type ChatJson, type ChatListOptions, Message as ChatMessage, type ChatMigrationOptions, type ChatMigrationProgress, type ChatMigrationResult, type ChatMigrationSkip, type ChatOutboxLocks, type ChatOutboxStorage, type ChatPage, type ChatPresignedUrl, type ChatRecord, type ChatRecordKind, type ChatRef, type ChatRevision, type ChatRole, type ChatSearchHit, type ChatSearchOptions, type ChatSnapshot, type ChatStore, ChatStoreError, type ChatWrite, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateSelectPaymentWalletToolOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CreateWalletPaymentToolOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_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, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCounts, type MemoryCreate, type MemoryDecay, type MemoryDecaySweeperOptions, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryMigrationOptions, type MemoryMigrationProgress, type MemoryMigrationResult, type MemoryMigrationSkip, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, type MemoryTopicBacklog, type MemoryTopicMaintenance, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type 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 PaymentWallet, 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 RecallTelemetryCallbacks, type RecallToolCallbacks, type RecallToolOptions, type RecallTruncation, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteChatStoreOptions, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryMetadataPage, type RemoteMemoryMetadataRecord, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RemoteMemoryTopic, type RemoteMemoryWorkKind, type RemoteMemoryWorkLease, type RemoteMemoryWorkPersistence, type RemoteTopicPersistence, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SELECT_PAYMENT_WALLET_TOOL_NAME, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectPaymentWalletResult, 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 StoredTopic, 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, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, 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 VaultChatActivity, type VaultChatBackend, type VaultChatBackendOptions, type VaultChatEvent, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryProjection, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WriteFailureReason, 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, clearModelsCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteChatStore, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createSelectPaymentWalletTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultChatBackend, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWalletPaymentTool, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptMessageEmbeddingFields, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptToolCallEventsOp, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractReservationReceipts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, localChatBackend, maskScopedEmbeddingCache, memoryCipher, migrateChatsToRemote, migrateMemoriesToRemote, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, primaryTopic, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, vaultChatBackend, verifyMemoriesForPublish, xhrTransport };
12302
+ export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, type ChatAccount, type ChatAccountState, type ChatAttachment, type ChatAttachments, type ChatBackend, type ChatBackendFactory, type ChatBackendSigner, type ChatCacheStorage, type ChatChanges, type ChatChunkSearchOptions, Conversation as ChatConversation, type ChatImport, type ChatJson, type ChatListOptions, Message as ChatMessage, type ChatMigrationOptions, type ChatMigrationProgress, type ChatMigrationResult, type ChatMigrationSkip, type ChatOutboxLocks, type ChatOutboxStorage, type ChatPage, type ChatPresignedUrl, type ChatRecord, type ChatRecordKind, type ChatRef, type ChatRevision, type ChatRole, type ChatSearchHit, type ChatSearchOptions, type ChatSnapshot, type ChatStore, ChatStoreError, type ChatWrite, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateSelectPaymentWalletToolOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CreateWalletPaymentToolOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_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, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, 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 LocalMessageAttachment, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCounts, type MemoryCreate, type MemoryDecay, type MemoryDecaySweeperOptions, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryMigrationOptions, type MemoryMigrationProgress, type MemoryMigrationResult, type MemoryMigrationSkip, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, type MemoryTopicBacklog, type MemoryTopicMaintenance, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageAttachmentMigrationOptions, type MessageAttachmentMigrationResult, 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 PaymentWallet, 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 RecallTelemetryCallbacks, type RecallToolCallbacks, type RecallToolOptions, type RecallTruncation, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteChatStoreOptions, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryMetadataPage, type RemoteMemoryMetadataRecord, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RemoteMemoryTopic, type RemoteMemoryWorkKind, type RemoteMemoryWorkLease, type RemoteMemoryWorkPersistence, type RemoteTopicPersistence, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SELECT_PAYMENT_WALLET_TOOL_NAME, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectPaymentWalletResult, 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 StoredTopic, 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, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, 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 VaultAttachmentCache, type VaultAttachmentJournal, type VaultAttachmentOwner, type VaultAttachmentRef, type VaultAttachmentUploadOptions, type VaultAttachments, type VaultAttachmentsOptions, type VaultChatActivity, type VaultChatBackend, type VaultChatBackendOptions, type VaultChatEvent, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryProjection, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WriteFailureReason, 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, clearModelsCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteChatStore, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createSelectPaymentWalletTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultAttachments, createVaultChatBackend, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWalletPaymentTool, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptMessageEmbeddingFields, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptToolCallEventsOp, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractReservationReceipts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, localChatBackend, maskScopedEmbeddingCache, maxVaultAttachmentBytes, memoryCipher, migrateChatsToRemote, migrateMemoriesToRemote, migrateMessageAttachments, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, primaryTopic, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, vaultAttachmentRefs, vaultChatBackend, verifyMemoriesForPublish, xhrTransport };