@equationalapplications/core-llm-wiki 9.18.1 → 9.20.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.
@@ -1086,7 +1086,7 @@ type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
1086
1086
  * Closed for this release series, but new codes are added in minor versions:
1087
1087
  * hosts must tolerate codes they do not recognize.
1088
1088
  */
1089
- type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'heal_deleted' | 'heal_downgraded' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'classification_abstained' | 'node_type_assigned' | 'context_overflow_skipped' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'librarian_rewritten' | 'librarian_superseded' | 'contradicts_document' | 'ontology_backfill_held' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'supersede_scheduled_end_replaced' | 'external_deletion_discarded' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_event_gone' | 'derived_events_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable' | 'node_type_dropped' | 'node_type_folded' | 'ontology_update_rejected' | 'ingest_zero_facts';
1089
+ type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'heal_deleted' | 'heal_downgraded' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'classification_abstained' | 'node_type_assigned' | 'context_overflow_skipped' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'librarian_rewritten' | 'librarian_superseded' | 'contradicts_document' | 'ontology_backfill_held' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'supersede_scheduled_end_replaced' | 'external_deletion_discarded' | 'vector_removals_backlog' | 'vector_removals_trim_failed' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_event_gone' | 'derived_events_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable' | 'node_type_dropped' | 'node_type_folded' | 'ontology_update_rejected' | 'ingest_zero_facts';
1090
1090
  /** The service run that emitted the diagnostic. */
1091
1091
  type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune' | 'externalDeletion' | 'sourceStore' | 'erase';
1092
1092
  /** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
@@ -1129,9 +1129,9 @@ interface WikiDiagnosticDetail {
1129
1129
  packed?: number;
1130
1130
  /** read_budget only. */
1131
1131
  tokensUsed?: number;
1132
- /** external_deletion_pending only: epoch milliseconds (second resolution) of the oldest pending row. */
1132
+ /** external_deletion_pending / vector_removals_backlog: epoch milliseconds (second resolution) of the oldest pending row. */
1133
1133
  oldestEnqueuedAt?: number;
1134
- /** external_deletion_pending only: highest attempt count among pending rows. */
1134
+ /** external_deletion_pending / vector_removals_backlog: highest attempt count among pending rows. */
1135
1135
  maxAttempts?: number;
1136
1136
  /** supersede_scheduled_end_replaced only: epoch ms of the scheduled end the supersede overwrote (a timestamp, not content). */
1137
1137
  priorValidTo?: number;
@@ -1325,6 +1325,14 @@ interface StoredSource {
1325
1325
  charCount: number;
1326
1326
  storedAt: number;
1327
1327
  }
1328
+ /** Options for the paged `listStoredSources` (spec source-store §7).
1329
+ * Omitted or `undefined` keys count as absent; `null` is a defined value and throws. */
1330
+ interface ListStoredSourcesOptions {
1331
+ /** Keyset cursor: the last sourceRef of the previous page. A defined key starts paging. */
1332
+ afterSourceRef?: string;
1333
+ /** In paging mode: default 200; invalid args throw. */
1334
+ limit?: number;
1335
+ }
1328
1336
  /** One entry of `listStoredSources`. */
1329
1337
  interface StoredSourceSummary {
1330
1338
  sourceRef: string;
@@ -3367,6 +3375,14 @@ declare class VectorRemovalRepository extends BaseRepository {
3367
3375
  oldestEnqueuedAt: number | null;
3368
3376
  maxAttempts: number;
3369
3377
  }>;
3378
+ /**
3379
+ * Trim an entity's pending rows down toward `cap`, deleting at most `chunk`
3380
+ * of the oldest per call. Uses the lower of the two cutoffs (cap overflow,
3381
+ * chunk bound); a no-op when at or under cap or when the external-index
3382
+ * marker is set. Without `tx` it opens its own single short transaction.
3383
+ * Returns the number of rows deleted.
3384
+ */
3385
+ trimPendingOverflow(entityId: string, cap: number, chunk: number, tx?: SQLiteAdapter): Promise<number>;
3370
3386
  entitiesWithPending(): Promise<string[]>;
3371
3387
  /**
3372
3388
  * Entities with at least one pending row outside backoff (never attempted,
@@ -5331,7 +5347,9 @@ declare class WikiMemory {
5331
5347
  text: string;
5332
5348
  }): Promise<StoreSourceResult>;
5333
5349
  getStoredSource(entityId: string, sourceRef: string): Promise<StoredSource | null>;
5334
- listStoredSources(entityId: string): Promise<StoredSourceSummary[]>;
5350
+ listStoredSources(entityId: string, opts?: ListStoredSourcesOptions): Promise<StoredSourceSummary[]>;
5351
+ /** Spec source-store-paging §2: point probe passthrough; a bad entityId throws here, never a silent false. */
5352
+ hasStoredSource(entityId: string, sourceRef: string): Promise<boolean>;
5335
5353
  /**
5336
5354
  * End `oldId`'s validity and link it to its replacement (spec §4.3). One
5337
5355
  * transaction. Throws `WikiSupersedeError` for missing, foreign, already
@@ -5588,5 +5606,5 @@ declare class WikiMemory {
5588
5606
  setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
5589
5607
  }
5590
5608
 
5591
- export { ONTOLOGY_BACKFILL_RECHECK_MS as $, HEAL_RECHECK_MS as A, HOOK_TIMEOUT_MARKER as B, CLASSIFIER_MAX_CHOICES as C, HEAL_BATCH_SIZE as H, ONTOLOGY_ABSTAIN_SENTINEL as Z, ONTOLOGY_BACKFILL_BATCH_SIZE as _, validateManifest as a$, WikiDraftNotFound as aB, WikiDuplicateHashError as aC, WikiExternalDeletionError as aF, WikiGraphNodeOwnershipConflict as aH, WikiIngestEmptyError as aI, WikiInvalidReadOptions as aK, WikiMigrationRequiredError as aN, WikiParseError as aP, WikiSearchUnavailableError as aQ, WikiSourceRefHashCollision as aS, WikiStrictOntologyViolation as aT, WikiSupersedeError as aU, WikiTransactionError as aX, isReservedAbstainSlug as aZ, isWikiSearchUnavailableError as a_, PromptService as aa, PrunePartialFailureError as ab, WikiBusyError as as, EmbeddingService as b0, ImportExportService as b1, IngestionService as b2, JobManager as b3, MaintenanceService as b4, RetrievalService as b5, SearchService as b6, WriteService as b7, WikiMemory as e, CheckpointIncompleteError as f, EraseStepError as r };
5592
- export type { DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, HealResult as I, ImportDumpResult as J, IngestDocumentResult as K, IngestTypingCounters as L, MemoryBundle as M, LLMProvider as N, OntologyMode as O, LibrarianConfig as P, LibrarianGateConfig as Q, ReadOptions as R, SQLiteAdapter as S, LockedMaintenanceJob as T, MaintenanceJob as U, MaintenanceStopReason as V, WikiConfig as W, MemoryDumpEntity as X, MigrationPolicy as Y, MemoryDump as a, OntologyBackfillResult as a0, OntologyEdgeType as a1, OntologyManifest as a2, OntologyNodeType as a3, OntologyPromptContext as a4, OntologyUpdates as a5, PendingMaintenance as a6, PendingMigrationWork as a7, PendingSourceStatus as a8, PromptOverrides as a9, WikiDiagnosticTrigger as aA, WikiEdge as aD, WikiEvent as aE, WikiFact as aG, WikiInstructions as aJ, WikiLintReport as aL, WikiMemoryTestAccess as aM, WikiOutboxEvent as aO, WikiSourcePointer as aR, WikiSupersedeReason as aV, WikiTask as aW, WriteOntologyPromptContext as aY, ReembedResult as ac, RememberInput as ad, RunPendingMaintenanceOptions as ae, RunPendingMaintenanceResult as af, SourcePassage as ag, StoreSourceResult as ah, StoredSource as ai, StoredSourceDump as aj, StoredSourceSummary as ak, SupersedeReplacement as al, SystemOneConfig as am, SystemOneThresholdSite as an, VectorRanker as ao, VectorRankerFallback as ap, VectorRankerRankArgs as aq, VectorRankerSemanticResult as ar, WikiBusyOperation as at, WikiCheckpoint as au, WikiDiagnostic as av, WikiDiagnosticCode as aw, WikiDiagnosticDetail as ax, WikiDiagnosticOperation as ay, WikiDiagnosticSeverity as az, FormattedMemoryDump as b, OntologyConfig as c, WikiOptions as d, ChunkFailure as g, ClassifierAnswer as h, ClassifierQuestion as i, ClassifyRequest as j, ClassifyResponse as k, DraftPage as l, EmbedFailureKind as m, EmbeddingMarkerKind as n, EntityMaintenanceReport as o, EntityStatus as p, EraseReport as q, ExtractedFact as s, ExtractedFactEdge as t, ExtractedFactWithOntology as u, ExtractedTask as v, ForgetParams as w, ForgetResult as x, GraphTraversalOptions as y, GroundingConfig as z };
5609
+ export { ONTOLOGY_BACKFILL_BATCH_SIZE as $, HEAL_RECHECK_MS as A, HOOK_TIMEOUT_MARKER as B, CLASSIFIER_MAX_CHOICES as C, HEAL_BATCH_SIZE as H, ONTOLOGY_ABSTAIN_SENTINEL as _, isWikiSearchUnavailableError as a$, ONTOLOGY_BACKFILL_RECHECK_MS as a0, WikiDraftNotFound as aC, WikiDuplicateHashError as aD, WikiExternalDeletionError as aG, WikiGraphNodeOwnershipConflict as aI, WikiIngestEmptyError as aJ, WikiInvalidReadOptions as aL, WikiMigrationRequiredError as aO, WikiParseError as aQ, WikiSearchUnavailableError as aR, WikiSourceRefHashCollision as aT, WikiStrictOntologyViolation as aU, WikiSupersedeError as aV, WikiTransactionError as aY, isReservedAbstainSlug as a_, PromptService as ab, PrunePartialFailureError as ac, WikiBusyError as at, validateManifest as b0, EmbeddingService as b1, ImportExportService as b2, IngestionService as b3, JobManager as b4, MaintenanceService as b5, RetrievalService as b6, SearchService as b7, WriteService as b8, WikiMemory as e, CheckpointIncompleteError as f, EraseStepError as r };
5610
+ export type { DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, HealResult as I, ImportDumpResult as J, IngestDocumentResult as K, IngestTypingCounters as L, MemoryBundle as M, LLMProvider as N, OntologyMode as O, LibrarianConfig as P, LibrarianGateConfig as Q, ReadOptions as R, SQLiteAdapter as S, ListStoredSourcesOptions as T, LockedMaintenanceJob as U, MaintenanceJob as V, WikiConfig as W, MaintenanceStopReason as X, MemoryDumpEntity as Y, MigrationPolicy as Z, MemoryDump as a, OntologyBackfillResult as a1, OntologyEdgeType as a2, OntologyManifest as a3, OntologyNodeType as a4, OntologyPromptContext as a5, OntologyUpdates as a6, PendingMaintenance as a7, PendingMigrationWork as a8, PendingSourceStatus as a9, WikiDiagnosticSeverity as aA, WikiDiagnosticTrigger as aB, WikiEdge as aE, WikiEvent as aF, WikiFact as aH, WikiInstructions as aK, WikiLintReport as aM, WikiMemoryTestAccess as aN, WikiOutboxEvent as aP, WikiSourcePointer as aS, WikiSupersedeReason as aW, WikiTask as aX, WriteOntologyPromptContext as aZ, PromptOverrides as aa, ReembedResult as ad, RememberInput as ae, RunPendingMaintenanceOptions as af, RunPendingMaintenanceResult as ag, SourcePassage as ah, StoreSourceResult as ai, StoredSource as aj, StoredSourceDump as ak, StoredSourceSummary as al, SupersedeReplacement as am, SystemOneConfig as an, SystemOneThresholdSite as ao, VectorRanker as ap, VectorRankerFallback as aq, VectorRankerRankArgs as ar, VectorRankerSemanticResult as as, WikiBusyOperation as au, WikiCheckpoint as av, WikiDiagnostic as aw, WikiDiagnosticCode as ax, WikiDiagnosticDetail as ay, WikiDiagnosticOperation as az, FormattedMemoryDump as b, OntologyConfig as c, WikiOptions as d, ChunkFailure as g, ClassifierAnswer as h, ClassifierQuestion as i, ClassifyRequest as j, ClassifyResponse as k, DraftPage as l, EmbedFailureKind as m, EmbeddingMarkerKind as n, EntityMaintenanceReport as o, EntityStatus as p, EraseReport as q, ExtractedFact as s, ExtractedFactEdge as t, ExtractedFactWithOntology as u, ExtractedTask as v, ForgetParams as w, ForgetResult as x, GraphTraversalOptions as y, GroundingConfig as z };
@@ -1086,7 +1086,7 @@ type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
1086
1086
  * Closed for this release series, but new codes are added in minor versions:
1087
1087
  * hosts must tolerate codes they do not recognize.
1088
1088
  */
1089
- type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'heal_deleted' | 'heal_downgraded' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'classification_abstained' | 'node_type_assigned' | 'context_overflow_skipped' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'librarian_rewritten' | 'librarian_superseded' | 'contradicts_document' | 'ontology_backfill_held' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'supersede_scheduled_end_replaced' | 'external_deletion_discarded' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_event_gone' | 'derived_events_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable' | 'node_type_dropped' | 'node_type_folded' | 'ontology_update_rejected' | 'ingest_zero_facts';
1089
+ type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'heal_deleted' | 'heal_downgraded' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'classification_abstained' | 'node_type_assigned' | 'context_overflow_skipped' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'librarian_rewritten' | 'librarian_superseded' | 'contradicts_document' | 'ontology_backfill_held' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'supersede_scheduled_end_replaced' | 'external_deletion_discarded' | 'vector_removals_backlog' | 'vector_removals_trim_failed' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_event_gone' | 'derived_events_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable' | 'node_type_dropped' | 'node_type_folded' | 'ontology_update_rejected' | 'ingest_zero_facts';
1090
1090
  /** The service run that emitted the diagnostic. */
1091
1091
  type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune' | 'externalDeletion' | 'sourceStore' | 'erase';
1092
1092
  /** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
@@ -1129,9 +1129,9 @@ interface WikiDiagnosticDetail {
1129
1129
  packed?: number;
1130
1130
  /** read_budget only. */
1131
1131
  tokensUsed?: number;
1132
- /** external_deletion_pending only: epoch milliseconds (second resolution) of the oldest pending row. */
1132
+ /** external_deletion_pending / vector_removals_backlog: epoch milliseconds (second resolution) of the oldest pending row. */
1133
1133
  oldestEnqueuedAt?: number;
1134
- /** external_deletion_pending only: highest attempt count among pending rows. */
1134
+ /** external_deletion_pending / vector_removals_backlog: highest attempt count among pending rows. */
1135
1135
  maxAttempts?: number;
1136
1136
  /** supersede_scheduled_end_replaced only: epoch ms of the scheduled end the supersede overwrote (a timestamp, not content). */
1137
1137
  priorValidTo?: number;
@@ -1325,6 +1325,14 @@ interface StoredSource {
1325
1325
  charCount: number;
1326
1326
  storedAt: number;
1327
1327
  }
1328
+ /** Options for the paged `listStoredSources` (spec source-store §7).
1329
+ * Omitted or `undefined` keys count as absent; `null` is a defined value and throws. */
1330
+ interface ListStoredSourcesOptions {
1331
+ /** Keyset cursor: the last sourceRef of the previous page. A defined key starts paging. */
1332
+ afterSourceRef?: string;
1333
+ /** In paging mode: default 200; invalid args throw. */
1334
+ limit?: number;
1335
+ }
1328
1336
  /** One entry of `listStoredSources`. */
1329
1337
  interface StoredSourceSummary {
1330
1338
  sourceRef: string;
@@ -3367,6 +3375,14 @@ declare class VectorRemovalRepository extends BaseRepository {
3367
3375
  oldestEnqueuedAt: number | null;
3368
3376
  maxAttempts: number;
3369
3377
  }>;
3378
+ /**
3379
+ * Trim an entity's pending rows down toward `cap`, deleting at most `chunk`
3380
+ * of the oldest per call. Uses the lower of the two cutoffs (cap overflow,
3381
+ * chunk bound); a no-op when at or under cap or when the external-index
3382
+ * marker is set. Without `tx` it opens its own single short transaction.
3383
+ * Returns the number of rows deleted.
3384
+ */
3385
+ trimPendingOverflow(entityId: string, cap: number, chunk: number, tx?: SQLiteAdapter): Promise<number>;
3370
3386
  entitiesWithPending(): Promise<string[]>;
3371
3387
  /**
3372
3388
  * Entities with at least one pending row outside backoff (never attempted,
@@ -5331,7 +5347,9 @@ declare class WikiMemory {
5331
5347
  text: string;
5332
5348
  }): Promise<StoreSourceResult>;
5333
5349
  getStoredSource(entityId: string, sourceRef: string): Promise<StoredSource | null>;
5334
- listStoredSources(entityId: string): Promise<StoredSourceSummary[]>;
5350
+ listStoredSources(entityId: string, opts?: ListStoredSourcesOptions): Promise<StoredSourceSummary[]>;
5351
+ /** Spec source-store-paging §2: point probe passthrough; a bad entityId throws here, never a silent false. */
5352
+ hasStoredSource(entityId: string, sourceRef: string): Promise<boolean>;
5335
5353
  /**
5336
5354
  * End `oldId`'s validity and link it to its replacement (spec §4.3). One
5337
5355
  * transaction. Throws `WikiSupersedeError` for missing, foreign, already
@@ -5588,5 +5606,5 @@ declare class WikiMemory {
5588
5606
  setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
5589
5607
  }
5590
5608
 
5591
- export { ONTOLOGY_BACKFILL_RECHECK_MS as $, HEAL_RECHECK_MS as A, HOOK_TIMEOUT_MARKER as B, CLASSIFIER_MAX_CHOICES as C, HEAL_BATCH_SIZE as H, ONTOLOGY_ABSTAIN_SENTINEL as Z, ONTOLOGY_BACKFILL_BATCH_SIZE as _, validateManifest as a$, WikiDraftNotFound as aB, WikiDuplicateHashError as aC, WikiExternalDeletionError as aF, WikiGraphNodeOwnershipConflict as aH, WikiIngestEmptyError as aI, WikiInvalidReadOptions as aK, WikiMigrationRequiredError as aN, WikiParseError as aP, WikiSearchUnavailableError as aQ, WikiSourceRefHashCollision as aS, WikiStrictOntologyViolation as aT, WikiSupersedeError as aU, WikiTransactionError as aX, isReservedAbstainSlug as aZ, isWikiSearchUnavailableError as a_, PromptService as aa, PrunePartialFailureError as ab, WikiBusyError as as, EmbeddingService as b0, ImportExportService as b1, IngestionService as b2, JobManager as b3, MaintenanceService as b4, RetrievalService as b5, SearchService as b6, WriteService as b7, WikiMemory as e, CheckpointIncompleteError as f, EraseStepError as r };
5592
- export type { DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, HealResult as I, ImportDumpResult as J, IngestDocumentResult as K, IngestTypingCounters as L, MemoryBundle as M, LLMProvider as N, OntologyMode as O, LibrarianConfig as P, LibrarianGateConfig as Q, ReadOptions as R, SQLiteAdapter as S, LockedMaintenanceJob as T, MaintenanceJob as U, MaintenanceStopReason as V, WikiConfig as W, MemoryDumpEntity as X, MigrationPolicy as Y, MemoryDump as a, OntologyBackfillResult as a0, OntologyEdgeType as a1, OntologyManifest as a2, OntologyNodeType as a3, OntologyPromptContext as a4, OntologyUpdates as a5, PendingMaintenance as a6, PendingMigrationWork as a7, PendingSourceStatus as a8, PromptOverrides as a9, WikiDiagnosticTrigger as aA, WikiEdge as aD, WikiEvent as aE, WikiFact as aG, WikiInstructions as aJ, WikiLintReport as aL, WikiMemoryTestAccess as aM, WikiOutboxEvent as aO, WikiSourcePointer as aR, WikiSupersedeReason as aV, WikiTask as aW, WriteOntologyPromptContext as aY, ReembedResult as ac, RememberInput as ad, RunPendingMaintenanceOptions as ae, RunPendingMaintenanceResult as af, SourcePassage as ag, StoreSourceResult as ah, StoredSource as ai, StoredSourceDump as aj, StoredSourceSummary as ak, SupersedeReplacement as al, SystemOneConfig as am, SystemOneThresholdSite as an, VectorRanker as ao, VectorRankerFallback as ap, VectorRankerRankArgs as aq, VectorRankerSemanticResult as ar, WikiBusyOperation as at, WikiCheckpoint as au, WikiDiagnostic as av, WikiDiagnosticCode as aw, WikiDiagnosticDetail as ax, WikiDiagnosticOperation as ay, WikiDiagnosticSeverity as az, FormattedMemoryDump as b, OntologyConfig as c, WikiOptions as d, ChunkFailure as g, ClassifierAnswer as h, ClassifierQuestion as i, ClassifyRequest as j, ClassifyResponse as k, DraftPage as l, EmbedFailureKind as m, EmbeddingMarkerKind as n, EntityMaintenanceReport as o, EntityStatus as p, EraseReport as q, ExtractedFact as s, ExtractedFactEdge as t, ExtractedFactWithOntology as u, ExtractedTask as v, ForgetParams as w, ForgetResult as x, GraphTraversalOptions as y, GroundingConfig as z };
5609
+ export { ONTOLOGY_BACKFILL_BATCH_SIZE as $, HEAL_RECHECK_MS as A, HOOK_TIMEOUT_MARKER as B, CLASSIFIER_MAX_CHOICES as C, HEAL_BATCH_SIZE as H, ONTOLOGY_ABSTAIN_SENTINEL as _, isWikiSearchUnavailableError as a$, ONTOLOGY_BACKFILL_RECHECK_MS as a0, WikiDraftNotFound as aC, WikiDuplicateHashError as aD, WikiExternalDeletionError as aG, WikiGraphNodeOwnershipConflict as aI, WikiIngestEmptyError as aJ, WikiInvalidReadOptions as aL, WikiMigrationRequiredError as aO, WikiParseError as aQ, WikiSearchUnavailableError as aR, WikiSourceRefHashCollision as aT, WikiStrictOntologyViolation as aU, WikiSupersedeError as aV, WikiTransactionError as aY, isReservedAbstainSlug as a_, PromptService as ab, PrunePartialFailureError as ac, WikiBusyError as at, validateManifest as b0, EmbeddingService as b1, ImportExportService as b2, IngestionService as b3, JobManager as b4, MaintenanceService as b5, RetrievalService as b6, SearchService as b7, WriteService as b8, WikiMemory as e, CheckpointIncompleteError as f, EraseStepError as r };
5610
+ export type { DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, HealResult as I, ImportDumpResult as J, IngestDocumentResult as K, IngestTypingCounters as L, MemoryBundle as M, LLMProvider as N, OntologyMode as O, LibrarianConfig as P, LibrarianGateConfig as Q, ReadOptions as R, SQLiteAdapter as S, ListStoredSourcesOptions as T, LockedMaintenanceJob as U, MaintenanceJob as V, WikiConfig as W, MaintenanceStopReason as X, MemoryDumpEntity as Y, MigrationPolicy as Z, MemoryDump as a, OntologyBackfillResult as a1, OntologyEdgeType as a2, OntologyManifest as a3, OntologyNodeType as a4, OntologyPromptContext as a5, OntologyUpdates as a6, PendingMaintenance as a7, PendingMigrationWork as a8, PendingSourceStatus as a9, WikiDiagnosticSeverity as aA, WikiDiagnosticTrigger as aB, WikiEdge as aE, WikiEvent as aF, WikiFact as aH, WikiInstructions as aK, WikiLintReport as aM, WikiMemoryTestAccess as aN, WikiOutboxEvent as aP, WikiSourcePointer as aS, WikiSupersedeReason as aW, WikiTask as aX, WriteOntologyPromptContext as aZ, PromptOverrides as aa, ReembedResult as ad, RememberInput as ae, RunPendingMaintenanceOptions as af, RunPendingMaintenanceResult as ag, SourcePassage as ah, StoreSourceResult as ai, StoredSource as aj, StoredSourceDump as ak, StoredSourceSummary as al, SupersedeReplacement as am, SystemOneConfig as an, SystemOneThresholdSite as ao, VectorRanker as ap, VectorRankerFallback as aq, VectorRankerRankArgs as ar, VectorRankerSemanticResult as as, WikiBusyOperation as au, WikiCheckpoint as av, WikiDiagnostic as aw, WikiDiagnosticCode as ax, WikiDiagnosticDetail as ay, WikiDiagnosticOperation as az, FormattedMemoryDump as b, OntologyConfig as c, WikiOptions as d, ChunkFailure as g, ClassifierAnswer as h, ClassifierQuestion as i, ClassifyRequest as j, ClassifyResponse as k, DraftPage as l, EmbedFailureKind as m, EmbeddingMarkerKind as n, EntityMaintenanceReport as o, EntityStatus as p, EraseReport as q, ExtractedFact as s, ExtractedFactEdge as t, ExtractedFactWithOntology as u, ExtractedTask as v, ForgetParams as w, ForgetResult as x, GraphTraversalOptions as y, GroundingConfig as z };
@@ -1,2 +1,2 @@
1
- export { b0 as EmbeddingService, b1 as ImportExportService, b2 as IngestionService, b3 as JobManager, b3 as JobManagerType, b4 as MaintenanceService, b5 as RetrievalService, b6 as SearchService, b6 as SearchServiceType, aM as WikiMemoryTestAccess, b7 as WriteService } from './testing-CI0n5qQk.mjs';
1
+ export { b1 as EmbeddingService, b2 as ImportExportService, b3 as IngestionService, b4 as JobManager, b4 as JobManagerType, b5 as MaintenanceService, b6 as RetrievalService, b7 as SearchService, b7 as SearchServiceType, aN as WikiMemoryTestAccess, b8 as WriteService } from './testing-CnXg2aRj.mjs';
2
2
  import '@equationalapplications/core-okf';
package/dist/testing.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { b0 as EmbeddingService, b1 as ImportExportService, b2 as IngestionService, b3 as JobManager, b3 as JobManagerType, b4 as MaintenanceService, b5 as RetrievalService, b6 as SearchService, b6 as SearchServiceType, aM as WikiMemoryTestAccess, b7 as WriteService } from './testing-CI0n5qQk.js';
1
+ export { b1 as EmbeddingService, b2 as ImportExportService, b3 as IngestionService, b4 as JobManager, b4 as JobManagerType, b5 as MaintenanceService, b6 as RetrievalService, b7 as SearchService, b7 as SearchServiceType, aN as WikiMemoryTestAccess, b8 as WriteService } from './testing-CnXg2aRj.js';
2
2
  import '@equationalapplications/core-okf';
package/dist/testing.js CHANGED
@@ -755,6 +755,8 @@ var SEVERITY = {
755
755
  external_deletion_pending: "warn",
756
756
  supersede_scheduled_end_replaced: "info",
757
757
  external_deletion_discarded: "warn",
758
+ vector_removals_backlog: "warn",
759
+ vector_removals_trim_failed: "warn",
758
760
  guidance_too_long: "warn",
759
761
  guidance_resolver_failed: "warn",
760
762
  source_pointer_unresolved: "warn",
@@ -815,6 +817,8 @@ var MESSAGE = {
815
817
  supersede_scheduled_end_replaced: "A supersede replaced a scheduled end date on the old fact; the prior end is kept in prior_valid_to and reopen() can restore it.",
816
818
  external_deletion_pending: "Removals owed to the external vector index are still pending.",
817
819
  external_deletion_discarded: "Pending external vector removals were discarded because forceDeleteIgnoreRankerHook is set.",
820
+ vector_removals_backlog: "Pending external vector removals are accumulating faster than the host drains them.",
821
+ vector_removals_trim_failed: "The prune-time check of pending external vector removals failed; it will retry on the next prune pass.",
818
822
  guidance_too_long: "The configured guidance exceeded the length cap and was not sent for this pass.",
819
823
  guidance_resolver_failed: "The per-entity guidance resolver failed; its value was not used for this pass.",
820
824
  source_pointer_unresolved: "A stored librarian fact carries no source pointer because the model answer could not yield one, or the librarian merged such an unattributed candidate into this fact in place (its derived_events list was not extended).",
@@ -6606,6 +6610,9 @@ async function runLibrarianStrategy(deps, ctx) {
6606
6610
 
6607
6611
  // src/services/MaintenanceService.ts
6608
6612
  var CHAIN_TRUNCATED_NOTICE = `includeChain walk stopped at the depth cap (${HISTORY_MAX_DEPTH} links per direction); the chain is longer than the ids listed. Run forget again on a remaining chain id to continue.`;
6613
+ var MAX_PENDING_LEDGER_ROWS = 1e4;
6614
+ var WARN_PENDING_LEDGER_ROWS = 500;
6615
+ var TRIM_CHUNK_ROWS = 5e3;
6609
6616
  var ONTOLOGY_BACKFILL_BATCH_SIZE = 25;
6610
6617
  var ONTOLOGY_BACKFILL_RECHECK_MS = 7 * 24 * 60 * 60 * 1e3;
6611
6618
  var HEAL_ANCHOR_SEARCH_OVERFETCH = 4;
@@ -6850,6 +6857,33 @@ var _MaintenanceService = class _MaintenanceService {
6850
6857
  }
6851
6858
  }
6852
6859
  }
6860
+ if (gate === "none" && this.vectorRemoval && this.vectorRemovalRepo) {
6861
+ try {
6862
+ if (await this.vectorRemoval.ledgerPresent()) {
6863
+ if (!await this.vectorRemoval.externalIndexInUse()) {
6864
+ await this.vectorRemovalRepo.trimPendingOverflow(entityId, MAX_PENDING_LEDGER_ROWS, TRIM_CHUNK_ROWS);
6865
+ } else if (owner === "host") {
6866
+ const st = await this.vectorRemovalRepo.pendingStats(entityId);
6867
+ if (st.count > WARN_PENDING_LEDGER_ROWS) {
6868
+ emitDiagnostic(this.options, {
6869
+ code: "vector_removals_backlog",
6870
+ operation: "prune",
6871
+ trigger: "call",
6872
+ entityId,
6873
+ detail: {
6874
+ count: st.count,
6875
+ ...st.oldestEnqueuedAt !== null ? { oldestEnqueuedAt: st.oldestEnqueuedAt } : {},
6876
+ maxAttempts: st.maxAttempts
6877
+ }
6878
+ });
6879
+ }
6880
+ }
6881
+ }
6882
+ } catch (err) {
6883
+ const reason = err instanceof Error ? typeof err.code === "string" ? err.code : err.name : "unknown";
6884
+ emitDiagnostic(this.options, { code: "vector_removals_trim_failed", operation: "prune", trigger: "call", entityId, detail: { reason } });
6885
+ }
6886
+ }
6853
6887
  let vacuumCheckpointErr;
6854
6888
  if (vacuum) {
6855
6889
  try {