@anuma/sdk 6.9.0 → 6.10.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.
@@ -9595,6 +9595,7 @@ __export(index_exports, {
9595
9595
  hasEncryptionKey: () => hasEncryptionKey,
9596
9596
  ingestPublishedPhotoMemoriesOp: () => ingestPublishedPhotoMemoriesOp,
9597
9597
  injectionSignatureCatalog: () => injectionSignatureCatalog,
9598
+ isDegradedTopicSkip: () => isDegradedTopicSkip,
9598
9599
  isPiiRedactor: () => isPiiRedactor,
9599
9600
  isRerankerAvailable: () => isRerankerAvailable,
9600
9601
  moveMemoriesToFolderOp: () => moveMemoriesToFolderOp,
@@ -18463,6 +18464,18 @@ function parseTopicResponse(parsed, validIds) {
18463
18464
  }
18464
18465
  return out;
18465
18466
  }
18467
+ var DEGRADED_TOPIC_SKIP = {
18468
+ excluded: false,
18469
+ "link-declined": false,
18470
+ "stamp-declined": false,
18471
+ "llm-unanswered": true,
18472
+ unreadable: true,
18473
+ "not-found": true,
18474
+ "link-failed": true
18475
+ };
18476
+ function isDegradedTopicSkip(reason) {
18477
+ return DEGRADED_TOPIC_SKIP[reason] === true;
18478
+ }
18466
18479
  async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
18467
18480
  const entityCtx = ctx.entityCtx;
18468
18481
  if (!entityCtx) {
@@ -18471,17 +18484,24 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
18471
18484
  const log = getLogger();
18472
18485
  const extractedAt = options.now ?? Date.now();
18473
18486
  const skippedIds = [];
18487
+ const skippedReasons = /* @__PURE__ */ new Map();
18488
+ const skip = (id, reason) => {
18489
+ if (skippedReasons.has(id)) return;
18490
+ skippedIds.push(id);
18491
+ skippedReasons.set(id, reason);
18492
+ };
18474
18493
  const inputs = [];
18475
- for (const id of memoryIds) {
18494
+ for (const id of new Set(memoryIds)) {
18476
18495
  let record;
18477
18496
  try {
18478
18497
  record = await ctx.vaultMemoryCollection.find(id);
18479
- } catch {
18480
- skippedIds.push(id);
18498
+ } catch (err) {
18499
+ log.warn("[memory/topics] vault lookup failed for extraction", err);
18500
+ skip(id, "not-found");
18481
18501
  continue;
18482
18502
  }
18483
18503
  if (record.isDeleted || ctx.userId !== void 0 && record.userId !== ctx.userId || record.topicsUserManaged) {
18484
- skippedIds.push(id);
18504
+ skip(id, "excluded");
18485
18505
  continue;
18486
18506
  }
18487
18507
  try {
@@ -18494,7 +18514,7 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
18494
18514
  inputs.push({ id, content: stored.content });
18495
18515
  } catch (err) {
18496
18516
  log.warn("[memory/topics] failed to load memory for extraction", err);
18497
- skippedIds.push(id);
18517
+ skip(id, "unreadable");
18498
18518
  }
18499
18519
  }
18500
18520
  const entitiesByMemory = await extractEntitiesForMemories(inputs, options);
@@ -18502,19 +18522,19 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
18502
18522
  for (const input of inputs) {
18503
18523
  const entities = entitiesByMemory.get(input.id);
18504
18524
  if (entities === void 0) {
18505
- skippedIds.push(input.id);
18525
+ skip(input.id, "llm-unanswered");
18506
18526
  continue;
18507
18527
  }
18508
18528
  try {
18509
18529
  const linked = await replaceMemoryEntitiesGuardedOp(entityCtx, input.id, entities);
18510
18530
  if (linked === null) {
18511
- skippedIds.push(input.id);
18531
+ skip(input.id, "link-declined");
18512
18532
  entitiesByMemory.delete(input.id);
18513
18533
  continue;
18514
18534
  }
18515
18535
  } catch (err) {
18516
18536
  log.warn("[memory/topics] replaceMemoryEntitiesGuardedOp failed", err);
18517
- skippedIds.push(input.id);
18537
+ skip(input.id, "link-failed");
18518
18538
  entitiesByMemory.delete(input.id);
18519
18539
  continue;
18520
18540
  }
@@ -18524,11 +18544,11 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
18524
18544
  const stampedSet = new Set(stampedIds);
18525
18545
  for (const id of toStamp) {
18526
18546
  if (!stampedSet.has(id)) {
18527
- skippedIds.push(id);
18547
+ skip(id, "stamp-declined");
18528
18548
  entitiesByMemory.delete(id);
18529
18549
  }
18530
18550
  }
18531
- return { entitiesByMemory, stampedIds, skippedIds };
18551
+ return { entitiesByMemory, stampedIds, skippedIds, skippedReasons };
18532
18552
  }
18533
18553
 
18534
18554
  // src/lib/memory/verifySupport.ts
@@ -24560,6 +24580,7 @@ function createNotionTools(getAccessToken, requestNotionAccess) {
24560
24580
  hasEncryptionKey,
24561
24581
  ingestPublishedPhotoMemoriesOp,
24562
24582
  injectionSignatureCatalog,
24583
+ isDegradedTopicSkip,
24563
24584
  isPiiRedactor,
24564
24585
  isRerankerAvailable,
24565
24586
  moveMemoriesToFolderOp,
@@ -8519,6 +8519,39 @@ interface TopicExtractOptions extends PortalLlmAuth {
8519
8519
  * later sweep, never stamp them.
8520
8520
  */
8521
8521
  declare function extractEntitiesForMemories(memories: readonly TopicExtractionInput[], options: TopicExtractOptions): Promise<Map<string, ExtractedEntity[]>>;
8522
+ /**
8523
+ * Why one memory was skipped by a topic sweep.
8524
+ *
8525
+ * Split along the line that actually matters operationally — did the sweep
8526
+ * DECLINE this row on purpose, or did something BREAK:
8527
+ *
8528
+ * Deliberate (healthy; a sweep of nothing but these is a success):
8529
+ * - `excluded` — deleted, owned by another user, or `topicsUserManaged`.
8530
+ * - `link-declined` — the entity-link write's in-row guard declined (the row
8531
+ * became user-managed / deleted / absent mid-run).
8532
+ * - `stamp-declined` — same, caught by the stamp op's own re-check.
8533
+ *
8534
+ * Degraded (something is wrong; see {@link isDegradedTopicSkip}):
8535
+ * - `llm-unanswered` — the batch failed or the model omitted this id. THE one
8536
+ * to alarm on: it is how a wholly broken sweep looks.
8537
+ * - `unreadable` — the row could not be loaded/decrypted.
8538
+ * - `not-found` — the lookup threw (absent row or read fault).
8539
+ * - `link-failed` — the entity-link write threw.
8540
+ *
8541
+ * @public
8542
+ */
8543
+ type TopicSkipReason = "excluded" | "link-declined" | "stamp-declined" | "llm-unanswered" | "unreadable" | "not-found" | "link-failed";
8544
+ /**
8545
+ * Whether a skip reason means the sweep FAILED on that row, rather than
8546
+ * deliberately passing over it.
8547
+ *
8548
+ * Exported so callers classify identically instead of each re-deriving the
8549
+ * split — the reason this type exists is that one wrong grouping turns a broken
8550
+ * sweep back into a healthy-looking one.
8551
+ *
8552
+ * @public
8553
+ */
8554
+ declare function isDegradedTopicSkip(reason: TopicSkipReason): boolean;
8522
8555
  /** Outcome of one {@link extractAndLinkEntitiesForMemoriesOp} run. */
8523
8556
  interface TopicExtractionRunResult {
8524
8557
  /** memoryId → entities the LLM returned (post-validation, post-linking). */
@@ -8531,6 +8564,24 @@ interface TopicExtractionRunResult {
8531
8564
  * LLM batches. Skipped ids are not stamped, so failed batches are retried
8532
8565
  * by a later sweep — callers should apply their own attempt caps. */
8533
8566
  skippedIds: string[];
8567
+ /**
8568
+ * Why each id in {@link skippedIds} was skipped.
8569
+ *
8570
+ * `skippedIds` alone cannot distinguish a sweep that deliberately declined
8571
+ * work from one that FAILED: a run where every LLM batch errored and a run
8572
+ * over rows the user has taken manual control of produce an identical array.
8573
+ * That is the same blindness `outcome: 'empty-after-retry'` had before #888 —
8574
+ * a degradation wearing the shape of normal control flow.
8575
+ *
8576
+ * It matters here because topics feed the entity recall lane, so a silently
8577
+ * failing sweep means memories that exist but cannot be found by entity, with
8578
+ * nothing in production saying so.
8579
+ *
8580
+ * Populated in lockstep with `skippedIds` (single `skip()` helper), so the two
8581
+ * cannot drift. Group by {@link isDegradedTopicSkip} to separate "declined" from
8582
+ * "broke".
8583
+ */
8584
+ skippedReasons: Map<string, TopicSkipReason>;
8534
8585
  }
8535
8586
  /**
8536
8587
  * Run LLM topic extraction over existing vault memories and persist the
@@ -10377,4 +10428,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
10377
10428
  */
10378
10429
  declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
10379
10430
 
10380
- export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, backfillMemoryTopicsOp, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
10431
+ export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, backfillMemoryTopicsOp, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isDegradedTopicSkip, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
@@ -8519,6 +8519,39 @@ interface TopicExtractOptions extends PortalLlmAuth {
8519
8519
  * later sweep, never stamp them.
8520
8520
  */
8521
8521
  declare function extractEntitiesForMemories(memories: readonly TopicExtractionInput[], options: TopicExtractOptions): Promise<Map<string, ExtractedEntity[]>>;
8522
+ /**
8523
+ * Why one memory was skipped by a topic sweep.
8524
+ *
8525
+ * Split along the line that actually matters operationally — did the sweep
8526
+ * DECLINE this row on purpose, or did something BREAK:
8527
+ *
8528
+ * Deliberate (healthy; a sweep of nothing but these is a success):
8529
+ * - `excluded` — deleted, owned by another user, or `topicsUserManaged`.
8530
+ * - `link-declined` — the entity-link write's in-row guard declined (the row
8531
+ * became user-managed / deleted / absent mid-run).
8532
+ * - `stamp-declined` — same, caught by the stamp op's own re-check.
8533
+ *
8534
+ * Degraded (something is wrong; see {@link isDegradedTopicSkip}):
8535
+ * - `llm-unanswered` — the batch failed or the model omitted this id. THE one
8536
+ * to alarm on: it is how a wholly broken sweep looks.
8537
+ * - `unreadable` — the row could not be loaded/decrypted.
8538
+ * - `not-found` — the lookup threw (absent row or read fault).
8539
+ * - `link-failed` — the entity-link write threw.
8540
+ *
8541
+ * @public
8542
+ */
8543
+ type TopicSkipReason = "excluded" | "link-declined" | "stamp-declined" | "llm-unanswered" | "unreadable" | "not-found" | "link-failed";
8544
+ /**
8545
+ * Whether a skip reason means the sweep FAILED on that row, rather than
8546
+ * deliberately passing over it.
8547
+ *
8548
+ * Exported so callers classify identically instead of each re-deriving the
8549
+ * split — the reason this type exists is that one wrong grouping turns a broken
8550
+ * sweep back into a healthy-looking one.
8551
+ *
8552
+ * @public
8553
+ */
8554
+ declare function isDegradedTopicSkip(reason: TopicSkipReason): boolean;
8522
8555
  /** Outcome of one {@link extractAndLinkEntitiesForMemoriesOp} run. */
8523
8556
  interface TopicExtractionRunResult {
8524
8557
  /** memoryId → entities the LLM returned (post-validation, post-linking). */
@@ -8531,6 +8564,24 @@ interface TopicExtractionRunResult {
8531
8564
  * LLM batches. Skipped ids are not stamped, so failed batches are retried
8532
8565
  * by a later sweep — callers should apply their own attempt caps. */
8533
8566
  skippedIds: string[];
8567
+ /**
8568
+ * Why each id in {@link skippedIds} was skipped.
8569
+ *
8570
+ * `skippedIds` alone cannot distinguish a sweep that deliberately declined
8571
+ * work from one that FAILED: a run where every LLM batch errored and a run
8572
+ * over rows the user has taken manual control of produce an identical array.
8573
+ * That is the same blindness `outcome: 'empty-after-retry'` had before #888 —
8574
+ * a degradation wearing the shape of normal control flow.
8575
+ *
8576
+ * It matters here because topics feed the entity recall lane, so a silently
8577
+ * failing sweep means memories that exist but cannot be found by entity, with
8578
+ * nothing in production saying so.
8579
+ *
8580
+ * Populated in lockstep with `skippedIds` (single `skip()` helper), so the two
8581
+ * cannot drift. Group by {@link isDegradedTopicSkip} to separate "declined" from
8582
+ * "broke".
8583
+ */
8584
+ skippedReasons: Map<string, TopicSkipReason>;
8534
8585
  }
8535
8586
  /**
8536
8587
  * Run LLM topic extraction over existing vault memories and persist the
@@ -10377,4 +10428,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
10377
10428
  */
10378
10429
  declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
10379
10430
 
10380
- export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, backfillMemoryTopicsOp, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
10431
+ export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, ENTITY_FANOUT, type EmbeddedWalletSignerFn, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryToVerify, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, backfillMemoryTopicsOp, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isDegradedTopicSkip, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
@@ -8847,6 +8847,18 @@ function parseTopicResponse(parsed, validIds) {
8847
8847
  }
8848
8848
  return out;
8849
8849
  }
8850
+ var DEGRADED_TOPIC_SKIP = {
8851
+ excluded: false,
8852
+ "link-declined": false,
8853
+ "stamp-declined": false,
8854
+ "llm-unanswered": true,
8855
+ unreadable: true,
8856
+ "not-found": true,
8857
+ "link-failed": true
8858
+ };
8859
+ function isDegradedTopicSkip(reason) {
8860
+ return DEGRADED_TOPIC_SKIP[reason] === true;
8861
+ }
8850
8862
  async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
8851
8863
  const entityCtx = ctx.entityCtx;
8852
8864
  if (!entityCtx) {
@@ -8855,17 +8867,24 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
8855
8867
  const log = getLogger();
8856
8868
  const extractedAt = options.now ?? Date.now();
8857
8869
  const skippedIds = [];
8870
+ const skippedReasons = /* @__PURE__ */ new Map();
8871
+ const skip = (id, reason) => {
8872
+ if (skippedReasons.has(id)) return;
8873
+ skippedIds.push(id);
8874
+ skippedReasons.set(id, reason);
8875
+ };
8858
8876
  const inputs = [];
8859
- for (const id of memoryIds) {
8877
+ for (const id of new Set(memoryIds)) {
8860
8878
  let record;
8861
8879
  try {
8862
8880
  record = await ctx.vaultMemoryCollection.find(id);
8863
- } catch {
8864
- skippedIds.push(id);
8881
+ } catch (err) {
8882
+ log.warn("[memory/topics] vault lookup failed for extraction", err);
8883
+ skip(id, "not-found");
8865
8884
  continue;
8866
8885
  }
8867
8886
  if (record.isDeleted || ctx.userId !== void 0 && record.userId !== ctx.userId || record.topicsUserManaged) {
8868
- skippedIds.push(id);
8887
+ skip(id, "excluded");
8869
8888
  continue;
8870
8889
  }
8871
8890
  try {
@@ -8878,7 +8897,7 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
8878
8897
  inputs.push({ id, content: stored.content });
8879
8898
  } catch (err) {
8880
8899
  log.warn("[memory/topics] failed to load memory for extraction", err);
8881
- skippedIds.push(id);
8900
+ skip(id, "unreadable");
8882
8901
  }
8883
8902
  }
8884
8903
  const entitiesByMemory = await extractEntitiesForMemories(inputs, options);
@@ -8886,19 +8905,19 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
8886
8905
  for (const input of inputs) {
8887
8906
  const entities = entitiesByMemory.get(input.id);
8888
8907
  if (entities === void 0) {
8889
- skippedIds.push(input.id);
8908
+ skip(input.id, "llm-unanswered");
8890
8909
  continue;
8891
8910
  }
8892
8911
  try {
8893
8912
  const linked = await replaceMemoryEntitiesGuardedOp(entityCtx, input.id, entities);
8894
8913
  if (linked === null) {
8895
- skippedIds.push(input.id);
8914
+ skip(input.id, "link-declined");
8896
8915
  entitiesByMemory.delete(input.id);
8897
8916
  continue;
8898
8917
  }
8899
8918
  } catch (err) {
8900
8919
  log.warn("[memory/topics] replaceMemoryEntitiesGuardedOp failed", err);
8901
- skippedIds.push(input.id);
8920
+ skip(input.id, "link-failed");
8902
8921
  entitiesByMemory.delete(input.id);
8903
8922
  continue;
8904
8923
  }
@@ -8908,11 +8927,11 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
8908
8927
  const stampedSet = new Set(stampedIds);
8909
8928
  for (const id of toStamp) {
8910
8929
  if (!stampedSet.has(id)) {
8911
- skippedIds.push(id);
8930
+ skip(id, "stamp-declined");
8912
8931
  entitiesByMemory.delete(id);
8913
8932
  }
8914
8933
  }
8915
- return { entitiesByMemory, stampedIds, skippedIds };
8934
+ return { entitiesByMemory, stampedIds, skippedIds, skippedReasons };
8916
8935
  }
8917
8936
 
8918
8937
  // src/lib/memory/verifySupport.ts
@@ -14902,6 +14921,7 @@ export {
14902
14921
  hasEncryptionKey,
14903
14922
  ingestPublishedPhotoMemoriesOp,
14904
14923
  injectionSignatureCatalog,
14924
+ isDegradedTopicSkip,
14905
14925
  isPiiRedactor,
14906
14926
  isRerankerAvailable,
14907
14927
  moveMemoriesToFolderOp,
@@ -10046,6 +10046,7 @@ __export(index_exports, {
10046
10046
  insertChild: () => insertChild,
10047
10047
  isAnumaTag: () => isAnumaTag,
10048
10048
  isCalendarCallback: () => isCalendarCallback,
10049
+ isDegradedTopicSkip: () => isDegradedTopicSkip,
10049
10050
  isDriveCallback: () => isDriveCallback,
10050
10051
  isGithubCallback: () => isGithubCallback,
10051
10052
  isHtmlTag: () => isHtmlTag,
@@ -19761,6 +19762,18 @@ function parseTopicResponse(parsed, validIds) {
19761
19762
  }
19762
19763
  return out;
19763
19764
  }
19765
+ var DEGRADED_TOPIC_SKIP = {
19766
+ excluded: false,
19767
+ "link-declined": false,
19768
+ "stamp-declined": false,
19769
+ "llm-unanswered": true,
19770
+ unreadable: true,
19771
+ "not-found": true,
19772
+ "link-failed": true
19773
+ };
19774
+ function isDegradedTopicSkip(reason) {
19775
+ return DEGRADED_TOPIC_SKIP[reason] === true;
19776
+ }
19764
19777
  async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
19765
19778
  const entityCtx = ctx.entityCtx;
19766
19779
  if (!entityCtx) {
@@ -19769,17 +19782,24 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
19769
19782
  const log = getLogger();
19770
19783
  const extractedAt = options.now ?? Date.now();
19771
19784
  const skippedIds = [];
19785
+ const skippedReasons = /* @__PURE__ */ new Map();
19786
+ const skip = (id, reason) => {
19787
+ if (skippedReasons.has(id)) return;
19788
+ skippedIds.push(id);
19789
+ skippedReasons.set(id, reason);
19790
+ };
19772
19791
  const inputs = [];
19773
- for (const id of memoryIds) {
19792
+ for (const id of new Set(memoryIds)) {
19774
19793
  let record;
19775
19794
  try {
19776
19795
  record = await ctx.vaultMemoryCollection.find(id);
19777
- } catch {
19778
- skippedIds.push(id);
19796
+ } catch (err) {
19797
+ log.warn("[memory/topics] vault lookup failed for extraction", err);
19798
+ skip(id, "not-found");
19779
19799
  continue;
19780
19800
  }
19781
19801
  if (record.isDeleted || ctx.userId !== void 0 && record.userId !== ctx.userId || record.topicsUserManaged) {
19782
- skippedIds.push(id);
19802
+ skip(id, "excluded");
19783
19803
  continue;
19784
19804
  }
19785
19805
  try {
@@ -19792,7 +19812,7 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
19792
19812
  inputs.push({ id, content: stored.content });
19793
19813
  } catch (err) {
19794
19814
  log.warn("[memory/topics] failed to load memory for extraction", err);
19795
- skippedIds.push(id);
19815
+ skip(id, "unreadable");
19796
19816
  }
19797
19817
  }
19798
19818
  const entitiesByMemory = await extractEntitiesForMemories(inputs, options);
@@ -19800,19 +19820,19 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
19800
19820
  for (const input of inputs) {
19801
19821
  const entities = entitiesByMemory.get(input.id);
19802
19822
  if (entities === void 0) {
19803
- skippedIds.push(input.id);
19823
+ skip(input.id, "llm-unanswered");
19804
19824
  continue;
19805
19825
  }
19806
19826
  try {
19807
19827
  const linked = await replaceMemoryEntitiesGuardedOp(entityCtx, input.id, entities);
19808
19828
  if (linked === null) {
19809
- skippedIds.push(input.id);
19829
+ skip(input.id, "link-declined");
19810
19830
  entitiesByMemory.delete(input.id);
19811
19831
  continue;
19812
19832
  }
19813
19833
  } catch (err) {
19814
19834
  log.warn("[memory/topics] replaceMemoryEntitiesGuardedOp failed", err);
19815
- skippedIds.push(input.id);
19835
+ skip(input.id, "link-failed");
19816
19836
  entitiesByMemory.delete(input.id);
19817
19837
  continue;
19818
19838
  }
@@ -19822,11 +19842,11 @@ async function extractAndLinkEntitiesForMemoriesOp(ctx, memoryIds, options) {
19822
19842
  const stampedSet = new Set(stampedIds);
19823
19843
  for (const id of toStamp) {
19824
19844
  if (!stampedSet.has(id)) {
19825
- skippedIds.push(id);
19845
+ skip(id, "stamp-declined");
19826
19846
  entitiesByMemory.delete(id);
19827
19847
  }
19828
19848
  }
19829
- return { entitiesByMemory, stampedIds, skippedIds };
19849
+ return { entitiesByMemory, stampedIds, skippedIds, skippedReasons };
19830
19850
  }
19831
19851
 
19832
19852
  // src/lib/memory/verifySupport.ts
@@ -35481,6 +35501,7 @@ function renderAnumaJsx(jsx3) {
35481
35501
  insertChild,
35482
35502
  isAnumaTag,
35483
35503
  isCalendarCallback,
35504
+ isDegradedTopicSkip,
35484
35505
  isDriveCallback,
35485
35506
  isGithubCallback,
35486
35507
  isHtmlTag,