@anuma/sdk 1.2.2 → 1.3.1
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 +353 -219
- package/dist/expo/index.d.mts +80 -7
- package/dist/expo/index.d.ts +80 -7
- package/dist/expo/index.mjs +272 -143
- package/dist/react/index.cjs +440 -306
- package/dist/react/index.d.mts +80 -7
- package/dist/react/index.d.ts +80 -7
- package/dist/react/index.mjs +314 -185
- package/dist/server/index.cjs +474 -413
- package/dist/server/index.d.mts +20 -6
- package/dist/server/index.d.ts +20 -6
- package/dist/server/index.mjs +349 -288
- package/package.json +1 -1
package/dist/expo/index.d.mts
CHANGED
|
@@ -6341,8 +6341,10 @@ declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageR
|
|
|
6341
6341
|
* - v33: Added embedding_model column to memory_vault so stale-model vectors are
|
|
6342
6342
|
* detectable and re-embeddable after an embedding-model change (null = legacy
|
|
6343
6343
|
* rows, grandfathered as compatible with the current model)
|
|
6344
|
+
* - v35: Added conversation_memory table recording which vault memories a
|
|
6345
|
+
* conversation drew on, so the conversation-level Memories panel survives reload
|
|
6344
6346
|
*/
|
|
6345
|
-
declare const SDK_SCHEMA_VERSION =
|
|
6347
|
+
declare const SDK_SCHEMA_VERSION = 35;
|
|
6346
6348
|
/**
|
|
6347
6349
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
6348
6350
|
*
|
|
@@ -6420,6 +6422,7 @@ declare const sdkSchema: Readonly<{
|
|
|
6420
6422
|
* - v30 → v31: Added `user_id` column to memory_entity for multi-user scoping of the W5 graph lane (with backfill from memory_vault.user_id)
|
|
6421
6423
|
* - v31 → v32: Added `pinned_at` column to conversations for pinning chats
|
|
6422
6424
|
* - v32 → v33: Added `embedding_model` column to memory_vault (null grandfathered as current-model-compatible)
|
|
6425
|
+
* - v34 → v35: Added `conversation_memory` table (conversation ↔ recalled memory ids)
|
|
6423
6426
|
*/
|
|
6424
6427
|
declare const sdkMigrations: Readonly<{
|
|
6425
6428
|
validated: true;
|
|
@@ -6539,8 +6542,18 @@ interface DatabaseManagerOptions {
|
|
|
6539
6542
|
* ```
|
|
6540
6543
|
*/
|
|
6541
6544
|
declare class DatabaseManager {
|
|
6542
|
-
|
|
6543
|
-
|
|
6545
|
+
/**
|
|
6546
|
+
* WatermelonDB instances cached by their derived `dbName` (not by raw wallet
|
|
6547
|
+
* address). Caching per dbName makes {@link getDatabase} idempotent: a wallet
|
|
6548
|
+
* that is requested again — including after a transient `undefined`/guest
|
|
6549
|
+
* excursion or an address that briefly arrives in a different form during
|
|
6550
|
+
* sign-up — reuses the SAME instance instead of being torn down and rebuilt.
|
|
6551
|
+
* The rebuild was what left the web OPFS adapter disposed/orphaned mid-session
|
|
6552
|
+
* (client#4821). Instances are kept for the lifetime of the manager (typically
|
|
6553
|
+
* guest + one wallet); switching wallets keeps prior ones cached rather than
|
|
6554
|
+
* disposing an instance the app may still hold a reference to.
|
|
6555
|
+
*/
|
|
6556
|
+
private readonly databases;
|
|
6544
6557
|
private migrationInProgress;
|
|
6545
6558
|
private readonly dbNamePrefix;
|
|
6546
6559
|
private readonly createAdapter;
|
|
@@ -6555,8 +6568,9 @@ declare class DatabaseManager {
|
|
|
6555
6568
|
/**
|
|
6556
6569
|
* Get or create a WatermelonDB Database instance for the given wallet.
|
|
6557
6570
|
*
|
|
6558
|
-
*
|
|
6559
|
-
*
|
|
6571
|
+
* Instances are cached per derived dbName and reused across calls (including
|
|
6572
|
+
* repeat/guest-interleaved requests for the same wallet); a new one is built
|
|
6573
|
+
* only for a dbName not yet seen. See the `databases` field for why.
|
|
6560
6574
|
*
|
|
6561
6575
|
* @param walletAddress - The wallet address to scope the database to.
|
|
6562
6576
|
* If undefined, uses a "guest" database.
|
|
@@ -6565,7 +6579,7 @@ declare class DatabaseManager {
|
|
|
6565
6579
|
*/
|
|
6566
6580
|
getDatabase(walletAddress?: string): Database;
|
|
6567
6581
|
/**
|
|
6568
|
-
* Reset
|
|
6582
|
+
* Reset ALL cached databases (useful for logout or testing).
|
|
6569
6583
|
*/
|
|
6570
6584
|
resetDatabase(): Promise<void>;
|
|
6571
6585
|
/**
|
|
@@ -6575,6 +6589,65 @@ declare class DatabaseManager {
|
|
|
6575
6589
|
private handleSchemaMigration;
|
|
6576
6590
|
}
|
|
6577
6591
|
|
|
6592
|
+
/**
|
|
6593
|
+
* A memory a conversation drew on, recorded so the conversation-level Memories
|
|
6594
|
+
* panel can be rebuilt after a reload. Stores only the vault memory id (+ recall
|
|
6595
|
+
* score) — the snippet/topic/scope are resolved from the memory_vault by id, so
|
|
6596
|
+
* no memory content is duplicated here.
|
|
6597
|
+
*/
|
|
6598
|
+
declare class ConversationMemory extends Model {
|
|
6599
|
+
static table: string;
|
|
6600
|
+
static associations: Associations;
|
|
6601
|
+
conversationId: string;
|
|
6602
|
+
memoryId: string;
|
|
6603
|
+
score: number;
|
|
6604
|
+
createdAt: Date;
|
|
6605
|
+
}
|
|
6606
|
+
|
|
6607
|
+
/**
|
|
6608
|
+
* Types for the conversation-memory storage module.
|
|
6609
|
+
*
|
|
6610
|
+
* A conversation-memory row links a conversation to a vault memory it drew on,
|
|
6611
|
+
* so the conversation Memories panel survives reload. Only the memory id and
|
|
6612
|
+
* recall score are stored; content lives in the encrypted memory_vault.
|
|
6613
|
+
*/
|
|
6614
|
+
/** Plain object representation of a conversation-memory record. */
|
|
6615
|
+
interface StoredConversationMemory {
|
|
6616
|
+
/** WatermelonDB internal ID */
|
|
6617
|
+
uniqueId: string;
|
|
6618
|
+
/** The conversation this memory was drawn on in */
|
|
6619
|
+
conversationId: string;
|
|
6620
|
+
/** The memory_vault record id this row points at */
|
|
6621
|
+
memoryId: string;
|
|
6622
|
+
/** Recall relevance score (~0–1) at the time it was recorded */
|
|
6623
|
+
score: number;
|
|
6624
|
+
createdAt: Date;
|
|
6625
|
+
}
|
|
6626
|
+
/** One memory drawn on during a turn, passed to addConversationMemoriesOp. */
|
|
6627
|
+
interface ConversationMemoryInput {
|
|
6628
|
+
memoryId: string;
|
|
6629
|
+
score: number;
|
|
6630
|
+
}
|
|
6631
|
+
|
|
6632
|
+
/** Context required by conversation-memory operations. */
|
|
6633
|
+
interface ConversationMemoryOperationsContext {
|
|
6634
|
+
database: Database;
|
|
6635
|
+
conversationMemoryCollection: Collection<ConversationMemory>;
|
|
6636
|
+
}
|
|
6637
|
+
/** Convert a WatermelonDB ConversationMemory model to a plain object. */
|
|
6638
|
+
declare function conversationMemoryToStored(row: ConversationMemory): StoredConversationMemory;
|
|
6639
|
+
/**
|
|
6640
|
+
* Record the memories a turn drew on for a conversation. Dedupes on
|
|
6641
|
+
* (conversation_id, memory_id) against existing rows, keeps insertion order, and
|
|
6642
|
+
* prunes the oldest rows beyond MAX_PER_CONVERSATION. No-ops on an empty
|
|
6643
|
+
* conversation id or empty item list.
|
|
6644
|
+
*/
|
|
6645
|
+
declare function addConversationMemoriesOp(ctx: ConversationMemoryOperationsContext, conversationId: string, items: ConversationMemoryInput[]): Promise<void>;
|
|
6646
|
+
/** List a conversation's recorded memories, oldest first. */
|
|
6647
|
+
declare function getConversationMemoriesOp(ctx: ConversationMemoryOperationsContext, conversationId: string): Promise<StoredConversationMemory[]>;
|
|
6648
|
+
/** Delete all recorded memories for a conversation (e.g. incognito purge). */
|
|
6649
|
+
declare function clearConversationMemoriesOp(ctx: ConversationMemoryOperationsContext, conversationId: string): Promise<void>;
|
|
6650
|
+
|
|
6578
6651
|
declare class VaultFolder extends Model {
|
|
6579
6652
|
static table: string;
|
|
6580
6653
|
name: string;
|
|
@@ -6871,4 +6944,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
6871
6944
|
*/
|
|
6872
6945
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
6873
6946
|
|
|
6874
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkingOptions, type ConsolidationFallbackReason, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type TextChunk, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, cosineInt8, createAutoExtractor, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndRetain, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, streamCancelPath, streamReplayPath, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
|
6947
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type TextChunk, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndRetain, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, streamCancelPath, streamReplayPath, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -6341,8 +6341,10 @@ declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageR
|
|
|
6341
6341
|
* - v33: Added embedding_model column to memory_vault so stale-model vectors are
|
|
6342
6342
|
* detectable and re-embeddable after an embedding-model change (null = legacy
|
|
6343
6343
|
* rows, grandfathered as compatible with the current model)
|
|
6344
|
+
* - v35: Added conversation_memory table recording which vault memories a
|
|
6345
|
+
* conversation drew on, so the conversation-level Memories panel survives reload
|
|
6344
6346
|
*/
|
|
6345
|
-
declare const SDK_SCHEMA_VERSION =
|
|
6347
|
+
declare const SDK_SCHEMA_VERSION = 35;
|
|
6346
6348
|
/**
|
|
6347
6349
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
6348
6350
|
*
|
|
@@ -6420,6 +6422,7 @@ declare const sdkSchema: Readonly<{
|
|
|
6420
6422
|
* - v30 → v31: Added `user_id` column to memory_entity for multi-user scoping of the W5 graph lane (with backfill from memory_vault.user_id)
|
|
6421
6423
|
* - v31 → v32: Added `pinned_at` column to conversations for pinning chats
|
|
6422
6424
|
* - v32 → v33: Added `embedding_model` column to memory_vault (null grandfathered as current-model-compatible)
|
|
6425
|
+
* - v34 → v35: Added `conversation_memory` table (conversation ↔ recalled memory ids)
|
|
6423
6426
|
*/
|
|
6424
6427
|
declare const sdkMigrations: Readonly<{
|
|
6425
6428
|
validated: true;
|
|
@@ -6539,8 +6542,18 @@ interface DatabaseManagerOptions {
|
|
|
6539
6542
|
* ```
|
|
6540
6543
|
*/
|
|
6541
6544
|
declare class DatabaseManager {
|
|
6542
|
-
|
|
6543
|
-
|
|
6545
|
+
/**
|
|
6546
|
+
* WatermelonDB instances cached by their derived `dbName` (not by raw wallet
|
|
6547
|
+
* address). Caching per dbName makes {@link getDatabase} idempotent: a wallet
|
|
6548
|
+
* that is requested again — including after a transient `undefined`/guest
|
|
6549
|
+
* excursion or an address that briefly arrives in a different form during
|
|
6550
|
+
* sign-up — reuses the SAME instance instead of being torn down and rebuilt.
|
|
6551
|
+
* The rebuild was what left the web OPFS adapter disposed/orphaned mid-session
|
|
6552
|
+
* (client#4821). Instances are kept for the lifetime of the manager (typically
|
|
6553
|
+
* guest + one wallet); switching wallets keeps prior ones cached rather than
|
|
6554
|
+
* disposing an instance the app may still hold a reference to.
|
|
6555
|
+
*/
|
|
6556
|
+
private readonly databases;
|
|
6544
6557
|
private migrationInProgress;
|
|
6545
6558
|
private readonly dbNamePrefix;
|
|
6546
6559
|
private readonly createAdapter;
|
|
@@ -6555,8 +6568,9 @@ declare class DatabaseManager {
|
|
|
6555
6568
|
/**
|
|
6556
6569
|
* Get or create a WatermelonDB Database instance for the given wallet.
|
|
6557
6570
|
*
|
|
6558
|
-
*
|
|
6559
|
-
*
|
|
6571
|
+
* Instances are cached per derived dbName and reused across calls (including
|
|
6572
|
+
* repeat/guest-interleaved requests for the same wallet); a new one is built
|
|
6573
|
+
* only for a dbName not yet seen. See the `databases` field for why.
|
|
6560
6574
|
*
|
|
6561
6575
|
* @param walletAddress - The wallet address to scope the database to.
|
|
6562
6576
|
* If undefined, uses a "guest" database.
|
|
@@ -6565,7 +6579,7 @@ declare class DatabaseManager {
|
|
|
6565
6579
|
*/
|
|
6566
6580
|
getDatabase(walletAddress?: string): Database;
|
|
6567
6581
|
/**
|
|
6568
|
-
* Reset
|
|
6582
|
+
* Reset ALL cached databases (useful for logout or testing).
|
|
6569
6583
|
*/
|
|
6570
6584
|
resetDatabase(): Promise<void>;
|
|
6571
6585
|
/**
|
|
@@ -6575,6 +6589,65 @@ declare class DatabaseManager {
|
|
|
6575
6589
|
private handleSchemaMigration;
|
|
6576
6590
|
}
|
|
6577
6591
|
|
|
6592
|
+
/**
|
|
6593
|
+
* A memory a conversation drew on, recorded so the conversation-level Memories
|
|
6594
|
+
* panel can be rebuilt after a reload. Stores only the vault memory id (+ recall
|
|
6595
|
+
* score) — the snippet/topic/scope are resolved from the memory_vault by id, so
|
|
6596
|
+
* no memory content is duplicated here.
|
|
6597
|
+
*/
|
|
6598
|
+
declare class ConversationMemory extends Model {
|
|
6599
|
+
static table: string;
|
|
6600
|
+
static associations: Associations;
|
|
6601
|
+
conversationId: string;
|
|
6602
|
+
memoryId: string;
|
|
6603
|
+
score: number;
|
|
6604
|
+
createdAt: Date;
|
|
6605
|
+
}
|
|
6606
|
+
|
|
6607
|
+
/**
|
|
6608
|
+
* Types for the conversation-memory storage module.
|
|
6609
|
+
*
|
|
6610
|
+
* A conversation-memory row links a conversation to a vault memory it drew on,
|
|
6611
|
+
* so the conversation Memories panel survives reload. Only the memory id and
|
|
6612
|
+
* recall score are stored; content lives in the encrypted memory_vault.
|
|
6613
|
+
*/
|
|
6614
|
+
/** Plain object representation of a conversation-memory record. */
|
|
6615
|
+
interface StoredConversationMemory {
|
|
6616
|
+
/** WatermelonDB internal ID */
|
|
6617
|
+
uniqueId: string;
|
|
6618
|
+
/** The conversation this memory was drawn on in */
|
|
6619
|
+
conversationId: string;
|
|
6620
|
+
/** The memory_vault record id this row points at */
|
|
6621
|
+
memoryId: string;
|
|
6622
|
+
/** Recall relevance score (~0–1) at the time it was recorded */
|
|
6623
|
+
score: number;
|
|
6624
|
+
createdAt: Date;
|
|
6625
|
+
}
|
|
6626
|
+
/** One memory drawn on during a turn, passed to addConversationMemoriesOp. */
|
|
6627
|
+
interface ConversationMemoryInput {
|
|
6628
|
+
memoryId: string;
|
|
6629
|
+
score: number;
|
|
6630
|
+
}
|
|
6631
|
+
|
|
6632
|
+
/** Context required by conversation-memory operations. */
|
|
6633
|
+
interface ConversationMemoryOperationsContext {
|
|
6634
|
+
database: Database;
|
|
6635
|
+
conversationMemoryCollection: Collection<ConversationMemory>;
|
|
6636
|
+
}
|
|
6637
|
+
/** Convert a WatermelonDB ConversationMemory model to a plain object. */
|
|
6638
|
+
declare function conversationMemoryToStored(row: ConversationMemory): StoredConversationMemory;
|
|
6639
|
+
/**
|
|
6640
|
+
* Record the memories a turn drew on for a conversation. Dedupes on
|
|
6641
|
+
* (conversation_id, memory_id) against existing rows, keeps insertion order, and
|
|
6642
|
+
* prunes the oldest rows beyond MAX_PER_CONVERSATION. No-ops on an empty
|
|
6643
|
+
* conversation id or empty item list.
|
|
6644
|
+
*/
|
|
6645
|
+
declare function addConversationMemoriesOp(ctx: ConversationMemoryOperationsContext, conversationId: string, items: ConversationMemoryInput[]): Promise<void>;
|
|
6646
|
+
/** List a conversation's recorded memories, oldest first. */
|
|
6647
|
+
declare function getConversationMemoriesOp(ctx: ConversationMemoryOperationsContext, conversationId: string): Promise<StoredConversationMemory[]>;
|
|
6648
|
+
/** Delete all recorded memories for a conversation (e.g. incognito purge). */
|
|
6649
|
+
declare function clearConversationMemoriesOp(ctx: ConversationMemoryOperationsContext, conversationId: string): Promise<void>;
|
|
6650
|
+
|
|
6578
6651
|
declare class VaultFolder extends Model {
|
|
6579
6652
|
static table: string;
|
|
6580
6653
|
name: string;
|
|
@@ -6871,4 +6944,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
6871
6944
|
*/
|
|
6872
6945
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
6873
6946
|
|
|
6874
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkingOptions, type ConsolidationFallbackReason, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type TextChunk, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, cosineInt8, createAutoExtractor, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndRetain, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, streamCancelPath, streamReplayPath, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
|
6947
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type TextChunk, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndRetain, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, streamCancelPath, streamReplayPath, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|