@anuma/sdk 6.8.2 → 6.10.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.
@@ -8114,6 +8114,14 @@ declare function relinkMemoryTopicsOp(ctx: VaultMemoryOperationsContext, memoryI
8114
8114
  * row has: a curated memory's topics are recorded as `user`, everything else as
8115
8115
  * `auto`. Skips deleted, foreign-user, unlinked rows, and rows that already have
8116
8116
  * a record. Returns the ids filled.
8117
+ *
8118
+ * Runs as ONE writer over the whole (caller-bounded) list, in two phases:
8119
+ * resolve every row's write — all the awaits — and only then prepare and batch,
8120
+ * synchronously. Resolving and preparing per row inside its own writer is what
8121
+ * fired WatermelonDB's "wasn't sent to batch() synchronously" diagnostic once
8122
+ * per memory (~107 on a single dev launch, sdk#891); it also cost N writes.
8123
+ * Same treatment as {@link stampTopicsExtractedAtOp}, including its
8124
+ * transpilation hazard — the prepare pass MUST stay a `.map()`.
8117
8125
  */
8118
8126
  declare function backfillMemoryTopicsOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[]): Promise<string[]>;
8119
8127
  declare function deleteAllVaultMemoriesForUserOp(ctx: VaultMemoryOperationsContext, userId: string): Promise<number>;
@@ -8398,6 +8406,22 @@ interface TurnCompleteEvent {
8398
8406
  * previously indistinguishable (both surfaced as zero candidates).
8399
8407
  */
8400
8408
  outcome: ExtractOutcome;
8409
+ /**
8410
+ * Present only alongside `outcome: "empty-after-retry"` — WHICH failure ended
8411
+ * the turn (#888).
8412
+ *
8413
+ * `outcome` says extraction gave up; this says why, from a stable enum. The
8414
+ * distinction is the whole point: a 2026-08-11 audit measured ~63% of
8415
+ * production extraction turns ending in `empty-after-retry` and could not tell
8416
+ * from telemetry whether the cause was the freeloader 403 everyone assumed or
8417
+ * something else. It took a Prometheus cross-check to find the real one — the
8418
+ * portal returning HTTP 200 with an empty body, which it counts as a success.
8419
+ *
8420
+ * Forward `failure.reason` into your extraction analytics event; all three
8421
+ * fields are bounded (an enum, an HTTP status, a small attempt count) and none
8422
+ * carries content.
8423
+ */
8424
+ failure?: PortalLlmFailure;
8401
8425
  }
8402
8426
  /** @public */
8403
8427
  /**
@@ -9663,6 +9687,39 @@ interface TopicExtractOptions extends PortalLlmAuth {
9663
9687
  * later sweep, never stamp them.
9664
9688
  */
9665
9689
  declare function extractEntitiesForMemories(memories: readonly TopicExtractionInput[], options: TopicExtractOptions): Promise<Map<string, ExtractedEntity[]>>;
9690
+ /**
9691
+ * Why one memory was skipped by a topic sweep.
9692
+ *
9693
+ * Split along the line that actually matters operationally — did the sweep
9694
+ * DECLINE this row on purpose, or did something BREAK:
9695
+ *
9696
+ * Deliberate (healthy; a sweep of nothing but these is a success):
9697
+ * - `excluded` — deleted, owned by another user, or `topicsUserManaged`.
9698
+ * - `link-declined` — the entity-link write's in-row guard declined (the row
9699
+ * became user-managed / deleted / absent mid-run).
9700
+ * - `stamp-declined` — same, caught by the stamp op's own re-check.
9701
+ *
9702
+ * Degraded (something is wrong; see {@link isDegradedTopicSkip}):
9703
+ * - `llm-unanswered` — the batch failed or the model omitted this id. THE one
9704
+ * to alarm on: it is how a wholly broken sweep looks.
9705
+ * - `unreadable` — the row could not be loaded/decrypted.
9706
+ * - `not-found` — the lookup threw (absent row or read fault).
9707
+ * - `link-failed` — the entity-link write threw.
9708
+ *
9709
+ * @public
9710
+ */
9711
+ type TopicSkipReason = "excluded" | "link-declined" | "stamp-declined" | "llm-unanswered" | "unreadable" | "not-found" | "link-failed";
9712
+ /**
9713
+ * Whether a skip reason means the sweep FAILED on that row, rather than
9714
+ * deliberately passing over it.
9715
+ *
9716
+ * Exported so callers classify identically instead of each re-deriving the
9717
+ * split — the reason this type exists is that one wrong grouping turns a broken
9718
+ * sweep back into a healthy-looking one.
9719
+ *
9720
+ * @public
9721
+ */
9722
+ declare function isDegradedTopicSkip(reason: TopicSkipReason): boolean;
9666
9723
  /** Outcome of one {@link extractAndLinkEntitiesForMemoriesOp} run. */
9667
9724
  interface TopicExtractionRunResult {
9668
9725
  /** memoryId → entities the LLM returned (post-validation, post-linking). */
@@ -9675,6 +9732,24 @@ interface TopicExtractionRunResult {
9675
9732
  * LLM batches. Skipped ids are not stamped, so failed batches are retried
9676
9733
  * by a later sweep — callers should apply their own attempt caps. */
9677
9734
  skippedIds: string[];
9735
+ /**
9736
+ * Why each id in {@link skippedIds} was skipped.
9737
+ *
9738
+ * `skippedIds` alone cannot distinguish a sweep that deliberately declined
9739
+ * work from one that FAILED: a run where every LLM batch errored and a run
9740
+ * over rows the user has taken manual control of produce an identical array.
9741
+ * That is the same blindness `outcome: 'empty-after-retry'` had before #888 —
9742
+ * a degradation wearing the shape of normal control flow.
9743
+ *
9744
+ * It matters here because topics feed the entity recall lane, so a silently
9745
+ * failing sweep means memories that exist but cannot be found by entity, with
9746
+ * nothing in production saying so.
9747
+ *
9748
+ * Populated in lockstep with `skippedIds` (single `skip()` helper), so the two
9749
+ * cannot drift. Group by {@link isDegradedTopicSkip} to separate "declined" from
9750
+ * "broke".
9751
+ */
9752
+ skippedReasons: Map<string, TopicSkipReason>;
9678
9753
  }
9679
9754
  /**
9680
9755
  * Run LLM topic extraction over existing vault memories and persist the
@@ -15523,4 +15598,4 @@ declare function renderAnumaTree(node: AnumaNode): React.ReactElement | null;
15523
15598
  */
15524
15599
  declare function renderAnumaJsx(jsx: string): React.ReactElement | null;
15525
15600
 
15526
- 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 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, 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, 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 GraphTraversalOptions, type GroupProps, HARD_DELETE_WINDOW_MS, type ICloudAuthContextValue, ICloudAuthProvider, type ICloudAuthProviderProps, type ICloudExportResult, type ICloudImportResult, INFERENCE_ID_HEADER, 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 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 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 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 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 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 VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, 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, backfillMemoryEntityUserIdsOp, backfillMemoryTopicsOp, 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, 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, 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, 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, isCalendarCallback, isDriveCallback, isGithubCallback, isHtmlTag, isNotionCallback, isOPFSSupported, isR2UrlExpired, isRerankerAvailable, isSupportedFile, isSupportedMediaType, linkMemoryEntitiesOp, 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, 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, writeEncryptedFile };
15601
+ 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 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, 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, 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 GraphTraversalOptions, type GroupProps, HARD_DELETE_WINDOW_MS, type ICloudAuthContextValue, ICloudAuthProvider, type ICloudAuthProviderProps, type ICloudExportResult, type ICloudImportResult, INFERENCE_ID_HEADER, 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 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 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 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 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 VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, 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, backfillMemoryEntityUserIdsOp, backfillMemoryTopicsOp, 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, 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, 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, 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, isCalendarCallback, isDegradedTopicSkip, isDriveCallback, isGithubCallback, isHtmlTag, isNotionCallback, isOPFSSupported, isR2UrlExpired, isRerankerAvailable, isSupportedFile, isSupportedMediaType, linkMemoryEntitiesOp, 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, 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, writeEncryptedFile };
@@ -178,7 +178,7 @@ import {
178
178
  updateVaultMemoryOp,
179
179
  useEncryption,
180
180
  vaultMemoryToStored
181
- } from "./chunk-NPJSO5ES.mjs";
181
+ } from "./chunk-EJ65X4GI.mjs";
182
182
  import {
183
183
  PiiRedactor,
184
184
  createStreamingDeAnonymizer,
@@ -8357,7 +8357,7 @@ function createAutoExtractor(options) {
8357
8357
  const t0 = Date.now();
8358
8358
  void (async () => {
8359
8359
  try {
8360
- const { candidates, results, failedCount, outcome } = await extractAndRetain(
8360
+ const { candidates, results, failedCount, outcome, failure } = await extractAndRetain(
8361
8361
  window2,
8362
8362
  retainCtx,
8363
8363
  {
@@ -8397,7 +8397,11 @@ function createAutoExtractor(options) {
8397
8397
  failedCount,
8398
8398
  durationMs: Date.now() - t0,
8399
8399
  conversationId,
8400
- outcome
8400
+ outcome,
8401
+ // Only set alongside `outcome: "empty-after-retry"`. Spread so the key
8402
+ // is absent rather than explicitly undefined on a healthy turn —
8403
+ // analytics backends store an explicit undefined as a real value.
8404
+ ...failure !== void 0 && { failure }
8401
8405
  });
8402
8406
  } catch (err) {
8403
8407
  options.onError?.(err instanceof Error ? err : new Error(String(err)), conversationId);
@@ -9661,6 +9665,18 @@ function parseTopicResponse(parsed, validIds) {
9661
9665
  }
9662
9666
  return out;
9663
9667
  }
9668
+ var DEGRADED_TOPIC_SKIP = {
9669
+ excluded: false,
9670
+ "link-declined": false,
9671
+ "stamp-declined": false,
9672
+ "llm-unanswered": true,
9673
+ unreadable: true,
9674
+ "not-found": true,
9675
+ "link-failed": true
9676
+ };
9677
+ function isDegradedTopicSkip(reason) {
9678
+ return DEGRADED_TOPIC_SKIP[reason] === true;
9679
+ }
9664
9680
  async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
9665
9681
  const entityCtx = ctx.entityCtx;
9666
9682
  if (!entityCtx) {
@@ -9669,17 +9685,24 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
9669
9685
  const log = getLogger();
9670
9686
  const extractedAt = options.now ?? Date.now();
9671
9687
  const skippedIds = [];
9688
+ const skippedReasons = /* @__PURE__ */ new Map();
9689
+ const skip = (id, reason) => {
9690
+ if (skippedReasons.has(id)) return;
9691
+ skippedIds.push(id);
9692
+ skippedReasons.set(id, reason);
9693
+ };
9672
9694
  const inputs = [];
9673
- for (const id of memoryIds) {
9695
+ for (const id of new Set(memoryIds)) {
9674
9696
  let record;
9675
9697
  try {
9676
9698
  record = await ctx.vaultMemoryCollection.find(id);
9677
- } catch {
9678
- skippedIds.push(id);
9699
+ } catch (err) {
9700
+ log.warn("[memory/topics] vault lookup failed for extraction", err);
9701
+ skip(id, "not-found");
9679
9702
  continue;
9680
9703
  }
9681
9704
  if (record.isDeleted || ctx.userId !== void 0 && record.userId !== ctx.userId || record.topicsUserManaged) {
9682
- skippedIds.push(id);
9705
+ skip(id, "excluded");
9683
9706
  continue;
9684
9707
  }
9685
9708
  try {
@@ -9692,7 +9715,7 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
9692
9715
  inputs.push({ id, content: stored.content });
9693
9716
  } catch (err) {
9694
9717
  log.warn("[memory/topics] failed to load memory for extraction", err);
9695
- skippedIds.push(id);
9718
+ skip(id, "unreadable");
9696
9719
  }
9697
9720
  }
9698
9721
  const entitiesByMemory = await extractEntitiesForMemories(inputs, options);
@@ -9700,19 +9723,19 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
9700
9723
  for (const input of inputs) {
9701
9724
  const entities = entitiesByMemory.get(input.id);
9702
9725
  if (entities === void 0) {
9703
- skippedIds.push(input.id);
9726
+ skip(input.id, "llm-unanswered");
9704
9727
  continue;
9705
9728
  }
9706
9729
  try {
9707
9730
  const linked = await replaceMemoryEntitiesGuardedOp(entityCtx, input.id, entities);
9708
9731
  if (linked === null) {
9709
- skippedIds.push(input.id);
9732
+ skip(input.id, "link-declined");
9710
9733
  entitiesByMemory.delete(input.id);
9711
9734
  continue;
9712
9735
  }
9713
9736
  } catch (err) {
9714
9737
  log.warn("[memory/topics] replaceMemoryEntitiesGuardedOp failed", err);
9715
- skippedIds.push(input.id);
9738
+ skip(input.id, "link-failed");
9716
9739
  entitiesByMemory.delete(input.id);
9717
9740
  continue;
9718
9741
  }
@@ -9722,11 +9745,11 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
9722
9745
  const stampedSet = new Set(stampedIds);
9723
9746
  for (const id of toStamp) {
9724
9747
  if (!stampedSet.has(id)) {
9725
- skippedIds.push(id);
9748
+ skip(id, "stamp-declined");
9726
9749
  entitiesByMemory.delete(id);
9727
9750
  }
9728
9751
  }
9729
- return { entitiesByMemory, stampedIds, skippedIds };
9752
+ return { entitiesByMemory, stampedIds, skippedIds, skippedReasons };
9730
9753
  }
9731
9754
 
9732
9755
  // src/lib/memory/verifySupport.ts
@@ -25307,6 +25330,7 @@ export {
25307
25330
  insertChild,
25308
25331
  isAnumaTag,
25309
25332
  isCalendarCallback,
25333
+ isDegradedTopicSkip,
25310
25334
  isDriveCallback,
25311
25335
  isGithubCallback,
25312
25336
  isHtmlTag,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-NPJSO5ES.mjs";
3
+ } from "./chunk-EJ65X4GI.mjs";
4
4
  import "./chunk-CJ32HO6Q.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
@@ -16391,13 +16391,13 @@ async function upsertEntitiesInWrite(ctx, entities) {
16391
16391
  }
16392
16392
  const unique = Array.from(kindByName.keys());
16393
16393
  const out = /* @__PURE__ */ new Map();
16394
- if (unique.length === 0) return { entities: out, operations: [] };
16394
+ if (unique.length === 0) return { entities: out, operations: [], kindBackfills: [] };
16395
16395
  const existing = await ctx.entityCollection.query(import_watermelondb2.Q.where("canonical_name", import_watermelondb2.Q.oneOf(unique))).fetch();
16396
16396
  const existingNames = new Set(existing.map((e) => e.canonicalName));
16397
- const updates = existing.filter((e) => {
16397
+ const kindBackfills = existing.filter((e) => {
16398
16398
  const incoming = kindByName.get(e.canonicalName);
16399
16399
  return incoming !== void 0 && (e.kind === null || e.kind === void 0 || e.kind === "");
16400
- });
16400
+ }).map((record) => ({ record, kind: kindByName.get(record.canonicalName) }));
16401
16401
  const missing = unique.filter((n) => !existingNames.has(n));
16402
16402
  const created = missing.map(
16403
16403
  (name) => ctx.entityCollection.prepareCreate((record) => {
@@ -16406,14 +16406,19 @@ async function upsertEntitiesInWrite(ctx, entities) {
16406
16406
  if (kind !== void 0) record._setRaw("kind", kind);
16407
16407
  })
16408
16408
  );
16409
- const updated = updates.map(
16410
- (e) => e.prepareUpdate((record) => {
16411
- record._setRaw("kind", kindByName.get(e.canonicalName));
16412
- })
16413
- );
16414
16409
  for (const e of existing) out.set(e.canonicalName, entityToStored(e));
16415
16410
  for (const record of created) out.set(record.canonicalName, entityToStored(record));
16416
- return { entities: out, operations: [...created, ...updated] };
16411
+ for (const { record, kind } of kindBackfills) {
16412
+ out.set(record.canonicalName, { ...entityToStored(record), kind });
16413
+ }
16414
+ return { entities: out, operations: created, kindBackfills };
16415
+ }
16416
+ function prepareKindBackfills(backfills) {
16417
+ return backfills.map(
16418
+ ({ record, kind }) => record.prepareUpdate((r) => {
16419
+ r._setRaw("kind", kind);
16420
+ })
16421
+ );
16417
16422
  }
16418
16423
  async function findVaultRowInWrite(ctx, memoryId) {
16419
16424
  try {
@@ -16463,10 +16468,12 @@ function topicsForEntities(entities, displayNames, source) {
16463
16468
  function toEntityObjects(entityInputs) {
16464
16469
  return entityInputs.map((e) => typeof e === "string" ? { name: e } : e);
16465
16470
  }
16466
- async function prepareMemoryTopicsUpdate(ctx, memoryId, linked, inputs, source) {
16471
+ async function resolveMemoryTopicsWrite(ctx, memoryId, linked, inputs, source) {
16467
16472
  const row = await findVaultRowInWrite(ctx, memoryId);
16468
- const write = resolveTopicsWrite(row, linked, displayNamesOf(toEntityObjects(inputs)), source);
16469
- return write === null ? null : prepareTopicsUpdate(write.row, write.topics, Date.now());
16473
+ return resolveTopicsWrite(row, linked, displayNamesOf(toEntityObjects(inputs)), source);
16474
+ }
16475
+ function prepareMemoryTopicsUpdate(write) {
16476
+ return prepareTopicsUpdate(write.row, write.topics, Date.now());
16470
16477
  }
16471
16478
  async function linkMemoryEntitiesOp(ctx, memoryId, entityInputs, options) {
16472
16479
  if (entityInputs.length === 0) return [];
@@ -16475,15 +16482,16 @@ async function linkMemoryEntitiesOp(ctx, memoryId, entityInputs, options) {
16475
16482
  let skipped = false;
16476
16483
  let entities = [];
16477
16484
  await ctx.database.write(async () => {
16478
- const { entities: byName, operations: entityOps } = await upsertEntitiesInWrite(
16479
- ctx,
16480
- normalized
16481
- );
16485
+ const {
16486
+ entities: byName,
16487
+ operations: entityOps,
16488
+ kindBackfills
16489
+ } = await upsertEntitiesInWrite(ctx, normalized);
16482
16490
  entities = Array.from(byName.values());
16483
16491
  const vaultRow = await findVaultRowInWrite(ctx, memoryId);
16484
16492
  if (options?.unlessTopicsUserManaged && autoLinkBlocked(vaultRow)) {
16485
- if (entityOps.length > 0) {
16486
- await ctx.database.batch(...entityOps);
16493
+ if (entityOps.length > 0 || kindBackfills.length > 0) {
16494
+ await ctx.database.batch(...entityOps, ...prepareKindBackfills(kindBackfills));
16487
16495
  }
16488
16496
  skipped = true;
16489
16497
  return;
@@ -16503,7 +16511,9 @@ async function linkMemoryEntitiesOp(ctx, memoryId, entityInputs, options) {
16503
16511
  displayNamesOf(normalized),
16504
16512
  options?.topicsSource ?? "auto"
16505
16513
  );
16506
- if (entityOps.length === 0 && toCreate.length === 0 && topicsWrite === null) return;
16514
+ if (entityOps.length === 0 && kindBackfills.length === 0 && toCreate.length === 0 && topicsWrite === null) {
16515
+ return;
16516
+ }
16507
16517
  const linkOps = toCreate.map(
16508
16518
  (e) => ctx.memoryEntityCollection.prepareCreate((record) => {
16509
16519
  record._setRaw("memory_id", memoryId);
@@ -16513,6 +16523,7 @@ async function linkMemoryEntitiesOp(ctx, memoryId, entityInputs, options) {
16513
16523
  );
16514
16524
  await ctx.database.batch(
16515
16525
  ...entityOps,
16526
+ ...prepareKindBackfills(kindBackfills),
16516
16527
  ...linkOps,
16517
16528
  ...topicsWrite ? [prepareTopicsUpdate(topicsWrite.row, topicsWrite.topics, Date.now())] : []
16518
16529
  );
@@ -16550,10 +16561,11 @@ async function replaceMemoryEntities(ctx, memoryId, entityInputs, options) {
16550
16561
  skipped = true;
16551
16562
  return;
16552
16563
  }
16553
- const { entities: byName, operations: entityOps } = await upsertEntitiesInWrite(
16554
- ctx,
16555
- normalized
16556
- );
16564
+ const {
16565
+ entities: byName,
16566
+ operations: entityOps,
16567
+ kindBackfills
16568
+ } = await upsertEntitiesInWrite(ctx, normalized);
16557
16569
  entities = Array.from(byName.values());
16558
16570
  const existingLinks = await ctx.memoryEntityCollection.query(import_watermelondb2.Q.where("memory_id", memoryId)).fetch();
16559
16571
  const keep = new Set(entities.map((e) => e.uniqueId));
@@ -16566,12 +16578,13 @@ async function replaceMemoryEntities(ctx, memoryId, entityInputs, options) {
16566
16578
  displayNamesOf(normalized),
16567
16579
  options.topicsSource
16568
16580
  );
16569
- if (entityOps.length === 0 && toCreate.length === 0 && toDestroy.length === 0 && topicsWrite === null) {
16581
+ if (entityOps.length === 0 && kindBackfills.length === 0 && toCreate.length === 0 && toDestroy.length === 0 && topicsWrite === null) {
16570
16582
  return;
16571
16583
  }
16572
16584
  const orphans = await findOrphanedEntities(ctx, memoryId, toDestroy);
16573
16585
  await ctx.database.batch(
16574
16586
  ...entityOps,
16587
+ ...prepareKindBackfills(kindBackfills),
16575
16588
  ...toCreate.map(
16576
16589
  (e) => ctx.memoryEntityCollection.prepareCreate((record) => {
16577
16590
  record._setRaw("memory_id", memoryId);
@@ -17622,27 +17635,36 @@ async function backfillMemoryTopicsOp(ctx, memoryIds) {
17622
17635
  if (!entityCtx) {
17623
17636
  throw new Error("backfillMemoryTopicsOp requires ctx.entityCtx");
17624
17637
  }
17638
+ const uniqueIds = Array.from(new Set(memoryIds));
17639
+ if (uniqueIds.length === 0) return [];
17625
17640
  const filled = [];
17626
- for (const id of Array.from(new Set(memoryIds))) {
17627
- let record;
17628
- try {
17629
- record = await ctx.vaultMemoryCollection.find(id);
17630
- } catch {
17631
- continue;
17632
- }
17633
- if (record.isDeleted || !isOwnedByCtxUser(ctx, record)) continue;
17634
- if (parseTopics(record.topics) !== null) continue;
17635
- const links = await entityCtx.memoryEntityCollection.query(import_watermelondb3.Q.where("memory_id", id)).unsafeFetchRaw();
17636
- const entityIds = links.map((l) => String(l.entity_id));
17637
- if (entityIds.length === 0) continue;
17638
- const entities = await entityCtx.entityCollection.query(import_watermelondb3.Q.where("id", import_watermelondb3.Q.oneOf(entityIds))).fetch();
17639
- if (entities.length === 0) continue;
17640
- const source = record.topicsUserManaged ? "user" : "auto";
17641
+ const CHUNK = 500;
17642
+ for (let i = 0; i < uniqueIds.length; i += CHUNK) {
17643
+ const chunkIds = uniqueIds.slice(i, i + CHUNK);
17641
17644
  await ctx.database.write(async () => {
17642
- const topicsOp = await prepareMemoryTopicsUpdate(entityCtx, id, entities, [], source);
17643
- if (!topicsOp) return;
17644
- await ctx.database.batch(topicsOp);
17645
- filled.push(id);
17645
+ const writes = [];
17646
+ for (const id of chunkIds) {
17647
+ let record;
17648
+ try {
17649
+ record = await ctx.vaultMemoryCollection.find(id);
17650
+ } catch {
17651
+ continue;
17652
+ }
17653
+ if (record.isDeleted || !isOwnedByCtxUser(ctx, record)) continue;
17654
+ if (parseTopics(record.topics) !== null) continue;
17655
+ const links = await entityCtx.memoryEntityCollection.query(import_watermelondb3.Q.where("memory_id", id)).unsafeFetchRaw();
17656
+ const entityIds = links.map((l) => String(l.entity_id));
17657
+ if (entityIds.length === 0) continue;
17658
+ const entities = await entityCtx.entityCollection.query(import_watermelondb3.Q.where("id", import_watermelondb3.Q.oneOf(entityIds))).fetch();
17659
+ if (entities.length === 0) continue;
17660
+ const source = record.topicsUserManaged ? "user" : "auto";
17661
+ const write = await resolveMemoryTopicsWrite(entityCtx, id, entities, [], source);
17662
+ if (write) writes.push(write);
17663
+ }
17664
+ if (writes.length === 0) return;
17665
+ const prepared = writes.map(prepareMemoryTopicsUpdate);
17666
+ await ctx.database.batch(...prepared);
17667
+ for (const write of writes) filled.push(write.row.id);
17646
17668
  });
17647
17669
  }
17648
17670
  return filled;
@@ -20856,7 +20878,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
20856
20878
  subQueries = decomp.subQueries;
20857
20879
  }
20858
20880
  }
20859
- const { recall: recall2 } = await import("./recall-RTW7T7KR.mjs");
20881
+ const { recall: recall2 } = await import("./recall-T7CNXTQ3.mjs");
20860
20882
  let recallDegraded = [];
20861
20883
  const result = await recall2(
20862
20884
  query,