@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.
@@ -2779,6 +2779,7 @@ interface EntityOperationsContext {
2779
2779
  * (server / SQLite, where the migration backfill is authoritative).
2780
2780
  */
2781
2781
  allowUnscopedRows?: boolean;
2782
+ canWrite?: () => Promise<boolean>;
2782
2783
  }
2783
2784
 
2784
2785
  /**
@@ -3756,7 +3757,10 @@ declare function updateConversationProjectOp(ctx: StorageOperationsContext, id:
3756
3757
  * Pass null to get conversations that don't belong to any project.
3757
3758
  */
3758
3759
  declare function getConversationsByProjectOp(ctx: StorageOperationsContext, projectId: string | null): Promise<StoredConversation[]>;
3759
- declare function getMessagesOp(ctx: StorageOperationsContext, convId: string): Promise<StoredMessage[]>;
3760
+ declare function getMessagesOp(ctx: StorageOperationsContext, convId: string, opts?: {
3761
+ /** Keeps only rows whose raw, still-encrypted columns pass; runs before decryption. */
3762
+ rawFilter?: (raw: Record<string, unknown>) => boolean;
3763
+ }): Promise<StoredMessage[]>;
3760
3764
  /**
3761
3765
  * Clear all messages in a conversation.
3762
3766
  * Clears file_ids before deletion.
@@ -4187,7 +4191,7 @@ interface RecallOptions {
4187
4191
  }
4188
4192
  /** A fact source supplies bounded candidates; recall owns ranking and result handling. */
4189
4193
  interface RecallFactSource {
4190
- search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
4194
+ search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
4191
4195
  graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
4192
4196
  temporalRanking: (query: string, now?: number) => Promise<string[]>;
4193
4197
  }
@@ -4930,6 +4934,10 @@ type ExtractOutcome = "extracted" | "no-facts" | "empty-after-retry" | "dropped-
4930
4934
  */
4931
4935
  declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: RetainContext, options: {
4932
4936
  extract: ExtractFactsOptions;
4937
+ /** Route extracted facts through this store instead of the local vault. */
4938
+ memoryStore?: MemoryStore | null;
4939
+ /** Cancel remote writes for this extraction batch. */
4940
+ signal?: AbortSignal;
4933
4941
  minConfidence?: number;
4934
4942
  /** Override scope/folder for all retained facts. */
4935
4943
  scope?: string;
@@ -6177,7 +6185,12 @@ type MemoryRecallOptions = Omit<RecallOptions, "types" | "includeChunks" | "conv
6177
6185
  * and never receives these credentials, callbacks or redactor instances.
6178
6186
  * @public
6179
6187
  */
6180
- type MemoryRetainOptions = Omit<RetainOptions, "folderId">;
6188
+ type MemoryRetainOptions = Omit<RetainOptions, "folderId"> & {
6189
+ /** Reject writes when the originating extraction is no longer eligible. */
6190
+ canWrite?: () => Promise<boolean>;
6191
+ /** Abort pending remote requests when the originating extraction is cancelled. */
6192
+ signal?: AbortSignal;
6193
+ };
6181
6194
  /**
6182
6195
  * A topic and how many memories link to it.
6183
6196
  * @public
@@ -6306,7 +6319,11 @@ interface MemoryStore {
6306
6319
  /** Replace the memory's topics with a user-chosen set and stop auto-tagging it. */
6307
6320
  setTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredVaultMemory | null>;
6308
6321
  /** Add topics alongside the existing ones (auto-tagging stays on). */
6309
- addTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredEntity[]>;
6322
+ addTopics(memoryId: string, topics: readonly EntityInput[], options?: {
6323
+ unlessUserManaged?: boolean;
6324
+ canWrite?: () => Promise<boolean>;
6325
+ signal?: AbortSignal;
6326
+ }): Promise<StoredEntity[]>;
6310
6327
  setVisibility(id: string, visibility: VaultMemoryVisibility, options?: {
6311
6328
  twinOptIn?: boolean;
6312
6329
  }): Promise<StoredVaultMemory | null>;
@@ -9076,6 +9093,10 @@ interface SyncKeyValueStore {
9076
9093
  declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
9077
9094
  interface CreateAutoExtractorOptions {
9078
9095
  retainCtx: RetainContext;
9096
+ /** Route retained facts and topics through this store; null disables memory writes. */
9097
+ memoryStore?: MemoryStore | null;
9098
+ /** Cancel remote writes for an extraction batch. */
9099
+ signal?: AbortSignal;
9079
9100
  extract: ExtractFactsOptions;
9080
9101
  /** Confidence floor for retained facts. Default 0.7. */
9081
9102
  minConfidence?: number;
@@ -9683,6 +9704,8 @@ interface LocalMemoryStoreOptions {
9683
9704
  walletAddress?: string;
9684
9705
  signMessage?: SignMessageFn;
9685
9706
  embeddedWalletSigner?: EmbeddedWalletSignerFn;
9707
+ /** Rechecked inside each serialized memory write. */
9708
+ canWrite?: () => Promise<boolean>;
9686
9709
  /**
9687
9710
  * Scope every read/write to this user — for a shared, multi-tenant database
9688
9711
  * whose rows all carry their `user_id`. Rows with no `user_id` are invisible
@@ -2779,6 +2779,7 @@ interface EntityOperationsContext {
2779
2779
  * (server / SQLite, where the migration backfill is authoritative).
2780
2780
  */
2781
2781
  allowUnscopedRows?: boolean;
2782
+ canWrite?: () => Promise<boolean>;
2782
2783
  }
2783
2784
 
2784
2785
  /**
@@ -3756,7 +3757,10 @@ declare function updateConversationProjectOp(ctx: StorageOperationsContext, id:
3756
3757
  * Pass null to get conversations that don't belong to any project.
3757
3758
  */
3758
3759
  declare function getConversationsByProjectOp(ctx: StorageOperationsContext, projectId: string | null): Promise<StoredConversation[]>;
3759
- declare function getMessagesOp(ctx: StorageOperationsContext, convId: string): Promise<StoredMessage[]>;
3760
+ declare function getMessagesOp(ctx: StorageOperationsContext, convId: string, opts?: {
3761
+ /** Keeps only rows whose raw, still-encrypted columns pass; runs before decryption. */
3762
+ rawFilter?: (raw: Record<string, unknown>) => boolean;
3763
+ }): Promise<StoredMessage[]>;
3760
3764
  /**
3761
3765
  * Clear all messages in a conversation.
3762
3766
  * Clears file_ids before deletion.
@@ -4187,7 +4191,7 @@ interface RecallOptions {
4187
4191
  }
4188
4192
  /** A fact source supplies bounded candidates; recall owns ranking and result handling. */
4189
4193
  interface RecallFactSource {
4190
- search: (query: string, options?: MemoryVaultSearchOptions) => ReturnType<typeof searchVaultMemoriesWithSize>;
4194
+ search: (query: string, options?: MemoryVaultSearchOptions, embeddingCache?: Map<string, Float32Array>) => ReturnType<typeof searchVaultMemoriesWithSize>;
4191
4195
  graphRanking: (query: string, traverse: boolean, options: RecallOptions) => Promise<string[]>;
4192
4196
  temporalRanking: (query: string, now?: number) => Promise<string[]>;
4193
4197
  }
@@ -4930,6 +4934,10 @@ type ExtractOutcome = "extracted" | "no-facts" | "empty-after-retry" | "dropped-
4930
4934
  */
4931
4935
  declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: RetainContext, options: {
4932
4936
  extract: ExtractFactsOptions;
4937
+ /** Route extracted facts through this store instead of the local vault. */
4938
+ memoryStore?: MemoryStore | null;
4939
+ /** Cancel remote writes for this extraction batch. */
4940
+ signal?: AbortSignal;
4933
4941
  minConfidence?: number;
4934
4942
  /** Override scope/folder for all retained facts. */
4935
4943
  scope?: string;
@@ -6177,7 +6185,12 @@ type MemoryRecallOptions = Omit<RecallOptions, "types" | "includeChunks" | "conv
6177
6185
  * and never receives these credentials, callbacks or redactor instances.
6178
6186
  * @public
6179
6187
  */
6180
- type MemoryRetainOptions = Omit<RetainOptions, "folderId">;
6188
+ type MemoryRetainOptions = Omit<RetainOptions, "folderId"> & {
6189
+ /** Reject writes when the originating extraction is no longer eligible. */
6190
+ canWrite?: () => Promise<boolean>;
6191
+ /** Abort pending remote requests when the originating extraction is cancelled. */
6192
+ signal?: AbortSignal;
6193
+ };
6181
6194
  /**
6182
6195
  * A topic and how many memories link to it.
6183
6196
  * @public
@@ -6306,7 +6319,11 @@ interface MemoryStore {
6306
6319
  /** Replace the memory's topics with a user-chosen set and stop auto-tagging it. */
6307
6320
  setTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredVaultMemory | null>;
6308
6321
  /** Add topics alongside the existing ones (auto-tagging stays on). */
6309
- addTopics(memoryId: string, topics: readonly EntityInput[]): Promise<StoredEntity[]>;
6322
+ addTopics(memoryId: string, topics: readonly EntityInput[], options?: {
6323
+ unlessUserManaged?: boolean;
6324
+ canWrite?: () => Promise<boolean>;
6325
+ signal?: AbortSignal;
6326
+ }): Promise<StoredEntity[]>;
6310
6327
  setVisibility(id: string, visibility: VaultMemoryVisibility, options?: {
6311
6328
  twinOptIn?: boolean;
6312
6329
  }): Promise<StoredVaultMemory | null>;
@@ -9076,6 +9093,10 @@ interface SyncKeyValueStore {
9076
9093
  declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
9077
9094
  interface CreateAutoExtractorOptions {
9078
9095
  retainCtx: RetainContext;
9096
+ /** Route retained facts and topics through this store; null disables memory writes. */
9097
+ memoryStore?: MemoryStore | null;
9098
+ /** Cancel remote writes for an extraction batch. */
9099
+ signal?: AbortSignal;
9079
9100
  extract: ExtractFactsOptions;
9080
9101
  /** Confidence floor for retained facts. Default 0.7. */
9081
9102
  minConfidence?: number;
@@ -9683,6 +9704,8 @@ interface LocalMemoryStoreOptions {
9683
9704
  walletAddress?: string;
9684
9705
  signMessage?: SignMessageFn;
9685
9706
  embeddedWalletSigner?: EmbeddedWalletSignerFn;
9707
+ /** Rechecked inside each serialized memory write. */
9708
+ canWrite?: () => Promise<boolean>;
9686
9709
  /**
9687
9710
  * Scope every read/write to this user — for a shared, multi-tenant database
9688
9711
  * whose rows all carry their `user_id`. Rows with no `user_id` are invisible