@anuma/sdk 2.3.1 → 2.4.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.
- package/dist/expo/index.cjs +54 -6
- package/dist/expo/index.d.mts +67 -10
- package/dist/expo/index.d.ts +67 -10
- package/dist/expo/index.mjs +53 -6
- package/dist/react/index.cjs +54 -6
- package/dist/react/index.d.mts +67 -10
- package/dist/react/index.d.ts +67 -10
- package/dist/react/index.mjs +53 -6
- package/dist/server/index.cjs +54 -6
- package/dist/server/index.d.mts +67 -10
- package/dist/server/index.d.ts +67 -10
- package/dist/server/index.mjs +53 -6
- package/package.json +1 -1
package/dist/server/index.d.mts
CHANGED
|
@@ -6109,15 +6109,32 @@ declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: Ret
|
|
|
6109
6109
|
* newest (superset) message list re-covers any superseded turn. Turns for
|
|
6110
6110
|
* different conversations queue independently and never displace each other.
|
|
6111
6111
|
*
|
|
6112
|
-
* Watermark + window: the worker keeps
|
|
6113
|
-
*
|
|
6114
|
-
*
|
|
6115
|
-
*
|
|
6116
|
-
*
|
|
6117
|
-
*
|
|
6118
|
-
*
|
|
6119
|
-
*
|
|
6120
|
-
*
|
|
6112
|
+
* Watermark + window: the worker keeps a per-conversation watermark of the
|
|
6113
|
+
* last message it extracted through. Each run sends every message *after* that
|
|
6114
|
+
* watermark (plus a small overlap for coreference, capped at `maxWindowSize`)
|
|
6115
|
+
* rather than a fixed trailing slice — so facts stated in turns that arrived
|
|
6116
|
+
* during a busy window are still examined instead of scrolling out of a last-N
|
|
6117
|
+
* window.
|
|
6118
|
+
*
|
|
6119
|
+
* Durability: the in-memory watermark alone does NOT survive process death, so
|
|
6120
|
+
* a session killed after messages accumulate but before extraction would, on
|
|
6121
|
+
* the next launch, fall back to a trailing-window guess and could skip the
|
|
6122
|
+
* un-extracted tail. Pass a {@link ExtractionCursorStore} (`cursorStore`) to
|
|
6123
|
+
* persist the watermark per conversation — it is hydrated synchronously the
|
|
6124
|
+
* first time a conversation is touched, and written through on every *contiguous*
|
|
6125
|
+
* advance (never on a trailing-slice guess, which could jump the durable cursor
|
|
6126
|
+
* past an un-extracted gap), so a later session resumes exactly after the last
|
|
6127
|
+
* extracted message. The primary guarantee is single-session resume across
|
|
6128
|
+
* process death.
|
|
6129
|
+
*
|
|
6130
|
+
* Concurrent sessions sharing one store (web `localStorage`, mobile MMKV) are
|
|
6131
|
+
* best-effort, NOT exclusive: two sessions can each hydrate the same cursor
|
|
6132
|
+
* before either advances it and briefly re-extract the same turn (retain()'s
|
|
6133
|
+
* dedup/consolidation absorbs the duplicate — wasteful, not corrupting). The
|
|
6134
|
+
* durable write is last-writer-wins with a regression guard (it won't move the
|
|
6135
|
+
* cursor backwards when the currently-stored id is ahead within the same turn's
|
|
6136
|
+
* messages), but it does not serialize writers. Omit `cursorStore` for the
|
|
6137
|
+
* legacy in-memory-only behavior.
|
|
6121
6138
|
*
|
|
6122
6139
|
* Memory Studio panel subscribes by passing `onMemoryExtracted` and/or
|
|
6123
6140
|
* `onTurnComplete` callbacks. The Studio uses `onMemoryExtracted` to
|
|
@@ -6165,6 +6182,37 @@ interface TurnCompleteEvent {
|
|
|
6165
6182
|
outcome: ExtractOutcome;
|
|
6166
6183
|
}
|
|
6167
6184
|
/** @public */
|
|
6185
|
+
/**
|
|
6186
|
+
* Durable per-conversation extraction cursor. Synchronous by contract (both
|
|
6187
|
+
* SDK platform stores — web `localStorage`, mobile MMKV — are sync), so the
|
|
6188
|
+
* worker can hydrate the watermark inline without changing its fire-and-forget
|
|
6189
|
+
* control flow. Implementations should be best-effort; the worker guards every
|
|
6190
|
+
* call, so a throwing store degrades to in-memory-only rather than breaking
|
|
6191
|
+
* extraction.
|
|
6192
|
+
*
|
|
6193
|
+
* @public
|
|
6194
|
+
*/
|
|
6195
|
+
interface ExtractionCursorStore {
|
|
6196
|
+
/** Last message id extracted through for `conversationId`, or undefined. */
|
|
6197
|
+
get(conversationId: string): string | undefined;
|
|
6198
|
+
/** Persist the last-extracted message id for `conversationId`. */
|
|
6199
|
+
set(conversationId: string, messageId: string): void;
|
|
6200
|
+
}
|
|
6201
|
+
/** Minimal synchronous key/value surface — satisfied by the SDK's
|
|
6202
|
+
* `PlatformStorage` (web `localStorage`, mobile MMKV). */
|
|
6203
|
+
interface SyncKeyValueStore {
|
|
6204
|
+
getItem(key: string): string | null;
|
|
6205
|
+
setItem(key: string, value: string): void;
|
|
6206
|
+
}
|
|
6207
|
+
/**
|
|
6208
|
+
* Build an {@link ExtractionCursorStore} over a synchronous key/value store
|
|
6209
|
+
* (e.g. the SDK's `PlatformStorage`). Keys are namespaced by `keyPrefix`.
|
|
6210
|
+
* Reads/writes are guarded so a store that throws (quota, private mode) can't
|
|
6211
|
+
* break extraction — the watermark just falls back to in-memory.
|
|
6212
|
+
*
|
|
6213
|
+
* @public
|
|
6214
|
+
*/
|
|
6215
|
+
declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
|
|
6168
6216
|
interface CreateAutoExtractorOptions {
|
|
6169
6217
|
retainCtx: RetainContext;
|
|
6170
6218
|
extract: ExtractFactsOptions;
|
|
@@ -6195,6 +6243,15 @@ interface CreateAutoExtractorOptions {
|
|
|
6195
6243
|
* sessions in RAM-constrained hosts. Default 200.
|
|
6196
6244
|
*/
|
|
6197
6245
|
maxTrackedConversations?: number;
|
|
6246
|
+
/**
|
|
6247
|
+
* Durable per-conversation watermark store. When provided, the watermark is
|
|
6248
|
+
* hydrated from it the first time each conversation is touched and written
|
|
6249
|
+
* through on every advance, so extraction resumes exactly after the last
|
|
6250
|
+
* extracted message across process restarts (and, with a process-shared
|
|
6251
|
+
* store, across concurrent sessions). Build via {@link createPlatformCursorStore}.
|
|
6252
|
+
* Omit for in-memory-only (legacy) behavior.
|
|
6253
|
+
*/
|
|
6254
|
+
cursorStore?: ExtractionCursorStore;
|
|
6198
6255
|
/**
|
|
6199
6256
|
* Entity / memory_entity write context — when provided, each retained
|
|
6200
6257
|
* candidate's `entities[]` is persisted via `linkMemoryEntitiesOp`,
|
|
@@ -7522,4 +7579,4 @@ declare function sanitizeQuotes(s: string): string;
|
|
|
7522
7579
|
declare function renderTemplate(value: string | null | undefined, template: string): string | null;
|
|
7523
7580
|
declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
|
|
7524
7581
|
|
|
7525
|
-
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 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, 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 };
|
|
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 };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -6109,15 +6109,32 @@ declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: Ret
|
|
|
6109
6109
|
* newest (superset) message list re-covers any superseded turn. Turns for
|
|
6110
6110
|
* different conversations queue independently and never displace each other.
|
|
6111
6111
|
*
|
|
6112
|
-
* Watermark + window: the worker keeps
|
|
6113
|
-
*
|
|
6114
|
-
*
|
|
6115
|
-
*
|
|
6116
|
-
*
|
|
6117
|
-
*
|
|
6118
|
-
*
|
|
6119
|
-
*
|
|
6120
|
-
*
|
|
6112
|
+
* Watermark + window: the worker keeps a per-conversation watermark of the
|
|
6113
|
+
* last message it extracted through. Each run sends every message *after* that
|
|
6114
|
+
* watermark (plus a small overlap for coreference, capped at `maxWindowSize`)
|
|
6115
|
+
* rather than a fixed trailing slice — so facts stated in turns that arrived
|
|
6116
|
+
* during a busy window are still examined instead of scrolling out of a last-N
|
|
6117
|
+
* window.
|
|
6118
|
+
*
|
|
6119
|
+
* Durability: the in-memory watermark alone does NOT survive process death, so
|
|
6120
|
+
* a session killed after messages accumulate but before extraction would, on
|
|
6121
|
+
* the next launch, fall back to a trailing-window guess and could skip the
|
|
6122
|
+
* un-extracted tail. Pass a {@link ExtractionCursorStore} (`cursorStore`) to
|
|
6123
|
+
* persist the watermark per conversation — it is hydrated synchronously the
|
|
6124
|
+
* first time a conversation is touched, and written through on every *contiguous*
|
|
6125
|
+
* advance (never on a trailing-slice guess, which could jump the durable cursor
|
|
6126
|
+
* past an un-extracted gap), so a later session resumes exactly after the last
|
|
6127
|
+
* extracted message. The primary guarantee is single-session resume across
|
|
6128
|
+
* process death.
|
|
6129
|
+
*
|
|
6130
|
+
* Concurrent sessions sharing one store (web `localStorage`, mobile MMKV) are
|
|
6131
|
+
* best-effort, NOT exclusive: two sessions can each hydrate the same cursor
|
|
6132
|
+
* before either advances it and briefly re-extract the same turn (retain()'s
|
|
6133
|
+
* dedup/consolidation absorbs the duplicate — wasteful, not corrupting). The
|
|
6134
|
+
* durable write is last-writer-wins with a regression guard (it won't move the
|
|
6135
|
+
* cursor backwards when the currently-stored id is ahead within the same turn's
|
|
6136
|
+
* messages), but it does not serialize writers. Omit `cursorStore` for the
|
|
6137
|
+
* legacy in-memory-only behavior.
|
|
6121
6138
|
*
|
|
6122
6139
|
* Memory Studio panel subscribes by passing `onMemoryExtracted` and/or
|
|
6123
6140
|
* `onTurnComplete` callbacks. The Studio uses `onMemoryExtracted` to
|
|
@@ -6165,6 +6182,37 @@ interface TurnCompleteEvent {
|
|
|
6165
6182
|
outcome: ExtractOutcome;
|
|
6166
6183
|
}
|
|
6167
6184
|
/** @public */
|
|
6185
|
+
/**
|
|
6186
|
+
* Durable per-conversation extraction cursor. Synchronous by contract (both
|
|
6187
|
+
* SDK platform stores — web `localStorage`, mobile MMKV — are sync), so the
|
|
6188
|
+
* worker can hydrate the watermark inline without changing its fire-and-forget
|
|
6189
|
+
* control flow. Implementations should be best-effort; the worker guards every
|
|
6190
|
+
* call, so a throwing store degrades to in-memory-only rather than breaking
|
|
6191
|
+
* extraction.
|
|
6192
|
+
*
|
|
6193
|
+
* @public
|
|
6194
|
+
*/
|
|
6195
|
+
interface ExtractionCursorStore {
|
|
6196
|
+
/** Last message id extracted through for `conversationId`, or undefined. */
|
|
6197
|
+
get(conversationId: string): string | undefined;
|
|
6198
|
+
/** Persist the last-extracted message id for `conversationId`. */
|
|
6199
|
+
set(conversationId: string, messageId: string): void;
|
|
6200
|
+
}
|
|
6201
|
+
/** Minimal synchronous key/value surface — satisfied by the SDK's
|
|
6202
|
+
* `PlatformStorage` (web `localStorage`, mobile MMKV). */
|
|
6203
|
+
interface SyncKeyValueStore {
|
|
6204
|
+
getItem(key: string): string | null;
|
|
6205
|
+
setItem(key: string, value: string): void;
|
|
6206
|
+
}
|
|
6207
|
+
/**
|
|
6208
|
+
* Build an {@link ExtractionCursorStore} over a synchronous key/value store
|
|
6209
|
+
* (e.g. the SDK's `PlatformStorage`). Keys are namespaced by `keyPrefix`.
|
|
6210
|
+
* Reads/writes are guarded so a store that throws (quota, private mode) can't
|
|
6211
|
+
* break extraction — the watermark just falls back to in-memory.
|
|
6212
|
+
*
|
|
6213
|
+
* @public
|
|
6214
|
+
*/
|
|
6215
|
+
declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
|
|
6168
6216
|
interface CreateAutoExtractorOptions {
|
|
6169
6217
|
retainCtx: RetainContext;
|
|
6170
6218
|
extract: ExtractFactsOptions;
|
|
@@ -6195,6 +6243,15 @@ interface CreateAutoExtractorOptions {
|
|
|
6195
6243
|
* sessions in RAM-constrained hosts. Default 200.
|
|
6196
6244
|
*/
|
|
6197
6245
|
maxTrackedConversations?: number;
|
|
6246
|
+
/**
|
|
6247
|
+
* Durable per-conversation watermark store. When provided, the watermark is
|
|
6248
|
+
* hydrated from it the first time each conversation is touched and written
|
|
6249
|
+
* through on every advance, so extraction resumes exactly after the last
|
|
6250
|
+
* extracted message across process restarts (and, with a process-shared
|
|
6251
|
+
* store, across concurrent sessions). Build via {@link createPlatformCursorStore}.
|
|
6252
|
+
* Omit for in-memory-only (legacy) behavior.
|
|
6253
|
+
*/
|
|
6254
|
+
cursorStore?: ExtractionCursorStore;
|
|
6198
6255
|
/**
|
|
6199
6256
|
* Entity / memory_entity write context — when provided, each retained
|
|
6200
6257
|
* candidate's `entities[]` is persisted via `linkMemoryEntitiesOp`,
|
|
@@ -7522,4 +7579,4 @@ declare function sanitizeQuotes(s: string): string;
|
|
|
7522
7579
|
declare function renderTemplate(value: string | null | undefined, template: string): string | null;
|
|
7523
7580
|
declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
|
|
7524
7581
|
|
|
7525
|
-
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 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, 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 };
|
|
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 };
|
package/dist/server/index.mjs
CHANGED
|
@@ -5187,6 +5187,23 @@ function parseLocalCalendarDay(year, month, day) {
|
|
|
5187
5187
|
}
|
|
5188
5188
|
|
|
5189
5189
|
// src/lib/memory/autoExtractWorker.ts
|
|
5190
|
+
function createPlatformCursorStore(storage, keyPrefix = "anuma:mem:xcursor:") {
|
|
5191
|
+
return {
|
|
5192
|
+
get(conversationId) {
|
|
5193
|
+
try {
|
|
5194
|
+
return storage.getItem(keyPrefix + conversationId) ?? void 0;
|
|
5195
|
+
} catch {
|
|
5196
|
+
return void 0;
|
|
5197
|
+
}
|
|
5198
|
+
},
|
|
5199
|
+
set(conversationId, messageId) {
|
|
5200
|
+
try {
|
|
5201
|
+
storage.setItem(keyPrefix + conversationId, messageId);
|
|
5202
|
+
} catch {
|
|
5203
|
+
}
|
|
5204
|
+
}
|
|
5205
|
+
};
|
|
5206
|
+
}
|
|
5190
5207
|
var DEFAULT_WINDOW_SIZE = 6;
|
|
5191
5208
|
var DEFAULT_MAX_WINDOW_SIZE = 20;
|
|
5192
5209
|
var CONTEXT_OVERLAP = 2;
|
|
@@ -5206,12 +5223,24 @@ function createAutoExtractor(options) {
|
|
|
5206
5223
|
let inflight = 0;
|
|
5207
5224
|
let disposed = false;
|
|
5208
5225
|
const conversations = /* @__PURE__ */ new Map();
|
|
5226
|
+
const cursorStore = options.cursorStore;
|
|
5227
|
+
const hydrate = (state, conversationId) => {
|
|
5228
|
+
if (state.hydrated) return;
|
|
5229
|
+
state.hydrated = true;
|
|
5230
|
+
if (!cursorStore || conversationId === void 0 || state.watermark !== void 0) return;
|
|
5231
|
+
try {
|
|
5232
|
+
const persisted = cursorStore.get(conversationId);
|
|
5233
|
+
if (persisted) state.watermark = persisted;
|
|
5234
|
+
} catch {
|
|
5235
|
+
}
|
|
5236
|
+
};
|
|
5209
5237
|
const stateFor = (conversationId) => {
|
|
5210
5238
|
let state = conversations.get(conversationId);
|
|
5211
5239
|
if (!state) {
|
|
5212
5240
|
if (conversations.size >= maxTrackedConversations) evictOldestIdle(conversationId);
|
|
5213
5241
|
state = {};
|
|
5214
5242
|
conversations.set(conversationId, state);
|
|
5243
|
+
hydrate(state, conversationId);
|
|
5215
5244
|
}
|
|
5216
5245
|
return state;
|
|
5217
5246
|
};
|
|
@@ -5224,10 +5253,12 @@ function createAutoExtractor(options) {
|
|
|
5224
5253
|
}
|
|
5225
5254
|
};
|
|
5226
5255
|
function computeWindow(messages, conversationId) {
|
|
5227
|
-
const lastId =
|
|
5256
|
+
const lastId = stateFor(conversationId).watermark;
|
|
5228
5257
|
const idx = lastId === void 0 ? -1 : messages.findIndex((m) => m.id === lastId);
|
|
5229
|
-
if (idx === -1)
|
|
5230
|
-
|
|
5258
|
+
if (idx === -1) {
|
|
5259
|
+
return { window: messages.slice(-windowSize), contiguous: messages.length <= windowSize };
|
|
5260
|
+
}
|
|
5261
|
+
if (idx >= messages.length - 1) return { window: [], contiguous: true };
|
|
5231
5262
|
const start = Math.max(0, idx + 1 - CONTEXT_OVERLAP);
|
|
5232
5263
|
let window2 = messages.slice(start);
|
|
5233
5264
|
if (window2.length > maxWindowSize) {
|
|
@@ -5236,8 +5267,21 @@ function createAutoExtractor(options) {
|
|
|
5236
5267
|
);
|
|
5237
5268
|
window2 = window2.slice(0, maxWindowSize);
|
|
5238
5269
|
}
|
|
5239
|
-
return window2;
|
|
5270
|
+
return { window: window2, contiguous: true };
|
|
5240
5271
|
}
|
|
5272
|
+
const persistCursor = (conversationId, messages, advancedToId, contiguous) => {
|
|
5273
|
+
if (!cursorStore || conversationId === void 0 || !contiguous) return;
|
|
5274
|
+
try {
|
|
5275
|
+
const stored = cursorStore.get(conversationId);
|
|
5276
|
+
if (stored && stored !== advancedToId) {
|
|
5277
|
+
const storedIdx = messages.findIndex((m) => m.id === stored);
|
|
5278
|
+
const newIdx = messages.findIndex((m) => m.id === advancedToId);
|
|
5279
|
+
if (storedIdx !== -1 && newIdx !== -1 && storedIdx >= newIdx) return;
|
|
5280
|
+
}
|
|
5281
|
+
cursorStore.set(conversationId, advancedToId);
|
|
5282
|
+
} catch {
|
|
5283
|
+
}
|
|
5284
|
+
};
|
|
5241
5285
|
const consolidateBaseUrl = options.consolidate?.baseUrl ?? options.extract.baseUrl;
|
|
5242
5286
|
const consolidateOptions = options.consolidate ? {
|
|
5243
5287
|
...options.extract.apiKey !== void 0 && { apiKey: options.extract.apiKey },
|
|
@@ -5283,7 +5327,7 @@ function createAutoExtractor(options) {
|
|
|
5283
5327
|
return dispatch(messages, conversationId);
|
|
5284
5328
|
}
|
|
5285
5329
|
function dispatch(messages, conversationId) {
|
|
5286
|
-
const window2 = computeWindow(messages, conversationId);
|
|
5330
|
+
const { window: window2, contiguous } = computeWindow(messages, conversationId);
|
|
5287
5331
|
if (window2.length === 0) {
|
|
5288
5332
|
options.onSkipped?.({ reason: "no-new-content", conversationId });
|
|
5289
5333
|
drainPending();
|
|
@@ -5308,7 +5352,9 @@ function createAutoExtractor(options) {
|
|
|
5308
5352
|
}
|
|
5309
5353
|
}
|
|
5310
5354
|
);
|
|
5311
|
-
|
|
5355
|
+
const advancedTo = window2[window2.length - 1].id;
|
|
5356
|
+
stateFor(conversationId).watermark = advancedTo;
|
|
5357
|
+
persistCursor(conversationId, messages, advancedTo, contiguous);
|
|
5312
5358
|
for (let i = 0; i < results.length; i++) {
|
|
5313
5359
|
if (results[i].action === "suppressed") continue;
|
|
5314
5360
|
options.onMemoryExtracted?.({
|
|
@@ -11352,6 +11398,7 @@ export {
|
|
|
11352
11398
|
createMemoryVaultSearchTool,
|
|
11353
11399
|
createMemoryVaultTool,
|
|
11354
11400
|
createMessageOp,
|
|
11401
|
+
createPlatformCursorStore,
|
|
11355
11402
|
createProjectOp,
|
|
11356
11403
|
createRecallTool,
|
|
11357
11404
|
createServerToolsFilter,
|