@equationalapplications/core-llm-wiki 9.18.0 → 9.19.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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { BaseRepository, WikiGraphNodeOwnershipConflict, serializeSourcePointer, serializeDerivedEvents, parseStoredDerivedEvents, parseStoredSourcePointer, parseJsonObject, parseJsonArray, liveAtSql, reanchorRebuildFingerprint, __privateAdd, warnChangedDefaultsOnce, resolveContextBudgetOrThrow, EdgeRepository, MetadataRepository, EmbeddingService, VectorRemovalRepository, VectorRemovalService, SearchService, TemporalService, JobManager, PromptService, resolveGrounding, IngestionService, MaintenanceService, ImportExportService, RetrievalService, SourceStoreService, WriteService, __privateGet, __privateSet, createLegacySourceTypeIndex, createEntriesDeletedIndex, createEventsForgottenIndex, writeNormalizeStamp, CURRENT_SCHEMA_VERSION, detectSchemaVersion, MIGRATIONS, runSourceRefNormalize, emitDiagnostic, normalizeSourceRef, normalizeSourceHash, canEngageWriteTyping, canEngageIngestTyping, resolveLibrarianStrategy, entitySummaryMetaKey, WikiSourceRefHashCollision, DiagnosticBuffer, validateManifest, isReservedAbstainSlug, ONTOLOGY_ABSTAIN_SENTINEL, WikiDraftNotFound, generateId, emptyManifest, resolveNodeTypeMatch, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, typeSatisfies, normalizeTitleKey, edgeTripleAllowed, resolveNodeType, shouldEmitOntologyReceipt, nodeTypeReceipts, MAX_EMBED_ATTEMPTS, UsageMeter, isWikiSearchUnavailableError, WikiBusyError, WikiInvalidReadOptions, isLiveAt, packFactsByBudget, factTokenCost, probePendingWork, WikiMigrationRequiredError, setupDatabase, UnavailableIndexStrategy, createdAtValue, isUsableDate, validateDerivedEventsValue, validateSourcePointerValue, assertEntityId, assertEpochMs, passageFtsTriggerNames, FTS5_STATE_KEY, fts5LedgerDropSql, passageFtsTablesDdl, passageFtsTriggersDdl, fts5TablesDdl, fts5PendingIndexesDdl, fts5TriggersDdl, writeRebuildStart, FTS5_RETIRED_COUNTER_KEY, retiredTableName, FTS5_RETIRED_TABLES_KEY, isRetiredTableName, idReindexChunkSql, readRebuildProgress, FTS5_DRAIN_CHUNK, FTS5_RECLAIM_MERGE_PAGES, windowHiSql, windowChunkSql, FTS5_REBUILD_WM_KEY, sweepHiSql, sweepChunkSql, FTS5_SWEEP_CURSOR_KEY, drainHiSql, drainChunkSql, FTS5_REBUILD_SNAPSHOT_KEY, idDrainChunkSql, entityDrainHiSql, entityDrainChunkSql, fts5TriggerNames, extractSqliteCode, WikiTransactionError } from './chunk-FX4J6MLA.mjs';
2
- export { CLASSIFIER_MAX_CHOICES, CheckpointIncompleteError, DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DEFAULT_TYPING_MIN_CONFIDENCE, EMBED_CHARS_CEILING, EraseStepError, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_ABSTAIN_SENTINEL, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiExternalDeletionError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiMigrationRequiredError, WikiParseError, WikiSearchUnavailableError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, chunkText, configureRandomSource, isReservedAbstainSlug, isWikiSearchUnavailableError, parseEmbedding, resolveContextBudget, resolveDefaultChunkLength, resolveEdgesMinConfidence, resolveHealScreenMinConfidence, resolveMaxPromptChars, resolveResolveMinConfidence, resolveSystemOneEdges, resolveSystemOneHealScreen, resolveSystemOneResolve, resolveSystemOneTypeOnIngest, resolveSystemOneTypeOnWrite, resolveSystemOneTyping, resolveTypingMinConfidence, safeSlice, validUsage, validateManifest, warnOnce } from './chunk-FX4J6MLA.mjs';
1
+ import { BaseRepository, WikiGraphNodeOwnershipConflict, serializeSourcePointer, serializeDerivedEvents, parseStoredDerivedEvents, parseStoredSourcePointer, parseJsonObject, parseJsonArray, liveAtSql, reanchorRebuildFingerprint, __privateAdd, warnChangedDefaultsOnce, resolveContextBudgetOrThrow, EdgeRepository, MetadataRepository, EmbeddingService, VectorRemovalRepository, VectorRemovalService, SearchService, TemporalService, JobManager, PromptService, resolveGrounding, IngestionService, MaintenanceService, ImportExportService, RetrievalService, SourceStoreService, WriteService, __privateGet, __privateSet, createLegacySourceTypeIndex, createEntriesDeletedIndex, createEventsForgottenIndex, writeNormalizeStamp, CURRENT_SCHEMA_VERSION, detectSchemaVersion, MIGRATIONS, runSourceRefNormalize, emitDiagnostic, normalizeSourceRef, normalizeSourceHash, canEngageWriteTyping, canEngageIngestTyping, resolveLibrarianStrategy, entitySummaryMetaKey, WikiSourceRefHashCollision, DiagnosticBuffer, validateManifest, isReservedAbstainSlug, ONTOLOGY_ABSTAIN_SENTINEL, WikiDraftNotFound, generateId, emptyManifest, resolveNodeTypeMatch, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, typeSatisfies, normalizeTitleKey, edgeTripleAllowed, resolveNodeType, shouldEmitOntologyReceipt, nodeTypeReceipts, MAX_EMBED_ATTEMPTS, UsageMeter, isWikiSearchUnavailableError, WikiBusyError, WikiInvalidReadOptions, isLiveAt, packFactsByBudget, factTokenCost, probePendingWork, WikiMigrationRequiredError, setupDatabase, UnavailableIndexStrategy, createdAtValue, isUsableDate, validateDerivedEventsValue, validateSourcePointerValue, assertEntityId, assertEpochMs, passageFtsTriggerNames, FTS5_STATE_KEY, fts5LedgerDropSql, passageFtsTablesDdl, passageFtsTriggersDdl, fts5TablesDdl, fts5PendingIndexesDdl, fts5TriggersDdl, writeRebuildStart, FTS5_RETIRED_COUNTER_KEY, retiredTableName, FTS5_RETIRED_TABLES_KEY, isRetiredTableName, idReindexChunkSql, readRebuildProgress, FTS5_DRAIN_CHUNK, FTS5_RECLAIM_MERGE_PAGES, windowHiSql, windowChunkSql, FTS5_REBUILD_WM_KEY, sweepHiSql, sweepChunkSql, FTS5_SWEEP_CURSOR_KEY, drainHiSql, drainChunkSql, FTS5_REBUILD_SNAPSHOT_KEY, idDrainChunkSql, entityDrainHiSql, entityDrainChunkSql, fts5TriggerNames, extractSqliteCode, WikiTransactionError } from './chunk-JTKJXNB6.mjs';
2
+ export { CLASSIFIER_MAX_CHOICES, CheckpointIncompleteError, DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DEFAULT_TYPING_MIN_CONFIDENCE, EMBED_CHARS_CEILING, EraseStepError, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_ABSTAIN_SENTINEL, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiExternalDeletionError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiMigrationRequiredError, WikiParseError, WikiSearchUnavailableError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, chunkText, configureRandomSource, isReservedAbstainSlug, isWikiSearchUnavailableError, parseEmbedding, resolveContextBudget, resolveDefaultChunkLength, resolveEdgesMinConfidence, resolveHealScreenMinConfidence, resolveMaxPromptChars, resolveResolveMinConfidence, resolveSystemOneEdges, resolveSystemOneHealScreen, resolveSystemOneResolve, resolveSystemOneTypeOnIngest, resolveSystemOneTypeOnWrite, resolveSystemOneTyping, resolveTypingMinConfidence, safeSlice, validUsage, validateManifest, warnOnce } from './chunk-JTKJXNB6.mjs';
3
3
  import { deriveTrustTier, isStaleAfter, appendRelatedSection, buildConceptDocument, buildLogMd, buildEntityIndexMd, buildRootIndexMd, isAllowedOkfPath, parseRootIndexMd, parseEntityIndexMd, parseConcept, splitRelatedSection, extractMarkdownLinks, parseLogMd, parseEventIdComment, createEventIdDeriver, latestVerified, formatSourcesJson, appendEventIdComment, parseVerifiedFlexible, parseCitationsList } from '@equationalapplications/core-okf';
4
4
  import MiniSearch from 'minisearch';
5
5
 
@@ -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;
@@ -3367,6 +3367,14 @@ declare class VectorRemovalRepository extends BaseRepository {
3367
3367
  oldestEnqueuedAt: number | null;
3368
3368
  maxAttempts: number;
3369
3369
  }>;
3370
+ /**
3371
+ * Trim an entity's pending rows down toward `cap`, deleting at most `chunk`
3372
+ * of the oldest per call. Uses the lower of the two cutoffs (cap overflow,
3373
+ * chunk bound); a no-op when at or under cap or when the external-index
3374
+ * marker is set. Without `tx` it opens its own single short transaction.
3375
+ * Returns the number of rows deleted.
3376
+ */
3377
+ trimPendingOverflow(entityId: string, cap: number, chunk: number, tx?: SQLiteAdapter): Promise<number>;
3370
3378
  entitiesWithPending(): Promise<string[]>;
3371
3379
  /**
3372
3380
  * Entities with at least one pending row outside backoff (never attempted,
@@ -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;
@@ -3367,6 +3367,14 @@ declare class VectorRemovalRepository extends BaseRepository {
3367
3367
  oldestEnqueuedAt: number | null;
3368
3368
  maxAttempts: number;
3369
3369
  }>;
3370
+ /**
3371
+ * Trim an entity's pending rows down toward `cap`, deleting at most `chunk`
3372
+ * of the oldest per call. Uses the lower of the two cutoffs (cap overflow,
3373
+ * chunk bound); a no-op when at or under cap or when the external-index
3374
+ * marker is set. Without `tx` it opens its own single short transaction.
3375
+ * Returns the number of rows deleted.
3376
+ */
3377
+ trimPendingOverflow(entityId: string, cap: number, chunk: number, tx?: SQLiteAdapter): Promise<number>;
3370
3378
  entitiesWithPending(): Promise<string[]>;
3371
3379
  /**
3372
3380
  * Entities with at least one pending row outside backoff (never attempted,
@@ -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 { 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-hg6O6N-X.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 { 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-hg6O6N-X.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 {