@equationalapplications/core-llm-wiki 4.15.3 → 4.16.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.
@@ -21,6 +21,54 @@ interface PromptOverrides {
21
21
  librarianSystemPrompt?: string;
22
22
  healSystemPrompt?: string;
23
23
  }
24
+ type OntologyMode = 'strict' | 'emergent' | 'off';
25
+ interface OntologyNodeType {
26
+ type: string;
27
+ description: string;
28
+ }
29
+ interface OntologyEdgeType {
30
+ type: string;
31
+ source_type: string;
32
+ target_type: string;
33
+ description: string;
34
+ }
35
+ /**
36
+ * Allowed node and edge types for an entity's ontology graph.
37
+ * Persisted per entity and injected into librarian/ingest prompts when mode ≠ `off`.
38
+ */
39
+ interface OntologyManifest {
40
+ node_types: OntologyNodeType[];
41
+ edge_types: OntologyEdgeType[];
42
+ }
43
+ /**
44
+ * Global ontology defaults and bootstrap manifests for known entities.
45
+ * Per-entity mode and manifest overrides are stored in SQLite and managed via
46
+ * `WikiMemory.getOntologyManifest` / `setOntologyManifest`.
47
+ */
48
+ interface OntologyConfig {
49
+ /** Global default mode. Default: `'off'` (backward compatible — no typed extraction). */
50
+ mode?: OntologyMode;
51
+ /**
52
+ * Bootstrap manifests for known entities at construction time.
53
+ * Written to the database on first access if no row exists for that entity.
54
+ */
55
+ seedManifests?: Record<string, {
56
+ manifest: OntologyManifest;
57
+ mode?: OntologyMode;
58
+ }>;
59
+ }
60
+ interface ExtractedFactEdge {
61
+ edge_type: string;
62
+ target_title: string;
63
+ }
64
+ interface OntologyUpdates {
65
+ node_types?: OntologyNodeType[];
66
+ edge_types?: OntologyEdgeType[];
67
+ }
68
+ interface OntologyPromptContext {
69
+ ontologyManifest: string;
70
+ ontologyModeInstructions: string;
71
+ }
24
72
  interface WikiConfig {
25
73
  /**
26
74
  * Prefix applied to every SQL table/index/trigger name. Must match
@@ -64,6 +112,7 @@ interface WikiConfig {
64
112
  * @default false
65
113
  */
66
114
  enableOutbox?: boolean;
115
+ ontology?: OntologyConfig;
67
116
  }
68
117
  interface ReadOptions {
69
118
  maxResults?: number;
@@ -170,6 +219,10 @@ interface ExtractedFact {
170
219
  tags: string[];
171
220
  confidence: 'certain' | 'inferred' | 'tentative';
172
221
  }
222
+ interface ExtractedFactWithOntology extends ExtractedFact {
223
+ okf_type?: string;
224
+ edges?: ExtractedFactEdge[];
225
+ }
173
226
  interface ExtractedTask {
174
227
  description: string;
175
228
  priority: number;
@@ -627,6 +680,15 @@ declare class MetadataRepository extends BaseRepository {
627
680
  getTableDdl(tableName: string, tx?: SQLiteAdapter): Promise<string | null>;
628
681
  vacuum(): Promise<void>;
629
682
  getDistinctEntityIds(tx?: SQLiteAdapter): Promise<string[]>;
683
+ getManifest(entityId: string, tx?: SQLiteAdapter): Promise<{
684
+ mode: OntologyMode;
685
+ manifest: OntologyManifest;
686
+ } | null>;
687
+ setManifest(entityId: string, data: {
688
+ mode: OntologyMode;
689
+ manifest: OntologyManifest;
690
+ }, tx: SQLiteAdapter): Promise<void>;
691
+ mergeManifestUpdates(entityId: string, updates: OntologyUpdates, tx: SQLiteAdapter): Promise<OntologyManifest>;
630
692
  }
631
693
 
632
694
  interface ScoredRow {
@@ -778,15 +840,58 @@ declare class EmbeddingService {
778
840
  notifyEmbeddingPersistedOrThrow(entityId: string, factId: string, vector: Float32Array | null): Promise<void>;
779
841
  }
780
842
 
843
+ declare class EdgeRepository extends BaseRepository {
844
+ /**
845
+ * Insert an edge, silently skipping on primary-key or uniqueness conflicts.
846
+ * Throws when the insert was skipped due to an id collision with a different edge tuple.
847
+ */
848
+ addIgnoreDuplicate(edge: WikiEdge, tx?: SQLiteAdapter): Promise<void>;
849
+ getByEntityId(entityId: string, tx?: SQLiteAdapter): Promise<WikiEdge[]>;
850
+ /** Hard delete — edges have no soft-delete concept, only presence/absence. `tx` is REQUIRED. */
851
+ bulkDeleteByEntityId(entityId: string, tx: SQLiteAdapter): Promise<void>;
852
+ }
853
+
854
+ type TitleIndexEntry = {
855
+ id: string;
856
+ okf_type: string | null;
857
+ };
858
+ /**
859
+ * Coordinates ontology mode resolution, manifest caching, LLM output validation, and edge persistence.
860
+ * Cache is per WikiMemory instance (single-process); not shared across instances.
861
+ */
862
+ declare class OntologyService {
863
+ private metadataRepo;
864
+ private edgeRepo;
865
+ private ontologyConfig?;
866
+ private cache;
867
+ constructor(metadataRepo: MetadataRepository, edgeRepo: EdgeRepository, ontologyConfig?: OntologyConfig | undefined);
868
+ resolveMode(storedMode?: OntologyMode): OntologyMode;
869
+ invalidateCache(entityId: string): void;
870
+ getEffectiveState(entityId: string, tx?: SQLiteAdapter): Promise<{
871
+ mode: OntologyMode;
872
+ manifest: OntologyManifest;
873
+ }>;
874
+ buildPromptContext(entityId: string): Promise<OntologyPromptContext | null>;
875
+ mergeEmergentUpdates(entityId: string, updates: OntologyUpdates, tx: SQLiteAdapter): Promise<OntologyManifest>;
876
+ validateAndNormalizeFact(fact: ExtractedFactWithOntology, manifest: OntologyManifest): {
877
+ okf_type: string | null;
878
+ edges: ExtractedFactEdge[];
879
+ };
880
+ resolveAndPersistEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, tx: SQLiteAdapter, now: number): Promise<void>;
881
+ }
882
+
781
883
  declare class PromptService {
782
884
  private globalOverrides?;
783
885
  constructor(globalOverrides?: PromptOverrides | undefined);
784
886
  private hydrate;
785
- buildIngestPrompt(documentChunk: string, runtimeOverride?: string): {
887
+ private hasOntologyPlaceholders;
888
+ private buildSystemPrompt;
889
+ private appendOntology;
890
+ buildIngestPrompt(documentChunk: string, runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
786
891
  systemPrompt: string;
787
892
  userPrompt: string;
788
893
  };
789
- buildLibrarianPrompt(events: unknown[], currentFacts: unknown[], runtimeOverride?: string): {
894
+ buildLibrarianPrompt(events: unknown[], currentFacts: unknown[], runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
790
895
  systemPrompt: string;
791
896
  userPrompt: string;
792
897
  };
@@ -804,8 +909,9 @@ declare class IngestionService {
804
909
  private searchService;
805
910
  private jobManager;
806
911
  private embeddingService;
912
+ private ontologyService?;
807
913
  private promptService;
808
- constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService);
914
+ constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService, ontologyService?: OntologyService | undefined);
809
915
  ingestDocument(entityId: string, params: {
810
916
  sourceRef: string;
811
917
  sourceHash: string;
@@ -924,8 +1030,9 @@ declare class MaintenanceService {
924
1030
  private searchService;
925
1031
  private jobManager;
926
1032
  private embeddingService;
1033
+ private ontologyService?;
927
1034
  private promptService;
928
- constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService);
1035
+ constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService, ontologyService?: OntologyService | undefined);
929
1036
  runPrune(entityId: string, options?: {
930
1037
  retainSoftDeletedFor?: number | null;
931
1038
  retainEventsFor?: number | null;
@@ -969,17 +1076,6 @@ declare class MaintenanceService {
969
1076
  private _sanitizeRankerError;
970
1077
  }
971
1078
 
972
- declare class EdgeRepository extends BaseRepository {
973
- /**
974
- * Insert an edge, silently skipping on primary-key or uniqueness conflicts.
975
- * Throws when the insert was skipped due to an id collision with a different edge tuple.
976
- */
977
- addIgnoreDuplicate(edge: WikiEdge, tx?: SQLiteAdapter): Promise<void>;
978
- getByEntityId(entityId: string, tx?: SQLiteAdapter): Promise<WikiEdge[]>;
979
- /** Hard delete — edges have no soft-delete concept, only presence/absence. `tx` is REQUIRED. */
980
- bulkDeleteByEntityId(entityId: string, tx: SQLiteAdapter): Promise<void>;
981
- }
982
-
983
1079
  declare class ImportExportService {
984
1080
  private db;
985
1081
  private entryRepo;
@@ -1090,6 +1186,7 @@ declare class WikiMemory {
1090
1186
  private retrievalService;
1091
1187
  private writeService;
1092
1188
  private promptService;
1189
+ private ontologyService;
1093
1190
  constructor(db: SQLiteAdapter, options: WikiOptions);
1094
1191
  /**
1095
1192
  * Explicit escape hatch for test suites: typed access to composed services for mocks/spies.
@@ -1180,6 +1277,22 @@ declare class WikiMemory {
1180
1277
  * Call after successfully committing events to the external system.
1181
1278
  */
1182
1279
  markOutboxEventsProcessed(eventIds: string[]): Promise<void>;
1280
+ /**
1281
+ * Returns the effective ontology mode and manifest for an entity.
1282
+ * Resolution order: persisted DB row → `WikiConfig.ontology.seedManifests[entityId]` → `null`.
1283
+ */
1284
+ getOntologyManifest(entityId: string): Promise<{
1285
+ mode: OntologyMode;
1286
+ manifest: OntologyManifest;
1287
+ } | null>;
1288
+ /**
1289
+ * Seeds or replaces an entity's ontology manifest and optional mode override.
1290
+ * Validates manifest invariants (unique type slugs, edge endpoints reference node types).
1291
+ * Invalidates the in-memory ontology cache for this entity.
1292
+ */
1293
+ setOntologyManifest(entityId: string, manifest: OntologyManifest, options?: {
1294
+ mode?: OntologyMode;
1295
+ }): Promise<void>;
1183
1296
  }
1184
1297
 
1185
- export { type EntityStatus as E, type FormatContextOptions as F, HOOK_TIMEOUT_MARKER as H, ImportExportService as I, JobManager as J, type LLMProvider as L, type MemoryBundle as M, type PromptOverrides as P, type ReadOptions as R, type SQLiteAdapter as S, type VectorRanker as V, type WikiOptions as W, type MemoryDump as a, type FormattedMemoryDump as b, WikiMemory as c, type ExtractedFact as d, type ExtractedTask as e, PromptService as f, PrunePartialFailureError as g, type VectorRankerFallback as h, type VectorRankerRankArgs as i, type VectorRankerSemanticResult as j, WikiBusyError as k, type WikiBusyOperation as l, type WikiCheckpoint as m, type WikiConfig as n, type WikiEdge as o, type WikiEvent as p, type WikiFact as q, type WikiMemoryTestAccess as r, type WikiOutboxEvent as s, type WikiTask as t, EmbeddingService as u, IngestionService as v, MaintenanceService as w, RetrievalService as x, SearchService as y, WriteService as z };
1298
+ export { type WikiOutboxEvent as A, type WikiTask as B, EmbeddingService as C, IngestionService as D, type EntityStatus as E, type FormatContextOptions as F, MaintenanceService as G, HOOK_TIMEOUT_MARKER as H, ImportExportService as I, JobManager as J, RetrievalService as K, type LLMProvider as L, type MemoryBundle as M, SearchService as N, type OntologyConfig as O, type PromptOverrides as P, WriteService as Q, type ReadOptions as R, type SQLiteAdapter as S, type VectorRanker as V, type WikiOptions as W, type MemoryDump as a, type FormattedMemoryDump as b, WikiMemory as c, type ExtractedFact as d, type ExtractedFactEdge as e, type ExtractedFactWithOntology as f, type ExtractedTask as g, type OntologyEdgeType as h, type OntologyManifest as i, type OntologyMode as j, type OntologyNodeType as k, type OntologyPromptContext as l, type OntologyUpdates as m, PromptService as n, PrunePartialFailureError as o, type VectorRankerFallback as p, type VectorRankerRankArgs as q, type VectorRankerSemanticResult as r, WikiBusyError as s, type WikiBusyOperation as t, type WikiCheckpoint as u, type WikiConfig as v, type WikiEdge as w, type WikiEvent as x, type WikiFact as y, type WikiMemoryTestAccess as z };
@@ -21,6 +21,54 @@ interface PromptOverrides {
21
21
  librarianSystemPrompt?: string;
22
22
  healSystemPrompt?: string;
23
23
  }
24
+ type OntologyMode = 'strict' | 'emergent' | 'off';
25
+ interface OntologyNodeType {
26
+ type: string;
27
+ description: string;
28
+ }
29
+ interface OntologyEdgeType {
30
+ type: string;
31
+ source_type: string;
32
+ target_type: string;
33
+ description: string;
34
+ }
35
+ /**
36
+ * Allowed node and edge types for an entity's ontology graph.
37
+ * Persisted per entity and injected into librarian/ingest prompts when mode ≠ `off`.
38
+ */
39
+ interface OntologyManifest {
40
+ node_types: OntologyNodeType[];
41
+ edge_types: OntologyEdgeType[];
42
+ }
43
+ /**
44
+ * Global ontology defaults and bootstrap manifests for known entities.
45
+ * Per-entity mode and manifest overrides are stored in SQLite and managed via
46
+ * `WikiMemory.getOntologyManifest` / `setOntologyManifest`.
47
+ */
48
+ interface OntologyConfig {
49
+ /** Global default mode. Default: `'off'` (backward compatible — no typed extraction). */
50
+ mode?: OntologyMode;
51
+ /**
52
+ * Bootstrap manifests for known entities at construction time.
53
+ * Written to the database on first access if no row exists for that entity.
54
+ */
55
+ seedManifests?: Record<string, {
56
+ manifest: OntologyManifest;
57
+ mode?: OntologyMode;
58
+ }>;
59
+ }
60
+ interface ExtractedFactEdge {
61
+ edge_type: string;
62
+ target_title: string;
63
+ }
64
+ interface OntologyUpdates {
65
+ node_types?: OntologyNodeType[];
66
+ edge_types?: OntologyEdgeType[];
67
+ }
68
+ interface OntologyPromptContext {
69
+ ontologyManifest: string;
70
+ ontologyModeInstructions: string;
71
+ }
24
72
  interface WikiConfig {
25
73
  /**
26
74
  * Prefix applied to every SQL table/index/trigger name. Must match
@@ -64,6 +112,7 @@ interface WikiConfig {
64
112
  * @default false
65
113
  */
66
114
  enableOutbox?: boolean;
115
+ ontology?: OntologyConfig;
67
116
  }
68
117
  interface ReadOptions {
69
118
  maxResults?: number;
@@ -170,6 +219,10 @@ interface ExtractedFact {
170
219
  tags: string[];
171
220
  confidence: 'certain' | 'inferred' | 'tentative';
172
221
  }
222
+ interface ExtractedFactWithOntology extends ExtractedFact {
223
+ okf_type?: string;
224
+ edges?: ExtractedFactEdge[];
225
+ }
173
226
  interface ExtractedTask {
174
227
  description: string;
175
228
  priority: number;
@@ -627,6 +680,15 @@ declare class MetadataRepository extends BaseRepository {
627
680
  getTableDdl(tableName: string, tx?: SQLiteAdapter): Promise<string | null>;
628
681
  vacuum(): Promise<void>;
629
682
  getDistinctEntityIds(tx?: SQLiteAdapter): Promise<string[]>;
683
+ getManifest(entityId: string, tx?: SQLiteAdapter): Promise<{
684
+ mode: OntologyMode;
685
+ manifest: OntologyManifest;
686
+ } | null>;
687
+ setManifest(entityId: string, data: {
688
+ mode: OntologyMode;
689
+ manifest: OntologyManifest;
690
+ }, tx: SQLiteAdapter): Promise<void>;
691
+ mergeManifestUpdates(entityId: string, updates: OntologyUpdates, tx: SQLiteAdapter): Promise<OntologyManifest>;
630
692
  }
631
693
 
632
694
  interface ScoredRow {
@@ -778,15 +840,58 @@ declare class EmbeddingService {
778
840
  notifyEmbeddingPersistedOrThrow(entityId: string, factId: string, vector: Float32Array | null): Promise<void>;
779
841
  }
780
842
 
843
+ declare class EdgeRepository extends BaseRepository {
844
+ /**
845
+ * Insert an edge, silently skipping on primary-key or uniqueness conflicts.
846
+ * Throws when the insert was skipped due to an id collision with a different edge tuple.
847
+ */
848
+ addIgnoreDuplicate(edge: WikiEdge, tx?: SQLiteAdapter): Promise<void>;
849
+ getByEntityId(entityId: string, tx?: SQLiteAdapter): Promise<WikiEdge[]>;
850
+ /** Hard delete — edges have no soft-delete concept, only presence/absence. `tx` is REQUIRED. */
851
+ bulkDeleteByEntityId(entityId: string, tx: SQLiteAdapter): Promise<void>;
852
+ }
853
+
854
+ type TitleIndexEntry = {
855
+ id: string;
856
+ okf_type: string | null;
857
+ };
858
+ /**
859
+ * Coordinates ontology mode resolution, manifest caching, LLM output validation, and edge persistence.
860
+ * Cache is per WikiMemory instance (single-process); not shared across instances.
861
+ */
862
+ declare class OntologyService {
863
+ private metadataRepo;
864
+ private edgeRepo;
865
+ private ontologyConfig?;
866
+ private cache;
867
+ constructor(metadataRepo: MetadataRepository, edgeRepo: EdgeRepository, ontologyConfig?: OntologyConfig | undefined);
868
+ resolveMode(storedMode?: OntologyMode): OntologyMode;
869
+ invalidateCache(entityId: string): void;
870
+ getEffectiveState(entityId: string, tx?: SQLiteAdapter): Promise<{
871
+ mode: OntologyMode;
872
+ manifest: OntologyManifest;
873
+ }>;
874
+ buildPromptContext(entityId: string): Promise<OntologyPromptContext | null>;
875
+ mergeEmergentUpdates(entityId: string, updates: OntologyUpdates, tx: SQLiteAdapter): Promise<OntologyManifest>;
876
+ validateAndNormalizeFact(fact: ExtractedFactWithOntology, manifest: OntologyManifest): {
877
+ okf_type: string | null;
878
+ edges: ExtractedFactEdge[];
879
+ };
880
+ resolveAndPersistEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, tx: SQLiteAdapter, now: number): Promise<void>;
881
+ }
882
+
781
883
  declare class PromptService {
782
884
  private globalOverrides?;
783
885
  constructor(globalOverrides?: PromptOverrides | undefined);
784
886
  private hydrate;
785
- buildIngestPrompt(documentChunk: string, runtimeOverride?: string): {
887
+ private hasOntologyPlaceholders;
888
+ private buildSystemPrompt;
889
+ private appendOntology;
890
+ buildIngestPrompt(documentChunk: string, runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
786
891
  systemPrompt: string;
787
892
  userPrompt: string;
788
893
  };
789
- buildLibrarianPrompt(events: unknown[], currentFacts: unknown[], runtimeOverride?: string): {
894
+ buildLibrarianPrompt(events: unknown[], currentFacts: unknown[], runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
790
895
  systemPrompt: string;
791
896
  userPrompt: string;
792
897
  };
@@ -804,8 +909,9 @@ declare class IngestionService {
804
909
  private searchService;
805
910
  private jobManager;
806
911
  private embeddingService;
912
+ private ontologyService?;
807
913
  private promptService;
808
- constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService);
914
+ constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService, ontologyService?: OntologyService | undefined);
809
915
  ingestDocument(entityId: string, params: {
810
916
  sourceRef: string;
811
917
  sourceHash: string;
@@ -924,8 +1030,9 @@ declare class MaintenanceService {
924
1030
  private searchService;
925
1031
  private jobManager;
926
1032
  private embeddingService;
1033
+ private ontologyService?;
927
1034
  private promptService;
928
- constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService);
1035
+ constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService, ontologyService?: OntologyService | undefined);
929
1036
  runPrune(entityId: string, options?: {
930
1037
  retainSoftDeletedFor?: number | null;
931
1038
  retainEventsFor?: number | null;
@@ -969,17 +1076,6 @@ declare class MaintenanceService {
969
1076
  private _sanitizeRankerError;
970
1077
  }
971
1078
 
972
- declare class EdgeRepository extends BaseRepository {
973
- /**
974
- * Insert an edge, silently skipping on primary-key or uniqueness conflicts.
975
- * Throws when the insert was skipped due to an id collision with a different edge tuple.
976
- */
977
- addIgnoreDuplicate(edge: WikiEdge, tx?: SQLiteAdapter): Promise<void>;
978
- getByEntityId(entityId: string, tx?: SQLiteAdapter): Promise<WikiEdge[]>;
979
- /** Hard delete — edges have no soft-delete concept, only presence/absence. `tx` is REQUIRED. */
980
- bulkDeleteByEntityId(entityId: string, tx: SQLiteAdapter): Promise<void>;
981
- }
982
-
983
1079
  declare class ImportExportService {
984
1080
  private db;
985
1081
  private entryRepo;
@@ -1090,6 +1186,7 @@ declare class WikiMemory {
1090
1186
  private retrievalService;
1091
1187
  private writeService;
1092
1188
  private promptService;
1189
+ private ontologyService;
1093
1190
  constructor(db: SQLiteAdapter, options: WikiOptions);
1094
1191
  /**
1095
1192
  * Explicit escape hatch for test suites: typed access to composed services for mocks/spies.
@@ -1180,6 +1277,22 @@ declare class WikiMemory {
1180
1277
  * Call after successfully committing events to the external system.
1181
1278
  */
1182
1279
  markOutboxEventsProcessed(eventIds: string[]): Promise<void>;
1280
+ /**
1281
+ * Returns the effective ontology mode and manifest for an entity.
1282
+ * Resolution order: persisted DB row → `WikiConfig.ontology.seedManifests[entityId]` → `null`.
1283
+ */
1284
+ getOntologyManifest(entityId: string): Promise<{
1285
+ mode: OntologyMode;
1286
+ manifest: OntologyManifest;
1287
+ } | null>;
1288
+ /**
1289
+ * Seeds or replaces an entity's ontology manifest and optional mode override.
1290
+ * Validates manifest invariants (unique type slugs, edge endpoints reference node types).
1291
+ * Invalidates the in-memory ontology cache for this entity.
1292
+ */
1293
+ setOntologyManifest(entityId: string, manifest: OntologyManifest, options?: {
1294
+ mode?: OntologyMode;
1295
+ }): Promise<void>;
1183
1296
  }
1184
1297
 
1185
- export { type EntityStatus as E, type FormatContextOptions as F, HOOK_TIMEOUT_MARKER as H, ImportExportService as I, JobManager as J, type LLMProvider as L, type MemoryBundle as M, type PromptOverrides as P, type ReadOptions as R, type SQLiteAdapter as S, type VectorRanker as V, type WikiOptions as W, type MemoryDump as a, type FormattedMemoryDump as b, WikiMemory as c, type ExtractedFact as d, type ExtractedTask as e, PromptService as f, PrunePartialFailureError as g, type VectorRankerFallback as h, type VectorRankerRankArgs as i, type VectorRankerSemanticResult as j, WikiBusyError as k, type WikiBusyOperation as l, type WikiCheckpoint as m, type WikiConfig as n, type WikiEdge as o, type WikiEvent as p, type WikiFact as q, type WikiMemoryTestAccess as r, type WikiOutboxEvent as s, type WikiTask as t, EmbeddingService as u, IngestionService as v, MaintenanceService as w, RetrievalService as x, SearchService as y, WriteService as z };
1298
+ export { type WikiOutboxEvent as A, type WikiTask as B, EmbeddingService as C, IngestionService as D, type EntityStatus as E, type FormatContextOptions as F, MaintenanceService as G, HOOK_TIMEOUT_MARKER as H, ImportExportService as I, JobManager as J, RetrievalService as K, type LLMProvider as L, type MemoryBundle as M, SearchService as N, type OntologyConfig as O, type PromptOverrides as P, WriteService as Q, type ReadOptions as R, type SQLiteAdapter as S, type VectorRanker as V, type WikiOptions as W, type MemoryDump as a, type FormattedMemoryDump as b, WikiMemory as c, type ExtractedFact as d, type ExtractedFactEdge as e, type ExtractedFactWithOntology as f, type ExtractedTask as g, type OntologyEdgeType as h, type OntologyManifest as i, type OntologyMode as j, type OntologyNodeType as k, type OntologyPromptContext as l, type OntologyUpdates as m, PromptService as n, PrunePartialFailureError as o, type VectorRankerFallback as p, type VectorRankerRankArgs as q, type VectorRankerSemanticResult as r, WikiBusyError as s, type WikiBusyOperation as t, type WikiCheckpoint as u, type WikiConfig as v, type WikiEdge as w, type WikiEvent as x, type WikiFact as y, type WikiMemoryTestAccess as z };
@@ -1,2 +1,2 @@
1
- export { u as EmbeddingService, I as ImportExportService, v as IngestionService, J as JobManager, J as JobManagerType, w as MaintenanceService, x as RetrievalService, y as SearchService, y as SearchServiceType, r as WikiMemoryTestAccess, z as WriteService } from './testing-NH1_Aigh.mjs';
1
+ export { C as EmbeddingService, I as ImportExportService, D as IngestionService, J as JobManager, J as JobManagerType, G as MaintenanceService, K as RetrievalService, N as SearchService, N as SearchServiceType, z as WikiMemoryTestAccess, Q as WriteService } from './testing-BMsplvLy.mjs';
2
2
  import 'minisearch';
package/dist/testing.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { u as EmbeddingService, I as ImportExportService, v as IngestionService, J as JobManager, J as JobManagerType, w as MaintenanceService, x as RetrievalService, y as SearchService, y as SearchServiceType, r as WikiMemoryTestAccess, z as WriteService } from './testing-NH1_Aigh.js';
1
+ export { C as EmbeddingService, I as ImportExportService, D as IngestionService, J as JobManager, J as JobManagerType, G as MaintenanceService, K as RetrievalService, N as SearchService, N as SearchServiceType, z as WikiMemoryTestAccess, Q as WriteService } from './testing-BMsplvLy.js';
2
2
  import 'minisearch';