@equationalapplications/core-llm-wiki 7.7.6 → 7.7.7

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, __privateAdd, MetadataRepository, EmbeddingService, SearchService, JobManager, PromptService, resolveGrounding, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, normalizeSourceRef, normalizeSourceHash, entitySummaryMetaKey, WikiSourceRefHashCollision, DiagnosticBuffer, validateManifest, WikiDraftNotFound, generateId, emptyManifest, resolveNodeType, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, typeSatisfies, normalizeTitleKey, edgeTripleAllowed, WikiTransactionError, extractSqliteCode } from './chunk-PBUZLSOM.mjs';
2
- export { DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, EMBED_CHARS_CEILING, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiParseError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiTransactionError, chunkText, configureRandomSource, parseEmbedding, safeSlice, validateManifest } from './chunk-PBUZLSOM.mjs';
1
+ import { BaseRepository, WikiGraphNodeOwnershipConflict, __privateAdd, MetadataRepository, EmbeddingService, SearchService, JobManager, PromptService, resolveGrounding, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, normalizeSourceRef, normalizeSourceHash, entitySummaryMetaKey, WikiSourceRefHashCollision, DiagnosticBuffer, validateManifest, WikiDraftNotFound, generateId, emptyManifest, resolveNodeType, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, typeSatisfies, normalizeTitleKey, edgeTripleAllowed, WikiTransactionError, extractSqliteCode } from './chunk-46X3HO77.mjs';
2
+ export { DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, EMBED_CHARS_CEILING, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiParseError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiTransactionError, chunkText, configureRandomSource, parseEmbedding, safeSlice, validateManifest } from './chunk-46X3HO77.mjs';
3
3
  import { deriveTrustTier, isStaleAfter, appendRelatedSection, buildConceptDocument, buildLogMd, buildEntityIndexMd, buildRootIndexMd, isAllowedOkfPath, parseRootIndexMd, parseEntityIndexMd, parseConcept, splitRelatedSection, extractMarkdownLinks, parseLogMd, parseEventIdComment, latestVerified, formatSourcesJson, appendEventIdComment, parseVerifiedFlexible, parseCitationsList } from '@equationalapplications/core-okf';
4
4
 
5
5
  // src/db/schema.ts
package/dist/testing.js CHANGED
@@ -2772,6 +2772,7 @@ var MaintenanceService = class {
2772
2772
  this._validatePruneDuration(retainSoftDeletedFor, "retainSoftDeletedFor");
2773
2773
  this._validatePruneDuration(retainEventsFor, "retainEventsFor");
2774
2774
  const now = Date.now();
2775
+ let syncedIds = [];
2775
2776
  let deletedEntries = 0;
2776
2777
  let deletedTasks = 0;
2777
2778
  let deletedEvents = 0;
@@ -2790,6 +2791,7 @@ var MaintenanceService = class {
2790
2791
  }
2791
2792
  }
2792
2793
  const succeededIds = succeeded.map((r) => r.id);
2794
+ syncedIds = succeededIds;
2793
2795
  await this.db.withTransactionAsync(async (tx) => {
2794
2796
  if (succeededIds.length > 0) {
2795
2797
  deletedEntries = await this.entryRepo.bulkDeletePruned(entityId, cutoff, succeededIds, tx);
@@ -2797,7 +2799,7 @@ var MaintenanceService = class {
2797
2799
  deletedTasks = await this.taskRepo.bulkDeletePruned(entityId, cutoff, tx);
2798
2800
  });
2799
2801
  if (failure) {
2800
- await this.searchService.sync(entityId);
2802
+ await this.searchService.syncEntries(entityId, syncedIds);
2801
2803
  const remaining = entriesToDelete.length - succeeded.length - 1;
2802
2804
  const isTimeout = failure.cause?.[HOOK_TIMEOUT_MARKER] === true;
2803
2805
  if (isTimeout) {
@@ -2831,7 +2833,7 @@ var MaintenanceService = class {
2831
2833
  if (vacuum) {
2832
2834
  await this.metadataRepo.vacuum();
2833
2835
  }
2834
- await this.searchService.sync(entityId);
2836
+ await this.searchService.syncEntries(entityId, syncedIds);
2835
2837
  return { entries: deletedEntries, tasks: deletedTasks, events: deletedEvents };
2836
2838
  } finally {
2837
2839
  this.jobManager.releaseLock("prune", entityId);
@@ -3001,8 +3003,8 @@ var MaintenanceService = class {
3001
3003
  deletedEntries += refResult;
3002
3004
  }
3003
3005
  });
3004
- await this.searchService.sync(entityId);
3005
3006
  const uniqueDeletedIds = Array.from(new Set(deletedEntryIds));
3007
+ await this.searchService.syncEntries(entityId, uniqueDeletedIds);
3006
3008
  for (const factId of uniqueDeletedIds) {
3007
3009
  try {
3008
3010
  await this.embeddingService.notifyEmbeddingPersistedOrThrow(entityId, factId, null);
@@ -3200,7 +3202,7 @@ var MaintenanceService = class {
3200
3202
  }
3201
3203
  });
3202
3204
  diagBuffer.flush(this.options);
3203
- await this.searchService.sync(entityId);
3205
+ await this.searchService.syncEntries(entityId, insertedFacts.map((f) => f.id));
3204
3206
  for (const fact of insertedFacts) {
3205
3207
  await this.embeddingService.embedFact(fact, { operation: "librarian", trigger });
3206
3208
  }
@@ -3258,7 +3260,7 @@ var MaintenanceService = class {
3258
3260
  }
3259
3261
  const healCandidates = await this.entryRepo.findHealCandidatesByEntityId(entityId, batchSize, recheckCutoff);
3260
3262
  if (healCandidates.length === 0) {
3261
- await this.searchService.sync(entityId);
3263
+ await this.searchService.syncEntries(entityId, Array.from(/* @__PURE__ */ new Set([...orphanedIds, ...staleDowngradedIds])));
3262
3264
  this.searchService.evictCache(entityId);
3263
3265
  const counts2 = await this.entryRepo.countHealCandidatesByEntityId(entityId, recheckCutoff);
3264
3266
  return {
@@ -3428,7 +3430,14 @@ var MaintenanceService = class {
3428
3430
  diagBuffer.push({ ...diagBase, code: "heal_skipped", detail: { factId: item.id, reason } });
3429
3431
  }
3430
3432
  diagBuffer.flush(this.options);
3431
- await this.searchService.sync(entityId);
3433
+ const healSyncIds = Array.from(/* @__PURE__ */ new Set([
3434
+ ...orphanedIds,
3435
+ ...staleDowngradedIds,
3436
+ ...safeDowngraded,
3437
+ ...uniqueDeletedFactIds,
3438
+ ...insertedFacts.map((f) => f.id)
3439
+ ]));
3440
+ await this.searchService.syncEntries(entityId, healSyncIds);
3432
3441
  for (const factId of uniqueDeletedFactIds) {
3433
3442
  try {
3434
3443
  await this.embeddingService.notifyEmbeddingPersisted(entityId, factId, null);