@equationalapplications/core-llm-wiki 4.14.0 → 4.14.1

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, EmbeddingService, SearchService, JobManager, PromptService, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, normalizeSourceRef, normalizeSourceHash, generateId } from './chunk-6FWG2DG4.mjs';
2
- export { HOOK_TIMEOUT_MARKER, PromptService, PrunePartialFailureError, WikiBusyError, parseEmbedding } from './chunk-6FWG2DG4.mjs';
1
+ import { __privateAdd, EmbeddingService, SearchService, JobManager, PromptService, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, normalizeSourceRef, normalizeSourceHash, generateId } from './chunk-24ANTHZB.mjs';
2
+ export { HOOK_TIMEOUT_MARKER, PromptService, PrunePartialFailureError, WikiBusyError, parseEmbedding } from './chunk-24ANTHZB.mjs';
3
3
  import { buildConceptDocument, buildLogMd, buildIndexMd, buildRootIndexMd } from '@equationalapplications/core-okf';
4
4
 
5
5
  // src/db/schema.ts
@@ -1410,6 +1410,7 @@ var MetadataRepository = class extends BaseRepository {
1410
1410
  };
1411
1411
 
1412
1412
  // src/WikiMemory.ts
1413
+ var TABLE_PREFIX_PATTERN = /^[A-Za-z][A-Za-z0-9_]{0,30}_$/;
1413
1414
  var _testAccessNonTestEnvWarned;
1414
1415
  var WikiMemory = class {
1415
1416
  constructor(db, options) {
@@ -1417,7 +1418,12 @@ var WikiMemory = class {
1417
1418
  __privateAdd(this, _testAccessNonTestEnvWarned, false);
1418
1419
  this.db = db;
1419
1420
  this.options = options;
1420
- this.prefix = options.config?.tablePrefix || "llm_wiki_";
1421
+ this.prefix = options.config?.tablePrefix ?? "llm_wiki_";
1422
+ if (!TABLE_PREFIX_PATTERN.test(this.prefix)) {
1423
+ throw new Error(
1424
+ `Invalid tablePrefix: ${JSON.stringify(this.prefix)}. Must match ${TABLE_PREFIX_PATTERN} (letter, then alphanumeric/underscore, ending in "_", max 32 chars total).`
1425
+ );
1426
+ }
1421
1427
  this.outboxRepo = new OutboxRepository(db, this.prefix, !!options.config?.enableOutbox);
1422
1428
  this.entryRepo = new EntryRepository(db, this.prefix, this.outboxRepo);
1423
1429
  this.taskRepo = new TaskRepository(db, this.prefix, this.outboxRepo);
@@ -1471,6 +1477,7 @@ var WikiMemory = class {
1471
1477
  this.writeService = new WriteService(
1472
1478
  this.db,
1473
1479
  this.options,
1480
+ this.entryRepo,
1474
1481
  this.eventRepo,
1475
1482
  this.metadataRepo,
1476
1483
  this.jobManager,
@@ -1549,7 +1556,7 @@ var WikiMemory = class {
1549
1556
  async hasChanged(entityId, sourceRef, sourceHash) {
1550
1557
  const normalizedRef = normalizeSourceRef(sourceRef);
1551
1558
  if (!normalizedRef) {
1552
- throw new Error(`Invalid sourceRef: "${sourceRef}"`);
1559
+ throw new Error(`Invalid sourceRef: ${JSON.stringify(sourceRef)}`);
1553
1560
  }
1554
1561
  const normalizedHash = normalizeSourceHash(sourceHash);
1555
1562
  if (!normalizedHash) {