@equationalapplications/core-llm-wiki 4.14.0 → 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.
@@ -22,6 +22,12 @@ interface PromptOverrides {
22
22
  healSystemPrompt?: string;
23
23
  }
24
24
  interface WikiConfig {
25
+ /**
26
+ * Prefix applied to every SQL table/index/trigger name. Must match
27
+ * `^[A-Za-z][A-Za-z0-9_]{0,30}_$` (letter, then alphanumeric/underscore,
28
+ * ending in `_`, max 32 chars total) — enforced in the `WikiMemory` constructor.
29
+ * Default: `'llm_wiki_'`.
30
+ */
25
31
  tablePrefix?: string;
26
32
  maxResults?: number;
27
33
  /** @deprecated Use maxResults */
@@ -117,6 +123,12 @@ interface WikiFact {
117
123
  last_accessed_at: number | null;
118
124
  access_count: number;
119
125
  deleted_at: number | null;
126
+ /**
127
+ * Verbatim OKF `type:` frontmatter value when this fact originated from (or was
128
+ * re-imported via) an OKF bundle. `null`/`undefined` for facts never touched by
129
+ * OKF import. Distinct from `source_type`, which governs immutability rules.
130
+ */
131
+ okf_type?: string | null;
120
132
  }
121
133
  interface WikiTask {
122
134
  id: string;
@@ -128,6 +140,8 @@ interface WikiTask {
128
140
  updated_at: number;
129
141
  resolved_at: number | null;
130
142
  deleted_at: number | null;
143
+ /** Verbatim OKF `type:` frontmatter value when this task originated from an OKF bundle. */
144
+ okf_type?: string | null;
131
145
  }
132
146
  interface WikiEvent {
133
147
  id: string;
@@ -137,6 +151,14 @@ interface WikiEvent {
137
151
  related_entry_id?: string | null;
138
152
  created_at: number;
139
153
  }
154
+ interface WikiEdge {
155
+ id: string;
156
+ entity_id: string;
157
+ source_id: string;
158
+ target_id: string;
159
+ edge_type: string;
160
+ created_at: number;
161
+ }
140
162
  interface WikiCheckpoint {
141
163
  entity_id: string;
142
164
  heal_checkpoint: number;
@@ -303,6 +325,7 @@ interface MemoryBundle {
303
325
  facts: WikiFact[];
304
326
  tasks: WikiTask[];
305
327
  events: WikiEvent[];
328
+ edges?: WikiEdge[];
306
329
  factScores?: Record<string, number>;
307
330
  metadata?: {
308
331
  query: string;
@@ -696,6 +719,13 @@ declare class JobManager {
696
719
  private _forgetKey;
697
720
  private _librarianKey;
698
721
  private _healKey;
722
+ /**
723
+ * Lookup table for acquireLock/releaseLock's dynamic-dispatch branch.
724
+ * Excludes 'ingest' | 'global_reembed' | 'global_import', which those
725
+ * methods already handle via explicit if/else branches before reaching
726
+ * this table.
727
+ */
728
+ private readonly lockKeyFns;
699
729
  private _isReembedActive;
700
730
  private _isImportActiveFor;
701
731
  private _isForgetActiveFor;
@@ -939,16 +969,28 @@ declare class MaintenanceService {
939
969
  private _sanitizeRankerError;
940
970
  }
941
971
 
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
+
942
983
  declare class ImportExportService {
943
984
  private db;
944
985
  private entryRepo;
945
986
  private taskRepo;
946
987
  private eventRepo;
988
+ private edgeRepo;
947
989
  private metadataRepo;
948
990
  private searchService;
949
991
  private jobManager;
950
992
  private embeddingService;
951
- constructor(db: SQLiteAdapter, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService);
993
+ constructor(db: SQLiteAdapter, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, edgeRepo: EdgeRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService);
952
994
  exportDump(entityIds?: string[]): Promise<MemoryDump>;
953
995
  importDump(dump: MemoryDump, opts?: {
954
996
  merge?: boolean;
@@ -1004,11 +1046,12 @@ declare class RetrievalService {
1004
1046
  declare class WriteService {
1005
1047
  private db;
1006
1048
  private options;
1049
+ private entryRepo;
1007
1050
  private eventRepo;
1008
1051
  private metadataRepo;
1009
1052
  private jobManager;
1010
1053
  private maintenanceService;
1011
- constructor(db: SQLiteAdapter, options: WikiOptions, eventRepo: EventRepository, metadataRepo: MetadataRepository, jobManager: JobManager, maintenanceService: MaintenanceService);
1054
+ constructor(db: SQLiteAdapter, options: WikiOptions, entryRepo: EntryRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, jobManager: JobManager, maintenanceService: MaintenanceService);
1012
1055
  write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
1013
1056
  private runLibrarianThenMaybeHeal;
1014
1057
  }
@@ -1036,6 +1079,7 @@ declare class WikiMemory {
1036
1079
  private outboxRepo;
1037
1080
  private taskRepo;
1038
1081
  private eventRepo;
1082
+ private edgeRepo;
1039
1083
  private metadataRepo;
1040
1084
  private embeddingService;
1041
1085
  private searchService;
@@ -1138,4 +1182,4 @@ declare class WikiMemory {
1138
1182
  markOutboxEventsProcessed(eventIds: string[]): Promise<void>;
1139
1183
  }
1140
1184
 
1141
- 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 WikiEvent as o, type WikiFact as p, type WikiMemoryTestAccess as q, type WikiOutboxEvent as r, type WikiTask as s, EmbeddingService as t, IngestionService as u, MaintenanceService as v, RetrievalService as w, SearchService as x, WriteService as y };
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 };
@@ -22,6 +22,12 @@ interface PromptOverrides {
22
22
  healSystemPrompt?: string;
23
23
  }
24
24
  interface WikiConfig {
25
+ /**
26
+ * Prefix applied to every SQL table/index/trigger name. Must match
27
+ * `^[A-Za-z][A-Za-z0-9_]{0,30}_$` (letter, then alphanumeric/underscore,
28
+ * ending in `_`, max 32 chars total) — enforced in the `WikiMemory` constructor.
29
+ * Default: `'llm_wiki_'`.
30
+ */
25
31
  tablePrefix?: string;
26
32
  maxResults?: number;
27
33
  /** @deprecated Use maxResults */
@@ -117,6 +123,12 @@ interface WikiFact {
117
123
  last_accessed_at: number | null;
118
124
  access_count: number;
119
125
  deleted_at: number | null;
126
+ /**
127
+ * Verbatim OKF `type:` frontmatter value when this fact originated from (or was
128
+ * re-imported via) an OKF bundle. `null`/`undefined` for facts never touched by
129
+ * OKF import. Distinct from `source_type`, which governs immutability rules.
130
+ */
131
+ okf_type?: string | null;
120
132
  }
121
133
  interface WikiTask {
122
134
  id: string;
@@ -128,6 +140,8 @@ interface WikiTask {
128
140
  updated_at: number;
129
141
  resolved_at: number | null;
130
142
  deleted_at: number | null;
143
+ /** Verbatim OKF `type:` frontmatter value when this task originated from an OKF bundle. */
144
+ okf_type?: string | null;
131
145
  }
132
146
  interface WikiEvent {
133
147
  id: string;
@@ -137,6 +151,14 @@ interface WikiEvent {
137
151
  related_entry_id?: string | null;
138
152
  created_at: number;
139
153
  }
154
+ interface WikiEdge {
155
+ id: string;
156
+ entity_id: string;
157
+ source_id: string;
158
+ target_id: string;
159
+ edge_type: string;
160
+ created_at: number;
161
+ }
140
162
  interface WikiCheckpoint {
141
163
  entity_id: string;
142
164
  heal_checkpoint: number;
@@ -303,6 +325,7 @@ interface MemoryBundle {
303
325
  facts: WikiFact[];
304
326
  tasks: WikiTask[];
305
327
  events: WikiEvent[];
328
+ edges?: WikiEdge[];
306
329
  factScores?: Record<string, number>;
307
330
  metadata?: {
308
331
  query: string;
@@ -696,6 +719,13 @@ declare class JobManager {
696
719
  private _forgetKey;
697
720
  private _librarianKey;
698
721
  private _healKey;
722
+ /**
723
+ * Lookup table for acquireLock/releaseLock's dynamic-dispatch branch.
724
+ * Excludes 'ingest' | 'global_reembed' | 'global_import', which those
725
+ * methods already handle via explicit if/else branches before reaching
726
+ * this table.
727
+ */
728
+ private readonly lockKeyFns;
699
729
  private _isReembedActive;
700
730
  private _isImportActiveFor;
701
731
  private _isForgetActiveFor;
@@ -939,16 +969,28 @@ declare class MaintenanceService {
939
969
  private _sanitizeRankerError;
940
970
  }
941
971
 
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
+
942
983
  declare class ImportExportService {
943
984
  private db;
944
985
  private entryRepo;
945
986
  private taskRepo;
946
987
  private eventRepo;
988
+ private edgeRepo;
947
989
  private metadataRepo;
948
990
  private searchService;
949
991
  private jobManager;
950
992
  private embeddingService;
951
- constructor(db: SQLiteAdapter, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService);
993
+ constructor(db: SQLiteAdapter, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, edgeRepo: EdgeRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService);
952
994
  exportDump(entityIds?: string[]): Promise<MemoryDump>;
953
995
  importDump(dump: MemoryDump, opts?: {
954
996
  merge?: boolean;
@@ -1004,11 +1046,12 @@ declare class RetrievalService {
1004
1046
  declare class WriteService {
1005
1047
  private db;
1006
1048
  private options;
1049
+ private entryRepo;
1007
1050
  private eventRepo;
1008
1051
  private metadataRepo;
1009
1052
  private jobManager;
1010
1053
  private maintenanceService;
1011
- constructor(db: SQLiteAdapter, options: WikiOptions, eventRepo: EventRepository, metadataRepo: MetadataRepository, jobManager: JobManager, maintenanceService: MaintenanceService);
1054
+ constructor(db: SQLiteAdapter, options: WikiOptions, entryRepo: EntryRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, jobManager: JobManager, maintenanceService: MaintenanceService);
1012
1055
  write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
1013
1056
  private runLibrarianThenMaybeHeal;
1014
1057
  }
@@ -1036,6 +1079,7 @@ declare class WikiMemory {
1036
1079
  private outboxRepo;
1037
1080
  private taskRepo;
1038
1081
  private eventRepo;
1082
+ private edgeRepo;
1039
1083
  private metadataRepo;
1040
1084
  private embeddingService;
1041
1085
  private searchService;
@@ -1138,4 +1182,4 @@ declare class WikiMemory {
1138
1182
  markOutboxEventsProcessed(eventIds: string[]): Promise<void>;
1139
1183
  }
1140
1184
 
1141
- 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 WikiEvent as o, type WikiFact as p, type WikiMemoryTestAccess as q, type WikiOutboxEvent as r, type WikiTask as s, EmbeddingService as t, IngestionService as u, MaintenanceService as v, RetrievalService as w, SearchService as x, WriteService as y };
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 };
@@ -1,2 +1,2 @@
1
- export { t as EmbeddingService, I as ImportExportService, u as IngestionService, J as JobManager, J as JobManagerType, v as MaintenanceService, w as RetrievalService, x as SearchService, x as SearchServiceType, q as WikiMemoryTestAccess, y as WriteService } from './testing-CDIDE4Jd.mjs';
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';
2
2
  import 'minisearch';
package/dist/testing.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { t as EmbeddingService, I as ImportExportService, u as IngestionService, J as JobManager, J as JobManagerType, v as MaintenanceService, w as RetrievalService, x as SearchService, x as SearchServiceType, q as WikiMemoryTestAccess, y as WriteService } from './testing-CDIDE4Jd.js';
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';
2
2
  import 'minisearch';