@anuma/sdk 2.3.1 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/expo/{chunk-SF5AYTXH.mjs → chunk-UOUJUZM4.mjs} +229 -35
- package/dist/expo/index.cjs +310 -44
- package/dist/expo/index.d.mts +212 -10
- package/dist/expo/index.d.ts +212 -10
- package/dist/expo/index.mjs +78 -9
- package/dist/expo/{recall-PCKDVF3U.mjs → recall-HI7VO3VM.mjs} +1 -1
- package/dist/react/{chunk-JUDJVX66.mjs → chunk-IYDQBFS2.mjs} +229 -35
- package/dist/react/index.cjs +306 -43
- package/dist/react/index.d.mts +219 -10
- package/dist/react/index.d.ts +219 -10
- package/dist/react/index.mjs +74 -8
- package/dist/react/{recall-DSJSBDR4.mjs → recall-G3CS444F.mjs} +1 -1
- package/dist/server/{chunk-3AWYZRTS.mjs → chunk-3MLG7SUH.mjs} +229 -35
- package/dist/server/index.cjs +299 -42
- package/dist/server/index.d.mts +219 -10
- package/dist/server/index.d.ts +219 -10
- package/dist/server/index.mjs +67 -7
- package/dist/server/{recall-EWMI64SA.mjs → recall-MJHGXMHZ.mjs} +1 -1
- package/package.json +1 -1
package/dist/expo/index.d.mts
CHANGED
|
@@ -4248,6 +4248,37 @@ declare function getConversationsByProjectLazyOp(ctx: StorageOperationsContext,
|
|
|
4248
4248
|
declare function upsertMessageOp(ctx: StorageOperationsContext, opts: CreateMessageOptions & {
|
|
4249
4249
|
uniqueId: string;
|
|
4250
4250
|
}): Promise<StoredMessage>;
|
|
4251
|
+
/**
|
|
4252
|
+
* Decrypted, model-native chunk vectors for one message, cached across recall
|
|
4253
|
+
* calls so the chunk lane doesn't re-decrypt + re-JSON.parse every message's
|
|
4254
|
+
* embeddings on every query. Keyed by message id; `version` is the message's
|
|
4255
|
+
* `updated_at` at cache time, so a re-embed (which bumps `updated_at`) misses
|
|
4256
|
+
* and repopulates. Vectors are stored Float32 — model-native precision, half
|
|
4257
|
+
* the RAM of float64 `number[]` — mirroring the vault embedding cache (#705).
|
|
4258
|
+
* Content text is deliberately NOT cached (see searchChunksOp): it isn't
|
|
4259
|
+
* needed for scoring, and keeping decrypted content out of the cache preserves
|
|
4260
|
+
* the SDK's data-at-rest posture.
|
|
4261
|
+
*/
|
|
4262
|
+
interface CachedChunkVectors {
|
|
4263
|
+
/** Message `updated_at` (ms) at cache time — the invalidation token. */
|
|
4264
|
+
version: number;
|
|
4265
|
+
/**
|
|
4266
|
+
* Per-chunk embedding vectors, index-aligned with the message's decrypted
|
|
4267
|
+
* `chunks` array (empty-vector chunks kept as zero-length placeholders so
|
|
4268
|
+
* indices stay aligned). Empty when the message has only a whole-message
|
|
4269
|
+
* `fallback` vector.
|
|
4270
|
+
*/
|
|
4271
|
+
chunks: Float32Array[];
|
|
4272
|
+
/** Whole-message vector when the message was embedded without chunking. */
|
|
4273
|
+
fallback?: Float32Array;
|
|
4274
|
+
}
|
|
4275
|
+
/**
|
|
4276
|
+
* Cache consumed by {@link searchChunksOp}, keyed by message id. A plain `Map`
|
|
4277
|
+
* (satisfied by the LRU from `createChunkVectorCache`) — mirrors
|
|
4278
|
+
* `VaultEmbeddingCache` so consumers get the same `clear()`/`delete()`
|
|
4279
|
+
* ergonomics on an encryption-key reset.
|
|
4280
|
+
*/
|
|
4281
|
+
type ChunkVectorCache = Map<string, CachedChunkVectors>;
|
|
4251
4282
|
|
|
4252
4283
|
declare const chatStorageSchema: Readonly<{
|
|
4253
4284
|
version: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
@@ -5047,6 +5078,14 @@ interface RecallOptions {
|
|
|
5047
5078
|
* resolves windows in 2026 and never overlaps stored event_time.
|
|
5048
5079
|
*/
|
|
5049
5080
|
now?: number;
|
|
5081
|
+
/**
|
|
5082
|
+
* Best-effort observability hook. Called once per `recall()` with per-lane
|
|
5083
|
+
* timings, lane counts, and soft-degradation signals — the raw material for
|
|
5084
|
+
* tuning latency/quality and for wiring recall telemetry to PostHog. Invoked
|
|
5085
|
+
* synchronously just before `recall()` returns; a throwing callback is
|
|
5086
|
+
* swallowed (diagnostics must never break retrieval). Off unless provided.
|
|
5087
|
+
*/
|
|
5088
|
+
onDiagnostics?: (diagnostics: RecallDiagnostics) => void;
|
|
5050
5089
|
/** Number of candidates fed to the cross-encoder rerank stage. Default: 30. */
|
|
5051
5090
|
rerankTopN?: number;
|
|
5052
5091
|
/** Multiplicative cross-encoder blend weight. Default: 0.1. */
|
|
@@ -5077,6 +5116,12 @@ interface RecallContext {
|
|
|
5077
5116
|
embeddingOptions: EmbeddingOptions;
|
|
5078
5117
|
/** Vault embedding LRU cache. */
|
|
5079
5118
|
vaultCache?: VaultEmbeddingCache;
|
|
5119
|
+
/**
|
|
5120
|
+
* Optional chunk-vector LRU cache. When provided, the chunk lane skips the
|
|
5121
|
+
* per-query decrypt + JSON.parse of every message's chunk vectors on warm
|
|
5122
|
+
* entries. Build via `createChunkVectorCache`. Omit for legacy behavior.
|
|
5123
|
+
*/
|
|
5124
|
+
chunkCache?: ChunkVectorCache;
|
|
5080
5125
|
/**
|
|
5081
5126
|
* Optional — when provided, recall extracts entities from the query
|
|
5082
5127
|
* and adds a graph lane to the RRF fusion (memories sharing entities
|
|
@@ -5096,6 +5141,48 @@ interface RecallResult {
|
|
|
5096
5141
|
/** Diagnostic: total memories in the vault when fact lane was queried. */
|
|
5097
5142
|
vaultSize?: number;
|
|
5098
5143
|
}
|
|
5144
|
+
/** Soft-degradation signals surfaced via {@link RecallDiagnostics.degraded}. */
|
|
5145
|
+
type RecallDegradation =
|
|
5146
|
+
/** Rerank was requested (budget mid/high) but the cross-encoder didn't run
|
|
5147
|
+
* this call — unavailable (e.g. React Native) or a transient failure. */
|
|
5148
|
+
"rerank-unavailable"
|
|
5149
|
+
/** `budget: 'high'` requested but no `decomposeOptions`, so query
|
|
5150
|
+
* decomposition was skipped and the budget downgraded to mid. */
|
|
5151
|
+
| "decompose-unavailable";
|
|
5152
|
+
/**
|
|
5153
|
+
* Per-call recall observability payload (see {@link RecallOptions.onDiagnostics}).
|
|
5154
|
+
* All timings are wall-clock milliseconds. Lane counts are post-dedupe,
|
|
5155
|
+
* pre-fusion. Intended to be forwarded to a metrics sink (e.g. PostHog).
|
|
5156
|
+
*/
|
|
5157
|
+
interface RecallDiagnostics {
|
|
5158
|
+
/** Budget actually executed (may have downgraded from the requested one). */
|
|
5159
|
+
usedBudget: Budget;
|
|
5160
|
+
/** Whether the cross-encoder actually reranked the fact lane this call. */
|
|
5161
|
+
reranked: boolean;
|
|
5162
|
+
/** Total candidates considered before truncation. */
|
|
5163
|
+
candidateCount: number;
|
|
5164
|
+
/** Total vault size when the fact lane ran (absent if it didn't). */
|
|
5165
|
+
vaultSize?: number;
|
|
5166
|
+
/** Facts the fact lane returned (post-dedupe, pre-fusion). */
|
|
5167
|
+
factCount: number;
|
|
5168
|
+
/** Chunks the chunk lane returned (post-dedupe, pre-fusion). */
|
|
5169
|
+
chunkCount: number;
|
|
5170
|
+
/** Wall-clock phase timings (ms). */
|
|
5171
|
+
timings: {
|
|
5172
|
+
/** Whole `recall()` call. */
|
|
5173
|
+
total: number;
|
|
5174
|
+
/** Parallel query-embed + graph/temporal side-lane build. */
|
|
5175
|
+
prep: number;
|
|
5176
|
+
/** Vault fact-lane search (`searchVaultMemoriesWithSize`). */
|
|
5177
|
+
factLane: number;
|
|
5178
|
+
/** Chunk-lane search (`searchChunksOp`). */
|
|
5179
|
+
chunkLane: number;
|
|
5180
|
+
/** Cross-lane RRF fusion + provenance dedup after both lanes. */
|
|
5181
|
+
fuse: number;
|
|
5182
|
+
};
|
|
5183
|
+
/** Soft-degradation signals that fired this call (empty when clean). */
|
|
5184
|
+
degraded: RecallDegradation[];
|
|
5185
|
+
}
|
|
5099
5186
|
type RetainAction = "create" | "merge" | "update" | "skip" | "suppressed";
|
|
5100
5187
|
type RetainSource = "manual" | "auto-extracted" | "capsule";
|
|
5101
5188
|
/** Why the consolidator fell back to "create" instead of a real decision. */
|
|
@@ -5446,15 +5533,32 @@ declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: Ret
|
|
|
5446
5533
|
* newest (superset) message list re-covers any superseded turn. Turns for
|
|
5447
5534
|
* different conversations queue independently and never displace each other.
|
|
5448
5535
|
*
|
|
5449
|
-
* Watermark + window: the worker keeps
|
|
5450
|
-
*
|
|
5451
|
-
*
|
|
5452
|
-
*
|
|
5453
|
-
*
|
|
5454
|
-
*
|
|
5455
|
-
*
|
|
5456
|
-
*
|
|
5457
|
-
*
|
|
5536
|
+
* Watermark + window: the worker keeps a per-conversation watermark of the
|
|
5537
|
+
* last message it extracted through. Each run sends every message *after* that
|
|
5538
|
+
* watermark (plus a small overlap for coreference, capped at `maxWindowSize`)
|
|
5539
|
+
* rather than a fixed trailing slice — so facts stated in turns that arrived
|
|
5540
|
+
* during a busy window are still examined instead of scrolling out of a last-N
|
|
5541
|
+
* window.
|
|
5542
|
+
*
|
|
5543
|
+
* Durability: the in-memory watermark alone does NOT survive process death, so
|
|
5544
|
+
* a session killed after messages accumulate but before extraction would, on
|
|
5545
|
+
* the next launch, fall back to a trailing-window guess and could skip the
|
|
5546
|
+
* un-extracted tail. Pass a {@link ExtractionCursorStore} (`cursorStore`) to
|
|
5547
|
+
* persist the watermark per conversation — it is hydrated synchronously the
|
|
5548
|
+
* first time a conversation is touched, and written through on every *contiguous*
|
|
5549
|
+
* advance (never on a trailing-slice guess, which could jump the durable cursor
|
|
5550
|
+
* past an un-extracted gap), so a later session resumes exactly after the last
|
|
5551
|
+
* extracted message. The primary guarantee is single-session resume across
|
|
5552
|
+
* process death.
|
|
5553
|
+
*
|
|
5554
|
+
* Concurrent sessions sharing one store (web `localStorage`, mobile MMKV) are
|
|
5555
|
+
* best-effort, NOT exclusive: two sessions can each hydrate the same cursor
|
|
5556
|
+
* before either advances it and briefly re-extract the same turn (retain()'s
|
|
5557
|
+
* dedup/consolidation absorbs the duplicate — wasteful, not corrupting). The
|
|
5558
|
+
* durable write is last-writer-wins with a regression guard (it won't move the
|
|
5559
|
+
* cursor backwards when the currently-stored id is ahead within the same turn's
|
|
5560
|
+
* messages), but it does not serialize writers. Omit `cursorStore` for the
|
|
5561
|
+
* legacy in-memory-only behavior.
|
|
5458
5562
|
*
|
|
5459
5563
|
* Memory Studio panel subscribes by passing `onMemoryExtracted` and/or
|
|
5460
5564
|
* `onTurnComplete` callbacks. The Studio uses `onMemoryExtracted` to
|
|
@@ -5502,6 +5606,37 @@ interface TurnCompleteEvent {
|
|
|
5502
5606
|
outcome: ExtractOutcome;
|
|
5503
5607
|
}
|
|
5504
5608
|
/** @public */
|
|
5609
|
+
/**
|
|
5610
|
+
* Durable per-conversation extraction cursor. Synchronous by contract (both
|
|
5611
|
+
* SDK platform stores — web `localStorage`, mobile MMKV — are sync), so the
|
|
5612
|
+
* worker can hydrate the watermark inline without changing its fire-and-forget
|
|
5613
|
+
* control flow. Implementations should be best-effort; the worker guards every
|
|
5614
|
+
* call, so a throwing store degrades to in-memory-only rather than breaking
|
|
5615
|
+
* extraction.
|
|
5616
|
+
*
|
|
5617
|
+
* @public
|
|
5618
|
+
*/
|
|
5619
|
+
interface ExtractionCursorStore {
|
|
5620
|
+
/** Last message id extracted through for `conversationId`, or undefined. */
|
|
5621
|
+
get(conversationId: string): string | undefined;
|
|
5622
|
+
/** Persist the last-extracted message id for `conversationId`. */
|
|
5623
|
+
set(conversationId: string, messageId: string): void;
|
|
5624
|
+
}
|
|
5625
|
+
/** Minimal synchronous key/value surface — satisfied by the SDK's
|
|
5626
|
+
* `PlatformStorage` (web `localStorage`, mobile MMKV). */
|
|
5627
|
+
interface SyncKeyValueStore {
|
|
5628
|
+
getItem(key: string): string | null;
|
|
5629
|
+
setItem(key: string, value: string): void;
|
|
5630
|
+
}
|
|
5631
|
+
/**
|
|
5632
|
+
* Build an {@link ExtractionCursorStore} over a synchronous key/value store
|
|
5633
|
+
* (e.g. the SDK's `PlatformStorage`). Keys are namespaced by `keyPrefix`.
|
|
5634
|
+
* Reads/writes are guarded so a store that throws (quota, private mode) can't
|
|
5635
|
+
* break extraction — the watermark just falls back to in-memory.
|
|
5636
|
+
*
|
|
5637
|
+
* @public
|
|
5638
|
+
*/
|
|
5639
|
+
declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
|
|
5505
5640
|
interface CreateAutoExtractorOptions {
|
|
5506
5641
|
retainCtx: RetainContext;
|
|
5507
5642
|
extract: ExtractFactsOptions;
|
|
@@ -5532,6 +5667,15 @@ interface CreateAutoExtractorOptions {
|
|
|
5532
5667
|
* sessions in RAM-constrained hosts. Default 200.
|
|
5533
5668
|
*/
|
|
5534
5669
|
maxTrackedConversations?: number;
|
|
5670
|
+
/**
|
|
5671
|
+
* Durable per-conversation watermark store. When provided, the watermark is
|
|
5672
|
+
* hydrated from it the first time each conversation is touched and written
|
|
5673
|
+
* through on every advance, so extraction resumes exactly after the last
|
|
5674
|
+
* extracted message across process restarts (and, with a process-shared
|
|
5675
|
+
* store, across concurrent sessions). Build via {@link createPlatformCursorStore}.
|
|
5676
|
+
* Omit for in-memory-only (legacy) behavior.
|
|
5677
|
+
*/
|
|
5678
|
+
cursorStore?: ExtractionCursorStore;
|
|
5535
5679
|
/**
|
|
5536
5680
|
* Entity / memory_entity write context — when provided, each retained
|
|
5537
5681
|
* candidate's `entities[]` is persisted via `linkMemoryEntitiesOp`,
|
|
@@ -5607,6 +5751,24 @@ interface AutoExtractor {
|
|
|
5607
5751
|
*/
|
|
5608
5752
|
declare function createAutoExtractor(options: CreateAutoExtractorOptions): AutoExtractor;
|
|
5609
5753
|
|
|
5754
|
+
/**
|
|
5755
|
+
* Default entry cap for the chunk-vector cache. Entries are keyed by message
|
|
5756
|
+
* id, so this bounds how many messages' decrypted chunk vectors stay resident.
|
|
5757
|
+
* Matches the vault cache default (#705).
|
|
5758
|
+
*/
|
|
5759
|
+
declare const DEFAULT_CHUNK_CACHE_SIZE = 5000;
|
|
5760
|
+
/**
|
|
5761
|
+
* Create a {@link ChunkVectorCache} backed by an LRU. Pass the returned cache
|
|
5762
|
+
* into `recall()` (via `RecallContext.chunkCache`) so the chunk lane skips the
|
|
5763
|
+
* per-query decrypt + JSON.parse of every message's chunk vectors on warm
|
|
5764
|
+
* entries. Stale entries self-invalidate on `updated_at` mismatch, so no
|
|
5765
|
+
* explicit invalidation is required beyond clearing it on an encryption-key
|
|
5766
|
+
* reset (wallet switch), mirroring the vault embedding cache.
|
|
5767
|
+
*
|
|
5768
|
+
* @public
|
|
5769
|
+
*/
|
|
5770
|
+
declare function createChunkVectorCache(maxSize?: number): ChunkVectorCache;
|
|
5771
|
+
|
|
5610
5772
|
/**
|
|
5611
5773
|
* Unified Recall API — single retrieval surface above vault + engine.
|
|
5612
5774
|
*
|
|
@@ -5759,6 +5921,46 @@ interface ReflectResult {
|
|
|
5759
5921
|
*/
|
|
5760
5922
|
declare function reflect(query: string, ctx: RecallContext, options: ReflectOptions): Promise<ReflectResult>;
|
|
5761
5923
|
|
|
5924
|
+
/**
|
|
5925
|
+
* Cross-encoder reranker — local inference via @huggingface/transformers.
|
|
5926
|
+
*
|
|
5927
|
+
* Mirrors Hindsight's default reranker (`cross-encoder/ms-marco-MiniLM-L-6-v2`)
|
|
5928
|
+
* for parity with their reference pipeline. Runs fully on-device — no API
|
|
5929
|
+
* key, no network call, works offline. Model file ~25MB; lazy-loaded and
|
|
5930
|
+
* cached for the lifetime of the process.
|
|
5931
|
+
*
|
|
5932
|
+
* Implementation note: transformers.js v3 doesn't expose a "text-ranking"
|
|
5933
|
+
* pipeline, so we drive the cross-encoder directly via the tokenizer +
|
|
5934
|
+
* sequence-classification model. The model outputs a single relevance
|
|
5935
|
+
* logit per (query, doc) pair; we sigmoid it into [0, 1].
|
|
5936
|
+
*/
|
|
5937
|
+
/**
|
|
5938
|
+
* Thrown when the cross-encoder cannot run because its optional peer
|
|
5939
|
+
* dependency (`@huggingface/transformers`) isn't installed — the expected
|
|
5940
|
+
* state on React Native, where the package isn't part of the bundle. Callers
|
|
5941
|
+
* treat this as "reranker unavailable, degrade to the fused ranking" rather
|
|
5942
|
+
* than a transient error worth warning about on every recall.
|
|
5943
|
+
*
|
|
5944
|
+
* @public
|
|
5945
|
+
*/
|
|
5946
|
+
declare class RerankerUnavailableError extends Error {
|
|
5947
|
+
/** The underlying import failure, kept for debugging. */
|
|
5948
|
+
readonly reason: unknown;
|
|
5949
|
+
constructor(reason: unknown);
|
|
5950
|
+
}
|
|
5951
|
+
/**
|
|
5952
|
+
* Whether the cross-encoder reranker can run in this environment.
|
|
5953
|
+
*
|
|
5954
|
+
* - `true` — the model loaded successfully at least once.
|
|
5955
|
+
* - `false` — the optional `@huggingface/transformers` dependency is missing
|
|
5956
|
+
* (e.g. React Native); reranking is permanently degraded to the fused
|
|
5957
|
+
* ranking and no further load attempts are made.
|
|
5958
|
+
* - `undefined` — no rerank has been attempted yet, so availability is unknown.
|
|
5959
|
+
*
|
|
5960
|
+
* @public
|
|
5961
|
+
*/
|
|
5962
|
+
declare function isRerankerAvailable(): boolean | undefined;
|
|
5963
|
+
|
|
5762
5964
|
/**
|
|
5763
5965
|
* Standalone topic (entity) extraction for EXISTING memories.
|
|
5764
5966
|
*
|
|
@@ -7133,4 +7335,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
7133
7335
|
*/
|
|
7134
7336
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
7135
7337
|
|
|
7136
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, 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, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
|
7338
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, 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 CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, 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, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -4248,6 +4248,37 @@ declare function getConversationsByProjectLazyOp(ctx: StorageOperationsContext,
|
|
|
4248
4248
|
declare function upsertMessageOp(ctx: StorageOperationsContext, opts: CreateMessageOptions & {
|
|
4249
4249
|
uniqueId: string;
|
|
4250
4250
|
}): Promise<StoredMessage>;
|
|
4251
|
+
/**
|
|
4252
|
+
* Decrypted, model-native chunk vectors for one message, cached across recall
|
|
4253
|
+
* calls so the chunk lane doesn't re-decrypt + re-JSON.parse every message's
|
|
4254
|
+
* embeddings on every query. Keyed by message id; `version` is the message's
|
|
4255
|
+
* `updated_at` at cache time, so a re-embed (which bumps `updated_at`) misses
|
|
4256
|
+
* and repopulates. Vectors are stored Float32 — model-native precision, half
|
|
4257
|
+
* the RAM of float64 `number[]` — mirroring the vault embedding cache (#705).
|
|
4258
|
+
* Content text is deliberately NOT cached (see searchChunksOp): it isn't
|
|
4259
|
+
* needed for scoring, and keeping decrypted content out of the cache preserves
|
|
4260
|
+
* the SDK's data-at-rest posture.
|
|
4261
|
+
*/
|
|
4262
|
+
interface CachedChunkVectors {
|
|
4263
|
+
/** Message `updated_at` (ms) at cache time — the invalidation token. */
|
|
4264
|
+
version: number;
|
|
4265
|
+
/**
|
|
4266
|
+
* Per-chunk embedding vectors, index-aligned with the message's decrypted
|
|
4267
|
+
* `chunks` array (empty-vector chunks kept as zero-length placeholders so
|
|
4268
|
+
* indices stay aligned). Empty when the message has only a whole-message
|
|
4269
|
+
* `fallback` vector.
|
|
4270
|
+
*/
|
|
4271
|
+
chunks: Float32Array[];
|
|
4272
|
+
/** Whole-message vector when the message was embedded without chunking. */
|
|
4273
|
+
fallback?: Float32Array;
|
|
4274
|
+
}
|
|
4275
|
+
/**
|
|
4276
|
+
* Cache consumed by {@link searchChunksOp}, keyed by message id. A plain `Map`
|
|
4277
|
+
* (satisfied by the LRU from `createChunkVectorCache`) — mirrors
|
|
4278
|
+
* `VaultEmbeddingCache` so consumers get the same `clear()`/`delete()`
|
|
4279
|
+
* ergonomics on an encryption-key reset.
|
|
4280
|
+
*/
|
|
4281
|
+
type ChunkVectorCache = Map<string, CachedChunkVectors>;
|
|
4251
4282
|
|
|
4252
4283
|
declare const chatStorageSchema: Readonly<{
|
|
4253
4284
|
version: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
@@ -5047,6 +5078,14 @@ interface RecallOptions {
|
|
|
5047
5078
|
* resolves windows in 2026 and never overlaps stored event_time.
|
|
5048
5079
|
*/
|
|
5049
5080
|
now?: number;
|
|
5081
|
+
/**
|
|
5082
|
+
* Best-effort observability hook. Called once per `recall()` with per-lane
|
|
5083
|
+
* timings, lane counts, and soft-degradation signals — the raw material for
|
|
5084
|
+
* tuning latency/quality and for wiring recall telemetry to PostHog. Invoked
|
|
5085
|
+
* synchronously just before `recall()` returns; a throwing callback is
|
|
5086
|
+
* swallowed (diagnostics must never break retrieval). Off unless provided.
|
|
5087
|
+
*/
|
|
5088
|
+
onDiagnostics?: (diagnostics: RecallDiagnostics) => void;
|
|
5050
5089
|
/** Number of candidates fed to the cross-encoder rerank stage. Default: 30. */
|
|
5051
5090
|
rerankTopN?: number;
|
|
5052
5091
|
/** Multiplicative cross-encoder blend weight. Default: 0.1. */
|
|
@@ -5077,6 +5116,12 @@ interface RecallContext {
|
|
|
5077
5116
|
embeddingOptions: EmbeddingOptions;
|
|
5078
5117
|
/** Vault embedding LRU cache. */
|
|
5079
5118
|
vaultCache?: VaultEmbeddingCache;
|
|
5119
|
+
/**
|
|
5120
|
+
* Optional chunk-vector LRU cache. When provided, the chunk lane skips the
|
|
5121
|
+
* per-query decrypt + JSON.parse of every message's chunk vectors on warm
|
|
5122
|
+
* entries. Build via `createChunkVectorCache`. Omit for legacy behavior.
|
|
5123
|
+
*/
|
|
5124
|
+
chunkCache?: ChunkVectorCache;
|
|
5080
5125
|
/**
|
|
5081
5126
|
* Optional — when provided, recall extracts entities from the query
|
|
5082
5127
|
* and adds a graph lane to the RRF fusion (memories sharing entities
|
|
@@ -5096,6 +5141,48 @@ interface RecallResult {
|
|
|
5096
5141
|
/** Diagnostic: total memories in the vault when fact lane was queried. */
|
|
5097
5142
|
vaultSize?: number;
|
|
5098
5143
|
}
|
|
5144
|
+
/** Soft-degradation signals surfaced via {@link RecallDiagnostics.degraded}. */
|
|
5145
|
+
type RecallDegradation =
|
|
5146
|
+
/** Rerank was requested (budget mid/high) but the cross-encoder didn't run
|
|
5147
|
+
* this call — unavailable (e.g. React Native) or a transient failure. */
|
|
5148
|
+
"rerank-unavailable"
|
|
5149
|
+
/** `budget: 'high'` requested but no `decomposeOptions`, so query
|
|
5150
|
+
* decomposition was skipped and the budget downgraded to mid. */
|
|
5151
|
+
| "decompose-unavailable";
|
|
5152
|
+
/**
|
|
5153
|
+
* Per-call recall observability payload (see {@link RecallOptions.onDiagnostics}).
|
|
5154
|
+
* All timings are wall-clock milliseconds. Lane counts are post-dedupe,
|
|
5155
|
+
* pre-fusion. Intended to be forwarded to a metrics sink (e.g. PostHog).
|
|
5156
|
+
*/
|
|
5157
|
+
interface RecallDiagnostics {
|
|
5158
|
+
/** Budget actually executed (may have downgraded from the requested one). */
|
|
5159
|
+
usedBudget: Budget;
|
|
5160
|
+
/** Whether the cross-encoder actually reranked the fact lane this call. */
|
|
5161
|
+
reranked: boolean;
|
|
5162
|
+
/** Total candidates considered before truncation. */
|
|
5163
|
+
candidateCount: number;
|
|
5164
|
+
/** Total vault size when the fact lane ran (absent if it didn't). */
|
|
5165
|
+
vaultSize?: number;
|
|
5166
|
+
/** Facts the fact lane returned (post-dedupe, pre-fusion). */
|
|
5167
|
+
factCount: number;
|
|
5168
|
+
/** Chunks the chunk lane returned (post-dedupe, pre-fusion). */
|
|
5169
|
+
chunkCount: number;
|
|
5170
|
+
/** Wall-clock phase timings (ms). */
|
|
5171
|
+
timings: {
|
|
5172
|
+
/** Whole `recall()` call. */
|
|
5173
|
+
total: number;
|
|
5174
|
+
/** Parallel query-embed + graph/temporal side-lane build. */
|
|
5175
|
+
prep: number;
|
|
5176
|
+
/** Vault fact-lane search (`searchVaultMemoriesWithSize`). */
|
|
5177
|
+
factLane: number;
|
|
5178
|
+
/** Chunk-lane search (`searchChunksOp`). */
|
|
5179
|
+
chunkLane: number;
|
|
5180
|
+
/** Cross-lane RRF fusion + provenance dedup after both lanes. */
|
|
5181
|
+
fuse: number;
|
|
5182
|
+
};
|
|
5183
|
+
/** Soft-degradation signals that fired this call (empty when clean). */
|
|
5184
|
+
degraded: RecallDegradation[];
|
|
5185
|
+
}
|
|
5099
5186
|
type RetainAction = "create" | "merge" | "update" | "skip" | "suppressed";
|
|
5100
5187
|
type RetainSource = "manual" | "auto-extracted" | "capsule";
|
|
5101
5188
|
/** Why the consolidator fell back to "create" instead of a real decision. */
|
|
@@ -5446,15 +5533,32 @@ declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: Ret
|
|
|
5446
5533
|
* newest (superset) message list re-covers any superseded turn. Turns for
|
|
5447
5534
|
* different conversations queue independently and never displace each other.
|
|
5448
5535
|
*
|
|
5449
|
-
* Watermark + window: the worker keeps
|
|
5450
|
-
*
|
|
5451
|
-
*
|
|
5452
|
-
*
|
|
5453
|
-
*
|
|
5454
|
-
*
|
|
5455
|
-
*
|
|
5456
|
-
*
|
|
5457
|
-
*
|
|
5536
|
+
* Watermark + window: the worker keeps a per-conversation watermark of the
|
|
5537
|
+
* last message it extracted through. Each run sends every message *after* that
|
|
5538
|
+
* watermark (plus a small overlap for coreference, capped at `maxWindowSize`)
|
|
5539
|
+
* rather than a fixed trailing slice — so facts stated in turns that arrived
|
|
5540
|
+
* during a busy window are still examined instead of scrolling out of a last-N
|
|
5541
|
+
* window.
|
|
5542
|
+
*
|
|
5543
|
+
* Durability: the in-memory watermark alone does NOT survive process death, so
|
|
5544
|
+
* a session killed after messages accumulate but before extraction would, on
|
|
5545
|
+
* the next launch, fall back to a trailing-window guess and could skip the
|
|
5546
|
+
* un-extracted tail. Pass a {@link ExtractionCursorStore} (`cursorStore`) to
|
|
5547
|
+
* persist the watermark per conversation — it is hydrated synchronously the
|
|
5548
|
+
* first time a conversation is touched, and written through on every *contiguous*
|
|
5549
|
+
* advance (never on a trailing-slice guess, which could jump the durable cursor
|
|
5550
|
+
* past an un-extracted gap), so a later session resumes exactly after the last
|
|
5551
|
+
* extracted message. The primary guarantee is single-session resume across
|
|
5552
|
+
* process death.
|
|
5553
|
+
*
|
|
5554
|
+
* Concurrent sessions sharing one store (web `localStorage`, mobile MMKV) are
|
|
5555
|
+
* best-effort, NOT exclusive: two sessions can each hydrate the same cursor
|
|
5556
|
+
* before either advances it and briefly re-extract the same turn (retain()'s
|
|
5557
|
+
* dedup/consolidation absorbs the duplicate — wasteful, not corrupting). The
|
|
5558
|
+
* durable write is last-writer-wins with a regression guard (it won't move the
|
|
5559
|
+
* cursor backwards when the currently-stored id is ahead within the same turn's
|
|
5560
|
+
* messages), but it does not serialize writers. Omit `cursorStore` for the
|
|
5561
|
+
* legacy in-memory-only behavior.
|
|
5458
5562
|
*
|
|
5459
5563
|
* Memory Studio panel subscribes by passing `onMemoryExtracted` and/or
|
|
5460
5564
|
* `onTurnComplete` callbacks. The Studio uses `onMemoryExtracted` to
|
|
@@ -5502,6 +5606,37 @@ interface TurnCompleteEvent {
|
|
|
5502
5606
|
outcome: ExtractOutcome;
|
|
5503
5607
|
}
|
|
5504
5608
|
/** @public */
|
|
5609
|
+
/**
|
|
5610
|
+
* Durable per-conversation extraction cursor. Synchronous by contract (both
|
|
5611
|
+
* SDK platform stores — web `localStorage`, mobile MMKV — are sync), so the
|
|
5612
|
+
* worker can hydrate the watermark inline without changing its fire-and-forget
|
|
5613
|
+
* control flow. Implementations should be best-effort; the worker guards every
|
|
5614
|
+
* call, so a throwing store degrades to in-memory-only rather than breaking
|
|
5615
|
+
* extraction.
|
|
5616
|
+
*
|
|
5617
|
+
* @public
|
|
5618
|
+
*/
|
|
5619
|
+
interface ExtractionCursorStore {
|
|
5620
|
+
/** Last message id extracted through for `conversationId`, or undefined. */
|
|
5621
|
+
get(conversationId: string): string | undefined;
|
|
5622
|
+
/** Persist the last-extracted message id for `conversationId`. */
|
|
5623
|
+
set(conversationId: string, messageId: string): void;
|
|
5624
|
+
}
|
|
5625
|
+
/** Minimal synchronous key/value surface — satisfied by the SDK's
|
|
5626
|
+
* `PlatformStorage` (web `localStorage`, mobile MMKV). */
|
|
5627
|
+
interface SyncKeyValueStore {
|
|
5628
|
+
getItem(key: string): string | null;
|
|
5629
|
+
setItem(key: string, value: string): void;
|
|
5630
|
+
}
|
|
5631
|
+
/**
|
|
5632
|
+
* Build an {@link ExtractionCursorStore} over a synchronous key/value store
|
|
5633
|
+
* (e.g. the SDK's `PlatformStorage`). Keys are namespaced by `keyPrefix`.
|
|
5634
|
+
* Reads/writes are guarded so a store that throws (quota, private mode) can't
|
|
5635
|
+
* break extraction — the watermark just falls back to in-memory.
|
|
5636
|
+
*
|
|
5637
|
+
* @public
|
|
5638
|
+
*/
|
|
5639
|
+
declare function createPlatformCursorStore(storage: SyncKeyValueStore, keyPrefix?: string): ExtractionCursorStore;
|
|
5505
5640
|
interface CreateAutoExtractorOptions {
|
|
5506
5641
|
retainCtx: RetainContext;
|
|
5507
5642
|
extract: ExtractFactsOptions;
|
|
@@ -5532,6 +5667,15 @@ interface CreateAutoExtractorOptions {
|
|
|
5532
5667
|
* sessions in RAM-constrained hosts. Default 200.
|
|
5533
5668
|
*/
|
|
5534
5669
|
maxTrackedConversations?: number;
|
|
5670
|
+
/**
|
|
5671
|
+
* Durable per-conversation watermark store. When provided, the watermark is
|
|
5672
|
+
* hydrated from it the first time each conversation is touched and written
|
|
5673
|
+
* through on every advance, so extraction resumes exactly after the last
|
|
5674
|
+
* extracted message across process restarts (and, with a process-shared
|
|
5675
|
+
* store, across concurrent sessions). Build via {@link createPlatformCursorStore}.
|
|
5676
|
+
* Omit for in-memory-only (legacy) behavior.
|
|
5677
|
+
*/
|
|
5678
|
+
cursorStore?: ExtractionCursorStore;
|
|
5535
5679
|
/**
|
|
5536
5680
|
* Entity / memory_entity write context — when provided, each retained
|
|
5537
5681
|
* candidate's `entities[]` is persisted via `linkMemoryEntitiesOp`,
|
|
@@ -5607,6 +5751,24 @@ interface AutoExtractor {
|
|
|
5607
5751
|
*/
|
|
5608
5752
|
declare function createAutoExtractor(options: CreateAutoExtractorOptions): AutoExtractor;
|
|
5609
5753
|
|
|
5754
|
+
/**
|
|
5755
|
+
* Default entry cap for the chunk-vector cache. Entries are keyed by message
|
|
5756
|
+
* id, so this bounds how many messages' decrypted chunk vectors stay resident.
|
|
5757
|
+
* Matches the vault cache default (#705).
|
|
5758
|
+
*/
|
|
5759
|
+
declare const DEFAULT_CHUNK_CACHE_SIZE = 5000;
|
|
5760
|
+
/**
|
|
5761
|
+
* Create a {@link ChunkVectorCache} backed by an LRU. Pass the returned cache
|
|
5762
|
+
* into `recall()` (via `RecallContext.chunkCache`) so the chunk lane skips the
|
|
5763
|
+
* per-query decrypt + JSON.parse of every message's chunk vectors on warm
|
|
5764
|
+
* entries. Stale entries self-invalidate on `updated_at` mismatch, so no
|
|
5765
|
+
* explicit invalidation is required beyond clearing it on an encryption-key
|
|
5766
|
+
* reset (wallet switch), mirroring the vault embedding cache.
|
|
5767
|
+
*
|
|
5768
|
+
* @public
|
|
5769
|
+
*/
|
|
5770
|
+
declare function createChunkVectorCache(maxSize?: number): ChunkVectorCache;
|
|
5771
|
+
|
|
5610
5772
|
/**
|
|
5611
5773
|
* Unified Recall API — single retrieval surface above vault + engine.
|
|
5612
5774
|
*
|
|
@@ -5759,6 +5921,46 @@ interface ReflectResult {
|
|
|
5759
5921
|
*/
|
|
5760
5922
|
declare function reflect(query: string, ctx: RecallContext, options: ReflectOptions): Promise<ReflectResult>;
|
|
5761
5923
|
|
|
5924
|
+
/**
|
|
5925
|
+
* Cross-encoder reranker — local inference via @huggingface/transformers.
|
|
5926
|
+
*
|
|
5927
|
+
* Mirrors Hindsight's default reranker (`cross-encoder/ms-marco-MiniLM-L-6-v2`)
|
|
5928
|
+
* for parity with their reference pipeline. Runs fully on-device — no API
|
|
5929
|
+
* key, no network call, works offline. Model file ~25MB; lazy-loaded and
|
|
5930
|
+
* cached for the lifetime of the process.
|
|
5931
|
+
*
|
|
5932
|
+
* Implementation note: transformers.js v3 doesn't expose a "text-ranking"
|
|
5933
|
+
* pipeline, so we drive the cross-encoder directly via the tokenizer +
|
|
5934
|
+
* sequence-classification model. The model outputs a single relevance
|
|
5935
|
+
* logit per (query, doc) pair; we sigmoid it into [0, 1].
|
|
5936
|
+
*/
|
|
5937
|
+
/**
|
|
5938
|
+
* Thrown when the cross-encoder cannot run because its optional peer
|
|
5939
|
+
* dependency (`@huggingface/transformers`) isn't installed — the expected
|
|
5940
|
+
* state on React Native, where the package isn't part of the bundle. Callers
|
|
5941
|
+
* treat this as "reranker unavailable, degrade to the fused ranking" rather
|
|
5942
|
+
* than a transient error worth warning about on every recall.
|
|
5943
|
+
*
|
|
5944
|
+
* @public
|
|
5945
|
+
*/
|
|
5946
|
+
declare class RerankerUnavailableError extends Error {
|
|
5947
|
+
/** The underlying import failure, kept for debugging. */
|
|
5948
|
+
readonly reason: unknown;
|
|
5949
|
+
constructor(reason: unknown);
|
|
5950
|
+
}
|
|
5951
|
+
/**
|
|
5952
|
+
* Whether the cross-encoder reranker can run in this environment.
|
|
5953
|
+
*
|
|
5954
|
+
* - `true` — the model loaded successfully at least once.
|
|
5955
|
+
* - `false` — the optional `@huggingface/transformers` dependency is missing
|
|
5956
|
+
* (e.g. React Native); reranking is permanently degraded to the fused
|
|
5957
|
+
* ranking and no further load attempts are made.
|
|
5958
|
+
* - `undefined` — no rerank has been attempted yet, so availability is unknown.
|
|
5959
|
+
*
|
|
5960
|
+
* @public
|
|
5961
|
+
*/
|
|
5962
|
+
declare function isRerankerAvailable(): boolean | undefined;
|
|
5963
|
+
|
|
5762
5964
|
/**
|
|
5763
5965
|
* Standalone topic (entity) extraction for EXISTING memories.
|
|
5764
5966
|
*
|
|
@@ -7133,4 +7335,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
7133
7335
|
*/
|
|
7134
7336
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
7135
7337
|
|
|
7136
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, 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, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
|
7338
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, 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 CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, 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, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|