@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.
@@ -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)
@@ -5021,7 +5022,7 @@ interface RecallOptions {
5021
5022
  }
5022
5023
  /** A fact source supplies bounded candidates; recall owns ranking and result handling. */
5023
5024
  interface RecallFactSource {
5024
- search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
5025
+ search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
5025
5026
  graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
5026
5027
  temporalRanking: (query: string, now?: number) => Promise<string[]>;
5027
5028
  }
@@ -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
@@ -13898,13 +13918,6 @@ type UseChatResult = BaseUseChatResult & {
13898
13918
  */
13899
13919
  declare function useChat(options?: UseChatOptions): UseChatResult;
13900
13920
 
13901
- /**
13902
- * Namespacing for a caller-shared embedding cache.
13903
- *
13904
- * Lives here, next to the `embeddingCache` send-arg it serves, rather than in either platform hook:
13905
- * react and expo both thread the option through their own send paths, and a copy per platform is how
13906
- * the two drift.
13907
- */
13908
13921
  declare function maskScopedEmbeddingCache(cache: Map<string, Float32Array>, masked: boolean): Map<string, Float32Array>;
13909
13922
 
13910
13923
  /**
@@ -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)
@@ -5021,7 +5022,7 @@ interface RecallOptions {
5021
5022
  }
5022
5023
  /** A fact source supplies bounded candidates; recall owns ranking and result handling. */
5023
5024
  interface RecallFactSource {
5024
- search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
5025
+ search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
5025
5026
  graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
5026
5027
  temporalRanking: (query: string, now?: number) => Promise<string[]>;
5027
5028
  }
@@ -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
@@ -13898,13 +13918,6 @@ type UseChatResult = BaseUseChatResult & {
13898
13918
  */
13899
13919
  declare function useChat(options?: UseChatOptions): UseChatResult;
13900
13920
 
13901
- /**
13902
- * Namespacing for a caller-shared embedding cache.
13903
- *
13904
- * Lives here, next to the `embeddingCache` send-arg it serves, rather than in either platform hook:
13905
- * react and expo both thread the option through their own send paths, and a copy per platform is how
13906
- * the two drift.
13907
- */
13908
13921
  declare function maskScopedEmbeddingCache(cache: Map<string, Float32Array>, masked: boolean): Map<string, Float32Array>;
13909
13922
 
13910
13923
  /**