@anuma/sdk 2.4.2 → 2.5.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.
- package/dist/expo/{chunk-UOUJUZM4.mjs → chunk-A26RBLTJ.mjs} +97 -3
- package/dist/expo/{consolidate-HEMQGOUD.mjs → consolidate-3QQPUWD6.mjs} +15 -9
- package/dist/expo/index.cjs +232 -67
- package/dist/expo/index.d.mts +44 -7
- package/dist/expo/index.d.ts +44 -7
- package/dist/expo/index.mjs +126 -58
- package/dist/{react/recall-G3CS444F.mjs → expo/recall-JC5GF5CX.mjs} +1 -1
- package/dist/react/{chunk-IYDQBFS2.mjs → chunk-V5GC3ES7.mjs} +97 -3
- package/dist/react/{consolidate-IJH7LD2T.mjs → consolidate-3MXZV3G7.mjs} +15 -9
- package/dist/react/index.cjs +232 -67
- package/dist/react/index.d.mts +44 -7
- package/dist/react/index.d.ts +44 -7
- package/dist/react/index.mjs +126 -58
- package/dist/{expo/recall-HI7VO3VM.mjs → react/recall-IRTSMKYI.mjs} +1 -1
- package/dist/server/{chunk-3MLG7SUH.mjs → chunk-TWWLE6P3.mjs} +97 -3
- package/dist/server/{consolidate-TDT4HRHG.mjs → consolidate-CN2GQV4D.mjs} +15 -9
- package/dist/server/index.cjs +232 -67
- package/dist/server/index.d.mts +44 -7
- package/dist/server/index.d.ts +44 -7
- package/dist/server/index.mjs +126 -58
- package/dist/server/{recall-MJHGXMHZ.mjs → recall-44FIK2MJ.mjs} +1 -1
- package/package.json +1 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -53,8 +53,12 @@ import { ResultCallback } from '@nozbe/watermelondb/utils/fp/Result';
|
|
|
53
53
|
* LLM topic-extraction pass, so the background topic worker re-extracts only
|
|
54
54
|
* memories edited since (updated_at > topics_extracted_at) instead of
|
|
55
55
|
* re-running the whole vault
|
|
56
|
+
* - v37: Added superseded_by + superseded_at columns to memory_vault for
|
|
57
|
+
* write-time supersession — a changed fact retires the stale one (points at
|
|
58
|
+
* the newer memory) instead of both surviving; superseded rows are excluded
|
|
59
|
+
* from recall/dedup by default
|
|
56
60
|
*/
|
|
57
|
-
declare const SDK_SCHEMA_VERSION =
|
|
61
|
+
declare const SDK_SCHEMA_VERSION = 37;
|
|
58
62
|
/**
|
|
59
63
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
60
64
|
*
|
|
@@ -134,6 +138,7 @@ declare const sdkSchema: Readonly<{
|
|
|
134
138
|
* - v32 → v33: Added `embedding_model` column to memory_vault (null grandfathered as current-model-compatible)
|
|
135
139
|
* - v34 → v35: Added `conversation_memory` table (conversation ↔ recalled memory ids)
|
|
136
140
|
* - v35 → v36: Added `topics_extracted_at` column to memory_vault (watermark for the background topic-extraction worker; null + existing links grandfathered as extracted)
|
|
141
|
+
* - v36 → v37: Added `superseded_by` + `superseded_at` columns to memory_vault (write-time supersession; null = live, excluded from recall/dedup when set)
|
|
137
142
|
*/
|
|
138
143
|
declare const sdkMigrations: Readonly<{
|
|
139
144
|
validated: true;
|
|
@@ -4142,6 +4147,9 @@ declare class VaultMemory extends Model$1 {
|
|
|
4142
4147
|
/** Unix ms of the last LLM topic-extraction pass. Null = never extracted
|
|
4143
4148
|
* standalone (linked legacy rows are grandfathered as extracted). */
|
|
4144
4149
|
topicsExtractedAt: number | null;
|
|
4150
|
+
/** A2 supersession: newer memory id that replaced this one, or null if live. */
|
|
4151
|
+
supersededBy: string | null;
|
|
4152
|
+
supersededAt: number | null;
|
|
4145
4153
|
createdAt: Date;
|
|
4146
4154
|
updatedAt: Date;
|
|
4147
4155
|
isDeleted: boolean;
|
|
@@ -4249,6 +4257,13 @@ interface StoredVaultMemory {
|
|
|
4249
4257
|
* Null = never extracted standalone; rows that already carry entity links
|
|
4250
4258
|
* are grandfathered as extracted (see getMemoriesNeedingTopicExtractionOp). */
|
|
4251
4259
|
topicsExtractedAt: number | null;
|
|
4260
|
+
/** Write-time supersession (A2): id of the newer memory that replaced this
|
|
4261
|
+
* one (incompatible-value update, e.g. "Lives in Portland" → "Lives in SF").
|
|
4262
|
+
* Null = live. Superseded rows are excluded from recall/dedup by default but
|
|
4263
|
+
* kept for history + the read-time fallback. */
|
|
4264
|
+
supersededBy: string | null;
|
|
4265
|
+
/** Unix ms when this memory was superseded. Null when live. */
|
|
4266
|
+
supersededAt: number | null;
|
|
4252
4267
|
createdAt: Date;
|
|
4253
4268
|
updatedAt: Date;
|
|
4254
4269
|
isDeleted: boolean;
|
|
@@ -4357,12 +4372,30 @@ declare function getAllVaultMemoriesOp(ctx: VaultMemoryOperationsContext, option
|
|
|
4357
4372
|
* render "forgotten" nodes; ordinary consumers should leave this off.
|
|
4358
4373
|
*/
|
|
4359
4374
|
includeDeleted?: boolean;
|
|
4375
|
+
/**
|
|
4376
|
+
* Include A2-superseded memories (each carries `supersededBy`). Default
|
|
4377
|
+
* `false` — superseded rows are excluded, as they are from recall/dedup.
|
|
4378
|
+
* Used by a "memory history" view to render retired facts.
|
|
4379
|
+
*/
|
|
4380
|
+
includeSuperseded?: boolean;
|
|
4360
4381
|
}): Promise<StoredVaultMemory[]>;
|
|
4361
4382
|
declare function getAllVaultMemoryContentsOp(ctx: VaultMemoryOperationsContext, options?: {
|
|
4362
4383
|
since?: Date;
|
|
4363
4384
|
}): Promise<string[]>;
|
|
4364
4385
|
declare function updateVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string, opts: UpdateVaultMemoryOptions): Promise<StoredVaultMemory | null>;
|
|
4365
4386
|
declare function deleteVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string): Promise<boolean>;
|
|
4387
|
+
/**
|
|
4388
|
+
* Mark a memory as superseded by a newer one (A2 write-time supersession).
|
|
4389
|
+
* The row stays in the table (history + read-time fallback) but is excluded
|
|
4390
|
+
* from recall/dedup by default via `superseded_by`. Idempotent-ish: no-op if
|
|
4391
|
+
* the row is missing, not owned, deleted, or already superseded. Does NOT
|
|
4392
|
+
* preserve `updated_at` — superseded rows are hidden from recall, so their
|
|
4393
|
+
* recency is irrelevant.
|
|
4394
|
+
*
|
|
4395
|
+
* @param id - the memory being retired (e.g. "Lives in Portland")
|
|
4396
|
+
* @param supersededById - the newer memory that replaced it (e.g. "Lives in SF")
|
|
4397
|
+
*/
|
|
4398
|
+
declare function supersedeVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string, supersededById: string): Promise<boolean>;
|
|
4366
4399
|
/**
|
|
4367
4400
|
* Get all non-deleted, unfiled vault memories (folder_id is null).
|
|
4368
4401
|
*/
|
|
@@ -5853,7 +5886,7 @@ interface RecallDiagnostics {
|
|
|
5853
5886
|
/** Soft-degradation signals that fired this call (empty when clean). */
|
|
5854
5887
|
degraded: RecallDegradation[];
|
|
5855
5888
|
}
|
|
5856
|
-
type RetainAction = "create" | "merge" | "update" | "skip" | "suppressed";
|
|
5889
|
+
type RetainAction = "create" | "merge" | "update" | "skip" | "suppressed" | "supersede";
|
|
5857
5890
|
type RetainSource = "manual" | "auto-extracted" | "capsule";
|
|
5858
5891
|
/** Why the consolidator fell back to "create" instead of a real decision. */
|
|
5859
5892
|
type ConsolidationFallbackReason = "llm_error" | "invalid_response";
|
|
@@ -5919,7 +5952,8 @@ interface RetainOptions {
|
|
|
5919
5952
|
interface RetainResult {
|
|
5920
5953
|
action: RetainAction;
|
|
5921
5954
|
memoryId: string;
|
|
5922
|
-
/** When action is 'merge' or 'update', the prior memory's id.
|
|
5955
|
+
/** When action is 'merge' or 'update', the prior memory's id. When action is
|
|
5956
|
+
* 'supersede', the stale memory that was retired (`memoryId` is the new one). */
|
|
5923
5957
|
targetId?: string;
|
|
5924
5958
|
/**
|
|
5925
5959
|
* When action is 'suppressed', the id of the soft-deleted memory that blocked
|
|
@@ -6141,9 +6175,12 @@ declare function extractFacts(messages: AutoExtractMessage[], options: ExtractFa
|
|
|
6141
6175
|
type ExtractOutcome = "extracted" | "no-facts" | "empty-after-retry" | "dropped-after-redaction";
|
|
6142
6176
|
/**
|
|
6143
6177
|
* Stage 2 — for each extracted candidate, call retain() with auto-merge
|
|
6144
|
-
* enabled.
|
|
6145
|
-
*
|
|
6146
|
-
*
|
|
6178
|
+
* enabled. When `consolidateOptions` are wired, retain()'s consolidation pass
|
|
6179
|
+
* is the "resolver": a second LLM call against the top-K existing vault
|
|
6180
|
+
* memories that decides create/update/noop/supersede — including retiring a
|
|
6181
|
+
* stale value on a state change (the supersession the extraction prompt above
|
|
6182
|
+
* promises). Without consolidation, retain() still dedups at the cosine-merge
|
|
6183
|
+
* level, and the read-time supersession heuristic remains the fallback.
|
|
6147
6184
|
*
|
|
6148
6185
|
* Returns the candidates that survived validation along with the retain
|
|
6149
6186
|
* result for each (which captures whether the fact was created, merged,
|
|
@@ -7731,4 +7768,4 @@ declare function sanitizeQuotes(s: string): string;
|
|
|
7731
7768
|
declare function renderTemplate(value: string | null | undefined, template: string): string | null;
|
|
7732
7769
|
declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
|
|
7733
7770
|
|
|
7734
|
-
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 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_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, 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 EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, INFERENCE_ID_HEADER, type LazyStoredConversation, type LlmTokenUsage, MAX_MESSAGES_PER_SUMMARIZATION, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, type OperationExecutor, 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 ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, 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, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, 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, TOOL_CATALOG, TOPIC_EXTRACTION_BATCH_SIZE, 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, 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, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, 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, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summaryToSystemMessage, toolSetSystemPrompts, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
|
|
7771
|
+
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 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_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, 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 EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, INFERENCE_ID_HEADER, type LazyStoredConversation, type LlmTokenUsage, MAX_MESSAGES_PER_SUMMARIZATION, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, type OperationExecutor, 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 ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, 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, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, 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, TOOL_CATALOG, TOPIC_EXTRACTION_BATCH_SIZE, 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, 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, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, 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, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summaryToSystemMessage, supersedeVaultMemoryOp, toolSetSystemPrompts, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
|
package/dist/server/index.mjs
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
createMemoryVaultSearchTool,
|
|
23
23
|
createMessageOp,
|
|
24
24
|
createSseClient,
|
|
25
|
+
createSupersedingMemoryOp,
|
|
25
26
|
createVaultEmbeddingCache,
|
|
26
27
|
createVaultMemoriesBatchOp,
|
|
27
28
|
createVaultMemoryOp,
|
|
@@ -92,6 +93,7 @@ import {
|
|
|
92
93
|
shouldChunkMessage,
|
|
93
94
|
stampTopicsExtractedAtOp,
|
|
94
95
|
stripToolCalls,
|
|
96
|
+
supersedeVaultMemoryOp,
|
|
95
97
|
updateConversationProjectOp,
|
|
96
98
|
updateConversationTitleOp,
|
|
97
99
|
updateMessageChunksOp,
|
|
@@ -102,7 +104,7 @@ import {
|
|
|
102
104
|
updateVaultMemoryOp,
|
|
103
105
|
upsertMessageOp,
|
|
104
106
|
vaultMemoryToStored
|
|
105
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-TWWLE6P3.mjs";
|
|
106
108
|
import {
|
|
107
109
|
createStreamingDeAnonymizer,
|
|
108
110
|
resolvePiiRedactor
|
|
@@ -1096,6 +1098,12 @@ __decorateClass([
|
|
|
1096
1098
|
__decorateClass([
|
|
1097
1099
|
(0, import_decorators6.field)("topics_extracted_at")
|
|
1098
1100
|
], VaultMemory.prototype, "topicsExtractedAt", 2);
|
|
1101
|
+
__decorateClass([
|
|
1102
|
+
(0, import_decorators6.field)("superseded_by")
|
|
1103
|
+
], VaultMemory.prototype, "supersededBy", 2);
|
|
1104
|
+
__decorateClass([
|
|
1105
|
+
(0, import_decorators6.field)("superseded_at")
|
|
1106
|
+
], VaultMemory.prototype, "supersededAt", 2);
|
|
1099
1107
|
__decorateClass([
|
|
1100
1108
|
import_decorators6.readonly,
|
|
1101
1109
|
(0, import_decorators6.date)("created_at")
|
|
@@ -1243,7 +1251,7 @@ __decorateClass([
|
|
|
1243
1251
|
], VaultFolder.prototype, "context", 2);
|
|
1244
1252
|
|
|
1245
1253
|
// src/lib/db/schema.ts
|
|
1246
|
-
var SDK_SCHEMA_VERSION =
|
|
1254
|
+
var SDK_SCHEMA_VERSION = 37;
|
|
1247
1255
|
var sdkSchema = (0, import_watermelondb12.appSchema)({
|
|
1248
1256
|
version: SDK_SCHEMA_VERSION,
|
|
1249
1257
|
tables: [
|
|
@@ -1368,7 +1376,16 @@ var sdkSchema = (0, import_watermelondb12.appSchema)({
|
|
|
1368
1376
|
// Unix ms of the last LLM topic-extraction pass over this memory's
|
|
1369
1377
|
// content. Null = never extracted standalone (legacy rows with entity
|
|
1370
1378
|
// links are grandfathered — see getMemoriesNeedingTopicExtractionOp).
|
|
1371
|
-
{ name: "topics_extracted_at", type: "number", isOptional: true }
|
|
1379
|
+
{ name: "topics_extracted_at", type: "number", isOptional: true },
|
|
1380
|
+
// Write-time supersession (A2). When set, this fact was replaced by a
|
|
1381
|
+
// newer, incompatible-value fact (e.g. "Lives in Portland" superseded by
|
|
1382
|
+
// "Lives in SF"); `superseded_by` points at the newer memory's id and
|
|
1383
|
+
// `superseded_at` is the Unix ms it happened. Superseded rows stay in
|
|
1384
|
+
// the table (history / read-time fallback) but are excluded from recall
|
|
1385
|
+
// and dedup by default. Null = live (not superseded). Indexed so the
|
|
1386
|
+
// recall filter stays cheap.
|
|
1387
|
+
{ name: "superseded_by", type: "string", isOptional: true, isIndexed: true },
|
|
1388
|
+
{ name: "superseded_at", type: "number", isOptional: true }
|
|
1372
1389
|
]
|
|
1373
1390
|
}),
|
|
1374
1391
|
// Entity table — canonical names extracted from auto-extraction (W5).
|
|
@@ -1979,6 +1996,21 @@ var sdkMigrations = (0, import_migrations.schemaMigrations)({
|
|
|
1979
1996
|
columns: [{ name: "topics_extracted_at", type: "number", isOptional: true }]
|
|
1980
1997
|
})
|
|
1981
1998
|
]
|
|
1999
|
+
},
|
|
2000
|
+
// v36 -> v37: write-time supersession columns on memory_vault. Existing rows
|
|
2001
|
+
// keep both NULL (= live / not superseded), so no backfill — legacy
|
|
2002
|
+
// contradictory rows are handled by the read-time supersession fallback.
|
|
2003
|
+
{
|
|
2004
|
+
toVersion: 37,
|
|
2005
|
+
steps: [
|
|
2006
|
+
(0, import_migrations.addColumns)({
|
|
2007
|
+
table: "memory_vault",
|
|
2008
|
+
columns: [
|
|
2009
|
+
{ name: "superseded_by", type: "string", isOptional: true, isIndexed: true },
|
|
2010
|
+
{ name: "superseded_at", type: "number", isOptional: true }
|
|
2011
|
+
]
|
|
2012
|
+
})
|
|
2013
|
+
]
|
|
1982
2014
|
}
|
|
1983
2015
|
]
|
|
1984
2016
|
});
|
|
@@ -4677,53 +4709,62 @@ async function retain(content, ctx, options = {}) {
|
|
|
4677
4709
|
const enableAutoMerge = options.enableAutoMerge ?? true;
|
|
4678
4710
|
const threshold = options.autoMergeThreshold ?? DEFAULT_AUTO_MERGE_THRESHOLD;
|
|
4679
4711
|
const resolvedScope = options.scope ?? DEFAULT_SCOPE;
|
|
4712
|
+
let supersedeTargetId;
|
|
4713
|
+
let supersedeContent;
|
|
4680
4714
|
if (enableAutoMerge) {
|
|
4681
4715
|
if (options.consolidateOptions) {
|
|
4682
|
-
const
|
|
4683
|
-
if (
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
);
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4716
|
+
const outcome = await tryConsolidate(trimmed, ctx, options);
|
|
4717
|
+
if (outcome) {
|
|
4718
|
+
if ("done" in outcome) return outcome.done;
|
|
4719
|
+
supersedeTargetId = outcome.supersede;
|
|
4720
|
+
supersedeContent = outcome.content;
|
|
4721
|
+
}
|
|
4722
|
+
}
|
|
4723
|
+
if (!supersedeTargetId) {
|
|
4724
|
+
const matches = await searchVaultMemories(
|
|
4725
|
+
trimmed,
|
|
4726
|
+
ctx.vaultCtx,
|
|
4727
|
+
ctx.embeddingOptions,
|
|
4728
|
+
ctx.vaultCache,
|
|
4729
|
+
{
|
|
4730
|
+
limit: 1,
|
|
4731
|
+
minSimilarity: threshold,
|
|
4732
|
+
useFusion: false,
|
|
4733
|
+
scopes: [resolvedScope],
|
|
4734
|
+
...options.folderId !== void 0 && { folderId: options.folderId }
|
|
4735
|
+
}
|
|
4736
|
+
);
|
|
4737
|
+
if (matches.length > 0) {
|
|
4738
|
+
const targetId = matches[0].uniqueId;
|
|
4739
|
+
const existing = await getVaultMemoryOp(ctx.vaultCtx, targetId);
|
|
4740
|
+
if (existing && !existing.supersededBy) {
|
|
4741
|
+
const mergedSourceIds = unionStrings(
|
|
4742
|
+
existing.sourceChunkIds ?? [],
|
|
4743
|
+
options.sourceChunkIds ?? []
|
|
4744
|
+
);
|
|
4745
|
+
const eventTimeUpdate = pickEventTimeUpdate(existing, options.eventTime);
|
|
4746
|
+
const updated = await updateVaultMemoryOp(ctx.vaultCtx, targetId, {
|
|
4747
|
+
content: existing.content,
|
|
4748
|
+
proofCountIncrement: 1,
|
|
4749
|
+
sourceChunkIds: mergedSourceIds,
|
|
4750
|
+
preserveUpdatedAt: true,
|
|
4751
|
+
...eventTimeUpdate && { eventTime: eventTimeUpdate }
|
|
4752
|
+
});
|
|
4753
|
+
if (updated) {
|
|
4754
|
+
return {
|
|
4755
|
+
action: "merge",
|
|
4756
|
+
memoryId: targetId,
|
|
4757
|
+
targetId,
|
|
4758
|
+
proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
|
|
4759
|
+
};
|
|
4760
|
+
}
|
|
4761
|
+
await assertMergeTargetGoneOrThrow(ctx, targetId);
|
|
4721
4762
|
}
|
|
4722
|
-
await assertMergeTargetGoneOrThrow(ctx, targetId);
|
|
4723
4763
|
}
|
|
4724
4764
|
}
|
|
4725
4765
|
}
|
|
4726
|
-
const
|
|
4766
|
+
const contentToWrite = supersedeContent ?? trimmed;
|
|
4767
|
+
const embedding = await generateEmbedding(contentToWrite, ctx.embeddingOptions);
|
|
4727
4768
|
const embeddingModel = ctx.embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
4728
4769
|
if (options.respectTombstones) {
|
|
4729
4770
|
const tombstoneId = await findTombstoneMatch(embedding, embeddingModel, resolvedScope, ctx, {
|
|
@@ -4734,8 +4775,8 @@ async function retain(content, ctx, options = {}) {
|
|
|
4734
4775
|
return { action: "suppressed", memoryId: tombstoneId, tombstoneId, proofCount: 0 };
|
|
4735
4776
|
}
|
|
4736
4777
|
}
|
|
4737
|
-
const
|
|
4738
|
-
content:
|
|
4778
|
+
const createOpts = {
|
|
4779
|
+
content: contentToWrite,
|
|
4739
4780
|
scope: resolvedScope,
|
|
4740
4781
|
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
4741
4782
|
embedding: JSON.stringify(embedding),
|
|
@@ -4752,7 +4793,24 @@ async function retain(content, ctx, options = {}) {
|
|
|
4752
4793
|
kind: options.eventTime.kind
|
|
4753
4794
|
}
|
|
4754
4795
|
}
|
|
4755
|
-
}
|
|
4796
|
+
};
|
|
4797
|
+
if (supersedeTargetId) {
|
|
4798
|
+
const { created: created2, retired } = await createSupersedingMemoryOp(
|
|
4799
|
+
ctx.vaultCtx,
|
|
4800
|
+
createOpts,
|
|
4801
|
+
supersedeTargetId
|
|
4802
|
+
);
|
|
4803
|
+
if (created2 && retired) {
|
|
4804
|
+
ctx.vaultCache.set(created2.uniqueId, Float32Array.from(embedding));
|
|
4805
|
+
return {
|
|
4806
|
+
action: "supersede",
|
|
4807
|
+
memoryId: created2.uniqueId,
|
|
4808
|
+
targetId: supersedeTargetId,
|
|
4809
|
+
proofCount: 1
|
|
4810
|
+
};
|
|
4811
|
+
}
|
|
4812
|
+
}
|
|
4813
|
+
const created = await createVaultMemoryOp(ctx.vaultCtx, createOpts);
|
|
4756
4814
|
ctx.vaultCache.set(created.uniqueId, Float32Array.from(embedding));
|
|
4757
4815
|
return {
|
|
4758
4816
|
action: "create",
|
|
@@ -4819,12 +4877,17 @@ async function tryConsolidate(trimmed, ctx, options) {
|
|
|
4819
4877
|
content: m.content,
|
|
4820
4878
|
similarity: m.similarity
|
|
4821
4879
|
}));
|
|
4822
|
-
const { consolidateMemory: doConsolidate } = await import("./consolidate-
|
|
4880
|
+
const { consolidateMemory: doConsolidate } = await import("./consolidate-CN2GQV4D.mjs");
|
|
4823
4881
|
const decision = await doConsolidate(trimmed, candidates, consolidateOptions);
|
|
4824
4882
|
if (decision.action === "create") return null;
|
|
4883
|
+
if (decision.action === "supersede" && decision.targetId && decision.content) {
|
|
4884
|
+
const existing = await getVaultMemoryOp(ctx.vaultCtx, decision.targetId);
|
|
4885
|
+
if (!existing || existing.supersededBy) return null;
|
|
4886
|
+
return { supersede: decision.targetId, content: decision.content };
|
|
4887
|
+
}
|
|
4825
4888
|
if (decision.action === "noop" && decision.targetId) {
|
|
4826
4889
|
const existing = await getVaultMemoryOp(ctx.vaultCtx, decision.targetId);
|
|
4827
|
-
if (!existing) return null;
|
|
4890
|
+
if (!existing || existing.supersededBy) return null;
|
|
4828
4891
|
const mergedSourceIds = unionStrings(
|
|
4829
4892
|
existing.sourceChunkIds ?? [],
|
|
4830
4893
|
options.sourceChunkIds ?? []
|
|
@@ -4842,15 +4905,17 @@ async function tryConsolidate(trimmed, ctx, options) {
|
|
|
4842
4905
|
return null;
|
|
4843
4906
|
}
|
|
4844
4907
|
return {
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4908
|
+
done: {
|
|
4909
|
+
action: "merge",
|
|
4910
|
+
memoryId: decision.targetId,
|
|
4911
|
+
targetId: decision.targetId,
|
|
4912
|
+
proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
|
|
4913
|
+
}
|
|
4849
4914
|
};
|
|
4850
4915
|
}
|
|
4851
4916
|
if (decision.action === "update" && decision.targetId && decision.content) {
|
|
4852
4917
|
const existing = await getVaultMemoryOp(ctx.vaultCtx, decision.targetId);
|
|
4853
|
-
if (!existing) return null;
|
|
4918
|
+
if (!existing || existing.supersededBy) return null;
|
|
4854
4919
|
const mergedSourceIds = unionStrings(
|
|
4855
4920
|
existing.sourceChunkIds ?? [],
|
|
4856
4921
|
options.sourceChunkIds ?? []
|
|
@@ -4877,10 +4942,12 @@ async function tryConsolidate(trimmed, ctx, options) {
|
|
|
4877
4942
|
}
|
|
4878
4943
|
ctx.vaultCache.set(decision.targetId, Float32Array.from(newEmbedding));
|
|
4879
4944
|
return {
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4945
|
+
done: {
|
|
4946
|
+
action: "update",
|
|
4947
|
+
memoryId: decision.targetId,
|
|
4948
|
+
targetId: decision.targetId,
|
|
4949
|
+
proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
|
|
4950
|
+
}
|
|
4884
4951
|
};
|
|
4885
4952
|
}
|
|
4886
4953
|
return null;
|
|
@@ -11552,6 +11619,7 @@ export {
|
|
|
11552
11619
|
streamCancelPath,
|
|
11553
11620
|
streamReplayPath,
|
|
11554
11621
|
summaryToSystemMessage,
|
|
11622
|
+
supersedeVaultMemoryOp,
|
|
11555
11623
|
toolSetSystemPrompts,
|
|
11556
11624
|
updateConversationProjectOp,
|
|
11557
11625
|
updateConversationTitleOp,
|