@anuma/sdk 3.5.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8152,6 +8152,66 @@ interface LlmNeighborRefinerOptions extends PortalLlmAuth {
8152
8152
  */
8153
8153
  declare function createLlmNeighborRefiner(options: LlmNeighborRefinerOptions): NeighborRefiner;
8154
8154
 
8155
+ /**
8156
+ * Profile salience — profile-worthiness scoring for vault facts (#706).
8157
+ *
8158
+ * Distinct from query-time relevance (`recall` fusion). Answers: "is this
8159
+ * fact worth putting on a shareable profile?" using durable type, proof
8160
+ * density, and C2 observation trend. Pure + deterministic — no LLM, no DB.
8161
+ *
8162
+ * Used by:
8163
+ * - `synthesizeProfile` facet recall (default factTypeWeights)
8164
+ * - Publish-review UIs via {@link rankProfileCandidates} (nearby / client)
8165
+ *
8166
+ * Persisted `importance` is deferred until publish flow proves the need.
8167
+ */
8168
+
8169
+ /** Proof-count curve weight inside {@link scoreProfileSalience}. */
8170
+ declare const DEFAULT_PROFILE_PROOF_ALPHA = 0.2;
8171
+ /**
8172
+ * Per-FactType multipliers for profile synthesis / salience.
8173
+ * Durable identity-class types (never age-archive in decay) rank higher;
8174
+ * ephemeral plan/ongoing_context rank lower. Untyped / `other` stay neutral.
8175
+ */
8176
+ declare const DEFAULT_PROFILE_FACT_TYPE_WEIGHTS: Partial<Record<FactType, number>>;
8177
+ /** C2 trend multipliers for profile-worthiness. */
8178
+ declare const DEFAULT_PROFILE_TREND_MULTIPLIERS: Record<ObservationTrend, number>;
8179
+ interface ProfileSalienceInput extends ObservationTrendInput {
8180
+ /** Vault memory id — required for {@link rankProfileCandidates}. */
8181
+ id: string;
8182
+ /** Extractor FactType; null/undefined → neutral weight (1.0). */
8183
+ factType?: string | null;
8184
+ }
8185
+ interface RankedProfileCandidate {
8186
+ id: string;
8187
+ score: number;
8188
+ trend: ObservationTrend;
8189
+ factType?: string | null;
8190
+ proofCount: number;
8191
+ }
8192
+ interface ScoreProfileSalienceOptions {
8193
+ /** Override type weights (merged over {@link DEFAULT_PROFILE_FACT_TYPE_WEIGHTS}). */
8194
+ factTypeWeights?: Partial<Record<FactType, number>>;
8195
+ /** Override trend multipliers. */
8196
+ trendMultipliers?: Partial<Record<ObservationTrend, number>>;
8197
+ /** Proof-count α. Default: {@link DEFAULT_PROFILE_PROOF_ALPHA}. */
8198
+ proofCountAlpha?: number;
8199
+ }
8200
+ /**
8201
+ * Score a vault fact for profile-worthiness.
8202
+ *
8203
+ * `typeWeight * (1 + α·log(1+proofCount) − α·log(2)) * trendMultiplier`
8204
+ *
8205
+ * The proof term mirrors vault fusion's log curve (neutral at proofCount=1).
8206
+ * Pass `now` for deterministic evals.
8207
+ */
8208
+ declare function scoreProfileSalience(input: ProfileSalienceInput, now?: number, options?: ScoreProfileSalienceOptions): number;
8209
+ /**
8210
+ * Rank vault facts by profile-worthiness (descending score).
8211
+ * Ties broken by higher proofCount, then id ascending for stability.
8212
+ */
8213
+ declare function rankProfileCandidates(inputs: readonly ProfileSalienceInput[], now?: number, options?: ScoreProfileSalienceOptions): RankedProfileCandidate[];
8214
+
8155
8215
  /**
8156
8216
  * Unified Recall API — single retrieval surface above vault + engine.
8157
8217
  *
@@ -8289,6 +8349,12 @@ interface ReflectOptions extends RecallOptions, PortalLlmAuth {
8289
8349
  fetchFn?: typeof fetch;
8290
8350
  /** Optional JSON Schema to coerce structured outputs. */
8291
8351
  responseSchema?: Record<string, unknown>;
8352
+ /**
8353
+ * Skip Stage-1 {@link recall} and synthesize from these memories instead.
8354
+ * Used by `synthesizeProfile` after intersecting recall with a
8355
+ * `reviewedMemoryIds` gate so the LLM never sees unreviewed evidence.
8356
+ */
8357
+ memories?: RankedMemory[];
8292
8358
  }
8293
8359
  interface ReflectResult {
8294
8360
  /** The synthesized answer text. */
@@ -8412,8 +8478,9 @@ interface ProfileSection {
8412
8478
  /** Fingerprint of the config that produced a {@link ProfileDoc}. Delta reuse
8413
8479
  * (both the wholesale fast path and per-section reuse) is only valid when the
8414
8480
  * current call's config matches — otherwise reused sections could carry the
8415
- * wrong scope's evidence, un-redacted text under a now-present redactor, or an
8416
- * old section shape. */
8481
+ * wrong scope's evidence, un-redacted text under a now-present redactor, an
8482
+ * old section shape, or text grounded in memory ids that are no longer in the
8483
+ * publish-review set. */
8417
8484
  interface ProfileConfigFingerprint {
8418
8485
  /** Facet keys present in the doc, sorted. */
8419
8486
  facetKeys: ProfileFacetKey[];
@@ -8428,6 +8495,14 @@ interface ProfileConfigFingerprint {
8428
8495
  /** Whether a PII redactor gated the section text. Reusing un-gated text under
8429
8496
  * a now-present redactor would leak PII, so this flips the fingerprint. */
8430
8497
  redacted: boolean;
8498
+ /**
8499
+ * Order-independent digest of {@link SynthesizeProfileOptions.reviewedMemoryIds}.
8500
+ * Empty string when the review gate is off (omit / empty array). Changing the
8501
+ * set must invalidate reuse — otherwise a narrowed review keeps text grounded
8502
+ * in unreviewed ids, and a widened review leaves previously-cleared sections
8503
+ * empty.
8504
+ */
8505
+ reviewedMemoryIdsSignature: string;
8431
8506
  }
8432
8507
  /** A synthesized profile. Server-authoritative once published; the client
8433
8508
  * caches it and passes it back as {@link SynthesizeProfileOptions.previous}. */
@@ -8473,6 +8548,24 @@ interface SynthesizeProfileOptions extends PortalLlmAuth {
8473
8548
  * Omit only when the caller redacts downstream — `nearby` also moderates
8474
8549
  * server-side, but the client should never publish un-gated text. */
8475
8550
  redactor?: PiiRedactor;
8551
+ /**
8552
+ * Per-FactType score multipliers for facet recall. Default:
8553
+ * {@link DEFAULT_PROFILE_FACT_TYPE_WEIGHTS} (durable types boosted).
8554
+ * Does not change global chat `recall()` defaults.
8555
+ */
8556
+ factTypeWeights?: Partial<Record<FactType, number>>;
8557
+ /**
8558
+ * Proof-count α for facet recall. Default: {@link DEFAULT_PROFILE_PROOF_ALPHA}
8559
+ * (0.2). Chat recall stays at 0.1.
8560
+ */
8561
+ proofCountAlpha?: number;
8562
+ /**
8563
+ * When non-empty, intersect each facet's recalled evidence with this id set
8564
+ * before the LLM runs (publish-review gate). Empty intersection → empty
8565
+ * section (legitimate no-evidence), not a stale fallback. Omit / empty →
8566
+ * no gate.
8567
+ */
8568
+ reviewedMemoryIds?: readonly string[];
8476
8569
  }
8477
8570
  /**
8478
8571
  * Synthesize a shareable {@link ProfileDoc} from the user's vault, on-device.
@@ -13935,4 +14028,4 @@ declare function renderAnumaTree(node: AnumaNode): React.ReactElement | null;
13935
14028
  */
13936
14029
  declare function renderAnumaJsx(jsx: string): React.ReactElement | null;
13937
14030
 
13938
- export { Anuma, type AnumaChild, AnumaJsxError, type AnumaNode, AnumaShadowIsolationProvider, type AnumaShadowIsolationProviderProps, type AnumaTheme, AnumaThemeProvider, type AnumaThemeProviderProps, AppFile as AppFileModel, type AppFileOperationsContext, type AttrValue, type AutoExtractMessage, type AutoExtractor, DEFAULT_CONVERSATIONS_FOLDER as BACKUP_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as BACKUP_DRIVE_ROOT_FOLDER, DEFAULT_BACKUP_FOLDER as BACKUP_ICLOUD_FOLDER, BUILT_IN_TOOL_SETS, type BackupAuthContextValue, BackupAuthProvider, type BackupAuthProviderProps, type BackupOperationOptions, BlobUrlManager, type Budget, type CachedChunkVectors, type CachedServerTools, ChartCard, type ChartCardProps, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChatStorageAdapter, type ChatStorageObservable, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type CircleProps, type ClientToolsFilterFn, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type ConversationQueryOptions, type CreateAutoExtractorOptions, type CreateConversationOptions, type 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_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, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageChunk, type MessageFeedback, 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 PlatformStorage, type PortalLlmAuth, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSection, type ProfileUpdate, type ProgressCallback, Project, type ProjectOperationsContext, type PromptPreProcessor, type PromptPreProcessorContext, type ProviderAuthState, type ProviderBackupState, ProviderStreamError, type QuantizedEmbedding, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, R2_DEFAULT_TTL_MS, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RectProps, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, 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 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 StoredUserPreference, UserPreference as StoredUserPreferenceModel, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type SynthesizeProfileOptions, THEME_ATTRS, 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 TranscriptionResult, type TurnCompleteEvent, type TurnSkippedEvent, type UIInteractionContextValue, UIInteractionProvider, type UIInteractionProviderProps, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateSavedToolOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseBackupOptions, type UseBackupResult, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseDropboxBackupOptions, type UseDropboxBackupResult, type UseEncryptionResult, type UseExportPdfResult, type UseFilesOptions, type UseFilesResult, type UseGoogleDriveBackupOptions, type UseGoogleDriveBackupResult, type UseICloudBackupOptions, type UseICloudBackupResult, type UseModelsResult, type UseOCRResult, type UsePdfResult, type UsePhoneCallsOptions, type UsePhoneCallsResult, type UseProjectsOptions, type UseProjectsResult, type UseSettingsOptions, type UseSettingsResult, type UseSubscriptionOptions, type UseSubscriptionResult, type UseToolsOptions, type UseToolsResult, type UseVoiceOptions, type UseVoiceResult, type UseWalletBindingOptions, type UseWalletBindingResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, type VoiceRecording, WalletPoller, WatermelonChatStorageAdapter, type WatermelonChatStorageAdapterOptions, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WhisperModel, WordProcessor, ZipProcessor, type ZipProcessorOptions, addConversationMemoriesOp, appFileToStored, archiveVaultMemoryOp, backfillMemoryEntityUserIdsOp, 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, createPlatformCursorStore, createProjectOp, createRecallTool, createSavedToolOp, createServerToolsFilter, createStockPricePreProcessor, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllAppFilesOp, deleteAllVaultMemoriesForUserOp, deleteAppFileOp, deleteEncryptedFile, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteProjectOp, deleteSavedToolOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, expandToolSetsAdditive, exportElementToPdf, exportMarkdownToPdf, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractFileIds, fileExists, findById, findMatchingTools, findParentOfId, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllSavedToolsOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAndClearCalendarPendingMessage, getAndClearCalendarReturnUrl, getAndClearDrivePendingMessage, getAndClearDriveReturnUrl, getAndClearGithubPendingMessage, getAndClearGithubReturnUrl, getAndClearNotionPendingMessage, getAndClearNotionReturnUrl, getAppFileMapOp, getAppFileOp, getAppFilesOp, getAudioOp, getCachedServerTools, getCalendarAccessToken, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsPageOp, 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, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, handleCalendarCallback, handleDriveCallback, handleGithubCallback, handleNotionCallback, hardDeleteDecayedOp, hardDeleteMediaOp, hasCalendarCredentials, hasDriveCredentials, hasDropboxCredentials, hasEncryptionKey, hasGithubCredentials, hasGoogleDriveCredentials, hasICloudCredentials, hasKeyPair, hasNotionCredentials, 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, preEmbedVaultMemories, preprocessFiles, previewToolSelection, projectToStored, putAppFileOp, quantizeEmbedding, queueManager, readEncryptedFile, recall, reflect, refreshCalendarToken, refreshDriveToken, refreshGithubToken, refreshNotionToken, relinkMisclassifiedVideosOp, removeById, renderAnumaJsx, renderAnumaTree, renderElementToCanvas, replaceById, replaceMemoryEntitiesGuardedOp, requestEncryptionKey, requestKeyPair, resolveFilePlaceholders, resolveThemeColor, restoreVaultMemoryOp, resumeStream, retain, revokeCalendarToken, revokeDriveToken, revokeGithubToken, revokeNotionAccess, savedToolToStored, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serializeJsx, setLogger, setMemoryEntitiesOp, settingsStorageSchema, shouldChunkMessage, shouldRefreshTools, stampTopicsExtractedAtOp, startGithubAuth, startNotionAuth, storeCalendarPendingMessage, storeCalendarReturnUrl, storeCalendarToken, storeDrivePendingMessage, storeDriveReturnUrl, storeDriveToken, storeGithubPendingMessage, storeGithubReturnUrl, storeGithubToken, storeNotionPendingMessage, storeNotionReturnUrl, streamCancelPath, streamReplayPath, 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, walk, webPlatformStorage, writeEncryptedFile };
14031
+ export { Anuma, type AnumaChild, AnumaJsxError, type AnumaNode, AnumaShadowIsolationProvider, type AnumaShadowIsolationProviderProps, type AnumaTheme, AnumaThemeProvider, type AnumaThemeProviderProps, AppFile as AppFileModel, type AppFileOperationsContext, type AttrValue, type AutoExtractMessage, type AutoExtractor, DEFAULT_CONVERSATIONS_FOLDER as BACKUP_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as BACKUP_DRIVE_ROOT_FOLDER, DEFAULT_BACKUP_FOLDER as BACKUP_ICLOUD_FOLDER, BUILT_IN_TOOL_SETS, type BackupAuthContextValue, BackupAuthProvider, type BackupAuthProviderProps, type BackupOperationOptions, BlobUrlManager, type Budget, type CachedChunkVectors, type CachedServerTools, ChartCard, type ChartCardProps, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChatStorageAdapter, type ChatStorageObservable, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type CircleProps, type ClientToolsFilterFn, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type ConversationQueryOptions, type CreateAutoExtractorOptions, type CreateConversationOptions, type 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, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageChunk, type MessageFeedback, 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 PlatformStorage, type PortalLlmAuth, 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 QuantizedEmbedding, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, R2_DEFAULT_TTL_MS, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, 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, 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 StoredUserPreference, UserPreference as StoredUserPreferenceModel, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type SynthesizeProfileOptions, THEME_ATTRS, 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 TranscriptionResult, type TurnCompleteEvent, type TurnSkippedEvent, type UIInteractionContextValue, UIInteractionProvider, type UIInteractionProviderProps, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateSavedToolOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseBackupOptions, type UseBackupResult, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseDropboxBackupOptions, type UseDropboxBackupResult, type UseEncryptionResult, type UseExportPdfResult, type UseFilesOptions, type UseFilesResult, type UseGoogleDriveBackupOptions, type UseGoogleDriveBackupResult, type UseICloudBackupOptions, type UseICloudBackupResult, type UseModelsResult, type UseOCRResult, type UsePdfResult, type UsePhoneCallsOptions, type UsePhoneCallsResult, type UseProjectsOptions, type UseProjectsResult, type UseSettingsOptions, type UseSettingsResult, type UseSubscriptionOptions, type UseSubscriptionResult, type UseToolsOptions, type UseToolsResult, type UseVoiceOptions, type UseVoiceResult, type UseWalletBindingOptions, type UseWalletBindingResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, type VoiceRecording, WalletPoller, WatermelonChatStorageAdapter, type WatermelonChatStorageAdapterOptions, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WhisperModel, WordProcessor, ZipProcessor, type ZipProcessorOptions, addConversationMemoriesOp, appFileToStored, archiveVaultMemoryOp, backfillMemoryEntityUserIdsOp, 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, createPlatformCursorStore, createProjectOp, createRecallTool, createSavedToolOp, createServerToolsFilter, createStockPricePreProcessor, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllAppFilesOp, deleteAllVaultMemoriesForUserOp, deleteAppFileOp, deleteEncryptedFile, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteProjectOp, deleteSavedToolOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, expandToolSetsAdditive, exportElementToPdf, exportMarkdownToPdf, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractFileIds, fileExists, findById, findMatchingTools, findParentOfId, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllSavedToolsOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAndClearCalendarPendingMessage, getAndClearCalendarReturnUrl, getAndClearDrivePendingMessage, getAndClearDriveReturnUrl, getAndClearGithubPendingMessage, getAndClearGithubReturnUrl, getAndClearNotionPendingMessage, getAndClearNotionReturnUrl, getAppFileMapOp, getAppFileOp, getAppFilesOp, getAudioOp, getCachedServerTools, getCalendarAccessToken, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsPageOp, 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, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, handleCalendarCallback, handleDriveCallback, handleGithubCallback, handleNotionCallback, hardDeleteDecayedOp, hardDeleteMediaOp, hasCalendarCredentials, hasDriveCredentials, hasDropboxCredentials, hasEncryptionKey, hasGithubCredentials, hasGoogleDriveCredentials, hasICloudCredentials, hasKeyPair, hasNotionCredentials, 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, preEmbedVaultMemories, preprocessFiles, previewToolSelection, projectToStored, putAppFileOp, quantizeEmbedding, queueManager, rankProfileCandidates, readEncryptedFile, recall, reflect, refreshCalendarToken, refreshDriveToken, refreshGithubToken, refreshNotionToken, 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, selectServerToolsForPrompt, serializeJsx, setLogger, setMemoryEntitiesOp, 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, walk, webPlatformStorage, writeEncryptedFile };
@@ -8304,6 +8304,61 @@ function createDecaySweeper(options) {
8304
8304
  };
8305
8305
  }
8306
8306
 
8307
+ // src/lib/memory/profileSalience.ts
8308
+ var DEFAULT_PROFILE_PROOF_ALPHA = 0.2;
8309
+ var DEFAULT_PROFILE_FACT_TYPE_WEIGHTS = {
8310
+ identity: 1.5,
8311
+ preference: 1.5,
8312
+ relationship: 1.5,
8313
+ constraint: 1.5,
8314
+ other: 1,
8315
+ plan: 0.6,
8316
+ ongoing_context: 0.6
8317
+ };
8318
+ var DEFAULT_PROFILE_TREND_MULTIPLIERS = {
8319
+ strengthening: 1.25,
8320
+ new: 1.1,
8321
+ stable: 1,
8322
+ weakening: 0.75,
8323
+ stale: 0.5
8324
+ };
8325
+ function typeWeight(factType, weights) {
8326
+ if (!factType) return 1;
8327
+ const w = weights[factType];
8328
+ if (w !== void 0 && Number.isFinite(w) && w > 0) return w;
8329
+ return 1;
8330
+ }
8331
+ function scoreProfileSalience(input, now = Date.now(), options = {}) {
8332
+ const alpha = options.proofCountAlpha ?? DEFAULT_PROFILE_PROOF_ALPHA;
8333
+ const typeWeights = { ...DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, ...options.factTypeWeights };
8334
+ const trendMults = { ...DEFAULT_PROFILE_TREND_MULTIPLIERS, ...options.trendMultipliers };
8335
+ const proofs = Math.max(1, input.proofCount ?? 1);
8336
+ const proofBoost = 1 + alpha * Math.log(1 + proofs) - alpha * Math.log(2);
8337
+ const trend = classifyObservationTrend(input, now);
8338
+ const tw = typeWeight(input.factType, typeWeights);
8339
+ const tm = trendMults[trend] ?? 1;
8340
+ const score = tw * proofBoost * tm;
8341
+ return Number.isFinite(score) ? score : 0;
8342
+ }
8343
+ function rankProfileCandidates(inputs, now = Date.now(), options = {}) {
8344
+ const ranked = inputs.map((input) => {
8345
+ const proofs = Math.max(1, input.proofCount ?? 1);
8346
+ return {
8347
+ id: input.id,
8348
+ score: scoreProfileSalience(input, now, options),
8349
+ trend: classifyObservationTrend(input, now),
8350
+ factType: input.factType ?? null,
8351
+ proofCount: proofs
8352
+ };
8353
+ });
8354
+ ranked.sort((a, b) => {
8355
+ if (b.score !== a.score) return b.score - a.score;
8356
+ if (b.proofCount !== a.proofCount) return b.proofCount - a.proofCount;
8357
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
8358
+ });
8359
+ return ranked;
8360
+ }
8361
+
8307
8362
  // src/lib/memory/recallConstants.ts
8308
8363
  var RECALL_TOOL_NAME = "recall_memory";
8309
8364
  var RECALL_MAX_LIMIT = 50;
@@ -8528,18 +8583,18 @@ async function reflect(query, ctx, options) {
8528
8583
  usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 }
8529
8584
  };
8530
8585
  if (trimmed.length === 0) return empty;
8531
- const { maxTokens: _llmMaxTokens, ...recallOptions } = options;
8532
- const recalled = await recall(trimmed, ctx, recallOptions);
8533
- const memoryIds = recalled.memories.map((m) => m.id);
8586
+ const { maxTokens: _llmMaxTokens, memories: providedMemories, ...recallOptions } = options;
8587
+ const recalledMemories = providedMemories !== void 0 ? providedMemories : (await recall(trimmed, ctx, recallOptions)).memories;
8588
+ const memoryIds = recalledMemories.map((m) => m.id);
8534
8589
  const baseResult = {
8535
8590
  text: "",
8536
8591
  basedOn: { memoryIds },
8537
8592
  usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 }
8538
8593
  };
8539
- if (recalled.memories.length === 0) {
8594
+ if (recalledMemories.length === 0) {
8540
8595
  return baseResult;
8541
8596
  }
8542
- const evidence = recalled.memories.map((m, i) => `[${i + 1}] (id: ${m.id}, kind: ${m.kind})
8597
+ const evidence = recalledMemories.map((m, i) => `[${i + 1}] (id: ${m.id}, kind: ${m.kind})
8543
8598
  ${m.content}`).join("\n\n");
8544
8599
  const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;
8545
8600
  const model = options.llmModel ?? DEFAULT_MODEL3;
@@ -8725,7 +8780,8 @@ async function synthesizeProfile(ctx, options = {}) {
8725
8780
  facetKeys: facets.map((f) => f.key).sort(),
8726
8781
  facetsSignature: facetsSignature(facets),
8727
8782
  scopes: [...scopes].sort(),
8728
- redacted: options.redactor !== void 0
8783
+ redacted: options.redactor !== void 0,
8784
+ reviewedMemoryIdsSignature: reviewedMemoryIdsSignature(options.reviewedMemoryIds)
8729
8785
  };
8730
8786
  const previous = options.previous && options.previous.version === PROFILE_DOC_VERSION && configMatches(options.previous.config, config) ? options.previous : void 0;
8731
8787
  const memories = await getAllVaultMemoriesOp(ctx.vaultCtx, {
@@ -8798,7 +8854,11 @@ async function synthesizeProfile(ctx, options = {}) {
8798
8854
  }
8799
8855
  function configMatches(a, b) {
8800
8856
  if (!a) return false;
8801
- return a.redacted === b.redacted && a.facetsSignature === b.facetsSignature && a.scopes.length === b.scopes.length && a.scopes.every((s, i) => s === b.scopes[i]);
8857
+ return a.redacted === b.redacted && a.facetsSignature === b.facetsSignature && (a.reviewedMemoryIdsSignature ?? "") === b.reviewedMemoryIdsSignature && a.scopes.length === b.scopes.length && a.scopes.every((s, i) => s === b.scopes[i]);
8858
+ }
8859
+ function reviewedMemoryIdsSignature(ids) {
8860
+ if (ids === void 0 || ids.length === 0) return "";
8861
+ return [...new Set(ids)].sort().join("\n");
8802
8862
  }
8803
8863
  function facetsSignature(facets) {
8804
8864
  return facets.map((f) => JSON.stringify([f.key, f.label, f.query, f.guidance])).sort().join("\n");
@@ -8902,18 +8962,46 @@ async function attributeFacts(ctx, candidates, facets) {
8902
8962
  return keys;
8903
8963
  }
8904
8964
  async function synthesizeFacet(facet, ctx, options, prior) {
8965
+ const scopes = options.scopes ?? DEFAULT_SCOPES;
8966
+ const limit = options.limit ?? DEFAULT_FACET_RECALL_LIMIT;
8967
+ const factTypeWeights = { ...DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, ...options.factTypeWeights };
8968
+ const proofCountAlpha = options.proofCountAlpha ?? DEFAULT_PROFILE_PROOF_ALPHA;
8969
+ const reviewed = options.reviewedMemoryIds;
8970
+ const hasReviewGate = reviewed !== void 0 && reviewed.length > 0;
8971
+ const recalled = await recall(facet.query, ctx, {
8972
+ scopes,
8973
+ limit: hasReviewGate ? RECALL_MAX_LIMIT : limit,
8974
+ types: ["fact"],
8975
+ factTypeWeights,
8976
+ proofCountAlpha
8977
+ });
8978
+ let memories = recalled.memories;
8979
+ if (hasReviewGate) {
8980
+ const allowed = new Set(reviewed);
8981
+ memories = memories.filter((m) => allowed.has(m.id)).slice(0, limit);
8982
+ }
8983
+ if (memories.length === 0) {
8984
+ return {
8985
+ key: facet.key,
8986
+ label: facet.label,
8987
+ text: "",
8988
+ sourceMemoryIds: [],
8989
+ generatedAt: Date.now()
8990
+ };
8991
+ }
8905
8992
  const result = await reflect(facet.query, ctx, {
8906
8993
  apiKey: options.apiKey,
8907
8994
  getToken: options.getToken,
8908
8995
  llmModel: options.llmModel ?? DEFAULT_SYNTHESIS_MODEL,
8909
8996
  baseUrl: options.baseUrl,
8910
8997
  fetchFn: options.fetchFn,
8911
- scopes: options.scopes ?? DEFAULT_SCOPES,
8912
- limit: options.limit ?? DEFAULT_FACET_RECALL_LIMIT,
8998
+ scopes,
8999
+ limit,
8913
9000
  types: ["fact"],
8914
9001
  maxTokens: DEFAULT_FACET_MAX_TOKENS,
8915
9002
  systemPrompt: buildFacetSystemPrompt(facet),
8916
- responseSchema: FACET_RESPONSE_SCHEMA
9003
+ responseSchema: FACET_RESPONSE_SCHEMA,
9004
+ memories
8917
9005
  });
8918
9006
  const noEvidence = result.basedOn.memoryIds.length === 0;
8919
9007
  const { text: text12, legitimateEmpty } = extractFacetText(result.structuredOutput);
@@ -24765,6 +24853,9 @@ export {
24765
24853
  DEFAULT_MIN_CHUNK_SIZE,
24766
24854
  DEFAULT_PERSONALITY_SETTINGS,
24767
24855
  DEFAULT_PROFILE_FACETS,
24856
+ DEFAULT_PROFILE_FACT_TYPE_WEIGHTS,
24857
+ DEFAULT_PROFILE_PROOF_ALPHA,
24858
+ DEFAULT_PROFILE_TREND_MULTIPLIERS,
24768
24859
  DEFAULT_SERVER_TOOLS_MATCH_OPTIONS,
24769
24860
  DEFAULT_VAULT_CACHE_SIZE,
24770
24861
  DatabaseManager,
@@ -25050,6 +25141,7 @@ export {
25050
25141
  putAppFileOp,
25051
25142
  quantizeEmbedding,
25052
25143
  queueManager,
25144
+ rankProfileCandidates,
25053
25145
  readEncryptedFile,
25054
25146
  recall,
25055
25147
  reflect,
@@ -25076,6 +25168,7 @@ export {
25076
25168
  revokeGithubToken,
25077
25169
  revokeNotionAccess,
25078
25170
  savedToolToStored,
25171
+ scoreProfileSalience,
25079
25172
  screenCandidatesForInjection,
25080
25173
  sdkMigrations,
25081
25174
  sdkModelClasses,
@@ -20072,8 +20072,8 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
20072
20072
  const proofCount = Math.max(1, item?.proofCount ?? 1);
20073
20073
  const proofBoost = 1 + proofCountAlpha * Math.log(1 + proofCount) - proofCountAlpha * Math.log(2);
20074
20074
  const rawTypeWeight = item?.factType ? factTypeWeights?.[item.factType] : void 0;
20075
- const typeWeight = rawTypeWeight !== void 0 && Number.isFinite(rawTypeWeight) && rawTypeWeight > 0 ? rawTypeWeight : 1;
20076
- return recencyBoost * proofBoost * typeWeight;
20075
+ const typeWeight2 = rawTypeWeight !== void 0 && Number.isFinite(rawTypeWeight) && rawTypeWeight > 0 ? rawTypeWeight : 1;
20076
+ return recencyBoost * proofBoost * typeWeight2;
20077
20077
  };
20078
20078
  let combined = [...baseRanked, ...admitted].map((r) => ({
20079
20079
  ...r,
@@ -21633,6 +21633,9 @@ __export(index_exports, {
21633
21633
  DEFAULT_MIN_MESSAGES: () => DEFAULT_MIN_MESSAGES,
21634
21634
  DEFAULT_PERSONALITY_SETTINGS: () => DEFAULT_PERSONALITY_SETTINGS,
21635
21635
  DEFAULT_PROFILE_FACETS: () => DEFAULT_PROFILE_FACETS,
21636
+ DEFAULT_PROFILE_FACT_TYPE_WEIGHTS: () => DEFAULT_PROFILE_FACT_TYPE_WEIGHTS,
21637
+ DEFAULT_PROFILE_PROOF_ALPHA: () => DEFAULT_PROFILE_PROOF_ALPHA,
21638
+ DEFAULT_PROFILE_TREND_MULTIPLIERS: () => DEFAULT_PROFILE_TREND_MULTIPLIERS,
21636
21639
  DEFAULT_PROMPT_TEMPLATES: () => DEFAULT_PROMPT_TEMPLATES,
21637
21640
  DEFAULT_REFRESH_EVERY_MESSAGES: () => DEFAULT_REFRESH_EVERY_MESSAGES,
21638
21641
  DEFAULT_SERVER_TOOLS_MATCH_OPTIONS: () => DEFAULT_SERVER_TOOLS_MATCH_OPTIONS,
@@ -21845,6 +21848,7 @@ __export(index_exports, {
21845
21848
  progressiveSummarize: () => progressiveSummarize,
21846
21849
  projectToStored: () => projectToStored,
21847
21850
  queueManager: () => queueManager,
21851
+ rankProfileCandidates: () => rankProfileCandidates,
21848
21852
  recall: () => recall,
21849
21853
  reflect: () => reflect,
21850
21854
  relinkMisclassifiedVideosOp: () => relinkMisclassifiedVideosOp,
@@ -21857,6 +21861,7 @@ __export(index_exports, {
21857
21861
  runToolLoop: () => runToolLoop,
21858
21862
  sanitizeQuotes: () => sanitizeQuotes,
21859
21863
  schemaToCreateSQL: () => schemaToCreateSQL,
21864
+ scoreProfileSalience: () => scoreProfileSalience,
21860
21865
  screenCandidatesForInjection: () => screenCandidatesForInjection,
21861
21866
  sdkMigrations: () => sdkMigrations,
21862
21867
  sdkModelClasses: () => sdkModelClasses,
@@ -27442,6 +27447,64 @@ function createDecaySweeper(options) {
27442
27447
  // src/lib/memory/index.ts
27443
27448
  init_graphTraversal();
27444
27449
  init_observationTrend();
27450
+
27451
+ // src/lib/memory/profileSalience.ts
27452
+ init_observationTrend();
27453
+ var DEFAULT_PROFILE_PROOF_ALPHA = 0.2;
27454
+ var DEFAULT_PROFILE_FACT_TYPE_WEIGHTS = {
27455
+ identity: 1.5,
27456
+ preference: 1.5,
27457
+ relationship: 1.5,
27458
+ constraint: 1.5,
27459
+ other: 1,
27460
+ plan: 0.6,
27461
+ ongoing_context: 0.6
27462
+ };
27463
+ var DEFAULT_PROFILE_TREND_MULTIPLIERS = {
27464
+ strengthening: 1.25,
27465
+ new: 1.1,
27466
+ stable: 1,
27467
+ weakening: 0.75,
27468
+ stale: 0.5
27469
+ };
27470
+ function typeWeight(factType, weights) {
27471
+ if (!factType) return 1;
27472
+ const w = weights[factType];
27473
+ if (w !== void 0 && Number.isFinite(w) && w > 0) return w;
27474
+ return 1;
27475
+ }
27476
+ function scoreProfileSalience(input, now = Date.now(), options = {}) {
27477
+ const alpha = options.proofCountAlpha ?? DEFAULT_PROFILE_PROOF_ALPHA;
27478
+ const typeWeights = { ...DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, ...options.factTypeWeights };
27479
+ const trendMults = { ...DEFAULT_PROFILE_TREND_MULTIPLIERS, ...options.trendMultipliers };
27480
+ const proofs = Math.max(1, input.proofCount ?? 1);
27481
+ const proofBoost = 1 + alpha * Math.log(1 + proofs) - alpha * Math.log(2);
27482
+ const trend = classifyObservationTrend(input, now);
27483
+ const tw = typeWeight(input.factType, typeWeights);
27484
+ const tm = trendMults[trend] ?? 1;
27485
+ const score = tw * proofBoost * tm;
27486
+ return Number.isFinite(score) ? score : 0;
27487
+ }
27488
+ function rankProfileCandidates(inputs, now = Date.now(), options = {}) {
27489
+ const ranked = inputs.map((input) => {
27490
+ const proofs = Math.max(1, input.proofCount ?? 1);
27491
+ return {
27492
+ id: input.id,
27493
+ score: scoreProfileSalience(input, now, options),
27494
+ trend: classifyObservationTrend(input, now),
27495
+ factType: input.factType ?? null,
27496
+ proofCount: proofs
27497
+ };
27498
+ });
27499
+ ranked.sort((a, b) => {
27500
+ if (b.score !== a.score) return b.score - a.score;
27501
+ if (b.proofCount !== a.proofCount) return b.proofCount - a.proofCount;
27502
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
27503
+ });
27504
+ return ranked;
27505
+ }
27506
+
27507
+ // src/lib/memory/index.ts
27445
27508
  init_recall();
27446
27509
 
27447
27510
  // src/lib/memory/recallTool.ts
@@ -27675,18 +27738,18 @@ async function reflect(query, ctx, options) {
27675
27738
  usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 }
27676
27739
  };
27677
27740
  if (trimmed.length === 0) return empty;
27678
- const { maxTokens: _llmMaxTokens, ...recallOptions } = options;
27679
- const recalled = await recall(trimmed, ctx, recallOptions);
27680
- const memoryIds = recalled.memories.map((m) => m.id);
27741
+ const { maxTokens: _llmMaxTokens, memories: providedMemories, ...recallOptions } = options;
27742
+ const recalledMemories = providedMemories !== void 0 ? providedMemories : (await recall(trimmed, ctx, recallOptions)).memories;
27743
+ const memoryIds = recalledMemories.map((m) => m.id);
27681
27744
  const baseResult = {
27682
27745
  text: "",
27683
27746
  basedOn: { memoryIds },
27684
27747
  usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 }
27685
27748
  };
27686
- if (recalled.memories.length === 0) {
27749
+ if (recalledMemories.length === 0) {
27687
27750
  return baseResult;
27688
27751
  }
27689
- const evidence = recalled.memories.map((m, i) => `[${i + 1}] (id: ${m.id}, kind: ${m.kind})
27752
+ const evidence = recalledMemories.map((m, i) => `[${i + 1}] (id: ${m.id}, kind: ${m.kind})
27690
27753
  ${m.content}`).join("\n\n");
27691
27754
  const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL2;
27692
27755
  const model = options.llmModel ?? DEFAULT_MODEL5;
@@ -27809,6 +27872,7 @@ init_constants();
27809
27872
  init_embeddings();
27810
27873
  init_vector();
27811
27874
  init_observationTrend();
27875
+ init_recall();
27812
27876
  var DEFAULT_SYNTHESIS_MODEL = "inclusionai/ling-2.6-flash";
27813
27877
  var DEFAULT_FACET_RECALL_LIMIT = 20;
27814
27878
  var DEFAULT_FACET_MAX_TOKENS = 512;
@@ -27881,7 +27945,8 @@ async function synthesizeProfile(ctx, options = {}) {
27881
27945
  facetKeys: facets.map((f) => f.key).sort(),
27882
27946
  facetsSignature: facetsSignature(facets),
27883
27947
  scopes: [...scopes].sort(),
27884
- redacted: options.redactor !== void 0
27948
+ redacted: options.redactor !== void 0,
27949
+ reviewedMemoryIdsSignature: reviewedMemoryIdsSignature(options.reviewedMemoryIds)
27885
27950
  };
27886
27951
  const previous = options.previous && options.previous.version === PROFILE_DOC_VERSION && configMatches(options.previous.config, config) ? options.previous : void 0;
27887
27952
  const memories = await getAllVaultMemoriesOp(ctx.vaultCtx, {
@@ -27954,7 +28019,11 @@ async function synthesizeProfile(ctx, options = {}) {
27954
28019
  }
27955
28020
  function configMatches(a, b) {
27956
28021
  if (!a) return false;
27957
- return a.redacted === b.redacted && a.facetsSignature === b.facetsSignature && a.scopes.length === b.scopes.length && a.scopes.every((s, i) => s === b.scopes[i]);
28022
+ return a.redacted === b.redacted && a.facetsSignature === b.facetsSignature && (a.reviewedMemoryIdsSignature ?? "") === b.reviewedMemoryIdsSignature && a.scopes.length === b.scopes.length && a.scopes.every((s, i) => s === b.scopes[i]);
28023
+ }
28024
+ function reviewedMemoryIdsSignature(ids) {
28025
+ if (ids === void 0 || ids.length === 0) return "";
28026
+ return [...new Set(ids)].sort().join("\n");
27958
28027
  }
27959
28028
  function facetsSignature(facets) {
27960
28029
  return facets.map((f) => JSON.stringify([f.key, f.label, f.query, f.guidance])).sort().join("\n");
@@ -28058,18 +28127,46 @@ async function attributeFacts(ctx, candidates, facets) {
28058
28127
  return keys;
28059
28128
  }
28060
28129
  async function synthesizeFacet(facet, ctx, options, prior) {
28130
+ const scopes = options.scopes ?? DEFAULT_SCOPES;
28131
+ const limit = options.limit ?? DEFAULT_FACET_RECALL_LIMIT;
28132
+ const factTypeWeights = { ...DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, ...options.factTypeWeights };
28133
+ const proofCountAlpha = options.proofCountAlpha ?? DEFAULT_PROFILE_PROOF_ALPHA;
28134
+ const reviewed = options.reviewedMemoryIds;
28135
+ const hasReviewGate = reviewed !== void 0 && reviewed.length > 0;
28136
+ const recalled = await recall(facet.query, ctx, {
28137
+ scopes,
28138
+ limit: hasReviewGate ? RECALL_MAX_LIMIT : limit,
28139
+ types: ["fact"],
28140
+ factTypeWeights,
28141
+ proofCountAlpha
28142
+ });
28143
+ let memories = recalled.memories;
28144
+ if (hasReviewGate) {
28145
+ const allowed = new Set(reviewed);
28146
+ memories = memories.filter((m) => allowed.has(m.id)).slice(0, limit);
28147
+ }
28148
+ if (memories.length === 0) {
28149
+ return {
28150
+ key: facet.key,
28151
+ label: facet.label,
28152
+ text: "",
28153
+ sourceMemoryIds: [],
28154
+ generatedAt: Date.now()
28155
+ };
28156
+ }
28061
28157
  const result = await reflect(facet.query, ctx, {
28062
28158
  apiKey: options.apiKey,
28063
28159
  getToken: options.getToken,
28064
28160
  llmModel: options.llmModel ?? DEFAULT_SYNTHESIS_MODEL,
28065
28161
  baseUrl: options.baseUrl,
28066
28162
  fetchFn: options.fetchFn,
28067
- scopes: options.scopes ?? DEFAULT_SCOPES,
28068
- limit: options.limit ?? DEFAULT_FACET_RECALL_LIMIT,
28163
+ scopes,
28164
+ limit,
28069
28165
  types: ["fact"],
28070
28166
  maxTokens: DEFAULT_FACET_MAX_TOKENS,
28071
28167
  systemPrompt: buildFacetSystemPrompt(facet),
28072
- responseSchema: FACET_RESPONSE_SCHEMA
28168
+ responseSchema: FACET_RESPONSE_SCHEMA,
28169
+ memories
28073
28170
  });
28074
28171
  const noEvidence = result.basedOn.memoryIds.length === 0;
28075
28172
  const { text: text12, legitimateEmpty } = extractFacetText(result.structuredOutput);
@@ -34039,6 +34136,9 @@ function buildSystemPrompt(ctx, options) {
34039
34136
  DEFAULT_MIN_MESSAGES,
34040
34137
  DEFAULT_PERSONALITY_SETTINGS,
34041
34138
  DEFAULT_PROFILE_FACETS,
34139
+ DEFAULT_PROFILE_FACT_TYPE_WEIGHTS,
34140
+ DEFAULT_PROFILE_PROOF_ALPHA,
34141
+ DEFAULT_PROFILE_TREND_MULTIPLIERS,
34042
34142
  DEFAULT_PROMPT_TEMPLATES,
34043
34143
  DEFAULT_REFRESH_EVERY_MESSAGES,
34044
34144
  DEFAULT_SERVER_TOOLS_MATCH_OPTIONS,
@@ -34251,6 +34351,7 @@ function buildSystemPrompt(ctx, options) {
34251
34351
  progressiveSummarize,
34252
34352
  projectToStored,
34253
34353
  queueManager,
34354
+ rankProfileCandidates,
34254
34355
  recall,
34255
34356
  reflect,
34256
34357
  relinkMisclassifiedVideosOp,
@@ -34263,6 +34364,7 @@ function buildSystemPrompt(ctx, options) {
34263
34364
  runToolLoop,
34264
34365
  sanitizeQuotes,
34265
34366
  schemaToCreateSQL,
34367
+ scoreProfileSalience,
34266
34368
  screenCandidatesForInjection,
34267
34369
  sdkMigrations,
34268
34370
  sdkModelClasses,