@anuma/sdk 6.17.1 → 6.18.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 +78 -6
- package/dist/expo/index.d.mts +73 -1
- package/dist/expo/index.d.ts +73 -1
- package/dist/expo/index.mjs +78 -6
- package/dist/react/index.cjs +69 -2
- package/dist/react/index.d.mts +73 -1
- package/dist/react/index.d.ts +73 -1
- package/dist/react/index.mjs +69 -2
- package/dist/server/index.cjs +41 -0
- package/dist/server/index.d.mts +64 -0
- package/dist/server/index.d.ts +64 -0
- package/dist/server/index.mjs +41 -0
- package/package.json +5 -4
package/dist/expo/index.cjs
CHANGED
|
@@ -19308,6 +19308,26 @@ var MANUAL_FACT_TYPES = [
|
|
|
19308
19308
|
function normalizeManualFactType(value) {
|
|
19309
19309
|
return typeof value === "string" && MANUAL_FACT_TYPES.includes(value) ? value : void 0;
|
|
19310
19310
|
}
|
|
19311
|
+
async function notifyWritten(options, input, outcome) {
|
|
19312
|
+
try {
|
|
19313
|
+
await options?.onWritten?.({ input, outcome });
|
|
19314
|
+
} catch {
|
|
19315
|
+
}
|
|
19316
|
+
}
|
|
19317
|
+
function describeWriteOutcome(outcome) {
|
|
19318
|
+
switch (outcome.action) {
|
|
19319
|
+
case "create":
|
|
19320
|
+
return `Memory saved successfully (ID: ${outcome.memoryId}).`;
|
|
19321
|
+
case "update":
|
|
19322
|
+
case "supersede":
|
|
19323
|
+
return `Memory saved successfully (ID: ${outcome.memoryId}); it replaces an earlier version of this fact.`;
|
|
19324
|
+
case "merge":
|
|
19325
|
+
case "skip":
|
|
19326
|
+
return `The vault already holds this fact (ID: ${outcome.memoryId}); it was noted as re-observed. Nothing new was created \u2014 do not save it again.`;
|
|
19327
|
+
case "suppressed":
|
|
19328
|
+
return "Not saved: this matches a memory the user previously deleted. Do not re-save it.";
|
|
19329
|
+
}
|
|
19330
|
+
}
|
|
19311
19331
|
function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
19312
19332
|
const hasOnSave = !!options?.onSave;
|
|
19313
19333
|
const folderNames = options?.folderMap ? Array.from(options.folderMap.keys()) : [];
|
|
@@ -19400,6 +19420,17 @@ function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
|
19400
19420
|
return `Memory updated successfully (ID: ${updated.uniqueId}).`;
|
|
19401
19421
|
} else {
|
|
19402
19422
|
const folderId = folderName ? options?.folderMap?.get(folderName) : void 0;
|
|
19423
|
+
if (options?.write) {
|
|
19424
|
+
const input = {
|
|
19425
|
+
content,
|
|
19426
|
+
scope,
|
|
19427
|
+
...folderId !== void 0 && { folderId },
|
|
19428
|
+
...factType !== void 0 && { factType }
|
|
19429
|
+
};
|
|
19430
|
+
const outcome = await options.write(input);
|
|
19431
|
+
await notifyWritten(options, input, outcome);
|
|
19432
|
+
return describeWriteOutcome(outcome);
|
|
19433
|
+
}
|
|
19403
19434
|
const created = await createVaultMemoryOp(vaultCtx, {
|
|
19404
19435
|
content,
|
|
19405
19436
|
scope,
|
|
@@ -19419,6 +19450,16 @@ function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
|
19419
19450
|
}
|
|
19420
19451
|
);
|
|
19421
19452
|
}
|
|
19453
|
+
await notifyWritten(
|
|
19454
|
+
options,
|
|
19455
|
+
{
|
|
19456
|
+
content,
|
|
19457
|
+
scope,
|
|
19458
|
+
...folderId !== void 0 && { folderId },
|
|
19459
|
+
...factType !== void 0 && { factType }
|
|
19460
|
+
},
|
|
19461
|
+
{ memoryId: created.uniqueId, action: "create" }
|
|
19462
|
+
);
|
|
19422
19463
|
return `Memory saved successfully (ID: ${created.uniqueId}).`;
|
|
19423
19464
|
}
|
|
19424
19465
|
} catch (error) {
|
|
@@ -20771,12 +20812,6 @@ function useChatStorage(options) {
|
|
|
20771
20812
|
},
|
|
20772
20813
|
[storageCtx, getToken, baseUrl, embeddingModel, maskEmbeddingInput]
|
|
20773
20814
|
);
|
|
20774
|
-
const createMemoryVaultTool2 = (0, import_react4.useCallback)(
|
|
20775
|
-
(options2) => {
|
|
20776
|
-
return createMemoryVaultTool(vaultCtx, options2);
|
|
20777
|
-
},
|
|
20778
|
-
[vaultCtx]
|
|
20779
|
-
);
|
|
20780
20815
|
const vaultEmbeddingCache = (0, import_react4.useMemo)(
|
|
20781
20816
|
() => getVaultEmbeddingCache(database, walletAddress, embeddingModel),
|
|
20782
20817
|
[database, walletAddress, embeddingModel]
|
|
@@ -20788,6 +20823,42 @@ function useChatStorage(options) {
|
|
|
20788
20823
|
chunkVectorCacheRef.current.clear();
|
|
20789
20824
|
});
|
|
20790
20825
|
}, [vaultEmbeddingCache]);
|
|
20826
|
+
const retainVaultMemory = (0, import_react4.useCallback)(
|
|
20827
|
+
async (input) => {
|
|
20828
|
+
if (!getToken) {
|
|
20829
|
+
throw new Error("getToken is required to retain a vault memory");
|
|
20830
|
+
}
|
|
20831
|
+
return retain(
|
|
20832
|
+
input.content,
|
|
20833
|
+
{
|
|
20834
|
+
vaultCtx,
|
|
20835
|
+
embeddingOptions: {
|
|
20836
|
+
getToken,
|
|
20837
|
+
baseUrl,
|
|
20838
|
+
model: embeddingModel,
|
|
20839
|
+
maskInput: maskEmbeddingInput
|
|
20840
|
+
},
|
|
20841
|
+
vaultCache: vaultEmbeddingCache
|
|
20842
|
+
},
|
|
20843
|
+
{
|
|
20844
|
+
source: "manual",
|
|
20845
|
+
scope: input.scope,
|
|
20846
|
+
...input.folderId !== void 0 && { folderId: input.folderId },
|
|
20847
|
+
...input.factType !== void 0 && { factType: input.factType }
|
|
20848
|
+
}
|
|
20849
|
+
);
|
|
20850
|
+
},
|
|
20851
|
+
[vaultCtx, getToken, baseUrl, embeddingModel, maskEmbeddingInput, vaultEmbeddingCache]
|
|
20852
|
+
);
|
|
20853
|
+
const createMemoryVaultTool2 = (0, import_react4.useCallback)(
|
|
20854
|
+
(options2) => {
|
|
20855
|
+
return createMemoryVaultTool(
|
|
20856
|
+
vaultCtx,
|
|
20857
|
+
getToken ? { write: retainVaultMemory, ...options2 } : options2
|
|
20858
|
+
);
|
|
20859
|
+
},
|
|
20860
|
+
[vaultCtx, getToken, retainVaultMemory]
|
|
20861
|
+
);
|
|
20791
20862
|
const createRecallTool2 = (0, import_react4.useCallback)(
|
|
20792
20863
|
(toolOptions, callbacks) => {
|
|
20793
20864
|
if (!getToken) {
|
|
@@ -22137,6 +22208,7 @@ function useChatStorage(options) {
|
|
|
22137
22208
|
getMessageCount,
|
|
22138
22209
|
createMemoryEngineTool: createMemoryEngineTool2,
|
|
22139
22210
|
createMemoryVaultTool: createMemoryVaultTool2,
|
|
22211
|
+
retainVaultMemory,
|
|
22140
22212
|
createRecallTool: createRecallTool2,
|
|
22141
22213
|
recall: recallFn,
|
|
22142
22214
|
getVaultMemories,
|
package/dist/expo/index.d.mts
CHANGED
|
@@ -9530,6 +9530,41 @@ declare function decodeChunkVector(vector: number[] | string | null | undefined,
|
|
|
9530
9530
|
* Each operation can be intercepted by the host app for confirmation/cancellation.
|
|
9531
9531
|
*/
|
|
9532
9532
|
|
|
9533
|
+
/**
|
|
9534
|
+
* The 7 FactTypes a manual save may self-classify into (PR5). Mirrors the
|
|
9535
|
+
* extractor's `FactType` union in `memory/autoExtract` — kept as a local const
|
|
9536
|
+
* (not imported) to avoid a memoryVault → memory runtime import cycle. Only used
|
|
9537
|
+
* to validate the optional `type` tool argument; an unrecognized value is
|
|
9538
|
+
* dropped (persisted as null, the untyped/medium-decay bucket).
|
|
9539
|
+
*/
|
|
9540
|
+
declare const MANUAL_FACT_TYPES: readonly ["identity", "preference", "relationship", "plan", "ongoing_context", "constraint", "other"];
|
|
9541
|
+
/** A FactType the save tool's optional `type` argument may carry. */
|
|
9542
|
+
type ManualFactType = (typeof MANUAL_FACT_TYPES)[number];
|
|
9543
|
+
/**
|
|
9544
|
+
* What a {@link VaultMemoryWriter} reports back. The action set mirrors
|
|
9545
|
+
* `RetainResult.action` in `memory/retain` — restated here rather than imported
|
|
9546
|
+
* for the same reason MANUAL_FACT_TYPES is (memoryVault → memory import cycle).
|
|
9547
|
+
*/
|
|
9548
|
+
type VaultWriteAction = "create" | "merge" | "update" | "supersede" | "suppressed" | "skip";
|
|
9549
|
+
interface VaultWriteOutcome {
|
|
9550
|
+
/** The memory the write landed on: the fresh row, or the existing one it merged into. */
|
|
9551
|
+
memoryId: string;
|
|
9552
|
+
action: VaultWriteAction;
|
|
9553
|
+
}
|
|
9554
|
+
/** A NEW memory the tool wants written — `id`-addressed updates never come here. */
|
|
9555
|
+
interface VaultWriteInput {
|
|
9556
|
+
content: string;
|
|
9557
|
+
scope: string;
|
|
9558
|
+
folderId?: string;
|
|
9559
|
+
factType?: ManualFactType;
|
|
9560
|
+
}
|
|
9561
|
+
/**
|
|
9562
|
+
* The seam through which the tool writes NEW memories when the host supplies one.
|
|
9563
|
+
* `useChatStorage` (react + expo) passes a `retain()`-backed writer so a
|
|
9564
|
+
* model-initiated save gets the same cosine auto-merge the background extractor
|
|
9565
|
+
* gets, instead of a bare insert that trusts the model to have de-duplicated.
|
|
9566
|
+
*/
|
|
9567
|
+
type VaultMemoryWriter = (input: VaultWriteInput) => Promise<VaultWriteOutcome>;
|
|
9533
9568
|
/**
|
|
9534
9569
|
* Describes a pending vault save operation for UI confirmation.
|
|
9535
9570
|
*/
|
|
@@ -9568,6 +9603,35 @@ interface MemoryVaultToolOptions {
|
|
|
9568
9603
|
* When provided, the LLM can specify a folderName argument.
|
|
9569
9604
|
*/
|
|
9570
9605
|
folderMap?: Map<string, string>;
|
|
9606
|
+
/**
|
|
9607
|
+
* Writer for NEW memories. When set, a save without an `id` goes through it
|
|
9608
|
+
* instead of a bare `createVaultMemoryOp`, and the tool phrases its reply from
|
|
9609
|
+
* the reported action (a merge reads as "already known", not "saved").
|
|
9610
|
+
*
|
|
9611
|
+
* The hooks supply a `retain()`-backed writer, which is what makes this tool
|
|
9612
|
+
* stop being a dedup bypass: until then the only thing standing between the
|
|
9613
|
+
* model and a duplicate row was the prompt asking it to pass an `id`. Omit it
|
|
9614
|
+
* (as a bare `createMemoryVaultTool(vaultCtx, …)` caller must — retain needs
|
|
9615
|
+
* embeddings) and the direct insert path is unchanged.
|
|
9616
|
+
*
|
|
9617
|
+
* Updates addressed by `id` never come here: the model has already named the
|
|
9618
|
+
* row, so there is nothing to de-duplicate against.
|
|
9619
|
+
*/
|
|
9620
|
+
write?: VaultMemoryWriter;
|
|
9621
|
+
/**
|
|
9622
|
+
* Fires after a NEW memory's write settles, with what was asked and what the
|
|
9623
|
+
* writer did. The host's analytics hook: `onSave` runs BEFORE the write and so
|
|
9624
|
+
* cannot tell a fresh create from a merge into an existing memory — and that
|
|
9625
|
+
* split is the one number that says whether model-initiated saves duplicate
|
|
9626
|
+
* the vault. Fires on both write paths (a `write` seam, or the direct insert
|
|
9627
|
+
* when none is supplied — reported as `create`). Not called for
|
|
9628
|
+
* `id`-addressed updates or cancelled saves. A throwing or rejecting listener
|
|
9629
|
+
* is awaited and swallowed so it can never fail the tool call.
|
|
9630
|
+
*/
|
|
9631
|
+
onWritten?: (event: {
|
|
9632
|
+
input: VaultWriteInput;
|
|
9633
|
+
outcome: VaultWriteOutcome;
|
|
9634
|
+
}) => void | Promise<void>;
|
|
9571
9635
|
}
|
|
9572
9636
|
/**
|
|
9573
9637
|
* Creates a memory vault tool for use with chat completions.
|
|
@@ -9860,6 +9924,14 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
|
|
|
9860
9924
|
createMemoryEngineTool: (searchOptions?: Partial<MemoryEngineSearchOptions>) => ToolConfig;
|
|
9861
9925
|
/** Create a memory vault tool pre-configured with hook's vault context and encryption. */
|
|
9862
9926
|
createMemoryVaultTool: (options?: MemoryVaultToolOptions) => ToolConfig;
|
|
9927
|
+
/**
|
|
9928
|
+
* Write one memory through `retain()` — cosine auto-merge against the vault,
|
|
9929
|
+
* so an explicit "save this" from a host surface (selection → memory, a
|
|
9930
|
+
* manual add) lands as a re-observation of an existing memory instead of a
|
|
9931
|
+
* duplicate row when the vault already holds the fact. The
|
|
9932
|
+
* `memory_vault_save` tool writes through this too. Throws without `getToken`.
|
|
9933
|
+
*/
|
|
9934
|
+
retainVaultMemory: (input: VaultWriteInput) => Promise<RetainResult>;
|
|
9863
9935
|
/**
|
|
9864
9936
|
* Create the unified recall tool — single chat-completion tool that
|
|
9865
9937
|
* searches both vault facts and conversation chunks via recall().
|
|
@@ -10654,4 +10726,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
10654
10726
|
*/
|
|
10655
10727
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
10656
10728
|
|
|
10657
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, 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, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, 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 Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, 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 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 RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, 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 StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, 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 VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, backfillMemoryTopicsOp, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, 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, isDegradedTopicSkip, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
|
|
10729
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, 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, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, 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 Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type ManualFactType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, 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 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 RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, 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 StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, 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 VaultFolderOperationsContext, type VaultMemoryOperationsContext, 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, addConversationMemoriesOp, archiveVaultMemoryOp, backfillMemoryTopicsOp, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, 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, isDegradedTopicSkip, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -9530,6 +9530,41 @@ declare function decodeChunkVector(vector: number[] | string | null | undefined,
|
|
|
9530
9530
|
* Each operation can be intercepted by the host app for confirmation/cancellation.
|
|
9531
9531
|
*/
|
|
9532
9532
|
|
|
9533
|
+
/**
|
|
9534
|
+
* The 7 FactTypes a manual save may self-classify into (PR5). Mirrors the
|
|
9535
|
+
* extractor's `FactType` union in `memory/autoExtract` — kept as a local const
|
|
9536
|
+
* (not imported) to avoid a memoryVault → memory runtime import cycle. Only used
|
|
9537
|
+
* to validate the optional `type` tool argument; an unrecognized value is
|
|
9538
|
+
* dropped (persisted as null, the untyped/medium-decay bucket).
|
|
9539
|
+
*/
|
|
9540
|
+
declare const MANUAL_FACT_TYPES: readonly ["identity", "preference", "relationship", "plan", "ongoing_context", "constraint", "other"];
|
|
9541
|
+
/** A FactType the save tool's optional `type` argument may carry. */
|
|
9542
|
+
type ManualFactType = (typeof MANUAL_FACT_TYPES)[number];
|
|
9543
|
+
/**
|
|
9544
|
+
* What a {@link VaultMemoryWriter} reports back. The action set mirrors
|
|
9545
|
+
* `RetainResult.action` in `memory/retain` — restated here rather than imported
|
|
9546
|
+
* for the same reason MANUAL_FACT_TYPES is (memoryVault → memory import cycle).
|
|
9547
|
+
*/
|
|
9548
|
+
type VaultWriteAction = "create" | "merge" | "update" | "supersede" | "suppressed" | "skip";
|
|
9549
|
+
interface VaultWriteOutcome {
|
|
9550
|
+
/** The memory the write landed on: the fresh row, or the existing one it merged into. */
|
|
9551
|
+
memoryId: string;
|
|
9552
|
+
action: VaultWriteAction;
|
|
9553
|
+
}
|
|
9554
|
+
/** A NEW memory the tool wants written — `id`-addressed updates never come here. */
|
|
9555
|
+
interface VaultWriteInput {
|
|
9556
|
+
content: string;
|
|
9557
|
+
scope: string;
|
|
9558
|
+
folderId?: string;
|
|
9559
|
+
factType?: ManualFactType;
|
|
9560
|
+
}
|
|
9561
|
+
/**
|
|
9562
|
+
* The seam through which the tool writes NEW memories when the host supplies one.
|
|
9563
|
+
* `useChatStorage` (react + expo) passes a `retain()`-backed writer so a
|
|
9564
|
+
* model-initiated save gets the same cosine auto-merge the background extractor
|
|
9565
|
+
* gets, instead of a bare insert that trusts the model to have de-duplicated.
|
|
9566
|
+
*/
|
|
9567
|
+
type VaultMemoryWriter = (input: VaultWriteInput) => Promise<VaultWriteOutcome>;
|
|
9533
9568
|
/**
|
|
9534
9569
|
* Describes a pending vault save operation for UI confirmation.
|
|
9535
9570
|
*/
|
|
@@ -9568,6 +9603,35 @@ interface MemoryVaultToolOptions {
|
|
|
9568
9603
|
* When provided, the LLM can specify a folderName argument.
|
|
9569
9604
|
*/
|
|
9570
9605
|
folderMap?: Map<string, string>;
|
|
9606
|
+
/**
|
|
9607
|
+
* Writer for NEW memories. When set, a save without an `id` goes through it
|
|
9608
|
+
* instead of a bare `createVaultMemoryOp`, and the tool phrases its reply from
|
|
9609
|
+
* the reported action (a merge reads as "already known", not "saved").
|
|
9610
|
+
*
|
|
9611
|
+
* The hooks supply a `retain()`-backed writer, which is what makes this tool
|
|
9612
|
+
* stop being a dedup bypass: until then the only thing standing between the
|
|
9613
|
+
* model and a duplicate row was the prompt asking it to pass an `id`. Omit it
|
|
9614
|
+
* (as a bare `createMemoryVaultTool(vaultCtx, …)` caller must — retain needs
|
|
9615
|
+
* embeddings) and the direct insert path is unchanged.
|
|
9616
|
+
*
|
|
9617
|
+
* Updates addressed by `id` never come here: the model has already named the
|
|
9618
|
+
* row, so there is nothing to de-duplicate against.
|
|
9619
|
+
*/
|
|
9620
|
+
write?: VaultMemoryWriter;
|
|
9621
|
+
/**
|
|
9622
|
+
* Fires after a NEW memory's write settles, with what was asked and what the
|
|
9623
|
+
* writer did. The host's analytics hook: `onSave` runs BEFORE the write and so
|
|
9624
|
+
* cannot tell a fresh create from a merge into an existing memory — and that
|
|
9625
|
+
* split is the one number that says whether model-initiated saves duplicate
|
|
9626
|
+
* the vault. Fires on both write paths (a `write` seam, or the direct insert
|
|
9627
|
+
* when none is supplied — reported as `create`). Not called for
|
|
9628
|
+
* `id`-addressed updates or cancelled saves. A throwing or rejecting listener
|
|
9629
|
+
* is awaited and swallowed so it can never fail the tool call.
|
|
9630
|
+
*/
|
|
9631
|
+
onWritten?: (event: {
|
|
9632
|
+
input: VaultWriteInput;
|
|
9633
|
+
outcome: VaultWriteOutcome;
|
|
9634
|
+
}) => void | Promise<void>;
|
|
9571
9635
|
}
|
|
9572
9636
|
/**
|
|
9573
9637
|
* Creates a memory vault tool for use with chat completions.
|
|
@@ -9860,6 +9924,14 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
|
|
|
9860
9924
|
createMemoryEngineTool: (searchOptions?: Partial<MemoryEngineSearchOptions>) => ToolConfig;
|
|
9861
9925
|
/** Create a memory vault tool pre-configured with hook's vault context and encryption. */
|
|
9862
9926
|
createMemoryVaultTool: (options?: MemoryVaultToolOptions) => ToolConfig;
|
|
9927
|
+
/**
|
|
9928
|
+
* Write one memory through `retain()` — cosine auto-merge against the vault,
|
|
9929
|
+
* so an explicit "save this" from a host surface (selection → memory, a
|
|
9930
|
+
* manual add) lands as a re-observation of an existing memory instead of a
|
|
9931
|
+
* duplicate row when the vault already holds the fact. The
|
|
9932
|
+
* `memory_vault_save` tool writes through this too. Throws without `getToken`.
|
|
9933
|
+
*/
|
|
9934
|
+
retainVaultMemory: (input: VaultWriteInput) => Promise<RetainResult>;
|
|
9863
9935
|
/**
|
|
9864
9936
|
* Create the unified recall tool — single chat-completion tool that
|
|
9865
9937
|
* searches both vault facts and conversation chunks via recall().
|
|
@@ -10654,4 +10726,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
10654
10726
|
*/
|
|
10655
10727
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
10656
10728
|
|
|
10657
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, 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, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, 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 Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, 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 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 RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, 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 StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, 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 VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, backfillMemoryTopicsOp, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, 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, isDegradedTopicSkip, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
|
|
10729
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, 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, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, 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 Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type ManualFactType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, 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 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 RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, 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 StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, 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 VaultFolderOperationsContext, type VaultMemoryOperationsContext, 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, addConversationMemoriesOp, archiveVaultMemoryOp, backfillMemoryTopicsOp, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, 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, isDegradedTopicSkip, isPiiRedactor, isRerankerAvailable, maskScopedEmbeddingCache, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
|
package/dist/expo/index.mjs
CHANGED
|
@@ -9517,6 +9517,26 @@ var MANUAL_FACT_TYPES = [
|
|
|
9517
9517
|
function normalizeManualFactType(value) {
|
|
9518
9518
|
return typeof value === "string" && MANUAL_FACT_TYPES.includes(value) ? value : void 0;
|
|
9519
9519
|
}
|
|
9520
|
+
async function notifyWritten(options, input, outcome) {
|
|
9521
|
+
try {
|
|
9522
|
+
await options?.onWritten?.({ input, outcome });
|
|
9523
|
+
} catch {
|
|
9524
|
+
}
|
|
9525
|
+
}
|
|
9526
|
+
function describeWriteOutcome(outcome) {
|
|
9527
|
+
switch (outcome.action) {
|
|
9528
|
+
case "create":
|
|
9529
|
+
return `Memory saved successfully (ID: ${outcome.memoryId}).`;
|
|
9530
|
+
case "update":
|
|
9531
|
+
case "supersede":
|
|
9532
|
+
return `Memory saved successfully (ID: ${outcome.memoryId}); it replaces an earlier version of this fact.`;
|
|
9533
|
+
case "merge":
|
|
9534
|
+
case "skip":
|
|
9535
|
+
return `The vault already holds this fact (ID: ${outcome.memoryId}); it was noted as re-observed. Nothing new was created \u2014 do not save it again.`;
|
|
9536
|
+
case "suppressed":
|
|
9537
|
+
return "Not saved: this matches a memory the user previously deleted. Do not re-save it.";
|
|
9538
|
+
}
|
|
9539
|
+
}
|
|
9520
9540
|
function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
9521
9541
|
const hasOnSave = !!options?.onSave;
|
|
9522
9542
|
const folderNames = options?.folderMap ? Array.from(options.folderMap.keys()) : [];
|
|
@@ -9609,6 +9629,17 @@ function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
|
9609
9629
|
return `Memory updated successfully (ID: ${updated.uniqueId}).`;
|
|
9610
9630
|
} else {
|
|
9611
9631
|
const folderId = folderName ? options?.folderMap?.get(folderName) : void 0;
|
|
9632
|
+
if (options?.write) {
|
|
9633
|
+
const input = {
|
|
9634
|
+
content,
|
|
9635
|
+
scope,
|
|
9636
|
+
...folderId !== void 0 && { folderId },
|
|
9637
|
+
...factType !== void 0 && { factType }
|
|
9638
|
+
};
|
|
9639
|
+
const outcome = await options.write(input);
|
|
9640
|
+
await notifyWritten(options, input, outcome);
|
|
9641
|
+
return describeWriteOutcome(outcome);
|
|
9642
|
+
}
|
|
9612
9643
|
const created = await createVaultMemoryOp(vaultCtx, {
|
|
9613
9644
|
content,
|
|
9614
9645
|
scope,
|
|
@@ -9628,6 +9659,16 @@ function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
|
9628
9659
|
}
|
|
9629
9660
|
);
|
|
9630
9661
|
}
|
|
9662
|
+
await notifyWritten(
|
|
9663
|
+
options,
|
|
9664
|
+
{
|
|
9665
|
+
content,
|
|
9666
|
+
scope,
|
|
9667
|
+
...folderId !== void 0 && { folderId },
|
|
9668
|
+
...factType !== void 0 && { factType }
|
|
9669
|
+
},
|
|
9670
|
+
{ memoryId: created.uniqueId, action: "create" }
|
|
9671
|
+
);
|
|
9631
9672
|
return `Memory saved successfully (ID: ${created.uniqueId}).`;
|
|
9632
9673
|
}
|
|
9633
9674
|
} catch (error) {
|
|
@@ -10970,12 +11011,6 @@ function useChatStorage(options) {
|
|
|
10970
11011
|
},
|
|
10971
11012
|
[storageCtx, getToken, baseUrl, embeddingModel, maskEmbeddingInput]
|
|
10972
11013
|
);
|
|
10973
|
-
const createMemoryVaultTool2 = useCallback4(
|
|
10974
|
-
(options2) => {
|
|
10975
|
-
return createMemoryVaultTool(vaultCtx, options2);
|
|
10976
|
-
},
|
|
10977
|
-
[vaultCtx]
|
|
10978
|
-
);
|
|
10979
11014
|
const vaultEmbeddingCache = useMemo(
|
|
10980
11015
|
() => getVaultEmbeddingCache(database, walletAddress, embeddingModel),
|
|
10981
11016
|
[database, walletAddress, embeddingModel]
|
|
@@ -10987,6 +11022,42 @@ function useChatStorage(options) {
|
|
|
10987
11022
|
chunkVectorCacheRef.current.clear();
|
|
10988
11023
|
});
|
|
10989
11024
|
}, [vaultEmbeddingCache]);
|
|
11025
|
+
const retainVaultMemory = useCallback4(
|
|
11026
|
+
async (input) => {
|
|
11027
|
+
if (!getToken) {
|
|
11028
|
+
throw new Error("getToken is required to retain a vault memory");
|
|
11029
|
+
}
|
|
11030
|
+
return retain(
|
|
11031
|
+
input.content,
|
|
11032
|
+
{
|
|
11033
|
+
vaultCtx,
|
|
11034
|
+
embeddingOptions: {
|
|
11035
|
+
getToken,
|
|
11036
|
+
baseUrl,
|
|
11037
|
+
model: embeddingModel,
|
|
11038
|
+
maskInput: maskEmbeddingInput
|
|
11039
|
+
},
|
|
11040
|
+
vaultCache: vaultEmbeddingCache
|
|
11041
|
+
},
|
|
11042
|
+
{
|
|
11043
|
+
source: "manual",
|
|
11044
|
+
scope: input.scope,
|
|
11045
|
+
...input.folderId !== void 0 && { folderId: input.folderId },
|
|
11046
|
+
...input.factType !== void 0 && { factType: input.factType }
|
|
11047
|
+
}
|
|
11048
|
+
);
|
|
11049
|
+
},
|
|
11050
|
+
[vaultCtx, getToken, baseUrl, embeddingModel, maskEmbeddingInput, vaultEmbeddingCache]
|
|
11051
|
+
);
|
|
11052
|
+
const createMemoryVaultTool2 = useCallback4(
|
|
11053
|
+
(options2) => {
|
|
11054
|
+
return createMemoryVaultTool(
|
|
11055
|
+
vaultCtx,
|
|
11056
|
+
getToken ? { write: retainVaultMemory, ...options2 } : options2
|
|
11057
|
+
);
|
|
11058
|
+
},
|
|
11059
|
+
[vaultCtx, getToken, retainVaultMemory]
|
|
11060
|
+
);
|
|
10990
11061
|
const createRecallTool2 = useCallback4(
|
|
10991
11062
|
(toolOptions, callbacks) => {
|
|
10992
11063
|
if (!getToken) {
|
|
@@ -12336,6 +12407,7 @@ function useChatStorage(options) {
|
|
|
12336
12407
|
getMessageCount,
|
|
12337
12408
|
createMemoryEngineTool: createMemoryEngineTool2,
|
|
12338
12409
|
createMemoryVaultTool: createMemoryVaultTool2,
|
|
12410
|
+
retainVaultMemory,
|
|
12339
12411
|
createRecallTool: createRecallTool2,
|
|
12340
12412
|
recall: recallFn,
|
|
12341
12413
|
getVaultMemories,
|
package/dist/react/index.cjs
CHANGED
|
@@ -20606,6 +20606,26 @@ var MANUAL_FACT_TYPES = [
|
|
|
20606
20606
|
function normalizeManualFactType(value) {
|
|
20607
20607
|
return typeof value === "string" && MANUAL_FACT_TYPES.includes(value) ? value : void 0;
|
|
20608
20608
|
}
|
|
20609
|
+
async function notifyWritten(options, input, outcome) {
|
|
20610
|
+
try {
|
|
20611
|
+
await options?.onWritten?.({ input, outcome });
|
|
20612
|
+
} catch {
|
|
20613
|
+
}
|
|
20614
|
+
}
|
|
20615
|
+
function describeWriteOutcome(outcome) {
|
|
20616
|
+
switch (outcome.action) {
|
|
20617
|
+
case "create":
|
|
20618
|
+
return `Memory saved successfully (ID: ${outcome.memoryId}).`;
|
|
20619
|
+
case "update":
|
|
20620
|
+
case "supersede":
|
|
20621
|
+
return `Memory saved successfully (ID: ${outcome.memoryId}); it replaces an earlier version of this fact.`;
|
|
20622
|
+
case "merge":
|
|
20623
|
+
case "skip":
|
|
20624
|
+
return `The vault already holds this fact (ID: ${outcome.memoryId}); it was noted as re-observed. Nothing new was created \u2014 do not save it again.`;
|
|
20625
|
+
case "suppressed":
|
|
20626
|
+
return "Not saved: this matches a memory the user previously deleted. Do not re-save it.";
|
|
20627
|
+
}
|
|
20628
|
+
}
|
|
20609
20629
|
function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
20610
20630
|
const hasOnSave = !!options?.onSave;
|
|
20611
20631
|
const folderNames = options?.folderMap ? Array.from(options.folderMap.keys()) : [];
|
|
@@ -20698,6 +20718,17 @@ function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
|
20698
20718
|
return `Memory updated successfully (ID: ${updated.uniqueId}).`;
|
|
20699
20719
|
} else {
|
|
20700
20720
|
const folderId = folderName ? options?.folderMap?.get(folderName) : void 0;
|
|
20721
|
+
if (options?.write) {
|
|
20722
|
+
const input = {
|
|
20723
|
+
content,
|
|
20724
|
+
scope,
|
|
20725
|
+
...folderId !== void 0 && { folderId },
|
|
20726
|
+
...factType !== void 0 && { factType }
|
|
20727
|
+
};
|
|
20728
|
+
const outcome = await options.write(input);
|
|
20729
|
+
await notifyWritten(options, input, outcome);
|
|
20730
|
+
return describeWriteOutcome(outcome);
|
|
20731
|
+
}
|
|
20701
20732
|
const created = await createVaultMemoryOp(vaultCtx, {
|
|
20702
20733
|
content,
|
|
20703
20734
|
scope,
|
|
@@ -20717,6 +20748,16 @@ function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
|
20717
20748
|
}
|
|
20718
20749
|
);
|
|
20719
20750
|
}
|
|
20751
|
+
await notifyWritten(
|
|
20752
|
+
options,
|
|
20753
|
+
{
|
|
20754
|
+
content,
|
|
20755
|
+
scope,
|
|
20756
|
+
...folderId !== void 0 && { folderId },
|
|
20757
|
+
...factType !== void 0 && { factType }
|
|
20758
|
+
},
|
|
20759
|
+
{ memoryId: created.uniqueId, action: "create" }
|
|
20760
|
+
);
|
|
20720
20761
|
return `Memory saved successfully (ID: ${created.uniqueId}).`;
|
|
20721
20762
|
}
|
|
20722
20763
|
} catch (error) {
|
|
@@ -23318,17 +23359,42 @@ function useChatStorage(options) {
|
|
|
23318
23359
|
},
|
|
23319
23360
|
[storageCtx, getToken, vaultEmbeddingOptions]
|
|
23320
23361
|
);
|
|
23362
|
+
const retainVaultMemory = (0, import_react5.useCallback)(
|
|
23363
|
+
async (input) => {
|
|
23364
|
+
if (!getToken) {
|
|
23365
|
+
throw new Error("getToken is required to retain a vault memory");
|
|
23366
|
+
}
|
|
23367
|
+
return retain(
|
|
23368
|
+
input.content,
|
|
23369
|
+
{
|
|
23370
|
+
vaultCtx,
|
|
23371
|
+
embeddingOptions: vaultEmbeddingOptions,
|
|
23372
|
+
vaultCache: vaultEmbeddingCache
|
|
23373
|
+
},
|
|
23374
|
+
{
|
|
23375
|
+
source: "manual",
|
|
23376
|
+
scope: input.scope,
|
|
23377
|
+
...input.folderId !== void 0 && { folderId: input.folderId },
|
|
23378
|
+
...input.factType !== void 0 && { factType: input.factType }
|
|
23379
|
+
}
|
|
23380
|
+
);
|
|
23381
|
+
},
|
|
23382
|
+
[vaultCtx, getToken, vaultEmbeddingOptions, vaultEmbeddingCache]
|
|
23383
|
+
);
|
|
23321
23384
|
const createMemoryVaultTool2 = (0, import_react5.useCallback)(
|
|
23322
23385
|
(options2) => {
|
|
23323
23386
|
const embOpts = getToken ? vaultEmbeddingOptions : void 0;
|
|
23324
23387
|
return createMemoryVaultTool(
|
|
23325
23388
|
vaultCtx,
|
|
23326
|
-
|
|
23389
|
+
// New memories go through retain() (auto-merge) whenever embeddings are
|
|
23390
|
+
// available; a caller-supplied `write` still wins. Without a token the
|
|
23391
|
+
// tool keeps its direct-insert path — retain cannot embed.
|
|
23392
|
+
embOpts ? { write: retainVaultMemory, ...options2 } : options2,
|
|
23327
23393
|
embOpts,
|
|
23328
23394
|
embOpts ? vaultEmbeddingCache : void 0
|
|
23329
23395
|
);
|
|
23330
23396
|
},
|
|
23331
|
-
[vaultCtx, getToken, vaultEmbeddingOptions, vaultEmbeddingCache]
|
|
23397
|
+
[vaultCtx, getToken, vaultEmbeddingOptions, vaultEmbeddingCache, retainVaultMemory]
|
|
23332
23398
|
);
|
|
23333
23399
|
const getVaultMemories = (0, import_react5.useCallback)(
|
|
23334
23400
|
(options2) => {
|
|
@@ -24624,6 +24690,7 @@ function useChatStorage(options) {
|
|
|
24624
24690
|
getAllFiles,
|
|
24625
24691
|
createMemoryEngineTool: createMemoryEngineTool2,
|
|
24626
24692
|
createMemoryVaultTool: createMemoryVaultTool2,
|
|
24693
|
+
retainVaultMemory,
|
|
24627
24694
|
createMemoryVaultSearchTool: createMemoryVaultSearchTool2,
|
|
24628
24695
|
createRecallTool: createRecallTool2,
|
|
24629
24696
|
recall: recallFn,
|