@equationalapplications/core-llm-wiki 4.18.0 → 4.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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-BfxdUHg9.mjs';
2
- export { E as EntityStatus, d as ExtractedFact, e as ExtractedFactEdge, f as ExtractedFactWithOntology, g as ExtractedTask, h as GraphTraversalOptions, H as HOOK_TIMEOUT_MARKER, L as LLMProvider, O as OntologyConfig, i as OntologyEdgeType, j as OntologyManifest, k as OntologyMode, l as OntologyNodeType, m as OntologyPromptContext, n as OntologyUpdates, P as PromptOverrides, o as PromptService, p as PrunePartialFailureError, V as VectorRanker, q as VectorRankerFallback, r as VectorRankerRankArgs, s as VectorRankerSemanticResult, t as WikiBusyError, u as WikiBusyOperation, v as WikiCheckpoint, w as WikiConfig, x as WikiEdge, y as WikiEvent, z as WikiFact, A as WikiMemoryTestAccess, B as WikiOutboxEvent, C as WikiTask } from './testing-BfxdUHg9.mjs';
1
+ import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-DP3lus54.mjs';
2
+ export { E as EntityStatus, d as ExtractedFact, e as ExtractedFactEdge, f as ExtractedFactWithOntology, g as ExtractedTask, h as GraphTraversalOptions, H as HOOK_TIMEOUT_MARKER, L as LLMProvider, O as OntologyConfig, i as OntologyEdgeType, j as OntologyManifest, k as OntologyMode, l as OntologyNodeType, m as OntologyPromptContext, n as OntologyUpdates, P as PromptOverrides, o as PromptService, p as PrunePartialFailureError, V as VectorRanker, q as VectorRankerFallback, r as VectorRankerRankArgs, s as VectorRankerSemanticResult, t as WikiBusyError, u as WikiBusyOperation, v as WikiCheckpoint, w as WikiConfig, x as WikiEdge, y as WikiEvent, z as WikiFact, A as WikiMemoryTestAccess, B as WikiOutboxEvent, C as WikiTask } from './testing-DP3lus54.mjs';
3
3
  import { OkfFile } from '@equationalapplications/core-okf';
4
4
  import 'minisearch';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-BfxdUHg9.js';
2
- export { E as EntityStatus, d as ExtractedFact, e as ExtractedFactEdge, f as ExtractedFactWithOntology, g as ExtractedTask, h as GraphTraversalOptions, H as HOOK_TIMEOUT_MARKER, L as LLMProvider, O as OntologyConfig, i as OntologyEdgeType, j as OntologyManifest, k as OntologyMode, l as OntologyNodeType, m as OntologyPromptContext, n as OntologyUpdates, P as PromptOverrides, o as PromptService, p as PrunePartialFailureError, V as VectorRanker, q as VectorRankerFallback, r as VectorRankerRankArgs, s as VectorRankerSemanticResult, t as WikiBusyError, u as WikiBusyOperation, v as WikiCheckpoint, w as WikiConfig, x as WikiEdge, y as WikiEvent, z as WikiFact, A as WikiMemoryTestAccess, B as WikiOutboxEvent, C as WikiTask } from './testing-BfxdUHg9.js';
1
+ import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-DP3lus54.js';
2
+ export { E as EntityStatus, d as ExtractedFact, e as ExtractedFactEdge, f as ExtractedFactWithOntology, g as ExtractedTask, h as GraphTraversalOptions, H as HOOK_TIMEOUT_MARKER, L as LLMProvider, O as OntologyConfig, i as OntologyEdgeType, j as OntologyManifest, k as OntologyMode, l as OntologyNodeType, m as OntologyPromptContext, n as OntologyUpdates, P as PromptOverrides, o as PromptService, p as PrunePartialFailureError, V as VectorRanker, q as VectorRankerFallback, r as VectorRankerRankArgs, s as VectorRankerSemanticResult, t as WikiBusyError, u as WikiBusyOperation, v as WikiCheckpoint, w as WikiConfig, x as WikiEdge, y as WikiEvent, z as WikiFact, A as WikiMemoryTestAccess, B as WikiOutboxEvent, C as WikiTask } from './testing-DP3lus54.js';
3
3
  import { OkfFile } from '@equationalapplications/core-okf';
4
4
  import 'minisearch';
5
5
 
package/dist/index.js CHANGED
@@ -1643,6 +1643,9 @@ function validateInlineEdges(sourceType, _targetType, edges, manifest) {
1643
1643
  }
1644
1644
 
1645
1645
  // src/repositories/MetadataRepository.ts
1646
+ function entitySummaryMetaKey(entityId) {
1647
+ return `entity_summary:${entityId}`;
1648
+ }
1646
1649
  var MetadataRepository = class extends BaseRepository {
1647
1650
  // CHECKPOINTS TABLE METHODS
1648
1651
  async getCheckpoint(entityId, tx) {
@@ -1701,6 +1704,13 @@ var MetadataRepository = class extends BaseRepository {
1701
1704
  [key, value]
1702
1705
  );
1703
1706
  }
1707
+ async deleteMeta(key, tx) {
1708
+ const executor = this.getExecutor(tx);
1709
+ await executor.runAsync(
1710
+ `DELETE FROM ${this.prefix}meta WHERE key = ?`,
1711
+ [key]
1712
+ );
1713
+ }
1704
1714
  async clearDimensionMismatch(tx) {
1705
1715
  const executor = this.getExecutor(tx);
1706
1716
  await executor.runAsync(
@@ -2994,6 +3004,7 @@ var MaintenanceService = class {
2994
3004
  deletedEntries = await this.entryRepo.bulkSoftDeleteByEntityId(entityId, tx);
2995
3005
  deletedTasks = await this.taskRepo.bulkSoftDeleteByEntityId(entityId, tx);
2996
3006
  await this.metadataRepo.updateCheckpoint(entityId, { memory: 0, heal: 0 }, tx);
3007
+ await this.metadataRepo.deleteMeta(entitySummaryMetaKey(entityId), tx);
2997
3008
  } else {
2998
3009
  const hasIdSelectors = params.entryId !== void 0 || params.taskId !== void 0;
2999
3010
  const hasSourceSelectors = params.sourceRef !== void 0 || params.sourceHash !== void 0;
@@ -3342,11 +3353,12 @@ var ImportExportService = class {
3342
3353
  }
3343
3354
  }
3344
3355
  async getFullBundle(entityId, opts) {
3345
- const [factsRaw, tasks, events, edges] = await Promise.all([
3356
+ const [factsRaw, tasks, events, edges, summaryValue] = await Promise.all([
3346
3357
  opts?.includeBlobs ? this.entryRepo.findAllByEntityIdWithBlobs(entityId) : this.entryRepo.findAllByEntityId(entityId),
3347
3358
  this.taskRepo.findAllByEntityId(entityId),
3348
3359
  this.eventRepo.getByEntityId(entityId, opts?.maxEvents),
3349
- this.edgeRepo.getByEntityId(entityId)
3360
+ this.edgeRepo.getByEntityId(entityId),
3361
+ this.metadataRepo.getMeta(entitySummaryMetaKey(entityId))
3350
3362
  ]);
3351
3363
  const facts = factsRaw.map((f) => {
3352
3364
  const {
@@ -3365,7 +3377,13 @@ var ImportExportService = class {
3365
3377
  tags: typeof factBase.tags === "string" ? JSON.parse(factBase.tags) : factBase.tags
3366
3378
  };
3367
3379
  });
3368
- return { facts, tasks, events, edges };
3380
+ return {
3381
+ facts,
3382
+ tasks,
3383
+ events,
3384
+ edges,
3385
+ ...summaryValue != null ? { summary: summaryValue } : {}
3386
+ };
3369
3387
  }
3370
3388
  /** Single-entity import transaction + post-processing; package-internal hook for tests. */
3371
3389
  async doImportEntity(entityId, bundle, merge) {
@@ -3390,6 +3408,11 @@ var ImportExportService = class {
3390
3408
  await this.edgeRepo.bulkDeleteByEntityId(entityId, tx);
3391
3409
  await this.metadataRepo.deleteCheckpoint(entityId, tx);
3392
3410
  }
3411
+ if (bundle.summary !== void 0) {
3412
+ await this.metadataRepo.setMeta(entitySummaryMetaKey(entityId), bundle.summary, tx);
3413
+ } else if (!merge) {
3414
+ await this.metadataRepo.deleteMeta(entitySummaryMetaKey(entityId), tx);
3415
+ }
3393
3416
  const factIds = bundle.facts.map((fact) => fact.id);
3394
3417
  const existingFactsById = /* @__PURE__ */ new Map();
3395
3418
  const existingFacts = await this.entryRepo.findExistingMetadataByIds(
@@ -4836,6 +4859,10 @@ var WikiMemory = class {
4836
4859
  async exportDump(entityIds) {
4837
4860
  return this.importExportService.exportDump(entityIds);
4838
4861
  }
4862
+ /** Entity summary prose persisted from an OKF profile ≥ 1 import; null when none stored. */
4863
+ async getEntitySummary(entityId) {
4864
+ return this.metadataRepo.getMeta(entitySummaryMetaKey(entityId));
4865
+ }
4839
4866
  async importDump(dump, opts) {
4840
4867
  return this.importExportService.importDump(dump, opts);
4841
4868
  }
@@ -5267,7 +5294,7 @@ function formatOkfBundle(dump) {
5267
5294
  const targetPath = idToConceptPath.get(edge.target_id);
5268
5295
  if (!targetPath) return null;
5269
5296
  return { edge_type: edge.edge_type, path: conceptRelativePath(sourcePath, targetPath) };
5270
- }).filter((link) => link != null).sort((a, b) => a.edge_type.localeCompare(b.edge_type) || a.path.localeCompare(b.path));
5297
+ }).filter((link) => link != null);
5271
5298
  };
5272
5299
  const dir = sanitizeForFilename(entityId);
5273
5300
  const factIdToFilename = new Map(