@anuma/sdk 7.6.0 → 8.0.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 +119 -4
- package/dist/expo/index.d.mts +9 -1
- package/dist/expo/index.d.ts +9 -1
- package/dist/expo/index.mjs +117 -4
- package/dist/react/index.cjs +118 -4
- package/dist/react/index.d.mts +5 -1
- package/dist/react/index.d.ts +5 -1
- package/dist/react/index.mjs +116 -4
- package/dist/server/index.cjs +226 -41
- package/dist/server/index.d.mts +13 -7
- package/dist/server/index.d.ts +13 -7
- package/dist/server/index.mjs +224 -41
- package/package.json +1 -1
package/dist/expo/index.cjs
CHANGED
|
@@ -1505,6 +1505,7 @@ __export(index_exports, {
|
|
|
1505
1505
|
createWebSearchPreProcessor: () => createWebSearchPreProcessor,
|
|
1506
1506
|
decodeChunkVector: () => decodeChunkVector,
|
|
1507
1507
|
decryptConversationTitle: () => decryptConversationTitle,
|
|
1508
|
+
decryptMessageEmbeddingFields: () => decryptMessageEmbeddingFields,
|
|
1508
1509
|
deleteAllVaultMemoriesForUserOp: () => deleteAllVaultMemoriesForUserOp,
|
|
1509
1510
|
deleteMessageOp: () => deleteMessageOp,
|
|
1510
1511
|
deleteVaultFolderOp: () => deleteVaultFolderOp,
|
|
@@ -1585,6 +1586,7 @@ __export(index_exports, {
|
|
|
1585
1586
|
sdkMigrations: () => sdkMigrations,
|
|
1586
1587
|
sdkModelClasses: () => sdkModelClasses,
|
|
1587
1588
|
sdkSchema: () => sdkSchema,
|
|
1589
|
+
sealLegacyMessageEmbeddingsOp: () => sealLegacyMessageEmbeddingsOp,
|
|
1588
1590
|
searchVaultMemories: () => searchVaultMemories,
|
|
1589
1591
|
seedEncryptionKeys: () => seedEncryptionKeys,
|
|
1590
1592
|
setLogger: () => setLogger,
|
|
@@ -4015,16 +4017,19 @@ async function updateMessageEmbeddingOp(ctx, uniqueId, vector, embeddingModel) {
|
|
|
4015
4017
|
} catch {
|
|
4016
4018
|
return null;
|
|
4017
4019
|
}
|
|
4020
|
+
const address = ctx.walletAddress;
|
|
4018
4021
|
await ctx.database.write(async () => {
|
|
4022
|
+
const key = await resolveMessageEmbeddingKey(address, message.content);
|
|
4023
|
+
const storedVector2 = await serializeMessageEmbedding(key, vector);
|
|
4019
4024
|
await message.update((msg) => {
|
|
4020
|
-
msg._setRaw("vector",
|
|
4025
|
+
msg._setRaw("vector", storedVector2);
|
|
4021
4026
|
if (msg.origin === "chunks_discarded" && vector.length > 0) {
|
|
4022
4027
|
msg._setRaw("origin", "message");
|
|
4023
4028
|
}
|
|
4024
4029
|
msg._setRaw("embedding_model", embeddingModel);
|
|
4025
4030
|
});
|
|
4026
4031
|
});
|
|
4027
|
-
return messageToStored(message, ctx.walletAddress
|
|
4032
|
+
return messageToStored(message, ctx.walletAddress);
|
|
4028
4033
|
}
|
|
4029
4034
|
async function updateMessageChunksOp(ctx, uniqueId, chunks3, embeddingModel) {
|
|
4030
4035
|
let message;
|
|
@@ -4034,16 +4039,123 @@ async function updateMessageChunksOp(ctx, uniqueId, chunks3, embeddingModel) {
|
|
|
4034
4039
|
return null;
|
|
4035
4040
|
}
|
|
4036
4041
|
const storedChunks = chunks3.map(({ text: _text, ...rest }) => rest);
|
|
4042
|
+
const address = ctx.walletAddress;
|
|
4037
4043
|
await ctx.database.write(async () => {
|
|
4044
|
+
const key = await resolveMessageEmbeddingKey(address, message.content);
|
|
4045
|
+
const serializedChunks = await serializeMessageEmbedding(key, storedChunks);
|
|
4038
4046
|
await message.update((msg) => {
|
|
4039
|
-
msg._setRaw("chunks",
|
|
4047
|
+
msg._setRaw("chunks", serializedChunks);
|
|
4040
4048
|
if (msg.origin === "chunks_discarded" && storedChunks.length > 0 && storedChunks.every((chunk) => chunk.vector.length > 0)) {
|
|
4041
4049
|
msg._setRaw("origin", "message");
|
|
4042
4050
|
}
|
|
4043
4051
|
msg._setRaw("embedding_model", embeddingModel);
|
|
4044
4052
|
});
|
|
4045
4053
|
});
|
|
4046
|
-
return messageToStored(message, ctx.walletAddress
|
|
4054
|
+
return messageToStored(message, ctx.walletAddress);
|
|
4055
|
+
}
|
|
4056
|
+
async function resolveMessageEmbeddingKey(address, content) {
|
|
4057
|
+
if (!address || !isEncrypted(content)) return null;
|
|
4058
|
+
const key = await getEncryptionKey(address, "v3");
|
|
4059
|
+
const contentKey = content.startsWith("enc:v2:") ? await getEncryptionKey(address, "v2") : key;
|
|
4060
|
+
try {
|
|
4061
|
+
await decryptDataWithKey(content.slice("enc:vN:".length), contentKey);
|
|
4062
|
+
} catch {
|
|
4063
|
+
throw new Error("Cannot decrypt the message with the cached wallet key");
|
|
4064
|
+
}
|
|
4065
|
+
return key;
|
|
4066
|
+
}
|
|
4067
|
+
async function serializeMessageEmbedding(key, value) {
|
|
4068
|
+
const json4 = JSON.stringify(value);
|
|
4069
|
+
return key ? `enc:v3:${await encryptDataWithKey(json4, key)}` : json4;
|
|
4070
|
+
}
|
|
4071
|
+
async function decryptMessageEmbeddingFields(raw, walletAddress) {
|
|
4072
|
+
const result = { ...raw };
|
|
4073
|
+
for (const column of ["vector", "chunks"]) {
|
|
4074
|
+
const value = raw[column];
|
|
4075
|
+
if (typeof value !== "string" || !value.startsWith("enc:")) continue;
|
|
4076
|
+
const decrypted = walletAddress ? await decryptField(value, walletAddress) : value;
|
|
4077
|
+
result[column] = decrypted.startsWith("enc:") ? void 0 : decrypted;
|
|
4078
|
+
}
|
|
4079
|
+
return result;
|
|
4080
|
+
}
|
|
4081
|
+
async function sealLegacyMessageEmbeddingsOp(ctx) {
|
|
4082
|
+
if (!ctx.walletAddress) return 0;
|
|
4083
|
+
const candidateIds = await ctx.messagesCollection.query(
|
|
4084
|
+
import_watermelondb2.Q.where("content", import_watermelondb2.Q.like("enc:%")),
|
|
4085
|
+
import_watermelondb2.Q.or(
|
|
4086
|
+
...["vector", "chunks"].map(
|
|
4087
|
+
(column) => import_watermelondb2.Q.and(
|
|
4088
|
+
import_watermelondb2.Q.where(column, import_watermelondb2.Q.notEq(null)),
|
|
4089
|
+
import_watermelondb2.Q.where(column, import_watermelondb2.Q.notEq("")),
|
|
4090
|
+
import_watermelondb2.Q.where(column, import_watermelondb2.Q.notLike("enc:%"))
|
|
4091
|
+
)
|
|
4092
|
+
)
|
|
4093
|
+
)
|
|
4094
|
+
).fetchIds();
|
|
4095
|
+
let sealed = 0;
|
|
4096
|
+
let undecryptable = 0;
|
|
4097
|
+
for (let start = 0; start < candidateIds.length; start += 50) {
|
|
4098
|
+
const pageIds = candidateIds.slice(start, start + 50);
|
|
4099
|
+
await ctx.database.write(async () => {
|
|
4100
|
+
const pageMessages = await ctx.messagesCollection.query(import_watermelondb2.Q.where("id", import_watermelondb2.Q.oneOf(pageIds))).fetch();
|
|
4101
|
+
for (const message of pageMessages) {
|
|
4102
|
+
if (!isEncrypted(message.content)) continue;
|
|
4103
|
+
const content = await decryptFieldDetailed(message.content, ctx.walletAddress);
|
|
4104
|
+
if (content.status === "key_missing") {
|
|
4105
|
+
throw new Error("Cannot decrypt the message with the cached wallet key");
|
|
4106
|
+
}
|
|
4107
|
+
if (content.status !== "ok") {
|
|
4108
|
+
undecryptable++;
|
|
4109
|
+
continue;
|
|
4110
|
+
}
|
|
4111
|
+
const plaintext = content.value;
|
|
4112
|
+
const key = await resolveMessageEmbeddingKey(ctx.walletAddress, message.content);
|
|
4113
|
+
const updates = {};
|
|
4114
|
+
for (const column of ["vector", "chunks"]) {
|
|
4115
|
+
const value = message._getRaw(column);
|
|
4116
|
+
if (typeof value !== "string" || value.startsWith("enc:") || !value) continue;
|
|
4117
|
+
let parsed;
|
|
4118
|
+
try {
|
|
4119
|
+
parsed = JSON.parse(value);
|
|
4120
|
+
} catch {
|
|
4121
|
+
updates[column] = null;
|
|
4122
|
+
continue;
|
|
4123
|
+
}
|
|
4124
|
+
if (!Array.isArray(parsed)) {
|
|
4125
|
+
updates[column] = null;
|
|
4126
|
+
continue;
|
|
4127
|
+
}
|
|
4128
|
+
if (column === "chunks") {
|
|
4129
|
+
const chunks3 = parsed;
|
|
4130
|
+
if (chunks3.some(
|
|
4131
|
+
(chunk) => !chunk || !Number.isInteger(chunk.startOffset) || !Number.isInteger(chunk.endOffset) || chunk.startOffset < 0 || chunk.endOffset <= chunk.startOffset || chunk.endOffset > plaintext.length
|
|
4132
|
+
)) {
|
|
4133
|
+
updates.chunks = null;
|
|
4134
|
+
updates.vector = null;
|
|
4135
|
+
updates.origin = message.origin === "tool_result" ? "tool_result" : "chunks_discarded";
|
|
4136
|
+
break;
|
|
4137
|
+
}
|
|
4138
|
+
parsed = chunks3.map(({ text: _text, ...rest }) => rest);
|
|
4139
|
+
}
|
|
4140
|
+
updates[column] = await serializeMessageEmbedding(key, parsed);
|
|
4141
|
+
}
|
|
4142
|
+
if (Object.keys(updates).length === 0) continue;
|
|
4143
|
+
const updatedAt = Number(message._getRaw("updated_at"));
|
|
4144
|
+
const discarded = updates.origin !== void 0;
|
|
4145
|
+
await message.update((msg) => {
|
|
4146
|
+
for (const [column, value] of Object.entries(updates)) msg._setRaw(column, value);
|
|
4147
|
+
msg._setRaw("updated_at", discarded ? Math.max(Date.now(), updatedAt + 1) : updatedAt);
|
|
4148
|
+
});
|
|
4149
|
+
sealed++;
|
|
4150
|
+
}
|
|
4151
|
+
});
|
|
4152
|
+
}
|
|
4153
|
+
if (undecryptable > 0) {
|
|
4154
|
+
getLogger().warn(
|
|
4155
|
+
`Skipped ${undecryptable} message embeddings that the cached wallet key cannot decrypt`
|
|
4156
|
+
);
|
|
4157
|
+
}
|
|
4158
|
+
return sealed;
|
|
4047
4159
|
}
|
|
4048
4160
|
var RAW_REPAIR_PAGE_SIZE = 100;
|
|
4049
4161
|
function chunksWithoutText(raw) {
|
|
@@ -29105,6 +29217,7 @@ function useChatStorage(options) {
|
|
|
29105
29217
|
return {
|
|
29106
29218
|
data: result2.data,
|
|
29107
29219
|
error: null,
|
|
29220
|
+
autoExecutedToolResults: "autoExecutedToolResults" in result2 ? result2.autoExecutedToolResults : void 0,
|
|
29108
29221
|
skipped: true
|
|
29109
29222
|
};
|
|
29110
29223
|
}
|
|
@@ -29979,6 +30092,7 @@ function useChatStorage(options) {
|
|
|
29979
30092
|
createWebSearchPreProcessor,
|
|
29980
30093
|
decodeChunkVector,
|
|
29981
30094
|
decryptConversationTitle,
|
|
30095
|
+
decryptMessageEmbeddingFields,
|
|
29982
30096
|
deleteAllVaultMemoriesForUserOp,
|
|
29983
30097
|
deleteMessageOp,
|
|
29984
30098
|
deleteVaultFolderOp,
|
|
@@ -30059,6 +30173,7 @@ function useChatStorage(options) {
|
|
|
30059
30173
|
sdkMigrations,
|
|
30060
30174
|
sdkModelClasses,
|
|
30061
30175
|
sdkSchema,
|
|
30176
|
+
sealLegacyMessageEmbeddingsOp,
|
|
30062
30177
|
searchVaultMemories,
|
|
30063
30178
|
seedEncryptionKeys,
|
|
30064
30179
|
setLogger,
|
package/dist/expo/index.d.mts
CHANGED
|
@@ -4191,6 +4191,10 @@ declare function deleteMessageOp(ctx: StorageOperationsContext, uniqueId: string
|
|
|
4191
4191
|
declare function upsertMessageOp(ctx: StorageOperationsContext, opts: CreateMessageOptions & {
|
|
4192
4192
|
uniqueId: string;
|
|
4193
4193
|
}): Promise<StoredMessage>;
|
|
4194
|
+
/** Decrypts raw message embedding columns with the cached wallet key. */
|
|
4195
|
+
declare function decryptMessageEmbeddingFields(raw: Record<string, unknown>, walletAddress?: string): Promise<Record<string, unknown>>;
|
|
4196
|
+
/** Seals legacy message embedding columns and discards chunks with invalid plaintext offsets. */
|
|
4197
|
+
declare function sealLegacyMessageEmbeddingsOp(ctx: StorageOperationsContext): Promise<number>;
|
|
4194
4198
|
/**
|
|
4195
4199
|
* Removes the plaintext `text` that rows chunked before sdk#889 still carry in
|
|
4196
4200
|
* their `chunks` column. Since #889 `updateMessageChunksOp` never writes it, so
|
|
@@ -7964,6 +7968,10 @@ interface BaseSendMessageSkippedResult {
|
|
|
7964
7968
|
error: null;
|
|
7965
7969
|
userMessage?: undefined;
|
|
7966
7970
|
assistantMessage?: undefined;
|
|
7971
|
+
autoExecutedToolResults?: {
|
|
7972
|
+
name: string;
|
|
7973
|
+
result: unknown;
|
|
7974
|
+
}[];
|
|
7967
7975
|
/** Indicates this was a skipStorage request - no messages were persisted */
|
|
7968
7976
|
skipped: true;
|
|
7969
7977
|
}
|
|
@@ -11521,4 +11529,4 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
|
|
|
11521
11529
|
*/
|
|
11522
11530
|
declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
|
|
11523
11531
|
|
|
11524
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, 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, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCreate, type MemoryDecay, type MemoryDecaySweeperOptions, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryMigrationOptions, type MemoryMigrationProgress, type MemoryMigrationResult, type MemoryMigrationSkip, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, type MemoryTopicBacklog, type MemoryTopicMaintenance, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionMcpCaller, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallTelemetryCallbacks, type RecallToolCallbacks, type RecallToolOptions, type RecallTruncation, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryMetadataPage, type RemoteMemoryMetadataRecord, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredTopic, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryProjection, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WriteFailureReason, addConversationMemoriesOp, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryTopicsOp, buildAttachedFilesText, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearModelsCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptToolCallEventsOp, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractReservationReceipts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, memoryCipher, migrateMemoriesToRemote, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, primaryTopic, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
|
|
11532
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, 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, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCreate, type MemoryDecay, type MemoryDecaySweeperOptions, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryMigrationOptions, type MemoryMigrationProgress, type MemoryMigrationResult, type MemoryMigrationSkip, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, type MemoryTopicBacklog, type MemoryTopicMaintenance, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionMcpCaller, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallTelemetryCallbacks, type RecallToolCallbacks, type RecallToolOptions, type RecallTruncation, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryMetadataPage, type RemoteMemoryMetadataRecord, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredTopic, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryProjection, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WriteFailureReason, addConversationMemoriesOp, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryTopicsOp, buildAttachedFilesText, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearModelsCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptMessageEmbeddingFields, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptToolCallEventsOp, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractReservationReceipts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, memoryCipher, migrateMemoriesToRemote, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, primaryTopic, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -4191,6 +4191,10 @@ declare function deleteMessageOp(ctx: StorageOperationsContext, uniqueId: string
|
|
|
4191
4191
|
declare function upsertMessageOp(ctx: StorageOperationsContext, opts: CreateMessageOptions & {
|
|
4192
4192
|
uniqueId: string;
|
|
4193
4193
|
}): Promise<StoredMessage>;
|
|
4194
|
+
/** Decrypts raw message embedding columns with the cached wallet key. */
|
|
4195
|
+
declare function decryptMessageEmbeddingFields(raw: Record<string, unknown>, walletAddress?: string): Promise<Record<string, unknown>>;
|
|
4196
|
+
/** Seals legacy message embedding columns and discards chunks with invalid plaintext offsets. */
|
|
4197
|
+
declare function sealLegacyMessageEmbeddingsOp(ctx: StorageOperationsContext): Promise<number>;
|
|
4194
4198
|
/**
|
|
4195
4199
|
* Removes the plaintext `text` that rows chunked before sdk#889 still carry in
|
|
4196
4200
|
* their `chunks` column. Since #889 `updateMessageChunksOp` never writes it, so
|
|
@@ -7964,6 +7968,10 @@ interface BaseSendMessageSkippedResult {
|
|
|
7964
7968
|
error: null;
|
|
7965
7969
|
userMessage?: undefined;
|
|
7966
7970
|
assistantMessage?: undefined;
|
|
7971
|
+
autoExecutedToolResults?: {
|
|
7972
|
+
name: string;
|
|
7973
|
+
result: unknown;
|
|
7974
|
+
}[];
|
|
7967
7975
|
/** Indicates this was a skipStorage request - no messages were persisted */
|
|
7968
7976
|
skipped: true;
|
|
7969
7977
|
}
|
|
@@ -11521,4 +11529,4 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
|
|
|
11521
11529
|
*/
|
|
11522
11530
|
declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
|
|
11523
11531
|
|
|
11524
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, 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, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCreate, type MemoryDecay, type MemoryDecaySweeperOptions, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryMigrationOptions, type MemoryMigrationProgress, type MemoryMigrationResult, type MemoryMigrationSkip, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, type MemoryTopicBacklog, type MemoryTopicMaintenance, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionMcpCaller, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallTelemetryCallbacks, type RecallToolCallbacks, type RecallToolOptions, type RecallTruncation, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryMetadataPage, type RemoteMemoryMetadataRecord, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredTopic, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryProjection, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WriteFailureReason, addConversationMemoriesOp, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryTopicsOp, buildAttachedFilesText, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearModelsCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptToolCallEventsOp, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractReservationReceipts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, memoryCipher, migrateMemoriesToRemote, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, primaryTopic, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
|
|
11532
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, 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, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCreate, type MemoryDecay, type MemoryDecaySweeperOptions, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryMigrationOptions, type MemoryMigrationProgress, type MemoryMigrationResult, type MemoryMigrationSkip, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, type MemoryTopicBacklog, type MemoryTopicMaintenance, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionMcpCaller, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallTelemetryCallbacks, type RecallToolCallbacks, type RecallToolOptions, type RecallTruncation, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryMetadataPage, type RemoteMemoryMetadataRecord, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredTopic, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryProjection, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WriteFailureReason, addConversationMemoriesOp, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryTopicsOp, buildAttachedFilesText, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearModelsCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptMessageEmbeddingFields, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptToolCallEventsOp, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractReservationReceipts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, memoryCipher, migrateMemoriesToRemote, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, primaryTopic, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
|
package/dist/expo/index.mjs
CHANGED
|
@@ -2420,16 +2420,19 @@ async function updateMessageEmbeddingOp(ctx, uniqueId, vector, embeddingModel) {
|
|
|
2420
2420
|
} catch {
|
|
2421
2421
|
return null;
|
|
2422
2422
|
}
|
|
2423
|
+
const address = ctx.walletAddress;
|
|
2423
2424
|
await ctx.database.write(async () => {
|
|
2425
|
+
const key = await resolveMessageEmbeddingKey(address, message.content);
|
|
2426
|
+
const storedVector2 = await serializeMessageEmbedding(key, vector);
|
|
2424
2427
|
await message.update((msg) => {
|
|
2425
|
-
msg._setRaw("vector",
|
|
2428
|
+
msg._setRaw("vector", storedVector2);
|
|
2426
2429
|
if (msg.origin === "chunks_discarded" && vector.length > 0) {
|
|
2427
2430
|
msg._setRaw("origin", "message");
|
|
2428
2431
|
}
|
|
2429
2432
|
msg._setRaw("embedding_model", embeddingModel);
|
|
2430
2433
|
});
|
|
2431
2434
|
});
|
|
2432
|
-
return messageToStored(message, ctx.walletAddress
|
|
2435
|
+
return messageToStored(message, ctx.walletAddress);
|
|
2433
2436
|
}
|
|
2434
2437
|
async function updateMessageChunksOp(ctx, uniqueId, chunks3, embeddingModel) {
|
|
2435
2438
|
let message;
|
|
@@ -2439,16 +2442,123 @@ async function updateMessageChunksOp(ctx, uniqueId, chunks3, embeddingModel) {
|
|
|
2439
2442
|
return null;
|
|
2440
2443
|
}
|
|
2441
2444
|
const storedChunks = chunks3.map(({ text: _text, ...rest }) => rest);
|
|
2445
|
+
const address = ctx.walletAddress;
|
|
2442
2446
|
await ctx.database.write(async () => {
|
|
2447
|
+
const key = await resolveMessageEmbeddingKey(address, message.content);
|
|
2448
|
+
const serializedChunks = await serializeMessageEmbedding(key, storedChunks);
|
|
2443
2449
|
await message.update((msg) => {
|
|
2444
|
-
msg._setRaw("chunks",
|
|
2450
|
+
msg._setRaw("chunks", serializedChunks);
|
|
2445
2451
|
if (msg.origin === "chunks_discarded" && storedChunks.length > 0 && storedChunks.every((chunk) => chunk.vector.length > 0)) {
|
|
2446
2452
|
msg._setRaw("origin", "message");
|
|
2447
2453
|
}
|
|
2448
2454
|
msg._setRaw("embedding_model", embeddingModel);
|
|
2449
2455
|
});
|
|
2450
2456
|
});
|
|
2451
|
-
return messageToStored(message, ctx.walletAddress
|
|
2457
|
+
return messageToStored(message, ctx.walletAddress);
|
|
2458
|
+
}
|
|
2459
|
+
async function resolveMessageEmbeddingKey(address, content) {
|
|
2460
|
+
if (!address || !isEncrypted(content)) return null;
|
|
2461
|
+
const key = await getEncryptionKey(address, "v3");
|
|
2462
|
+
const contentKey = content.startsWith("enc:v2:") ? await getEncryptionKey(address, "v2") : key;
|
|
2463
|
+
try {
|
|
2464
|
+
await decryptDataWithKey(content.slice("enc:vN:".length), contentKey);
|
|
2465
|
+
} catch {
|
|
2466
|
+
throw new Error("Cannot decrypt the message with the cached wallet key");
|
|
2467
|
+
}
|
|
2468
|
+
return key;
|
|
2469
|
+
}
|
|
2470
|
+
async function serializeMessageEmbedding(key, value) {
|
|
2471
|
+
const json4 = JSON.stringify(value);
|
|
2472
|
+
return key ? `enc:v3:${await encryptDataWithKey(json4, key)}` : json4;
|
|
2473
|
+
}
|
|
2474
|
+
async function decryptMessageEmbeddingFields(raw, walletAddress) {
|
|
2475
|
+
const result = { ...raw };
|
|
2476
|
+
for (const column of ["vector", "chunks"]) {
|
|
2477
|
+
const value = raw[column];
|
|
2478
|
+
if (typeof value !== "string" || !value.startsWith("enc:")) continue;
|
|
2479
|
+
const decrypted = walletAddress ? await decryptField(value, walletAddress) : value;
|
|
2480
|
+
result[column] = decrypted.startsWith("enc:") ? void 0 : decrypted;
|
|
2481
|
+
}
|
|
2482
|
+
return result;
|
|
2483
|
+
}
|
|
2484
|
+
async function sealLegacyMessageEmbeddingsOp(ctx) {
|
|
2485
|
+
if (!ctx.walletAddress) return 0;
|
|
2486
|
+
const candidateIds = await ctx.messagesCollection.query(
|
|
2487
|
+
Q.where("content", Q.like("enc:%")),
|
|
2488
|
+
Q.or(
|
|
2489
|
+
...["vector", "chunks"].map(
|
|
2490
|
+
(column) => Q.and(
|
|
2491
|
+
Q.where(column, Q.notEq(null)),
|
|
2492
|
+
Q.where(column, Q.notEq("")),
|
|
2493
|
+
Q.where(column, Q.notLike("enc:%"))
|
|
2494
|
+
)
|
|
2495
|
+
)
|
|
2496
|
+
)
|
|
2497
|
+
).fetchIds();
|
|
2498
|
+
let sealed = 0;
|
|
2499
|
+
let undecryptable = 0;
|
|
2500
|
+
for (let start = 0; start < candidateIds.length; start += 50) {
|
|
2501
|
+
const pageIds = candidateIds.slice(start, start + 50);
|
|
2502
|
+
await ctx.database.write(async () => {
|
|
2503
|
+
const pageMessages = await ctx.messagesCollection.query(Q.where("id", Q.oneOf(pageIds))).fetch();
|
|
2504
|
+
for (const message of pageMessages) {
|
|
2505
|
+
if (!isEncrypted(message.content)) continue;
|
|
2506
|
+
const content = await decryptFieldDetailed(message.content, ctx.walletAddress);
|
|
2507
|
+
if (content.status === "key_missing") {
|
|
2508
|
+
throw new Error("Cannot decrypt the message with the cached wallet key");
|
|
2509
|
+
}
|
|
2510
|
+
if (content.status !== "ok") {
|
|
2511
|
+
undecryptable++;
|
|
2512
|
+
continue;
|
|
2513
|
+
}
|
|
2514
|
+
const plaintext = content.value;
|
|
2515
|
+
const key = await resolveMessageEmbeddingKey(ctx.walletAddress, message.content);
|
|
2516
|
+
const updates = {};
|
|
2517
|
+
for (const column of ["vector", "chunks"]) {
|
|
2518
|
+
const value = message._getRaw(column);
|
|
2519
|
+
if (typeof value !== "string" || value.startsWith("enc:") || !value) continue;
|
|
2520
|
+
let parsed;
|
|
2521
|
+
try {
|
|
2522
|
+
parsed = JSON.parse(value);
|
|
2523
|
+
} catch {
|
|
2524
|
+
updates[column] = null;
|
|
2525
|
+
continue;
|
|
2526
|
+
}
|
|
2527
|
+
if (!Array.isArray(parsed)) {
|
|
2528
|
+
updates[column] = null;
|
|
2529
|
+
continue;
|
|
2530
|
+
}
|
|
2531
|
+
if (column === "chunks") {
|
|
2532
|
+
const chunks3 = parsed;
|
|
2533
|
+
if (chunks3.some(
|
|
2534
|
+
(chunk) => !chunk || !Number.isInteger(chunk.startOffset) || !Number.isInteger(chunk.endOffset) || chunk.startOffset < 0 || chunk.endOffset <= chunk.startOffset || chunk.endOffset > plaintext.length
|
|
2535
|
+
)) {
|
|
2536
|
+
updates.chunks = null;
|
|
2537
|
+
updates.vector = null;
|
|
2538
|
+
updates.origin = message.origin === "tool_result" ? "tool_result" : "chunks_discarded";
|
|
2539
|
+
break;
|
|
2540
|
+
}
|
|
2541
|
+
parsed = chunks3.map(({ text: _text, ...rest }) => rest);
|
|
2542
|
+
}
|
|
2543
|
+
updates[column] = await serializeMessageEmbedding(key, parsed);
|
|
2544
|
+
}
|
|
2545
|
+
if (Object.keys(updates).length === 0) continue;
|
|
2546
|
+
const updatedAt = Number(message._getRaw("updated_at"));
|
|
2547
|
+
const discarded = updates.origin !== void 0;
|
|
2548
|
+
await message.update((msg) => {
|
|
2549
|
+
for (const [column, value] of Object.entries(updates)) msg._setRaw(column, value);
|
|
2550
|
+
msg._setRaw("updated_at", discarded ? Math.max(Date.now(), updatedAt + 1) : updatedAt);
|
|
2551
|
+
});
|
|
2552
|
+
sealed++;
|
|
2553
|
+
}
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2556
|
+
if (undecryptable > 0) {
|
|
2557
|
+
getLogger().warn(
|
|
2558
|
+
`Skipped ${undecryptable} message embeddings that the cached wallet key cannot decrypt`
|
|
2559
|
+
);
|
|
2560
|
+
}
|
|
2561
|
+
return sealed;
|
|
2452
2562
|
}
|
|
2453
2563
|
var RAW_REPAIR_PAGE_SIZE = 100;
|
|
2454
2564
|
function chunksWithoutText(raw) {
|
|
@@ -27415,6 +27525,7 @@ function useChatStorage(options) {
|
|
|
27415
27525
|
return {
|
|
27416
27526
|
data: result2.data,
|
|
27417
27527
|
error: null,
|
|
27528
|
+
autoExecutedToolResults: "autoExecutedToolResults" in result2 ? result2.autoExecutedToolResults : void 0,
|
|
27418
27529
|
skipped: true
|
|
27419
27530
|
};
|
|
27420
27531
|
}
|
|
@@ -28288,6 +28399,7 @@ export {
|
|
|
28288
28399
|
createWebSearchPreProcessor,
|
|
28289
28400
|
decodeChunkVector,
|
|
28290
28401
|
decryptConversationTitle,
|
|
28402
|
+
decryptMessageEmbeddingFields,
|
|
28291
28403
|
deleteAllVaultMemoriesForUserOp,
|
|
28292
28404
|
deleteMessageOp,
|
|
28293
28405
|
deleteVaultFolderOp,
|
|
@@ -28368,6 +28480,7 @@ export {
|
|
|
28368
28480
|
sdkMigrations,
|
|
28369
28481
|
sdkModelClasses,
|
|
28370
28482
|
sdkSchema,
|
|
28483
|
+
sealLegacyMessageEmbeddingsOp,
|
|
28371
28484
|
searchVaultMemories,
|
|
28372
28485
|
seedEncryptionKeys,
|
|
28373
28486
|
setLogger,
|