@equationalapplications/core-llm-wiki 4.14.1 → 4.15.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.
@@ -1428,11 +1428,12 @@ var MAX_EMBEDDING_BLOB_BYTES = 32 * 1024;
1428
1428
  var IMPORT_TITLE_MAX = 500;
1429
1429
  var IMPORT_BODY_MAX = 8e3;
1430
1430
  var ImportExportService = class {
1431
- constructor(db, entryRepo, taskRepo, eventRepo, metadataRepo, searchService, jobManager, embeddingService) {
1431
+ constructor(db, entryRepo, taskRepo, eventRepo, edgeRepo, metadataRepo, searchService, jobManager, embeddingService) {
1432
1432
  this.db = db;
1433
1433
  this.entryRepo = entryRepo;
1434
1434
  this.taskRepo = taskRepo;
1435
1435
  this.eventRepo = eventRepo;
1436
+ this.edgeRepo = edgeRepo;
1436
1437
  this.metadataRepo = metadataRepo;
1437
1438
  this.searchService = searchService;
1438
1439
  this.jobManager = jobManager;
@@ -1477,10 +1478,11 @@ var ImportExportService = class {
1477
1478
  }
1478
1479
  }
1479
1480
  async getFullBundle(entityId, opts) {
1480
- const [factsRaw, tasks, events] = await Promise.all([
1481
+ const [factsRaw, tasks, events, edges] = await Promise.all([
1481
1482
  opts?.includeBlobs ? this.entryRepo.findAllByEntityIdWithBlobs(entityId) : this.entryRepo.findAllByEntityId(entityId),
1482
1483
  this.taskRepo.findAllByEntityId(entityId),
1483
- this.eventRepo.getByEntityId(entityId, opts?.maxEvents)
1484
+ this.eventRepo.getByEntityId(entityId, opts?.maxEvents),
1485
+ this.edgeRepo.getByEntityId(entityId)
1484
1486
  ]);
1485
1487
  const facts = factsRaw.map((f) => {
1486
1488
  const {
@@ -1499,7 +1501,7 @@ var ImportExportService = class {
1499
1501
  tags: typeof factBase.tags === "string" ? JSON.parse(factBase.tags) : factBase.tags
1500
1502
  };
1501
1503
  });
1502
- return { facts, tasks, events };
1504
+ return { facts, tasks, events, edges };
1503
1505
  }
1504
1506
  /** Single-entity import transaction + post-processing; package-internal hook for tests. */
1505
1507
  async doImportEntity(entityId, bundle, merge) {
@@ -1521,6 +1523,7 @@ var ImportExportService = class {
1521
1523
  softDeletedFactIds.push(...deletedLiveFactIds);
1522
1524
  await this.entryRepo.bulkSoftDeleteByEntityId(entityId, tx);
1523
1525
  await this.taskRepo.bulkSoftDeleteByEntityId(entityId, tx);
1526
+ await this.edgeRepo.bulkDeleteByEntityId(entityId, tx);
1524
1527
  await this.metadataRepo.deleteCheckpoint(entityId, tx);
1525
1528
  }
1526
1529
  const factIds = bundle.facts.map((fact) => fact.id);
@@ -1618,7 +1621,8 @@ var ImportExportService = class {
1618
1621
  last_accessed_at: fact.last_accessed_at,
1619
1622
  access_count: fact.access_count,
1620
1623
  deleted_at: fact.deleted_at,
1621
- embedding_blob: blobData ?? void 0
1624
+ embedding_blob: blobData ?? void 0,
1625
+ okf_type: fact.okf_type ?? null
1622
1626
  };
1623
1627
  await this.entryRepo.upsertForImport(factObj, tx);
1624
1628
  if (blobData != null) {
@@ -1667,7 +1671,8 @@ var ImportExportService = class {
1667
1671
  created_at: task.created_at,
1668
1672
  updated_at: safeUpdatedAt,
1669
1673
  resolved_at: task.resolved_at,
1670
- deleted_at: task.deleted_at
1674
+ deleted_at: task.deleted_at,
1675
+ okf_type: task.okf_type ?? null
1671
1676
  },
1672
1677
  tx,
1673
1678
  safeUpdatedAt
@@ -1691,6 +1696,19 @@ var ImportExportService = class {
1691
1696
  tx
1692
1697
  );
1693
1698
  }
1699
+ for (const edge of bundle.edges ?? []) {
1700
+ await this.edgeRepo.addIgnoreDuplicate(
1701
+ {
1702
+ id: edge.id,
1703
+ entity_id: entityId,
1704
+ source_id: edge.source_id,
1705
+ target_id: edge.target_id,
1706
+ edge_type: edge.edge_type,
1707
+ created_at: edge.created_at
1708
+ },
1709
+ tx
1710
+ );
1711
+ }
1694
1712
  });
1695
1713
  await this.searchService.sync(entityId);
1696
1714
  for (const fact of bundle.facts) {
@@ -2007,7 +2025,7 @@ var RetrievalService = class {
2007
2025
  const sanitizedTierWeights = shouldExposeReadMetadata(entityId) ? sanitizeTierWeights(entityIds, options?.tierWeights) : void 0;
2008
2026
  const exposeMetadata = shouldExposeReadMetadata(entityId);
2009
2027
  if (entityIds.length === 0) {
2010
- const empty = { facts: [], tasks: [], events: [] };
2028
+ const empty = { facts: [], tasks: [], events: [], edges: [] };
2011
2029
  if (exposeMetadata) {
2012
2030
  empty.metadata = { query, entityIds: [] };
2013
2031
  if (sanitizedTierWeights && Object.keys(sanitizedTierWeights).length > 0) empty.metadata.tierWeights = sanitizedTierWeights;
@@ -2397,7 +2415,7 @@ var RetrievalService = class {
2397
2415
  if (exposeMetadata && trimmedQuery && scoreByFactId) {
2398
2416
  factScores = Object.fromEntries(facts.map((fact) => [fact.id, scoreByFactId.get(fact.id) ?? 0]));
2399
2417
  }
2400
- const bundle = { facts, tasks, events: events.reverse() };
2418
+ const bundle = { facts, tasks, events: events.reverse(), edges: [] };
2401
2419
  if (exposeMetadata) {
2402
2420
  bundle.metadata = { query, entityIds };
2403
2421
  if (sanitizedTierWeights && Object.keys(sanitizedTierWeights).length > 0) bundle.metadata.tierWeights = sanitizedTierWeights;
@@ -2597,5 +2615,5 @@ var WriteService = class {
2597
2615
  };
2598
2616
 
2599
2617
  export { EmbeddingService, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MaintenanceService, PromptService, PrunePartialFailureError, RetrievalService, SearchService, WikiBusyError, WriteService, __privateAdd, __privateGet, __privateSet, generateId, normalizeSourceHash, normalizeSourceRef, parseEmbedding };
2600
- //# sourceMappingURL=chunk-24ANTHZB.mjs.map
2601
- //# sourceMappingURL=chunk-24ANTHZB.mjs.map
2618
+ //# sourceMappingURL=chunk-J4GBC6CP.mjs.map
2619
+ //# sourceMappingURL=chunk-J4GBC6CP.mjs.map