@anuma/sdk 3.5.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.
@@ -7691,6 +7691,66 @@ interface LlmNeighborRefinerOptions extends PortalLlmAuth {
7691
7691
  */
7692
7692
  declare function createLlmNeighborRefiner(options: LlmNeighborRefinerOptions): NeighborRefiner;
7693
7693
 
7694
+ /**
7695
+ * Profile salience — profile-worthiness scoring for vault facts (#706).
7696
+ *
7697
+ * Distinct from query-time relevance (`recall` fusion). Answers: "is this
7698
+ * fact worth putting on a shareable profile?" using durable type, proof
7699
+ * density, and C2 observation trend. Pure + deterministic — no LLM, no DB.
7700
+ *
7701
+ * Used by:
7702
+ * - `synthesizeProfile` facet recall (default factTypeWeights)
7703
+ * - Publish-review UIs via {@link rankProfileCandidates} (nearby / client)
7704
+ *
7705
+ * Persisted `importance` is deferred until publish flow proves the need.
7706
+ */
7707
+
7708
+ /** Proof-count curve weight inside {@link scoreProfileSalience}. */
7709
+ declare const DEFAULT_PROFILE_PROOF_ALPHA = 0.2;
7710
+ /**
7711
+ * Per-FactType multipliers for profile synthesis / salience.
7712
+ * Durable identity-class types (never age-archive in decay) rank higher;
7713
+ * ephemeral plan/ongoing_context rank lower. Untyped / `other` stay neutral.
7714
+ */
7715
+ declare const DEFAULT_PROFILE_FACT_TYPE_WEIGHTS: Partial<Record<FactType, number>>;
7716
+ /** C2 trend multipliers for profile-worthiness. */
7717
+ declare const DEFAULT_PROFILE_TREND_MULTIPLIERS: Record<ObservationTrend, number>;
7718
+ interface ProfileSalienceInput extends ObservationTrendInput {
7719
+ /** Vault memory id — required for {@link rankProfileCandidates}. */
7720
+ id: string;
7721
+ /** Extractor FactType; null/undefined → neutral weight (1.0). */
7722
+ factType?: string | null;
7723
+ }
7724
+ interface RankedProfileCandidate {
7725
+ id: string;
7726
+ score: number;
7727
+ trend: ObservationTrend;
7728
+ factType?: string | null;
7729
+ proofCount: number;
7730
+ }
7731
+ interface ScoreProfileSalienceOptions {
7732
+ /** Override type weights (merged over {@link DEFAULT_PROFILE_FACT_TYPE_WEIGHTS}). */
7733
+ factTypeWeights?: Partial<Record<FactType, number>>;
7734
+ /** Override trend multipliers. */
7735
+ trendMultipliers?: Partial<Record<ObservationTrend, number>>;
7736
+ /** Proof-count α. Default: {@link DEFAULT_PROFILE_PROOF_ALPHA}. */
7737
+ proofCountAlpha?: number;
7738
+ }
7739
+ /**
7740
+ * Score a vault fact for profile-worthiness.
7741
+ *
7742
+ * `typeWeight * (1 + α·log(1+proofCount) − α·log(2)) * trendMultiplier`
7743
+ *
7744
+ * The proof term mirrors vault fusion's log curve (neutral at proofCount=1).
7745
+ * Pass `now` for deterministic evals.
7746
+ */
7747
+ declare function scoreProfileSalience(input: ProfileSalienceInput, now?: number, options?: ScoreProfileSalienceOptions): number;
7748
+ /**
7749
+ * Rank vault facts by profile-worthiness (descending score).
7750
+ * Ties broken by higher proofCount, then id ascending for stability.
7751
+ */
7752
+ declare function rankProfileCandidates(inputs: readonly ProfileSalienceInput[], now?: number, options?: ScoreProfileSalienceOptions): RankedProfileCandidate[];
7753
+
7694
7754
  /**
7695
7755
  * Unified Recall API — single retrieval surface above vault + engine.
7696
7756
  *
@@ -7828,6 +7888,12 @@ interface ReflectOptions extends RecallOptions, PortalLlmAuth {
7828
7888
  fetchFn?: typeof fetch;
7829
7889
  /** Optional JSON Schema to coerce structured outputs. */
7830
7890
  responseSchema?: Record<string, unknown>;
7891
+ /**
7892
+ * Skip Stage-1 {@link recall} and synthesize from these memories instead.
7893
+ * Used by `synthesizeProfile` after intersecting recall with a
7894
+ * `reviewedMemoryIds` gate so the LLM never sees unreviewed evidence.
7895
+ */
7896
+ memories?: RankedMemory[];
7831
7897
  }
7832
7898
  interface ReflectResult {
7833
7899
  /** The synthesized answer text. */
@@ -7951,8 +8017,9 @@ interface ProfileSection {
7951
8017
  /** Fingerprint of the config that produced a {@link ProfileDoc}. Delta reuse
7952
8018
  * (both the wholesale fast path and per-section reuse) is only valid when the
7953
8019
  * current call's config matches — otherwise reused sections could carry the
7954
- * wrong scope's evidence, un-redacted text under a now-present redactor, or an
7955
- * old section shape. */
8020
+ * wrong scope's evidence, un-redacted text under a now-present redactor, an
8021
+ * old section shape, or text grounded in memory ids that are no longer in the
8022
+ * publish-review set. */
7956
8023
  interface ProfileConfigFingerprint {
7957
8024
  /** Facet keys present in the doc, sorted. */
7958
8025
  facetKeys: ProfileFacetKey[];
@@ -7967,6 +8034,14 @@ interface ProfileConfigFingerprint {
7967
8034
  /** Whether a PII redactor gated the section text. Reusing un-gated text under
7968
8035
  * a now-present redactor would leak PII, so this flips the fingerprint. */
7969
8036
  redacted: boolean;
8037
+ /**
8038
+ * Order-independent digest of {@link SynthesizeProfileOptions.reviewedMemoryIds}.
8039
+ * Empty string when the review gate is off (omit / empty array). Changing the
8040
+ * set must invalidate reuse — otherwise a narrowed review keeps text grounded
8041
+ * in unreviewed ids, and a widened review leaves previously-cleared sections
8042
+ * empty.
8043
+ */
8044
+ reviewedMemoryIdsSignature: string;
7970
8045
  }
7971
8046
  /** A synthesized profile. Server-authoritative once published; the client
7972
8047
  * caches it and passes it back as {@link SynthesizeProfileOptions.previous}. */
@@ -8012,6 +8087,24 @@ interface SynthesizeProfileOptions extends PortalLlmAuth {
8012
8087
  * Omit only when the caller redacts downstream — `nearby` also moderates
8013
8088
  * server-side, but the client should never publish un-gated text. */
8014
8089
  redactor?: PiiRedactor;
8090
+ /**
8091
+ * Per-FactType score multipliers for facet recall. Default:
8092
+ * {@link DEFAULT_PROFILE_FACT_TYPE_WEIGHTS} (durable types boosted).
8093
+ * Does not change global chat `recall()` defaults.
8094
+ */
8095
+ factTypeWeights?: Partial<Record<FactType, number>>;
8096
+ /**
8097
+ * Proof-count α for facet recall. Default: {@link DEFAULT_PROFILE_PROOF_ALPHA}
8098
+ * (0.2). Chat recall stays at 0.1.
8099
+ */
8100
+ proofCountAlpha?: number;
8101
+ /**
8102
+ * When non-empty, intersect each facet's recalled evidence with this id set
8103
+ * before the LLM runs (publish-review gate). Empty intersection → empty
8104
+ * section (legitimate no-evidence), not a stale fallback. Omit / empty →
8105
+ * no gate.
8106
+ */
8107
+ reviewedMemoryIds?: readonly string[];
8015
8108
  }
8016
8109
  /**
8017
8110
  * Synthesize a shareable {@link ProfileDoc} from the user's vault, on-device.
@@ -9122,4 +9215,4 @@ declare function sanitizeQuotes(s: string): string;
9122
9215
  declare function renderTemplate(value: string | null | undefined, template: string): string | null;
9123
9216
  declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
9124
9217
 
9125
- export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, ENTITY_FANOUT, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LlmTokenUsage, MAX_HOPS, MAX_MESSAGES_PER_SUMMARIZATION, MEDIUM_TTL_MS, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSection, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, 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 ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, type SynthesizeProfileOptions, TOOL_CATALOG, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, capHopsForDensity, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getConversationsPageOp, getDecayCandidatesRawOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessageOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, injectionSignatureCatalog, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, summaryToSystemMessage, supersedeVaultMemoryOp, synthesizeProfile, toolSetSystemPrompts, traverseGraphLane, ttlForType, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
9218
+ export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, ENTITY_FANOUT, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LlmTokenUsage, MAX_HOPS, MAX_MESSAGES_PER_SUMMARIZATION, MEDIUM_TTL_MS, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, 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 ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, type SynthesizeProfileOptions, TOOL_CATALOG, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, capHopsForDensity, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getConversationsPageOp, getDecayCandidatesRawOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessageOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, injectionSignatureCatalog, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, rankProfileCandidates, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, summaryToSystemMessage, supersedeVaultMemoryOp, synthesizeProfile, toolSetSystemPrompts, traverseGraphLane, ttlForType, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
@@ -7691,6 +7691,66 @@ interface LlmNeighborRefinerOptions extends PortalLlmAuth {
7691
7691
  */
7692
7692
  declare function createLlmNeighborRefiner(options: LlmNeighborRefinerOptions): NeighborRefiner;
7693
7693
 
7694
+ /**
7695
+ * Profile salience — profile-worthiness scoring for vault facts (#706).
7696
+ *
7697
+ * Distinct from query-time relevance (`recall` fusion). Answers: "is this
7698
+ * fact worth putting on a shareable profile?" using durable type, proof
7699
+ * density, and C2 observation trend. Pure + deterministic — no LLM, no DB.
7700
+ *
7701
+ * Used by:
7702
+ * - `synthesizeProfile` facet recall (default factTypeWeights)
7703
+ * - Publish-review UIs via {@link rankProfileCandidates} (nearby / client)
7704
+ *
7705
+ * Persisted `importance` is deferred until publish flow proves the need.
7706
+ */
7707
+
7708
+ /** Proof-count curve weight inside {@link scoreProfileSalience}. */
7709
+ declare const DEFAULT_PROFILE_PROOF_ALPHA = 0.2;
7710
+ /**
7711
+ * Per-FactType multipliers for profile synthesis / salience.
7712
+ * Durable identity-class types (never age-archive in decay) rank higher;
7713
+ * ephemeral plan/ongoing_context rank lower. Untyped / `other` stay neutral.
7714
+ */
7715
+ declare const DEFAULT_PROFILE_FACT_TYPE_WEIGHTS: Partial<Record<FactType, number>>;
7716
+ /** C2 trend multipliers for profile-worthiness. */
7717
+ declare const DEFAULT_PROFILE_TREND_MULTIPLIERS: Record<ObservationTrend, number>;
7718
+ interface ProfileSalienceInput extends ObservationTrendInput {
7719
+ /** Vault memory id — required for {@link rankProfileCandidates}. */
7720
+ id: string;
7721
+ /** Extractor FactType; null/undefined → neutral weight (1.0). */
7722
+ factType?: string | null;
7723
+ }
7724
+ interface RankedProfileCandidate {
7725
+ id: string;
7726
+ score: number;
7727
+ trend: ObservationTrend;
7728
+ factType?: string | null;
7729
+ proofCount: number;
7730
+ }
7731
+ interface ScoreProfileSalienceOptions {
7732
+ /** Override type weights (merged over {@link DEFAULT_PROFILE_FACT_TYPE_WEIGHTS}). */
7733
+ factTypeWeights?: Partial<Record<FactType, number>>;
7734
+ /** Override trend multipliers. */
7735
+ trendMultipliers?: Partial<Record<ObservationTrend, number>>;
7736
+ /** Proof-count α. Default: {@link DEFAULT_PROFILE_PROOF_ALPHA}. */
7737
+ proofCountAlpha?: number;
7738
+ }
7739
+ /**
7740
+ * Score a vault fact for profile-worthiness.
7741
+ *
7742
+ * `typeWeight * (1 + α·log(1+proofCount) − α·log(2)) * trendMultiplier`
7743
+ *
7744
+ * The proof term mirrors vault fusion's log curve (neutral at proofCount=1).
7745
+ * Pass `now` for deterministic evals.
7746
+ */
7747
+ declare function scoreProfileSalience(input: ProfileSalienceInput, now?: number, options?: ScoreProfileSalienceOptions): number;
7748
+ /**
7749
+ * Rank vault facts by profile-worthiness (descending score).
7750
+ * Ties broken by higher proofCount, then id ascending for stability.
7751
+ */
7752
+ declare function rankProfileCandidates(inputs: readonly ProfileSalienceInput[], now?: number, options?: ScoreProfileSalienceOptions): RankedProfileCandidate[];
7753
+
7694
7754
  /**
7695
7755
  * Unified Recall API — single retrieval surface above vault + engine.
7696
7756
  *
@@ -7828,6 +7888,12 @@ interface ReflectOptions extends RecallOptions, PortalLlmAuth {
7828
7888
  fetchFn?: typeof fetch;
7829
7889
  /** Optional JSON Schema to coerce structured outputs. */
7830
7890
  responseSchema?: Record<string, unknown>;
7891
+ /**
7892
+ * Skip Stage-1 {@link recall} and synthesize from these memories instead.
7893
+ * Used by `synthesizeProfile` after intersecting recall with a
7894
+ * `reviewedMemoryIds` gate so the LLM never sees unreviewed evidence.
7895
+ */
7896
+ memories?: RankedMemory[];
7831
7897
  }
7832
7898
  interface ReflectResult {
7833
7899
  /** The synthesized answer text. */
@@ -7951,8 +8017,9 @@ interface ProfileSection {
7951
8017
  /** Fingerprint of the config that produced a {@link ProfileDoc}. Delta reuse
7952
8018
  * (both the wholesale fast path and per-section reuse) is only valid when the
7953
8019
  * current call's config matches — otherwise reused sections could carry the
7954
- * wrong scope's evidence, un-redacted text under a now-present redactor, or an
7955
- * old section shape. */
8020
+ * wrong scope's evidence, un-redacted text under a now-present redactor, an
8021
+ * old section shape, or text grounded in memory ids that are no longer in the
8022
+ * publish-review set. */
7956
8023
  interface ProfileConfigFingerprint {
7957
8024
  /** Facet keys present in the doc, sorted. */
7958
8025
  facetKeys: ProfileFacetKey[];
@@ -7967,6 +8034,14 @@ interface ProfileConfigFingerprint {
7967
8034
  /** Whether a PII redactor gated the section text. Reusing un-gated text under
7968
8035
  * a now-present redactor would leak PII, so this flips the fingerprint. */
7969
8036
  redacted: boolean;
8037
+ /**
8038
+ * Order-independent digest of {@link SynthesizeProfileOptions.reviewedMemoryIds}.
8039
+ * Empty string when the review gate is off (omit / empty array). Changing the
8040
+ * set must invalidate reuse — otherwise a narrowed review keeps text grounded
8041
+ * in unreviewed ids, and a widened review leaves previously-cleared sections
8042
+ * empty.
8043
+ */
8044
+ reviewedMemoryIdsSignature: string;
7970
8045
  }
7971
8046
  /** A synthesized profile. Server-authoritative once published; the client
7972
8047
  * caches it and passes it back as {@link SynthesizeProfileOptions.previous}. */
@@ -8012,6 +8087,24 @@ interface SynthesizeProfileOptions extends PortalLlmAuth {
8012
8087
  * Omit only when the caller redacts downstream — `nearby` also moderates
8013
8088
  * server-side, but the client should never publish un-gated text. */
8014
8089
  redactor?: PiiRedactor;
8090
+ /**
8091
+ * Per-FactType score multipliers for facet recall. Default:
8092
+ * {@link DEFAULT_PROFILE_FACT_TYPE_WEIGHTS} (durable types boosted).
8093
+ * Does not change global chat `recall()` defaults.
8094
+ */
8095
+ factTypeWeights?: Partial<Record<FactType, number>>;
8096
+ /**
8097
+ * Proof-count α for facet recall. Default: {@link DEFAULT_PROFILE_PROOF_ALPHA}
8098
+ * (0.2). Chat recall stays at 0.1.
8099
+ */
8100
+ proofCountAlpha?: number;
8101
+ /**
8102
+ * When non-empty, intersect each facet's recalled evidence with this id set
8103
+ * before the LLM runs (publish-review gate). Empty intersection → empty
8104
+ * section (legitimate no-evidence), not a stale fallback. Omit / empty →
8105
+ * no gate.
8106
+ */
8107
+ reviewedMemoryIds?: readonly string[];
8015
8108
  }
8016
8109
  /**
8017
8110
  * Synthesize a shareable {@link ProfileDoc} from the user's vault, on-device.
@@ -9122,4 +9215,4 @@ declare function sanitizeQuotes(s: string): string;
9122
9215
  declare function renderTemplate(value: string | null | undefined, template: string): string | null;
9123
9216
  declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
9124
9217
 
9125
- export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, ENTITY_FANOUT, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LlmTokenUsage, MAX_HOPS, MAX_MESSAGES_PER_SUMMARIZATION, MEDIUM_TTL_MS, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSection, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, 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 ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, type SynthesizeProfileOptions, TOOL_CATALOG, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, capHopsForDensity, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getConversationsPageOp, getDecayCandidatesRawOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessageOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, injectionSignatureCatalog, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, summaryToSystemMessage, supersedeVaultMemoryOp, synthesizeProfile, toolSetSystemPrompts, traverseGraphLane, ttlForType, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
9218
+ export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, ENTITY_FANOUT, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LlmTokenUsage, MAX_HOPS, MAX_MESSAGES_PER_SUMMARIZATION, MEDIUM_TTL_MS, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, 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 ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, type SynthesizeProfileOptions, TOOL_CATALOG, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, capHopsForDensity, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getConversationsPageOp, getDecayCandidatesRawOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessageOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, injectionSignatureCatalog, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, rankProfileCandidates, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, summaryToSystemMessage, supersedeVaultMemoryOp, synthesizeProfile, toolSetSystemPrompts, traverseGraphLane, ttlForType, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
@@ -6267,6 +6267,61 @@ function createDecaySweeper(options) {
6267
6267
  };
6268
6268
  }
6269
6269
 
6270
+ // src/lib/memory/profileSalience.ts
6271
+ var DEFAULT_PROFILE_PROOF_ALPHA = 0.2;
6272
+ var DEFAULT_PROFILE_FACT_TYPE_WEIGHTS = {
6273
+ identity: 1.5,
6274
+ preference: 1.5,
6275
+ relationship: 1.5,
6276
+ constraint: 1.5,
6277
+ other: 1,
6278
+ plan: 0.6,
6279
+ ongoing_context: 0.6
6280
+ };
6281
+ var DEFAULT_PROFILE_TREND_MULTIPLIERS = {
6282
+ strengthening: 1.25,
6283
+ new: 1.1,
6284
+ stable: 1,
6285
+ weakening: 0.75,
6286
+ stale: 0.5
6287
+ };
6288
+ function typeWeight(factType, weights) {
6289
+ if (!factType) return 1;
6290
+ const w = weights[factType];
6291
+ if (w !== void 0 && Number.isFinite(w) && w > 0) return w;
6292
+ return 1;
6293
+ }
6294
+ function scoreProfileSalience(input, now = Date.now(), options = {}) {
6295
+ const alpha = options.proofCountAlpha ?? DEFAULT_PROFILE_PROOF_ALPHA;
6296
+ const typeWeights = { ...DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, ...options.factTypeWeights };
6297
+ const trendMults = { ...DEFAULT_PROFILE_TREND_MULTIPLIERS, ...options.trendMultipliers };
6298
+ const proofs = Math.max(1, input.proofCount ?? 1);
6299
+ const proofBoost = 1 + alpha * Math.log(1 + proofs) - alpha * Math.log(2);
6300
+ const trend = classifyObservationTrend(input, now);
6301
+ const tw = typeWeight(input.factType, typeWeights);
6302
+ const tm = trendMults[trend] ?? 1;
6303
+ const score = tw * proofBoost * tm;
6304
+ return Number.isFinite(score) ? score : 0;
6305
+ }
6306
+ function rankProfileCandidates(inputs, now = Date.now(), options = {}) {
6307
+ const ranked = inputs.map((input) => {
6308
+ const proofs = Math.max(1, input.proofCount ?? 1);
6309
+ return {
6310
+ id: input.id,
6311
+ score: scoreProfileSalience(input, now, options),
6312
+ trend: classifyObservationTrend(input, now),
6313
+ factType: input.factType ?? null,
6314
+ proofCount: proofs
6315
+ };
6316
+ });
6317
+ ranked.sort((a, b) => {
6318
+ if (b.score !== a.score) return b.score - a.score;
6319
+ if (b.proofCount !== a.proofCount) return b.proofCount - a.proofCount;
6320
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
6321
+ });
6322
+ return ranked;
6323
+ }
6324
+
6270
6325
  // src/lib/memory/recallConstants.ts
6271
6326
  var RECALL_TOOL_NAME = "recall_memory";
6272
6327
  var RECALL_MAX_LIMIT = 50;
@@ -6491,18 +6546,18 @@ async function reflect(query, ctx, options) {
6491
6546
  usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 }
6492
6547
  };
6493
6548
  if (trimmed.length === 0) return empty;
6494
- const { maxTokens: _llmMaxTokens, ...recallOptions } = options;
6495
- const recalled = await recall(trimmed, ctx, recallOptions);
6496
- const memoryIds = recalled.memories.map((m) => m.id);
6549
+ const { maxTokens: _llmMaxTokens, memories: providedMemories, ...recallOptions } = options;
6550
+ const recalledMemories = providedMemories !== void 0 ? providedMemories : (await recall(trimmed, ctx, recallOptions)).memories;
6551
+ const memoryIds = recalledMemories.map((m) => m.id);
6497
6552
  const baseResult = {
6498
6553
  text: "",
6499
6554
  basedOn: { memoryIds },
6500
6555
  usage: { promptTokens: 0, completionTokens: 0, totalTokens: 0 }
6501
6556
  };
6502
- if (recalled.memories.length === 0) {
6557
+ if (recalledMemories.length === 0) {
6503
6558
  return baseResult;
6504
6559
  }
6505
- const evidence = recalled.memories.map((m, i) => `[${i + 1}] (id: ${m.id}, kind: ${m.kind})
6560
+ const evidence = recalledMemories.map((m, i) => `[${i + 1}] (id: ${m.id}, kind: ${m.kind})
6506
6561
  ${m.content}`).join("\n\n");
6507
6562
  const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;
6508
6563
  const model = options.llmModel ?? DEFAULT_MODEL3;
@@ -6688,7 +6743,8 @@ async function synthesizeProfile(ctx, options = {}) {
6688
6743
  facetKeys: facets.map((f) => f.key).sort(),
6689
6744
  facetsSignature: facetsSignature(facets),
6690
6745
  scopes: [...scopes].sort(),
6691
- redacted: options.redactor !== void 0
6746
+ redacted: options.redactor !== void 0,
6747
+ reviewedMemoryIdsSignature: reviewedMemoryIdsSignature(options.reviewedMemoryIds)
6692
6748
  };
6693
6749
  const previous = options.previous && options.previous.version === PROFILE_DOC_VERSION && configMatches(options.previous.config, config) ? options.previous : void 0;
6694
6750
  const memories = await getAllVaultMemoriesOp(ctx.vaultCtx, {
@@ -6761,7 +6817,11 @@ async function synthesizeProfile(ctx, options = {}) {
6761
6817
  }
6762
6818
  function configMatches(a, b) {
6763
6819
  if (!a) return false;
6764
- return a.redacted === b.redacted && a.facetsSignature === b.facetsSignature && a.scopes.length === b.scopes.length && a.scopes.every((s, i) => s === b.scopes[i]);
6820
+ 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]);
6821
+ }
6822
+ function reviewedMemoryIdsSignature(ids) {
6823
+ if (ids === void 0 || ids.length === 0) return "";
6824
+ return [...new Set(ids)].sort().join("\n");
6765
6825
  }
6766
6826
  function facetsSignature(facets) {
6767
6827
  return facets.map((f) => JSON.stringify([f.key, f.label, f.query, f.guidance])).sort().join("\n");
@@ -6865,18 +6925,46 @@ async function attributeFacts(ctx, candidates, facets) {
6865
6925
  return keys;
6866
6926
  }
6867
6927
  async function synthesizeFacet(facet, ctx, options, prior) {
6928
+ const scopes = options.scopes ?? DEFAULT_SCOPES;
6929
+ const limit = options.limit ?? DEFAULT_FACET_RECALL_LIMIT;
6930
+ const factTypeWeights = { ...DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, ...options.factTypeWeights };
6931
+ const proofCountAlpha = options.proofCountAlpha ?? DEFAULT_PROFILE_PROOF_ALPHA;
6932
+ const reviewed = options.reviewedMemoryIds;
6933
+ const hasReviewGate = reviewed !== void 0 && reviewed.length > 0;
6934
+ const recalled = await recall(facet.query, ctx, {
6935
+ scopes,
6936
+ limit: hasReviewGate ? RECALL_MAX_LIMIT : limit,
6937
+ types: ["fact"],
6938
+ factTypeWeights,
6939
+ proofCountAlpha
6940
+ });
6941
+ let memories = recalled.memories;
6942
+ if (hasReviewGate) {
6943
+ const allowed = new Set(reviewed);
6944
+ memories = memories.filter((m) => allowed.has(m.id)).slice(0, limit);
6945
+ }
6946
+ if (memories.length === 0) {
6947
+ return {
6948
+ key: facet.key,
6949
+ label: facet.label,
6950
+ text: "",
6951
+ sourceMemoryIds: [],
6952
+ generatedAt: Date.now()
6953
+ };
6954
+ }
6868
6955
  const result = await reflect(facet.query, ctx, {
6869
6956
  apiKey: options.apiKey,
6870
6957
  getToken: options.getToken,
6871
6958
  llmModel: options.llmModel ?? DEFAULT_SYNTHESIS_MODEL,
6872
6959
  baseUrl: options.baseUrl,
6873
6960
  fetchFn: options.fetchFn,
6874
- scopes: options.scopes ?? DEFAULT_SCOPES,
6875
- limit: options.limit ?? DEFAULT_FACET_RECALL_LIMIT,
6961
+ scopes,
6962
+ limit,
6876
6963
  types: ["fact"],
6877
6964
  maxTokens: DEFAULT_FACET_MAX_TOKENS,
6878
6965
  systemPrompt: buildFacetSystemPrompt(facet),
6879
- responseSchema: FACET_RESPONSE_SCHEMA
6966
+ responseSchema: FACET_RESPONSE_SCHEMA,
6967
+ memories
6880
6968
  });
6881
6969
  const noEvidence = result.basedOn.memoryIds.length === 0;
6882
6970
  const { text: text12, legitimateEmpty } = extractFacetText(result.structuredOutput);
@@ -12798,6 +12886,9 @@ export {
12798
12886
  DEFAULT_MIN_MESSAGES,
12799
12887
  DEFAULT_PERSONALITY_SETTINGS,
12800
12888
  DEFAULT_PROFILE_FACETS,
12889
+ DEFAULT_PROFILE_FACT_TYPE_WEIGHTS,
12890
+ DEFAULT_PROFILE_PROOF_ALPHA,
12891
+ DEFAULT_PROFILE_TREND_MULTIPLIERS,
12801
12892
  DEFAULT_PROMPT_TEMPLATES,
12802
12893
  DEFAULT_REFRESH_EVERY_MESSAGES,
12803
12894
  DEFAULT_SERVER_TOOLS_MATCH_OPTIONS,
@@ -13010,6 +13101,7 @@ export {
13010
13101
  progressiveSummarize,
13011
13102
  projectToStored,
13012
13103
  queueManager,
13104
+ rankProfileCandidates,
13013
13105
  recall,
13014
13106
  reflect,
13015
13107
  relinkMisclassifiedVideosOp,
@@ -13022,6 +13114,7 @@ export {
13022
13114
  runToolLoop,
13023
13115
  sanitizeQuotes,
13024
13116
  schemaToCreateSQL,
13117
+ scoreProfileSalience,
13025
13118
  screenCandidatesForInjection,
13026
13119
  sdkMigrations,
13027
13120
  sdkModelClasses,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",