@anuma/sdk 6.34.0 → 6.36.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/index.cjs +858 -52
- package/dist/expo/index.d.mts +134 -8
- package/dist/expo/index.d.ts +134 -8
- package/dist/expo/index.mjs +848 -52
- package/dist/memory/context.d.mts +21 -1
- package/dist/memory/context.d.ts +21 -1
- package/dist/react/index.cjs +848 -42
- package/dist/react/index.d.mts +134 -8
- package/dist/react/index.d.ts +134 -8
- package/dist/react/index.mjs +838 -42
- package/dist/server/index.cjs +201 -13
- package/dist/server/index.d.mts +61 -8
- package/dist/server/index.d.ts +61 -8
- package/dist/server/index.mjs +198 -13
- package/package.json +1 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -4775,8 +4775,10 @@ declare function deleteConversationSummaryOp(ctx: SummaryOperationsContext, conv
|
|
|
4775
4775
|
* budget was in memory and reset on every turn, so one batch that could never
|
|
4776
4776
|
* extract blocked its conversation's extraction forever. Additive, both
|
|
4777
4777
|
* nullable, no backfill: NULL reads as "never failed"
|
|
4778
|
+
* - v48: Added kind, kind_value (encrypted) and level to memory_vault; level is
|
|
4779
|
+
* backfilled from scope where SQL steps run
|
|
4778
4780
|
*/
|
|
4779
|
-
declare const SDK_SCHEMA_VERSION =
|
|
4781
|
+
declare const SDK_SCHEMA_VERSION = 48;
|
|
4780
4782
|
/**
|
|
4781
4783
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
4782
4784
|
*
|
|
@@ -4865,6 +4867,7 @@ declare const sdkSchema: Readonly<{
|
|
|
4865
4867
|
* - v41 → v42: Added `topics` + `topics_updated_at` columns to memory_vault, making a memory's topics the durable synced record and `entity`/`memory_entity` a device-local index over it (null `topics` = pre-v42, backfilled from the row's current links by the sweep)
|
|
4866
4868
|
* - v42 → v43: Added a composite `(is_deleted, created_at)` index to conversations so the list reads stop temp-sorting (structural only, no data rewritten)
|
|
4867
4869
|
* - v43 → v44: Added `origin` column to history recording which producer synthesised a row, so the embedding sweep can skip never-rendered tool-result dumps (plaintext by design — the sweep has no wallet context; null = legacy, embedded as before)
|
|
4870
|
+
* - v47 → v48: Added `kind`, `kind_value`, `level` to memory_vault; `level` backfilled from `scope` (`shared`/`public` → matching, else private) where SQL steps run
|
|
4868
4871
|
*/
|
|
4869
4872
|
declare const sdkMigrations: Readonly<{
|
|
4870
4873
|
validated: true;
|
|
@@ -5382,6 +5385,12 @@ declare class VaultMemory extends Model {
|
|
|
5382
5385
|
static table: string;
|
|
5383
5386
|
content: string;
|
|
5384
5387
|
scope: string;
|
|
5388
|
+
/** Profile kind, or null for a free-form memory. */
|
|
5389
|
+
kind: string | null;
|
|
5390
|
+
/** Canonical JSON value of a kinded memory, encrypted at rest. */
|
|
5391
|
+
kindValue: string | null;
|
|
5392
|
+
/** private | matching | profile. */
|
|
5393
|
+
level: string | null;
|
|
5385
5394
|
folderId: string | null;
|
|
5386
5395
|
userId: string | null;
|
|
5387
5396
|
embedding: string | null;
|
|
@@ -7135,13 +7144,35 @@ declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: Ret
|
|
|
7135
7144
|
* the fail-safe direction: it un-publishes rather than exposes.
|
|
7136
7145
|
*/
|
|
7137
7146
|
type VaultMemoryVisibility = "private" | "public";
|
|
7147
|
+
/** Profile kinds a vault memory can carry. */
|
|
7148
|
+
declare const MEMORY_KINDS: readonly ["display_name", "birth_date", "bio", "occupation", "interest", "gender", "height_cm", "looking_for", "politics", "religion", "ethnicity", "smoking", "drinking", "exercise", "sexuality", "prompt"];
|
|
7149
|
+
/** One of {@link MEMORY_KINDS}. */
|
|
7150
|
+
type VaultMemoryKind = (typeof MEMORY_KINDS)[number];
|
|
7151
|
+
/** Who a memory reaches. */
|
|
7152
|
+
declare const MEMORY_LEVELS: readonly ["private", "matching", "profile"];
|
|
7153
|
+
/** One of {@link MEMORY_LEVELS}. */
|
|
7154
|
+
type MemoryLevel = (typeof MEMORY_LEVELS)[number];
|
|
7155
|
+
/**
|
|
7156
|
+
* Thrown by vault writes that would store an unknown kind or level, or a profile level without a kind.
|
|
7157
|
+
*
|
|
7158
|
+
* @public
|
|
7159
|
+
*/
|
|
7160
|
+
declare class MemoryLevelError extends Error {
|
|
7161
|
+
constructor(message: string);
|
|
7162
|
+
}
|
|
7138
7163
|
interface StoredVaultMemory {
|
|
7139
7164
|
/** WatermelonDB internal ID */
|
|
7140
7165
|
uniqueId: string;
|
|
7141
7166
|
/** Plain text memory content */
|
|
7142
7167
|
content: string;
|
|
7143
|
-
/** Scope for partitioning memories (e.g., "private", "shared") */
|
|
7168
|
+
/** Scope for partitioning memories (e.g., "private", "shared"). */
|
|
7144
7169
|
scope: string;
|
|
7170
|
+
/** Profile kind ({@link MEMORY_KINDS}) or null for a free-form memory. */
|
|
7171
|
+
kind?: string | null;
|
|
7172
|
+
/** Canonical value of a kinded memory, JSON-encoded (slug, slug[], int, date, text). */
|
|
7173
|
+
kindValue?: string | null;
|
|
7174
|
+
/** Who this memory reaches. */
|
|
7175
|
+
level?: MemoryLevel;
|
|
7145
7176
|
/** Folder ID for organization, null if unfiled */
|
|
7146
7177
|
folderId: string | null;
|
|
7147
7178
|
/** User ID for multi-user server-side scoping, null on client */
|
|
@@ -7245,8 +7276,14 @@ interface PhotoMediaRef {
|
|
|
7245
7276
|
declare function parseMedia(value: unknown): PhotoMediaRef[] | null;
|
|
7246
7277
|
interface CreateVaultMemoryOptions {
|
|
7247
7278
|
content: string;
|
|
7248
|
-
/** Scope for the memory.
|
|
7279
|
+
/** Scope for the memory. */
|
|
7249
7280
|
scope?: string;
|
|
7281
|
+
/** Profile kind, or omit/null for a free-form memory. */
|
|
7282
|
+
kind?: VaultMemoryKind | null;
|
|
7283
|
+
/** Canonical JSON value of a kinded memory. */
|
|
7284
|
+
kindValue?: string | null;
|
|
7285
|
+
/** Who this memory reaches. */
|
|
7286
|
+
level?: MemoryLevel;
|
|
7250
7287
|
/** Folder ID for organization, null or omitted if unfiled */
|
|
7251
7288
|
folderId?: string | null;
|
|
7252
7289
|
/** JSON-stringified embedding vector to persist */
|
|
@@ -7287,8 +7324,19 @@ interface CreateVaultMemoryOptions {
|
|
|
7287
7324
|
}
|
|
7288
7325
|
interface UpdateVaultMemoryOptions {
|
|
7289
7326
|
content: string;
|
|
7290
|
-
/**
|
|
7327
|
+
/** When true, the write is skipped (returns null) if the row carries a profile kind. */
|
|
7328
|
+
freeFormOnly?: boolean;
|
|
7329
|
+
/**
|
|
7330
|
+
* If provided, updates the memory's scope (and the level it implies; a `profile` row keeps
|
|
7331
|
+
* `profile` under `scope: "shared"`).
|
|
7332
|
+
*/
|
|
7291
7333
|
scope?: string;
|
|
7334
|
+
/** If provided, sets the profile kind (null makes the memory free-form). */
|
|
7335
|
+
kind?: VaultMemoryKind | null;
|
|
7336
|
+
/** If provided, sets the canonical JSON value (null clears it). */
|
|
7337
|
+
kindValue?: string | null;
|
|
7338
|
+
/** If provided, sets the level (and dual-writes `scope`). */
|
|
7339
|
+
level?: MemoryLevel;
|
|
7292
7340
|
/** If provided, moves the memory to this folder. */
|
|
7293
7341
|
folderId?: string | null;
|
|
7294
7342
|
/** JSON-stringified embedding vector to persist, or null to clear stale embedding */
|
|
@@ -7428,6 +7476,10 @@ declare function getAllVaultMemoriesOp(ctx: VaultMemoryOperationsContext, option
|
|
|
7428
7476
|
* published set to diff against the server index.
|
|
7429
7477
|
*/
|
|
7430
7478
|
visibility?: VaultMemoryVisibility[];
|
|
7479
|
+
/** Filter by level. */
|
|
7480
|
+
levels?: MemoryLevel[];
|
|
7481
|
+
/** Restrict to these profile kinds. */
|
|
7482
|
+
kinds?: string[];
|
|
7431
7483
|
}): Promise<StoredVaultMemory[]>;
|
|
7432
7484
|
declare function getAllVaultMemoryContentsOp(ctx: VaultMemoryOperationsContext, options?: {
|
|
7433
7485
|
since?: Date;
|
|
@@ -7667,7 +7719,8 @@ interface DecayCandidateRaw {
|
|
|
7667
7719
|
*
|
|
7668
7720
|
* Includes archived AND quarantined rows (so archived→delete transitions and
|
|
7669
7721
|
* aged quarantined rows are seen) but excludes hard-deleted rows — the
|
|
7670
|
-
* `baseVaultConditions` default keeps `is_deleted = false`.
|
|
7722
|
+
* `baseVaultConditions` default keeps `is_deleted = false`. Excludes kinded
|
|
7723
|
+
* (profile) memories, which never decay.
|
|
7671
7724
|
*
|
|
7672
7725
|
* Refuses to run on an unscoped multi-tenant context (see
|
|
7673
7726
|
* {@link assertVaultScopeForSweep}).
|
|
@@ -9660,8 +9713,8 @@ interface SynthesizeProfileOptions extends PortalLlmAuth {
|
|
|
9660
9713
|
* on memories the user approved for publication. Empty intersection → empty
|
|
9661
9714
|
* section (legitimate no-evidence), not a stale fallback.
|
|
9662
9715
|
*
|
|
9663
|
-
* Pass the user's published set (e.g. `getAllVaultMemoriesOp(ctx, {
|
|
9664
|
-
* ["
|
|
9716
|
+
* Pass the user's published set (e.g. `getAllVaultMemoriesOp(ctx, { levels:
|
|
9717
|
+
* ["matching", "profile"] })`) to keep a published profile derivable only from published
|
|
9665
9718
|
* memories — People Nearby's two-tier model treats `private` memories as never
|
|
9666
9719
|
* leaving the device, and a summary derived from them is a derivative that does.
|
|
9667
9720
|
*
|
|
@@ -10734,4 +10787,4 @@ declare class PostgreSQLAdapter implements DatabaseAdapter {
|
|
|
10734
10787
|
*/
|
|
10735
10788
|
declare function serverPlatformStorage(): PlatformStorage;
|
|
10736
10789
|
|
|
10737
|
-
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 ConsolidationAction, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, 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, type DurableAutoExtractorOptions, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, 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, type LocalMemoryStoreOptions, 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 MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryListOptions, type MemoryMaintenance, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, Message, type MessageChunk, type MessageFeedback, type MessageOrigin, 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 PhotoIngestResult, type PhotoMediaRef, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, 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 PublishedPhotoMemory, 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 RecallEmptyReason, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunTerminalState, 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 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 TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultEmbeddingExpectation, VaultMemory, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, assembleMemoryContext, backfillMemoryTopicsOp, 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, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createMessageSourceResolver, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteMessageOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultMemoryOp, deriveKeyFromSignatureBytes, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, 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, getVaultMemoryOp, getVideosOp, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isDegradedTopicSkip, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, onKeyAvailable, parseMedia, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, relinkMemoryTopicsOp, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, seedEncryptionKeys, selectServerToolsForPrompt, serverPlatformStorage, setMemoryVisibilityOp, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRecallMemory, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, summaryToSystemMessage, supersedeVaultMemoryOp, synthesizeProfile, toolSetSystemPrompts, traverseGraphLane, ttlForType, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp, verifyMemoriesForPublish };
|
|
10790
|
+
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 ConsolidationAction, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, 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, type DurableAutoExtractorOptions, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, 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, type LocalMemoryStoreOptions, MAX_HOPS, MAX_MESSAGES_PER_SUMMARIZATION, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, Message, type MessageChunk, type MessageFeedback, type MessageOrigin, 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 PhotoIngestResult, type PhotoMediaRef, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, 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 PublishedPhotoMemory, 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 RecallEmptyReason, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunTerminalState, 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 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 TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultEmbeddingExpectation, VaultMemory, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, archiveVaultMemoryOp, assembleMemoryContext, backfillMemoryTopicsOp, 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, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createMessageSourceResolver, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteMessageOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultMemoryOp, deriveKeyFromSignatureBytes, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, 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, getVaultMemoryOp, getVideosOp, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isDegradedTopicSkip, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, onKeyAvailable, parseMedia, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, relinkMemoryTopicsOp, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, restoreVaultMemoryOp, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, seedEncryptionKeys, selectServerToolsForPrompt, serverPlatformStorage, setMemoryVisibilityOp, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRecallMemory, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, summaryToSystemMessage, supersedeVaultMemoryOp, synthesizeProfile, toolSetSystemPrompts, traverseGraphLane, ttlForType, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp, verifyMemoriesForPublish };
|
package/dist/server/index.mjs
CHANGED
|
@@ -23733,6 +23733,15 @@ __decorateClass([
|
|
|
23733
23733
|
__decorateClass([
|
|
23734
23734
|
(0, import_decorators6.text)("scope")
|
|
23735
23735
|
], VaultMemory.prototype, "scope", 2);
|
|
23736
|
+
__decorateClass([
|
|
23737
|
+
(0, import_decorators6.field)("kind")
|
|
23738
|
+
], VaultMemory.prototype, "kind", 2);
|
|
23739
|
+
__decorateClass([
|
|
23740
|
+
(0, import_decorators6.field)("kind_value")
|
|
23741
|
+
], VaultMemory.prototype, "kindValue", 2);
|
|
23742
|
+
__decorateClass([
|
|
23743
|
+
(0, import_decorators6.field)("level")
|
|
23744
|
+
], VaultMemory.prototype, "level", 2);
|
|
23736
23745
|
__decorateClass([
|
|
23737
23746
|
(0, import_decorators6.field)("folder_id")
|
|
23738
23747
|
], VaultMemory.prototype, "folderId", 2);
|
|
@@ -23958,7 +23967,7 @@ __decorateClass([
|
|
|
23958
23967
|
], VaultFolder.prototype, "context", 2);
|
|
23959
23968
|
|
|
23960
23969
|
// src/lib/db/schema.ts
|
|
23961
|
-
var SDK_SCHEMA_VERSION =
|
|
23970
|
+
var SDK_SCHEMA_VERSION = 48;
|
|
23962
23971
|
var sdkSchema = (0, import_watermelondb15.appSchema)({
|
|
23963
23972
|
version: SDK_SCHEMA_VERSION,
|
|
23964
23973
|
tables: [
|
|
@@ -24053,6 +24062,9 @@ var sdkSchema = (0, import_watermelondb15.appSchema)({
|
|
|
24053
24062
|
columns: [
|
|
24054
24063
|
{ name: "content", type: "string" },
|
|
24055
24064
|
{ name: "scope", type: "string", isIndexed: true },
|
|
24065
|
+
{ name: "kind", type: "string", isOptional: true, isIndexed: true },
|
|
24066
|
+
{ name: "kind_value", type: "string", isOptional: true },
|
|
24067
|
+
{ name: "level", type: "string", isOptional: true, isIndexed: true },
|
|
24056
24068
|
{ name: "folder_id", type: "string", isOptional: true, isIndexed: true },
|
|
24057
24069
|
{ name: "created_at", type: "number", isIndexed: true },
|
|
24058
24070
|
{ name: "updated_at", type: "number", isIndexed: true },
|
|
@@ -24729,6 +24741,22 @@ var sdkMigrations = (0, import_migrations.schemaMigrations)({
|
|
|
24729
24741
|
]
|
|
24730
24742
|
})
|
|
24731
24743
|
]
|
|
24744
|
+
},
|
|
24745
|
+
{
|
|
24746
|
+
toVersion: 48,
|
|
24747
|
+
steps: [
|
|
24748
|
+
(0, import_migrations.addColumns)({
|
|
24749
|
+
table: "memory_vault",
|
|
24750
|
+
columns: [
|
|
24751
|
+
{ name: "kind", type: "string", isOptional: true, isIndexed: true },
|
|
24752
|
+
{ name: "kind_value", type: "string", isOptional: true },
|
|
24753
|
+
{ name: "level", type: "string", isOptional: true, isIndexed: true }
|
|
24754
|
+
]
|
|
24755
|
+
}),
|
|
24756
|
+
(0, import_migrations.unsafeExecuteSql)(
|
|
24757
|
+
"UPDATE memory_vault SET level = CASE WHEN scope IN ('shared', 'public') THEN 'matching' ELSE 'private' END WHERE level IS NULL;"
|
|
24758
|
+
)
|
|
24759
|
+
]
|
|
24732
24760
|
}
|
|
24733
24761
|
]
|
|
24734
24762
|
});
|
|
@@ -25880,13 +25908,54 @@ async function decryptVaultMemoryFields(memory, address, signMessage, embeddedWa
|
|
|
25880
25908
|
}
|
|
25881
25909
|
}
|
|
25882
25910
|
const decryptedContent = await decryptField(memory.content, address);
|
|
25911
|
+
const decryptedKindValue = typeof memory.kindValue === "string" ? await decryptField(memory.kindValue, address) : memory.kindValue;
|
|
25883
25912
|
return {
|
|
25884
25913
|
...memory,
|
|
25885
|
-
content: decryptedContent
|
|
25914
|
+
content: decryptedContent,
|
|
25915
|
+
...decryptedKindValue !== void 0 && { kindValue: decryptedKindValue }
|
|
25886
25916
|
};
|
|
25887
25917
|
}
|
|
25888
25918
|
|
|
25889
25919
|
// src/lib/db/memoryVault/types.ts
|
|
25920
|
+
var MEMORY_KINDS = [
|
|
25921
|
+
"display_name",
|
|
25922
|
+
"birth_date",
|
|
25923
|
+
"bio",
|
|
25924
|
+
"occupation",
|
|
25925
|
+
"interest",
|
|
25926
|
+
"gender",
|
|
25927
|
+
"height_cm",
|
|
25928
|
+
"looking_for",
|
|
25929
|
+
"politics",
|
|
25930
|
+
"religion",
|
|
25931
|
+
"ethnicity",
|
|
25932
|
+
"smoking",
|
|
25933
|
+
"drinking",
|
|
25934
|
+
"exercise",
|
|
25935
|
+
"sexuality",
|
|
25936
|
+
"prompt"
|
|
25937
|
+
];
|
|
25938
|
+
var MEMORY_LEVELS = ["private", "matching", "profile"];
|
|
25939
|
+
var MemoryLevelError = class extends Error {
|
|
25940
|
+
constructor(message) {
|
|
25941
|
+
super(message);
|
|
25942
|
+
this.name = "MemoryLevelError";
|
|
25943
|
+
}
|
|
25944
|
+
};
|
|
25945
|
+
var PUBLISHED_SCOPES = /* @__PURE__ */ new Set(["shared", "public"]);
|
|
25946
|
+
function levelFromScope(scope) {
|
|
25947
|
+
return typeof scope === "string" && PUBLISHED_SCOPES.has(scope) ? "matching" : "private";
|
|
25948
|
+
}
|
|
25949
|
+
function scopeForLevel(level) {
|
|
25950
|
+
return level === "private" ? "private" : "shared";
|
|
25951
|
+
}
|
|
25952
|
+
function resolveMemoryLevel(level, scope) {
|
|
25953
|
+
return typeof level === "string" && MEMORY_LEVELS.includes(level) ? level : levelFromScope(scope);
|
|
25954
|
+
}
|
|
25955
|
+
function levelForScopeChange(current, nextScope) {
|
|
25956
|
+
const implied = levelFromScope(nextScope);
|
|
25957
|
+
return implied === "matching" && resolveMemoryLevel(current.level, current.scope) === "profile" ? "profile" : implied;
|
|
25958
|
+
}
|
|
25890
25959
|
function parseMedia(value) {
|
|
25891
25960
|
if (typeof value !== "string" || value === "") return null;
|
|
25892
25961
|
try {
|
|
@@ -25916,6 +25985,56 @@ function visibilityConditions(requested) {
|
|
|
25916
25985
|
if (excluded.length === 0) return [];
|
|
25917
25986
|
return [import_watermelondb19.Q.or(import_watermelondb19.Q.where("visibility", null), import_watermelondb19.Q.where("visibility", import_watermelondb19.Q.notIn(excluded)))];
|
|
25918
25987
|
}
|
|
25988
|
+
function isKinded(record) {
|
|
25989
|
+
return record.kind !== null && record.kind !== void 0;
|
|
25990
|
+
}
|
|
25991
|
+
function assertValidKindLevel(kind, level) {
|
|
25992
|
+
const hasKind = kind !== null && kind !== void 0;
|
|
25993
|
+
if (hasKind && !MEMORY_KINDS.includes(kind)) {
|
|
25994
|
+
throw new MemoryLevelError(`Unknown memory kind: ${kind}`);
|
|
25995
|
+
}
|
|
25996
|
+
if (level !== void 0 && !MEMORY_LEVELS.includes(level)) {
|
|
25997
|
+
throw new MemoryLevelError(`Unknown memory level: ${level}`);
|
|
25998
|
+
}
|
|
25999
|
+
if (level === "profile" && !hasKind) {
|
|
26000
|
+
throw new MemoryLevelError("Only a memory with a kind can be at level 'profile'");
|
|
26001
|
+
}
|
|
26002
|
+
}
|
|
26003
|
+
function resolveCreateLevel(opts) {
|
|
26004
|
+
if (opts.level !== void 0) return { level: opts.level, scope: scopeForLevel(opts.level) };
|
|
26005
|
+
if (opts.scope !== void 0) return { level: levelFromScope(opts.scope), scope: opts.scope };
|
|
26006
|
+
return { level: "private", scope: "private" };
|
|
26007
|
+
}
|
|
26008
|
+
async function encryptKindValue(ctx, value) {
|
|
26009
|
+
if (typeof value !== "string" || !ctx.walletAddress || !ctx.signMessage) return value;
|
|
26010
|
+
return encryptVaultMemoryContent(
|
|
26011
|
+
value,
|
|
26012
|
+
ctx.walletAddress,
|
|
26013
|
+
ctx.signMessage,
|
|
26014
|
+
ctx.embeddedWalletSigner
|
|
26015
|
+
);
|
|
26016
|
+
}
|
|
26017
|
+
function levelConditions(requested) {
|
|
26018
|
+
if (!requested?.length) return [];
|
|
26019
|
+
const published = ["shared", "public"];
|
|
26020
|
+
const wantsMatching = requested.includes("matching");
|
|
26021
|
+
const wantsPrivate = requested.includes("private");
|
|
26022
|
+
const unresolved = import_watermelondb19.Q.or(import_watermelondb19.Q.where("level", null), import_watermelondb19.Q.where("level", import_watermelondb19.Q.notIn([...MEMORY_LEVELS])));
|
|
26023
|
+
const byLevel = import_watermelondb19.Q.where("level", import_watermelondb19.Q.oneOf([...requested]));
|
|
26024
|
+
if (wantsMatching && wantsPrivate) return [import_watermelondb19.Q.or(byLevel, unresolved)];
|
|
26025
|
+
if (wantsMatching) {
|
|
26026
|
+
return [import_watermelondb19.Q.or(byLevel, import_watermelondb19.Q.and(unresolved, import_watermelondb19.Q.where("scope", import_watermelondb19.Q.oneOf(published))))];
|
|
26027
|
+
}
|
|
26028
|
+
if (wantsPrivate) {
|
|
26029
|
+
return [
|
|
26030
|
+
import_watermelondb19.Q.or(
|
|
26031
|
+
byLevel,
|
|
26032
|
+
import_watermelondb19.Q.and(unresolved, import_watermelondb19.Q.or(import_watermelondb19.Q.where("scope", null), import_watermelondb19.Q.where("scope", import_watermelondb19.Q.notIn(published))))
|
|
26033
|
+
)
|
|
26034
|
+
];
|
|
26035
|
+
}
|
|
26036
|
+
return [byLevel];
|
|
26037
|
+
}
|
|
25919
26038
|
function isOwnedByCtxUser(ctx, record) {
|
|
25920
26039
|
return ctx.userId === void 0 || record.userId === ctx.userId;
|
|
25921
26040
|
}
|
|
@@ -25959,6 +26078,9 @@ function vaultMemoryToStoredRaw(memory) {
|
|
|
25959
26078
|
uniqueId: memory.id,
|
|
25960
26079
|
content: memory.content,
|
|
25961
26080
|
scope: memory.scope,
|
|
26081
|
+
kind: memory.kind ?? null,
|
|
26082
|
+
kindValue: memory.kindValue ?? null,
|
|
26083
|
+
level: resolveMemoryLevel(memory.level, memory.scope),
|
|
25962
26084
|
folderId: memory.folderId ?? null,
|
|
25963
26085
|
userId: memory.userId ?? null,
|
|
25964
26086
|
embedding: memory.embedding ?? null,
|
|
@@ -25997,9 +26119,13 @@ async function vaultMemoryToStored(memory, walletAddress, signMessage, embeddedW
|
|
|
25997
26119
|
}
|
|
25998
26120
|
return raw;
|
|
25999
26121
|
}
|
|
26000
|
-
function populateNewVaultMemory(record, ctx, opts, encryptedContent) {
|
|
26122
|
+
function populateNewVaultMemory(record, ctx, opts, encryptedContent, encryptedKindValue) {
|
|
26123
|
+
const { level, scope } = resolveCreateLevel(opts);
|
|
26001
26124
|
record._setRaw("content", encryptedContent);
|
|
26002
|
-
record._setRaw("scope",
|
|
26125
|
+
record._setRaw("scope", scope);
|
|
26126
|
+
record._setRaw("level", level);
|
|
26127
|
+
record._setRaw("kind", opts.kind ?? null);
|
|
26128
|
+
record._setRaw("kind_value", encryptedKindValue ?? null);
|
|
26003
26129
|
record._setRaw("folder_id", opts.folderId ?? null);
|
|
26004
26130
|
record._setRaw("user_id", ctx.userId ?? null);
|
|
26005
26131
|
record._setRaw("is_deleted", false);
|
|
@@ -26033,6 +26159,8 @@ function populateNewVaultMemory(record, ctx, opts, encryptedContent) {
|
|
|
26033
26159
|
}
|
|
26034
26160
|
}
|
|
26035
26161
|
async function createVaultMemoryOp(ctx, opts) {
|
|
26162
|
+
assertValidKindLevel(opts.kind, resolveCreateLevel(opts).level);
|
|
26163
|
+
const encryptedKindValue = await encryptKindValue(ctx, opts.kindValue);
|
|
26036
26164
|
const encryptedContent = ctx.walletAddress && ctx.signMessage ? await encryptVaultMemoryContent(
|
|
26037
26165
|
opts.content,
|
|
26038
26166
|
ctx.walletAddress,
|
|
@@ -26043,13 +26171,15 @@ async function createVaultMemoryOp(ctx, opts) {
|
|
|
26043
26171
|
if (ctx.canWrite && !await ctx.canWrite())
|
|
26044
26172
|
throw new Error("Memory source is no longer eligible");
|
|
26045
26173
|
return ctx.vaultMemoryCollection.create(
|
|
26046
|
-
(record) => populateNewVaultMemory(record, ctx, opts, encryptedContent)
|
|
26174
|
+
(record) => populateNewVaultMemory(record, ctx, opts, encryptedContent, encryptedKindValue)
|
|
26047
26175
|
);
|
|
26048
26176
|
});
|
|
26049
26177
|
return vaultMemoryToStored(created, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner);
|
|
26050
26178
|
}
|
|
26051
26179
|
async function createSupersedingMemoryOp(ctx, opts, targetId) {
|
|
26052
26180
|
if (!targetId) return { created: null, retired: false };
|
|
26181
|
+
assertValidKindLevel(opts.kind, resolveCreateLevel(opts).level);
|
|
26182
|
+
const encryptedKindValue = await encryptKindValue(ctx, opts.kindValue);
|
|
26053
26183
|
const encryptedContent = ctx.walletAddress && ctx.signMessage ? await encryptVaultMemoryContent(
|
|
26054
26184
|
opts.content,
|
|
26055
26185
|
ctx.walletAddress,
|
|
@@ -26066,9 +26196,10 @@ async function createSupersedingMemoryOp(ctx, opts, targetId) {
|
|
|
26066
26196
|
} catch {
|
|
26067
26197
|
return;
|
|
26068
26198
|
}
|
|
26069
|
-
if (target.isDeleted || target.supersededBy || !isOwnedByCtxUser(ctx, target))
|
|
26199
|
+
if (target.isDeleted || target.supersededBy || isKinded(target) || !isOwnedByCtxUser(ctx, target))
|
|
26200
|
+
return;
|
|
26070
26201
|
createdRecord = await ctx.vaultMemoryCollection.create(
|
|
26071
|
-
(record) => populateNewVaultMemory(record, ctx, opts, encryptedContent)
|
|
26202
|
+
(record) => populateNewVaultMemory(record, ctx, opts, encryptedContent, encryptedKindValue)
|
|
26072
26203
|
);
|
|
26073
26204
|
await target.update((r) => {
|
|
26074
26205
|
r._setRaw("superseded_by", createdRecord.id);
|
|
@@ -26132,6 +26263,10 @@ async function getMemoriesByEventTimeOp(ctx, windowStart, windowEnd) {
|
|
|
26132
26263
|
}
|
|
26133
26264
|
async function createVaultMemoriesBatchOp(ctx, optionsArray) {
|
|
26134
26265
|
if (optionsArray.length === 0) return [];
|
|
26266
|
+
for (const opts of optionsArray) assertValidKindLevel(opts.kind, resolveCreateLevel(opts).level);
|
|
26267
|
+
const encryptedKindValues = await Promise.all(
|
|
26268
|
+
optionsArray.map((opts) => encryptKindValue(ctx, opts.kindValue))
|
|
26269
|
+
);
|
|
26135
26270
|
const encryptedContents = await Promise.all(
|
|
26136
26271
|
optionsArray.map(async (opts) => {
|
|
26137
26272
|
if (ctx.walletAddress && ctx.signMessage) {
|
|
@@ -26150,7 +26285,7 @@ async function createVaultMemoriesBatchOp(ctx, optionsArray) {
|
|
|
26150
26285
|
throw new Error("Memory source is no longer eligible");
|
|
26151
26286
|
const prepared = optionsArray.map(
|
|
26152
26287
|
(opts, i) => ctx.vaultMemoryCollection.prepareCreate(
|
|
26153
|
-
(record) => populateNewVaultMemory(record, ctx, opts, encryptedContents[i])
|
|
26288
|
+
(record) => populateNewVaultMemory(record, ctx, opts, encryptedContents[i], encryptedKindValues[i])
|
|
26154
26289
|
)
|
|
26155
26290
|
);
|
|
26156
26291
|
await ctx.database.batch(...prepared);
|
|
@@ -26193,6 +26328,9 @@ function vaultMemoryRawToStoredRaw(raw) {
|
|
|
26193
26328
|
uniqueId: raw.id,
|
|
26194
26329
|
content: raw.content ?? "",
|
|
26195
26330
|
scope: raw.scope ?? "",
|
|
26331
|
+
kind: raw.kind ?? null,
|
|
26332
|
+
kindValue: raw.kind_value ?? null,
|
|
26333
|
+
level: resolveMemoryLevel(raw.level, raw.scope),
|
|
26196
26334
|
folderId: raw.folder_id ?? null,
|
|
26197
26335
|
userId: raw.user_id ?? null,
|
|
26198
26336
|
embedding: raw.embedding ?? null,
|
|
@@ -26236,6 +26374,8 @@ async function getAllVaultMemoriesOp(ctx, options) {
|
|
|
26236
26374
|
...baseVaultConditions(ctx, options),
|
|
26237
26375
|
...options?.scopes?.length ? [import_watermelondb19.Q.where("scope", import_watermelondb19.Q.oneOf(options.scopes))] : [],
|
|
26238
26376
|
...visibilityConditions(options?.visibility),
|
|
26377
|
+
...levelConditions(options?.levels),
|
|
26378
|
+
...options?.kinds?.length ? [import_watermelondb19.Q.where("kind", import_watermelondb19.Q.oneOf(options.kinds))] : [],
|
|
26239
26379
|
...options?.folderId !== void 0 ? [import_watermelondb19.Q.where("folder_id", options.folderId)] : [],
|
|
26240
26380
|
...options?.factTypes?.length ? [import_watermelondb19.Q.where("fact_type", import_watermelondb19.Q.oneOf(options.factTypes))] : [],
|
|
26241
26381
|
import_watermelondb19.Q.sortBy(options?.since ? "updated_at" : "created_at", import_watermelondb19.Q.desc),
|
|
@@ -26402,6 +26542,14 @@ async function updateVaultMemoryOp(ctx, id, opts) {
|
|
|
26402
26542
|
try {
|
|
26403
26543
|
const probe = await ctx.vaultMemoryCollection.find(id);
|
|
26404
26544
|
if (probe.isDeleted || probe.supersededBy || !isOwnedByCtxUser(ctx, probe)) return null;
|
|
26545
|
+
if (opts.freeFormOnly && isKinded(probe)) return null;
|
|
26546
|
+
const levelAfter = (current) => {
|
|
26547
|
+
if (opts.level !== void 0) return opts.level;
|
|
26548
|
+
if (opts.scope === void 0) return resolveMemoryLevel(current.level, current.scope);
|
|
26549
|
+
return levelForScopeChange(current, opts.scope);
|
|
26550
|
+
};
|
|
26551
|
+
assertValidKindLevel(opts.kind !== void 0 ? opts.kind : probe.kind, levelAfter(probe));
|
|
26552
|
+
const encryptedKindValue = await encryptKindValue(ctx, opts.kindValue);
|
|
26405
26553
|
const encryptedContent = ctx.walletAddress && ctx.signMessage ? await encryptVaultMemoryContent(
|
|
26406
26554
|
opts.content,
|
|
26407
26555
|
ctx.walletAddress,
|
|
@@ -26414,10 +26562,13 @@ async function updateVaultMemoryOp(ctx, id, opts) {
|
|
|
26414
26562
|
await ctx.database.write(async () => {
|
|
26415
26563
|
if (ctx.canWrite && !await ctx.canWrite())
|
|
26416
26564
|
throw new Error("Memory source is no longer eligible");
|
|
26417
|
-
if (record.isDeleted || record.supersededBy || !isOwnedByCtxUser(ctx, record)) {
|
|
26565
|
+
if (record.isDeleted || record.supersededBy || !isOwnedByCtxUser(ctx, record) || opts.freeFormOnly && isKinded(record)) {
|
|
26418
26566
|
stale = true;
|
|
26419
26567
|
return;
|
|
26420
26568
|
}
|
|
26569
|
+
const nextKind = opts.kind !== void 0 ? opts.kind : record.kind;
|
|
26570
|
+
const nextLevel = levelAfter(record);
|
|
26571
|
+
assertValidKindLevel(nextKind, nextLevel);
|
|
26421
26572
|
let observedSources = [];
|
|
26422
26573
|
let replayedObservation = false;
|
|
26423
26574
|
if (opts.observationSourceIds?.length) {
|
|
@@ -26431,8 +26582,18 @@ async function updateVaultMemoryOp(ctx, id, opts) {
|
|
|
26431
26582
|
}
|
|
26432
26583
|
await record.update((r) => {
|
|
26433
26584
|
r._setRaw("content", encryptedContent);
|
|
26434
|
-
if (opts.
|
|
26585
|
+
if (opts.level !== void 0) {
|
|
26586
|
+
r._setRaw("level", nextLevel);
|
|
26587
|
+
r._setRaw("scope", scopeForLevel(nextLevel));
|
|
26588
|
+
} else if (opts.scope !== void 0) {
|
|
26435
26589
|
r._setRaw("scope", opts.scope);
|
|
26590
|
+
r._setRaw("level", nextLevel);
|
|
26591
|
+
}
|
|
26592
|
+
if (opts.kind !== void 0) {
|
|
26593
|
+
r._setRaw("kind", opts.kind);
|
|
26594
|
+
}
|
|
26595
|
+
if (encryptedKindValue !== void 0) {
|
|
26596
|
+
r._setRaw("kind_value", encryptedKindValue);
|
|
26436
26597
|
}
|
|
26437
26598
|
if (opts.folderId !== void 0) {
|
|
26438
26599
|
r._setRaw("folder_id", opts.folderId);
|
|
@@ -26491,7 +26652,8 @@ async function updateVaultMemoryOp(ctx, id, opts) {
|
|
|
26491
26652
|
ctx.signMessage,
|
|
26492
26653
|
ctx.embeddedWalletSigner
|
|
26493
26654
|
);
|
|
26494
|
-
} catch {
|
|
26655
|
+
} catch (err) {
|
|
26656
|
+
if (err instanceof MemoryLevelError) throw err;
|
|
26495
26657
|
return null;
|
|
26496
26658
|
}
|
|
26497
26659
|
}
|
|
@@ -26627,6 +26789,7 @@ async function supersedeVaultMemoryOp(ctx, id, supersededById) {
|
|
|
26627
26789
|
try {
|
|
26628
26790
|
const record = await ctx.vaultMemoryCollection.find(id);
|
|
26629
26791
|
if (record.isDeleted || record.supersededBy || !isOwnedByCtxUser(ctx, record)) return false;
|
|
26792
|
+
if (isKinded(record)) return false;
|
|
26630
26793
|
let successor;
|
|
26631
26794
|
try {
|
|
26632
26795
|
successor = await ctx.vaultMemoryCollection.find(supersededById);
|
|
@@ -26927,7 +27090,10 @@ function assertVaultScopeForSweep(ctx) {
|
|
|
26927
27090
|
}
|
|
26928
27091
|
async function getDecayCandidatesRawOp(ctx) {
|
|
26929
27092
|
assertVaultScopeForSweep(ctx);
|
|
26930
|
-
const results = await ctx.vaultMemoryCollection.query(
|
|
27093
|
+
const results = await ctx.vaultMemoryCollection.query(
|
|
27094
|
+
...baseVaultConditions(ctx, { includeArchived: true, includeQuarantined: true }),
|
|
27095
|
+
import_watermelondb19.Q.where("kind", null)
|
|
27096
|
+
).unsafeFetchRaw();
|
|
26931
27097
|
return results.map((raw) => ({
|
|
26932
27098
|
uniqueId: raw.id,
|
|
26933
27099
|
factType: raw.fact_type ?? null,
|
|
@@ -27187,6 +27353,7 @@ async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
|
|
|
27187
27353
|
record._raw.id = row.memoryId;
|
|
27188
27354
|
record._setRaw("content", content);
|
|
27189
27355
|
record._setRaw("scope", "shared");
|
|
27356
|
+
record._setRaw("level", "matching");
|
|
27190
27357
|
record._setRaw("folder_id", null);
|
|
27191
27358
|
record._setRaw("user_id", ctx.userId ?? null);
|
|
27192
27359
|
record._setRaw("is_deleted", false);
|
|
@@ -30121,6 +30288,7 @@ async function retainWithPersistence(content, ctx, options = {}) {
|
|
|
30121
30288
|
includeArchived: true,
|
|
30122
30289
|
...options.folderId !== void 0 && { folderId: options.folderId }
|
|
30123
30290
|
});
|
|
30291
|
+
prepared = withoutKindedRows(prepared);
|
|
30124
30292
|
if (prepared.embeddingFailure || prepared.embeddingsUnavailable) {
|
|
30125
30293
|
throw new Error(
|
|
30126
30294
|
"retain: embeddings unavailable \u2014 refusing to auto-merge against an inert cosine lane, which would create a duplicate instead of merging into the existing memory. Retry when embeddings recover, or pass enableAutoMerge: false to force a create."
|
|
@@ -30162,6 +30330,7 @@ async function retainWithPersistence(content, ctx, options = {}) {
|
|
|
30162
30330
|
const resurrect = resurrectFields(existing);
|
|
30163
30331
|
const updated = await ctx.persistence.update(targetId, {
|
|
30164
30332
|
content: existing.content,
|
|
30333
|
+
freeFormOnly: true,
|
|
30165
30334
|
proofCountIncrement: 1,
|
|
30166
30335
|
observationSourceIds: options.sourceChunkIds,
|
|
30167
30336
|
sourceChunkIds: mergedSourceIds,
|
|
@@ -30290,6 +30459,17 @@ async function retainWithPersistence(content, ctx, options = {}) {
|
|
|
30290
30459
|
...consolidationDecidedCreate && { consolidation: "create" }
|
|
30291
30460
|
};
|
|
30292
30461
|
}
|
|
30462
|
+
function withoutKindedRows(prepared) {
|
|
30463
|
+
const kinded = new Set(
|
|
30464
|
+
prepared.memories.filter((m) => m.kind !== null && m.kind !== void 0).map((m) => m.uniqueId)
|
|
30465
|
+
);
|
|
30466
|
+
if (kinded.size === 0) return prepared;
|
|
30467
|
+
return {
|
|
30468
|
+
...prepared,
|
|
30469
|
+
memories: prepared.memories.filter((m) => !kinded.has(m.uniqueId)),
|
|
30470
|
+
embeddedItems: prepared.embeddedItems.filter((item) => !kinded.has(item.id))
|
|
30471
|
+
};
|
|
30472
|
+
}
|
|
30293
30473
|
function unionStrings(a, b) {
|
|
30294
30474
|
return [.../* @__PURE__ */ new Set([...a, ...b])];
|
|
30295
30475
|
}
|
|
@@ -30389,6 +30569,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
|
|
|
30389
30569
|
const resurrect = resurrectFields(existing);
|
|
30390
30570
|
const updated = await ctx.persistence.update(decision.targetId, {
|
|
30391
30571
|
content: existing.content,
|
|
30572
|
+
freeFormOnly: true,
|
|
30392
30573
|
proofCountIncrement: 1,
|
|
30393
30574
|
observationSourceIds: options.sourceChunkIds,
|
|
30394
30575
|
sourceChunkIds: mergedSourceIds,
|
|
@@ -30434,6 +30615,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
|
|
|
30434
30615
|
const resurrect = resurrectFields(existing);
|
|
30435
30616
|
const updated = await ctx.persistence.update(decision.targetId, {
|
|
30436
30617
|
content: decision.content,
|
|
30618
|
+
freeFormOnly: true,
|
|
30437
30619
|
proofCountIncrement: 1,
|
|
30438
30620
|
observationSourceIds: options.sourceChunkIds,
|
|
30439
30621
|
sourceChunkIds: mergedSourceIds,
|
|
@@ -30477,7 +30659,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
|
|
|
30477
30659
|
}
|
|
30478
30660
|
async function assertMergeTargetGoneOrThrow(ctx, targetId) {
|
|
30479
30661
|
const stillExists = await (ctx.persistence.getFresh ? ctx.persistence.getFresh(targetId) : ctx.persistence.get(targetId));
|
|
30480
|
-
if (stillExists) {
|
|
30662
|
+
if (stillExists && (stillExists.kind === null || stillExists.kind === void 0)) {
|
|
30481
30663
|
throw new Error(`retain: merge into memory ${targetId} failed to persist`);
|
|
30482
30664
|
}
|
|
30483
30665
|
}
|
|
@@ -36843,7 +37025,10 @@ export {
|
|
|
36843
37025
|
MAX_HOPS,
|
|
36844
37026
|
MAX_MESSAGES_PER_SUMMARIZATION,
|
|
36845
37027
|
MEDIUM_TTL_MS,
|
|
37028
|
+
MEMORY_KINDS,
|
|
37029
|
+
MEMORY_LEVELS,
|
|
36846
37030
|
Media,
|
|
37031
|
+
MemoryLevelError,
|
|
36847
37032
|
Message,
|
|
36848
37033
|
ModelPreference,
|
|
36849
37034
|
NEVER_TTL_MS,
|