@equationalapplications/core-llm-wiki 4.21.0 → 4.22.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.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { __privateAdd, MetadataRepository, EmbeddingService, SearchService, JobManager, PromptService, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, normalizeSourceRef, normalizeSourceHash, entitySummaryMetaKey, generateId, BaseRepository, emptyManifest, resolveNodeType, validateInlineEdges, resolveEdgeDefinition, normalizeTitleKey, WikiTransactionError, extractSqliteCode } from './chunk-UYLYN5N4.mjs';
2
- export { HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiTransactionError, configureRandomSource, parseEmbedding } from './chunk-UYLYN5N4.mjs';
1
+ import { __privateAdd, MetadataRepository, EmbeddingService, SearchService, JobManager, PromptService, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, normalizeSourceRef, normalizeSourceHash, entitySummaryMetaKey, generateId, BaseRepository, emptyManifest, resolveNodeType, validateInlineEdges, resolveEdgeDefinitions, normalizeTitleKey, WikiTransactionError, extractSqliteCode } from './chunk-LCAU6NYC.mjs';
2
+ export { HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiTransactionError, configureRandomSource, parseEmbedding, validateManifest } from './chunk-LCAU6NYC.mjs';
3
3
  import { appendRelatedSection, buildConceptDocument, buildLogMd, buildEntityIndexMd, buildRootIndexMd, isAllowedOkfPath, parseRootIndexMd, parseEntityIndexMd, parseConcept, splitRelatedSection, extractMarkdownLinks, parseLogMd, parseEventIdComment, appendEventIdComment } from '@equationalapplications/core-okf';
4
4
 
5
5
  // src/db/schema.ts
@@ -1643,7 +1643,8 @@ function mapRowToEdge(row) {
1643
1643
  var FACT_ONTOLOGY_FIELDS = `
1644
1644
  Each fact may optionally include:
1645
1645
  - "okf_type": string \u2014 must be one of the node_types in the manifest
1646
- - "edges": [{ "edge_type": string, "target_title": string }] \u2014 target_title must match another fact's title in this response or existing memory`;
1646
+ - "edges": [{ "edge_type": string, "target_title": string }] \u2014 target_title must match another fact's title in this response or existing memory
1647
+ - An edge_type may appear in the manifest multiple times with different source_type/target_type; use the row whose types match your fact and target.`;
1647
1648
  var EMERGENT_EXTRA = `
1648
1649
  You may also return "ontology_updates" to propose new types:
1649
1650
  "ontology_updates": {
@@ -1728,12 +1729,15 @@ var OntologyService = class {
1728
1729
  if (!sourceType || edges.length === 0) return 0;
1729
1730
  let persisted = 0;
1730
1731
  for (const edge of edges) {
1731
- const def = resolveEdgeDefinition(edge.edge_type, manifest);
1732
- if (!def || def.source_type.toLowerCase() !== sourceType.toLowerCase()) continue;
1732
+ const candidates = resolveEdgeDefinitions(edge.edge_type, manifest).filter((d) => d.source_type.toLowerCase() === sourceType.toLowerCase());
1733
+ if (candidates.length === 0) continue;
1733
1734
  const targetKey = normalizeTitleKey(edge.target_title);
1734
1735
  const target = titleIndex.get(targetKey);
1735
1736
  if (!target) continue;
1736
- if (def.target_type.toLowerCase() !== (target.okf_type ?? "").toLowerCase()) continue;
1737
+ const def = candidates.find(
1738
+ (d) => d.target_type.toLowerCase() === (target.okf_type ?? "").toLowerCase()
1739
+ );
1740
+ if (!def) continue;
1737
1741
  const wikiEdge = {
1738
1742
  id: generateId(),
1739
1743
  entity_id: entityId,