@anuma/sdk 7.0.6 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3484,6 +3484,7 @@ interface EntityOperationsContext {
3484
3484
  * (server / SQLite, where the migration backfill is authoritative).
3485
3485
  */
3486
3486
  allowUnscopedRows?: boolean;
3487
+ canWrite?: () => Promise<boolean>;
3487
3488
  }
3488
3489
  /**
3489
3490
  * Link a memory to one or more entities. Accepts bare names (back-compat)
@@ -5764,6 +5765,10 @@ type ExtractOutcome = "extracted" | "no-facts" | "empty-after-retry" | "dropped-
5764
5765
  */
5765
5766
  declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: RetainContext, options: {
5766
5767
  extract: ExtractFactsOptions;
5768
+ /** Route extracted facts through this store instead of the local vault. */
5769
+ memoryStore?: MemoryStore | null;
5770
+ /** Cancel remote writes for this extraction batch. */
5771
+ signal?: AbortSignal;
5767
5772
  minConfidence?: number;
5768
5773
  /** Override scope/folder for all retained facts. */
5769
5774
  scope?: string;
@@ -7142,7 +7147,12 @@ type MemoryRecallOptions = Omit<RecallOptions, "types" | "includeChunks" | "conv
7142
7147
  * and never receives these credentials, callbacks or redactor instances.
7143
7148
  * @public
7144
7149
  */
7145
- type MemoryRetainOptions = Omit<RetainOptions, "folderId">;
7150
+ type MemoryRetainOptions = Omit<RetainOptions, "folderId"> & {
7151
+ /** Reject writes when the originating extraction is no longer eligible. */
7152
+ canWrite?: () => Promise<boolean>;
7153
+ /** Abort pending remote requests when the originating extraction is cancelled. */
7154
+ signal?: AbortSignal;
7155
+ };
7146
7156
  /**
7147
7157
  * A topic and how many memories link to it.
7148
7158
  * @public
@@ -7271,7 +7281,11 @@ interface MemoryStore {
7271
7281
  /** Replace the memory's topics with a user-chosen set and stop auto-tagging it. */
7272
7282
  setTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredVaultMemory | null>;
7273
7283
  /** Add topics alongside the existing ones (auto-tagging stays on). */
7274
- addTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredEntity[]>;
7284
+ addTopics(memoryId: string, topics: readonly EntityInput[], options?: {
7285
+ unlessUserManaged?: boolean;
7286
+ canWrite?: () => Promise<boolean>;
7287
+ signal?: AbortSignal;
7288
+ }): Promise<StoredEntity[]>;
7275
7289
  setVisibility(id: string, visibility: VaultMemoryVisibility, options?: {
7276
7290
  twinOptIn?: boolean;
7277
7291
  }): Promise<StoredVaultMemory | null>;
@@ -8386,8 +8400,8 @@ interface BaseUseChatStorageOptions {
8386
8400
  hooks?: RunHooks | RunHooks[];
8387
8401
  /** WatermelonDB database instance for storing conversations and messages */
8388
8402
  database: Database;
8389
- /** Route memory reads, writes, recall and the memory tools through this store instead of the database's vault; folders are unsupported. With `piiRedaction` on, build the store with `embeddingOptions.maskInput` (e.g. `(text) => redactor.maskText(text)` with any `PiiRedactor`) or its memory calls throw. */
8390
- memoryStore?: MemoryStore;
8403
+ /** Route memory operations through this store; `null` disables memory access while `undefined` uses the local vault. Folders are unsupported. With `piiRedaction` on, build the store with `embeddingOptions.maskInput` or its memory calls throw. */
8404
+ memoryStore?: MemoryStore | null;
8391
8405
  /** ID of an existing conversation to load and continue */
8392
8406
  conversationId?: string;
8393
8407
  /** Automatically create a new conversation if none is set (default: true) */
@@ -10602,6 +10616,10 @@ interface SyncKeyValueStore {
10602
10616
  declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
10603
10617
  interface CreateAutoExtractorOptions {
10604
10618
  retainCtx: RetainContext;
10619
+ /** Route retained facts and topics through this store; null disables memory writes. */
10620
+ memoryStore?: MemoryStore | null;
10621
+ /** Cancel remote writes for an extraction batch. */
10622
+ signal?: AbortSignal;
10605
10623
  extract: ExtractFactsOptions;
10606
10624
  /** Confidence floor for retained facts. Default 0.7. */
10607
10625
  minConfidence?: number;
@@ -11209,6 +11227,8 @@ interface LocalMemoryStoreOptions {
11209
11227
  walletAddress?: string;
11210
11228
  signMessage?: SignMessageFn;
11211
11229
  embeddedWalletSigner?: EmbeddedWalletSignerFn;
11230
+ /** Rechecked inside each serialized memory write. */
11231
+ canWrite?: () => Promise<boolean>;
11212
11232
  /**
11213
11233
  * Scope every read/write to this user — for a shared, multi-tenant database
11214
11234
  * whose rows all carry their `user_id`. Rows with no `user_id` are invisible
@@ -11458,6 +11478,8 @@ interface MemoryMigrationOptions extends Pick<RemoteMemoryPersistenceOptions, "b
11458
11478
  fallbacks?: readonly MemoryKeyRing[];
11459
11479
  /** Activate even when some rows could not be migrated. Default false. */
11460
11480
  allowSkipped?: boolean;
11481
+ /** Re-embeds rows whose local vector nearby could not rank; without it those rows upload unembedded. */
11482
+ embeddingOptions?: EmbeddingOptions;
11461
11483
  signal?: AbortSignal;
11462
11484
  onProgress?: (progress: MemoryMigrationProgress) => void;
11463
11485
  }
@@ -11484,6 +11506,14 @@ interface MemoryMigrationResult {
11484
11506
  total: number;
11485
11507
  imported: number;
11486
11508
  skipped: MemoryMigrationSkip[];
11509
+ /** Rows uploaded with a vector embedded during migration. */
11510
+ reembedded: number;
11511
+ /** Rows uploaded without a vector nearby can rank. */
11512
+ unembedded: number;
11513
+ /** Deleted rows no supplied key decrypts, uploaded with placeholder content. */
11514
+ placeholderTombstones: number;
11515
+ /** Rows whose oldest source ids were dropped to fit nearby's limit. */
11516
+ truncatedSourceChunkIds: number;
11487
11517
  }
11488
11518
  /**
11489
11519
  * Upload this device's local memories to nearby and, once nearby holds every one, make it authoritative.
@@ -3484,6 +3484,7 @@ interface EntityOperationsContext {
3484
3484
  * (server / SQLite, where the migration backfill is authoritative).
3485
3485
  */
3486
3486
  allowUnscopedRows?: boolean;
3487
+ canWrite?: () => Promise<boolean>;
3487
3488
  }
3488
3489
  /**
3489
3490
  * Link a memory to one or more entities. Accepts bare names (back-compat)
@@ -5764,6 +5765,10 @@ type ExtractOutcome = "extracted" | "no-facts" | "empty-after-retry" | "dropped-
5764
5765
  */
5765
5766
  declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: RetainContext, options: {
5766
5767
  extract: ExtractFactsOptions;
5768
+ /** Route extracted facts through this store instead of the local vault. */
5769
+ memoryStore?: MemoryStore | null;
5770
+ /** Cancel remote writes for this extraction batch. */
5771
+ signal?: AbortSignal;
5767
5772
  minConfidence?: number;
5768
5773
  /** Override scope/folder for all retained facts. */
5769
5774
  scope?: string;
@@ -7142,7 +7147,12 @@ type MemoryRecallOptions = Omit<RecallOptions, "types" | "includeChunks" | "conv
7142
7147
  * and never receives these credentials, callbacks or redactor instances.
7143
7148
  * @public
7144
7149
  */
7145
- type MemoryRetainOptions = Omit<RetainOptions, "folderId">;
7150
+ type MemoryRetainOptions = Omit<RetainOptions, "folderId"> & {
7151
+ /** Reject writes when the originating extraction is no longer eligible. */
7152
+ canWrite?: () => Promise<boolean>;
7153
+ /** Abort pending remote requests when the originating extraction is cancelled. */
7154
+ signal?: AbortSignal;
7155
+ };
7146
7156
  /**
7147
7157
  * A topic and how many memories link to it.
7148
7158
  * @public
@@ -7271,7 +7281,11 @@ interface MemoryStore {
7271
7281
  /** Replace the memory's topics with a user-chosen set and stop auto-tagging it. */
7272
7282
  setTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredVaultMemory | null>;
7273
7283
  /** Add topics alongside the existing ones (auto-tagging stays on). */
7274
- addTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredEntity[]>;
7284
+ addTopics(memoryId: string, topics: readonly EntityInput[], options?: {
7285
+ unlessUserManaged?: boolean;
7286
+ canWrite?: () => Promise<boolean>;
7287
+ signal?: AbortSignal;
7288
+ }): Promise<StoredEntity[]>;
7275
7289
  setVisibility(id: string, visibility: VaultMemoryVisibility, options?: {
7276
7290
  twinOptIn?: boolean;
7277
7291
  }): Promise<StoredVaultMemory | null>;
@@ -8386,8 +8400,8 @@ interface BaseUseChatStorageOptions {
8386
8400
  hooks?: RunHooks | RunHooks[];
8387
8401
  /** WatermelonDB database instance for storing conversations and messages */
8388
8402
  database: Database;
8389
- /** Route memory reads, writes, recall and the memory tools through this store instead of the database's vault; folders are unsupported. With `piiRedaction` on, build the store with `embeddingOptions.maskInput` (e.g. `(text) => redactor.maskText(text)` with any `PiiRedactor`) or its memory calls throw. */
8390
- memoryStore?: MemoryStore;
8403
+ /** Route memory operations through this store; `null` disables memory access while `undefined` uses the local vault. Folders are unsupported. With `piiRedaction` on, build the store with `embeddingOptions.maskInput` or its memory calls throw. */
8404
+ memoryStore?: MemoryStore | null;
8391
8405
  /** ID of an existing conversation to load and continue */
8392
8406
  conversationId?: string;
8393
8407
  /** Automatically create a new conversation if none is set (default: true) */
@@ -10602,6 +10616,10 @@ interface SyncKeyValueStore {
10602
10616
  declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
10603
10617
  interface CreateAutoExtractorOptions {
10604
10618
  retainCtx: RetainContext;
10619
+ /** Route retained facts and topics through this store; null disables memory writes. */
10620
+ memoryStore?: MemoryStore | null;
10621
+ /** Cancel remote writes for an extraction batch. */
10622
+ signal?: AbortSignal;
10605
10623
  extract: ExtractFactsOptions;
10606
10624
  /** Confidence floor for retained facts. Default 0.7. */
10607
10625
  minConfidence?: number;
@@ -11209,6 +11227,8 @@ interface LocalMemoryStoreOptions {
11209
11227
  walletAddress?: string;
11210
11228
  signMessage?: SignMessageFn;
11211
11229
  embeddedWalletSigner?: EmbeddedWalletSignerFn;
11230
+ /** Rechecked inside each serialized memory write. */
11231
+ canWrite?: () => Promise<boolean>;
11212
11232
  /**
11213
11233
  * Scope every read/write to this user — for a shared, multi-tenant database
11214
11234
  * whose rows all carry their `user_id`. Rows with no `user_id` are invisible
@@ -11458,6 +11478,8 @@ interface MemoryMigrationOptions extends Pick<RemoteMemoryPersistenceOptions, "b
11458
11478
  fallbacks?: readonly MemoryKeyRing[];
11459
11479
  /** Activate even when some rows could not be migrated. Default false. */
11460
11480
  allowSkipped?: boolean;
11481
+ /** Re-embeds rows whose local vector nearby could not rank; without it those rows upload unembedded. */
11482
+ embeddingOptions?: EmbeddingOptions;
11461
11483
  signal?: AbortSignal;
11462
11484
  onProgress?: (progress: MemoryMigrationProgress) => void;
11463
11485
  }
@@ -11484,6 +11506,14 @@ interface MemoryMigrationResult {
11484
11506
  total: number;
11485
11507
  imported: number;
11486
11508
  skipped: MemoryMigrationSkip[];
11509
+ /** Rows uploaded with a vector embedded during migration. */
11510
+ reembedded: number;
11511
+ /** Rows uploaded without a vector nearby can rank. */
11512
+ unembedded: number;
11513
+ /** Deleted rows no supplied key decrypts, uploaded with placeholder content. */
11514
+ placeholderTombstones: number;
11515
+ /** Rows whose oldest source ids were dropped to fit nearby's limit. */
11516
+ truncatedSourceChunkIds: number;
11487
11517
  }
11488
11518
  /**
11489
11519
  * Upload this device's local memories to nearby and, once nearby holds every one, make it authoritative.