@anuma/sdk 3.4.0 → 3.6.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.
@@ -6195,7 +6195,7 @@ interface VaultSearchResult {
6195
6195
  updatedAt?: Date;
6196
6196
  /** Times this fact has been re-observed — for C2 trend labels. */
6197
6197
  proofCount?: number | null;
6198
- /** C3 re-observation watermark (Unix ms) — for C2 trend labels. */
6198
+ /** C3 re-observation watermark (Unix ms) — for C2 trends + C4 CE dates. */
6199
6199
  lastObservedAt?: number | null;
6200
6200
  /** W6 temporal-lane anchors carried through to downstream `RankedMemory`
6201
6201
  * so the recall executor can surface dates to the answer model without
@@ -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 };
@@ -129,7 +129,7 @@ import {
129
129
  updateVaultMemoryOp,
130
130
  useEncryption,
131
131
  vaultMemoryToStored
132
- } from "./chunk-CGC3UJHM.mjs";
132
+ } from "./chunk-DDHTJGZN.mjs";
133
133
  import {
134
134
  PiiRedactor,
135
135
  createStreamingDeAnonymizer,
@@ -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,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-CGC3UJHM.mjs";
3
+ } from "./chunk-DDHTJGZN.mjs";
4
4
  import "./chunk-DFVCS3QQ.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
@@ -17559,11 +17559,20 @@ async function getModel() {
17559
17559
  function sigmoid(x) {
17560
17560
  return 1 / (1 + Math.exp(-x));
17561
17561
  }
17562
+ function formatRerankDoc(content, dateMs) {
17563
+ if (dateMs === null || dateMs === void 0 || !Number.isFinite(dateMs)) return content;
17564
+ const d = new Date(dateMs);
17565
+ if (!Number.isFinite(d.getTime())) return content;
17566
+ const yyyy = d.getFullYear();
17567
+ const mm = String(d.getMonth() + 1).padStart(2, "0");
17568
+ const dd = String(d.getDate()).padStart(2, "0");
17569
+ return `[Date: ${yyyy}-${mm}-${dd}] ${content}`;
17570
+ }
17562
17571
  async function rerankPairs(query, items) {
17563
17572
  if (items.length === 0 || !query) return [];
17564
17573
  const { tokenizer, model } = await getModel();
17565
17574
  const queries = items.map(() => query);
17566
- const docs = items.map((i) => i.content);
17575
+ const docs = items.map((i) => formatRerankDoc(i.content, i.dateMs));
17567
17576
  const tokenize2 = tokenizer;
17568
17577
  const inputs = tokenize2(queries, { text_pair: docs, padding: true, truncation: true });
17569
17578
  const forward = model;
@@ -17912,6 +17921,23 @@ function createVaultEmbeddingCache(maxSize = DEFAULT_VAULT_CACHE_SIZE) {
17912
17921
  function normalizeEventTimeKind(kind) {
17913
17922
  return kind === "point" || kind === "range" || kind === "ongoing" ? kind : null;
17914
17923
  }
17924
+ function rerankDateMs(item) {
17925
+ if (item.eventTimeStart !== null && item.eventTimeStart !== void 0 && Number.isFinite(item.eventTimeStart) && item.eventTimeStart > 0) {
17926
+ return item.eventTimeStart;
17927
+ }
17928
+ if (item.lastObservedAt !== null && item.lastObservedAt !== void 0 && Number.isFinite(item.lastObservedAt) && item.lastObservedAt > 0) {
17929
+ return item.lastObservedAt;
17930
+ }
17931
+ const updatedMs = item.updatedAt?.getTime();
17932
+ if (updatedMs !== null && updatedMs !== void 0 && Number.isFinite(updatedMs) && updatedMs > 0) {
17933
+ return updatedMs;
17934
+ }
17935
+ const createdMs = item.createdAt?.getTime();
17936
+ if (createdMs !== null && createdMs !== void 0 && Number.isFinite(createdMs) && createdMs > 0) {
17937
+ return createdMs;
17938
+ }
17939
+ return void 0;
17940
+ }
17915
17941
  var SUPERSESSION_SIMILARITY_THRESHOLD = 0.7;
17916
17942
  var SUPERSESSION_MIN_AGE_GAP_MS = 30 * 24 * 60 * 60 * 1e3;
17917
17943
  var SUPERSESSION_BOOST_FACTOR = 0.8;
@@ -18118,6 +18144,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
18118
18144
  }
18119
18145
  let combined;
18120
18146
  let tailSlice = [];
18147
+ const itemById = new Map(items.map((i) => [i.id, i]));
18121
18148
  if (options?.rerank) {
18122
18149
  const rerankTopN = options.rerankTopN ?? 30;
18123
18150
  const ceWeight = options.ceWeight ?? 0.1;
@@ -18125,7 +18152,12 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
18125
18152
  try {
18126
18153
  const reranked = await rerankPairs(
18127
18154
  query,
18128
- headSlice.map((r) => ({ id: r.uniqueId, content: r.content }))
18155
+ headSlice.map((r) => ({
18156
+ id: r.uniqueId,
18157
+ content: r.content,
18158
+ // C4: date-prefix the CE doc so temporal alignment influences rank.
18159
+ dateMs: rerankDateMs(itemById.get(r.uniqueId) ?? r)
18160
+ }))
18129
18161
  );
18130
18162
  tailSlice = v2Ranked.slice(rerankTopN);
18131
18163
  const v2ScoreById = new Map(headSlice.map((r) => [r.uniqueId, r.similarity]));
@@ -18160,11 +18192,11 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
18160
18192
  const fused = rrfFuse([headIds, headIds, ...sideLanesAsync], options?.rrfK);
18161
18193
  const fusedHead = combined.map((r) => ({ ...r, similarity: fused.get(r.uniqueId) ?? r.similarity })).sort((a, b) => b.similarity - a.similarity);
18162
18194
  const seen = new Set(combined.map((r) => r.uniqueId));
18163
- const itemById = new Map(items.map((i) => [i.id, i]));
18195
+ const itemById2 = new Map(items.map((i) => [i.id, i]));
18164
18196
  for (const lane of sideLanesAsync) {
18165
18197
  for (const id of lane) {
18166
18198
  if (seen.has(id)) continue;
18167
- const it = itemById.get(id);
18199
+ const it = itemById2.get(id);
18168
18200
  if (!it) continue;
18169
18201
  fusedHead.push({
18170
18202
  uniqueId: id,
@@ -18183,11 +18215,11 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
18183
18215
  if (options?.mmr) {
18184
18216
  const lambda = options.mmrLambda ?? 0.7;
18185
18217
  const mmrTopN = options.mmrTopN ?? 20;
18186
- const itemById = new Map(items.map((i) => [i.id, i]));
18218
+ const itemById2 = new Map(items.map((i) => [i.id, i]));
18187
18219
  const mmrCandidates = combined.slice(0, mmrTopN).map((r) => ({
18188
18220
  id: r.uniqueId,
18189
18221
  score: r.similarity,
18190
- embedding: itemById.get(r.uniqueId)?.embedding ?? [],
18222
+ embedding: itemById2.get(r.uniqueId)?.embedding ?? [],
18191
18223
  content: r.content
18192
18224
  }));
18193
18225
  const picked = applyMMR(mmrCandidates, limit, lambda);
@@ -18309,7 +18341,12 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
18309
18341
  try {
18310
18342
  const reranked = await rerankPairs(
18311
18343
  originalQuery,
18312
- headSlice.map((r) => ({ id: r.uniqueId, content: r.content }))
18344
+ headSlice.map((r) => ({
18345
+ id: r.uniqueId,
18346
+ content: r.content,
18347
+ // C4: date-prefix the CE doc so temporal alignment influences rank.
18348
+ dateMs: rerankDateMs(itemById.get(r.uniqueId) ?? r)
18349
+ }))
18313
18350
  );
18314
18351
  const ceById = new Map(reranked.map((r) => [r.id, r.score]));
18315
18352
  const head = headSlice.map((r) => ({
@@ -18727,7 +18764,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
18727
18764
  legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
18728
18765
  );
18729
18766
  }
18730
- const { recall: recall2 } = await import("./recall-GWRWPGE4.mjs");
18767
+ const { recall: recall2 } = await import("./recall-IWY2MYHR.mjs");
18731
18768
  const result = await recall2(
18732
18769
  query,
18733
18770
  { vaultCtx, embeddingOptions, vaultCache: cache },