@anuma/sdk 2.6.1 → 3.0.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/{chunk-TCRDSUC6.mjs → chunk-IY7NNIYM.mjs} +149 -42
- package/dist/expo/index.cjs +184 -43
- package/dist/expo/index.d.mts +53 -2
- package/dist/expo/index.d.ts +53 -2
- package/dist/expo/index.mjs +38 -3
- package/dist/expo/{recall-FQU3NUTL.mjs → recall-DJ5LD5WJ.mjs} +1 -1
- package/dist/index.cjs +8 -6
- package/dist/index.mjs +8 -6
- package/dist/react/{chunk-ZXS3KOY4.mjs → chunk-OSDVRDLI.mjs} +151 -44
- package/dist/react/index.cjs +210 -55
- package/dist/react/index.d.mts +53 -2
- package/dist/react/index.d.ts +53 -2
- package/dist/react/index.mjs +62 -13
- package/dist/react/{recall-PV7L3SN3.mjs → recall-3BDCIEQF.mjs} +1 -1
- package/dist/server/{chunk-Z6II54I7.mjs → chunk-QQOIC37O.mjs} +157 -26
- package/dist/server/index.cjs +202 -31
- package/dist/server/index.d.mts +92 -29
- package/dist/server/index.d.ts +92 -29
- package/dist/server/index.mjs +50 -7
- package/dist/server/{recall-CQT24XLH.mjs → recall-6QLUEYB7.mjs} +1 -1
- package/package.json +1 -1
package/dist/react/index.d.ts
CHANGED
|
@@ -2192,6 +2192,12 @@ type BaseSendMessageArgs = ResponsesApiOptions & {
|
|
|
2192
2192
|
onData?: (chunk: string) => void;
|
|
2193
2193
|
/** Groups requests belonging to the same conversation for observability. Pass-through only — not forwarded to the LLM provider. */
|
|
2194
2194
|
conversationId?: string;
|
|
2195
|
+
/**
|
|
2196
|
+
* Per-request override for the API path. When set, this request is sent to the
|
|
2197
|
+
* given path instead of the model-resolved endpoint. The request/response
|
|
2198
|
+
* contract is unchanged — only the path differs. Omit to use the default path.
|
|
2199
|
+
*/
|
|
2200
|
+
endpointOverride?: string;
|
|
2195
2201
|
/**
|
|
2196
2202
|
* Per-request override for PII redaction. When set, takes precedence over the
|
|
2197
2203
|
* hook-level `piiRedaction` for this call only — e.g. pass `false` to disable
|
|
@@ -2785,8 +2791,13 @@ interface EmbeddingOptions {
|
|
|
2785
2791
|
* are looked up in this map before calling the API, and new embeddings
|
|
2786
2792
|
* are stored after generation. Useful when the same texts are embedded
|
|
2787
2793
|
* repeatedly (e.g., across eval iterations or re-indexing runs).
|
|
2794
|
+
*
|
|
2795
|
+
* Values are stored as `Float32Array` (the embedding model's native
|
|
2796
|
+
* precision) rather than a float64 `number[]`, halving the resident RAM of
|
|
2797
|
+
* the cache with no precision loss. `generateEmbedding(s)` still return
|
|
2798
|
+
* `number[]` at the API boundary, so callers are unaffected.
|
|
2788
2799
|
*/
|
|
2789
|
-
cache?: Map<string,
|
|
2800
|
+
cache?: Map<string, Float32Array>;
|
|
2790
2801
|
/** Called after each embedding API call with the token usage from the response. */
|
|
2791
2802
|
onUsage?: (usage: {
|
|
2792
2803
|
promptTokens: number;
|
|
@@ -4707,6 +4718,32 @@ interface GetMessagesPageOptions {
|
|
|
4707
4718
|
*/
|
|
4708
4719
|
limit: number;
|
|
4709
4720
|
}
|
|
4721
|
+
/** Options for keyset-paginated conversation-list reads ({@link getConversationsPageOp}). */
|
|
4722
|
+
interface GetConversationsPageOptions {
|
|
4723
|
+
/**
|
|
4724
|
+
* Upper-bound `created_at` cursor (epoch ms). Without
|
|
4725
|
+
* `boundaryExcludeUniqueIds` it is EXCLUSIVE: only conversations with
|
|
4726
|
+
* `createdAt < before` are returned. Omit to fetch the newest page.
|
|
4727
|
+
*/
|
|
4728
|
+
before?: number;
|
|
4729
|
+
/**
|
|
4730
|
+
* uniqueIds of the rows the caller already holds AT the `before` boundary.
|
|
4731
|
+
* `created_at` is NOT unique (a bulk restore/import writes many rows with the
|
|
4732
|
+
* same timestamp) — with an exclusive cursor, an unseen row sharing the
|
|
4733
|
+
* boundary timestamp would be silently skipped by every page. When provided,
|
|
4734
|
+
* the boundary timestamp is fetched INCLUSIVELY and these known rows are
|
|
4735
|
+
* filtered out, so a boundary-timestamp row is returned exactly once. Mirrors
|
|
4736
|
+
* {@link GetMessagesPageOptions.boundaryExcludeUniqueIds}.
|
|
4737
|
+
*/
|
|
4738
|
+
boundaryExcludeUniqueIds?: string[];
|
|
4739
|
+
/**
|
|
4740
|
+
* Maximum rows to return — the NEWEST `limit` rows of the matching range.
|
|
4741
|
+
* Defaults to 200. A non-positive or non-finite value yields an EMPTY page
|
|
4742
|
+
* (never an unbounded read — SQLite treats `LIMIT -1` as "no limit");
|
|
4743
|
+
* fractional values are floored.
|
|
4744
|
+
*/
|
|
4745
|
+
limit?: number;
|
|
4746
|
+
}
|
|
4710
4747
|
/**
|
|
4711
4748
|
* Lightweight, mostly-undecrypted projection of a message row. Contains just
|
|
4712
4749
|
* enough for consumers to build the conversation's branch tree (parent/child
|
|
@@ -5420,6 +5457,20 @@ interface StorageOperationsContext {
|
|
|
5420
5457
|
* for `decryptField` is exactly zero.
|
|
5421
5458
|
*/
|
|
5422
5459
|
declare function getConversationsLazyOp(ctx: StorageOperationsContext): Promise<LazyStoredConversation[]>;
|
|
5460
|
+
/**
|
|
5461
|
+
* Keyset-paginated, lazy (no-decrypt) variant of {@link getConversationsLazyOp}.
|
|
5462
|
+
*
|
|
5463
|
+
* Returns at most `limit` conversations (newest first by `created_at`), each
|
|
5464
|
+
* with its raw stored title under `encryptedTitle` — pair with
|
|
5465
|
+
* {@link decryptConversationTitle} to decrypt on render. Page through older
|
|
5466
|
+
* threads by passing the oldest loaded `createdAt` as `before` plus the
|
|
5467
|
+
* uniqueIds held at that boundary as `boundaryExcludeUniqueIds`.
|
|
5468
|
+
*
|
|
5469
|
+
* Decrypts nothing and builds no WatermelonDB Model (the never-evicted
|
|
5470
|
+
* RecordCache stays empty — web Pile-2). Sort order, soft-delete filtering,
|
|
5471
|
+
* and the encrypted-title projection all match `getConversationsLazyOp`.
|
|
5472
|
+
*/
|
|
5473
|
+
declare function getConversationsPageOp(ctx: StorageOperationsContext, options?: GetConversationsPageOptions): Promise<LazyStoredConversation[]>;
|
|
5423
5474
|
/**
|
|
5424
5475
|
* Lazy variant of {@link getConversationsByProjectOp}.
|
|
5425
5476
|
*
|
|
@@ -12592,4 +12643,4 @@ declare function renderAnumaTree(node: AnumaNode): React.ReactElement | null;
|
|
|
12592
12643
|
*/
|
|
12593
12644
|
declare function renderAnumaJsx(jsx: string): React.ReactElement | null;
|
|
12594
12645
|
|
|
12595
|
-
export { Anuma, type AnumaChild, AnumaJsxError, type AnumaNode, AnumaShadowIsolationProvider, type AnumaShadowIsolationProviderProps, type AnumaTheme, AnumaThemeProvider, type AnumaThemeProviderProps, AppFile as AppFileModel, type AppFileOperationsContext, type AttrValue, type AutoExtractMessage, type AutoExtractor, DEFAULT_CONVERSATIONS_FOLDER as BACKUP_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as BACKUP_DRIVE_ROOT_FOLDER, DEFAULT_BACKUP_FOLDER as BACKUP_ICLOUD_FOLDER, BUILT_IN_TOOL_SETS, type BackupAuthContextValue, BackupAuthProvider, type BackupAuthProviderProps, type BackupOperationOptions, BlobUrlManager, type Budget, type CachedChunkVectors, type CachedServerTools, ChartCard, type ChartCardProps, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChatStorageAdapter, type ChatStorageObservable, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type CircleProps, type ClientToolsFilterFn, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type ConversationQueryOptions, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateEntityOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateSavedToolOptions, type CreateServerToolsFilterOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_BACKUP_FOLDER$1 as DEFAULT_BACKUP_FOLDER, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_CONVERSATIONS_FOLDER as DEFAULT_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as DEFAULT_DRIVE_ROOT_FOLDER, DEFAULT_BACKUP_FOLDER$1 as DEFAULT_DROPBOX_FOLDER, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_BACKUP_FOLDER as DEFAULT_ICLOUD_BACKUP_FOLDER, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DeckProps, type DisplayToolMigrations, type DropboxAuthContextValue, DropboxAuthProvider, type DropboxAuthProviderProps, type DropboxExportResult, type DropboxImportResult, ENTITY_KINDS, type EmbeddedWalletSignerFn, type EntityInput, type EntityKind, Entity as EntityModel, type EntityOperationsContext, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, FILE_PLACEHOLDER_PREFIX, FILE_PLACEHOLDER_REGEX, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetMessagesPageOptions, type GoogleDriveAuthContextValue, GoogleDriveAuthProvider, type GoogleDriveAuthProviderProps, type GoogleDriveExportResult, type GoogleDriveImportResult, type GroupProps, type ICloudAuthContextValue, ICloudAuthProvider, type ICloudAuthProviderProps, type ICloudExportResult, type ICloudImportResult, INFERENCE_ID_HEADER, type IconProps, type ImageProps, type InteractionType, type KnownTag, type LazyStoredConversation, type LineProps, type Logger, LoggerProvider, type LoggerProviderProps, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, MemoryEntity as MemoryEntityModel, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageChunk, type MessageFeedback, type MessageSkeleton, type ModelLoadProgress, type OCRFile, type OperationExecutor, type ParsedServerToolsResponse, type PdfExportOptions, type PdfExportProgress, type PdfExportStage, type PdfFile, PdfProcessor, type PendingInteraction, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PhoneCallPollingOptions, type PlatformStorage, type PortalLlmAuth, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileUpdate, type ProgressCallback, Project, type ProjectOperationsContext, type PromptPreProcessor, type PromptPreProcessorContext, type ProviderAuthState, type ProviderBackupState, ProviderStreamError, type QuantizedEmbedding, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, R2_DEFAULT_TTL_MS, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RectProps, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SLIDER_CONFIG, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, STREAM_RESUMABLE_HEADER, SavedTool as SavedToolModel, type SavedToolOperationsContext, type SavedToolParameter, type ScoreBreakdown, type ScreenProps, type SearchMessagesOptions, type SearchSource, type SelectServerToolsForPromptOptions, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ServerTool, type ServerToolsFilter, type ServerToolsFilterFn, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type SignMessageOptions, type SlideProps, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredAppFile, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredEntity, type StoredFileWithContext, type StoredMedia, Media as StoredMediaModel, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type StoredProject, type StoredSavedTool, type StoredUserPreference, UserPreference as StoredUserPreferenceModel, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, THEME_ATTRS, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, TextProcessor, type TextProps, type ThemeAttr, type ToolCallArgumentsDeltaEvent, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TranscriptionResult, type TurnCompleteEvent, type TurnSkippedEvent, type UIInteractionContextValue, UIInteractionProvider, type UIInteractionProviderProps, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateSavedToolOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseBackupOptions, type UseBackupResult, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseDropboxBackupOptions, type UseDropboxBackupResult, type UseEncryptionResult, type UseExportPdfResult, type UseFilesOptions, type UseFilesResult, type UseGoogleDriveBackupOptions, type UseGoogleDriveBackupResult, type UseICloudBackupOptions, type UseICloudBackupResult, type UseModelsResult, type UseOCRResult, type UsePdfResult, type UsePhoneCallsOptions, type UsePhoneCallsResult, type UseProjectsOptions, type UseProjectsResult, type UseSettingsOptions, type UseSettingsResult, type UseSubscriptionOptions, type UseSubscriptionResult, type UseToolsOptions, type UseToolsResult, type UseVoiceOptions, type UseVoiceResult, type UseWalletBindingOptions, type UseWalletBindingResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, type VoiceRecording, WalletPoller, WatermelonChatStorageAdapter, type WatermelonChatStorageAdapterOptions, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WhisperModel, WordProcessor, ZipProcessor, type ZipProcessorOptions, addConversationMemoriesOp, appFileToStored, backfillMemoryEntityUserIdsOp, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearCalendarToken, clearConversationMemoriesOp, clearDriveToken, clearToken as clearDropboxToken, clearEncryptionKey, clearGithubToken, clearGoogleDriveToken, clearICloudAuth, clearKeyPair, clearLazyTitleCache, clearMemoryTopicsOverrideOp, clearNotionToken, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createGitHubTools, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createPlatformCursorStore, createProjectOp, createRecallTool, createSavedToolOp, createServerToolsFilter, createStockPricePreProcessor, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllAppFilesOp, deleteAllVaultMemoriesForUserOp, deleteAppFileOp, deleteEncryptedFile, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteProjectOp, deleteSavedToolOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, expandToolSetsAdditive, exportElementToPdf, exportMarkdownToPdf, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractFileIds, fileExists, findById, findMatchingTools, findParentOfId, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllSavedToolsOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAndClearCalendarPendingMessage, getAndClearCalendarReturnUrl, getAndClearDrivePendingMessage, getAndClearDriveReturnUrl, getAndClearGithubPendingMessage, getAndClearGithubReturnUrl, getAndClearNotionPendingMessage, getAndClearNotionReturnUrl, getAppFileMapOp, getAppFileOp, getAppFilesOp, getAudioOp, getCachedServerTools, getCalendarAccessToken, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getDocumentsOp, getDriveAccessToken, getEncryptionKey, getGithubAccessToken, getGoogleDriveStoredToken, getId, getImagesOp, getLogger, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesByEntityNamesOp, getMemoriesNeedingTopicExtractionOp, getNotionAccessToken, getNotionMCPUrl, getNumberAttr, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getSavedToolByIdOp, getServerTools, getStringAttr, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserUploadedMediaOp, getValidCalendarToken, getValidDriveToken, getValidGithubToken, getValidNotionToken, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, handleCalendarCallback, handleDriveCallback, handleGithubCallback, handleNotionCallback, hardDeleteMediaOp, hasCalendarCredentials, hasDriveCredentials, hasDropboxCredentials, hasEncryptionKey, hasGithubCredentials, hasGoogleDriveCredentials, hasICloudCredentials, hasKeyPair, hasNotionCredentials, insertAfterId, insertChild, isAnumaTag, isCalendarCallback, isDriveCallback, isGithubCallback, isHtmlTag, isNotionCallback, isOPFSSupported, isR2UrlExpired, isRerankerAvailable, isSupportedFile, isSupportedMediaType, linkMemoryEntitiesOp, mediaToStored, migrateCalendarToken, migrateDisplayResult, migrateDriveToken, migrateGithubToken, migrateNotionClientRegistration, migrateNotionToken, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseJsx, preEmbedVaultMemories, preprocessFiles, previewToolSelection, projectToStored, putAppFileOp, quantizeEmbedding, queueManager, readEncryptedFile, recall, reflect, refreshCalendarToken, refreshDriveToken, refreshGithubToken, refreshNotionToken, relinkMisclassifiedVideosOp, removeById, renderAnumaJsx, renderAnumaTree, renderElementToCanvas, replaceById, replaceMemoryEntitiesGuardedOp, requestEncryptionKey, requestKeyPair, resolveFilePlaceholders, resolveThemeColor, resumeStream, retain, revokeCalendarToken, revokeDriveToken, revokeGithubToken, revokeNotionAccess, savedToolToStored, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serializeJsx, setLogger, setMemoryEntitiesOp, settingsStorageSchema, shouldChunkMessage, shouldRefreshTools, stampTopicsExtractedAtOp, startGithubAuth, startNotionAuth, storeCalendarPendingMessage, storeCalendarReturnUrl, storeCalendarToken, storeDrivePendingMessage, storeDriveReturnUrl, storeDriveToken, storeGithubPendingMessage, storeGithubReturnUrl, storeGithubToken, storeNotionPendingMessage, storeNotionReturnUrl, streamCancelPath, streamReplayPath, supersedeVaultMemoryOp, updateAttrs, updateConversationProjectOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageFeedbackOp, updateProjectNameOp, updateProjectOp, updateSavedToolOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, useAnumaTheme, useBackup, useBackupAuth, useChat, useChatStorage, useCredits, useDatabaseManager, useDropboxAuth, useDropboxBackup, useEncryption, useExportPdf, useFiles, useGoogleDriveAuth, useGoogleDriveBackup, useICloudAuth, useICloudBackup, useModels, useOCR, usePdf, usePhoneCalls, useProjects, useSettings, useSubscription, useTools, useUIInteraction, useVoice, useWalletBinding, userPreferencesStorageSchema, walk, webPlatformStorage, writeEncryptedFile };
|
|
12646
|
+
export { Anuma, type AnumaChild, AnumaJsxError, type AnumaNode, AnumaShadowIsolationProvider, type AnumaShadowIsolationProviderProps, type AnumaTheme, AnumaThemeProvider, type AnumaThemeProviderProps, AppFile as AppFileModel, type AppFileOperationsContext, type AttrValue, type AutoExtractMessage, type AutoExtractor, DEFAULT_CONVERSATIONS_FOLDER as BACKUP_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as BACKUP_DRIVE_ROOT_FOLDER, DEFAULT_BACKUP_FOLDER as BACKUP_ICLOUD_FOLDER, BUILT_IN_TOOL_SETS, type BackupAuthContextValue, BackupAuthProvider, type BackupAuthProviderProps, type BackupOperationOptions, BlobUrlManager, type Budget, type CachedChunkVectors, type CachedServerTools, ChartCard, type ChartCardProps, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChatStorageAdapter, type ChatStorageObservable, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type CircleProps, type ClientToolsFilterFn, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type ConversationQueryOptions, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateEntityOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateSavedToolOptions, type CreateServerToolsFilterOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_BACKUP_FOLDER$1 as DEFAULT_BACKUP_FOLDER, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_CONVERSATIONS_FOLDER as DEFAULT_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as DEFAULT_DRIVE_ROOT_FOLDER, DEFAULT_BACKUP_FOLDER$1 as DEFAULT_DROPBOX_FOLDER, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_BACKUP_FOLDER as DEFAULT_ICLOUD_BACKUP_FOLDER, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DeckProps, type DisplayToolMigrations, type DropboxAuthContextValue, DropboxAuthProvider, type DropboxAuthProviderProps, type DropboxExportResult, type DropboxImportResult, ENTITY_KINDS, type EmbeddedWalletSignerFn, type EntityInput, type EntityKind, Entity as EntityModel, type EntityOperationsContext, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, FILE_PLACEHOLDER_PREFIX, FILE_PLACEHOLDER_REGEX, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GoogleDriveAuthContextValue, GoogleDriveAuthProvider, type GoogleDriveAuthProviderProps, type GoogleDriveExportResult, type GoogleDriveImportResult, type GroupProps, type ICloudAuthContextValue, ICloudAuthProvider, type ICloudAuthProviderProps, type ICloudExportResult, type ICloudImportResult, INFERENCE_ID_HEADER, type IconProps, type ImageProps, type InteractionType, type KnownTag, type LazyStoredConversation, type LineProps, type Logger, LoggerProvider, type LoggerProviderProps, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, MemoryEntity as MemoryEntityModel, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageChunk, type MessageFeedback, type MessageSkeleton, type ModelLoadProgress, type OCRFile, type OperationExecutor, type ParsedServerToolsResponse, type PdfExportOptions, type PdfExportProgress, type PdfExportStage, type PdfFile, PdfProcessor, type PendingInteraction, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PhoneCallPollingOptions, type PlatformStorage, type PortalLlmAuth, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileUpdate, type ProgressCallback, Project, type ProjectOperationsContext, type PromptPreProcessor, type PromptPreProcessorContext, type ProviderAuthState, type ProviderBackupState, ProviderStreamError, type QuantizedEmbedding, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, R2_DEFAULT_TTL_MS, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RectProps, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SLIDER_CONFIG, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, STREAM_RESUMABLE_HEADER, SavedTool as SavedToolModel, type SavedToolOperationsContext, type SavedToolParameter, type ScoreBreakdown, type ScreenProps, type SearchMessagesOptions, type SearchSource, type SelectServerToolsForPromptOptions, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ServerTool, type ServerToolsFilter, type ServerToolsFilterFn, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type SignMessageOptions, type SlideProps, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredAppFile, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredEntity, type StoredFileWithContext, type StoredMedia, Media as StoredMediaModel, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type StoredProject, type StoredSavedTool, type StoredUserPreference, UserPreference as StoredUserPreferenceModel, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, THEME_ATTRS, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, TextProcessor, type TextProps, type ThemeAttr, type ToolCallArgumentsDeltaEvent, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TranscriptionResult, type TurnCompleteEvent, type TurnSkippedEvent, type UIInteractionContextValue, UIInteractionProvider, type UIInteractionProviderProps, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateSavedToolOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseBackupOptions, type UseBackupResult, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseDropboxBackupOptions, type UseDropboxBackupResult, type UseEncryptionResult, type UseExportPdfResult, type UseFilesOptions, type UseFilesResult, type UseGoogleDriveBackupOptions, type UseGoogleDriveBackupResult, type UseICloudBackupOptions, type UseICloudBackupResult, type UseModelsResult, type UseOCRResult, type UsePdfResult, type UsePhoneCallsOptions, type UsePhoneCallsResult, type UseProjectsOptions, type UseProjectsResult, type UseSettingsOptions, type UseSettingsResult, type UseSubscriptionOptions, type UseSubscriptionResult, type UseToolsOptions, type UseToolsResult, type UseVoiceOptions, type UseVoiceResult, type UseWalletBindingOptions, type UseWalletBindingResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, type VoiceRecording, WalletPoller, WatermelonChatStorageAdapter, type WatermelonChatStorageAdapterOptions, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WhisperModel, WordProcessor, ZipProcessor, type ZipProcessorOptions, addConversationMemoriesOp, appFileToStored, backfillMemoryEntityUserIdsOp, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearCalendarToken, clearConversationMemoriesOp, clearDriveToken, clearToken as clearDropboxToken, clearEncryptionKey, clearGithubToken, clearGoogleDriveToken, clearICloudAuth, clearKeyPair, clearLazyTitleCache, clearMemoryTopicsOverrideOp, clearNotionToken, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createGitHubTools, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createPlatformCursorStore, createProjectOp, createRecallTool, createSavedToolOp, createServerToolsFilter, createStockPricePreProcessor, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllAppFilesOp, deleteAllVaultMemoriesForUserOp, deleteAppFileOp, deleteEncryptedFile, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteProjectOp, deleteSavedToolOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, expandToolSetsAdditive, exportElementToPdf, exportMarkdownToPdf, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractFileIds, fileExists, findById, findMatchingTools, findParentOfId, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllSavedToolsOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAndClearCalendarPendingMessage, getAndClearCalendarReturnUrl, getAndClearDrivePendingMessage, getAndClearDriveReturnUrl, getAndClearGithubPendingMessage, getAndClearGithubReturnUrl, getAndClearNotionPendingMessage, getAndClearNotionReturnUrl, getAppFileMapOp, getAppFileOp, getAppFilesOp, getAudioOp, getCachedServerTools, getCalendarAccessToken, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsPageOp, getDocumentsOp, getDriveAccessToken, getEncryptionKey, getGithubAccessToken, getGoogleDriveStoredToken, getId, getImagesOp, getLogger, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesByEntityNamesOp, getMemoriesNeedingTopicExtractionOp, getNotionAccessToken, getNotionMCPUrl, getNumberAttr, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getSavedToolByIdOp, getServerTools, getStringAttr, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserUploadedMediaOp, getValidCalendarToken, getValidDriveToken, getValidGithubToken, getValidNotionToken, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, handleCalendarCallback, handleDriveCallback, handleGithubCallback, handleNotionCallback, hardDeleteMediaOp, hasCalendarCredentials, hasDriveCredentials, hasDropboxCredentials, hasEncryptionKey, hasGithubCredentials, hasGoogleDriveCredentials, hasICloudCredentials, hasKeyPair, hasNotionCredentials, insertAfterId, insertChild, isAnumaTag, isCalendarCallback, isDriveCallback, isGithubCallback, isHtmlTag, isNotionCallback, isOPFSSupported, isR2UrlExpired, isRerankerAvailable, isSupportedFile, isSupportedMediaType, linkMemoryEntitiesOp, mediaToStored, migrateCalendarToken, migrateDisplayResult, migrateDriveToken, migrateGithubToken, migrateNotionClientRegistration, migrateNotionToken, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseJsx, preEmbedVaultMemories, preprocessFiles, previewToolSelection, projectToStored, putAppFileOp, quantizeEmbedding, queueManager, readEncryptedFile, recall, reflect, refreshCalendarToken, refreshDriveToken, refreshGithubToken, refreshNotionToken, relinkMisclassifiedVideosOp, removeById, renderAnumaJsx, renderAnumaTree, renderElementToCanvas, replaceById, replaceMemoryEntitiesGuardedOp, requestEncryptionKey, requestKeyPair, resolveFilePlaceholders, resolveThemeColor, resumeStream, retain, revokeCalendarToken, revokeDriveToken, revokeGithubToken, revokeNotionAccess, savedToolToStored, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serializeJsx, setLogger, setMemoryEntitiesOp, settingsStorageSchema, shouldChunkMessage, shouldRefreshTools, stampTopicsExtractedAtOp, startGithubAuth, startNotionAuth, storeCalendarPendingMessage, storeCalendarReturnUrl, storeCalendarToken, storeDrivePendingMessage, storeDriveReturnUrl, storeDriveToken, storeGithubPendingMessage, storeGithubReturnUrl, storeGithubToken, storeNotionPendingMessage, storeNotionReturnUrl, streamCancelPath, streamReplayPath, supersedeVaultMemoryOp, updateAttrs, updateConversationProjectOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageFeedbackOp, updateProjectNameOp, updateProjectOp, updateSavedToolOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, useAnumaTheme, useBackup, useBackupAuth, useChat, useChatStorage, useCredits, useDatabaseManager, useDropboxAuth, useDropboxBackup, useEncryption, useExportPdf, useFiles, useGoogleDriveAuth, useGoogleDriveBackup, useICloudAuth, useICloudBackup, useModels, useOCR, usePdf, usePhoneCalls, useProjects, useSettings, useSubscription, useTools, useUIInteraction, useVoice, useWalletBinding, userPreferencesStorageSchema, walk, webPlatformStorage, writeEncryptedFile };
|
package/dist/react/index.mjs
CHANGED
|
@@ -73,6 +73,7 @@ import {
|
|
|
73
73
|
getConversationsByProjectOp,
|
|
74
74
|
getConversationsLazyOp,
|
|
75
75
|
getConversationsOp,
|
|
76
|
+
getConversationsPageOp,
|
|
76
77
|
getEncryptionKey,
|
|
77
78
|
getImageModel,
|
|
78
79
|
getMemoriesByEntityNamesOp,
|
|
@@ -131,7 +132,7 @@ import {
|
|
|
131
132
|
updateVaultMemoryOp,
|
|
132
133
|
useEncryption,
|
|
133
134
|
vaultMemoryToStored
|
|
134
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-OSDVRDLI.mjs";
|
|
135
136
|
import {
|
|
136
137
|
PiiRedactor,
|
|
137
138
|
createStreamingDeAnonymizer,
|
|
@@ -2328,6 +2329,22 @@ function linkAbortSignals(a, b) {
|
|
|
2328
2329
|
}
|
|
2329
2330
|
};
|
|
2330
2331
|
}
|
|
2332
|
+
function validateEndpointOverride(override) {
|
|
2333
|
+
const trimmed = override.trim();
|
|
2334
|
+
if (trimmed === "") {
|
|
2335
|
+
return {
|
|
2336
|
+
valid: false,
|
|
2337
|
+
message: 'endpointOverride must be a non-empty, root-relative path (e.g. "/api/v1/utility/responses"); received an empty or whitespace-only string'
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2340
|
+
if (trimmed.startsWith("//") || trimmed.includes("://")) {
|
|
2341
|
+
return {
|
|
2342
|
+
valid: false,
|
|
2343
|
+
message: `endpointOverride must be a root-relative path (e.g. "/api/v1/utility/responses"), not a protocol-relative or absolute URL; received "${trimmed}"`
|
|
2344
|
+
};
|
|
2345
|
+
}
|
|
2346
|
+
return { valid: true, endpoint: trimmed.startsWith("/") ? trimmed : `/${trimmed}` };
|
|
2347
|
+
}
|
|
2331
2348
|
async function runToolLoop(options) {
|
|
2332
2349
|
const {
|
|
2333
2350
|
model,
|
|
@@ -2335,6 +2352,7 @@ async function runToolLoop(options) {
|
|
|
2335
2352
|
baseUrl = BASE_URL,
|
|
2336
2353
|
headers,
|
|
2337
2354
|
apiType = "auto",
|
|
2355
|
+
endpointOverride,
|
|
2338
2356
|
temperature,
|
|
2339
2357
|
maxOutputTokens,
|
|
2340
2358
|
tools,
|
|
@@ -2417,6 +2435,20 @@ async function runToolLoop(options) {
|
|
|
2417
2435
|
await fireRunError({ error: msg, stage: "model", errorObject: new Error(msg) });
|
|
2418
2436
|
return { data: null, error: msg };
|
|
2419
2437
|
}
|
|
2438
|
+
let effectiveEndpoint = strategy.endpoint;
|
|
2439
|
+
if (endpointOverride !== void 0) {
|
|
2440
|
+
const overrideValidation = validateEndpointOverride(endpointOverride);
|
|
2441
|
+
if (!overrideValidation.valid) {
|
|
2442
|
+
if (onError) onError(new Error(overrideValidation.message));
|
|
2443
|
+
await fireRunError({
|
|
2444
|
+
error: overrideValidation.message,
|
|
2445
|
+
stage: "model",
|
|
2446
|
+
errorObject: new Error(overrideValidation.message)
|
|
2447
|
+
});
|
|
2448
|
+
return { data: null, error: overrideValidation.message };
|
|
2449
|
+
}
|
|
2450
|
+
effectiveEndpoint = overrideValidation.endpoint;
|
|
2451
|
+
}
|
|
2420
2452
|
const { signal: combinedSignal, cleanup: cleanupSignalLink } = linkAbortSignals(
|
|
2421
2453
|
signal,
|
|
2422
2454
|
detachSignal
|
|
@@ -2600,7 +2632,7 @@ async function runToolLoop(options) {
|
|
|
2600
2632
|
if (onRequest) onRequest(measureRequest(0, attempt, requestBody, messages, apiTools));
|
|
2601
2633
|
const sseResult = makeStreamingRequest({
|
|
2602
2634
|
baseUrl,
|
|
2603
|
-
endpoint:
|
|
2635
|
+
endpoint: effectiveEndpoint,
|
|
2604
2636
|
body: requestBody,
|
|
2605
2637
|
token,
|
|
2606
2638
|
headers: effectiveHeaders,
|
|
@@ -3072,7 +3104,7 @@ Executing tool: ${toolInfo}
|
|
|
3072
3104
|
const continuationRound = toolIteration;
|
|
3073
3105
|
const continuationResult = makeStreamingRequest({
|
|
3074
3106
|
baseUrl,
|
|
3075
|
-
endpoint:
|
|
3107
|
+
endpoint: effectiveEndpoint,
|
|
3076
3108
|
body: continuationRequestBody,
|
|
3077
3109
|
token,
|
|
3078
3110
|
headers: effectiveHeaders,
|
|
@@ -3486,6 +3518,7 @@ function useChat(options) {
|
|
|
3486
3518
|
imageModel,
|
|
3487
3519
|
apiType: requestApiType,
|
|
3488
3520
|
conversationId,
|
|
3521
|
+
endpointOverride,
|
|
3489
3522
|
piiRedaction: requestPiiRedaction
|
|
3490
3523
|
}) => {
|
|
3491
3524
|
if (abortControllerRef.current) {
|
|
@@ -3555,6 +3588,7 @@ function useChat(options) {
|
|
|
3555
3588
|
baseUrl,
|
|
3556
3589
|
headers,
|
|
3557
3590
|
apiType: requestApiType ?? defaultApiType,
|
|
3591
|
+
endpointOverride,
|
|
3558
3592
|
temperature,
|
|
3559
3593
|
maxOutputTokens,
|
|
3560
3594
|
tools,
|
|
@@ -8241,6 +8275,7 @@ function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
|
8241
8275
|
}
|
|
8242
8276
|
|
|
8243
8277
|
// src/lib/processors/encoding.ts
|
|
8278
|
+
var B64_ENCODE_CHUNK = 32768 * 3;
|
|
8244
8279
|
async function dataUrlToArrayBuffer(dataUrl) {
|
|
8245
8280
|
if (dataUrl.startsWith("blob:") || dataUrl.startsWith("http://") || dataUrl.startsWith("https://")) {
|
|
8246
8281
|
const response = await fetch(dataUrl);
|
|
@@ -8263,11 +8298,28 @@ function uint8ArrayToBase64(data) {
|
|
|
8263
8298
|
if (typeof Buffer !== "undefined") {
|
|
8264
8299
|
return Buffer.from(data).toString("base64");
|
|
8265
8300
|
}
|
|
8266
|
-
let
|
|
8267
|
-
for (let i = 0; i < data.length; i
|
|
8268
|
-
|
|
8301
|
+
let base64 = "";
|
|
8302
|
+
for (let i = 0; i < data.length; i += B64_ENCODE_CHUNK) {
|
|
8303
|
+
const slice = data.subarray(i, i + B64_ENCODE_CHUNK);
|
|
8304
|
+
let binary = "";
|
|
8305
|
+
for (let j = 0; j < slice.length; j++) {
|
|
8306
|
+
binary += String.fromCharCode(slice[j]);
|
|
8307
|
+
}
|
|
8308
|
+
base64 += btoa(binary);
|
|
8269
8309
|
}
|
|
8270
|
-
return
|
|
8310
|
+
return base64;
|
|
8311
|
+
}
|
|
8312
|
+
function base64ToUint8Array(base64) {
|
|
8313
|
+
if (typeof Buffer !== "undefined") {
|
|
8314
|
+
const buf = Buffer.from(base64, "base64");
|
|
8315
|
+
return new Uint8Array(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength));
|
|
8316
|
+
}
|
|
8317
|
+
const binary = atob(base64);
|
|
8318
|
+
const bytes = new Uint8Array(binary.length);
|
|
8319
|
+
for (let i = 0; i < binary.length; i++) {
|
|
8320
|
+
bytes[i] = binary.charCodeAt(i);
|
|
8321
|
+
}
|
|
8322
|
+
return bytes;
|
|
8271
8323
|
}
|
|
8272
8324
|
|
|
8273
8325
|
// src/lib/processors/ExcelProcessor.ts
|
|
@@ -18557,7 +18609,7 @@ async function uploadFileToICloud(filename, content) {
|
|
|
18557
18609
|
const database = container.privateCloudDatabase;
|
|
18558
18610
|
const recordName = `backup_${filename.replace(/[^a-zA-Z0-9]/g, "_")}`;
|
|
18559
18611
|
const arrayBuffer = await content.arrayBuffer();
|
|
18560
|
-
const base64Data =
|
|
18612
|
+
const base64Data = uint8ArrayToBase64(new Uint8Array(arrayBuffer));
|
|
18561
18613
|
const record = {
|
|
18562
18614
|
recordType: RECORD_TYPE,
|
|
18563
18615
|
recordName,
|
|
@@ -18619,11 +18671,7 @@ async function downloadICloudFile(recordName) {
|
|
|
18619
18671
|
throw new Error("No data in record");
|
|
18620
18672
|
}
|
|
18621
18673
|
if (typeof dataField === "string") {
|
|
18622
|
-
const
|
|
18623
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
18624
|
-
for (let i = 0; i < binaryString.length; i++) {
|
|
18625
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
18626
|
-
}
|
|
18674
|
+
const bytes = base64ToUint8Array(dataField);
|
|
18627
18675
|
return new Blob([bytes], { type: "application/json" });
|
|
18628
18676
|
}
|
|
18629
18677
|
if (typeof dataField === "object" && "downloadURL" in dataField) {
|
|
@@ -22798,6 +22846,7 @@ export {
|
|
|
22798
22846
|
getConversationsByProjectLazyOp,
|
|
22799
22847
|
getConversationsByProjectOp,
|
|
22800
22848
|
getConversationsLazyOp,
|
|
22849
|
+
getConversationsPageOp,
|
|
22801
22850
|
getDocumentsOp,
|
|
22802
22851
|
getDriveAccessToken,
|
|
22803
22852
|
getEncryptionKey,
|
|
@@ -14553,6 +14553,15 @@ async function encryptData(plaintext, address) {
|
|
|
14553
14553
|
const key = await getEncryptionKey(address);
|
|
14554
14554
|
return encryptDataWithKey(plaintext, key);
|
|
14555
14555
|
}
|
|
14556
|
+
async function encryptDataBytes(plaintext, address) {
|
|
14557
|
+
if (!isValidWalletAddress(address)) {
|
|
14558
|
+
throw new Error(
|
|
14559
|
+
`Invalid wallet address: ${address}. Address must start with 0x and be 42 characters (0x + 40 hex characters).`
|
|
14560
|
+
);
|
|
14561
|
+
}
|
|
14562
|
+
const key = await getEncryptionKey(address);
|
|
14563
|
+
return encryptBytesWithKey(plaintext, key);
|
|
14564
|
+
}
|
|
14556
14565
|
async function decryptData(encryptedHex, address, version = "v3") {
|
|
14557
14566
|
const key = await getEncryptionKey(address, version);
|
|
14558
14567
|
return decryptDataWithKey(encryptedHex, key);
|
|
@@ -14572,6 +14581,20 @@ async function decryptDataBytes(encryptedHex, address, version = "v3") {
|
|
|
14572
14581
|
);
|
|
14573
14582
|
return new Uint8Array(decryptedData);
|
|
14574
14583
|
}
|
|
14584
|
+
async function decryptDataBytesFromBytes(encrypted, address, version = "v3") {
|
|
14585
|
+
const key = await getEncryptionKey(address, version);
|
|
14586
|
+
const iv = encrypted.subarray(0, 12);
|
|
14587
|
+
const encryptedData = encrypted.subarray(12);
|
|
14588
|
+
const decryptedData = await crypto.subtle.decrypt(
|
|
14589
|
+
{
|
|
14590
|
+
name: "AES-GCM",
|
|
14591
|
+
iv
|
|
14592
|
+
},
|
|
14593
|
+
key,
|
|
14594
|
+
encryptedData
|
|
14595
|
+
);
|
|
14596
|
+
return new Uint8Array(decryptedData);
|
|
14597
|
+
}
|
|
14575
14598
|
function hasEncryptionKey(address) {
|
|
14576
14599
|
return getStoredKey(address) !== null;
|
|
14577
14600
|
}
|
|
@@ -15209,6 +15232,67 @@ async function messageToStored(message, walletAddress, signMessage, embeddedWall
|
|
|
15209
15232
|
}
|
|
15210
15233
|
return baseMessage;
|
|
15211
15234
|
}
|
|
15235
|
+
function rawDate(value) {
|
|
15236
|
+
return new Date(typeof value === "number" ? value : 0);
|
|
15237
|
+
}
|
|
15238
|
+
function messageRawToStoredRaw(raw, projection) {
|
|
15239
|
+
const parseJsonField = (rawValue) => {
|
|
15240
|
+
if (!rawValue) return void 0;
|
|
15241
|
+
if (typeof rawValue === "string") {
|
|
15242
|
+
if (rawValue.startsWith("enc:")) return rawValue;
|
|
15243
|
+
try {
|
|
15244
|
+
return JSON.parse(rawValue);
|
|
15245
|
+
} catch {
|
|
15246
|
+
return void 0;
|
|
15247
|
+
}
|
|
15248
|
+
}
|
|
15249
|
+
return rawValue;
|
|
15250
|
+
};
|
|
15251
|
+
const skipEmbeddings = projection?.skipEmbeddings === true;
|
|
15252
|
+
const vectorRaw = skipEmbeddings ? null : raw.vector;
|
|
15253
|
+
const chunksRaw = skipEmbeddings ? null : raw.chunks;
|
|
15254
|
+
return {
|
|
15255
|
+
uniqueId: raw.id,
|
|
15256
|
+
messageId: raw.message_id,
|
|
15257
|
+
conversationId: raw.conversation_id ?? "",
|
|
15258
|
+
role: raw.role ?? "",
|
|
15259
|
+
content: raw.content ?? "",
|
|
15260
|
+
model: raw.model,
|
|
15261
|
+
imageModel: raw.image_model,
|
|
15262
|
+
files: parseJsonField(raw.files),
|
|
15263
|
+
fileIds: parseJsonField(raw.file_ids),
|
|
15264
|
+
createdAt: rawDate(raw.created_at),
|
|
15265
|
+
updatedAt: rawDate(raw.updated_at),
|
|
15266
|
+
vector: skipEmbeddings ? void 0 : parseJsonField(vectorRaw),
|
|
15267
|
+
embeddingModel: raw.embedding_model,
|
|
15268
|
+
chunks: skipEmbeddings ? void 0 : parseJsonField(chunksRaw),
|
|
15269
|
+
usage: parseJsonField(raw.usage),
|
|
15270
|
+
sources: parseJsonField(raw.sources),
|
|
15271
|
+
responseDuration: raw.response_duration,
|
|
15272
|
+
// `was_stopped` is an OPTIONAL boolean: an unset row sanitizes to null, and the Model path
|
|
15273
|
+
// (message.wasStopped) returns that null verbatim. Preserve it (don't collapse to false) so the
|
|
15274
|
+
// raw path is byte-identical. When set, coerce SQLite 0/1 and LokiJS true/false alike.
|
|
15275
|
+
wasStopped: raw.was_stopped === null || raw.was_stopped === void 0 ? raw.was_stopped : raw.was_stopped === true || raw.was_stopped === 1,
|
|
15276
|
+
error: raw.error,
|
|
15277
|
+
thoughtProcess: parseJsonField(raw.thought_process),
|
|
15278
|
+
thinking: raw.thinking,
|
|
15279
|
+
parentMessageId: raw.parent_message_id,
|
|
15280
|
+
feedback: raw.feedback || null,
|
|
15281
|
+
toolCallEvents: parseJsonField(raw.tool_call_events)
|
|
15282
|
+
};
|
|
15283
|
+
}
|
|
15284
|
+
async function messageRawToStored(raw, walletAddress, signMessage, embeddedWalletSigner, projection) {
|
|
15285
|
+
const baseMessage = messageRawToStoredRaw(raw, projection);
|
|
15286
|
+
if (walletAddress) {
|
|
15287
|
+
return await decryptMessageFields(
|
|
15288
|
+
baseMessage,
|
|
15289
|
+
walletAddress,
|
|
15290
|
+
signMessage,
|
|
15291
|
+
embeddedWalletSigner
|
|
15292
|
+
);
|
|
15293
|
+
}
|
|
15294
|
+
return baseMessage;
|
|
15295
|
+
}
|
|
15212
15296
|
function conversationToStoredRaw(conversation) {
|
|
15213
15297
|
return {
|
|
15214
15298
|
uniqueId: conversation.id,
|
|
@@ -15233,6 +15317,33 @@ async function conversationToStored(conversation, walletAddress, signMessage, em
|
|
|
15233
15317
|
}
|
|
15234
15318
|
return baseConversation;
|
|
15235
15319
|
}
|
|
15320
|
+
function conversationRawToStoredRaw(raw) {
|
|
15321
|
+
const pinnedAt = raw.pinned_at;
|
|
15322
|
+
return {
|
|
15323
|
+
uniqueId: raw.id,
|
|
15324
|
+
conversationId: raw.conversation_id ?? "",
|
|
15325
|
+
title: raw.title ?? "",
|
|
15326
|
+
projectId: raw.project_id,
|
|
15327
|
+
createdAt: rawDate(raw.created_at),
|
|
15328
|
+
updatedAt: rawDate(raw.updated_at),
|
|
15329
|
+
// SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
|
|
15330
|
+
isDeleted: raw.is_deleted === true || raw.is_deleted === 1,
|
|
15331
|
+
// @date maps a non-number raw column (incl. an explicit unpin null) to null; a number → Date.
|
|
15332
|
+
pinnedAt: typeof pinnedAt === "number" ? new Date(pinnedAt) : null
|
|
15333
|
+
};
|
|
15334
|
+
}
|
|
15335
|
+
async function conversationRawToStored(raw, walletAddress, signMessage, embeddedWalletSigner) {
|
|
15336
|
+
const baseConversation = conversationRawToStoredRaw(raw);
|
|
15337
|
+
if (walletAddress) {
|
|
15338
|
+
return await decryptConversationFields(
|
|
15339
|
+
baseConversation,
|
|
15340
|
+
walletAddress,
|
|
15341
|
+
signMessage,
|
|
15342
|
+
embeddedWalletSigner
|
|
15343
|
+
);
|
|
15344
|
+
}
|
|
15345
|
+
return baseConversation;
|
|
15346
|
+
}
|
|
15236
15347
|
async function createConversationOp(ctx, opts, defaultTitle = "New Conversation") {
|
|
15237
15348
|
const convId = opts?.conversationId || generateConversationId();
|
|
15238
15349
|
const title = opts?.title || defaultTitle;
|
|
@@ -15272,36 +15383,51 @@ async function getConversationOp(ctx, id) {
|
|
|
15272
15383
|
) : null;
|
|
15273
15384
|
}
|
|
15274
15385
|
async function getConversationsOp(ctx) {
|
|
15275
|
-
const results = await ctx.conversationsCollection.query(import_watermelondb.Q.where("is_deleted", false), import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)).
|
|
15386
|
+
const results = await ctx.conversationsCollection.query(import_watermelondb.Q.where("is_deleted", false), import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)).unsafeFetchRaw();
|
|
15276
15387
|
return Promise.all(
|
|
15277
15388
|
results.map(
|
|
15278
|
-
(
|
|
15389
|
+
(raw) => conversationRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
|
|
15279
15390
|
)
|
|
15280
15391
|
);
|
|
15281
15392
|
}
|
|
15282
|
-
function
|
|
15393
|
+
function conversationRawToLazyStored(raw) {
|
|
15394
|
+
const pinnedAt = raw.pinned_at;
|
|
15283
15395
|
return {
|
|
15284
|
-
uniqueId:
|
|
15285
|
-
conversationId:
|
|
15286
|
-
encryptedTitle:
|
|
15287
|
-
projectId:
|
|
15288
|
-
createdAt:
|
|
15289
|
-
updatedAt:
|
|
15290
|
-
isDeleted:
|
|
15291
|
-
pinnedAt:
|
|
15396
|
+
uniqueId: raw.id,
|
|
15397
|
+
conversationId: raw.conversation_id ?? "",
|
|
15398
|
+
encryptedTitle: raw.title ?? "",
|
|
15399
|
+
projectId: raw.project_id,
|
|
15400
|
+
createdAt: rawDate(raw.created_at),
|
|
15401
|
+
updatedAt: rawDate(raw.updated_at),
|
|
15402
|
+
isDeleted: raw.is_deleted === true || raw.is_deleted === 1,
|
|
15403
|
+
pinnedAt: typeof pinnedAt === "number" ? new Date(pinnedAt) : null
|
|
15292
15404
|
};
|
|
15293
15405
|
}
|
|
15294
15406
|
async function getConversationsLazyOp(ctx) {
|
|
15295
|
-
const results = await ctx.conversationsCollection.query(import_watermelondb.Q.where("is_deleted", false), import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)).
|
|
15296
|
-
return results.map(
|
|
15407
|
+
const results = await ctx.conversationsCollection.query(import_watermelondb.Q.where("is_deleted", false), import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)).unsafeFetchRaw();
|
|
15408
|
+
return results.map(conversationRawToLazyStored);
|
|
15409
|
+
}
|
|
15410
|
+
async function getConversationsPageOp(ctx, options) {
|
|
15411
|
+
const limit = Math.floor(options?.limit ?? 200);
|
|
15412
|
+
if (!Number.isFinite(limit) || limit < 1) return [];
|
|
15413
|
+
const exclude = new Set(options?.boundaryExcludeUniqueIds ?? []);
|
|
15414
|
+
const clauses = [import_watermelondb.Q.where("is_deleted", false)];
|
|
15415
|
+
if (options?.before !== void 0) {
|
|
15416
|
+
clauses.push(
|
|
15417
|
+
exclude.size > 0 ? import_watermelondb.Q.where("created_at", import_watermelondb.Q.lte(options.before)) : import_watermelondb.Q.where("created_at", import_watermelondb.Q.lt(options.before))
|
|
15418
|
+
);
|
|
15419
|
+
}
|
|
15420
|
+
const fetched = await ctx.conversationsCollection.query(...clauses, import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc), import_watermelondb.Q.take(limit + exclude.size)).unsafeFetchRaw();
|
|
15421
|
+
const results = exclude.size > 0 ? fetched.filter((raw) => !exclude.has(raw.id)) : fetched;
|
|
15422
|
+
return results.slice(0, limit).map(conversationRawToLazyStored);
|
|
15297
15423
|
}
|
|
15298
15424
|
async function getConversationsByProjectLazyOp(ctx, projectId) {
|
|
15299
15425
|
const results = await ctx.conversationsCollection.query(
|
|
15300
15426
|
import_watermelondb.Q.where("project_id", projectId === null ? "" : projectId),
|
|
15301
15427
|
import_watermelondb.Q.where("is_deleted", false),
|
|
15302
15428
|
import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)
|
|
15303
|
-
).
|
|
15304
|
-
return results.map(
|
|
15429
|
+
).unsafeFetchRaw();
|
|
15430
|
+
return results.map(conversationRawToLazyStored);
|
|
15305
15431
|
}
|
|
15306
15432
|
async function updateConversationTitleOp(ctx, id, title) {
|
|
15307
15433
|
const results = await ctx.conversationsCollection.query(import_watermelondb.Q.where("conversation_id", id), import_watermelondb.Q.where("is_deleted", false)).fetch();
|
|
@@ -15351,18 +15477,18 @@ async function getConversationsByProjectOp(ctx, projectId) {
|
|
|
15351
15477
|
import_watermelondb.Q.where("project_id", projectId === null ? "" : projectId),
|
|
15352
15478
|
import_watermelondb.Q.where("is_deleted", false),
|
|
15353
15479
|
import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)
|
|
15354
|
-
).
|
|
15480
|
+
).unsafeFetchRaw();
|
|
15355
15481
|
return Promise.all(
|
|
15356
15482
|
results.map(
|
|
15357
|
-
(
|
|
15483
|
+
(raw) => conversationRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
|
|
15358
15484
|
)
|
|
15359
15485
|
);
|
|
15360
15486
|
}
|
|
15361
15487
|
async function getMessagesOp(ctx, convId) {
|
|
15362
|
-
const results = await ctx.messagesCollection.query(import_watermelondb.Q.where("conversation_id", convId), import_watermelondb.Q.sortBy("message_id", import_watermelondb.Q.asc)).
|
|
15488
|
+
const results = await ctx.messagesCollection.query(import_watermelondb.Q.where("conversation_id", convId), import_watermelondb.Q.sortBy("message_id", import_watermelondb.Q.asc)).unsafeFetchRaw();
|
|
15363
15489
|
return Promise.all(
|
|
15364
15490
|
results.map(
|
|
15365
|
-
(
|
|
15491
|
+
(raw) => messageRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
|
|
15366
15492
|
)
|
|
15367
15493
|
);
|
|
15368
15494
|
}
|
|
@@ -17640,7 +17766,7 @@ async function generateEmbedding(text, options) {
|
|
|
17640
17766
|
const { baseUrl = BASE_URL, getToken, apiKey, model, cache } = options;
|
|
17641
17767
|
if (cache) {
|
|
17642
17768
|
const cached = cache.get(text);
|
|
17643
|
-
if (cached) return cached;
|
|
17769
|
+
if (cached) return Array.from(cached);
|
|
17644
17770
|
}
|
|
17645
17771
|
let headers;
|
|
17646
17772
|
if (apiKey) {
|
|
@@ -17679,10 +17805,11 @@ async function generateEmbedding(text, options) {
|
|
|
17679
17805
|
totalTokens: response.data.usage.total_tokens ?? 0
|
|
17680
17806
|
});
|
|
17681
17807
|
}
|
|
17808
|
+
const f32Embedding = Float32Array.from(embedding);
|
|
17682
17809
|
if (cache) {
|
|
17683
|
-
cache.set(text,
|
|
17810
|
+
cache.set(text, f32Embedding);
|
|
17684
17811
|
}
|
|
17685
|
-
return
|
|
17812
|
+
return Array.from(f32Embedding);
|
|
17686
17813
|
}
|
|
17687
17814
|
var DEFAULT_EMBEDDING_BATCH_SIZE = 100;
|
|
17688
17815
|
var DEFAULT_EMBEDDING_BATCH_CONCURRENCY = 3;
|
|
@@ -17720,7 +17847,7 @@ async function generateEmbeddings(texts, options) {
|
|
|
17720
17847
|
if (cache) {
|
|
17721
17848
|
const cached = cache.get(texts[i]);
|
|
17722
17849
|
if (cached) {
|
|
17723
|
-
results[i] = cached;
|
|
17850
|
+
results[i] = Array.from(cached);
|
|
17724
17851
|
continue;
|
|
17725
17852
|
}
|
|
17726
17853
|
}
|
|
@@ -17781,9 +17908,10 @@ async function generateEmbeddings(texts, options) {
|
|
|
17781
17908
|
newEmbeddings = allEmbeddings.flat();
|
|
17782
17909
|
}
|
|
17783
17910
|
for (let i = 0; i < uncachedIndices.length; i++) {
|
|
17784
|
-
|
|
17911
|
+
const f32Embedding = Float32Array.from(newEmbeddings[i]);
|
|
17912
|
+
results[uncachedIndices[i]] = Array.from(f32Embedding);
|
|
17785
17913
|
if (cache) {
|
|
17786
|
-
cache.set(uncachedTexts[i],
|
|
17914
|
+
cache.set(uncachedTexts[i], f32Embedding);
|
|
17787
17915
|
}
|
|
17788
17916
|
}
|
|
17789
17917
|
return results;
|
|
@@ -19207,7 +19335,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
|
|
|
19207
19335
|
legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
|
|
19208
19336
|
);
|
|
19209
19337
|
}
|
|
19210
|
-
const { recall: recall2 } = await import("./recall-
|
|
19338
|
+
const { recall: recall2 } = await import("./recall-6QLUEYB7.mjs");
|
|
19211
19339
|
const result = await recall2(
|
|
19212
19340
|
query,
|
|
19213
19341
|
{ vaultCtx, embeddingOptions, vaultCache: cache },
|
|
@@ -19847,8 +19975,10 @@ export {
|
|
|
19847
19975
|
clearAllEncryptionKeys,
|
|
19848
19976
|
getEncryptionKey,
|
|
19849
19977
|
encryptData,
|
|
19978
|
+
encryptDataBytes,
|
|
19850
19979
|
decryptData,
|
|
19851
19980
|
decryptDataBytes,
|
|
19981
|
+
decryptDataBytesFromBytes,
|
|
19852
19982
|
hasEncryptionKey,
|
|
19853
19983
|
encryptDataWithKey,
|
|
19854
19984
|
decryptDataWithKey,
|
|
@@ -19873,6 +20003,7 @@ export {
|
|
|
19873
20003
|
getConversationOp,
|
|
19874
20004
|
getConversationsOp,
|
|
19875
20005
|
getConversationsLazyOp,
|
|
20006
|
+
getConversationsPageOp,
|
|
19876
20007
|
getConversationsByProjectLazyOp,
|
|
19877
20008
|
updateConversationTitleOp,
|
|
19878
20009
|
deleteConversationOp,
|