@anuma/sdk 10.3.1 → 10.4.1
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.
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/expo/index.cjs +364 -1
- package/dist/expo/index.d.mts +610 -527
- package/dist/expo/index.d.ts +610 -527
- package/dist/expo/index.mjs +360 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +154 -154
- package/dist/index.d.ts +154 -154
- package/dist/index.mjs +1 -1
- package/dist/react/index.cjs +364 -1
- package/dist/react/index.d.mts +1055 -972
- package/dist/react/index.d.ts +1055 -972
- package/dist/react/index.mjs +360 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.mts +10 -0
- package/dist/server/index.d.ts +10 -0
- package/dist/server/index.mjs +1 -1
- package/dist/tools/selection/index.cjs +1 -1
- package/dist/tools/selection/index.mjs +1 -1
- package/package.json +1 -1
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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';
|
|
@@ -3190,1059 +3190,861 @@ interface WebSearchPreProcessorOptions {
|
|
|
3190
3190
|
*/
|
|
3191
3191
|
declare function createWebSearchPreProcessor(options?: WebSearchPreProcessorOptions): PromptPreProcessor;
|
|
3192
3192
|
|
|
3193
|
+
declare class VaultMemory extends Model {
|
|
3194
|
+
static table: string;
|
|
3195
|
+
content: string;
|
|
3196
|
+
scope: string;
|
|
3197
|
+
/** Profile kind, or null for a free-form memory. */
|
|
3198
|
+
kind: string | null;
|
|
3199
|
+
/** Canonical JSON value of a kinded memory, encrypted at rest. */
|
|
3200
|
+
kindValue: string | null;
|
|
3201
|
+
/** private | matching | profile. */
|
|
3202
|
+
level: string | null;
|
|
3203
|
+
folderId: string | null;
|
|
3204
|
+
userId: string | null;
|
|
3205
|
+
embedding: string | null;
|
|
3206
|
+
/** Model that produced `embedding`. Null on legacy rows (grandfathered). */
|
|
3207
|
+
embeddingModel: string | null;
|
|
3208
|
+
sourceChunkIds: string | null;
|
|
3209
|
+
proofCount: number | null;
|
|
3210
|
+
source: string | null;
|
|
3211
|
+
/** W6 temporal lane — Unix ms timestamp of when the event occurred. */
|
|
3212
|
+
eventTimeStart: number | null;
|
|
3213
|
+
/** W6 temporal lane — Unix ms timestamp of event end (range/ongoing). */
|
|
3214
|
+
eventTimeEnd: number | null;
|
|
3215
|
+
/** W6 temporal lane — `point | range | ongoing | null`. */
|
|
3216
|
+
eventTimeKind: string | null;
|
|
3217
|
+
/** When true, the user has manually set this memory's topics; auto-extraction
|
|
3218
|
+
* leaves its entity links alone. Null on legacy rows (treated as false). */
|
|
3219
|
+
topicsUserManaged: boolean | null;
|
|
3220
|
+
/** The durable, synced record of this memory's topics — JSON `StoredTopic[]`.
|
|
3221
|
+
* `entity` / `memory_entity` are a device-local index over it. Null = pre-v42
|
|
3222
|
+
* (backfilled from the row's current links by the sweep). */
|
|
3223
|
+
topics: string | null;
|
|
3224
|
+
/** Unix ms of the last `topics` write. Separate from `updated_at`, which every
|
|
3225
|
+
* topic writer pins on purpose (recall recency) — see the schema note. */
|
|
3226
|
+
topicsUpdatedAt: number | null;
|
|
3227
|
+
/** The photo(s) a SERVER-EXTRACTED memory came from — JSON
|
|
3228
|
+
* `[{feed_item_id, object_key}]`, exactly the shape
|
|
3229
|
+
* GET /api/memories/published returns. Null on anything not from a photo. */
|
|
3230
|
+
media: string | null;
|
|
3231
|
+
/** Unix ms of the last LLM topic-extraction pass. Null = never extracted
|
|
3232
|
+
* standalone (linked legacy rows are grandfathered as extracted).
|
|
3233
|
+
* DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
|
|
3234
|
+
topicsExtractedAt: number | null;
|
|
3235
|
+
/** A2 supersession: newer memory id that replaced this one, or null if live. */
|
|
3236
|
+
supersededBy: string | null;
|
|
3237
|
+
supersededAt: number | null;
|
|
3238
|
+
/** Extraction-logic version this memory was last stamped under. Null (pre-v38)
|
|
3239
|
+
* reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows.
|
|
3240
|
+
* DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
|
|
3241
|
+
topicsExtractedVersion: number | null;
|
|
3242
|
+
/** C3 re-observation watermark: Unix ms of the last retain() merge, or null. */
|
|
3243
|
+
lastObservedAt: number | null;
|
|
3244
|
+
/** Typed memory (PR1) — the extractor's FactType. Null on legacy/manual rows. */
|
|
3245
|
+
factType: string | null;
|
|
3246
|
+
/** Decay archive state (PR2) — Unix ms when archived, null when active. */
|
|
3247
|
+
archivedAt: number | null;
|
|
3248
|
+
/** Tier-0 security (PR3) — "quarantined" | "trusted" | null. */
|
|
3249
|
+
trustTier: string | null;
|
|
3250
|
+
/** People Nearby visibility: 'private' | 'public'. Null on legacy rows, and
|
|
3251
|
+
* any unrecognised value, read as 'private' — never published without opt-in. */
|
|
3252
|
+
visibility: string | null;
|
|
3253
|
+
/** Owner opted this memory into their own digital twin (twin-scoped only). */
|
|
3254
|
+
twinOptIn: boolean | null;
|
|
3255
|
+
/** Unix ms when visibility last became non-private; null while private. */
|
|
3256
|
+
publishedAt: number | null;
|
|
3257
|
+
/** Reserved coarse-geohash slot for landmark/Trail memories. */
|
|
3258
|
+
geohash: string | null;
|
|
3259
|
+
createdAt: Date;
|
|
3260
|
+
updatedAt: Date;
|
|
3261
|
+
isDeleted: boolean;
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3193
3264
|
/**
|
|
3194
|
-
*
|
|
3195
|
-
*
|
|
3196
|
-
* - "v3": HKDF derived key with domain separation (for new encryption)
|
|
3265
|
+
* A canonical entity (person, place, thing) extracted from the user's
|
|
3266
|
+
* conversations. Many-to-many with vault memories via {@link MemoryEntity}.
|
|
3197
3267
|
*
|
|
3198
|
-
*
|
|
3199
|
-
*
|
|
3200
|
-
*
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
/**
|
|
3204
|
-
* Thrown by {@link getEncryptionKey} when the requested version is absent.
|
|
3205
|
-
* Distinct from AES-GCM auth-tag failures so decrypt callers can tell
|
|
3206
|
-
* "need to derive/hydrate this version" from "wrong key for intact ciphertext".
|
|
3268
|
+
* Created on the write path by the auto-extraction worker (W2) when a
|
|
3269
|
+
* candidate fact arrives with non-empty `entities[]`. Used at retrieval
|
|
3270
|
+
* time as a 3rd RRF lane (W5 graph traversal): query entity overlap
|
|
3271
|
+
* with stored memories surfaces topically-related facts that pure
|
|
3272
|
+
* semantic search misses.
|
|
3207
3273
|
*/
|
|
3208
|
-
declare class
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3274
|
+
declare class Entity extends Model {
|
|
3275
|
+
static table: string;
|
|
3276
|
+
/** Lowercased, trimmed name used for dedup and lookup. */
|
|
3277
|
+
canonicalName: string;
|
|
3278
|
+
/** Optional category — "person" | "place" | "thing" | "concept" | etc. */
|
|
3279
|
+
kind: string | null;
|
|
3280
|
+
createdAt: Date;
|
|
3281
|
+
updatedAt: Date;
|
|
3212
3282
|
}
|
|
3213
3283
|
/**
|
|
3214
|
-
*
|
|
3284
|
+
* Join row: a memory references an entity (and vice versa). Multiple
|
|
3285
|
+
* rows per memory (one per entity) and per entity (one per memory).
|
|
3215
3286
|
*/
|
|
3216
|
-
|
|
3287
|
+
declare class MemoryEntity extends Model {
|
|
3288
|
+
static table: string;
|
|
3289
|
+
memoryId: string;
|
|
3290
|
+
entityId: string;
|
|
3217
3291
|
/**
|
|
3218
|
-
*
|
|
3219
|
-
*
|
|
3220
|
-
*
|
|
3221
|
-
* caller has ciphertext that must keep working — force-replace can pin a
|
|
3222
|
-
* newly derived wrong key over a still-valid one.
|
|
3292
|
+
* User-scope for the W5 graph lane. Optional because client-side
|
|
3293
|
+
* (single-user) deployments may leave it null; server-side multi-user
|
|
3294
|
+
* deployments must set it so retrieval can filter cross-user IDs.
|
|
3223
3295
|
*/
|
|
3224
|
-
|
|
3296
|
+
userId: string | null;
|
|
3297
|
+
createdAt: Date;
|
|
3225
3298
|
}
|
|
3299
|
+
|
|
3226
3300
|
/**
|
|
3227
|
-
*
|
|
3228
|
-
*
|
|
3229
|
-
*
|
|
3301
|
+
* The recognized entity classifications. Runtime list + derived type kept
|
|
3302
|
+
* in one place so the extractor's validation and the `EntityKind` union
|
|
3303
|
+
* can't drift apart.
|
|
3304
|
+
* @public
|
|
3230
3305
|
*/
|
|
3231
|
-
declare
|
|
3306
|
+
declare const ENTITY_KINDS: readonly ["person", "organization", "place", "event", "product", "thing", "concept", "other"];
|
|
3307
|
+
/** @public */
|
|
3308
|
+
type EntityKind = (typeof ENTITY_KINDS)[number];
|
|
3309
|
+
interface StoredEntity {
|
|
3310
|
+
uniqueId: string;
|
|
3311
|
+
canonicalName: string;
|
|
3312
|
+
kind: string | null;
|
|
3313
|
+
createdAt: Date;
|
|
3314
|
+
updatedAt: Date;
|
|
3315
|
+
}
|
|
3232
3316
|
/**
|
|
3233
|
-
*
|
|
3234
|
-
*
|
|
3317
|
+
* Who put a topic on a memory. Written to `memory_vault.topics` but not yet
|
|
3318
|
+
* READ anywhere — it exists so a later improvement can refresh the `auto`
|
|
3319
|
+
* entries of a curated memory while leaving `user` entries alone (today
|
|
3320
|
+
* `topics_user_managed` is all-or-nothing per memory) without needing a second
|
|
3321
|
+
* migration or backfill. Don't build that behavior off it yet.
|
|
3322
|
+
*
|
|
3323
|
+
* When you do: a value written by the v42 backfill is NOT ground truth. Pre-v42
|
|
3324
|
+
* rows carry no per-topic provenance, so `backfillMemoryTopicsOp` derives it
|
|
3325
|
+
* from the per-memory `topics_user_managed` flag and stamps a curated legacy
|
|
3326
|
+
* row's every topic `user` — see the note at that derivation.
|
|
3327
|
+
* @public
|
|
3235
3328
|
*/
|
|
3236
|
-
|
|
3329
|
+
type TopicSource = "user" | "auto";
|
|
3237
3330
|
/**
|
|
3238
|
-
*
|
|
3239
|
-
*
|
|
3240
|
-
*
|
|
3241
|
-
*
|
|
3242
|
-
*
|
|
3243
|
-
*
|
|
3244
|
-
* persisted ECDH key pairs from localStorage so they can't be decrypted by a
|
|
3245
|
-
* subsequent user on a shared browser.
|
|
3246
|
-
*
|
|
3247
|
-
* Call this on logout / session-end to prevent cross-user key leakage on shared
|
|
3248
|
-
* browsers. If you manage auth outside the SDK, wire this into your logout flow.
|
|
3249
|
-
*
|
|
3250
|
-
* @example
|
|
3251
|
-
* ```tsx
|
|
3252
|
-
* import { clearAllEncryptionState } from "@anuma/sdk/react";
|
|
3253
|
-
*
|
|
3254
|
-
* async function handleLogout() {
|
|
3255
|
-
* clearAllEncryptionState();
|
|
3256
|
-
* await privy.logout();
|
|
3257
|
-
* }
|
|
3258
|
-
* ```
|
|
3331
|
+
* One entry in `memory_vault.topics` — the durable, synced record of a memory's
|
|
3332
|
+
* topics. `name` carries the CALLER's display casing, unlike
|
|
3333
|
+
* {@link StoredEntity.canonicalName}, which {@link normalizeEntityName}
|
|
3334
|
+
* lowercases and which has no display column: preserving casing here is the
|
|
3335
|
+
* point of storing names on the memory row.
|
|
3336
|
+
* @public
|
|
3259
3337
|
*/
|
|
3260
|
-
|
|
3338
|
+
interface StoredTopic {
|
|
3339
|
+
name: string;
|
|
3340
|
+
kind?: string;
|
|
3341
|
+
source: TopicSource;
|
|
3342
|
+
/** How central the topic is to the memory, in (0, 1]; read it with {@link topicWeight}. */
|
|
3343
|
+
weight?: number;
|
|
3344
|
+
}
|
|
3261
3345
|
/**
|
|
3262
|
-
*
|
|
3263
|
-
*
|
|
3264
|
-
* @deprecated Use {@link clearAllEncryptionState} instead. This function is kept
|
|
3265
|
-
* as an alias for backwards compatibility and now delegates to the canonical
|
|
3266
|
-
* teardown, which additionally clears `keyAvailableCallbacks`, pending key
|
|
3267
|
-
* requests, and derived ECDH key pairs (both in-memory and persisted).
|
|
3346
|
+
* Fixed weight per salience level the topic extractor assigns.
|
|
3347
|
+
* @public
|
|
3268
3348
|
*/
|
|
3269
|
-
declare
|
|
3349
|
+
declare const TOPIC_SALIENCE_WEIGHTS: {
|
|
3350
|
+
readonly primary: 1;
|
|
3351
|
+
readonly secondary: 0.6;
|
|
3352
|
+
readonly mention: 0.3;
|
|
3353
|
+
};
|
|
3354
|
+
/** @public */
|
|
3355
|
+
type TopicSalience = keyof typeof TOPIC_SALIENCE_WEIGHTS;
|
|
3270
3356
|
/**
|
|
3271
|
-
*
|
|
3272
|
-
*
|
|
3273
|
-
* Privy Solana `signMessage` returns a `Uint8Array`. Pass those bytes here.
|
|
3274
|
-
* The signature is never hex-encoded, base58-encoded, or passed through
|
|
3275
|
-
* `String()`. That string round-trip is what made {@link hexToBytes} store
|
|
3276
|
-
* zeros for every non-hex pair and yield a low-entropy AES key.
|
|
3277
|
-
*
|
|
3278
|
-
* This is the derivation for the next key version (`anuma-sdk-aes-gcm-v4`).
|
|
3279
|
-
* {@link requestEncryptionKey} does not install it; v2 and v3 stay on the
|
|
3280
|
-
* hex-string path so existing ciphertext keeps decrypting. The return value
|
|
3281
|
-
* is the same 64-char hex form the in-memory store already uses.
|
|
3282
|
-
*
|
|
3283
|
-
* @param signature - Raw signature bytes. Must be at least 64 bytes.
|
|
3284
|
-
* @returns 32-byte AES-GCM key as hex, without a `0x` prefix.
|
|
3285
|
-
* @throws Error when `signature` is shorter than 64 bytes.
|
|
3286
|
-
* @category Encryption
|
|
3357
|
+
* A topic's weight: 1 when it is user-set or carries no weight.
|
|
3358
|
+
* @public
|
|
3287
3359
|
*/
|
|
3288
|
-
declare function
|
|
3360
|
+
declare function topicWeight(topic: StoredTopic): number;
|
|
3289
3361
|
/**
|
|
3290
|
-
*
|
|
3291
|
-
*
|
|
3292
|
-
* Uses a cache to avoid re-importing the same key on every call.
|
|
3293
|
-
*
|
|
3294
|
-
* @param address - The wallet address
|
|
3295
|
-
* @param version - Which key version to use (default: "v3" for HKDF key)
|
|
3296
|
-
* @returns The CryptoKey for AES-GCM encryption/decryption
|
|
3297
|
-
* @throws Error if the key hasn't been requested yet
|
|
3362
|
+
* The first topic with the highest weight, or null when there are none.
|
|
3363
|
+
* @public
|
|
3298
3364
|
*/
|
|
3299
|
-
declare function
|
|
3365
|
+
declare function primaryTopic(topics: readonly StoredTopic[] | null | undefined): StoredTopic | null;
|
|
3366
|
+
/** @public */
|
|
3367
|
+
interface CreateEntityOptions {
|
|
3368
|
+
canonicalName: string;
|
|
3369
|
+
kind?: EntityKind | (string & {});
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3300
3372
|
/**
|
|
3301
|
-
*
|
|
3302
|
-
*
|
|
3303
|
-
*
|
|
3304
|
-
*
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3373
|
+
* Accepted entity shape for {@link linkMemoryEntitiesOp}. A bare string is
|
|
3374
|
+
* a name with no kind (back-compat with the original signature); the object
|
|
3375
|
+
* form carries an optional classification.
|
|
3376
|
+
* @public
|
|
3377
|
+
*/
|
|
3378
|
+
type EntityInput = string | {
|
|
3379
|
+
name: string;
|
|
3380
|
+
kind?: EntityKind | (string & {});
|
|
3381
|
+
weight?: number;
|
|
3382
|
+
};
|
|
3383
|
+
interface EntityOperationsContext {
|
|
3384
|
+
database: Database;
|
|
3385
|
+
entityCollection: Collection<Entity>;
|
|
3386
|
+
memoryEntityCollection: Collection<MemoryEntity>;
|
|
3387
|
+
/**
|
|
3388
|
+
* Optional user-scope. When provided, `linkMemoryEntitiesOp` stamps
|
|
3389
|
+
* `user_id` on new memory_entity rows and `getMemoriesByEntityNamesOp`
|
|
3390
|
+
* filters lookups by it. Leave undefined for single-user clients.
|
|
3391
|
+
*/
|
|
3392
|
+
userId?: string;
|
|
3393
|
+
/**
|
|
3394
|
+
* When `true`, `getMemoriesByEntityNamesOp` admits rows with
|
|
3395
|
+
* `user_id = null` alongside the strict `userId` match. Set this on
|
|
3396
|
+
* LokiJS (web) adapters where the v31 `unsafeExecuteSql` backfill
|
|
3397
|
+
* is a no-op — pre-v31 rows otherwise become invisible to the W5
|
|
3398
|
+
* lane until `backfillMemoryEntityUserIdsOp` runs. Default `false`
|
|
3399
|
+
* (server / SQLite, where the migration backfill is authoritative).
|
|
3400
|
+
*/
|
|
3401
|
+
allowUnscopedRows?: boolean;
|
|
3402
|
+
canWrite?: () => Promise<boolean>;
|
|
3403
|
+
}
|
|
3404
|
+
/**
|
|
3405
|
+
* Link a memory to one or more entities. Accepts bare names (back-compat)
|
|
3406
|
+
* or `{ name, kind }` objects. Names are normalized; missing entities are
|
|
3407
|
+
* auto-created (with their kind), and an existing entity's null kind is
|
|
3408
|
+
* back-filled — see {@link upsertEntitiesInWrite}. Idempotent — duplicate
|
|
3409
|
+
* (memory_id, entity_id) pairs are skipped.
|
|
3315
3410
|
*
|
|
3316
|
-
*
|
|
3317
|
-
*
|
|
3411
|
+
* `options.unlessTopicsUserManaged` re-checks the memory's vault row INSIDE
|
|
3412
|
+
* the serialized writer and skips link creation when the row is user-managed
|
|
3413
|
+
* (`topics_user_managed`), soft-deleted, or absent. Auto paths (extraction,
|
|
3414
|
+
* topic worker) need this: a pre-call check races the LLM round-trip —
|
|
3415
|
+
* `setMemoryEntitiesOp` sets the flag in its own writer and a delete can land
|
|
3416
|
+
* mid-call (orphaning links the cascade already swept) — so only an in-write
|
|
3417
|
+
* check guarantees a user's manual edit or delete can't be grafted over. The
|
|
3418
|
+
* row read fails CLOSED (skip links) so a transient fault never attaches
|
|
3419
|
+
* topics to a memory we couldn't verify. Entity upserts and link creation
|
|
3420
|
+
* run in ONE writer to prevent orphan-prune races; returns [] when links
|
|
3421
|
+
* were skipped.
|
|
3318
3422
|
*
|
|
3319
|
-
*
|
|
3320
|
-
*
|
|
3321
|
-
*
|
|
3322
|
-
*
|
|
3423
|
+
* `options.topicsSource` (default `auto`) is the provenance recorded in
|
|
3424
|
+
* `memory_vault.topics`, which this rewrites from the memory's FULL resulting
|
|
3425
|
+
* link set — see {@link prepareTopicsUpdate}. Add semantics mean that set is
|
|
3426
|
+
* old ∪ new, so already-linked entities are resolved for their names too.
|
|
3323
3427
|
*
|
|
3324
|
-
* @
|
|
3428
|
+
* @deprecated App code: use `MemoryStore.addTopics` (`createLocalMemoryStore`).
|
|
3325
3429
|
*/
|
|
3326
|
-
declare function
|
|
3430
|
+
declare function linkMemoryEntitiesOp(ctx: EntityOperationsContext, memoryId: string, entityInputs: ReadonlyArray<EntityInput>, options?: {
|
|
3431
|
+
unlessTopicsUserManaged?: boolean;
|
|
3432
|
+
topicsSource?: TopicSource;
|
|
3433
|
+
}): Promise<StoredEntity[]>;
|
|
3327
3434
|
/**
|
|
3328
|
-
*
|
|
3329
|
-
*
|
|
3330
|
-
*
|
|
3331
|
-
*
|
|
3332
|
-
*
|
|
3435
|
+
* REPLACE a memory's entity links with an auto-derived set — the topic
|
|
3436
|
+
* worker's write primitive. Unlike {@link setMemoryEntitiesOp} it does NOT
|
|
3437
|
+
* mark the memory user-managed (the pass is automatic), and unlike
|
|
3438
|
+
* {@link linkMemoryEntitiesOp} it removes stale links, so re-extracting an
|
|
3439
|
+
* edited memory drops entities its previous content mentioned ("works at
|
|
3440
|
+
* Acme" → "works at Globex" must unlink Acme). Insert-missing and
|
|
3441
|
+
* destroy-stale are batched in ONE writer, after the same in-write guard as
|
|
3442
|
+
* the link op (user-managed / deleted / absent / read-fault ⇒ skip).
|
|
3333
3443
|
*
|
|
3334
|
-
*
|
|
3335
|
-
* @
|
|
3336
|
-
*
|
|
3337
|
-
*
|
|
3444
|
+
* That batch also prunes `entity` rows left with no links at all (see
|
|
3445
|
+
* {@link findOrphanedEntities}) — otherwise a topic the extractor has disowned
|
|
3446
|
+
* keeps rendering as a chip that matches no memory.
|
|
3447
|
+
*
|
|
3448
|
+
* Returns the linked entities ([] for an answered-empty set), or null when
|
|
3449
|
+
* the guard skipped — callers must treat null as "not persisted" (e.g. don't
|
|
3450
|
+
* stamp `topics_extracted_at`).
|
|
3338
3451
|
*/
|
|
3339
|
-
declare function
|
|
3452
|
+
declare function replaceMemoryEntitiesGuardedOp(ctx: EntityOperationsContext, memoryId: string, entityInputs: ReadonlyArray<EntityInput>): Promise<StoredEntity[] | null>;
|
|
3340
3453
|
/**
|
|
3341
|
-
*
|
|
3454
|
+
* Backfill `memory_entity.user_id` from the parent vault row's user_id.
|
|
3455
|
+
* Idempotent — only touches rows where user_id is null.
|
|
3342
3456
|
*
|
|
3343
|
-
*
|
|
3344
|
-
*
|
|
3345
|
-
*
|
|
3457
|
+
* Why this exists: the v31 schema migration backfills via
|
|
3458
|
+
* `unsafeExecuteSql`, which is a no-op on the LokiJS (web) adapter. Native
|
|
3459
|
+
* SQLite installs have already been filled by the migration; web installs
|
|
3460
|
+
* upgrading through v31 keep `user_id=null` on every pre-existing
|
|
3461
|
+
* `memory_entity` row until this helper runs.
|
|
3346
3462
|
*
|
|
3347
|
-
*
|
|
3348
|
-
*
|
|
3349
|
-
*
|
|
3350
|
-
*
|
|
3463
|
+
* Consumers wiring an `EntityOperationsContext` with `userId` set are
|
|
3464
|
+
* obliged to call this once on first use — `getMemoriesByEntityNamesOp`
|
|
3465
|
+
* strictly filters by `user_id`, so unstamped rows are otherwise
|
|
3466
|
+
* invisible to the W5 graph lane.
|
|
3351
3467
|
*
|
|
3352
|
-
* @
|
|
3353
|
-
|
|
3354
|
-
|
|
3468
|
+
* @public
|
|
3469
|
+
*/
|
|
3470
|
+
declare function backfillMemoryEntityUserIdsOp(ctx: EntityOperationsContext, vaultMemoryCollection: {
|
|
3471
|
+
find: (id: string) => Promise<{
|
|
3472
|
+
userId?: string | null;
|
|
3473
|
+
}>;
|
|
3474
|
+
}): Promise<number>;
|
|
3475
|
+
/**
|
|
3476
|
+
* W5 graph-lane read: given a set of entity names (e.g. extracted from
|
|
3477
|
+
* a query), return the set of memory IDs linked to *any* of them, with
|
|
3478
|
+
* a per-memory count of how many of the queried entities they match.
|
|
3355
3479
|
*
|
|
3356
|
-
*
|
|
3357
|
-
*
|
|
3480
|
+
* Caller passes the result to `rankByEntityOverlap` to score each
|
|
3481
|
+
* memory via `tanh(0.5 × shared_entity_count)` — this op only does the
|
|
3482
|
+
* cheap "find candidate memories" step and leaves scoring to the
|
|
3483
|
+
* ranker so callers can attach their own kind-weights or alternative
|
|
3484
|
+
* scoring strategies later.
|
|
3358
3485
|
*
|
|
3359
|
-
*
|
|
3360
|
-
*
|
|
3361
|
-
* if (encrypted) {
|
|
3362
|
-
* const decrypted = await decryptData(encrypted, walletAddress);
|
|
3363
|
-
* console.log("Decrypted:", decrypted);
|
|
3364
|
-
* }
|
|
3365
|
-
* ```
|
|
3486
|
+
* Names are normalized (lowercased, trimmed). Empty input returns an
|
|
3487
|
+
* empty map. Names that don't exist as entities contribute nothing.
|
|
3366
3488
|
*
|
|
3367
|
-
*
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
/**
|
|
3371
|
-
* Decrypts data and returns as Uint8Array (for binary data)
|
|
3372
|
-
* @param encryptedHex - Encrypted data as hex string (IV + ciphertext + auth tag)
|
|
3373
|
-
* @returns Decrypted data as Uint8Array
|
|
3374
|
-
*/
|
|
3375
|
-
declare function decryptDataBytes(encryptedHex: string, address: string, version?: EncryptionKeyVersion): Promise<Uint8Array>;
|
|
3376
|
-
/**
|
|
3377
|
-
* Like {@link decryptDataBytes} but takes the raw encrypted bytes
|
|
3378
|
-
* (`[IV][ciphertext+tag]`) directly instead of a hex string. Skips the
|
|
3379
|
-
* `hexToBytes` conversion — for large binary media the hex string the caller
|
|
3380
|
-
* would otherwise build is a ~1.37x copy of the whole payload (a ~1GB string
|
|
3381
|
-
* for a 500MB video), plus this avoids a second byte copy. Same key resolution
|
|
3382
|
-
* as decryptDataBytes.
|
|
3489
|
+
* Multi-user safety: when `ctx.userId` is set, results are filtered to
|
|
3490
|
+
* memory_entity rows whose `user_id` matches. Without this filter the
|
|
3491
|
+
* lane returns IDs from every user who tagged a matching entity.
|
|
3383
3492
|
*
|
|
3384
|
-
* @
|
|
3385
|
-
* @param address - The wallet address associated with the encryption key
|
|
3386
|
-
* @param version - Encryption key version to decrypt with (defaults to "v3")
|
|
3387
|
-
* @returns Decrypted data as Uint8Array
|
|
3388
|
-
* @category Encryption
|
|
3493
|
+
* @deprecated App code: use `MemoryStore.memoriesByTopics` (`createLocalMemoryStore`).
|
|
3389
3494
|
*/
|
|
3390
|
-
declare function
|
|
3495
|
+
declare function getMemoriesByEntityNamesOp(ctx: EntityOperationsContext, entityNames: readonly string[]): Promise<Map<string, Set<string>>>;
|
|
3391
3496
|
/**
|
|
3392
|
-
*
|
|
3497
|
+
* Reverse of {@link getMemoriesByEntityNamesOp}: given a set of memory IDs
|
|
3498
|
+
* (e.g. the current BFS frontier), return each memory's set of linked
|
|
3499
|
+
* canonical entity names. This is the missing primitive for multi-hop graph
|
|
3500
|
+
* traversal (PR4) — one step outward from a memory to its neighbor entities,
|
|
3501
|
+
* which the traversal then expands to reach topically-adjacent memories.
|
|
3393
3502
|
*
|
|
3394
|
-
*
|
|
3395
|
-
*
|
|
3396
|
-
* write/OPFS/encrypt paths need. Callers that only need to read legacy
|
|
3397
|
-
* `enc:v2:` data should pass `"v2"` explicitly. (#561 / PR #828)
|
|
3398
|
-
*/
|
|
3399
|
-
declare function hasEncryptionKey(address: string, version?: EncryptionKeyVersion): boolean;
|
|
3400
|
-
/**
|
|
3401
|
-
* Seed (or merge) raw key hex into the in-memory store without signing.
|
|
3503
|
+
* Empty input returns an empty map. Memory IDs with no links contribute
|
|
3504
|
+
* nothing (they simply don't appear as keys).
|
|
3402
3505
|
*
|
|
3403
|
-
*
|
|
3404
|
-
*
|
|
3405
|
-
*
|
|
3506
|
+
* Multi-user safety mirrors {@link getMemoriesByEntityNamesOp} exactly: when
|
|
3507
|
+
* `ctx.userId` is set, only `memory_entity` rows owned by that user are
|
|
3508
|
+
* followed (with the same `allowUnscopedRows` LokiJS escape hatch for pre-v31
|
|
3509
|
+
* rows whose `user_id` backfill was a no-op). Without the filter the reverse
|
|
3510
|
+
* lookup would leak entity links written by other users.
|
|
3406
3511
|
*
|
|
3407
|
-
*
|
|
3408
|
-
* Pass an explicit empty merge is not supported; omit the field to leave it.
|
|
3512
|
+
* @public
|
|
3409
3513
|
*
|
|
3410
|
-
*
|
|
3514
|
+
* @deprecated App code: use `MemoryStore.topicsByMemories` (`createLocalMemoryStore`).
|
|
3411
3515
|
*/
|
|
3412
|
-
declare function
|
|
3413
|
-
|
|
3414
|
-
current?: string;
|
|
3415
|
-
}): void;
|
|
3516
|
+
declare function getEntitiesByMemoryIdsOp(ctx: EntityOperationsContext, memoryIds: readonly string[]): Promise<Map<string, Set<string>>>;
|
|
3517
|
+
|
|
3416
3518
|
/**
|
|
3417
|
-
*
|
|
3418
|
-
*
|
|
3519
|
+
* Encryption key version type.
|
|
3520
|
+
* - "v2": Legacy SHA-256 derived key (for reading enc:v2: data)
|
|
3521
|
+
* - "v3": HKDF derived key with domain separation (for new encryption)
|
|
3419
3522
|
*
|
|
3420
|
-
*
|
|
3421
|
-
*
|
|
3422
|
-
* @
|
|
3423
|
-
* @internal
|
|
3523
|
+
* Raw signature bytes (Privy Solana `signMessage` returns a `Uint8Array`) are
|
|
3524
|
+
* not a stored version. Derive them with {@link deriveKeyFromSignatureBytes}.
|
|
3525
|
+
* {@link requestEncryptionKey} still derives v2 and v3 from a hex signature only.
|
|
3424
3526
|
*/
|
|
3425
|
-
|
|
3527
|
+
type EncryptionKeyVersion = "v2" | "v3";
|
|
3426
3528
|
/**
|
|
3427
|
-
*
|
|
3428
|
-
*
|
|
3429
|
-
*
|
|
3430
|
-
* @param encryptedHex - Encrypted data as hex string (IV + ciphertext + auth tag)
|
|
3431
|
-
* @param key - The CryptoKey for AES-GCM decryption
|
|
3432
|
-
* @returns Decrypted data as string
|
|
3433
|
-
* @internal
|
|
3529
|
+
* Thrown by {@link getEncryptionKey} when the requested version is absent.
|
|
3530
|
+
* Distinct from AES-GCM auth-tag failures so decrypt callers can tell
|
|
3531
|
+
* "need to derive/hydrate this version" from "wrong key for intact ciphertext".
|
|
3434
3532
|
*/
|
|
3435
|
-
declare
|
|
3533
|
+
declare class EncryptionKeyMissingError extends Error {
|
|
3534
|
+
readonly address: string;
|
|
3535
|
+
readonly version: EncryptionKeyVersion;
|
|
3536
|
+
constructor(address: string, version: EncryptionKeyVersion);
|
|
3537
|
+
}
|
|
3436
3538
|
/**
|
|
3437
|
-
*
|
|
3438
|
-
* Much faster than calling encryptData for each value individually.
|
|
3439
|
-
*
|
|
3440
|
-
* @param values - Array of plaintext values to encrypt
|
|
3441
|
-
* @param address - The wallet address associated with the encryption key
|
|
3442
|
-
* @returns Array of encrypted values as hex strings
|
|
3443
|
-
* @throws Error if encryption key is not found in memory
|
|
3444
|
-
*
|
|
3445
|
-
* @example
|
|
3446
|
-
* ```tsx
|
|
3447
|
-
* const encrypted = await encryptDataBatch(
|
|
3448
|
-
* ["secret1", "secret2", "secret3"],
|
|
3449
|
-
* walletAddress
|
|
3450
|
-
* );
|
|
3451
|
-
* ```
|
|
3452
|
-
*
|
|
3453
|
-
* @category Encryption
|
|
3539
|
+
* Options for {@link requestEncryptionKey}.
|
|
3454
3540
|
*/
|
|
3455
|
-
|
|
3456
|
-
/**
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
*
|
|
3465
|
-
* @example
|
|
3466
|
-
* ```tsx
|
|
3467
|
-
* const decrypted = await decryptDataBatch(
|
|
3468
|
-
* [encrypted1, encrypted2, encrypted3],
|
|
3469
|
-
* walletAddress
|
|
3470
|
-
* );
|
|
3471
|
-
* ```
|
|
3472
|
-
*
|
|
3473
|
-
* @category Encryption
|
|
3474
|
-
*/
|
|
3475
|
-
declare function decryptDataBatch(encryptedValues: string[], address: string): Promise<string[]>;
|
|
3476
|
-
/**
|
|
3477
|
-
* Options for signing messages.
|
|
3478
|
-
*/
|
|
3479
|
-
interface SignMessageOptions {
|
|
3480
|
-
/** Whether to show wallet UI during signing. Default: true */
|
|
3481
|
-
showWalletUIs?: boolean;
|
|
3541
|
+
interface RequestEncryptionKeyOptions {
|
|
3542
|
+
/**
|
|
3543
|
+
* When true, re-derive and replace any existing in-memory keys for this
|
|
3544
|
+
* address. Default false preserves the historical "if present, return"
|
|
3545
|
+
* short-circuit. Prefer {@link refreshEncryptionKeyIfMatches} when the
|
|
3546
|
+
* caller has ciphertext that must keep working — force-replace can pin a
|
|
3547
|
+
* newly derived wrong key over a still-valid one.
|
|
3548
|
+
*/
|
|
3549
|
+
force?: boolean;
|
|
3482
3550
|
}
|
|
3483
3551
|
/**
|
|
3484
|
-
*
|
|
3485
|
-
*
|
|
3486
|
-
*
|
|
3487
|
-
* The resolved value must be a hex signature (`0x`-prefixed or bare). A
|
|
3488
|
-
* non-hex string — including `String(uint8Array)` or a base58 signature —
|
|
3489
|
-
* throws from key derivation instead of becoming a zero-filled AES key.
|
|
3490
|
-
* Raw signature bytes go to {@link deriveKeyFromSignatureBytes}.
|
|
3552
|
+
* Register a callback that fires when an encryption key becomes available for an address.
|
|
3553
|
+
* If the key is already available, the callback fires immediately.
|
|
3554
|
+
* @returns Unsubscribe function
|
|
3491
3555
|
*/
|
|
3492
|
-
|
|
3556
|
+
declare function onKeyAvailable(address: string, callback: () => void): () => void;
|
|
3493
3557
|
/**
|
|
3494
|
-
*
|
|
3495
|
-
*
|
|
3496
|
-
* when configured correctly in the Privy dashboard.
|
|
3558
|
+
* Clears the encryption key for a wallet address from memory
|
|
3559
|
+
* @param address - The wallet address
|
|
3497
3560
|
*/
|
|
3498
|
-
|
|
3561
|
+
declare function clearEncryptionKey(address: string): void;
|
|
3499
3562
|
/**
|
|
3500
|
-
*
|
|
3501
|
-
* If a key already exists in memory for the given wallet, resolves immediately
|
|
3502
|
-
* unless {@link RequestEncryptionKeyOptions.force} is set.
|
|
3563
|
+
* Clears all encryption-related state from memory and any derived persistence.
|
|
3503
3564
|
*
|
|
3504
|
-
*
|
|
3505
|
-
*
|
|
3565
|
+
* This is the canonical session-teardown entry point. It wipes every module-level
|
|
3566
|
+
* map that retains key material or listeners tied to a session: the raw
|
|
3567
|
+
* encryption keys, cached imported CryptoKey objects, availability callbacks,
|
|
3568
|
+
* pending sign-in flights, and derived ECDH key pairs. It also removes any
|
|
3569
|
+
* persisted ECDH key pairs from localStorage so they can't be decrypted by a
|
|
3570
|
+
* subsequent user on a shared browser.
|
|
3506
3571
|
*
|
|
3507
|
-
*
|
|
3508
|
-
*
|
|
3509
|
-
* (without firing {@link onKeyAvailable}). Callers that need write readiness
|
|
3510
|
-
* should check the return value or {@link hasEncryptionKey} before encrypting
|
|
3511
|
-
* so they can surface a re-unlock UI instead of failing downstream (#828).
|
|
3572
|
+
* Call this on logout / session-end to prevent cross-user key leakage on shared
|
|
3573
|
+
* browsers. If you manage auth outside the SDK, wire this into your logout flow.
|
|
3512
3574
|
*
|
|
3513
|
-
* @
|
|
3514
|
-
*
|
|
3515
|
-
*
|
|
3516
|
-
*
|
|
3517
|
-
*
|
|
3518
|
-
*
|
|
3519
|
-
*
|
|
3575
|
+
* @example
|
|
3576
|
+
* ```tsx
|
|
3577
|
+
* import { clearAllEncryptionState } from "@anuma/sdk/react";
|
|
3578
|
+
*
|
|
3579
|
+
* async function handleLogout() {
|
|
3580
|
+
* clearAllEncryptionState();
|
|
3581
|
+
* await privy.logout();
|
|
3582
|
+
* }
|
|
3583
|
+
* ```
|
|
3520
3584
|
*/
|
|
3521
|
-
declare function
|
|
3585
|
+
declare function clearAllEncryptionState(): void;
|
|
3522
3586
|
/**
|
|
3523
|
-
*
|
|
3524
|
-
* they successfully decrypt `probeCiphertext` (a prefixed `enc:v2:` / `enc:v3:`
|
|
3525
|
-
* value). If they do not, the existing in-memory keys are left untouched.
|
|
3526
|
-
*
|
|
3527
|
-
* Concurrent calls for the same wallet share one sign+derive. Each caller then
|
|
3528
|
-
* probes **its own** ciphertext against those candidates, so mixed-era messages
|
|
3529
|
-
* in one `Promise.all` batch can still recover when only the leader's probe
|
|
3530
|
-
* misses (#828 review). Failed candidates are memoized for the session so
|
|
3531
|
-
* pagination does not re-prompt on every page when the wallet has changed.
|
|
3587
|
+
* Clears all encryption keys from memory.
|
|
3532
3588
|
*
|
|
3533
|
-
* @
|
|
3534
|
-
*
|
|
3535
|
-
*
|
|
3589
|
+
* @deprecated Use {@link clearAllEncryptionState} instead. This function is kept
|
|
3590
|
+
* as an alias for backwards compatibility and now delegates to the canonical
|
|
3591
|
+
* teardown, which additionally clears `keyAvailableCallbacks`, pending key
|
|
3592
|
+
* requests, and derived ECDH key pairs (both in-memory and persisted).
|
|
3536
3593
|
*/
|
|
3537
|
-
declare function
|
|
3594
|
+
declare function clearAllEncryptionKeys(): void;
|
|
3538
3595
|
/**
|
|
3539
|
-
*
|
|
3540
|
-
* If a key pair already exists in memory for the given wallet, resolves immediately.
|
|
3596
|
+
* Derives the bytes-native AES key from a raw signature.
|
|
3541
3597
|
*
|
|
3542
|
-
*
|
|
3543
|
-
*
|
|
3598
|
+
* Privy Solana `signMessage` returns a `Uint8Array`. Pass those bytes here.
|
|
3599
|
+
* The signature is never hex-encoded, base58-encoded, or passed through
|
|
3600
|
+
* `String()`. That string round-trip is what made {@link hexToBytes} store
|
|
3601
|
+
* zeros for every non-hex pair and yield a low-entropy AES key.
|
|
3544
3602
|
*
|
|
3545
|
-
*
|
|
3546
|
-
* @
|
|
3547
|
-
*
|
|
3548
|
-
*
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
*
|
|
3553
|
-
* @
|
|
3554
|
-
* @param signMessage - Function to sign a message (returns signature hex string)
|
|
3555
|
-
* @param embeddedWalletSigner - Optional function for silent signing with embedded wallets
|
|
3556
|
-
* @returns The public key as base64-encoded SPKI string
|
|
3557
|
-
*/
|
|
3558
|
-
declare function exportPublicKey(address: string, signMessage: SignMessageFn, embeddedWalletSigner?: EmbeddedWalletSignerFn): Promise<string>;
|
|
3559
|
-
/**
|
|
3560
|
-
* Checks if a key pair exists in memory for the given wallet address
|
|
3561
|
-
* @param address - The wallet address
|
|
3562
|
-
* @returns True if key pair exists, false otherwise
|
|
3603
|
+
* This is the derivation for the next key version (`anuma-sdk-aes-gcm-v4`).
|
|
3604
|
+
* {@link requestEncryptionKey} does not install it; v2 and v3 stay on the
|
|
3605
|
+
* hex-string path so existing ciphertext keeps decrypting. The return value
|
|
3606
|
+
* is the same 64-char hex form the in-memory store already uses.
|
|
3607
|
+
*
|
|
3608
|
+
* @param signature - Raw signature bytes. Must be at least 64 bytes.
|
|
3609
|
+
* @returns 32-byte AES-GCM key as hex, without a `0x` prefix.
|
|
3610
|
+
* @throws Error when `signature` is shorter than 64 bytes.
|
|
3611
|
+
* @category Encryption
|
|
3563
3612
|
*/
|
|
3564
|
-
declare function
|
|
3613
|
+
declare function deriveKeyFromSignatureBytes(signature: Uint8Array): Promise<string>;
|
|
3565
3614
|
/**
|
|
3566
|
-
*
|
|
3615
|
+
* Gets the encryption key from in-memory storage and imports it as a CryptoKey.
|
|
3616
|
+
* The key must have been previously requested via requestEncryptionKey.
|
|
3617
|
+
* Uses a cache to avoid re-importing the same key on every call.
|
|
3618
|
+
*
|
|
3567
3619
|
* @param address - The wallet address
|
|
3620
|
+
* @param version - Which key version to use (default: "v3" for HKDF key)
|
|
3621
|
+
* @returns The CryptoKey for AES-GCM encryption/decryption
|
|
3622
|
+
* @throws Error if the key hasn't been requested yet
|
|
3568
3623
|
*/
|
|
3569
|
-
declare function
|
|
3624
|
+
declare function getEncryptionKey(address: string, version?: EncryptionKeyVersion): Promise<CryptoKey>;
|
|
3570
3625
|
/**
|
|
3571
|
-
*
|
|
3626
|
+
* Encrypts data using AES-GCM with the stored encryption key.
|
|
3572
3627
|
*
|
|
3573
|
-
*
|
|
3574
|
-
*
|
|
3575
|
-
*
|
|
3576
|
-
*/
|
|
3577
|
-
declare function clearAllKeyPairs(): void;
|
|
3578
|
-
/**
|
|
3579
|
-
* Result returned by the useEncryption hook.
|
|
3580
|
-
* @category Hooks
|
|
3581
|
-
*/
|
|
3582
|
-
interface UseEncryptionResult {
|
|
3583
|
-
/** Request and generate an encryption key for a wallet address */
|
|
3584
|
-
requestEncryptionKey: (walletAddress: string) => Promise<boolean>;
|
|
3585
|
-
/** Request and generate an ECDH key pair for a wallet address */
|
|
3586
|
-
requestKeyPair: (walletAddress: string) => Promise<void>;
|
|
3587
|
-
/** Export the public key for a wallet address as base64-encoded SPKI */
|
|
3588
|
-
exportPublicKey: (walletAddress: string) => Promise<string>;
|
|
3589
|
-
/** Check if a key pair exists in memory for a wallet address */
|
|
3590
|
-
hasKeyPair: (walletAddress: string) => boolean;
|
|
3591
|
-
/** Clear the key pair for a wallet address from memory */
|
|
3592
|
-
clearKeyPair: (walletAddress: string) => void;
|
|
3593
|
-
}
|
|
3594
|
-
/**
|
|
3595
|
-
* Hook that provides encryption key management for securing local data.
|
|
3628
|
+
* This function uses the encryption key previously generated via `requestEncryptionKey`
|
|
3629
|
+
* to encrypt data. The key must exist in memory before calling this function, or it
|
|
3630
|
+
* will throw an error prompting the user to sign a message.
|
|
3596
3631
|
*
|
|
3597
|
-
*
|
|
3598
|
-
*
|
|
3599
|
-
*
|
|
3632
|
+
* @param plaintext - The data to encrypt (string or Uint8Array)
|
|
3633
|
+
* @param address - The wallet address associated with the encryption key
|
|
3634
|
+
* @returns Encrypted data as hex string (IV + ciphertext + auth tag)
|
|
3635
|
+
* @throws Error if encryption key is not found in memory
|
|
3600
3636
|
*
|
|
3601
|
-
*
|
|
3637
|
+
* @example
|
|
3638
|
+
* ```tsx
|
|
3639
|
+
* import { encryptData, requestEncryptionKey } from "@anuma/sdk/react";
|
|
3602
3640
|
*
|
|
3603
|
-
*
|
|
3604
|
-
*
|
|
3605
|
-
* 3. The key is stored in memory (not localStorage) for the session
|
|
3606
|
-
* 4. Data can be encrypted/decrypted using this key
|
|
3607
|
-
* 5. On page reload, user must sign again to derive the key
|
|
3641
|
+
* // First, ensure encryption key exists
|
|
3642
|
+
* await requestEncryptionKey(walletAddress);
|
|
3608
3643
|
*
|
|
3609
|
-
*
|
|
3644
|
+
* // Then encrypt data
|
|
3645
|
+
* const encrypted = await encryptData("my secret data", walletAddress);
|
|
3646
|
+
* localStorage.setItem("mySecret", encrypted);
|
|
3647
|
+
* ```
|
|
3610
3648
|
*
|
|
3611
|
-
*
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3649
|
+
* @category Encryption
|
|
3650
|
+
*/
|
|
3651
|
+
declare function encryptData(plaintext: string | Uint8Array, address: string): Promise<string>;
|
|
3652
|
+
/**
|
|
3653
|
+
* Like {@link encryptData} but takes raw bytes and returns the raw encrypted
|
|
3654
|
+
* `[IV][ciphertext+tag]` Uint8Array instead of a hex string. Avoids the hex
|
|
3655
|
+
* round-trip (`encryptData` returns hex, which callers immediately convert back
|
|
3656
|
+
* to bytes) — for large binary media that hex string is a ~1.37x copy of the
|
|
3657
|
+
* whole payload. Use for binary uploads (e.g. enc:v3 media frames).
|
|
3615
3658
|
*
|
|
3616
|
-
*
|
|
3659
|
+
* @param plaintext - The raw bytes to encrypt
|
|
3660
|
+
* @param address - The wallet address associated with the encryption key
|
|
3661
|
+
* @returns Encrypted data as raw bytes (IV + ciphertext + auth tag)
|
|
3662
|
+
* @category Encryption
|
|
3663
|
+
*/
|
|
3664
|
+
declare function encryptDataBytes(plaintext: Uint8Array, address: string): Promise<Uint8Array>;
|
|
3665
|
+
/**
|
|
3666
|
+
* Decrypts data using AES-GCM with the stored encryption key.
|
|
3617
3667
|
*
|
|
3618
|
-
*
|
|
3619
|
-
* to
|
|
3620
|
-
*
|
|
3668
|
+
* This function uses the encryption key previously generated via `requestEncryptionKey`
|
|
3669
|
+
* to decrypt data. The key must exist in memory before calling this function, or it
|
|
3670
|
+
* will throw an error prompting the user to sign a message.
|
|
3621
3671
|
*
|
|
3622
|
-
* @param
|
|
3623
|
-
* @param
|
|
3624
|
-
* @returns
|
|
3672
|
+
* @param encryptedHex - Encrypted data as hex string (IV + ciphertext + auth tag)
|
|
3673
|
+
* @param address - The wallet address associated with the encryption key
|
|
3674
|
+
* @returns Decrypted data as string
|
|
3675
|
+
* @throws Error if encryption key is not found in memory or if decryption fails
|
|
3625
3676
|
*
|
|
3626
3677
|
* @example
|
|
3627
3678
|
* ```tsx
|
|
3628
|
-
* import {
|
|
3629
|
-
* import { useEncryption, encryptData, decryptData } from "@anuma/sdk/react";
|
|
3679
|
+
* import { decryptData, requestEncryptionKey } from "@anuma/sdk/react";
|
|
3630
3680
|
*
|
|
3631
|
-
*
|
|
3632
|
-
*
|
|
3633
|
-
* const { wallets } = useWallets();
|
|
3634
|
-
* const embeddedWallet = wallets.find(w => w.walletClientType === 'privy');
|
|
3681
|
+
* // First, ensure encryption key exists
|
|
3682
|
+
* await requestEncryptionKey(walletAddress);
|
|
3635
3683
|
*
|
|
3636
|
-
*
|
|
3637
|
-
*
|
|
3638
|
-
*
|
|
3639
|
-
*
|
|
3640
|
-
*
|
|
3641
|
-
*
|
|
3642
|
-
*
|
|
3643
|
-
* }, [embeddedWallet]);
|
|
3684
|
+
* // Then decrypt data
|
|
3685
|
+
* const encrypted = localStorage.getItem("mySecret");
|
|
3686
|
+
* if (encrypted) {
|
|
3687
|
+
* const decrypted = await decryptData(encrypted, walletAddress);
|
|
3688
|
+
* console.log("Decrypted:", decrypted);
|
|
3689
|
+
* }
|
|
3690
|
+
* ```
|
|
3644
3691
|
*
|
|
3645
|
-
*
|
|
3692
|
+
* @category Encryption
|
|
3693
|
+
*/
|
|
3694
|
+
declare function decryptData(encryptedHex: string, address: string, version?: EncryptionKeyVersion): Promise<string>;
|
|
3695
|
+
/**
|
|
3696
|
+
* Decrypts data and returns as Uint8Array (for binary data)
|
|
3697
|
+
* @param encryptedHex - Encrypted data as hex string (IV + ciphertext + auth tag)
|
|
3698
|
+
* @returns Decrypted data as Uint8Array
|
|
3699
|
+
*/
|
|
3700
|
+
declare function decryptDataBytes(encryptedHex: string, address: string, version?: EncryptionKeyVersion): Promise<Uint8Array>;
|
|
3701
|
+
/**
|
|
3702
|
+
* Like {@link decryptDataBytes} but takes the raw encrypted bytes
|
|
3703
|
+
* (`[IV][ciphertext+tag]`) directly instead of a hex string. Skips the
|
|
3704
|
+
* `hexToBytes` conversion — for large binary media the hex string the caller
|
|
3705
|
+
* would otherwise build is a ~1.37x copy of the whole payload (a ~1GB string
|
|
3706
|
+
* for a 500MB video), plus this avoids a second byte copy. Same key resolution
|
|
3707
|
+
* as decryptDataBytes.
|
|
3646
3708
|
*
|
|
3647
|
-
*
|
|
3648
|
-
*
|
|
3649
|
-
*
|
|
3650
|
-
*
|
|
3651
|
-
*
|
|
3652
|
-
|
|
3653
|
-
|
|
3709
|
+
* @param encrypted - Raw encrypted bytes (IV + ciphertext + auth tag), no hex
|
|
3710
|
+
* @param address - The wallet address associated with the encryption key
|
|
3711
|
+
* @param version - Encryption key version to decrypt with (defaults to "v3")
|
|
3712
|
+
* @returns Decrypted data as Uint8Array
|
|
3713
|
+
* @category Encryption
|
|
3714
|
+
*/
|
|
3715
|
+
declare function decryptDataBytesFromBytes(encrypted: Uint8Array, address: string, version?: EncryptionKeyVersion): Promise<Uint8Array>;
|
|
3716
|
+
/**
|
|
3717
|
+
* Checks if an encryption key exists in memory for the given wallet address.
|
|
3654
3718
|
*
|
|
3655
|
-
*
|
|
3656
|
-
*
|
|
3657
|
-
*
|
|
3658
|
-
*
|
|
3659
|
-
|
|
3719
|
+
* @param address - Wallet address
|
|
3720
|
+
* @param version - When omitted, checks the **v3** (`current`) key — the key
|
|
3721
|
+
* write/OPFS/encrypt paths need. Callers that only need to read legacy
|
|
3722
|
+
* `enc:v2:` data should pass `"v2"` explicitly. (#561 / PR #828)
|
|
3723
|
+
*/
|
|
3724
|
+
declare function hasEncryptionKey(address: string, version?: EncryptionKeyVersion): boolean;
|
|
3725
|
+
/**
|
|
3726
|
+
* Seed (or merge) raw key hex into the in-memory store without signing.
|
|
3660
3727
|
*
|
|
3661
|
-
*
|
|
3662
|
-
*
|
|
3663
|
-
*
|
|
3664
|
-
* if (encrypted) {
|
|
3665
|
-
* const decrypted = await decryptData(encrypted, user.wallet.address);
|
|
3666
|
-
* console.log(decrypted);
|
|
3667
|
-
* }
|
|
3668
|
-
* };
|
|
3728
|
+
* Used by platform polyfills that hydrate from SecureStore / keychain where
|
|
3729
|
+
* one version may be missing — callers must not require both versions to
|
|
3730
|
+
* exist before the other becomes usable (#561).
|
|
3669
3731
|
*
|
|
3670
|
-
*
|
|
3671
|
-
*
|
|
3672
|
-
* <button onClick={() => saveSecret("my secret data")}>Encrypt & Save</button>
|
|
3673
|
-
* <button onClick={loadSecret}>Load & Decrypt</button>
|
|
3674
|
-
* </div>
|
|
3675
|
-
* );
|
|
3676
|
-
* }
|
|
3677
|
-
* ```
|
|
3732
|
+
* Existing versions are preserved when the corresponding argument is omitted.
|
|
3733
|
+
* Pass an explicit empty merge is not supported; omit the field to leave it.
|
|
3678
3734
|
*
|
|
3679
|
-
*
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3735
|
+
* Each provided key must be 64 hex characters (32-byte AES key).
|
|
3736
|
+
*/
|
|
3737
|
+
declare function seedEncryptionKeys(address: string, keys: {
|
|
3738
|
+
legacy?: string;
|
|
3739
|
+
current?: string;
|
|
3740
|
+
}): void;
|
|
3741
|
+
/**
|
|
3742
|
+
* Encrypts data using a pre-fetched CryptoKey.
|
|
3743
|
+
* Use this for batch operations to avoid repeated key lookups.
|
|
3684
3744
|
*
|
|
3685
|
-
*
|
|
3686
|
-
*
|
|
3687
|
-
*
|
|
3745
|
+
* @param plaintext - The data to encrypt (string or Uint8Array)
|
|
3746
|
+
* @param key - The CryptoKey for AES-GCM encryption
|
|
3747
|
+
* @returns Encrypted data as hex string (IV + ciphertext + auth tag)
|
|
3748
|
+
* @internal
|
|
3749
|
+
*/
|
|
3750
|
+
declare function encryptDataWithKey(plaintext: string | Uint8Array, key: CryptoKey): Promise<string>;
|
|
3751
|
+
/**
|
|
3752
|
+
* Decrypts data using a pre-fetched CryptoKey.
|
|
3753
|
+
* Use this for batch operations to avoid repeated key lookups.
|
|
3688
3754
|
*
|
|
3689
|
-
*
|
|
3690
|
-
*
|
|
3691
|
-
*
|
|
3692
|
-
*
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
*
|
|
3697
|
-
*
|
|
3755
|
+
* @param encryptedHex - Encrypted data as hex string (IV + ciphertext + auth tag)
|
|
3756
|
+
* @param key - The CryptoKey for AES-GCM decryption
|
|
3757
|
+
* @returns Decrypted data as string
|
|
3758
|
+
* @internal
|
|
3759
|
+
*/
|
|
3760
|
+
declare function decryptDataWithKey(encryptedHex: string, key: CryptoKey): Promise<string>;
|
|
3761
|
+
/**
|
|
3762
|
+
* Batch encrypt multiple values efficiently with a single key lookup.
|
|
3763
|
+
* Much faster than calling encryptData for each value individually.
|
|
3764
|
+
*
|
|
3765
|
+
* @param values - Array of plaintext values to encrypt
|
|
3766
|
+
* @param address - The wallet address associated with the encryption key
|
|
3767
|
+
* @returns Array of encrypted values as hex strings
|
|
3768
|
+
* @throws Error if encryption key is not found in memory
|
|
3698
3769
|
*
|
|
3699
3770
|
* @example
|
|
3700
3771
|
* ```tsx
|
|
3701
|
-
*
|
|
3702
|
-
*
|
|
3703
|
-
*
|
|
3772
|
+
* const encrypted = await encryptDataBatch(
|
|
3773
|
+
* ["secret1", "secret2", "secret3"],
|
|
3774
|
+
* walletAddress
|
|
3775
|
+
* );
|
|
3776
|
+
* ```
|
|
3704
3777
|
*
|
|
3705
|
-
*
|
|
3706
|
-
|
|
3707
|
-
|
|
3778
|
+
* @category Encryption
|
|
3779
|
+
*/
|
|
3780
|
+
declare function encryptDataBatch(values: (string | Uint8Array)[], address: string): Promise<string[]>;
|
|
3781
|
+
/**
|
|
3782
|
+
* Batch decrypt multiple values efficiently with a single key lookup.
|
|
3783
|
+
* Much faster than calling decryptData for each value individually.
|
|
3708
3784
|
*
|
|
3709
|
-
*
|
|
3710
|
-
*
|
|
3711
|
-
*
|
|
3785
|
+
* @param encryptedValues - Array of encrypted hex strings
|
|
3786
|
+
* @param address - The wallet address associated with the encryption key
|
|
3787
|
+
* @returns Array of decrypted plaintext values
|
|
3788
|
+
* @throws Error if encryption key is not found in memory or decryption fails
|
|
3712
3789
|
*
|
|
3713
|
-
*
|
|
3714
|
-
*
|
|
3715
|
-
*
|
|
3716
|
-
*
|
|
3717
|
-
*
|
|
3790
|
+
* @example
|
|
3791
|
+
* ```tsx
|
|
3792
|
+
* const decrypted = await decryptDataBatch(
|
|
3793
|
+
* [encrypted1, encrypted2, encrypted3],
|
|
3794
|
+
* walletAddress
|
|
3795
|
+
* );
|
|
3718
3796
|
* ```
|
|
3719
|
-
*
|
|
3720
|
-
* @category
|
|
3721
|
-
*/
|
|
3722
|
-
declare function
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
interface ChatRecord {
|
|
3730
|
-
kind: ChatRecordKind;
|
|
3731
|
-
id: string;
|
|
3732
|
-
conversationId: string;
|
|
3733
|
-
sortKey: number;
|
|
3734
|
-
createdAt: number;
|
|
3735
|
-
updatedAt: number;
|
|
3736
|
-
isDeleted: boolean;
|
|
3737
|
-
data: {
|
|
3738
|
-
[key: string]: ChatJson;
|
|
3739
|
-
};
|
|
3740
|
-
}
|
|
3741
|
-
interface ChatSnapshot {
|
|
3742
|
-
record: ChatRecord;
|
|
3743
|
-
version: number;
|
|
3744
|
-
serverUpdatedAt: string;
|
|
3745
|
-
}
|
|
3746
|
-
interface ChatWrite {
|
|
3747
|
-
record: ChatRecord;
|
|
3748
|
-
expectedVersion: number;
|
|
3749
|
-
/** Sent and stored unencrypted so vault can run vector search. */
|
|
3750
|
-
embeddings?: number[][];
|
|
3751
|
-
embeddingModel?: string;
|
|
3752
|
-
}
|
|
3753
|
-
interface ChatRef {
|
|
3754
|
-
kind: ChatRecordKind;
|
|
3755
|
-
id: string;
|
|
3756
|
-
}
|
|
3757
|
-
type ChatAccountState = "none" | "migrating" | "active";
|
|
3758
|
-
interface ChatAccount {
|
|
3759
|
-
keyId: string;
|
|
3760
|
-
state: ChatAccountState;
|
|
3761
|
-
recordCount: number;
|
|
3762
|
-
storageBytes: number;
|
|
3763
|
-
vectorCount: number;
|
|
3764
|
-
/** The newest change; read it before loading history and poll `changes` from it. Absent before the first record. */
|
|
3765
|
-
changesCursor?: string;
|
|
3766
|
-
}
|
|
3767
|
-
interface ChatImport {
|
|
3768
|
-
record: ChatRecord;
|
|
3769
|
-
/** Sent and stored unencrypted so vault can run vector search. */
|
|
3770
|
-
embeddings?: number[][];
|
|
3771
|
-
embeddingModel?: string;
|
|
3772
|
-
}
|
|
3773
|
-
interface ChatRevision {
|
|
3774
|
-
kind: ChatRecordKind;
|
|
3775
|
-
id: string;
|
|
3776
|
-
updatedAt: number;
|
|
3777
|
-
isDeleted: boolean;
|
|
3778
|
-
}
|
|
3779
|
-
interface ChatChanges {
|
|
3780
|
-
items: ChatSnapshot[];
|
|
3781
|
-
nextCursor?: string;
|
|
3782
|
-
changesCursor: string;
|
|
3783
|
-
}
|
|
3784
|
-
interface ChatSearchOptions {
|
|
3785
|
-
limit?: number;
|
|
3786
|
-
kinds?: ("message" | "summary")[];
|
|
3787
|
-
conversationId?: string;
|
|
3788
|
-
excludeConversationId?: string;
|
|
3789
|
-
/** Ranks only vectors from this model; vectors stored without one always count. */
|
|
3790
|
-
embeddingModel?: string;
|
|
3791
|
-
signal?: AbortSignal;
|
|
3792
|
-
}
|
|
3793
|
-
interface ChatSearchHit extends ChatSnapshot {
|
|
3794
|
-
chunk: number;
|
|
3795
|
-
score: number;
|
|
3796
|
-
}
|
|
3797
|
-
interface ChatAttachment {
|
|
3798
|
-
id: string;
|
|
3799
|
-
sizeBytes: number;
|
|
3800
|
-
state: "pending" | "committed";
|
|
3801
|
-
ownerKind?: "message" | "summary";
|
|
3802
|
-
ownerId?: string;
|
|
3803
|
-
createdAt: string;
|
|
3804
|
-
committedAt?: string;
|
|
3805
|
-
}
|
|
3806
|
-
interface ChatPresignedUrl {
|
|
3807
|
-
url: string;
|
|
3808
|
-
method: string;
|
|
3809
|
-
headers: Record<string, string>;
|
|
3810
|
-
expiresAt: string;
|
|
3811
|
-
}
|
|
3812
|
-
interface ChatAttachments {
|
|
3813
|
-
create(sizeBytes: number, signal?: AbortSignal): Promise<{
|
|
3814
|
-
attachment: ChatAttachment;
|
|
3815
|
-
upload: ChatPresignedUrl;
|
|
3816
|
-
}>;
|
|
3817
|
-
commit(attachmentId: string, owner: {
|
|
3818
|
-
kind: "message" | "summary";
|
|
3819
|
-
id: string;
|
|
3820
|
-
}, signal?: AbortSignal): Promise<ChatAttachment>;
|
|
3821
|
-
get(attachmentId: string, signal?: AbortSignal): Promise<{
|
|
3822
|
-
attachment: ChatAttachment;
|
|
3823
|
-
download?: ChatPresignedUrl;
|
|
3824
|
-
} | null>;
|
|
3825
|
-
delete(attachmentId: string, signal?: AbortSignal): Promise<void>;
|
|
3826
|
-
}
|
|
3827
|
-
interface ChatListOptions {
|
|
3828
|
-
kind: ChatRecordKind;
|
|
3829
|
-
conversationId?: string;
|
|
3830
|
-
includeDeleted?: boolean;
|
|
3831
|
-
cursor?: string;
|
|
3832
|
-
limit?: number;
|
|
3833
|
-
signal?: AbortSignal;
|
|
3834
|
-
}
|
|
3835
|
-
interface ChatPage {
|
|
3836
|
-
items: ChatSnapshot[];
|
|
3837
|
-
nextCursor?: string;
|
|
3838
|
-
total?: number;
|
|
3839
|
-
}
|
|
3840
|
-
/** Explicit versions protect edits; ambiguous writes are never replayed automatically. */
|
|
3841
|
-
interface ChatStore {
|
|
3842
|
-
get(kind: ChatRecordKind, id: string, signal?: AbortSignal): Promise<ChatSnapshot | null>;
|
|
3843
|
-
list(options: ChatListOptions): Promise<ChatPage>;
|
|
3844
|
-
putMany(writes: readonly ChatWrite[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
|
|
3845
|
-
getMany(refs: readonly ChatRef[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
|
|
3846
|
-
account(signal?: AbortSignal): Promise<ChatAccount>;
|
|
3847
|
-
importRecords(records: readonly ChatImport[], signal?: AbortSignal): Promise<number>;
|
|
3848
|
-
verify(revisions: readonly ChatRevision[], signal?: AbortSignal): Promise<ChatRef[]>;
|
|
3849
|
-
activate(signal?: AbortSignal): Promise<boolean>;
|
|
3850
|
-
changes(cursor?: string, options?: {
|
|
3851
|
-
limit?: number;
|
|
3852
|
-
signal?: AbortSignal;
|
|
3853
|
-
}): Promise<ChatChanges>;
|
|
3854
|
-
search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
|
|
3855
|
-
deleteAll(signal?: AbortSignal): Promise<number>;
|
|
3856
|
-
attachments: ChatAttachments;
|
|
3857
|
-
}
|
|
3858
|
-
interface RemoteChatStoreOptions {
|
|
3859
|
-
baseUrl: string;
|
|
3860
|
-
getToken: () => Promise<string | null>;
|
|
3861
|
-
keyId: string;
|
|
3862
|
-
encrypt: (plaintext: string) => Promise<string>;
|
|
3863
|
-
decrypt: (ciphertext: string) => Promise<string>;
|
|
3864
|
-
fetch?: typeof globalThis.fetch;
|
|
3865
|
-
timeoutMs?: number;
|
|
3866
|
-
signal?: AbortSignal;
|
|
3867
|
-
}
|
|
3868
|
-
declare class ChatStoreError extends Error {
|
|
3869
|
-
readonly status: number;
|
|
3870
|
-
readonly code?: string | undefined;
|
|
3871
|
-
readonly retryAfterMs?: number | undefined;
|
|
3872
|
-
constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
|
|
3873
|
-
}
|
|
3874
|
-
|
|
3875
|
-
interface ChatMigrationOptions {
|
|
3876
|
-
/** The device's local chat database. */
|
|
3877
|
-
database: Database;
|
|
3878
|
-
/** Vault, opened with the account's canonical key. */
|
|
3879
|
-
store: ChatStore;
|
|
3880
|
-
walletAddress?: string;
|
|
3881
|
-
signMessage?: SignMessageFn;
|
|
3882
|
-
embeddedWalletSigner?: EmbeddedWalletSignerFn;
|
|
3883
|
-
/** Runs the final pass while local chat writers are held, so nothing lands locally after it. */
|
|
3884
|
-
withWriteBarrier: (task: () => Promise<ChatMigrationResult>) => Promise<ChatMigrationResult>;
|
|
3885
|
-
/** Called once vault holds everything; hand the device over to vault here. */
|
|
3886
|
-
onActivated: () => void | Promise<void>;
|
|
3887
|
-
/** Activate even when some rows could not be read; they stay on the device. */
|
|
3888
|
-
allowSkipped?: boolean;
|
|
3889
|
-
maxVectors?: number;
|
|
3890
|
-
maxStorageBytes?: number;
|
|
3891
|
-
signal?: AbortSignal;
|
|
3892
|
-
onProgress?: (progress: ChatMigrationProgress) => void;
|
|
3893
|
-
}
|
|
3894
|
-
interface ChatMigrationProgress {
|
|
3895
|
-
imported: number;
|
|
3896
|
-
toImport: number;
|
|
3897
|
-
}
|
|
3898
|
-
interface ChatMigrationSkip {
|
|
3899
|
-
kind: ChatRecordKind;
|
|
3900
|
-
id: string;
|
|
3901
|
-
reason: "unreadable" | "invalid";
|
|
3902
|
-
}
|
|
3903
|
-
interface ChatMigrationResult {
|
|
3904
|
-
state: "migrating" | "active";
|
|
3905
|
-
conversations: number;
|
|
3906
|
-
messages: number;
|
|
3907
|
-
imported: number;
|
|
3908
|
-
skipped: ChatMigrationSkip[];
|
|
3909
|
-
/** Conversations whose title could not be decrypted and went up untitled. */
|
|
3910
|
-
untitled: number;
|
|
3911
|
-
/** Messages sent without vectors to stay inside the account's vector quota. */
|
|
3912
|
-
unembedded: number;
|
|
3913
|
-
/** Messages shrunk to fit vault's record limit. */
|
|
3914
|
-
truncated: number;
|
|
3915
|
-
}
|
|
3916
|
-
/** Copies this device's chats to vault, verifies them under the write barrier, then activates vault and hands the device over. */
|
|
3917
|
-
declare function migrateChatsToRemote(options: ChatMigrationOptions): Promise<ChatMigrationResult>;
|
|
3918
|
-
|
|
3919
|
-
/** Connect to owner-scoped server storage using the account's canonical device-held cipher. */
|
|
3920
|
-
declare function createRemoteChatStore(options: RemoteChatStoreOptions): Promise<ChatStore>;
|
|
3921
|
-
|
|
3922
|
-
declare class VaultMemory extends Model {
|
|
3923
|
-
static table: string;
|
|
3924
|
-
content: string;
|
|
3925
|
-
scope: string;
|
|
3926
|
-
/** Profile kind, or null for a free-form memory. */
|
|
3927
|
-
kind: string | null;
|
|
3928
|
-
/** Canonical JSON value of a kinded memory, encrypted at rest. */
|
|
3929
|
-
kindValue: string | null;
|
|
3930
|
-
/** private | matching | profile. */
|
|
3931
|
-
level: string | null;
|
|
3932
|
-
folderId: string | null;
|
|
3933
|
-
userId: string | null;
|
|
3934
|
-
embedding: string | null;
|
|
3935
|
-
/** Model that produced `embedding`. Null on legacy rows (grandfathered). */
|
|
3936
|
-
embeddingModel: string | null;
|
|
3937
|
-
sourceChunkIds: string | null;
|
|
3938
|
-
proofCount: number | null;
|
|
3939
|
-
source: string | null;
|
|
3940
|
-
/** W6 temporal lane — Unix ms timestamp of when the event occurred. */
|
|
3941
|
-
eventTimeStart: number | null;
|
|
3942
|
-
/** W6 temporal lane — Unix ms timestamp of event end (range/ongoing). */
|
|
3943
|
-
eventTimeEnd: number | null;
|
|
3944
|
-
/** W6 temporal lane — `point | range | ongoing | null`. */
|
|
3945
|
-
eventTimeKind: string | null;
|
|
3946
|
-
/** When true, the user has manually set this memory's topics; auto-extraction
|
|
3947
|
-
* leaves its entity links alone. Null on legacy rows (treated as false). */
|
|
3948
|
-
topicsUserManaged: boolean | null;
|
|
3949
|
-
/** The durable, synced record of this memory's topics — JSON `StoredTopic[]`.
|
|
3950
|
-
* `entity` / `memory_entity` are a device-local index over it. Null = pre-v42
|
|
3951
|
-
* (backfilled from the row's current links by the sweep). */
|
|
3952
|
-
topics: string | null;
|
|
3953
|
-
/** Unix ms of the last `topics` write. Separate from `updated_at`, which every
|
|
3954
|
-
* topic writer pins on purpose (recall recency) — see the schema note. */
|
|
3955
|
-
topicsUpdatedAt: number | null;
|
|
3956
|
-
/** The photo(s) a SERVER-EXTRACTED memory came from — JSON
|
|
3957
|
-
* `[{feed_item_id, object_key}]`, exactly the shape
|
|
3958
|
-
* GET /api/memories/published returns. Null on anything not from a photo. */
|
|
3959
|
-
media: string | null;
|
|
3960
|
-
/** Unix ms of the last LLM topic-extraction pass. Null = never extracted
|
|
3961
|
-
* standalone (linked legacy rows are grandfathered as extracted).
|
|
3962
|
-
* DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
|
|
3963
|
-
topicsExtractedAt: number | null;
|
|
3964
|
-
/** A2 supersession: newer memory id that replaced this one, or null if live. */
|
|
3965
|
-
supersededBy: string | null;
|
|
3966
|
-
supersededAt: number | null;
|
|
3967
|
-
/** Extraction-logic version this memory was last stamped under. Null (pre-v38)
|
|
3968
|
-
* reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows.
|
|
3969
|
-
* DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
|
|
3970
|
-
topicsExtractedVersion: number | null;
|
|
3971
|
-
/** C3 re-observation watermark: Unix ms of the last retain() merge, or null. */
|
|
3972
|
-
lastObservedAt: number | null;
|
|
3973
|
-
/** Typed memory (PR1) — the extractor's FactType. Null on legacy/manual rows. */
|
|
3974
|
-
factType: string | null;
|
|
3975
|
-
/** Decay archive state (PR2) — Unix ms when archived, null when active. */
|
|
3976
|
-
archivedAt: number | null;
|
|
3977
|
-
/** Tier-0 security (PR3) — "quarantined" | "trusted" | null. */
|
|
3978
|
-
trustTier: string | null;
|
|
3979
|
-
/** People Nearby visibility: 'private' | 'public'. Null on legacy rows, and
|
|
3980
|
-
* any unrecognised value, read as 'private' — never published without opt-in. */
|
|
3981
|
-
visibility: string | null;
|
|
3982
|
-
/** Owner opted this memory into their own digital twin (twin-scoped only). */
|
|
3983
|
-
twinOptIn: boolean | null;
|
|
3984
|
-
/** Unix ms when visibility last became non-private; null while private. */
|
|
3985
|
-
publishedAt: number | null;
|
|
3986
|
-
/** Reserved coarse-geohash slot for landmark/Trail memories. */
|
|
3987
|
-
geohash: string | null;
|
|
3988
|
-
createdAt: Date;
|
|
3989
|
-
updatedAt: Date;
|
|
3990
|
-
isDeleted: boolean;
|
|
3797
|
+
*
|
|
3798
|
+
* @category Encryption
|
|
3799
|
+
*/
|
|
3800
|
+
declare function decryptDataBatch(encryptedValues: string[], address: string): Promise<string[]>;
|
|
3801
|
+
/**
|
|
3802
|
+
* Options for signing messages.
|
|
3803
|
+
*/
|
|
3804
|
+
interface SignMessageOptions {
|
|
3805
|
+
/** Whether to show wallet UI during signing. Default: true */
|
|
3806
|
+
showWalletUIs?: boolean;
|
|
3991
3807
|
}
|
|
3992
|
-
|
|
3993
3808
|
/**
|
|
3994
|
-
*
|
|
3995
|
-
*
|
|
3809
|
+
* Type for the signMessage function that client must provide.
|
|
3810
|
+
* This is typically from Privy's useSignMessage hook.
|
|
3996
3811
|
*
|
|
3997
|
-
*
|
|
3998
|
-
*
|
|
3999
|
-
*
|
|
4000
|
-
*
|
|
4001
|
-
* semantic search misses.
|
|
3812
|
+
* The resolved value must be a hex signature (`0x`-prefixed or bare). A
|
|
3813
|
+
* non-hex string — including `String(uint8Array)` or a base58 signature —
|
|
3814
|
+
* throws from key derivation instead of becoming a zero-filled AES key.
|
|
3815
|
+
* Raw signature bytes go to {@link deriveKeyFromSignatureBytes}.
|
|
4002
3816
|
*/
|
|
4003
|
-
|
|
4004
|
-
static table: string;
|
|
4005
|
-
/** Lowercased, trimmed name used for dedup and lookup. */
|
|
4006
|
-
canonicalName: string;
|
|
4007
|
-
/** Optional category — "person" | "place" | "thing" | "concept" | etc. */
|
|
4008
|
-
kind: string | null;
|
|
4009
|
-
createdAt: Date;
|
|
4010
|
-
updatedAt: Date;
|
|
4011
|
-
}
|
|
3817
|
+
type SignMessageFn = (message: string, options?: SignMessageOptions) => Promise<string>;
|
|
4012
3818
|
/**
|
|
4013
|
-
*
|
|
4014
|
-
*
|
|
3819
|
+
* Type for embedded wallet signer function that enables silent signing.
|
|
3820
|
+
* For Privy embedded wallets, this can sign programmatically without user interaction
|
|
3821
|
+
* when configured correctly in the Privy dashboard.
|
|
4015
3822
|
*/
|
|
4016
|
-
|
|
4017
|
-
static table: string;
|
|
4018
|
-
memoryId: string;
|
|
4019
|
-
entityId: string;
|
|
4020
|
-
/**
|
|
4021
|
-
* User-scope for the W5 graph lane. Optional because client-side
|
|
4022
|
-
* (single-user) deployments may leave it null; server-side multi-user
|
|
4023
|
-
* deployments must set it so retrieval can filter cross-user IDs.
|
|
4024
|
-
*/
|
|
4025
|
-
userId: string | null;
|
|
4026
|
-
createdAt: Date;
|
|
4027
|
-
}
|
|
4028
|
-
|
|
3823
|
+
type EmbeddedWalletSignerFn = (message: string, options?: SignMessageOptions) => Promise<string>;
|
|
4029
3824
|
/**
|
|
4030
|
-
*
|
|
4031
|
-
*
|
|
4032
|
-
*
|
|
4033
|
-
*
|
|
3825
|
+
* Requests the user to sign a message to generate an encryption key.
|
|
3826
|
+
* If a key already exists in memory for the given wallet, resolves immediately
|
|
3827
|
+
* unless {@link RequestEncryptionKeyOptions.force} is set.
|
|
3828
|
+
*
|
|
3829
|
+
* Note: Keys are stored in memory only and do not persist across page reloads.
|
|
3830
|
+
* This is a security feature - users must sign once per session to derive their key.
|
|
3831
|
+
*
|
|
3832
|
+
* When a seeded/pinned store already has keys and the fresh derive does not
|
|
3833
|
+
* match any of them, the store is left unchanged and this resolves to `false`
|
|
3834
|
+
* (without firing {@link onKeyAvailable}). Callers that need write readiness
|
|
3835
|
+
* should check the return value or {@link hasEncryptionKey} before encrypting
|
|
3836
|
+
* so they can surface a re-unlock UI instead of failing downstream (#828).
|
|
3837
|
+
*
|
|
3838
|
+
* @param walletAddress - The wallet address to generate the key for
|
|
3839
|
+
* @param signMessage - Function to sign a message (returns signature hex string)
|
|
3840
|
+
* @param embeddedWalletSigner - Optional function for silent signing with embedded wallets
|
|
3841
|
+
* @param options - Optional flags (e.g. force re-derive)
|
|
3842
|
+
* @returns `true` when keys are available after the call; `false` when a
|
|
3843
|
+
* divergent derive left the store unchanged (or the session was torn down
|
|
3844
|
+
* mid-flight).
|
|
4034
3845
|
*/
|
|
4035
|
-
declare
|
|
4036
|
-
/** @public */
|
|
4037
|
-
type EntityKind = (typeof ENTITY_KINDS)[number];
|
|
4038
|
-
interface StoredEntity {
|
|
4039
|
-
uniqueId: string;
|
|
4040
|
-
canonicalName: string;
|
|
4041
|
-
kind: string | null;
|
|
4042
|
-
createdAt: Date;
|
|
4043
|
-
updatedAt: Date;
|
|
4044
|
-
}
|
|
3846
|
+
declare function requestEncryptionKey(walletAddress: string, signMessage: SignMessageFn, embeddedWalletSigner?: EmbeddedWalletSignerFn, options?: RequestEncryptionKeyOptions): Promise<boolean>;
|
|
4045
3847
|
/**
|
|
4046
|
-
*
|
|
4047
|
-
*
|
|
4048
|
-
*
|
|
4049
|
-
* `topics_user_managed` is all-or-nothing per memory) without needing a second
|
|
4050
|
-
* migration or backfill. Don't build that behavior off it yet.
|
|
3848
|
+
* Re-derive encryption keys from a fresh signature and commit them **only if**
|
|
3849
|
+
* they successfully decrypt `probeCiphertext` (a prefixed `enc:v2:` / `enc:v3:`
|
|
3850
|
+
* value). If they do not, the existing in-memory keys are left untouched.
|
|
4051
3851
|
*
|
|
4052
|
-
*
|
|
4053
|
-
*
|
|
4054
|
-
*
|
|
4055
|
-
*
|
|
4056
|
-
*
|
|
3852
|
+
* Concurrent calls for the same wallet share one sign+derive. Each caller then
|
|
3853
|
+
* probes **its own** ciphertext against those candidates, so mixed-era messages
|
|
3854
|
+
* in one `Promise.all` batch can still recover when only the leader's probe
|
|
3855
|
+
* misses (#828 review). Failed candidates are memoized for the session so
|
|
3856
|
+
* pagination does not re-prompt on every page when the wallet has changed.
|
|
3857
|
+
*
|
|
3858
|
+
* @returns true when keys were refreshed (probe decrypted); false when the
|
|
3859
|
+
* probe failed under the candidate keys (store unchanged) or the probe was
|
|
3860
|
+
* not encrypted.
|
|
4057
3861
|
*/
|
|
4058
|
-
|
|
3862
|
+
declare function refreshEncryptionKeyIfMatches(walletAddress: string, probeCiphertext: string, signMessage: SignMessageFn, embeddedWalletSigner?: EmbeddedWalletSignerFn): Promise<boolean>;
|
|
4059
3863
|
/**
|
|
4060
|
-
*
|
|
4061
|
-
*
|
|
4062
|
-
*
|
|
4063
|
-
*
|
|
4064
|
-
*
|
|
4065
|
-
*
|
|
3864
|
+
* Requests the user to sign a message to generate an ECDH key pair.
|
|
3865
|
+
* If a key pair already exists in memory for the given wallet, resolves immediately.
|
|
3866
|
+
*
|
|
3867
|
+
* Note: Key pairs are stored in memory only and do not persist across page reloads.
|
|
3868
|
+
* This is a security feature - users must sign once per session to derive their key pair.
|
|
3869
|
+
*
|
|
3870
|
+
* @param walletAddress - The wallet address to generate the key pair for
|
|
3871
|
+
* @param signMessage - Function to sign a message (returns signature hex string)
|
|
3872
|
+
* @param embeddedWalletSigner - Optional function for silent signing with embedded wallets
|
|
3873
|
+
* @returns Promise that resolves when the key pair is available
|
|
4066
3874
|
*/
|
|
4067
|
-
|
|
4068
|
-
name: string;
|
|
4069
|
-
kind?: string;
|
|
4070
|
-
source: TopicSource;
|
|
4071
|
-
/** How central the topic is to the memory, in (0, 1]; read it with {@link topicWeight}. */
|
|
4072
|
-
weight?: number;
|
|
4073
|
-
}
|
|
3875
|
+
declare function requestKeyPair(walletAddress: string, signMessage: SignMessageFn, embeddedWalletSigner?: EmbeddedWalletSignerFn): Promise<void>;
|
|
4074
3876
|
/**
|
|
4075
|
-
*
|
|
4076
|
-
* @
|
|
3877
|
+
* Exports the public key for a wallet address as SPKI format (base64)
|
|
3878
|
+
* @param address - The wallet address
|
|
3879
|
+
* @param signMessage - Function to sign a message (returns signature hex string)
|
|
3880
|
+
* @param embeddedWalletSigner - Optional function for silent signing with embedded wallets
|
|
3881
|
+
* @returns The public key as base64-encoded SPKI string
|
|
4077
3882
|
*/
|
|
4078
|
-
declare
|
|
4079
|
-
readonly primary: 1;
|
|
4080
|
-
readonly secondary: 0.6;
|
|
4081
|
-
readonly mention: 0.3;
|
|
4082
|
-
};
|
|
4083
|
-
/** @public */
|
|
4084
|
-
type TopicSalience = keyof typeof TOPIC_SALIENCE_WEIGHTS;
|
|
3883
|
+
declare function exportPublicKey(address: string, signMessage: SignMessageFn, embeddedWalletSigner?: EmbeddedWalletSignerFn): Promise<string>;
|
|
4085
3884
|
/**
|
|
4086
|
-
*
|
|
4087
|
-
* @
|
|
3885
|
+
* Checks if a key pair exists in memory for the given wallet address
|
|
3886
|
+
* @param address - The wallet address
|
|
3887
|
+
* @returns True if key pair exists, false otherwise
|
|
4088
3888
|
*/
|
|
4089
|
-
declare function
|
|
3889
|
+
declare function hasKeyPair(address: string): boolean;
|
|
4090
3890
|
/**
|
|
4091
|
-
*
|
|
4092
|
-
* @
|
|
3891
|
+
* Clears the key pair for a wallet address from memory and localStorage
|
|
3892
|
+
* @param address - The wallet address
|
|
4093
3893
|
*/
|
|
4094
|
-
declare function
|
|
4095
|
-
/** @public */
|
|
4096
|
-
interface CreateEntityOptions {
|
|
4097
|
-
canonicalName: string;
|
|
4098
|
-
kind?: EntityKind | (string & {});
|
|
4099
|
-
}
|
|
4100
|
-
|
|
3894
|
+
declare function clearKeyPair(address: string): void;
|
|
4101
3895
|
/**
|
|
4102
|
-
*
|
|
4103
|
-
*
|
|
4104
|
-
*
|
|
4105
|
-
*
|
|
3896
|
+
* Clears all key pairs from memory and any persisted entries in localStorage.
|
|
3897
|
+
*
|
|
3898
|
+
* Matches the persistence behavior of the per-address {@link clearKeyPair};
|
|
3899
|
+
* without this, `clearAllKeyPairs()` would leave `ecdh_keypair_*` ciphertext
|
|
3900
|
+
* behind in storage while `clearKeyPair(address)` removes it.
|
|
4106
3901
|
*/
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
interface
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
* When `true`, `getMemoriesByEntityNamesOp` admits rows with
|
|
4124
|
-
* `user_id = null` alongside the strict `userId` match. Set this on
|
|
4125
|
-
* LokiJS (web) adapters where the v31 `unsafeExecuteSql` backfill
|
|
4126
|
-
* is a no-op — pre-v31 rows otherwise become invisible to the W5
|
|
4127
|
-
* lane until `backfillMemoryEntityUserIdsOp` runs. Default `false`
|
|
4128
|
-
* (server / SQLite, where the migration backfill is authoritative).
|
|
4129
|
-
*/
|
|
4130
|
-
allowUnscopedRows?: boolean;
|
|
4131
|
-
canWrite?: () => Promise<boolean>;
|
|
3902
|
+
declare function clearAllKeyPairs(): void;
|
|
3903
|
+
/**
|
|
3904
|
+
* Result returned by the useEncryption hook.
|
|
3905
|
+
* @category Hooks
|
|
3906
|
+
*/
|
|
3907
|
+
interface UseEncryptionResult {
|
|
3908
|
+
/** Request and generate an encryption key for a wallet address */
|
|
3909
|
+
requestEncryptionKey: (walletAddress: string) => Promise<boolean>;
|
|
3910
|
+
/** Request and generate an ECDH key pair for a wallet address */
|
|
3911
|
+
requestKeyPair: (walletAddress: string) => Promise<void>;
|
|
3912
|
+
/** Export the public key for a wallet address as base64-encoded SPKI */
|
|
3913
|
+
exportPublicKey: (walletAddress: string) => Promise<string>;
|
|
3914
|
+
/** Check if a key pair exists in memory for a wallet address */
|
|
3915
|
+
hasKeyPair: (walletAddress: string) => boolean;
|
|
3916
|
+
/** Clear the key pair for a wallet address from memory */
|
|
3917
|
+
clearKeyPair: (walletAddress: string) => void;
|
|
4132
3918
|
}
|
|
4133
3919
|
/**
|
|
4134
|
-
*
|
|
4135
|
-
* or `{ name, kind }` objects. Names are normalized; missing entities are
|
|
4136
|
-
* auto-created (with their kind), and an existing entity's null kind is
|
|
4137
|
-
* back-filled — see {@link upsertEntitiesInWrite}. Idempotent — duplicate
|
|
4138
|
-
* (memory_id, entity_id) pairs are skipped.
|
|
3920
|
+
* Hook that provides encryption key management for securing local data.
|
|
4139
3921
|
*
|
|
4140
|
-
*
|
|
4141
|
-
*
|
|
4142
|
-
*
|
|
4143
|
-
*
|
|
4144
|
-
*
|
|
4145
|
-
*
|
|
4146
|
-
*
|
|
4147
|
-
*
|
|
4148
|
-
*
|
|
4149
|
-
*
|
|
4150
|
-
*
|
|
3922
|
+
* This hook helps you encrypt and decrypt data using a key derived from a wallet
|
|
3923
|
+
* signature. It requires `@privy-io/react-auth` for wallet authentication. Keys are
|
|
3924
|
+
* stored in memory only and do not persist across page reloads for security.
|
|
3925
|
+
*
|
|
3926
|
+
* ## How it works
|
|
3927
|
+
*
|
|
3928
|
+
* 1. User signs a message with their wallet
|
|
3929
|
+
* 2. The signature is used to deterministically derive an encryption key
|
|
3930
|
+
* 3. The key is stored in memory (not localStorage) for the session
|
|
3931
|
+
* 4. Data can be encrypted/decrypted using this key
|
|
3932
|
+
* 5. On page reload, user must sign again to derive the key
|
|
3933
|
+
*
|
|
3934
|
+
* ## Security Features
|
|
3935
|
+
*
|
|
3936
|
+
* - **In-memory only**: Keys never touch disk or localStorage
|
|
3937
|
+
* - **Deterministic**: Same wallet + signature always generates same key
|
|
3938
|
+
* - **Session-scoped**: Keys cleared on page reload
|
|
3939
|
+
* - **XSS-resistant**: Keys not accessible after page reload
|
|
3940
|
+
*
|
|
3941
|
+
* ## Embedded Wallet Support
|
|
4151
3942
|
*
|
|
4152
|
-
*
|
|
4153
|
-
*
|
|
4154
|
-
*
|
|
4155
|
-
* old ∪ new, so already-linked entities are resolved for their names too.
|
|
3943
|
+
* For Privy embedded wallets, you can provide an `embeddedWalletSigner` function
|
|
3944
|
+
* to enable silent signing without user confirmation modals. This is useful for
|
|
3945
|
+
* deterministic key generation that should happen automatically.
|
|
4156
3946
|
*
|
|
4157
|
-
* @
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
unlessTopicsUserManaged?: boolean;
|
|
4161
|
-
topicsSource?: TopicSource;
|
|
4162
|
-
}): Promise<StoredEntity[]>;
|
|
4163
|
-
/**
|
|
4164
|
-
* REPLACE a memory's entity links with an auto-derived set — the topic
|
|
4165
|
-
* worker's write primitive. Unlike {@link setMemoryEntitiesOp} it does NOT
|
|
4166
|
-
* mark the memory user-managed (the pass is automatic), and unlike
|
|
4167
|
-
* {@link linkMemoryEntitiesOp} it removes stale links, so re-extracting an
|
|
4168
|
-
* edited memory drops entities its previous content mentioned ("works at
|
|
4169
|
-
* Acme" → "works at Globex" must unlink Acme). Insert-missing and
|
|
4170
|
-
* destroy-stale are batched in ONE writer, after the same in-write guard as
|
|
4171
|
-
* the link op (user-managed / deleted / absent / read-fault ⇒ skip).
|
|
3947
|
+
* @param signMessage - Function to sign a message (from Privy's useSignMessage hook)
|
|
3948
|
+
* @param embeddedWalletSigner - Optional function for silent signing with embedded wallets
|
|
3949
|
+
* @returns Functions to request encryption keys and manage key pairs
|
|
4172
3950
|
*
|
|
4173
|
-
*
|
|
4174
|
-
*
|
|
4175
|
-
*
|
|
3951
|
+
* @example
|
|
3952
|
+
* ```tsx
|
|
3953
|
+
* import { usePrivy, useWallets } from "@privy-io/react-auth";
|
|
3954
|
+
* import { useEncryption, encryptData, decryptData } from "@anuma/sdk/react";
|
|
4176
3955
|
*
|
|
4177
|
-
*
|
|
4178
|
-
*
|
|
4179
|
-
*
|
|
4180
|
-
|
|
4181
|
-
declare function replaceMemoryEntitiesGuardedOp(ctx: EntityOperationsContext, memoryId: string, entityInputs: ReadonlyArray<EntityInput>): Promise<StoredEntity[] | null>;
|
|
4182
|
-
/**
|
|
4183
|
-
* Backfill `memory_entity.user_id` from the parent vault row's user_id.
|
|
4184
|
-
* Idempotent — only touches rows where user_id is null.
|
|
3956
|
+
* function SecureComponent() {
|
|
3957
|
+
* const { user, signMessage } = usePrivy();
|
|
3958
|
+
* const { wallets } = useWallets();
|
|
3959
|
+
* const embeddedWallet = wallets.find(w => w.walletClientType === 'privy');
|
|
4185
3960
|
*
|
|
4186
|
-
*
|
|
4187
|
-
*
|
|
4188
|
-
*
|
|
4189
|
-
*
|
|
4190
|
-
*
|
|
3961
|
+
* // Create silent signer for embedded wallets
|
|
3962
|
+
* const embeddedSigner = useCallback(async (message: string) => {
|
|
3963
|
+
* if (embeddedWallet) {
|
|
3964
|
+
* const { signature } = await embeddedWallet.signMessage({ message });
|
|
3965
|
+
* return signature;
|
|
3966
|
+
* }
|
|
3967
|
+
* throw new Error('No embedded wallet');
|
|
3968
|
+
* }, [embeddedWallet]);
|
|
4191
3969
|
*
|
|
4192
|
-
*
|
|
4193
|
-
* obliged to call this once on first use — `getMemoriesByEntityNamesOp`
|
|
4194
|
-
* strictly filters by `user_id`, so unstamped rows are otherwise
|
|
4195
|
-
* invisible to the W5 graph lane.
|
|
3970
|
+
* const { requestEncryptionKey } = useEncryption(signMessage, embeddedSigner);
|
|
4196
3971
|
*
|
|
4197
|
-
*
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
})
|
|
4204
|
-
/**
|
|
4205
|
-
* W5 graph-lane read: given a set of entity names (e.g. extracted from
|
|
4206
|
-
* a query), return the set of memory IDs linked to *any* of them, with
|
|
4207
|
-
* a per-memory count of how many of the queried entities they match.
|
|
3972
|
+
* // Request encryption key when user is authenticated
|
|
3973
|
+
* useEffect(() => {
|
|
3974
|
+
* if (user?.wallet?.address) {
|
|
3975
|
+
* // This will use silent signing for embedded wallets
|
|
3976
|
+
* await requestEncryptionKey(user.wallet.address);
|
|
3977
|
+
* }
|
|
3978
|
+
* }, [user]);
|
|
4208
3979
|
*
|
|
4209
|
-
*
|
|
4210
|
-
*
|
|
4211
|
-
*
|
|
4212
|
-
*
|
|
4213
|
-
*
|
|
3980
|
+
* // Encrypt data
|
|
3981
|
+
* const saveSecret = async (text: string) => {
|
|
3982
|
+
* const encrypted = await encryptData(text, user.wallet.address);
|
|
3983
|
+
* localStorage.setItem("mySecret", encrypted);
|
|
3984
|
+
* };
|
|
4214
3985
|
*
|
|
4215
|
-
*
|
|
4216
|
-
*
|
|
3986
|
+
* // Decrypt data
|
|
3987
|
+
* const loadSecret = async () => {
|
|
3988
|
+
* const encrypted = localStorage.getItem("mySecret");
|
|
3989
|
+
* if (encrypted) {
|
|
3990
|
+
* const decrypted = await decryptData(encrypted, user.wallet.address);
|
|
3991
|
+
* console.log(decrypted);
|
|
3992
|
+
* }
|
|
3993
|
+
* };
|
|
4217
3994
|
*
|
|
4218
|
-
*
|
|
4219
|
-
*
|
|
4220
|
-
*
|
|
3995
|
+
* return (
|
|
3996
|
+
* <div>
|
|
3997
|
+
* <button onClick={() => saveSecret("my secret data")}>Encrypt & Save</button>
|
|
3998
|
+
* <button onClick={loadSecret}>Load & Decrypt</button>
|
|
3999
|
+
* </div>
|
|
4000
|
+
* );
|
|
4001
|
+
* }
|
|
4002
|
+
* ```
|
|
4221
4003
|
*
|
|
4222
|
-
* @
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
*
|
|
4227
|
-
* (e.g. the current BFS frontier), return each memory's set of linked
|
|
4228
|
-
* canonical entity names. This is the missing primitive for multi-hop graph
|
|
4229
|
-
* traversal (PR4) — one step outward from a memory to its neighbor entities,
|
|
4230
|
-
* which the traversal then expands to reach topically-adjacent memories.
|
|
4004
|
+
* @example
|
|
4005
|
+
* ```tsx
|
|
4006
|
+
* // Standard usage with external wallets (shows confirmation modal)
|
|
4007
|
+
* import { usePrivy } from "@privy-io/react-auth";
|
|
4008
|
+
* import { useEncryption, encryptData, decryptData } from "@anuma/sdk/react";
|
|
4231
4009
|
*
|
|
4232
|
-
*
|
|
4233
|
-
*
|
|
4010
|
+
* function SecureComponent() {
|
|
4011
|
+
* const { user, signMessage } = usePrivy();
|
|
4012
|
+
* const { requestEncryptionKey } = useEncryption(signMessage);
|
|
4234
4013
|
*
|
|
4235
|
-
*
|
|
4236
|
-
*
|
|
4237
|
-
*
|
|
4238
|
-
*
|
|
4239
|
-
*
|
|
4014
|
+
* // Request encryption key when user is authenticated
|
|
4015
|
+
* useEffect(() => {
|
|
4016
|
+
* if (user?.wallet?.address) {
|
|
4017
|
+
* // This will prompt user to sign if key doesn't exist
|
|
4018
|
+
* await requestEncryptionKey(user.wallet.address);
|
|
4019
|
+
* }
|
|
4020
|
+
* }, [user]);
|
|
4021
|
+
* }
|
|
4022
|
+
* ```
|
|
4240
4023
|
*
|
|
4241
|
-
* @
|
|
4024
|
+
* @example
|
|
4025
|
+
* ```tsx
|
|
4026
|
+
* // ECDH key pair generation for end-to-end encryption
|
|
4027
|
+
* import { usePrivy } from "@privy-io/react-auth";
|
|
4028
|
+
* import { useEncryption } from "@anuma/sdk/react";
|
|
4242
4029
|
*
|
|
4243
|
-
*
|
|
4030
|
+
* function E2EEComponent() {
|
|
4031
|
+
* const { signMessage } = usePrivy();
|
|
4032
|
+
* const { requestKeyPair, exportPublicKey } = useEncryption(signMessage);
|
|
4033
|
+
*
|
|
4034
|
+
* const setupEncryption = async (walletAddress: string) => {
|
|
4035
|
+
* // Generate deterministic ECDH key pair from wallet signature
|
|
4036
|
+
* await requestKeyPair(walletAddress);
|
|
4037
|
+
*
|
|
4038
|
+
* // Export public key to share with others
|
|
4039
|
+
* const publicKey = await exportPublicKey(walletAddress);
|
|
4040
|
+
* console.log("Share this public key:", publicKey);
|
|
4041
|
+
* };
|
|
4042
|
+
* }
|
|
4043
|
+
* ```
|
|
4044
|
+
*
|
|
4045
|
+
* @category Hooks
|
|
4244
4046
|
*/
|
|
4245
|
-
declare function
|
|
4047
|
+
declare function useEncryption(signMessage: SignMessageFn, embeddedWalletSigner?: EmbeddedWalletSignerFn): UseEncryptionResult;
|
|
4246
4048
|
|
|
4247
4049
|
/**
|
|
4248
4050
|
* Checks if a string value is encrypted (has the enc:v2: or enc:v3: prefix with valid hex payload).
|
|
@@ -8507,6 +8309,14 @@ interface FileMetadata {
|
|
|
8507
8309
|
*/
|
|
8508
8310
|
sourceUrl?: string;
|
|
8509
8311
|
}
|
|
8312
|
+
/** 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. */
|
|
8313
|
+
interface VaultAttachmentRef {
|
|
8314
|
+
attachmentId: string;
|
|
8315
|
+
fileId: string;
|
|
8316
|
+
name: string;
|
|
8317
|
+
type: string;
|
|
8318
|
+
size: number;
|
|
8319
|
+
}
|
|
8510
8320
|
interface ChatCompletionUsage {
|
|
8511
8321
|
promptTokens?: number;
|
|
8512
8322
|
completionTokens?: number;
|
|
@@ -8610,6 +8420,7 @@ interface StoredMessage {
|
|
|
8610
8420
|
files?: FileMetadata[];
|
|
8611
8421
|
/** Array of media_id references for direct lookup in media table */
|
|
8612
8422
|
fileIds?: string[];
|
|
8423
|
+
vaultAttachments?: VaultAttachmentRef[];
|
|
8613
8424
|
createdAt: Date;
|
|
8614
8425
|
updatedAt: Date;
|
|
8615
8426
|
vector?: number[];
|
|
@@ -8786,6 +8597,7 @@ interface CreateMessageOptions {
|
|
|
8786
8597
|
files?: FileMetadata[];
|
|
8787
8598
|
/** Array of media_id references for direct lookup in media table */
|
|
8788
8599
|
fileIds?: string[];
|
|
8600
|
+
vaultAttachments?: VaultAttachmentRef[];
|
|
8789
8601
|
usage?: ChatCompletionUsage;
|
|
8790
8602
|
sources?: SearchSource[];
|
|
8791
8603
|
responseDuration?: number;
|
|
@@ -9336,29 +9148,336 @@ interface BaseSendMessageWithStorageArgs {
|
|
|
9336
9148
|
*/
|
|
9337
9149
|
assistantUniqueId?: string;
|
|
9338
9150
|
}
|
|
9339
|
-
interface BaseUseChatStorageResult {
|
|
9340
|
-
isLoading: boolean;
|
|
9341
|
-
stop: () => void;
|
|
9342
|
-
conversationId: string | null;
|
|
9343
|
-
setConversationId: (id: string | null) => void;
|
|
9344
|
-
createConversation: (options?: CreateConversationOptions) => Promise<StoredConversation>;
|
|
9345
|
-
getConversation: (id: string) => Promise<StoredConversation | null>;
|
|
9346
|
-
getConversations: () => Promise<StoredConversation[]>;
|
|
9347
|
-
updateConversationTitle: (id: string, title: string) => Promise<boolean>;
|
|
9348
|
-
updateConversationPinned: (id: string, pinned: boolean) => Promise<boolean>;
|
|
9349
|
-
deleteConversation: (id: string) => Promise<boolean>;
|
|
9350
|
-
getMessages: (conversationId: string) => Promise<StoredMessage[]>;
|
|
9351
|
-
/**
|
|
9352
|
-
* Paginated display read: the newest `limit` messages (optionally below
|
|
9353
|
-
* `beforeMessageId`), ascending, with embedding columns skipped.
|
|
9354
|
-
*/
|
|
9355
|
-
getMessagesPage: (conversationId: string, options: GetMessagesPageOptions) => Promise<StoredMessage[]>;
|
|
9356
|
-
/** Whole-thread branch-tree skeleton — no field decryption. */
|
|
9357
|
-
getMessageSkeletons: (conversationId: string) => Promise<MessageSkeleton[]>;
|
|
9358
|
-
/** Total message count for a conversation. */
|
|
9359
|
-
getMessageCount: (conversationId: string) => Promise<number>;
|
|
9151
|
+
interface BaseUseChatStorageResult {
|
|
9152
|
+
isLoading: boolean;
|
|
9153
|
+
stop: () => void;
|
|
9154
|
+
conversationId: string | null;
|
|
9155
|
+
setConversationId: (id: string | null) => void;
|
|
9156
|
+
createConversation: (options?: CreateConversationOptions) => Promise<StoredConversation>;
|
|
9157
|
+
getConversation: (id: string) => Promise<StoredConversation | null>;
|
|
9158
|
+
getConversations: () => Promise<StoredConversation[]>;
|
|
9159
|
+
updateConversationTitle: (id: string, title: string) => Promise<boolean>;
|
|
9160
|
+
updateConversationPinned: (id: string, pinned: boolean) => Promise<boolean>;
|
|
9161
|
+
deleteConversation: (id: string) => Promise<boolean>;
|
|
9162
|
+
getMessages: (conversationId: string) => Promise<StoredMessage[]>;
|
|
9163
|
+
/**
|
|
9164
|
+
* Paginated display read: the newest `limit` messages (optionally below
|
|
9165
|
+
* `beforeMessageId`), ascending, with embedding columns skipped.
|
|
9166
|
+
*/
|
|
9167
|
+
getMessagesPage: (conversationId: string, options: GetMessagesPageOptions) => Promise<StoredMessage[]>;
|
|
9168
|
+
/** Whole-thread branch-tree skeleton — no field decryption. */
|
|
9169
|
+
getMessageSkeletons: (conversationId: string) => Promise<MessageSkeleton[]>;
|
|
9170
|
+
/** Total message count for a conversation. */
|
|
9171
|
+
getMessageCount: (conversationId: string) => Promise<number>;
|
|
9172
|
+
}
|
|
9173
|
+
declare function generateConversationId(): string;
|
|
9174
|
+
|
|
9175
|
+
type ChatRecordKind = "conversation" | "message" | "summary" | "project" | "memory_links";
|
|
9176
|
+
type ChatJson = null | boolean | number | string | ChatJson[] | {
|
|
9177
|
+
[key: string]: ChatJson;
|
|
9178
|
+
};
|
|
9179
|
+
/** Whole-record JSON data is encrypted on the device, including all text, vectors and tool events. */
|
|
9180
|
+
interface ChatRecord {
|
|
9181
|
+
kind: ChatRecordKind;
|
|
9182
|
+
id: string;
|
|
9183
|
+
conversationId: string;
|
|
9184
|
+
sortKey: number;
|
|
9185
|
+
createdAt: number;
|
|
9186
|
+
updatedAt: number;
|
|
9187
|
+
isDeleted: boolean;
|
|
9188
|
+
data: {
|
|
9189
|
+
[key: string]: ChatJson;
|
|
9190
|
+
};
|
|
9191
|
+
}
|
|
9192
|
+
interface ChatSnapshot {
|
|
9193
|
+
record: ChatRecord;
|
|
9194
|
+
version: number;
|
|
9195
|
+
serverUpdatedAt: string;
|
|
9196
|
+
}
|
|
9197
|
+
interface ChatWrite {
|
|
9198
|
+
record: ChatRecord;
|
|
9199
|
+
expectedVersion: number;
|
|
9200
|
+
/** Sent and stored unencrypted so vault can run vector search. */
|
|
9201
|
+
embeddings?: number[][];
|
|
9202
|
+
embeddingModel?: string;
|
|
9203
|
+
}
|
|
9204
|
+
interface ChatRef {
|
|
9205
|
+
kind: ChatRecordKind;
|
|
9206
|
+
id: string;
|
|
9207
|
+
}
|
|
9208
|
+
type ChatAccountState = "none" | "migrating" | "active";
|
|
9209
|
+
interface ChatAccount {
|
|
9210
|
+
keyId: string;
|
|
9211
|
+
state: ChatAccountState;
|
|
9212
|
+
recordCount: number;
|
|
9213
|
+
storageBytes: number;
|
|
9214
|
+
vectorCount: number;
|
|
9215
|
+
/** The newest change; read it before loading history and poll `changes` from it. Absent before the first record. */
|
|
9216
|
+
changesCursor?: string;
|
|
9217
|
+
}
|
|
9218
|
+
interface ChatImport {
|
|
9219
|
+
record: ChatRecord;
|
|
9220
|
+
/** Sent and stored unencrypted so vault can run vector search. */
|
|
9221
|
+
embeddings?: number[][];
|
|
9222
|
+
embeddingModel?: string;
|
|
9223
|
+
}
|
|
9224
|
+
interface ChatRevision {
|
|
9225
|
+
kind: ChatRecordKind;
|
|
9226
|
+
id: string;
|
|
9227
|
+
updatedAt: number;
|
|
9228
|
+
isDeleted: boolean;
|
|
9229
|
+
}
|
|
9230
|
+
interface ChatChanges {
|
|
9231
|
+
items: ChatSnapshot[];
|
|
9232
|
+
nextCursor?: string;
|
|
9233
|
+
changesCursor: string;
|
|
9234
|
+
}
|
|
9235
|
+
interface ChatSearchOptions {
|
|
9236
|
+
limit?: number;
|
|
9237
|
+
kinds?: ("message" | "summary")[];
|
|
9238
|
+
conversationId?: string;
|
|
9239
|
+
excludeConversationId?: string;
|
|
9240
|
+
/** Ranks only vectors from this model; vectors stored without one always count. */
|
|
9241
|
+
embeddingModel?: string;
|
|
9242
|
+
signal?: AbortSignal;
|
|
9360
9243
|
}
|
|
9361
|
-
|
|
9244
|
+
interface ChatSearchHit extends ChatSnapshot {
|
|
9245
|
+
chunk: number;
|
|
9246
|
+
score: number;
|
|
9247
|
+
}
|
|
9248
|
+
interface ChatAttachment {
|
|
9249
|
+
id: string;
|
|
9250
|
+
sizeBytes: number;
|
|
9251
|
+
state: "pending" | "committed";
|
|
9252
|
+
ownerKind?: "message" | "summary";
|
|
9253
|
+
ownerId?: string;
|
|
9254
|
+
createdAt: string;
|
|
9255
|
+
committedAt?: string;
|
|
9256
|
+
}
|
|
9257
|
+
interface ChatPresignedUrl {
|
|
9258
|
+
url: string;
|
|
9259
|
+
method: string;
|
|
9260
|
+
headers: Record<string, string>;
|
|
9261
|
+
expiresAt: string;
|
|
9262
|
+
}
|
|
9263
|
+
interface ChatAttachments {
|
|
9264
|
+
create(sizeBytes: number, signal?: AbortSignal): Promise<{
|
|
9265
|
+
attachment: ChatAttachment;
|
|
9266
|
+
upload: ChatPresignedUrl;
|
|
9267
|
+
}>;
|
|
9268
|
+
commit(attachmentId: string, owner: {
|
|
9269
|
+
kind: "message" | "summary";
|
|
9270
|
+
id: string;
|
|
9271
|
+
}, signal?: AbortSignal): Promise<ChatAttachment>;
|
|
9272
|
+
get(attachmentId: string, signal?: AbortSignal): Promise<{
|
|
9273
|
+
attachment: ChatAttachment;
|
|
9274
|
+
download?: ChatPresignedUrl;
|
|
9275
|
+
} | null>;
|
|
9276
|
+
delete(attachmentId: string, signal?: AbortSignal): Promise<void>;
|
|
9277
|
+
}
|
|
9278
|
+
interface ChatListOptions {
|
|
9279
|
+
kind: ChatRecordKind;
|
|
9280
|
+
conversationId?: string;
|
|
9281
|
+
includeDeleted?: boolean;
|
|
9282
|
+
cursor?: string;
|
|
9283
|
+
limit?: number;
|
|
9284
|
+
signal?: AbortSignal;
|
|
9285
|
+
}
|
|
9286
|
+
interface ChatPage {
|
|
9287
|
+
items: ChatSnapshot[];
|
|
9288
|
+
nextCursor?: string;
|
|
9289
|
+
total?: number;
|
|
9290
|
+
}
|
|
9291
|
+
/** Explicit versions protect edits; ambiguous writes are never replayed automatically. */
|
|
9292
|
+
interface ChatStore {
|
|
9293
|
+
get(kind: ChatRecordKind, id: string, signal?: AbortSignal): Promise<ChatSnapshot | null>;
|
|
9294
|
+
list(options: ChatListOptions): Promise<ChatPage>;
|
|
9295
|
+
putMany(writes: readonly ChatWrite[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
|
|
9296
|
+
getMany(refs: readonly ChatRef[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
|
|
9297
|
+
account(signal?: AbortSignal): Promise<ChatAccount>;
|
|
9298
|
+
importRecords(records: readonly ChatImport[], signal?: AbortSignal): Promise<number>;
|
|
9299
|
+
verify(revisions: readonly ChatRevision[], signal?: AbortSignal): Promise<ChatRef[]>;
|
|
9300
|
+
activate(signal?: AbortSignal): Promise<boolean>;
|
|
9301
|
+
changes(cursor?: string, options?: {
|
|
9302
|
+
limit?: number;
|
|
9303
|
+
signal?: AbortSignal;
|
|
9304
|
+
}): Promise<ChatChanges>;
|
|
9305
|
+
search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
|
|
9306
|
+
deleteAll(signal?: AbortSignal): Promise<number>;
|
|
9307
|
+
attachments: ChatAttachments;
|
|
9308
|
+
}
|
|
9309
|
+
interface RemoteChatStoreOptions {
|
|
9310
|
+
baseUrl: string;
|
|
9311
|
+
getToken: () => Promise<string | null>;
|
|
9312
|
+
keyId: string;
|
|
9313
|
+
encrypt: (plaintext: string) => Promise<string>;
|
|
9314
|
+
decrypt: (ciphertext: string) => Promise<string>;
|
|
9315
|
+
fetch?: typeof globalThis.fetch;
|
|
9316
|
+
timeoutMs?: number;
|
|
9317
|
+
signal?: AbortSignal;
|
|
9318
|
+
}
|
|
9319
|
+
declare class ChatStoreError extends Error {
|
|
9320
|
+
readonly status: number;
|
|
9321
|
+
readonly code?: string | undefined;
|
|
9322
|
+
readonly retryAfterMs?: number | undefined;
|
|
9323
|
+
constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
|
|
9324
|
+
}
|
|
9325
|
+
|
|
9326
|
+
interface ChatMigrationOptions {
|
|
9327
|
+
/** The device's local chat database. */
|
|
9328
|
+
database: Database;
|
|
9329
|
+
/** Vault, opened with the account's canonical key. */
|
|
9330
|
+
store: ChatStore;
|
|
9331
|
+
walletAddress?: string;
|
|
9332
|
+
signMessage?: SignMessageFn;
|
|
9333
|
+
embeddedWalletSigner?: EmbeddedWalletSignerFn;
|
|
9334
|
+
/** Runs the final pass while local chat writers are held, so nothing lands locally after it. */
|
|
9335
|
+
withWriteBarrier: (task: () => Promise<ChatMigrationResult>) => Promise<ChatMigrationResult>;
|
|
9336
|
+
/** Called once vault holds everything; hand the device over to vault here. */
|
|
9337
|
+
onActivated: () => void | Promise<void>;
|
|
9338
|
+
/** Activate even when some rows could not be read; they stay on the device. */
|
|
9339
|
+
allowSkipped?: boolean;
|
|
9340
|
+
maxVectors?: number;
|
|
9341
|
+
maxStorageBytes?: number;
|
|
9342
|
+
signal?: AbortSignal;
|
|
9343
|
+
onProgress?: (progress: ChatMigrationProgress) => void;
|
|
9344
|
+
}
|
|
9345
|
+
interface ChatMigrationProgress {
|
|
9346
|
+
imported: number;
|
|
9347
|
+
toImport: number;
|
|
9348
|
+
}
|
|
9349
|
+
interface ChatMigrationSkip {
|
|
9350
|
+
kind: ChatRecordKind;
|
|
9351
|
+
id: string;
|
|
9352
|
+
reason: "unreadable" | "invalid";
|
|
9353
|
+
}
|
|
9354
|
+
interface ChatMigrationResult {
|
|
9355
|
+
state: "migrating" | "active";
|
|
9356
|
+
conversations: number;
|
|
9357
|
+
messages: number;
|
|
9358
|
+
imported: number;
|
|
9359
|
+
skipped: ChatMigrationSkip[];
|
|
9360
|
+
/** Conversations whose title could not be decrypted and went up untitled. */
|
|
9361
|
+
untitled: number;
|
|
9362
|
+
/** Messages sent without vectors to stay inside the account's vector quota. */
|
|
9363
|
+
unembedded: number;
|
|
9364
|
+
/** Messages shrunk to fit vault's record limit. */
|
|
9365
|
+
truncated: number;
|
|
9366
|
+
}
|
|
9367
|
+
/** Copies this device's chats to vault, verifies them under the write barrier, then activates vault and hands the device over. */
|
|
9368
|
+
declare function migrateChatsToRemote(options: ChatMigrationOptions): Promise<ChatMigrationResult>;
|
|
9369
|
+
|
|
9370
|
+
/** Connect to owner-scoped server storage using the account's canonical device-held cipher. */
|
|
9371
|
+
declare function createRemoteChatStore(options: RemoteChatStoreOptions): Promise<ChatStore>;
|
|
9372
|
+
|
|
9373
|
+
/**
|
|
9374
|
+
* AES-GCM keys derived from one wallet signature over `SIGN_MESSAGE`.
|
|
9375
|
+
* @public
|
|
9376
|
+
*/
|
|
9377
|
+
interface MemoryKeyRing {
|
|
9378
|
+
keyId: string;
|
|
9379
|
+
v3: CryptoKey;
|
|
9380
|
+
v2: CryptoKey;
|
|
9381
|
+
}
|
|
9382
|
+
/**
|
|
9383
|
+
* Thrown when no supplied key decrypts a field.
|
|
9384
|
+
* @public
|
|
9385
|
+
*/
|
|
9386
|
+
declare class MemoryKeyError extends Error {
|
|
9387
|
+
constructor(message: string);
|
|
9388
|
+
}
|
|
9389
|
+
/**
|
|
9390
|
+
* Derive the v3 and legacy v2 memory keys from a hex wallet signature.
|
|
9391
|
+
* @public
|
|
9392
|
+
*/
|
|
9393
|
+
declare function deriveMemoryKeyRing(signatureHex: string): Promise<MemoryKeyRing>;
|
|
9394
|
+
/**
|
|
9395
|
+
* Encrypt and decrypt callbacks for `createRemoteMemoryPersistence` under the canonical key.
|
|
9396
|
+
* @public
|
|
9397
|
+
*/
|
|
9398
|
+
declare function memoryCipher(canonical: MemoryKeyRing): {
|
|
9399
|
+
encrypt: (plaintext: string) => Promise<string>;
|
|
9400
|
+
decrypt: (ciphertext: string) => Promise<string>;
|
|
9401
|
+
};
|
|
9402
|
+
/**
|
|
9403
|
+
* Re-encrypt a local field under the canonical key.
|
|
9404
|
+
* @throws MemoryKeyError when no key decrypts the field.
|
|
9405
|
+
* @public
|
|
9406
|
+
*/
|
|
9407
|
+
declare function reencryptMemoryField(value: string, canonical: MemoryKeyRing, fallbacks?: readonly MemoryKeyRing[]): Promise<string>;
|
|
9408
|
+
|
|
9409
|
+
/** The largest file vault stores, after the encryption frame is added. */
|
|
9410
|
+
declare const maxVaultAttachmentBytes: number;
|
|
9411
|
+
/** Device-side store for decrypted attachment bytes, keyed by vault attachment id. */
|
|
9412
|
+
interface VaultAttachmentCache {
|
|
9413
|
+
get(attachmentId: string): Promise<Uint8Array | null>;
|
|
9414
|
+
set(attachmentId: string, bytes: Uint8Array): Promise<void>;
|
|
9415
|
+
delete(attachmentId: string): Promise<void>;
|
|
9416
|
+
}
|
|
9417
|
+
interface VaultAttachmentOwner {
|
|
9418
|
+
kind: "message" | "summary";
|
|
9419
|
+
id: string;
|
|
9420
|
+
}
|
|
9421
|
+
interface VaultAttachmentsOptions {
|
|
9422
|
+
store: ChatStore;
|
|
9423
|
+
keyRing: MemoryKeyRing;
|
|
9424
|
+
cache?: VaultAttachmentCache;
|
|
9425
|
+
fetch?: typeof globalThis.fetch;
|
|
9426
|
+
retries?: number;
|
|
9427
|
+
retryDelayMs?: number;
|
|
9428
|
+
now?: () => number;
|
|
9429
|
+
}
|
|
9430
|
+
interface VaultAttachmentUploadOptions {
|
|
9431
|
+
signal?: AbortSignal;
|
|
9432
|
+
/** Runs before any bytes leave the device, again for each new reservation. */
|
|
9433
|
+
onReserved?: (attachmentId: string) => void | Promise<void>;
|
|
9434
|
+
}
|
|
9435
|
+
/** Encrypted chat attachments in vault: upload, bind to a message, read back on any device, delete. */
|
|
9436
|
+
interface VaultAttachments {
|
|
9437
|
+
/** Encrypts and uploads `bytes`; the attachment stays pending until `commit`, and vault drops it after 24h. */
|
|
9438
|
+
upload(bytes: Uint8Array, options?: VaultAttachmentUploadOptions): Promise<string>;
|
|
9439
|
+
/** Binds an uploaded attachment to a message or summary that vault already holds. */
|
|
9440
|
+
commit(attachmentId: string, owner: VaultAttachmentOwner, signal?: AbortSignal): Promise<ChatAttachment>;
|
|
9441
|
+
/** The decrypted bytes, or null when the attachment is gone or not yet committed. */
|
|
9442
|
+
read(attachmentId: string, signal?: AbortSignal): Promise<Uint8Array | null>;
|
|
9443
|
+
delete(attachmentId: string, signal?: AbortSignal): Promise<void>;
|
|
9444
|
+
}
|
|
9445
|
+
/** Creates the attachment client for one account and key; bytes are AES-GCM sealed with the ring's v3 key before upload. */
|
|
9446
|
+
declare function createVaultAttachments(options: VaultAttachmentsOptions): VaultAttachments;
|
|
9447
|
+
/** Where a migration run keeps the reservation it is working on, so a rerun resumes it instead of uploading again. */
|
|
9448
|
+
interface VaultAttachmentJournal {
|
|
9449
|
+
get(key: string): Promise<string | null>;
|
|
9450
|
+
set(key: string, attachmentId: string | null): Promise<void>;
|
|
9451
|
+
}
|
|
9452
|
+
interface LocalMessageAttachment {
|
|
9453
|
+
/** `FileMetadata.id` or the media id listed in `fileIds`. */
|
|
9454
|
+
fileId: string;
|
|
9455
|
+
name: string;
|
|
9456
|
+
type: string;
|
|
9457
|
+
read(): Promise<Uint8Array | null>;
|
|
9458
|
+
}
|
|
9459
|
+
interface MessageAttachmentMigrationOptions {
|
|
9460
|
+
store: ChatStore;
|
|
9461
|
+
attachments: VaultAttachments;
|
|
9462
|
+
journal: VaultAttachmentJournal;
|
|
9463
|
+
/** The message's vault id (`StoredMessage.uniqueId`); vault must already hold it. */
|
|
9464
|
+
messageId: string;
|
|
9465
|
+
files: readonly LocalMessageAttachment[];
|
|
9466
|
+
now?: () => number;
|
|
9467
|
+
signal?: AbortSignal;
|
|
9468
|
+
}
|
|
9469
|
+
interface MessageAttachmentMigrationResult {
|
|
9470
|
+
refs: VaultAttachmentRef[];
|
|
9471
|
+
uploaded: number;
|
|
9472
|
+
missing: string[];
|
|
9473
|
+
oversized: string[];
|
|
9474
|
+
/** File ids another run may still be uploading; rerun after 16 minutes. */
|
|
9475
|
+
deferred: string[];
|
|
9476
|
+
}
|
|
9477
|
+
/** The vault attachment refs a message record carries; malformed entries are left out. */
|
|
9478
|
+
declare function vaultAttachmentRefs(record: Pick<ChatRecord, "data">): VaultAttachmentRef[];
|
|
9479
|
+
/** 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. */
|
|
9480
|
+
declare function migrateMessageAttachments(options: MessageAttachmentMigrationOptions): Promise<MessageAttachmentMigrationResult>;
|
|
9362
9481
|
|
|
9363
9482
|
/** Durable home for each account's sealed chat cache; `set(account, null)` deletes that account's entry. */
|
|
9364
9483
|
interface ChatCacheStorage {
|
|
@@ -11820,42 +11939,6 @@ interface LocalMemoryStoreOptions {
|
|
|
11820
11939
|
*/
|
|
11821
11940
|
declare function createLocalMemoryStore(options: LocalMemoryStoreOptions): MemoryStore;
|
|
11822
11941
|
|
|
11823
|
-
/**
|
|
11824
|
-
* AES-GCM keys derived from one wallet signature over `SIGN_MESSAGE`.
|
|
11825
|
-
* @public
|
|
11826
|
-
*/
|
|
11827
|
-
interface MemoryKeyRing {
|
|
11828
|
-
keyId: string;
|
|
11829
|
-
v3: CryptoKey;
|
|
11830
|
-
v2: CryptoKey;
|
|
11831
|
-
}
|
|
11832
|
-
/**
|
|
11833
|
-
* Thrown when no supplied key decrypts a field.
|
|
11834
|
-
* @public
|
|
11835
|
-
*/
|
|
11836
|
-
declare class MemoryKeyError extends Error {
|
|
11837
|
-
constructor(message: string);
|
|
11838
|
-
}
|
|
11839
|
-
/**
|
|
11840
|
-
* Derive the v3 and legacy v2 memory keys from a hex wallet signature.
|
|
11841
|
-
* @public
|
|
11842
|
-
*/
|
|
11843
|
-
declare function deriveMemoryKeyRing(signatureHex: string): Promise<MemoryKeyRing>;
|
|
11844
|
-
/**
|
|
11845
|
-
* Encrypt and decrypt callbacks for `createRemoteMemoryPersistence` under the canonical key.
|
|
11846
|
-
* @public
|
|
11847
|
-
*/
|
|
11848
|
-
declare function memoryCipher(canonical: MemoryKeyRing): {
|
|
11849
|
-
encrypt: (plaintext: string) => Promise<string>;
|
|
11850
|
-
decrypt: (ciphertext: string) => Promise<string>;
|
|
11851
|
-
};
|
|
11852
|
-
/**
|
|
11853
|
-
* Re-encrypt a local field under the canonical key.
|
|
11854
|
-
* @throws MemoryKeyError when no key decrypts the field.
|
|
11855
|
-
* @public
|
|
11856
|
-
*/
|
|
11857
|
-
declare function reencryptMemoryField(value: string, canonical: MemoryKeyRing, fallbacks?: readonly MemoryKeyRing[]): Promise<string>;
|
|
11858
|
-
|
|
11859
11942
|
/** @public */
|
|
11860
11943
|
interface RemoteMemoryTopic {
|
|
11861
11944
|
name: string;
|
|
@@ -16212,4 +16295,4 @@ type UseWalletBindingResult = {
|
|
|
16212
16295
|
*/
|
|
16213
16296
|
declare function useWalletBinding(options?: UseWalletBindingOptions): UseWalletBindingResult;
|
|
16214
16297
|
|
|
16215
|
-
export { Anuma, type AnumaChild, AnumaJsxError, type AnumaNode, AnumaShadowIsolationProvider, type AnumaShadowIsolationProviderProps, type AnumaTheme, AnumaThemeProvider, type AnumaThemeProviderProps, AppFile as AppFileModel, type AppFileOperationsContext, type AttrValue, type AutoExtractMessage, type AutoExtractor, DEFAULT_BACKUP_FOLDER as BACKUP_ICLOUD_FOLDER, BUILT_IN_TOOL_SETS, type BackupAuthContextValue, BackupAuthProvider, type BackupAuthProviderProps, type BackupOperationOptions, BlobUrlManager, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, ChartCard, type ChartCardProps, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, 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 ChatStorageAdapter, type ChatStorageObservable, type ChatStore, ChatStoreError, type ChatWrite, type ChunkSearchResult, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type CircleProps, type ClientToolsFilterFn, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type ConversationQueryOptions, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateEntityOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateSavedToolOptions, type CreateSelectPaymentWalletToolOptions, type CreateServerToolsFilterOptions, type CreateUserPreferenceOptions, 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_EXCLUDED_SERVER_TOOLS, DEFAULT_BACKUP_FOLDER as DEFAULT_ICLOUD_BACKUP_FOLDER, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DeckProps, type DisplayToolMigrations, type DurableAutoExtractorOptions, ENTITY_FANOUT, ENTITY_KINDS, type EmbeddedWalletSignerFn, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type EncryptionKeyVersion, type EntityInput, type EntityKind, Entity as EntityModel, type EntityOperationsContext, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, FILE_PLACEHOLDER_PREFIX, FILE_PLACEHOLDER_REGEX, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, type GroupProps, HARD_DELETE_WINDOW_MS, type ICloudAuthContextValue, ICloudAuthProvider, type ICloudAuthProviderProps, type ICloudExportResult, type ICloudImportResult, INFERENCE_ID_HEADER, INTERNAL_FLOW_MARKER, type IconProps, type ImageProps, type InjectionClassifierOptions, type InjectionReason, type InteractionType, type KnownTag, type LazyStoredConversation, type LineProps, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, 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, MemoryEntity as MemoryEntityModel, 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 MessageChunk, type MessageFeedback, type MessageOrigin, type MessageSkeleton, type ModelLoadProgress, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type OCRFile, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, type PaymentWallet, type PdfExportOptions, type PdfExportProgress, type PdfExportStage, type PdfFile, PdfProcessor, type PendingInteraction, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PhoneCallPollingOptions, type PhotoIngestResult, type PhotoMediaRef, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type ProfileUpdate, type ProgressCallback, Project, type ProjectOperationsContext, type PromptPreProcessor, type PromptPreProcessorContext, type ProviderAuthState, type ProviderBackupState, ProviderStreamError, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, R2_DEFAULT_TTL_MS, 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 RectProps, 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 RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SELECT_PAYMENT_WALLET_TOOL_NAME, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, STREAM_RESUMABLE_HEADER, SavedTool as SavedToolModel, type SavedToolOperationsContext, type SavedToolParameter, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenProps, type ScreenResult, type ScreenedCandidate, type SearchMessagesOptions, type SearchSource, type SelectPaymentWalletResult, type SelectServerToolsForPromptOptions, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ServerTool, type ServerToolsFilter, type ServerToolsFilterFn, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type SignMessageOptions, type SlideProps, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredAppFile, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredEntity, type StoredFileWithContext, type StoredMedia, Media as StoredMediaModel, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type StoredProject, type StoredSavedTool, type StoredTopic, type StoredUserPreference, UserPreference as StoredUserPreferenceModel, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, THEME_ATTRS, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type TextProps, type ThemeAttr, type ToolCallArgumentsDeltaEvent, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TopicSource, type TranscriptionResult, type TurnCompleteEvent, type TurnSkippedEvent, type UIInteractionContextValue, UIInteractionProvider, type UIInteractionProviderProps, type UncheckedReason, type UnverifiableReason, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateSavedToolOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseBackupOptions, type UseBackupResult, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseEncryptionResult, type UseExportPdfResult, type UseFilesOptions, type UseFilesResult, type UseICloudBackupOptions, type UseICloudBackupResult, type UseModelsResult, type UseOCRResult, type UsePdfResult, type UsePhoneCallsOptions, type UsePhoneCallsResult, type UseProjectsOptions, type UseProjectsResult, type UseSettingsOptions, type UseSettingsResult, type UseSubscriptionOptions, type UseSubscriptionResult, type UseToolsOptions, type UseToolsResult, type UseVoiceOptions, type UseVoiceResult, type UseWalletBindingOptions, type UseWalletBindingResult, VAULT_SIZE_HOP_CAP, type VaultCandidateKey, 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, type VoiceRecording, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, WalletPoller, WatermelonChatStorageAdapter, type WatermelonChatStorageAdapterOptions, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WhisperModel, WordProcessor, type WriteFailureReason, ZipProcessor, type ZipProcessorOptions, addConversationMemoriesOp, appFileToStored, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryEntityUserIdsOp, backfillMemoryTopicsOp, buildAttachedFilesText, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearConversationMemoriesOp, clearEncryptionKey, clearICloudAuth, clearKeyPair, clearLazyTitleCache, clearMemoryTopicsOverrideOp, clearModelsCache, clearNotionToken, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createGitHubTools, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createPlatformCursorStore, createProjectOp, createRecallTool, createRemoteChatStore, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createSavedToolOp, createSelectPaymentWalletTool, createServerToolsFilter, createStockPricePreProcessor, createVaultChatBackend, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWalletPaymentTool, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, decryptMessageEmbeddingFields, defaultServerToolsFilter, deleteAllAppFilesOp, deleteAllVaultMemoriesForUserOp, deleteAppFileOp, deleteEncryptedFile, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteMessageOp, deleteProjectOp, deleteSavedToolOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, encryptToolCallEventsOp, ensureDefaultFoldersOp, expandToolSetsAdditive, exportElementToPdf, exportMarkdownToPdf, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractFileIds, extractMCPImageUrls, extractReservationReceipts, fileExists, findById, findMatchingTools, findParentOfId, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllSavedToolsOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAndClearNotionPendingMessage, getAndClearNotionReturnUrl, getAppFileMapOp, getAppFileOp, getAppFilesOp, getAudioOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getDocumentsOp, getEncryptionKey, getEntitiesByMemoryIdsOp, getId, getImagesOp, getLogger, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesByEntityNamesOp, getMemoriesNeedingTopicExtractionOp, getNotionAccessToken, getNotionMCPUrl, getNumberAttr, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getSavedToolByIdOp, getServerTools, getStringAttr, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserUploadedMediaOp, getValidNotionToken, getVaultCandidateKeysOp, getVaultEmbeddingsByIdsOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, getVideosOp, handleNotionCallback, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasICloudCredentials, hasKeyPair, hasNotionCredentials, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, insertAfterId, insertChild, isAnumaTag, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isHtmlTag, isNotionCallback, isOPFSSupported, isR2UrlExpired, isRerankerAvailable, isSupportedFile, isSupportedMediaType, linkMemoryEntitiesOp, localChatBackend, maskScopedEmbeddingCache, mediaToStored, memoryCipher, migrateChatsToRemote, migrateDisplayResult, migrateMemoriesToRemote, migrateNotionClientRegistration, migrateNotionToken, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseJsx, parseMedia, preEmbedVaultMemories, preprocessFiles, previewToolSelection, primaryTopic, projectToStored, putAppFileOp, quantizeEmbedding, queueManager, rankProfileCandidates, readEncryptedFile, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionToken, relinkMemoryTopicsOp, relinkMisclassifiedVideosOp, removeById, renderAnumaJsx, renderAnumaTree, renderElementToCanvas, replaceById, replaceMemoryEntitiesGuardedOp, requestEncryptionKey, requestKeyPair, resolveFilePlaceholders, resolveThemeColor, restoreVaultMemoryOp, resumeStream, retain, revokeNotionAccess, savedToolToStored, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, seedEncryptionKeys, selectServerToolsForPrompt, serializeJsx, setLogger, setMemoryEntitiesOp, setMemoryVisibilityOp, settingsStorageSchema, shouldChunkMessage, shouldRecallMemory, shouldRefreshTools, stampTopicsExtractedAtOp, startNotionAuth, storeNotionPendingMessage, storeNotionReturnUrl, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateAttrs, updateConversationProjectOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageFeedbackOp, updateProjectNameOp, updateProjectOp, updateSavedToolOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, useAnumaTheme, useBackup, useBackupAuth, useChat, useChatStorage, useCredits, useDatabaseManager, useEncryption, useExportPdf, useFiles, useICloudAuth, useICloudBackup, useModels, useOCR, usePdf, usePhoneCalls, useProjects, useSettings, useSubscription, useTools, useUIInteraction, useVoice, useWalletBinding, userPreferencesStorageSchema, vaultChatBackend, verifyMemoriesForPublish, walk, webPlatformStorage, withActiveToolSetServerTools, withInternalFlowMarker, writeEncryptedFile };
|
|
16298
|
+
export { Anuma, type AnumaChild, AnumaJsxError, type AnumaNode, AnumaShadowIsolationProvider, type AnumaShadowIsolationProviderProps, type AnumaTheme, AnumaThemeProvider, type AnumaThemeProviderProps, AppFile as AppFileModel, type AppFileOperationsContext, type AttrValue, type AutoExtractMessage, type AutoExtractor, DEFAULT_BACKUP_FOLDER as BACKUP_ICLOUD_FOLDER, BUILT_IN_TOOL_SETS, type BackupAuthContextValue, BackupAuthProvider, type BackupAuthProviderProps, type BackupOperationOptions, BlobUrlManager, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, ChartCard, type ChartCardProps, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, 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 ChatStorageAdapter, type ChatStorageObservable, type ChatStore, ChatStoreError, type ChatWrite, type ChunkSearchResult, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type CircleProps, type ClientToolsFilterFn, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type ConversationQueryOptions, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateEntityOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateSavedToolOptions, type CreateSelectPaymentWalletToolOptions, type CreateServerToolsFilterOptions, type CreateUserPreferenceOptions, 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_EXCLUDED_SERVER_TOOLS, DEFAULT_BACKUP_FOLDER as DEFAULT_ICLOUD_BACKUP_FOLDER, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DeckProps, type DisplayToolMigrations, type DurableAutoExtractorOptions, ENTITY_FANOUT, ENTITY_KINDS, type EmbeddedWalletSignerFn, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type EncryptionKeyVersion, type EntityInput, type EntityKind, Entity as EntityModel, type EntityOperationsContext, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, FILE_PLACEHOLDER_PREFIX, FILE_PLACEHOLDER_REGEX, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, type GroupProps, HARD_DELETE_WINDOW_MS, type ICloudAuthContextValue, ICloudAuthProvider, type ICloudAuthProviderProps, type ICloudExportResult, type ICloudImportResult, INFERENCE_ID_HEADER, INTERNAL_FLOW_MARKER, type IconProps, type ImageProps, type InjectionClassifierOptions, type InjectionReason, type InteractionType, type KnownTag, type LazyStoredConversation, type LineProps, 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 MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, 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, MemoryEntity as MemoryEntityModel, 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 MessageChunk, type MessageFeedback, type MessageOrigin, type MessageSkeleton, type ModelLoadProgress, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type OCRFile, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, type PaymentWallet, type PdfExportOptions, type PdfExportProgress, type PdfExportStage, type PdfFile, PdfProcessor, type PendingInteraction, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PhoneCallPollingOptions, type PhotoIngestResult, type PhotoMediaRef, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type ProfileUpdate, type ProgressCallback, Project, type ProjectOperationsContext, type PromptPreProcessor, type PromptPreProcessorContext, type ProviderAuthState, type ProviderBackupState, ProviderStreamError, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, R2_DEFAULT_TTL_MS, 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 RectProps, 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 RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SELECT_PAYMENT_WALLET_TOOL_NAME, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, STREAM_RESUMABLE_HEADER, SavedTool as SavedToolModel, type SavedToolOperationsContext, type SavedToolParameter, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenProps, type ScreenResult, type ScreenedCandidate, type SearchMessagesOptions, type SearchSource, type SelectPaymentWalletResult, type SelectServerToolsForPromptOptions, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ServerTool, type ServerToolsFilter, type ServerToolsFilterFn, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type SignMessageOptions, type SlideProps, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredAppFile, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredEntity, type StoredFileWithContext, type StoredMedia, Media as StoredMediaModel, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type StoredProject, type StoredSavedTool, type StoredTopic, type StoredUserPreference, UserPreference as StoredUserPreferenceModel, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, THEME_ATTRS, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type TextProps, type ThemeAttr, type ToolCallArgumentsDeltaEvent, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TopicSource, type TranscriptionResult, type TurnCompleteEvent, type TurnSkippedEvent, type UIInteractionContextValue, UIInteractionProvider, type UIInteractionProviderProps, type UncheckedReason, type UnverifiableReason, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateSavedToolOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseBackupOptions, type UseBackupResult, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseEncryptionResult, type UseExportPdfResult, type UseFilesOptions, type UseFilesResult, type UseICloudBackupOptions, type UseICloudBackupResult, type UseModelsResult, type UseOCRResult, type UsePdfResult, type UsePhoneCallsOptions, type UsePhoneCallsResult, type UseProjectsOptions, type UseProjectsResult, type UseSettingsOptions, type UseSettingsResult, type UseSubscriptionOptions, type UseSubscriptionResult, type UseToolsOptions, type UseToolsResult, type UseVoiceOptions, type UseVoiceResult, type UseWalletBindingOptions, type UseWalletBindingResult, VAULT_SIZE_HOP_CAP, type VaultAttachmentCache, type VaultAttachmentJournal, type VaultAttachmentOwner, type VaultAttachmentRef, type VaultAttachmentUploadOptions, type VaultAttachments, type VaultAttachmentsOptions, type VaultCandidateKey, 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, type VoiceRecording, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, WalletPoller, WatermelonChatStorageAdapter, type WatermelonChatStorageAdapterOptions, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WhisperModel, WordProcessor, type WriteFailureReason, ZipProcessor, type ZipProcessorOptions, addConversationMemoriesOp, appFileToStored, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryEntityUserIdsOp, backfillMemoryTopicsOp, buildAttachedFilesText, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearConversationMemoriesOp, clearEncryptionKey, clearICloudAuth, clearKeyPair, clearLazyTitleCache, clearMemoryTopicsOverrideOp, clearModelsCache, clearNotionToken, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createGitHubTools, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createPlatformCursorStore, createProjectOp, createRecallTool, createRemoteChatStore, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createSavedToolOp, createSelectPaymentWalletTool, createServerToolsFilter, createStockPricePreProcessor, createVaultAttachments, createVaultChatBackend, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWalletPaymentTool, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, decryptMessageEmbeddingFields, defaultServerToolsFilter, deleteAllAppFilesOp, deleteAllVaultMemoriesForUserOp, deleteAppFileOp, deleteEncryptedFile, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteMessageOp, deleteProjectOp, deleteSavedToolOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, encryptToolCallEventsOp, ensureDefaultFoldersOp, expandToolSetsAdditive, exportElementToPdf, exportMarkdownToPdf, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractFileIds, extractMCPImageUrls, extractReservationReceipts, fileExists, findById, findMatchingTools, findParentOfId, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllSavedToolsOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAndClearNotionPendingMessage, getAndClearNotionReturnUrl, getAppFileMapOp, getAppFileOp, getAppFilesOp, getAudioOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getDocumentsOp, getEncryptionKey, getEntitiesByMemoryIdsOp, getId, getImagesOp, getLogger, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesByEntityNamesOp, getMemoriesNeedingTopicExtractionOp, getNotionAccessToken, getNotionMCPUrl, getNumberAttr, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getSavedToolByIdOp, getServerTools, getStringAttr, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserUploadedMediaOp, getValidNotionToken, getVaultCandidateKeysOp, getVaultEmbeddingsByIdsOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, getVideosOp, handleNotionCallback, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasICloudCredentials, hasKeyPair, hasNotionCredentials, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, insertAfterId, insertChild, isAnumaTag, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isHtmlTag, isNotionCallback, isOPFSSupported, isR2UrlExpired, isRerankerAvailable, isSupportedFile, isSupportedMediaType, linkMemoryEntitiesOp, localChatBackend, maskScopedEmbeddingCache, maxVaultAttachmentBytes, mediaToStored, memoryCipher, migrateChatsToRemote, migrateDisplayResult, migrateMemoriesToRemote, migrateMessageAttachments, migrateNotionClientRegistration, migrateNotionToken, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseJsx, parseMedia, preEmbedVaultMemories, preprocessFiles, previewToolSelection, primaryTopic, projectToStored, putAppFileOp, quantizeEmbedding, queueManager, rankProfileCandidates, readEncryptedFile, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionToken, relinkMemoryTopicsOp, relinkMisclassifiedVideosOp, removeById, renderAnumaJsx, renderAnumaTree, renderElementToCanvas, replaceById, replaceMemoryEntitiesGuardedOp, requestEncryptionKey, requestKeyPair, resolveFilePlaceholders, resolveThemeColor, restoreVaultMemoryOp, resumeStream, retain, revokeNotionAccess, savedToolToStored, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, seedEncryptionKeys, selectServerToolsForPrompt, serializeJsx, setLogger, setMemoryEntitiesOp, setMemoryVisibilityOp, settingsStorageSchema, shouldChunkMessage, shouldRecallMemory, shouldRefreshTools, stampTopicsExtractedAtOp, startNotionAuth, storeNotionPendingMessage, storeNotionReturnUrl, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateAttrs, updateConversationProjectOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageFeedbackOp, updateProjectNameOp, updateProjectOp, updateSavedToolOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, useAnumaTheme, useBackup, useBackupAuth, useChat, useChatStorage, useCredits, useDatabaseManager, useEncryption, useExportPdf, useFiles, useICloudAuth, useICloudBackup, useModels, useOCR, usePdf, usePhoneCalls, useProjects, useSettings, useSubscription, useTools, useUIInteraction, useVoice, useWalletBinding, userPreferencesStorageSchema, vaultAttachmentRefs, vaultChatBackend, verifyMemoriesForPublish, walk, webPlatformStorage, withActiveToolSetServerTools, withInternalFlowMarker, writeEncryptedFile };
|