@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.
@@ -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
  /**
@@ -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) */
@@ -8872,6 +8886,10 @@ interface SyncKeyValueStore {
8872
8886
  declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
8873
8887
  interface CreateAutoExtractorOptions {
8874
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;
8875
8893
  extract: ExtractFactsOptions;
8876
8894
  /** Confidence floor for retained facts. Default 0.7. */
8877
8895
  minConfidence?: number;
@@ -9479,6 +9497,8 @@ interface LocalMemoryStoreOptions {
9479
9497
  walletAddress?: string;
9480
9498
  signMessage?: SignMessageFn;
9481
9499
  embeddedWalletSigner?: EmbeddedWalletSignerFn;
9500
+ /** Rechecked inside each serialized memory write. */
9501
+ canWrite?: () => Promise<boolean>;
9482
9502
  /**
9483
9503
  * Scope every read/write to this user — for a shared, multi-tenant database
9484
9504
  * whose rows all carry their `user_id`. Rows with no `user_id` are invisible
@@ -9728,6 +9748,8 @@ interface MemoryMigrationOptions extends Pick<RemoteMemoryPersistenceOptions, "b
9728
9748
  fallbacks?: readonly MemoryKeyRing[];
9729
9749
  /** Activate even when some rows could not be migrated. Default false. */
9730
9750
  allowSkipped?: boolean;
9751
+ /** Re-embeds rows whose local vector nearby could not rank; without it those rows upload unembedded. */
9752
+ embeddingOptions?: EmbeddingOptions;
9731
9753
  signal?: AbortSignal;
9732
9754
  onProgress?: (progress: MemoryMigrationProgress) => void;
9733
9755
  }
@@ -9754,6 +9776,14 @@ interface MemoryMigrationResult {
9754
9776
  total: number;
9755
9777
  imported: number;
9756
9778
  skipped: MemoryMigrationSkip[];
9779
+ /** Rows uploaded with a vector embedded during migration. */
9780
+ reembedded: number;
9781
+ /** Rows uploaded without a vector nearby can rank. */
9782
+ unembedded: number;
9783
+ /** Deleted rows no supplied key decrypts, uploaded with placeholder content. */
9784
+ placeholderTombstones: number;
9785
+ /** Rows whose oldest source ids were dropped to fit nearby's limit. */
9786
+ truncatedSourceChunkIds: number;
9757
9787
  }
9758
9788
  /**
9759
9789
  * Upload this device's local memories to nearby and, once nearby holds every one, make it authoritative.
@@ -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
  /**
@@ -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) */
@@ -8872,6 +8886,10 @@ interface SyncKeyValueStore {
8872
8886
  declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
8873
8887
  interface CreateAutoExtractorOptions {
8874
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;
8875
8893
  extract: ExtractFactsOptions;
8876
8894
  /** Confidence floor for retained facts. Default 0.7. */
8877
8895
  minConfidence?: number;
@@ -9479,6 +9497,8 @@ interface LocalMemoryStoreOptions {
9479
9497
  walletAddress?: string;
9480
9498
  signMessage?: SignMessageFn;
9481
9499
  embeddedWalletSigner?: EmbeddedWalletSignerFn;
9500
+ /** Rechecked inside each serialized memory write. */
9501
+ canWrite?: () => Promise<boolean>;
9482
9502
  /**
9483
9503
  * Scope every read/write to this user — for a shared, multi-tenant database
9484
9504
  * whose rows all carry their `user_id`. Rows with no `user_id` are invisible
@@ -9728,6 +9748,8 @@ interface MemoryMigrationOptions extends Pick<RemoteMemoryPersistenceOptions, "b
9728
9748
  fallbacks?: readonly MemoryKeyRing[];
9729
9749
  /** Activate even when some rows could not be migrated. Default false. */
9730
9750
  allowSkipped?: boolean;
9751
+ /** Re-embeds rows whose local vector nearby could not rank; without it those rows upload unembedded. */
9752
+ embeddingOptions?: EmbeddingOptions;
9731
9753
  signal?: AbortSignal;
9732
9754
  onProgress?: (progress: MemoryMigrationProgress) => void;
9733
9755
  }
@@ -9754,6 +9776,14 @@ interface MemoryMigrationResult {
9754
9776
  total: number;
9755
9777
  imported: number;
9756
9778
  skipped: MemoryMigrationSkip[];
9779
+ /** Rows uploaded with a vector embedded during migration. */
9780
+ reembedded: number;
9781
+ /** Rows uploaded without a vector nearby can rank. */
9782
+ unembedded: number;
9783
+ /** Deleted rows no supplied key decrypts, uploaded with placeholder content. */
9784
+ placeholderTombstones: number;
9785
+ /** Rows whose oldest source ids were dropped to fit nearby's limit. */
9786
+ truncatedSourceChunkIds: number;
9757
9787
  }
9758
9788
  /**
9759
9789
  * Upload this device's local memories to nearby and, once nearby holds every one, make it authoritative.