@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.js CHANGED
@@ -5757,6 +5757,7 @@ var MaintenanceService = class {
5757
5757
  this._validatePruneDuration(retainSoftDeletedFor, "retainSoftDeletedFor");
5758
5758
  this._validatePruneDuration(retainEventsFor, "retainEventsFor");
5759
5759
  const now = Date.now();
5760
+ let syncedIds = [];
5760
5761
  let deletedEntries = 0;
5761
5762
  let deletedTasks = 0;
5762
5763
  let deletedEvents = 0;
@@ -5775,6 +5776,7 @@ var MaintenanceService = class {
5775
5776
  }
5776
5777
  }
5777
5778
  const succeededIds = succeeded.map((r) => r.id);
5779
+ syncedIds = succeededIds;
5778
5780
  await this.db.withTransactionAsync(async (tx) => {
5779
5781
  if (succeededIds.length > 0) {
5780
5782
  deletedEntries = await this.entryRepo.bulkDeletePruned(entityId, cutoff, succeededIds, tx);
@@ -5782,7 +5784,7 @@ var MaintenanceService = class {
5782
5784
  deletedTasks = await this.taskRepo.bulkDeletePruned(entityId, cutoff, tx);
5783
5785
  });
5784
5786
  if (failure) {
5785
- await this.searchService.sync(entityId);
5787
+ await this.searchService.syncEntries(entityId, syncedIds);
5786
5788
  const remaining = entriesToDelete.length - succeeded.length - 1;
5787
5789
  const isTimeout = failure.cause?.[HOOK_TIMEOUT_MARKER] === true;
5788
5790
  if (isTimeout) {
@@ -5816,7 +5818,7 @@ var MaintenanceService = class {
5816
5818
  if (vacuum) {
5817
5819
  await this.metadataRepo.vacuum();
5818
5820
  }
5819
- await this.searchService.sync(entityId);
5821
+ await this.searchService.syncEntries(entityId, syncedIds);
5820
5822
  return { entries: deletedEntries, tasks: deletedTasks, events: deletedEvents };
5821
5823
  } finally {
5822
5824
  this.jobManager.releaseLock("prune", entityId);
@@ -5986,8 +5988,8 @@ var MaintenanceService = class {
5986
5988
  deletedEntries += refResult;
5987
5989
  }
5988
5990
  });
5989
- await this.searchService.sync(entityId);
5990
5991
  const uniqueDeletedIds = Array.from(new Set(deletedEntryIds));
5992
+ await this.searchService.syncEntries(entityId, uniqueDeletedIds);
5991
5993
  for (const factId of uniqueDeletedIds) {
5992
5994
  try {
5993
5995
  await this.embeddingService.notifyEmbeddingPersistedOrThrow(entityId, factId, null);
@@ -6185,7 +6187,7 @@ var MaintenanceService = class {
6185
6187
  }
6186
6188
  });
6187
6189
  diagBuffer.flush(this.options);
6188
- await this.searchService.sync(entityId);
6190
+ await this.searchService.syncEntries(entityId, insertedFacts.map((f) => f.id));
6189
6191
  for (const fact of insertedFacts) {
6190
6192
  await this.embeddingService.embedFact(fact, { operation: "librarian", trigger });
6191
6193
  }
@@ -6243,7 +6245,7 @@ var MaintenanceService = class {
6243
6245
  }
6244
6246
  const healCandidates = await this.entryRepo.findHealCandidatesByEntityId(entityId, batchSize, recheckCutoff);
6245
6247
  if (healCandidates.length === 0) {
6246
- await this.searchService.sync(entityId);
6248
+ await this.searchService.syncEntries(entityId, Array.from(/* @__PURE__ */ new Set([...orphanedIds, ...staleDowngradedIds])));
6247
6249
  this.searchService.evictCache(entityId);
6248
6250
  const counts2 = await this.entryRepo.countHealCandidatesByEntityId(entityId, recheckCutoff);
6249
6251
  return {
@@ -6413,7 +6415,14 @@ var MaintenanceService = class {
6413
6415
  diagBuffer.push({ ...diagBase, code: "heal_skipped", detail: { factId: item.id, reason } });
6414
6416
  }
6415
6417
  diagBuffer.flush(this.options);
6416
- await this.searchService.sync(entityId);
6418
+ const healSyncIds = Array.from(/* @__PURE__ */ new Set([
6419
+ ...orphanedIds,
6420
+ ...staleDowngradedIds,
6421
+ ...safeDowngraded,
6422
+ ...uniqueDeletedFactIds,
6423
+ ...insertedFacts.map((f) => f.id)
6424
+ ]));
6425
+ await this.searchService.syncEntries(entityId, healSyncIds);
6417
6426
  for (const factId of uniqueDeletedFactIds) {
6418
6427
  try {
6419
6428
  await this.embeddingService.notifyEmbeddingPersisted(entityId, factId, null);