@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.
@@ -3233,6 +3233,7 @@ var MaintenanceService = class {
3233
3233
  this._validatePruneDuration(retainSoftDeletedFor, "retainSoftDeletedFor");
3234
3234
  this._validatePruneDuration(retainEventsFor, "retainEventsFor");
3235
3235
  const now = Date.now();
3236
+ let syncedIds = [];
3236
3237
  let deletedEntries = 0;
3237
3238
  let deletedTasks = 0;
3238
3239
  let deletedEvents = 0;
@@ -3251,6 +3252,7 @@ var MaintenanceService = class {
3251
3252
  }
3252
3253
  }
3253
3254
  const succeededIds = succeeded.map((r) => r.id);
3255
+ syncedIds = succeededIds;
3254
3256
  await this.db.withTransactionAsync(async (tx) => {
3255
3257
  if (succeededIds.length > 0) {
3256
3258
  deletedEntries = await this.entryRepo.bulkDeletePruned(entityId, cutoff, succeededIds, tx);
@@ -3258,7 +3260,7 @@ var MaintenanceService = class {
3258
3260
  deletedTasks = await this.taskRepo.bulkDeletePruned(entityId, cutoff, tx);
3259
3261
  });
3260
3262
  if (failure) {
3261
- await this.searchService.sync(entityId);
3263
+ await this.searchService.syncEntries(entityId, syncedIds);
3262
3264
  const remaining = entriesToDelete.length - succeeded.length - 1;
3263
3265
  const isTimeout = failure.cause?.[HOOK_TIMEOUT_MARKER] === true;
3264
3266
  if (isTimeout) {
@@ -3292,7 +3294,7 @@ var MaintenanceService = class {
3292
3294
  if (vacuum) {
3293
3295
  await this.metadataRepo.vacuum();
3294
3296
  }
3295
- await this.searchService.sync(entityId);
3297
+ await this.searchService.syncEntries(entityId, syncedIds);
3296
3298
  return { entries: deletedEntries, tasks: deletedTasks, events: deletedEvents };
3297
3299
  } finally {
3298
3300
  this.jobManager.releaseLock("prune", entityId);
@@ -3462,8 +3464,8 @@ var MaintenanceService = class {
3462
3464
  deletedEntries += refResult;
3463
3465
  }
3464
3466
  });
3465
- await this.searchService.sync(entityId);
3466
3467
  const uniqueDeletedIds = Array.from(new Set(deletedEntryIds));
3468
+ await this.searchService.syncEntries(entityId, uniqueDeletedIds);
3467
3469
  for (const factId of uniqueDeletedIds) {
3468
3470
  try {
3469
3471
  await this.embeddingService.notifyEmbeddingPersistedOrThrow(entityId, factId, null);
@@ -3661,7 +3663,7 @@ var MaintenanceService = class {
3661
3663
  }
3662
3664
  });
3663
3665
  diagBuffer.flush(this.options);
3664
- await this.searchService.sync(entityId);
3666
+ await this.searchService.syncEntries(entityId, insertedFacts.map((f) => f.id));
3665
3667
  for (const fact of insertedFacts) {
3666
3668
  await this.embeddingService.embedFact(fact, { operation: "librarian", trigger });
3667
3669
  }
@@ -3719,7 +3721,7 @@ var MaintenanceService = class {
3719
3721
  }
3720
3722
  const healCandidates = await this.entryRepo.findHealCandidatesByEntityId(entityId, batchSize, recheckCutoff);
3721
3723
  if (healCandidates.length === 0) {
3722
- await this.searchService.sync(entityId);
3724
+ await this.searchService.syncEntries(entityId, Array.from(/* @__PURE__ */ new Set([...orphanedIds, ...staleDowngradedIds])));
3723
3725
  this.searchService.evictCache(entityId);
3724
3726
  const counts2 = await this.entryRepo.countHealCandidatesByEntityId(entityId, recheckCutoff);
3725
3727
  return {
@@ -3889,7 +3891,14 @@ var MaintenanceService = class {
3889
3891
  diagBuffer.push({ ...diagBase, code: "heal_skipped", detail: { factId: item.id, reason } });
3890
3892
  }
3891
3893
  diagBuffer.flush(this.options);
3892
- await this.searchService.sync(entityId);
3894
+ const healSyncIds = Array.from(/* @__PURE__ */ new Set([
3895
+ ...orphanedIds,
3896
+ ...staleDowngradedIds,
3897
+ ...safeDowngraded,
3898
+ ...uniqueDeletedFactIds,
3899
+ ...insertedFacts.map((f) => f.id)
3900
+ ]));
3901
+ await this.searchService.syncEntries(entityId, healSyncIds);
3893
3902
  for (const factId of uniqueDeletedFactIds) {
3894
3903
  try {
3895
3904
  await this.embeddingService.notifyEmbeddingPersisted(entityId, factId, null);
@@ -5782,5 +5791,5 @@ var WriteService = class {
5782
5791
  };
5783
5792
 
5784
5793
  export { BaseRepository, DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DiagnosticBuffer, EMBED_CHARS_CEILING, EmbeddingService, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MaintenanceService, MetadataRepository, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, RetrievalService, SearchService, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiParseError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiTransactionError, WriteService, __privateAdd, __privateGet, __privateSet, chunkText, configureRandomSource, edgeTripleAllowed, emptyManifest, entitySummaryMetaKey, extractSqliteCode, generateId, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, parseEmbedding, resolveEdgeDefinitions, resolveGrounding, resolveNodeType, safeSlice, typeSatisfies, validateInlineEdges, validateManifest };
5785
- //# sourceMappingURL=chunk-PBUZLSOM.mjs.map
5786
- //# sourceMappingURL=chunk-PBUZLSOM.mjs.map
5794
+ //# sourceMappingURL=chunk-46X3HO77.mjs.map
5795
+ //# sourceMappingURL=chunk-46X3HO77.mjs.map