@anuma/sdk 6.27.0 → 6.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3414,6 +3414,10 @@ declare function ChartCard({ data }: ChartCardProps): react_jsx_runtime.JSX.Elem
3414
3414
  * Encryption key version type.
3415
3415
  * - "v2": Legacy SHA-256 derived key (for reading enc:v2: data)
3416
3416
  * - "v3": HKDF derived key with domain separation (for new encryption)
3417
+ *
3418
+ * Raw signature bytes (Privy Solana `signMessage` returns a `Uint8Array`) are
3419
+ * not a stored version. Derive them with {@link deriveKeyFromSignatureBytes}.
3420
+ * {@link requestEncryptionKey} still derives v2 and v3 from a hex signature only.
3417
3421
  */
3418
3422
  type EncryptionKeyVersion = "v2" | "v3";
3419
3423
  /**
@@ -3483,6 +3487,25 @@ declare function clearAllEncryptionState(): void;
3483
3487
  * requests, and derived ECDH key pairs (both in-memory and persisted).
3484
3488
  */
3485
3489
  declare function clearAllEncryptionKeys(): void;
3490
+ /**
3491
+ * Derives the bytes-native AES key from a raw signature.
3492
+ *
3493
+ * Privy Solana `signMessage` returns a `Uint8Array`. Pass those bytes here.
3494
+ * The signature is never hex-encoded, base58-encoded, or passed through
3495
+ * `String()`. That string round-trip is what made {@link hexToBytes} store
3496
+ * zeros for every non-hex pair and yield a low-entropy AES key.
3497
+ *
3498
+ * This is the derivation for the next key version (`anuma-sdk-aes-gcm-v4`).
3499
+ * {@link requestEncryptionKey} does not install it; v2 and v3 stay on the
3500
+ * hex-string path so existing ciphertext keeps decrypting. The return value
3501
+ * is the same 64-char hex form the in-memory store already uses.
3502
+ *
3503
+ * @param signature - Raw signature bytes. Must be at least 64 bytes.
3504
+ * @returns 32-byte AES-GCM key as hex, without a `0x` prefix.
3505
+ * @throws Error when `signature` is shorter than 64 bytes.
3506
+ * @category Encryption
3507
+ */
3508
+ declare function deriveKeyFromSignatureBytes(signature: Uint8Array): Promise<string>;
3486
3509
  /**
3487
3510
  * Gets the encryption key from in-memory storage and imports it as a CryptoKey.
3488
3511
  * The key must have been previously requested via requestEncryptionKey.
@@ -3680,6 +3703,11 @@ interface SignMessageOptions {
3680
3703
  /**
3681
3704
  * Type for the signMessage function that client must provide.
3682
3705
  * This is typically from Privy's useSignMessage hook.
3706
+ *
3707
+ * The resolved value must be a hex signature (`0x`-prefixed or bare). A
3708
+ * non-hex string — including `String(uint8Array)` or a base58 signature —
3709
+ * throws from key derivation instead of becoming a zero-filled AES key.
3710
+ * Raw signature bytes go to {@link deriveKeyFromSignatureBytes}.
3683
3711
  */
3684
3712
  type SignMessageFn = (message: string, options?: SignMessageOptions) => Promise<string>;
3685
3713
  /**
@@ -16579,4 +16607,4 @@ declare function renderAnumaTree(node: AnumaNode): React.ReactElement | null;
16579
16607
  */
16580
16608
  declare function renderAnumaJsx(jsx: string): React.ReactElement | null;
16581
16609
 
16582
- 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, CHUNKS_DISCARDED_ORIGIN, 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 ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type ConversationQueryOptions, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, 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_DECAY_POLICY, 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_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DeckProps, type DisplayToolMigrations, type DropboxAuthContextValue, DropboxAuthProvider, type DropboxAuthProviderProps, type DropboxExportResult, type DropboxImportResult, type DurableAutoExtractorOptions, ENTITY_FANOUT, ENTITY_KINDS, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type EncryptionKeyVersion, type EntityInput, type EntityKind, Entity as EntityModel, type EntityOperationsContext, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionTimings, FILE_PLACEHOLDER_PREFIX, FILE_PLACEHOLDER_REGEX, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GoogleDriveAuthContextValue, GoogleDriveAuthProvider, type GoogleDriveAuthProviderProps, type GoogleDriveExportResult, type GoogleDriveImportResult, type GraphTraversalOptions, type GroupProps, HARD_DELETE_WINDOW_MS, type ICloudAuthContextValue, ICloudAuthProvider, type ICloudAuthProviderProps, type ICloudExportResult, type ICloudImportResult, INFERENCE_ID_HEADER, INTERNAL_FLOW_MARKER, type IconProps, type ImageProps, type InjectionClassifierOptions, type InjectionReason, type InteractionType, type KnownTag, type LazyStoredConversation, type LineProps, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type ManualFactType, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, MemoryEntity as MemoryEntityModel, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageChunk, type MessageFeedback, type MessageOrigin, type MessageSkeleton, type ModelLoadProgress, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type OCRFile, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, type PdfExportOptions, type PdfExportProgress, type PdfExportStage, type PdfFile, PdfProcessor, type PendingInteraction, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PhoneCallPollingOptions, type PhotoIngestResult, type PhotoMediaRef, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type ProfileUpdate, type ProgressCallback, Project, type ProjectOperationsContext, type PromptPreProcessor, type PromptPreProcessorContext, type ProviderAuthState, type ProviderBackupState, ProviderStreamError, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, R2_DEFAULT_TTL_MS, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RectProps, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, STREAM_RESUMABLE_HEADER, SavedTool as SavedToolModel, type SavedToolOperationsContext, type SavedToolParameter, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenProps, type ScreenResult, type ScreenedCandidate, 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 StoredTopic, type StoredUserPreference, UserPreference as StoredUserPreferenceModel, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, THEME_ATTRS, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type TextProps, type ThemeAttr, type ToolCallArgumentsDeltaEvent, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSkipReason, type TopicSource, type TranscriptionResult, type TurnCompleteEvent, type TurnSkippedEvent, type UIInteractionContextValue, UIInteractionProvider, type UIInteractionProviderProps, type UncheckedReason, type UnverifiableReason, 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, VAULT_SIZE_HOP_CAP, type VaultCandidateKey, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, type VoiceRecording, WalletPoller, WatermelonChatStorageAdapter, type WatermelonChatStorageAdapterOptions, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WhisperModel, WordProcessor, ZipProcessor, type ZipProcessorOptions, addConversationMemoriesOp, appFileToStored, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryEntityUserIdsOp, backfillMemoryTopicsOp, buildAttachedFilesText, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, 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, createDecaySweeper, createDurableAutoExtractor, createGitHubTools, createLlmDecayClassifier, createLlmNeighborRefiner, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createPlatformCursorStore, createProjectOp, createRecallTool, createSavedToolOp, createServerToolsFilter, createStockPricePreProcessor, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllAppFilesOp, deleteAllVaultMemoriesForUserOp, deleteAppFileOp, deleteEncryptedFile, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteMessageOp, deleteProjectOp, deleteSavedToolOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, expandToolSetsAdditive, exportElementToPdf, exportMarkdownToPdf, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractFileIds, fileExists, findById, findMatchingTools, findParentOfId, formatFileProcessingNotes, 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, getDecayCandidatesRawOp, getDocumentsOp, getDriveAccessToken, getEncryptionKey, getEntitiesByMemoryIdsOp, 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, getVaultCandidateKeysOp, getVaultEmbeddingsByIdsOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, getVideosOp, handleCalendarCallback, handleDriveCallback, handleGithubCallback, handleNotionCallback, hardDeleteDecayedOp, hardDeleteMediaOp, hasCalendarCredentials, hasDriveCredentials, hasDropboxCredentials, hasEncryptionKey, hasGithubCredentials, hasGoogleDriveCredentials, hasICloudCredentials, hasKeyPair, hasNotionCredentials, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, insertAfterId, insertChild, isAnumaTag, isAttachedFilesText, isCalendarCallback, isDegradedTopicSkip, isDriveCallback, isEncrypted, isGithubCallback, isHtmlTag, isNotionCallback, isOPFSSupported, isR2UrlExpired, isRerankerAvailable, isSupportedFile, isSupportedMediaType, linkMemoryEntitiesOp, maskScopedEmbeddingCache, mediaToStored, migrateCalendarToken, migrateDisplayResult, migrateDriveToken, migrateGithubToken, migrateNotionClientRegistration, migrateNotionToken, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseJsx, parseMedia, preEmbedVaultMemories, preprocessFiles, previewToolSelection, projectToStored, putAppFileOp, quantizeEmbedding, queueManager, rankProfileCandidates, readEncryptedFile, recall, reflect, refreshCalendarToken, refreshDriveToken, refreshEncryptionKeyIfMatches, refreshGithubToken, refreshNotionToken, relinkMemoryTopicsOp, relinkMisclassifiedVideosOp, removeById, renderAnumaJsx, renderAnumaTree, renderElementToCanvas, replaceById, replaceMemoryEntitiesGuardedOp, requestEncryptionKey, requestKeyPair, resolveFilePlaceholders, resolveThemeColor, restoreVaultMemoryOp, resumeStream, retain, revokeCalendarToken, revokeDriveToken, revokeGithubToken, revokeNotionAccess, savedToolToStored, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, seedEncryptionKeys, selectServerToolsForPrompt, serializeJsx, setLogger, setMemoryEntitiesOp, setMemoryVisibilityOp, settingsStorageSchema, shouldChunkMessage, shouldRecallMemory, shouldRefreshTools, stampTopicsExtractedAtOp, startGithubAuth, startNotionAuth, storeCalendarPendingMessage, storeCalendarReturnUrl, storeCalendarToken, storeDrivePendingMessage, storeDriveReturnUrl, storeDriveToken, storeGithubPendingMessage, storeGithubReturnUrl, storeGithubToken, storeNotionPendingMessage, storeNotionReturnUrl, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, 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, verifyMemoriesForPublish, walk, webPlatformStorage, withInternalFlowMarker, writeEncryptedFile };
16610
+ 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, CHUNKS_DISCARDED_ORIGIN, 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 ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type ConversationQueryOptions, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, 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_DECAY_POLICY, 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_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DeckProps, type DisplayToolMigrations, type DropboxAuthContextValue, DropboxAuthProvider, type DropboxAuthProviderProps, type DropboxExportResult, type DropboxImportResult, type DurableAutoExtractorOptions, ENTITY_FANOUT, ENTITY_KINDS, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type EncryptionKeyVersion, type EntityInput, type EntityKind, Entity as EntityModel, type EntityOperationsContext, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionTimings, FILE_PLACEHOLDER_PREFIX, FILE_PLACEHOLDER_REGEX, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GoogleDriveAuthContextValue, GoogleDriveAuthProvider, type GoogleDriveAuthProviderProps, type GoogleDriveExportResult, type GoogleDriveImportResult, type GraphTraversalOptions, type GroupProps, HARD_DELETE_WINDOW_MS, type ICloudAuthContextValue, ICloudAuthProvider, type ICloudAuthProviderProps, type ICloudExportResult, type ICloudImportResult, INFERENCE_ID_HEADER, INTERNAL_FLOW_MARKER, type IconProps, type ImageProps, type InjectionClassifierOptions, type InjectionReason, type InteractionType, type KnownTag, type LazyStoredConversation, type LineProps, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type ManualFactType, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, MemoryEntity as MemoryEntityModel, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageChunk, type MessageFeedback, type MessageOrigin, type MessageSkeleton, type ModelLoadProgress, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type OCRFile, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, type PdfExportOptions, type PdfExportProgress, type PdfExportStage, type PdfFile, PdfProcessor, type PendingInteraction, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PhoneCallPollingOptions, type PhotoIngestResult, type PhotoMediaRef, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type ProfileUpdate, type ProgressCallback, Project, type ProjectOperationsContext, type PromptPreProcessor, type PromptPreProcessorContext, type ProviderAuthState, type ProviderBackupState, ProviderStreamError, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, R2_DEFAULT_TTL_MS, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RectProps, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, STREAM_RESUMABLE_HEADER, SavedTool as SavedToolModel, type SavedToolOperationsContext, type SavedToolParameter, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenProps, type ScreenResult, type ScreenedCandidate, 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 StoredTopic, type StoredUserPreference, UserPreference as StoredUserPreferenceModel, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, THEME_ATTRS, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type TextProps, type ThemeAttr, type ToolCallArgumentsDeltaEvent, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSkipReason, type TopicSource, type TranscriptionResult, type TurnCompleteEvent, type TurnSkippedEvent, type UIInteractionContextValue, UIInteractionProvider, type UIInteractionProviderProps, type UncheckedReason, type UnverifiableReason, 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, VAULT_SIZE_HOP_CAP, type VaultCandidateKey, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, type VoiceRecording, WalletPoller, WatermelonChatStorageAdapter, type WatermelonChatStorageAdapterOptions, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WhisperModel, WordProcessor, ZipProcessor, type ZipProcessorOptions, addConversationMemoriesOp, appFileToStored, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryEntityUserIdsOp, backfillMemoryTopicsOp, buildAttachedFilesText, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, 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, createDecaySweeper, createDurableAutoExtractor, createGitHubTools, createLlmDecayClassifier, createLlmNeighborRefiner, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createPlatformCursorStore, createProjectOp, createRecallTool, createSavedToolOp, createServerToolsFilter, createStockPricePreProcessor, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllAppFilesOp, deleteAllVaultMemoriesForUserOp, deleteAppFileOp, deleteEncryptedFile, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteMessageOp, deleteProjectOp, deleteSavedToolOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, expandToolSetsAdditive, exportElementToPdf, exportMarkdownToPdf, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractFileIds, fileExists, findById, findMatchingTools, findParentOfId, formatFileProcessingNotes, 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, getDecayCandidatesRawOp, getDocumentsOp, getDriveAccessToken, getEncryptionKey, getEntitiesByMemoryIdsOp, 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, getVaultCandidateKeysOp, getVaultEmbeddingsByIdsOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, getVideosOp, handleCalendarCallback, handleDriveCallback, handleGithubCallback, handleNotionCallback, hardDeleteDecayedOp, hardDeleteMediaOp, hasCalendarCredentials, hasDriveCredentials, hasDropboxCredentials, hasEncryptionKey, hasGithubCredentials, hasGoogleDriveCredentials, hasICloudCredentials, hasKeyPair, hasNotionCredentials, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, insertAfterId, insertChild, isAnumaTag, isAttachedFilesText, isCalendarCallback, isDegradedTopicSkip, isDriveCallback, isEncrypted, isGithubCallback, isHtmlTag, isNotionCallback, isOPFSSupported, isR2UrlExpired, isRerankerAvailable, isSupportedFile, isSupportedMediaType, linkMemoryEntitiesOp, maskScopedEmbeddingCache, mediaToStored, migrateCalendarToken, migrateDisplayResult, migrateDriveToken, migrateGithubToken, migrateNotionClientRegistration, migrateNotionToken, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseJsx, parseMedia, preEmbedVaultMemories, preprocessFiles, previewToolSelection, projectToStored, putAppFileOp, quantizeEmbedding, queueManager, rankProfileCandidates, readEncryptedFile, recall, reflect, refreshCalendarToken, refreshDriveToken, refreshEncryptionKeyIfMatches, refreshGithubToken, refreshNotionToken, relinkMemoryTopicsOp, relinkMisclassifiedVideosOp, removeById, renderAnumaJsx, renderAnumaTree, renderElementToCanvas, replaceById, replaceMemoryEntitiesGuardedOp, requestEncryptionKey, requestKeyPair, resolveFilePlaceholders, resolveThemeColor, restoreVaultMemoryOp, resumeStream, retain, revokeCalendarToken, revokeDriveToken, revokeGithubToken, revokeNotionAccess, savedToolToStored, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, seedEncryptionKeys, selectServerToolsForPrompt, serializeJsx, setLogger, setMemoryEntitiesOp, setMemoryVisibilityOp, settingsStorageSchema, shouldChunkMessage, shouldRecallMemory, shouldRefreshTools, stampTopicsExtractedAtOp, startGithubAuth, startNotionAuth, storeCalendarPendingMessage, storeCalendarReturnUrl, storeCalendarToken, storeDrivePendingMessage, storeDriveReturnUrl, storeDriveToken, storeGithubPendingMessage, storeGithubReturnUrl, storeGithubToken, storeNotionPendingMessage, storeNotionReturnUrl, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, 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, verifyMemoriesForPublish, walk, webPlatformStorage, withInternalFlowMarker, writeEncryptedFile };
@@ -399,11 +399,32 @@ function clearAllEncryptionState() {
399
399
  function clearAllEncryptionKeys() {
400
400
  clearAllEncryptionState();
401
401
  }
402
+ function hexNibble(code) {
403
+ if (code >= 48 && code <= 57) return code - 48;
404
+ if (code >= 65 && code <= 70) return code - 55;
405
+ if (code >= 97 && code <= 102) return code - 87;
406
+ return -1;
407
+ }
402
408
  function hexToBytes(hex) {
409
+ if (typeof hex !== "string") {
410
+ throw new TypeError(
411
+ "hexToBytes: expected a hex string. Pass raw signature bytes to deriveKeyFromSignatureBytes instead of stringifying them."
412
+ );
413
+ }
403
414
  const cleanHex = hex.startsWith("0x") ? hex.slice(2) : hex;
415
+ if (cleanHex.length === 0 || cleanHex.length % 2 !== 0) {
416
+ throw new Error(
417
+ `hexToBytes: invalid hex string (expected a non-empty even length, got ${cleanHex.length})`
418
+ );
419
+ }
404
420
  const bytes = new Uint8Array(cleanHex.length / 2);
405
421
  for (let i = 0; i < cleanHex.length; i += 2) {
406
- bytes[i / 2] = parseInt(cleanHex.slice(i, i + 2), 16);
422
+ const hi = hexNibble(cleanHex.charCodeAt(i));
423
+ const lo = hexNibble(cleanHex.charCodeAt(i + 1));
424
+ if (hi < 0 || lo < 0) {
425
+ throw new Error(`hexToBytes: invalid hex string (non-hex character at index ${i})`);
426
+ }
427
+ bytes[i / 2] = hi << 4 | lo;
407
428
  }
408
429
  return bytes;
409
430
  }
@@ -415,15 +436,12 @@ var SHARED_TEXT_DECODER = new TextDecoder();
415
436
  function isValidWalletAddress(address) {
416
437
  return /^0x[a-fA-F0-9]{40}$/.test(address);
417
438
  }
418
- async function deriveKeyFromSignature(signature) {
419
- const sigBytes = hexToBytes(signature);
420
- const hashBuffer = await crypto.subtle.digest("SHA-256", sigBytes.buffer);
421
- const hashBytes = new Uint8Array(hashBuffer);
422
- return bytesToHex(hashBytes);
423
- }
424
- async function deriveKeyFromSignatureV3(signature) {
425
- const sigBytes = hexToBytes(signature);
426
- const ikm = await crypto.subtle.digest("SHA-256", sigBytes.buffer);
439
+ var AES_GCM_V3_INFO = "anuma-sdk-aes-gcm-v3";
440
+ var AES_GCM_V4_INFO = "anuma-sdk-aes-gcm-v4";
441
+ var MIN_SIGNATURE_BYTES = 64;
442
+ async function deriveHkdfAesKeyHex(signatureBytes, info) {
443
+ const sigBytes = new Uint8Array(signatureBytes);
444
+ const ikm = await crypto.subtle.digest("SHA-256", sigBytes);
427
445
  const hkdfKey = await crypto.subtle.importKey("raw", ikm, { name: "HKDF" }, false, [
428
446
  "deriveBits"
429
447
  ]);
@@ -433,13 +451,32 @@ async function deriveKeyFromSignatureV3(signature) {
433
451
  hash: "SHA-256",
434
452
  salt: new Uint8Array(32),
435
453
  // Zero salt (HKDF spec: uses hash-length zero buffer)
436
- info: SHARED_TEXT_ENCODER.encode("anuma-sdk-aes-gcm-v3")
454
+ info: SHARED_TEXT_ENCODER.encode(info)
437
455
  },
438
456
  hkdfKey,
439
457
  256
440
458
  );
441
459
  return bytesToHex(new Uint8Array(derivedBits));
442
460
  }
461
+ async function deriveKeyFromSignature(signature) {
462
+ const sigBytes = hexToBytes(signature);
463
+ const hashBuffer = await crypto.subtle.digest("SHA-256", sigBytes.buffer);
464
+ return bytesToHex(new Uint8Array(hashBuffer));
465
+ }
466
+ async function deriveKeyFromSignatureV3(signature) {
467
+ return deriveHkdfAesKeyHex(hexToBytes(signature), AES_GCM_V3_INFO);
468
+ }
469
+ async function deriveKeyFromSignatureBytes(signature) {
470
+ if (!(signature instanceof Uint8Array)) {
471
+ throw new TypeError("deriveKeyFromSignatureBytes: expected a Uint8Array signature");
472
+ }
473
+ if (signature.byteLength < MIN_SIGNATURE_BYTES) {
474
+ throw new Error(
475
+ `deriveKeyFromSignatureBytes: signature must be at least ${MIN_SIGNATURE_BYTES} bytes, got ${signature.byteLength}`
476
+ );
477
+ }
478
+ return deriveHkdfAesKeyHex(signature, AES_GCM_V4_INFO);
479
+ }
443
480
  function getStoredKeyPair(address) {
444
481
  return keyPairStore.get(address) ?? null;
445
482
  }
@@ -457,8 +494,9 @@ async function deriveKeyPairFromSignature(signature, address) {
457
494
  {
458
495
  name: "HKDF",
459
496
  hash: "SHA-256",
497
+ // EVM addresses are case-insensitive. Base58 is not — this salt stays
498
+ // behind the EVM address gate in requestKeyPair.
460
499
  salt: SHARED_TEXT_ENCODER.encode(address.toLowerCase()),
461
- // Wallet address as salt
462
500
  info: SHARED_TEXT_ENCODER.encode("ECDH-P256-KeyPair")
463
501
  // Context info
464
502
  },
@@ -3986,6 +4024,114 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
3986
4024
  return embeddedCount;
3987
4025
  }
3988
4026
 
4027
+ // src/lib/storage/mcpImages.ts
4028
+ var IMAGE_TOOL_NAMES = /* @__PURE__ */ new Set([
4029
+ "AnumaMediaMCP-anuma_create_image",
4030
+ "anuma_create_image",
4031
+ // Deprecated anuma-image-mcp tools, retained so images in already-stored
4032
+ // conversations still re-materialize on replay.
4033
+ "AnumaImageMCP-generate_cloud_image",
4034
+ "AnumaImageMCP-edit_cloud_image",
4035
+ "generate_cloud_image",
4036
+ "edit_cloud_image"
4037
+ ]);
4038
+ function toolOutputForModel(name, output) {
4039
+ if (!name || !IMAGE_TOOL_NAMES.has(name)) return output;
4040
+ try {
4041
+ const {
4042
+ imageUrl: _imageUrl,
4043
+ url: _url,
4044
+ output_images: _outputImages,
4045
+ ...rest
4046
+ } = JSON.parse(output);
4047
+ return JSON.stringify(rest);
4048
+ } catch {
4049
+ return output;
4050
+ }
4051
+ }
4052
+ var VIDEO_TOOL_NAMES = /* @__PURE__ */ new Set([
4053
+ "AnumaMediaMCP-anuma_create_video",
4054
+ "AnumaFalMCP-fal_generate_video",
4055
+ "anuma_create_video",
4056
+ "fal_generate_video"
4057
+ ]);
4058
+ var VIDEO_EXTENSIONS = ["mp4", "webm", "mov"];
4059
+ var VIDEO_EXTENSION_RE = new RegExp(`\\.(${VIDEO_EXTENSIONS.join("|")})(?:[?#]|$)`, "i");
4060
+ function videoExtensionOf(value) {
4061
+ return value?.match(VIDEO_EXTENSION_RE)?.[1]?.toLowerCase() ?? null;
4062
+ }
4063
+ function classifyUrl(url) {
4064
+ return VIDEO_EXTENSION_RE.test(url) ? "video" : "image";
4065
+ }
4066
+ function extractMCPImageUrls(content, toolCallEvents, mcpR2Domain) {
4067
+ const urls = [];
4068
+ if (toolCallEvents && toolCallEvents.length > 0) {
4069
+ for (const event of toolCallEvents) {
4070
+ if (!event.name) continue;
4071
+ if (IMAGE_TOOL_NAMES.has(event.name)) {
4072
+ try {
4073
+ const output = JSON.parse(event.output || "{}");
4074
+ const model = output.model || "image";
4075
+ const imageUrls = [
4076
+ ...new Set(
4077
+ [
4078
+ ...output.output_images?.map((i) => i.url) ?? [],
4079
+ output.imageUrl,
4080
+ output.url
4081
+ ].filter((u) => Boolean(u))
4082
+ )
4083
+ ];
4084
+ for (const url of imageUrls) {
4085
+ urls.push({ url, model, mediaType: "image" });
4086
+ }
4087
+ } catch {
4088
+ }
4089
+ } else if (VIDEO_TOOL_NAMES.has(event.name)) {
4090
+ try {
4091
+ const output = JSON.parse(event.output || "{}");
4092
+ const model = output.model || "video";
4093
+ const videoUrls = [
4094
+ ...new Set(
4095
+ [
4096
+ ...output.videos?.map((v) => v.video_url) ?? [],
4097
+ output.videoUrl,
4098
+ output.url
4099
+ ].filter((u) => Boolean(u))
4100
+ )
4101
+ ];
4102
+ for (const url of videoUrls) {
4103
+ urls.push({ url, model, mediaType: "video" });
4104
+ }
4105
+ } catch {
4106
+ }
4107
+ }
4108
+ }
4109
+ }
4110
+ if (urls.length === 0 && content) {
4111
+ const escaped = mcpR2Domain.replace(/\./g, "\\.");
4112
+ const patterns = [
4113
+ new RegExp(`https://${escaped}[^\\s"'<>)\\]]+`, "gi"),
4114
+ // Require the proxy's <svc>/<token> shape (>=2 path segments after
4115
+ // /api/v1/media/) so a third-party URL that only shallowly contains
4116
+ // /api/v1/media/ isn't returned as a portal media asset.
4117
+ new RegExp(`https?://[^\\s"'<>)\\]]+/api/v1/media/[^/\\s"'<>)\\]]+/[^\\s"'<>)\\]]+`, "gi")
4118
+ ];
4119
+ const matches = patterns.flatMap((re) => content.match(re) ?? []);
4120
+ if (matches.length > 0) {
4121
+ const seen = /* @__PURE__ */ new Set();
4122
+ for (const url of matches) {
4123
+ const normalized = url.replace(/[)"'>\s]+$/, "");
4124
+ if (!seen.has(normalized)) {
4125
+ seen.add(normalized);
4126
+ const mediaType = classifyUrl(normalized);
4127
+ urls.push({ url: normalized, model: "image", mediaType });
4128
+ }
4129
+ }
4130
+ }
4131
+ }
4132
+ return urls;
4133
+ }
4134
+
3989
4135
  // src/lib/chat/runHooks.ts
3990
4136
  function composeHooks(hooks) {
3991
4137
  const handlers = hooks.filter((h) => h !== void 0 && h !== null);
@@ -6116,6 +6262,40 @@ function extractLastUserText(messages) {
6116
6262
  function isToolErrorResult(result) {
6117
6263
  return result !== null && typeof result === "object" && "error" in result && typeof result.error === "string";
6118
6264
  }
6265
+ function serverToolCallMessages(events, messages, skipIds) {
6266
+ const seen = new Set(skipIds);
6267
+ for (const m of messages) {
6268
+ if (m.tool_call_id) seen.add(m.tool_call_id);
6269
+ for (const tc of m.tool_calls ?? []) if (tc.id) seen.add(tc.id);
6270
+ }
6271
+ const executed = [];
6272
+ for (const event of events ?? []) {
6273
+ if (!event.id || event.output === void 0 || event.output === null || seen.has(event.id)) {
6274
+ continue;
6275
+ }
6276
+ seen.add(event.id);
6277
+ executed.push(event);
6278
+ }
6279
+ if (executed.length === 0) return [];
6280
+ return [
6281
+ {
6282
+ role: "assistant",
6283
+ content: void 0,
6284
+ tool_calls: executed.map((event) => ({
6285
+ id: event.id,
6286
+ type: "function",
6287
+ function: { name: event.name, arguments: event.arguments }
6288
+ }))
6289
+ },
6290
+ ...executed.map(
6291
+ (event) => ({
6292
+ role: "tool",
6293
+ tool_call_id: event.id,
6294
+ content: [{ type: "text", text: toolOutputForModel(event.name, event.output ?? "") }]
6295
+ })
6296
+ )
6297
+ ];
6298
+ }
6119
6299
  function getToolName(tool) {
6120
6300
  const func = tool.function;
6121
6301
  const nestedName = func?.name;
@@ -6885,7 +7065,14 @@ Executing tool: ${toolInfo}
6885
7065
  }
6886
7066
  }))
6887
7067
  };
6888
- const toolResultMessages = [assistantMessage];
7068
+ const toolResultMessages = [
7069
+ ...serverToolCallMessages(
7070
+ currentAccumulator.toolCallEvents,
7071
+ currentMessages,
7072
+ new Set(toolCallsToExecute.map((tc) => tc.id))
7073
+ ),
7074
+ assistantMessage
7075
+ ];
6889
7076
  for (const execResult of continueResults) {
6890
7077
  const resultContent = execResult.error ? `Error: ${execResult.error}` : safeJsonStringify(execResult.result);
6891
7078
  toolResultMessages.push({
@@ -9568,100 +9755,6 @@ function isSupportedMediaType(mimeType) {
9568
9755
  // src/lib/db/media/operations.ts
9569
9756
  import { Q as Q4 } from "@nozbe/watermelondb";
9570
9757
 
9571
- // src/lib/storage/mcpImages.ts
9572
- var IMAGE_TOOL_NAMES = /* @__PURE__ */ new Set([
9573
- "AnumaMediaMCP-anuma_create_image",
9574
- "anuma_create_image",
9575
- // Deprecated anuma-image-mcp tools, retained so images in already-stored
9576
- // conversations still re-materialize on replay.
9577
- "AnumaImageMCP-generate_cloud_image",
9578
- "AnumaImageMCP-edit_cloud_image",
9579
- "generate_cloud_image",
9580
- "edit_cloud_image"
9581
- ]);
9582
- var VIDEO_TOOL_NAMES = /* @__PURE__ */ new Set([
9583
- "AnumaMediaMCP-anuma_create_video",
9584
- "AnumaFalMCP-fal_generate_video",
9585
- "anuma_create_video",
9586
- "fal_generate_video"
9587
- ]);
9588
- var VIDEO_EXTENSIONS = ["mp4", "webm", "mov"];
9589
- var VIDEO_EXTENSION_RE = new RegExp(`\\.(${VIDEO_EXTENSIONS.join("|")})(?:[?#]|$)`, "i");
9590
- function videoExtensionOf(value) {
9591
- return value?.match(VIDEO_EXTENSION_RE)?.[1]?.toLowerCase() ?? null;
9592
- }
9593
- function classifyUrl(url) {
9594
- return VIDEO_EXTENSION_RE.test(url) ? "video" : "image";
9595
- }
9596
- function extractMCPImageUrls(content, toolCallEvents, mcpR2Domain) {
9597
- const urls = [];
9598
- if (toolCallEvents && toolCallEvents.length > 0) {
9599
- for (const event of toolCallEvents) {
9600
- if (!event.name) continue;
9601
- if (IMAGE_TOOL_NAMES.has(event.name)) {
9602
- try {
9603
- const output = JSON.parse(event.output || "{}");
9604
- const model = output.model || "image";
9605
- const imageUrls = [
9606
- ...new Set(
9607
- [
9608
- ...output.output_images?.map((i) => i.url) ?? [],
9609
- output.imageUrl,
9610
- output.url
9611
- ].filter((u) => Boolean(u))
9612
- )
9613
- ];
9614
- for (const url of imageUrls) {
9615
- urls.push({ url, model, mediaType: "image" });
9616
- }
9617
- } catch {
9618
- }
9619
- } else if (VIDEO_TOOL_NAMES.has(event.name)) {
9620
- try {
9621
- const output = JSON.parse(event.output || "{}");
9622
- const model = output.model || "video";
9623
- const videoUrls = [
9624
- ...new Set(
9625
- [
9626
- ...output.videos?.map((v) => v.video_url) ?? [],
9627
- output.videoUrl,
9628
- output.url
9629
- ].filter((u) => Boolean(u))
9630
- )
9631
- ];
9632
- for (const url of videoUrls) {
9633
- urls.push({ url, model, mediaType: "video" });
9634
- }
9635
- } catch {
9636
- }
9637
- }
9638
- }
9639
- }
9640
- if (urls.length === 0 && content) {
9641
- const escaped = mcpR2Domain.replace(/\./g, "\\.");
9642
- const patterns = [
9643
- new RegExp(`https://${escaped}[^\\s"'<>)\\]]+`, "gi"),
9644
- // Require the proxy's <svc>/<token> shape (>=2 path segments after
9645
- // /api/v1/media/) so a third-party URL that only shallowly contains
9646
- // /api/v1/media/ isn't returned as a portal media asset.
9647
- new RegExp(`https?://[^\\s"'<>)\\]]+/api/v1/media/[^/\\s"'<>)\\]]+/[^\\s"'<>)\\]]+`, "gi")
9648
- ];
9649
- const matches = patterns.flatMap((re) => content.match(re) ?? []);
9650
- if (matches.length > 0) {
9651
- const seen = /* @__PURE__ */ new Set();
9652
- for (const url of matches) {
9653
- const normalized = url.replace(/[)"'>\s]+$/, "");
9654
- if (!seen.has(normalized)) {
9655
- seen.add(normalized);
9656
- const mediaType = classifyUrl(normalized);
9657
- urls.push({ url: normalized, model: "image", mediaType });
9658
- }
9659
- }
9660
- }
9661
- }
9662
- return urls;
9663
- }
9664
-
9665
9758
  // src/lib/storage/opfs.ts
9666
9759
  var FILE_PLACEHOLDER_PREFIX = "__SDKFILE__";
9667
9760
  var FILE_PLACEHOLDER_SUFFIX = "__";
@@ -22053,24 +22146,10 @@ async function storedToLlmapiMessage(stored, encryptionKey, resolveMediaByIds) {
22053
22146
  });
22054
22147
  for (const event of stored.toolCallEvents) {
22055
22148
  if (event.id && event.output !== void 0 && event.output !== null) {
22056
- let toolOutput = event.output;
22057
- if (event.name && IMAGE_TOOL_NAMES.has(event.name)) {
22058
- try {
22059
- const parsed = JSON.parse(toolOutput);
22060
- const {
22061
- imageUrl: _imageUrl,
22062
- url: _url,
22063
- output_images: _outputImages,
22064
- ...rest
22065
- } = parsed;
22066
- toolOutput = JSON.stringify(rest);
22067
- } catch {
22068
- }
22069
- }
22070
22149
  messages.push({
22071
22150
  role: "tool",
22072
22151
  tool_call_id: event.id,
22073
- content: [{ type: "text", text: toolOutput }]
22152
+ content: [{ type: "text", text: toolOutputForModel(event.name, event.output) }]
22074
22153
  });
22075
22154
  }
22076
22155
  }
@@ -34903,6 +34982,7 @@ export {
34903
34982
  deleteVaultFolderOp,
34904
34983
  deleteVaultMemoryOp,
34905
34984
  dequantizeEmbedding,
34985
+ deriveKeyFromSignatureBytes,
34906
34986
  eagerEmbedContent,
34907
34987
  embedAllMessages,
34908
34988
  embedMessage,