@anuma/sdk 2.4.0 → 2.4.2

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.
@@ -3873,6 +3873,37 @@ declare function searchMessagesOp(ctx: StorageOperationsContext, queryVector: nu
3873
3873
  minSimilarity?: number;
3874
3874
  conversationId?: string;
3875
3875
  }): Promise<StoredMessageWithSimilarity[]>;
3876
+ /**
3877
+ * Decrypted, model-native chunk vectors for one message, cached across recall
3878
+ * calls so the chunk lane doesn't re-decrypt + re-JSON.parse every message's
3879
+ * embeddings on every query. Keyed by message id; `version` is the message's
3880
+ * `updated_at` at cache time, so a re-embed (which bumps `updated_at`) misses
3881
+ * and repopulates. Vectors are stored Float32 — model-native precision, half
3882
+ * the RAM of float64 `number[]` — mirroring the vault embedding cache (#705).
3883
+ * Content text is deliberately NOT cached (see searchChunksOp): it isn't
3884
+ * needed for scoring, and keeping decrypted content out of the cache preserves
3885
+ * the SDK's data-at-rest posture.
3886
+ */
3887
+ interface CachedChunkVectors {
3888
+ /** Message `updated_at` (ms) at cache time — the invalidation token. */
3889
+ version: number;
3890
+ /**
3891
+ * Per-chunk embedding vectors, index-aligned with the message's decrypted
3892
+ * `chunks` array (empty-vector chunks kept as zero-length placeholders so
3893
+ * indices stay aligned). Empty when the message has only a whole-message
3894
+ * `fallback` vector.
3895
+ */
3896
+ chunks: Float32Array[];
3897
+ /** Whole-message vector when the message was embedded without chunking. */
3898
+ fallback?: Float32Array;
3899
+ }
3900
+ /**
3901
+ * Cache consumed by {@link searchChunksOp}, keyed by message id. A plain `Map`
3902
+ * (satisfied by the LRU from `createChunkVectorCache`) — mirrors
3903
+ * `VaultEmbeddingCache` so consumers get the same `clear()`/`delete()`
3904
+ * ergonomics on an encryption-key reset.
3905
+ */
3906
+ type ChunkVectorCache = Map<string, CachedChunkVectors>;
3876
3907
  /**
3877
3908
  * Search through message chunks for fine-grained semantic search.
3878
3909
  * Returns the matching chunk text along with the parent message.
@@ -3890,6 +3921,13 @@ declare function searchChunksOp(ctx: StorageOperationsContext, queryVector: numb
3890
3921
  * messages are re-embedded out-of-band by `chunkAndEmbedAllMessages`.
3891
3922
  */
3892
3923
  embeddingModel?: string;
3924
+ /**
3925
+ * Optional decrypted-vector cache. When provided, the per-query decrypt +
3926
+ * JSON.parse of every message's chunk vectors is skipped on warm entries
3927
+ * (validated by `updated_at`), which is the dominant cost of the chunk
3928
+ * lane. Omit for the legacy always-decrypt behavior.
3929
+ */
3930
+ chunkCache?: ChunkVectorCache;
3893
3931
  }): Promise<ChunkSearchResult[]>;
3894
3932
  /**
3895
3933
  * Get all files from all conversations, sorted by creation date (newest first).
@@ -5710,6 +5748,14 @@ interface RecallOptions {
5710
5748
  * resolves windows in 2026 and never overlaps stored event_time.
5711
5749
  */
5712
5750
  now?: number;
5751
+ /**
5752
+ * Best-effort observability hook. Called once per `recall()` with per-lane
5753
+ * timings, lane counts, and soft-degradation signals — the raw material for
5754
+ * tuning latency/quality and for wiring recall telemetry to PostHog. Invoked
5755
+ * synchronously just before `recall()` returns; a throwing callback is
5756
+ * swallowed (diagnostics must never break retrieval). Off unless provided.
5757
+ */
5758
+ onDiagnostics?: (diagnostics: RecallDiagnostics) => void;
5713
5759
  /** Number of candidates fed to the cross-encoder rerank stage. Default: 30. */
5714
5760
  rerankTopN?: number;
5715
5761
  /** Multiplicative cross-encoder blend weight. Default: 0.1. */
@@ -5740,6 +5786,12 @@ interface RecallContext {
5740
5786
  embeddingOptions: EmbeddingOptions;
5741
5787
  /** Vault embedding LRU cache. */
5742
5788
  vaultCache?: VaultEmbeddingCache;
5789
+ /**
5790
+ * Optional chunk-vector LRU cache. When provided, the chunk lane skips the
5791
+ * per-query decrypt + JSON.parse of every message's chunk vectors on warm
5792
+ * entries. Build via `createChunkVectorCache`. Omit for legacy behavior.
5793
+ */
5794
+ chunkCache?: ChunkVectorCache;
5743
5795
  /**
5744
5796
  * Optional — when provided, recall extracts entities from the query
5745
5797
  * and adds a graph lane to the RRF fusion (memories sharing entities
@@ -5759,6 +5811,48 @@ interface RecallResult {
5759
5811
  /** Diagnostic: total memories in the vault when fact lane was queried. */
5760
5812
  vaultSize?: number;
5761
5813
  }
5814
+ /** Soft-degradation signals surfaced via {@link RecallDiagnostics.degraded}. */
5815
+ type RecallDegradation =
5816
+ /** Rerank was requested (budget mid/high) but the cross-encoder didn't run
5817
+ * this call — unavailable (e.g. React Native) or a transient failure. */
5818
+ "rerank-unavailable"
5819
+ /** `budget: 'high'` requested but no `decomposeOptions`, so query
5820
+ * decomposition was skipped and the budget downgraded to mid. */
5821
+ | "decompose-unavailable";
5822
+ /**
5823
+ * Per-call recall observability payload (see {@link RecallOptions.onDiagnostics}).
5824
+ * All timings are wall-clock milliseconds. Lane counts are post-dedupe,
5825
+ * pre-fusion. Intended to be forwarded to a metrics sink (e.g. PostHog).
5826
+ */
5827
+ interface RecallDiagnostics {
5828
+ /** Budget actually executed (may have downgraded from the requested one). */
5829
+ usedBudget: Budget;
5830
+ /** Whether the cross-encoder actually reranked the fact lane this call. */
5831
+ reranked: boolean;
5832
+ /** Total candidates considered before truncation. */
5833
+ candidateCount: number;
5834
+ /** Total vault size when the fact lane ran (absent if it didn't). */
5835
+ vaultSize?: number;
5836
+ /** Facts the fact lane returned (post-dedupe, pre-fusion). */
5837
+ factCount: number;
5838
+ /** Chunks the chunk lane returned (post-dedupe, pre-fusion). */
5839
+ chunkCount: number;
5840
+ /** Wall-clock phase timings (ms). */
5841
+ timings: {
5842
+ /** Whole `recall()` call. */
5843
+ total: number;
5844
+ /** Parallel query-embed + graph/temporal side-lane build. */
5845
+ prep: number;
5846
+ /** Vault fact-lane search (`searchVaultMemoriesWithSize`). */
5847
+ factLane: number;
5848
+ /** Chunk-lane search (`searchChunksOp`). */
5849
+ chunkLane: number;
5850
+ /** Cross-lane RRF fusion + provenance dedup after both lanes. */
5851
+ fuse: number;
5852
+ };
5853
+ /** Soft-degradation signals that fired this call (empty when clean). */
5854
+ degraded: RecallDegradation[];
5855
+ }
5762
5856
  type RetainAction = "create" | "merge" | "update" | "skip" | "suppressed";
5763
5857
  type RetainSource = "manual" | "auto-extracted" | "capsule";
5764
5858
  /** Why the consolidator fell back to "create" instead of a real decision. */
@@ -6327,6 +6421,24 @@ interface AutoExtractor {
6327
6421
  */
6328
6422
  declare function createAutoExtractor(options: CreateAutoExtractorOptions): AutoExtractor;
6329
6423
 
6424
+ /**
6425
+ * Default entry cap for the chunk-vector cache. Entries are keyed by message
6426
+ * id, so this bounds how many messages' decrypted chunk vectors stay resident.
6427
+ * Matches the vault cache default (#705).
6428
+ */
6429
+ declare const DEFAULT_CHUNK_CACHE_SIZE = 5000;
6430
+ /**
6431
+ * Create a {@link ChunkVectorCache} backed by an LRU. Pass the returned cache
6432
+ * into `recall()` (via `RecallContext.chunkCache`) so the chunk lane skips the
6433
+ * per-query decrypt + JSON.parse of every message's chunk vectors on warm
6434
+ * entries. Stale entries self-invalidate on `updated_at` mismatch, so no
6435
+ * explicit invalidation is required beyond clearing it on an encryption-key
6436
+ * reset (wallet switch), mirroring the vault embedding cache.
6437
+ *
6438
+ * @public
6439
+ */
6440
+ declare function createChunkVectorCache(maxSize?: number): ChunkVectorCache;
6441
+
6330
6442
  /**
6331
6443
  * Unified Recall API — single retrieval surface above vault + engine.
6332
6444
  *
@@ -6479,6 +6591,46 @@ interface ReflectResult {
6479
6591
  */
6480
6592
  declare function reflect(query: string, ctx: RecallContext, options: ReflectOptions): Promise<ReflectResult>;
6481
6593
 
6594
+ /**
6595
+ * Cross-encoder reranker — local inference via @huggingface/transformers.
6596
+ *
6597
+ * Mirrors Hindsight's default reranker (`cross-encoder/ms-marco-MiniLM-L-6-v2`)
6598
+ * for parity with their reference pipeline. Runs fully on-device — no API
6599
+ * key, no network call, works offline. Model file ~25MB; lazy-loaded and
6600
+ * cached for the lifetime of the process.
6601
+ *
6602
+ * Implementation note: transformers.js v3 doesn't expose a "text-ranking"
6603
+ * pipeline, so we drive the cross-encoder directly via the tokenizer +
6604
+ * sequence-classification model. The model outputs a single relevance
6605
+ * logit per (query, doc) pair; we sigmoid it into [0, 1].
6606
+ */
6607
+ /**
6608
+ * Thrown when the cross-encoder cannot run because its optional peer
6609
+ * dependency (`@huggingface/transformers`) isn't installed — the expected
6610
+ * state on React Native, where the package isn't part of the bundle. Callers
6611
+ * treat this as "reranker unavailable, degrade to the fused ranking" rather
6612
+ * than a transient error worth warning about on every recall.
6613
+ *
6614
+ * @public
6615
+ */
6616
+ declare class RerankerUnavailableError extends Error {
6617
+ /** The underlying import failure, kept for debugging. */
6618
+ readonly reason: unknown;
6619
+ constructor(reason: unknown);
6620
+ }
6621
+ /**
6622
+ * Whether the cross-encoder reranker can run in this environment.
6623
+ *
6624
+ * - `true` — the model loaded successfully at least once.
6625
+ * - `false` — the optional `@huggingface/transformers` dependency is missing
6626
+ * (e.g. React Native); reranking is permanently degraded to the fused
6627
+ * ranking and no further load attempts are made.
6628
+ * - `undefined` — no rerank has been attempted yet, so availability is unknown.
6629
+ *
6630
+ * @public
6631
+ */
6632
+ declare function isRerankerAvailable(): boolean | undefined;
6633
+
6482
6634
  /**
6483
6635
  * Standalone topic (entity) extraction for EXISTING memories.
6484
6636
  *
@@ -7579,4 +7731,4 @@ declare function sanitizeQuotes(s: string): string;
7579
7731
  declare function renderTemplate(value: string | null | undefined, template: string): string | null;
7580
7732
  declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
7581
7733
 
7582
- export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, INFERENCE_ID_HEADER, type LazyStoredConversation, type LlmTokenUsage, MAX_MESSAGES_PER_SUMMARIZATION, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, type OperationExecutor, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, TOOL_CATALOG, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createConversationOp, createCryptoPricePreProcessor, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summaryToSystemMessage, toolSetSystemPrompts, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
7734
+ export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, INFERENCE_ID_HEADER, type LazyStoredConversation, type LlmTokenUsage, MAX_MESSAGES_PER_SUMMARIZATION, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, type OperationExecutor, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, TOOL_CATALOG, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summaryToSystemMessage, toolSetSystemPrompts, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
@@ -3873,6 +3873,37 @@ declare function searchMessagesOp(ctx: StorageOperationsContext, queryVector: nu
3873
3873
  minSimilarity?: number;
3874
3874
  conversationId?: string;
3875
3875
  }): Promise<StoredMessageWithSimilarity[]>;
3876
+ /**
3877
+ * Decrypted, model-native chunk vectors for one message, cached across recall
3878
+ * calls so the chunk lane doesn't re-decrypt + re-JSON.parse every message's
3879
+ * embeddings on every query. Keyed by message id; `version` is the message's
3880
+ * `updated_at` at cache time, so a re-embed (which bumps `updated_at`) misses
3881
+ * and repopulates. Vectors are stored Float32 — model-native precision, half
3882
+ * the RAM of float64 `number[]` — mirroring the vault embedding cache (#705).
3883
+ * Content text is deliberately NOT cached (see searchChunksOp): it isn't
3884
+ * needed for scoring, and keeping decrypted content out of the cache preserves
3885
+ * the SDK's data-at-rest posture.
3886
+ */
3887
+ interface CachedChunkVectors {
3888
+ /** Message `updated_at` (ms) at cache time — the invalidation token. */
3889
+ version: number;
3890
+ /**
3891
+ * Per-chunk embedding vectors, index-aligned with the message's decrypted
3892
+ * `chunks` array (empty-vector chunks kept as zero-length placeholders so
3893
+ * indices stay aligned). Empty when the message has only a whole-message
3894
+ * `fallback` vector.
3895
+ */
3896
+ chunks: Float32Array[];
3897
+ /** Whole-message vector when the message was embedded without chunking. */
3898
+ fallback?: Float32Array;
3899
+ }
3900
+ /**
3901
+ * Cache consumed by {@link searchChunksOp}, keyed by message id. A plain `Map`
3902
+ * (satisfied by the LRU from `createChunkVectorCache`) — mirrors
3903
+ * `VaultEmbeddingCache` so consumers get the same `clear()`/`delete()`
3904
+ * ergonomics on an encryption-key reset.
3905
+ */
3906
+ type ChunkVectorCache = Map<string, CachedChunkVectors>;
3876
3907
  /**
3877
3908
  * Search through message chunks for fine-grained semantic search.
3878
3909
  * Returns the matching chunk text along with the parent message.
@@ -3890,6 +3921,13 @@ declare function searchChunksOp(ctx: StorageOperationsContext, queryVector: numb
3890
3921
  * messages are re-embedded out-of-band by `chunkAndEmbedAllMessages`.
3891
3922
  */
3892
3923
  embeddingModel?: string;
3924
+ /**
3925
+ * Optional decrypted-vector cache. When provided, the per-query decrypt +
3926
+ * JSON.parse of every message's chunk vectors is skipped on warm entries
3927
+ * (validated by `updated_at`), which is the dominant cost of the chunk
3928
+ * lane. Omit for the legacy always-decrypt behavior.
3929
+ */
3930
+ chunkCache?: ChunkVectorCache;
3893
3931
  }): Promise<ChunkSearchResult[]>;
3894
3932
  /**
3895
3933
  * Get all files from all conversations, sorted by creation date (newest first).
@@ -5710,6 +5748,14 @@ interface RecallOptions {
5710
5748
  * resolves windows in 2026 and never overlaps stored event_time.
5711
5749
  */
5712
5750
  now?: number;
5751
+ /**
5752
+ * Best-effort observability hook. Called once per `recall()` with per-lane
5753
+ * timings, lane counts, and soft-degradation signals — the raw material for
5754
+ * tuning latency/quality and for wiring recall telemetry to PostHog. Invoked
5755
+ * synchronously just before `recall()` returns; a throwing callback is
5756
+ * swallowed (diagnostics must never break retrieval). Off unless provided.
5757
+ */
5758
+ onDiagnostics?: (diagnostics: RecallDiagnostics) => void;
5713
5759
  /** Number of candidates fed to the cross-encoder rerank stage. Default: 30. */
5714
5760
  rerankTopN?: number;
5715
5761
  /** Multiplicative cross-encoder blend weight. Default: 0.1. */
@@ -5740,6 +5786,12 @@ interface RecallContext {
5740
5786
  embeddingOptions: EmbeddingOptions;
5741
5787
  /** Vault embedding LRU cache. */
5742
5788
  vaultCache?: VaultEmbeddingCache;
5789
+ /**
5790
+ * Optional chunk-vector LRU cache. When provided, the chunk lane skips the
5791
+ * per-query decrypt + JSON.parse of every message's chunk vectors on warm
5792
+ * entries. Build via `createChunkVectorCache`. Omit for legacy behavior.
5793
+ */
5794
+ chunkCache?: ChunkVectorCache;
5743
5795
  /**
5744
5796
  * Optional — when provided, recall extracts entities from the query
5745
5797
  * and adds a graph lane to the RRF fusion (memories sharing entities
@@ -5759,6 +5811,48 @@ interface RecallResult {
5759
5811
  /** Diagnostic: total memories in the vault when fact lane was queried. */
5760
5812
  vaultSize?: number;
5761
5813
  }
5814
+ /** Soft-degradation signals surfaced via {@link RecallDiagnostics.degraded}. */
5815
+ type RecallDegradation =
5816
+ /** Rerank was requested (budget mid/high) but the cross-encoder didn't run
5817
+ * this call — unavailable (e.g. React Native) or a transient failure. */
5818
+ "rerank-unavailable"
5819
+ /** `budget: 'high'` requested but no `decomposeOptions`, so query
5820
+ * decomposition was skipped and the budget downgraded to mid. */
5821
+ | "decompose-unavailable";
5822
+ /**
5823
+ * Per-call recall observability payload (see {@link RecallOptions.onDiagnostics}).
5824
+ * All timings are wall-clock milliseconds. Lane counts are post-dedupe,
5825
+ * pre-fusion. Intended to be forwarded to a metrics sink (e.g. PostHog).
5826
+ */
5827
+ interface RecallDiagnostics {
5828
+ /** Budget actually executed (may have downgraded from the requested one). */
5829
+ usedBudget: Budget;
5830
+ /** Whether the cross-encoder actually reranked the fact lane this call. */
5831
+ reranked: boolean;
5832
+ /** Total candidates considered before truncation. */
5833
+ candidateCount: number;
5834
+ /** Total vault size when the fact lane ran (absent if it didn't). */
5835
+ vaultSize?: number;
5836
+ /** Facts the fact lane returned (post-dedupe, pre-fusion). */
5837
+ factCount: number;
5838
+ /** Chunks the chunk lane returned (post-dedupe, pre-fusion). */
5839
+ chunkCount: number;
5840
+ /** Wall-clock phase timings (ms). */
5841
+ timings: {
5842
+ /** Whole `recall()` call. */
5843
+ total: number;
5844
+ /** Parallel query-embed + graph/temporal side-lane build. */
5845
+ prep: number;
5846
+ /** Vault fact-lane search (`searchVaultMemoriesWithSize`). */
5847
+ factLane: number;
5848
+ /** Chunk-lane search (`searchChunksOp`). */
5849
+ chunkLane: number;
5850
+ /** Cross-lane RRF fusion + provenance dedup after both lanes. */
5851
+ fuse: number;
5852
+ };
5853
+ /** Soft-degradation signals that fired this call (empty when clean). */
5854
+ degraded: RecallDegradation[];
5855
+ }
5762
5856
  type RetainAction = "create" | "merge" | "update" | "skip" | "suppressed";
5763
5857
  type RetainSource = "manual" | "auto-extracted" | "capsule";
5764
5858
  /** Why the consolidator fell back to "create" instead of a real decision. */
@@ -6327,6 +6421,24 @@ interface AutoExtractor {
6327
6421
  */
6328
6422
  declare function createAutoExtractor(options: CreateAutoExtractorOptions): AutoExtractor;
6329
6423
 
6424
+ /**
6425
+ * Default entry cap for the chunk-vector cache. Entries are keyed by message
6426
+ * id, so this bounds how many messages' decrypted chunk vectors stay resident.
6427
+ * Matches the vault cache default (#705).
6428
+ */
6429
+ declare const DEFAULT_CHUNK_CACHE_SIZE = 5000;
6430
+ /**
6431
+ * Create a {@link ChunkVectorCache} backed by an LRU. Pass the returned cache
6432
+ * into `recall()` (via `RecallContext.chunkCache`) so the chunk lane skips the
6433
+ * per-query decrypt + JSON.parse of every message's chunk vectors on warm
6434
+ * entries. Stale entries self-invalidate on `updated_at` mismatch, so no
6435
+ * explicit invalidation is required beyond clearing it on an encryption-key
6436
+ * reset (wallet switch), mirroring the vault embedding cache.
6437
+ *
6438
+ * @public
6439
+ */
6440
+ declare function createChunkVectorCache(maxSize?: number): ChunkVectorCache;
6441
+
6330
6442
  /**
6331
6443
  * Unified Recall API — single retrieval surface above vault + engine.
6332
6444
  *
@@ -6479,6 +6591,46 @@ interface ReflectResult {
6479
6591
  */
6480
6592
  declare function reflect(query: string, ctx: RecallContext, options: ReflectOptions): Promise<ReflectResult>;
6481
6593
 
6594
+ /**
6595
+ * Cross-encoder reranker — local inference via @huggingface/transformers.
6596
+ *
6597
+ * Mirrors Hindsight's default reranker (`cross-encoder/ms-marco-MiniLM-L-6-v2`)
6598
+ * for parity with their reference pipeline. Runs fully on-device — no API
6599
+ * key, no network call, works offline. Model file ~25MB; lazy-loaded and
6600
+ * cached for the lifetime of the process.
6601
+ *
6602
+ * Implementation note: transformers.js v3 doesn't expose a "text-ranking"
6603
+ * pipeline, so we drive the cross-encoder directly via the tokenizer +
6604
+ * sequence-classification model. The model outputs a single relevance
6605
+ * logit per (query, doc) pair; we sigmoid it into [0, 1].
6606
+ */
6607
+ /**
6608
+ * Thrown when the cross-encoder cannot run because its optional peer
6609
+ * dependency (`@huggingface/transformers`) isn't installed — the expected
6610
+ * state on React Native, where the package isn't part of the bundle. Callers
6611
+ * treat this as "reranker unavailable, degrade to the fused ranking" rather
6612
+ * than a transient error worth warning about on every recall.
6613
+ *
6614
+ * @public
6615
+ */
6616
+ declare class RerankerUnavailableError extends Error {
6617
+ /** The underlying import failure, kept for debugging. */
6618
+ readonly reason: unknown;
6619
+ constructor(reason: unknown);
6620
+ }
6621
+ /**
6622
+ * Whether the cross-encoder reranker can run in this environment.
6623
+ *
6624
+ * - `true` — the model loaded successfully at least once.
6625
+ * - `false` — the optional `@huggingface/transformers` dependency is missing
6626
+ * (e.g. React Native); reranking is permanently degraded to the fused
6627
+ * ranking and no further load attempts are made.
6628
+ * - `undefined` — no rerank has been attempted yet, so availability is unknown.
6629
+ *
6630
+ * @public
6631
+ */
6632
+ declare function isRerankerAvailable(): boolean | undefined;
6633
+
6482
6634
  /**
6483
6635
  * Standalone topic (entity) extraction for EXISTING memories.
6484
6636
  *
@@ -7579,4 +7731,4 @@ declare function sanitizeQuotes(s: string): string;
7579
7731
  declare function renderTemplate(value: string | null | undefined, template: string): string | null;
7580
7732
  declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
7581
7733
 
7582
- export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, INFERENCE_ID_HEADER, type LazyStoredConversation, type LlmTokenUsage, MAX_MESSAGES_PER_SUMMARIZATION, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, type OperationExecutor, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, TOOL_CATALOG, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createConversationOp, createCryptoPricePreProcessor, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summaryToSystemMessage, toolSetSystemPrompts, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
7734
+ export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, INFERENCE_ID_HEADER, type LazyStoredConversation, type LlmTokenUsage, MAX_MESSAGES_PER_SUMMARIZATION, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, type OperationExecutor, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, TOOL_CATALOG, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summaryToSystemMessage, toolSetSystemPrompts, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
@@ -5,6 +5,8 @@ import {
5
5
  DEFAULT_MIN_CHUNK_SIZE,
6
6
  DEFAULT_VAULT_CACHE_SIZE,
7
7
  ENTITY_KINDS,
8
+ LRUCache,
9
+ RerankerUnavailableError,
8
10
  chunkAndEmbedAllMessages,
9
11
  chunkAndEmbedMessage,
10
12
  chunkText,
@@ -60,6 +62,7 @@ import {
60
62
  hasEncryptionKey,
61
63
  hasKeyPair,
62
64
  isEncrypted,
65
+ isRerankerAvailable,
63
66
  linkMemoryEntitiesOp,
64
67
  makeSyntheticStoredConversation,
65
68
  makeSyntheticStoredMessage,
@@ -99,7 +102,7 @@ import {
99
102
  updateVaultMemoryOp,
100
103
  upsertMessageOp,
101
104
  vaultMemoryToStored
102
- } from "./chunk-3AWYZRTS.mjs";
105
+ } from "./chunk-3MLG7SUH.mjs";
103
106
  import {
104
107
  createStreamingDeAnonymizer,
105
108
  resolvePiiRedactor
@@ -5401,6 +5404,12 @@ function createAutoExtractor(options) {
5401
5404
  };
5402
5405
  }
5403
5406
 
5407
+ // src/lib/memory/chunkVectorCache.ts
5408
+ var DEFAULT_CHUNK_CACHE_SIZE = 5e3;
5409
+ function createChunkVectorCache(maxSize = DEFAULT_CHUNK_CACHE_SIZE) {
5410
+ return new LRUCache(maxSize);
5411
+ }
5412
+
5404
5413
  // src/lib/memory/recallTool.ts
5405
5414
  var RECALL_TOOL_NAME = "recall_memory";
5406
5415
  var RECALL_MAX_LIMIT = 50;
@@ -11319,6 +11328,7 @@ export {
11319
11328
  DEFAULT_ANALYSIS_PROMPT,
11320
11329
  DEFAULT_ANALYZE_AFTER_MESSAGES,
11321
11330
  DEFAULT_CACHE_EXPIRATION_MS,
11331
+ DEFAULT_CHUNK_CACHE_SIZE,
11322
11332
  DEFAULT_CHUNK_OVERLAP,
11323
11333
  DEFAULT_CHUNK_SIZE,
11324
11334
  DEFAULT_DOCUMENT_PATTERN,
@@ -11349,6 +11359,7 @@ export {
11349
11359
  QueueManager,
11350
11360
  RECALL_MAX_LIMIT,
11351
11361
  RECALL_TOOL_NAME,
11362
+ RerankerUnavailableError,
11352
11363
  SDK_SCHEMA_VERSION,
11353
11364
  SERVER_TOOL_DEPENDENCY_SETS,
11354
11365
  SLIDER_CONFIG,
@@ -11390,6 +11401,7 @@ export {
11390
11401
  clearServerToolsCache,
11391
11402
  composeHooks,
11392
11403
  createAutoExtractor,
11404
+ createChunkVectorCache,
11393
11405
  createConversationOp,
11394
11406
  createCryptoPricePreProcessor,
11395
11407
  createMediaBatchOp,
@@ -11495,6 +11507,7 @@ export {
11495
11507
  hardDeleteMediaOp,
11496
11508
  hasEncryptionKey,
11497
11509
  hasKeyPair,
11510
+ isRerankerAvailable,
11498
11511
  isSupportedFile,
11499
11512
  isSupportedMediaType,
11500
11513
  makeSyntheticStoredConversation,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-3AWYZRTS.mjs";
3
+ } from "./chunk-3MLG7SUH.mjs";
4
4
  import "./chunk-AHJT66EO.mjs";
5
5
  import "./chunk-3RPGXXPZ.mjs";
6
6
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -145,7 +145,7 @@
145
145
  "homepage": "https://github.com/anuma-ai/sdk#readme",
146
146
  "packageManager": "pnpm@10.23.0",
147
147
  "dependencies": {
148
- "@anuma/portal": "1.0.0-next.20260717201251",
148
+ "@anuma/portal": "1.0.0-next.20260721055054",
149
149
  "@babel/parser": "^7.29.2",
150
150
  "@babel/types": "^7.29.0",
151
151
  "ai": "6.0.202",