@anuma/sdk 3.9.6 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/expo/{chunk-FFB4CDPC.mjs → chunk-7CTI3XR6.mjs} +73 -2
- package/dist/expo/{chunk-BOY27A2C.mjs → chunk-ILAWDQDE.mjs} +24 -0
- package/dist/expo/{consolidate-NC5DOC5J.mjs → consolidate-HYIEFPFA.mjs} +1 -1
- package/dist/expo/index.cjs +161 -15
- package/dist/expo/index.d.mts +88 -2
- package/dist/expo/index.d.ts +88 -2
- package/dist/expo/index.mjs +69 -17
- package/dist/{react/recall-ELUJPQQB.mjs → expo/recall-IBGUFY4P.mjs} +2 -2
- package/dist/react/{chunk-BOY27A2C.mjs → chunk-ILAWDQDE.mjs} +24 -0
- package/dist/react/{chunk-YGCJX5YW.mjs → chunk-LAFUCS4U.mjs} +73 -2
- package/dist/react/{consolidate-54UWIMP6.mjs → consolidate-DOY3ZWTE.mjs} +1 -1
- package/dist/react/index.cjs +161 -15
- package/dist/react/index.d.mts +88 -2
- package/dist/react/index.d.ts +88 -2
- package/dist/react/index.mjs +69 -17
- package/dist/{expo/recall-JA6SOQRR.mjs → react/recall-Q5V5DN4L.mjs} +2 -2
- package/dist/server/{chunk-FXS3EUKX.mjs → chunk-NCKDSZPQ.mjs} +73 -2
- package/dist/server/{chunk-MIXEASUP.mjs → chunk-OBDRKQQI.mjs} +24 -0
- package/dist/server/{consolidate-YCD45CXO.mjs → consolidate-JMGL3MXG.mjs} +1 -1
- package/dist/server/index.cjs +161 -15
- package/dist/server/index.d.mts +88 -2
- package/dist/server/index.d.ts +88 -2
- package/dist/server/index.mjs +69 -17
- package/dist/server/{recall-VZO4USXK.mjs → recall-AN7HBEFS.mjs} +2 -2
- package/package.json +3 -2
package/dist/expo/index.d.mts
CHANGED
|
@@ -4484,6 +4484,15 @@ declare class VaultMemory extends Model {
|
|
|
4484
4484
|
archivedAt: number | null;
|
|
4485
4485
|
/** Tier-0 security (PR3) — "quarantined" | "trusted" | null. */
|
|
4486
4486
|
trustTier: string | null;
|
|
4487
|
+
/** People Nearby visibility: 'private' | 'public'. Null on legacy rows, and
|
|
4488
|
+
* any unrecognised value, read as 'private' — never published without opt-in. */
|
|
4489
|
+
visibility: string | null;
|
|
4490
|
+
/** Owner opted this memory into their own digital twin (twin-scoped only). */
|
|
4491
|
+
twinOptIn: boolean | null;
|
|
4492
|
+
/** Unix ms when visibility last became non-private; null while private. */
|
|
4493
|
+
publishedAt: number | null;
|
|
4494
|
+
/** Reserved coarse-geohash slot for landmark/Trail memories. */
|
|
4495
|
+
geohash: string | null;
|
|
4487
4496
|
createdAt: Date;
|
|
4488
4497
|
updatedAt: Date;
|
|
4489
4498
|
isDeleted: boolean;
|
|
@@ -5653,6 +5662,20 @@ declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: Ret
|
|
|
5653
5662
|
quarantined: QuarantinedMemoryInfo[];
|
|
5654
5663
|
}>;
|
|
5655
5664
|
|
|
5665
|
+
/**
|
|
5666
|
+
* People Nearby cross-user visibility. ORTHOGONAL to `scope` (model access):
|
|
5667
|
+
* - `private`: local-only (default; null column grandfathered as private)
|
|
5668
|
+
* - `public`: embedding + plaintext may be published (compatibility matching,
|
|
5669
|
+
* profile display, discovery answers, digital-twin prompts)
|
|
5670
|
+
*
|
|
5671
|
+
* TWO TIERS ONLY (decided 2026-07-27). An earlier design had a middle
|
|
5672
|
+
* `matchable` tier that published a memory's embedding while keeping its text
|
|
5673
|
+
* on-device; it was dropped, so a memory either never leaves the device or is
|
|
5674
|
+
* published with its content. Any unrecognised stored value — including a
|
|
5675
|
+
* `matchable` row written by a pre-release build — reads as `private`, which is
|
|
5676
|
+
* the fail-safe direction: it un-publishes rather than exposes.
|
|
5677
|
+
*/
|
|
5678
|
+
type VaultMemoryVisibility = "private" | "public";
|
|
5656
5679
|
interface StoredVaultMemory {
|
|
5657
5680
|
/** WatermelonDB internal ID */
|
|
5658
5681
|
uniqueId: string;
|
|
@@ -5711,6 +5734,15 @@ interface StoredVaultMemory {
|
|
|
5711
5734
|
archivedAt: number | null;
|
|
5712
5735
|
/** Tier-0 security (PR3) — "quarantined" | "trusted" | null. */
|
|
5713
5736
|
trustTier: string | null;
|
|
5737
|
+
/** People Nearby cross-user visibility. Null column reads as "private". */
|
|
5738
|
+
visibility: VaultMemoryVisibility;
|
|
5739
|
+
/** Owner opted this memory into their own digital twin even when otherwise
|
|
5740
|
+
* private (twin-scoped only — never indexed for matching, never displayed). */
|
|
5741
|
+
twinOptIn: boolean;
|
|
5742
|
+
/** Unix ms when visibility last became non-private; null while private. */
|
|
5743
|
+
publishedAt: number | null;
|
|
5744
|
+
/** Reserved coarse-geohash slot for landmark/Trail memories. */
|
|
5745
|
+
geohash: string | null;
|
|
5714
5746
|
createdAt: Date;
|
|
5715
5747
|
updatedAt: Date;
|
|
5716
5748
|
isDeleted: boolean;
|
|
@@ -5747,6 +5779,15 @@ interface CreateVaultMemoryOptions {
|
|
|
5747
5779
|
/** Tier-0 security (PR3) — set "quarantined" when the injection screen
|
|
5748
5780
|
* flagged this fact. Omit for the default (null/trusted). */
|
|
5749
5781
|
trustTier?: string;
|
|
5782
|
+
/** People Nearby cross-user visibility. Defaults to "private" if omitted —
|
|
5783
|
+
* creation NEVER publishes; use {@link setMemoryVisibilityOp} so the
|
|
5784
|
+
* published_at bookkeeping stays consistent. Accepted here only so bulk
|
|
5785
|
+
* restore/import paths can round-trip an existing visibility. */
|
|
5786
|
+
visibility?: VaultMemoryVisibility;
|
|
5787
|
+
/** Round-trip slot for restore/import; see {@link visibility}. */
|
|
5788
|
+
publishedAt?: number | null;
|
|
5789
|
+
/** Coarse geohash for location-tagged memory sources (landmarks/Trail). */
|
|
5790
|
+
geohash?: string;
|
|
5750
5791
|
}
|
|
5751
5792
|
interface UpdateVaultMemoryOptions {
|
|
5752
5793
|
content: string;
|
|
@@ -5869,11 +5910,35 @@ declare function getAllVaultMemoriesOp(ctx: VaultMemoryOperationsContext, option
|
|
|
5869
5910
|
* Used by a "memory history" view to render retired facts.
|
|
5870
5911
|
*/
|
|
5871
5912
|
includeSuperseded?: boolean;
|
|
5913
|
+
/**
|
|
5914
|
+
* Filter by People Nearby visibility. Legacy rows with a NULL column
|
|
5915
|
+
* count as "private". Used by the publish reconciler to fetch the
|
|
5916
|
+
* published set to diff against the server index.
|
|
5917
|
+
*/
|
|
5918
|
+
visibility?: VaultMemoryVisibility[];
|
|
5872
5919
|
}): Promise<StoredVaultMemory[]>;
|
|
5873
5920
|
declare function getAllVaultMemoryContentsOp(ctx: VaultMemoryOperationsContext, options?: {
|
|
5874
5921
|
since?: Date;
|
|
5875
5922
|
}): Promise<string[]>;
|
|
5876
5923
|
declare function updateVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string, opts: UpdateVaultMemoryOptions): Promise<StoredVaultMemory | null>;
|
|
5924
|
+
/**
|
|
5925
|
+
* Set a memory's People Nearby visibility (and optionally its twin opt-in).
|
|
5926
|
+
*
|
|
5927
|
+
* This is the ONLY sanctioned write path for `visibility` — it keeps the
|
|
5928
|
+
* `published_at` bookkeeping consistent: transitioning to `public`
|
|
5929
|
+
* stamps `published_at` (kept if already set); transitioning to `private`
|
|
5930
|
+
* clears it (revoke). The server index remains the authority for what IS
|
|
5931
|
+
* published — this records the user's intent for the reconciler to act on.
|
|
5932
|
+
*
|
|
5933
|
+
* Preserves `updated_at`: a visibility change is metadata, not a
|
|
5934
|
+
* re-observation, so it must not inflate the recency multiplier (mirrors
|
|
5935
|
+
* {@link setMemoryEntitiesOp}).
|
|
5936
|
+
*/
|
|
5937
|
+
declare function setMemoryVisibilityOp(ctx: VaultMemoryOperationsContext, id: string, opts: {
|
|
5938
|
+
visibility: VaultMemoryVisibility;
|
|
5939
|
+
/** If provided, sets the twin opt-in flag alongside the visibility. */
|
|
5940
|
+
twinOptIn?: boolean;
|
|
5941
|
+
}): Promise<StoredVaultMemory | null>;
|
|
5877
5942
|
declare function deleteVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string): Promise<boolean>;
|
|
5878
5943
|
/**
|
|
5879
5944
|
* Mark a memory as superseded by a newer one (A2 write-time supersession).
|
|
@@ -6434,6 +6499,21 @@ interface CreateAutoExtractorOptions {
|
|
|
6434
6499
|
*/
|
|
6435
6500
|
onFallback?: (reason: ConsolidationFallbackReason) => void;
|
|
6436
6501
|
};
|
|
6502
|
+
/**
|
|
6503
|
+
* Tier-0 security (PR5) — enable the optional SECOND-layer LLM injection
|
|
6504
|
+
* classifier over the candidates the deterministic screen passed as clean.
|
|
6505
|
+
* Presence is the switch, so `injectionClassifier: {}` is how a client turns
|
|
6506
|
+
* it on. Auth is NOT configured here — like `consolidate`, the call reuses
|
|
6507
|
+
* the `extract` credentials and defaults to its `baseUrl`. See
|
|
6508
|
+
* `injectionClassifier.ts` for the safety posture and the defaults.
|
|
6509
|
+
*/
|
|
6510
|
+
injectionClassifier?: {
|
|
6511
|
+
/** Portal base URL for classifier calls. Default: the `extract` options' `baseUrl`. */
|
|
6512
|
+
baseUrl?: string;
|
|
6513
|
+
model?: string;
|
|
6514
|
+
maxCandidates?: number;
|
|
6515
|
+
totalTimeoutMs?: number;
|
|
6516
|
+
};
|
|
6437
6517
|
/** Per-fact event — fires once per memory written. */
|
|
6438
6518
|
onMemoryExtracted?: (event: MemoryExtractedEvent) => void;
|
|
6439
6519
|
/**
|
|
@@ -8319,8 +8399,13 @@ declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageR
|
|
|
8319
8399
|
* backfill (null = legacy/untyped, active, un-screened — content is
|
|
8320
8400
|
* encrypted so in-migration classification is impossible; NULL = zero-risk,
|
|
8321
8401
|
* exact embedding_model precedent)
|
|
8402
|
+
* - v41: Added visibility, twin_opt_in, published_at, geohash columns to
|
|
8403
|
+
* memory_vault for the People Nearby cross-user visibility axis. Visibility
|
|
8404
|
+
* is TWO-tier (`private | public`); null — and any unrecognised value —
|
|
8405
|
+
* reads as 'private', so nothing pre-existing is ever published without an
|
|
8406
|
+
* explicit visibility write
|
|
8322
8407
|
*/
|
|
8323
|
-
declare const SDK_SCHEMA_VERSION =
|
|
8408
|
+
declare const SDK_SCHEMA_VERSION = 41;
|
|
8324
8409
|
/**
|
|
8325
8410
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
8326
8411
|
*
|
|
@@ -8405,6 +8490,7 @@ declare const sdkSchema: Readonly<{
|
|
|
8405
8490
|
* - v37 → v38: Added `topics_extracted_version` column to memory_vault (extraction-logic version; null read as 0 so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows)
|
|
8406
8491
|
* - v38 → v39: Added `last_observed_at` column to memory_vault (C3 re-observation watermark; stamped on retain merge, distinct from updated_at)
|
|
8407
8492
|
* - v39 → v40: Added `fact_type`, `archived_at`, `trust_tier` columns to memory_vault for typed memory + decay + Tier-0 security (all nullable + plaintext, NULL backfill)
|
|
8493
|
+
* - v40 → v41: Added `visibility`, `twin_opt_in`, `published_at`, `geohash` columns to memory_vault for the People Nearby cross-user visibility axis (two-tier `private | public`; null/unknown grandfathered as 'private')
|
|
8408
8494
|
*/
|
|
8409
8495
|
declare const sdkMigrations: Readonly<{
|
|
8410
8496
|
validated: true;
|
|
@@ -8926,4 +9012,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
8926
9012
|
*/
|
|
8927
9013
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
8928
9014
|
|
|
8929
|
-
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 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, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, 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 PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, 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, 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, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, 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, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, 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, 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, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hardDeleteDecayedOp, hasEncryptionKey, injectionSignatureCatalog, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
|
9015
|
+
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 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, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, 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 PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, 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, 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, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, 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, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, 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, 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, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hardDeleteDecayedOp, hasEncryptionKey, injectionSignatureCatalog, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -4484,6 +4484,15 @@ declare class VaultMemory extends Model {
|
|
|
4484
4484
|
archivedAt: number | null;
|
|
4485
4485
|
/** Tier-0 security (PR3) — "quarantined" | "trusted" | null. */
|
|
4486
4486
|
trustTier: string | null;
|
|
4487
|
+
/** People Nearby visibility: 'private' | 'public'. Null on legacy rows, and
|
|
4488
|
+
* any unrecognised value, read as 'private' — never published without opt-in. */
|
|
4489
|
+
visibility: string | null;
|
|
4490
|
+
/** Owner opted this memory into their own digital twin (twin-scoped only). */
|
|
4491
|
+
twinOptIn: boolean | null;
|
|
4492
|
+
/** Unix ms when visibility last became non-private; null while private. */
|
|
4493
|
+
publishedAt: number | null;
|
|
4494
|
+
/** Reserved coarse-geohash slot for landmark/Trail memories. */
|
|
4495
|
+
geohash: string | null;
|
|
4487
4496
|
createdAt: Date;
|
|
4488
4497
|
updatedAt: Date;
|
|
4489
4498
|
isDeleted: boolean;
|
|
@@ -5653,6 +5662,20 @@ declare function extractAndRetain(messages: AutoExtractMessage[], retainCtx: Ret
|
|
|
5653
5662
|
quarantined: QuarantinedMemoryInfo[];
|
|
5654
5663
|
}>;
|
|
5655
5664
|
|
|
5665
|
+
/**
|
|
5666
|
+
* People Nearby cross-user visibility. ORTHOGONAL to `scope` (model access):
|
|
5667
|
+
* - `private`: local-only (default; null column grandfathered as private)
|
|
5668
|
+
* - `public`: embedding + plaintext may be published (compatibility matching,
|
|
5669
|
+
* profile display, discovery answers, digital-twin prompts)
|
|
5670
|
+
*
|
|
5671
|
+
* TWO TIERS ONLY (decided 2026-07-27). An earlier design had a middle
|
|
5672
|
+
* `matchable` tier that published a memory's embedding while keeping its text
|
|
5673
|
+
* on-device; it was dropped, so a memory either never leaves the device or is
|
|
5674
|
+
* published with its content. Any unrecognised stored value — including a
|
|
5675
|
+
* `matchable` row written by a pre-release build — reads as `private`, which is
|
|
5676
|
+
* the fail-safe direction: it un-publishes rather than exposes.
|
|
5677
|
+
*/
|
|
5678
|
+
type VaultMemoryVisibility = "private" | "public";
|
|
5656
5679
|
interface StoredVaultMemory {
|
|
5657
5680
|
/** WatermelonDB internal ID */
|
|
5658
5681
|
uniqueId: string;
|
|
@@ -5711,6 +5734,15 @@ interface StoredVaultMemory {
|
|
|
5711
5734
|
archivedAt: number | null;
|
|
5712
5735
|
/** Tier-0 security (PR3) — "quarantined" | "trusted" | null. */
|
|
5713
5736
|
trustTier: string | null;
|
|
5737
|
+
/** People Nearby cross-user visibility. Null column reads as "private". */
|
|
5738
|
+
visibility: VaultMemoryVisibility;
|
|
5739
|
+
/** Owner opted this memory into their own digital twin even when otherwise
|
|
5740
|
+
* private (twin-scoped only — never indexed for matching, never displayed). */
|
|
5741
|
+
twinOptIn: boolean;
|
|
5742
|
+
/** Unix ms when visibility last became non-private; null while private. */
|
|
5743
|
+
publishedAt: number | null;
|
|
5744
|
+
/** Reserved coarse-geohash slot for landmark/Trail memories. */
|
|
5745
|
+
geohash: string | null;
|
|
5714
5746
|
createdAt: Date;
|
|
5715
5747
|
updatedAt: Date;
|
|
5716
5748
|
isDeleted: boolean;
|
|
@@ -5747,6 +5779,15 @@ interface CreateVaultMemoryOptions {
|
|
|
5747
5779
|
/** Tier-0 security (PR3) — set "quarantined" when the injection screen
|
|
5748
5780
|
* flagged this fact. Omit for the default (null/trusted). */
|
|
5749
5781
|
trustTier?: string;
|
|
5782
|
+
/** People Nearby cross-user visibility. Defaults to "private" if omitted —
|
|
5783
|
+
* creation NEVER publishes; use {@link setMemoryVisibilityOp} so the
|
|
5784
|
+
* published_at bookkeeping stays consistent. Accepted here only so bulk
|
|
5785
|
+
* restore/import paths can round-trip an existing visibility. */
|
|
5786
|
+
visibility?: VaultMemoryVisibility;
|
|
5787
|
+
/** Round-trip slot for restore/import; see {@link visibility}. */
|
|
5788
|
+
publishedAt?: number | null;
|
|
5789
|
+
/** Coarse geohash for location-tagged memory sources (landmarks/Trail). */
|
|
5790
|
+
geohash?: string;
|
|
5750
5791
|
}
|
|
5751
5792
|
interface UpdateVaultMemoryOptions {
|
|
5752
5793
|
content: string;
|
|
@@ -5869,11 +5910,35 @@ declare function getAllVaultMemoriesOp(ctx: VaultMemoryOperationsContext, option
|
|
|
5869
5910
|
* Used by a "memory history" view to render retired facts.
|
|
5870
5911
|
*/
|
|
5871
5912
|
includeSuperseded?: boolean;
|
|
5913
|
+
/**
|
|
5914
|
+
* Filter by People Nearby visibility. Legacy rows with a NULL column
|
|
5915
|
+
* count as "private". Used by the publish reconciler to fetch the
|
|
5916
|
+
* published set to diff against the server index.
|
|
5917
|
+
*/
|
|
5918
|
+
visibility?: VaultMemoryVisibility[];
|
|
5872
5919
|
}): Promise<StoredVaultMemory[]>;
|
|
5873
5920
|
declare function getAllVaultMemoryContentsOp(ctx: VaultMemoryOperationsContext, options?: {
|
|
5874
5921
|
since?: Date;
|
|
5875
5922
|
}): Promise<string[]>;
|
|
5876
5923
|
declare function updateVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string, opts: UpdateVaultMemoryOptions): Promise<StoredVaultMemory | null>;
|
|
5924
|
+
/**
|
|
5925
|
+
* Set a memory's People Nearby visibility (and optionally its twin opt-in).
|
|
5926
|
+
*
|
|
5927
|
+
* This is the ONLY sanctioned write path for `visibility` — it keeps the
|
|
5928
|
+
* `published_at` bookkeeping consistent: transitioning to `public`
|
|
5929
|
+
* stamps `published_at` (kept if already set); transitioning to `private`
|
|
5930
|
+
* clears it (revoke). The server index remains the authority for what IS
|
|
5931
|
+
* published — this records the user's intent for the reconciler to act on.
|
|
5932
|
+
*
|
|
5933
|
+
* Preserves `updated_at`: a visibility change is metadata, not a
|
|
5934
|
+
* re-observation, so it must not inflate the recency multiplier (mirrors
|
|
5935
|
+
* {@link setMemoryEntitiesOp}).
|
|
5936
|
+
*/
|
|
5937
|
+
declare function setMemoryVisibilityOp(ctx: VaultMemoryOperationsContext, id: string, opts: {
|
|
5938
|
+
visibility: VaultMemoryVisibility;
|
|
5939
|
+
/** If provided, sets the twin opt-in flag alongside the visibility. */
|
|
5940
|
+
twinOptIn?: boolean;
|
|
5941
|
+
}): Promise<StoredVaultMemory | null>;
|
|
5877
5942
|
declare function deleteVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string): Promise<boolean>;
|
|
5878
5943
|
/**
|
|
5879
5944
|
* Mark a memory as superseded by a newer one (A2 write-time supersession).
|
|
@@ -6434,6 +6499,21 @@ interface CreateAutoExtractorOptions {
|
|
|
6434
6499
|
*/
|
|
6435
6500
|
onFallback?: (reason: ConsolidationFallbackReason) => void;
|
|
6436
6501
|
};
|
|
6502
|
+
/**
|
|
6503
|
+
* Tier-0 security (PR5) — enable the optional SECOND-layer LLM injection
|
|
6504
|
+
* classifier over the candidates the deterministic screen passed as clean.
|
|
6505
|
+
* Presence is the switch, so `injectionClassifier: {}` is how a client turns
|
|
6506
|
+
* it on. Auth is NOT configured here — like `consolidate`, the call reuses
|
|
6507
|
+
* the `extract` credentials and defaults to its `baseUrl`. See
|
|
6508
|
+
* `injectionClassifier.ts` for the safety posture and the defaults.
|
|
6509
|
+
*/
|
|
6510
|
+
injectionClassifier?: {
|
|
6511
|
+
/** Portal base URL for classifier calls. Default: the `extract` options' `baseUrl`. */
|
|
6512
|
+
baseUrl?: string;
|
|
6513
|
+
model?: string;
|
|
6514
|
+
maxCandidates?: number;
|
|
6515
|
+
totalTimeoutMs?: number;
|
|
6516
|
+
};
|
|
6437
6517
|
/** Per-fact event — fires once per memory written. */
|
|
6438
6518
|
onMemoryExtracted?: (event: MemoryExtractedEvent) => void;
|
|
6439
6519
|
/**
|
|
@@ -8319,8 +8399,13 @@ declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageR
|
|
|
8319
8399
|
* backfill (null = legacy/untyped, active, un-screened — content is
|
|
8320
8400
|
* encrypted so in-migration classification is impossible; NULL = zero-risk,
|
|
8321
8401
|
* exact embedding_model precedent)
|
|
8402
|
+
* - v41: Added visibility, twin_opt_in, published_at, geohash columns to
|
|
8403
|
+
* memory_vault for the People Nearby cross-user visibility axis. Visibility
|
|
8404
|
+
* is TWO-tier (`private | public`); null — and any unrecognised value —
|
|
8405
|
+
* reads as 'private', so nothing pre-existing is ever published without an
|
|
8406
|
+
* explicit visibility write
|
|
8322
8407
|
*/
|
|
8323
|
-
declare const SDK_SCHEMA_VERSION =
|
|
8408
|
+
declare const SDK_SCHEMA_VERSION = 41;
|
|
8324
8409
|
/**
|
|
8325
8410
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
8326
8411
|
*
|
|
@@ -8405,6 +8490,7 @@ declare const sdkSchema: Readonly<{
|
|
|
8405
8490
|
* - v37 → v38: Added `topics_extracted_version` column to memory_vault (extraction-logic version; null read as 0 so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows)
|
|
8406
8491
|
* - v38 → v39: Added `last_observed_at` column to memory_vault (C3 re-observation watermark; stamped on retain merge, distinct from updated_at)
|
|
8407
8492
|
* - v39 → v40: Added `fact_type`, `archived_at`, `trust_tier` columns to memory_vault for typed memory + decay + Tier-0 security (all nullable + plaintext, NULL backfill)
|
|
8493
|
+
* - v40 → v41: Added `visibility`, `twin_opt_in`, `published_at`, `geohash` columns to memory_vault for the People Nearby cross-user visibility axis (two-tier `private | public`; null/unknown grandfathered as 'private')
|
|
8408
8494
|
*/
|
|
8409
8495
|
declare const sdkMigrations: Readonly<{
|
|
8410
8496
|
validated: true;
|
|
@@ -8926,4 +9012,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
8926
9012
|
*/
|
|
8927
9013
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
8928
9014
|
|
|
8929
|
-
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 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, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, 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 PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, 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, 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, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, 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, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, 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, 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, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hardDeleteDecayedOp, hasEncryptionKey, injectionSignatureCatalog, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
|
9015
|
+
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 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, 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 MemoryVaultSearchOptions, type MemoryVaultToolOptions, 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 PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, 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, 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, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, 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, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, 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, 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, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hardDeleteDecayedOp, hasEncryptionKey, injectionSignatureCatalog, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
package/dist/expo/index.mjs
CHANGED
|
@@ -94,6 +94,7 @@ import {
|
|
|
94
94
|
restoreVaultMemoryOp,
|
|
95
95
|
searchChunksOp,
|
|
96
96
|
searchVaultMemories,
|
|
97
|
+
setMemoryVisibilityOp,
|
|
97
98
|
shouldChunkMessage,
|
|
98
99
|
stampTopicsExtractedAtOp,
|
|
99
100
|
stripToolCalls,
|
|
@@ -110,7 +111,7 @@ import {
|
|
|
110
111
|
upsertMessageOp,
|
|
111
112
|
useEncryption,
|
|
112
113
|
vaultMemoryToStored
|
|
113
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-7CTI3XR6.mjs";
|
|
114
115
|
import {
|
|
115
116
|
PII_PATTERNS,
|
|
116
117
|
PiiRedactor,
|
|
@@ -128,7 +129,7 @@ import {
|
|
|
128
129
|
setLogger,
|
|
129
130
|
supportsResponseFormat,
|
|
130
131
|
validateEndpointOverride
|
|
131
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-ILAWDQDE.mjs";
|
|
132
133
|
import {
|
|
133
134
|
BASE_URL,
|
|
134
135
|
MCP_R2_DOMAIN,
|
|
@@ -5579,6 +5580,18 @@ __decorateClass([
|
|
|
5579
5580
|
__decorateClass([
|
|
5580
5581
|
field3("trust_tier")
|
|
5581
5582
|
], VaultMemory.prototype, "trustTier", 2);
|
|
5583
|
+
__decorateClass([
|
|
5584
|
+
field3("visibility")
|
|
5585
|
+
], VaultMemory.prototype, "visibility", 2);
|
|
5586
|
+
__decorateClass([
|
|
5587
|
+
field3("twin_opt_in")
|
|
5588
|
+
], VaultMemory.prototype, "twinOptIn", 2);
|
|
5589
|
+
__decorateClass([
|
|
5590
|
+
field3("published_at")
|
|
5591
|
+
], VaultMemory.prototype, "publishedAt", 2);
|
|
5592
|
+
__decorateClass([
|
|
5593
|
+
field3("geohash")
|
|
5594
|
+
], VaultMemory.prototype, "geohash", 2);
|
|
5582
5595
|
__decorateClass([
|
|
5583
5596
|
readonly2,
|
|
5584
5597
|
date3("created_at")
|
|
@@ -6598,7 +6611,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
|
|
|
6598
6611
|
content: m.content,
|
|
6599
6612
|
similarity: m.similarity
|
|
6600
6613
|
}));
|
|
6601
|
-
const { consolidateMemory: doConsolidate } = await import("./consolidate-
|
|
6614
|
+
const { consolidateMemory: doConsolidate } = await import("./consolidate-HYIEFPFA.mjs");
|
|
6602
6615
|
const decision = await doConsolidate(trimmed, candidates, consolidateOptions);
|
|
6603
6616
|
if (decision.action === "create") return null;
|
|
6604
6617
|
if (decision.action === "supersede" && decision.content) {
|
|
@@ -7170,18 +7183,16 @@ function createAutoExtractor(options) {
|
|
|
7170
7183
|
} catch {
|
|
7171
7184
|
}
|
|
7172
7185
|
};
|
|
7173
|
-
const
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
// extractAndRetain (so direct callers are covered too), not copied here.
|
|
7184
|
-
} : void 0;
|
|
7186
|
+
const subPassAuth = (baseUrlOverride) => {
|
|
7187
|
+
const baseUrl = baseUrlOverride ?? options.extract.baseUrl;
|
|
7188
|
+
return {
|
|
7189
|
+
...options.extract.apiKey !== void 0 && { apiKey: options.extract.apiKey },
|
|
7190
|
+
...options.extract.getToken !== void 0 && { getToken: options.extract.getToken },
|
|
7191
|
+
...baseUrl !== void 0 && { baseUrl }
|
|
7192
|
+
};
|
|
7193
|
+
};
|
|
7194
|
+
const consolidateOptions = options.consolidate ? { ...options.consolidate, ...subPassAuth(options.consolidate.baseUrl) } : void 0;
|
|
7195
|
+
const injectionClassifierOptions = options.injectionClassifier ? { ...options.injectionClassifier, ...subPassAuth(options.injectionClassifier.baseUrl) } : void 0;
|
|
7185
7196
|
if (options.retainCtx.vaultCtx.entityCtx && !options.entityCtx) {
|
|
7186
7197
|
getLogger().warn(
|
|
7187
7198
|
"[memory/extract] retainCtx.vaultCtx.entityCtx is set but extractor was created without `entityCtx` \u2014 W5 graph lane will receive no writes"
|
|
@@ -7235,6 +7246,9 @@ function createAutoExtractor(options) {
|
|
|
7235
7246
|
...options.scope !== void 0 && { scope: options.scope },
|
|
7236
7247
|
...options.folderId !== void 0 && { folderId: options.folderId },
|
|
7237
7248
|
...consolidateOptions !== void 0 && { consolidateOptions },
|
|
7249
|
+
...injectionClassifierOptions !== void 0 && {
|
|
7250
|
+
injectionClassifier: injectionClassifierOptions
|
|
7251
|
+
},
|
|
7238
7252
|
...options.onCandidateFailed && {
|
|
7239
7253
|
onCandidateFailed: (candidate, error) => options.onCandidateFailed?.({ candidate, error, conversationId })
|
|
7240
7254
|
},
|
|
@@ -11677,7 +11691,7 @@ __decorateClass([
|
|
|
11677
11691
|
], VaultFolder.prototype, "context", 2);
|
|
11678
11692
|
|
|
11679
11693
|
// src/lib/db/schema.ts
|
|
11680
|
-
var SDK_SCHEMA_VERSION =
|
|
11694
|
+
var SDK_SCHEMA_VERSION = 41;
|
|
11681
11695
|
var sdkSchema = appSchema2({
|
|
11682
11696
|
version: SDK_SCHEMA_VERSION,
|
|
11683
11697
|
tables: [
|
|
@@ -11836,7 +11850,26 @@ var sdkSchema = appSchema2({
|
|
|
11836
11850
|
// Tier-0 security (PR3) — "quarantined" when the write-time injection
|
|
11837
11851
|
// screen flagged this fact, else null/"trusted". Indexed so the recall
|
|
11838
11852
|
// choke point can default-exclude quarantined rows.
|
|
11839
|
-
{ name: "trust_tier", type: "string", isOptional: true, isIndexed: true }
|
|
11853
|
+
{ name: "trust_tier", type: "string", isOptional: true, isIndexed: true },
|
|
11854
|
+
// People Nearby cross-user visibility axis — ORTHOGONAL to `scope`
|
|
11855
|
+
// (which partitions by MODEL access: private vs shared providers).
|
|
11856
|
+
// TWO tiers: 'private' (or null, or any unrecognised value —
|
|
11857
|
+
// grandfathered / fail-safe) = local-only; 'public' = embedding +
|
|
11858
|
+
// plaintext may be published (matching/profile/discovery/twin).
|
|
11859
|
+
// The server index is the authority for what IS published; this
|
|
11860
|
+
// column records the user's intent.
|
|
11861
|
+
{ name: "visibility", type: "string", isOptional: true, isIndexed: true },
|
|
11862
|
+
// When true, the owner opted this memory into their own digital twin
|
|
11863
|
+
// even if it is otherwise private (twin-scoped upload only — never
|
|
11864
|
+
// indexed for matching, never displayed). Null/false = follows visibility.
|
|
11865
|
+
{ name: "twin_opt_in", type: "boolean", isOptional: true },
|
|
11866
|
+
// Unix ms when visibility last became non-private. Null when private
|
|
11867
|
+
// (cleared on revoke) — the publish reconciler uses it to diff local
|
|
11868
|
+
// intent against the server index.
|
|
11869
|
+
{ name: "published_at", type: "number", isOptional: true },
|
|
11870
|
+
// Reserved geo slot (coarse geohash) for landmark/Trail memories.
|
|
11871
|
+
// Unused at launch; populated by location-tagged memory sources.
|
|
11872
|
+
{ name: "geohash", type: "string", isOptional: true }
|
|
11840
11873
|
]
|
|
11841
11874
|
}),
|
|
11842
11875
|
// Entity table — canonical names extracted from auto-extraction (W5).
|
|
@@ -12511,6 +12544,24 @@ var sdkMigrations = schemaMigrations2({
|
|
|
12511
12544
|
]
|
|
12512
12545
|
})
|
|
12513
12546
|
]
|
|
12547
|
+
},
|
|
12548
|
+
// v40 -> v41: People Nearby visibility axis on memory_vault. Existing rows
|
|
12549
|
+
// keep visibility NULL — read as 'private' (nothing pre-existing is ever
|
|
12550
|
+
// published without an explicit user action; the consent posture requires
|
|
12551
|
+
// opt-in, never a retroactive default).
|
|
12552
|
+
{
|
|
12553
|
+
toVersion: 41,
|
|
12554
|
+
steps: [
|
|
12555
|
+
addColumns2({
|
|
12556
|
+
table: "memory_vault",
|
|
12557
|
+
columns: [
|
|
12558
|
+
{ name: "visibility", type: "string", isOptional: true, isIndexed: true },
|
|
12559
|
+
{ name: "twin_opt_in", type: "boolean", isOptional: true },
|
|
12560
|
+
{ name: "published_at", type: "number", isOptional: true },
|
|
12561
|
+
{ name: "geohash", type: "string", isOptional: true }
|
|
12562
|
+
]
|
|
12563
|
+
})
|
|
12564
|
+
]
|
|
12514
12565
|
}
|
|
12515
12566
|
]
|
|
12516
12567
|
});
|
|
@@ -14000,6 +14051,7 @@ export {
|
|
|
14000
14051
|
sdkSchema,
|
|
14001
14052
|
searchVaultMemories,
|
|
14002
14053
|
setLogger,
|
|
14054
|
+
setMemoryVisibilityOp,
|
|
14003
14055
|
shouldChunkMessage,
|
|
14004
14056
|
stampTopicsExtractedAtOp,
|
|
14005
14057
|
streamCancelPath,
|
|
@@ -196,6 +196,7 @@ async function attemptPortalJson(req, endpoint) {
|
|
|
196
196
|
return { kind: "retryable", reason: `response body parse failed: ${err.message}` };
|
|
197
197
|
}
|
|
198
198
|
clearTimeout(timer);
|
|
199
|
+
logPortalUsage(body, req.tag);
|
|
199
200
|
const rawContent = extractCompletionContent(body);
|
|
200
201
|
if (!rawContent) {
|
|
201
202
|
return { kind: "retryable", reason: "portal response had no completion content" };
|
|
@@ -251,6 +252,29 @@ function extractJsonCandidate(raw) {
|
|
|
251
252
|
}
|
|
252
253
|
return body;
|
|
253
254
|
}
|
|
255
|
+
function asRecord(value) {
|
|
256
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
257
|
+
}
|
|
258
|
+
function asCount(value) {
|
|
259
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
260
|
+
}
|
|
261
|
+
function logPortalUsage(body, tag) {
|
|
262
|
+
try {
|
|
263
|
+
const root = asRecord(body);
|
|
264
|
+
if (!root) return;
|
|
265
|
+
const usage = asRecord(root.usage);
|
|
266
|
+
const promptTokens = asCount(usage?.prompt_tokens);
|
|
267
|
+
const completionTokens = asCount(usage?.completion_tokens);
|
|
268
|
+
if (promptTokens === void 0 && completionTokens === void 0) return;
|
|
269
|
+
const cachedTokens = asCount(asRecord(root.portal)?.cached_tokens) ?? asCount(asRecord(usage?.prompt_tokens_details)?.cached_tokens) ?? 0;
|
|
270
|
+
const parts = [];
|
|
271
|
+
if (promptTokens !== void 0) parts.push(`prompt=${promptTokens}`);
|
|
272
|
+
if (completionTokens !== void 0) parts.push(`completion=${completionTokens}`);
|
|
273
|
+
parts.push(`cached=${cachedTokens}`);
|
|
274
|
+
getLogger().debug(`[${tag}] usage ${parts.join(" ")}`);
|
|
275
|
+
} catch {
|
|
276
|
+
}
|
|
277
|
+
}
|
|
254
278
|
function extractCompletionContent(body) {
|
|
255
279
|
if (typeof body !== "object" || body === null) return null;
|
|
256
280
|
const choices = body.choices;
|