@anuma/sdk 7.0.3 → 7.0.4-next.20261015012621

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.
@@ -3302,6 +3302,7 @@ interface EntityOperationsContext {
3302
3302
  * (server / SQLite, where the migration backfill is authoritative).
3303
3303
  */
3304
3304
  allowUnscopedRows?: boolean;
3305
+ canWrite?: () => Promise<boolean>;
3305
3306
  }
3306
3307
 
3307
3308
  /**
@@ -4508,7 +4509,7 @@ interface RecallOptions {
4508
4509
  }
4509
4510
  /** A fact source supplies bounded candidates; recall owns ranking and result handling. */
4510
4511
  interface RecallFactSource {
4511
- search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
4512
+ search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
4512
4513
  graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
4513
4514
  temporalRanking: (query: string, now?: number) => Promise<string[]>;
4514
4515
  }
@@ -5251,6 +5252,10 @@ type ExtractOutcome = "extracted" | "no-facts" | "empty-after-retry" | "dropped-
5251
5252
  */
5252
5253
  declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: RetainContext, options: {
5253
5254
  extract: ExtractFactsOptions;
5255
+ /** Route extracted facts through this store instead of the local vault. */
5256
+ memoryStore?: MemoryStore | null;
5257
+ /** Cancel remote writes for this extraction batch. */
5258
+ signal?: AbortSignal;
5254
5259
  minConfidence?: number;
5255
5260
  /** Override scope/folder for all retained facts. */
5256
5261
  scope?: string;
@@ -6540,7 +6545,12 @@ type MemoryRecallOptions = Omit<RecallOptions, "types" | "includeChunks" | "conv
6540
6545
  * and never receives these credentials, callbacks or redactor instances.
6541
6546
  * @public
6542
6547
  */
6543
- type MemoryRetainOptions = Omit<RetainOptions, "folderId">;
6548
+ type MemoryRetainOptions = Omit<RetainOptions, "folderId"> & {
6549
+ /** Reject writes when the originating extraction is no longer eligible. */
6550
+ canWrite?: () => Promise<boolean>;
6551
+ /** Abort pending remote requests when the originating extraction is cancelled. */
6552
+ signal?: AbortSignal;
6553
+ };
6544
6554
  /**
6545
6555
  * A topic and how many memories link to it.
6546
6556
  * @public
@@ -6669,7 +6679,11 @@ interface MemoryStore {
6669
6679
  /** Replace the memory's topics with a user-chosen set and stop auto-tagging it. */
6670
6680
  setTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredVaultMemory | null>;
6671
6681
  /** Add topics alongside the existing ones (auto-tagging stays on). */
6672
- addTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredEntity[]>;
6682
+ addTopics(memoryId: string, topics: readonly EntityInput[], options?: {
6683
+ unlessUserManaged?: boolean;
6684
+ canWrite?: () => Promise<boolean>;
6685
+ signal?: AbortSignal;
6686
+ }): Promise<StoredEntity[]>;
6673
6687
  setVisibility(id: string, visibility: VaultMemoryVisibility, options?: {
6674
6688
  twinOptIn?: boolean;
6675
6689
  }): Promise<StoredVaultMemory | null>;
@@ -7366,8 +7380,8 @@ interface BaseUseChatStorageOptions {
7366
7380
  hooks?: RunHooks | RunHooks[];
7367
7381
  /** WatermelonDB database instance for storing conversations and messages */
7368
7382
  database: Database;
7369
- /** 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. */
7370
- memoryStore?: MemoryStore;
7383
+ /** 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. */
7384
+ memoryStore?: MemoryStore | null;
7371
7385
  /** ID of an existing conversation to load and continue */
7372
7386
  conversationId?: string;
7373
7387
  /** Automatically create a new conversation if none is set (default: true) */
@@ -7990,13 +8004,6 @@ declare const chatStorageMigrations: Readonly<{
7990
8004
  sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
7991
8005
  }>;
7992
8006
 
7993
- /**
7994
- * Namespacing for a caller-shared embedding cache.
7995
- *
7996
- * Lives here, next to the `embeddingCache` send-arg it serves, rather than in either platform hook:
7997
- * react and expo both thread the option through their own send paths, and a copy per platform is how
7998
- * the two drift.
7999
- */
8000
8007
  declare function maskScopedEmbeddingCache(cache: Map<string, Float32Array>, masked: boolean): Map<string, Float32Array>;
8001
8008
 
8002
8009
  /**
@@ -8879,6 +8886,10 @@ interface SyncKeyValueStore {
8879
8886
  declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
8880
8887
  interface CreateAutoExtractorOptions {
8881
8888
  retainCtx: RetainContext;
8889
+ /** Route retained facts and topics through this store; null disables memory writes. */
8890
+ memoryStore?: MemoryStore | null;
8891
+ /** Cancel remote writes for an extraction batch. */
8892
+ signal?: AbortSignal;
8882
8893
  extract: ExtractFactsOptions;
8883
8894
  /** Confidence floor for retained facts. Default 0.7. */
8884
8895
  minConfidence?: number;
@@ -9486,6 +9497,8 @@ interface LocalMemoryStoreOptions {
9486
9497
  walletAddress?: string;
9487
9498
  signMessage?: SignMessageFn;
9488
9499
  embeddedWalletSigner?: EmbeddedWalletSignerFn;
9500
+ /** Rechecked inside each serialized memory write. */
9501
+ canWrite?: () => Promise<boolean>;
9489
9502
  /**
9490
9503
  * Scope every read/write to this user — for a shared, multi-tenant database
9491
9504
  * whose rows all carry their `user_id`. Rows with no `user_id` are invisible
@@ -3302,6 +3302,7 @@ interface EntityOperationsContext {
3302
3302
  * (server / SQLite, where the migration backfill is authoritative).
3303
3303
  */
3304
3304
  allowUnscopedRows?: boolean;
3305
+ canWrite?: () => Promise<boolean>;
3305
3306
  }
3306
3307
 
3307
3308
  /**
@@ -4508,7 +4509,7 @@ interface RecallOptions {
4508
4509
  }
4509
4510
  /** A fact source supplies bounded candidates; recall owns ranking and result handling. */
4510
4511
  interface RecallFactSource {
4511
- search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
4512
+ search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
4512
4513
  graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
4513
4514
  temporalRanking: (query: string, now?: number) => Promise<string[]>;
4514
4515
  }
@@ -5251,6 +5252,10 @@ type ExtractOutcome = "extracted" | "no-facts" | "empty-after-retry" | "dropped-
5251
5252
  */
5252
5253
  declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: RetainContext, options: {
5253
5254
  extract: ExtractFactsOptions;
5255
+ /** Route extracted facts through this store instead of the local vault. */
5256
+ memoryStore?: MemoryStore | null;
5257
+ /** Cancel remote writes for this extraction batch. */
5258
+ signal?: AbortSignal;
5254
5259
  minConfidence?: number;
5255
5260
  /** Override scope/folder for all retained facts. */
5256
5261
  scope?: string;
@@ -6540,7 +6545,12 @@ type MemoryRecallOptions = Omit<RecallOptions, "types" | "includeChunks" | "conv
6540
6545
  * and never receives these credentials, callbacks or redactor instances.
6541
6546
  * @public
6542
6547
  */
6543
- type MemoryRetainOptions = Omit<RetainOptions, "folderId">;
6548
+ type MemoryRetainOptions = Omit<RetainOptions, "folderId"> & {
6549
+ /** Reject writes when the originating extraction is no longer eligible. */
6550
+ canWrite?: () => Promise<boolean>;
6551
+ /** Abort pending remote requests when the originating extraction is cancelled. */
6552
+ signal?: AbortSignal;
6553
+ };
6544
6554
  /**
6545
6555
  * A topic and how many memories link to it.
6546
6556
  * @public
@@ -6669,7 +6679,11 @@ interface MemoryStore {
6669
6679
  /** Replace the memory's topics with a user-chosen set and stop auto-tagging it. */
6670
6680
  setTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredVaultMemory | null>;
6671
6681
  /** Add topics alongside the existing ones (auto-tagging stays on). */
6672
- addTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredEntity[]>;
6682
+ addTopics(memoryId: string, topics: readonly EntityInput[], options?: {
6683
+ unlessUserManaged?: boolean;
6684
+ canWrite?: () => Promise<boolean>;
6685
+ signal?: AbortSignal;
6686
+ }): Promise<StoredEntity[]>;
6673
6687
  setVisibility(id: string, visibility: VaultMemoryVisibility, options?: {
6674
6688
  twinOptIn?: boolean;
6675
6689
  }): Promise<StoredVaultMemory | null>;
@@ -7366,8 +7380,8 @@ interface BaseUseChatStorageOptions {
7366
7380
  hooks?: RunHooks | RunHooks[];
7367
7381
  /** WatermelonDB database instance for storing conversations and messages */
7368
7382
  database: Database;
7369
- /** 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. */
7370
- memoryStore?: MemoryStore;
7383
+ /** 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. */
7384
+ memoryStore?: MemoryStore | null;
7371
7385
  /** ID of an existing conversation to load and continue */
7372
7386
  conversationId?: string;
7373
7387
  /** Automatically create a new conversation if none is set (default: true) */
@@ -7990,13 +8004,6 @@ declare const chatStorageMigrations: Readonly<{
7990
8004
  sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
7991
8005
  }>;
7992
8006
 
7993
- /**
7994
- * Namespacing for a caller-shared embedding cache.
7995
- *
7996
- * Lives here, next to the `embeddingCache` send-arg it serves, rather than in either platform hook:
7997
- * react and expo both thread the option through their own send paths, and a copy per platform is how
7998
- * the two drift.
7999
- */
8000
8007
  declare function maskScopedEmbeddingCache(cache: Map<string, Float32Array>, masked: boolean): Map<string, Float32Array>;
8001
8008
 
8002
8009
  /**
@@ -8879,6 +8886,10 @@ interface SyncKeyValueStore {
8879
8886
  declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
8880
8887
  interface CreateAutoExtractorOptions {
8881
8888
  retainCtx: RetainContext;
8889
+ /** Route retained facts and topics through this store; null disables memory writes. */
8890
+ memoryStore?: MemoryStore | null;
8891
+ /** Cancel remote writes for an extraction batch. */
8892
+ signal?: AbortSignal;
8882
8893
  extract: ExtractFactsOptions;
8883
8894
  /** Confidence floor for retained facts. Default 0.7. */
8884
8895
  minConfidence?: number;
@@ -9486,6 +9497,8 @@ interface LocalMemoryStoreOptions {
9486
9497
  walletAddress?: string;
9487
9498
  signMessage?: SignMessageFn;
9488
9499
  embeddedWalletSigner?: EmbeddedWalletSignerFn;
9500
+ /** Rechecked inside each serialized memory write. */
9501
+ canWrite?: () => Promise<boolean>;
9489
9502
  /**
9490
9503
  * Scope every read/write to this user — for a shared, multi-tenant database
9491
9504
  * whose rows all carry their `user_id`. Rows with no `user_id` are invisible