@equationalapplications/core-llm-wiki 7.7.5 → 7.7.6

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,6 +1,6 @@
1
- import { __privateAdd, MetadataRepository, EmbeddingService, SearchService, JobManager, PromptService, resolveGrounding, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, normalizeSourceRef, normalizeSourceHash, entitySummaryMetaKey, WikiSourceRefHashCollision, DiagnosticBuffer, validateManifest, WikiDraftNotFound, generateId, BaseRepository, WikiGraphNodeOwnershipConflict, emptyManifest, resolveNodeType, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, typeSatisfies, normalizeTitleKey, edgeTripleAllowed, WikiTransactionError, extractSqliteCode } from './chunk-JV2OQ5CM.mjs';
2
- export { DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, EMBED_CHARS_CEILING, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiParseError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiTransactionError, chunkText, configureRandomSource, parseEmbedding, safeSlice, validateManifest } from './chunk-JV2OQ5CM.mjs';
3
- import { appendRelatedSection, buildConceptDocument, buildLogMd, buildEntityIndexMd, buildRootIndexMd, isAllowedOkfPath, parseRootIndexMd, parseEntityIndexMd, parseConcept, splitRelatedSection, extractMarkdownLinks, parseLogMd, parseEventIdComment, latestVerified, formatSourcesJson, appendEventIdComment, parseVerifiedFlexible, parseCitationsList, deriveTrustTier, isStaleAfter } from '@equationalapplications/core-okf';
1
+ import { BaseRepository, WikiGraphNodeOwnershipConflict, __privateAdd, MetadataRepository, EmbeddingService, SearchService, JobManager, PromptService, resolveGrounding, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, normalizeSourceRef, normalizeSourceHash, entitySummaryMetaKey, WikiSourceRefHashCollision, DiagnosticBuffer, validateManifest, WikiDraftNotFound, generateId, emptyManifest, resolveNodeType, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, typeSatisfies, normalizeTitleKey, edgeTripleAllowed, WikiTransactionError, extractSqliteCode } from './chunk-PBUZLSOM.mjs';
2
+ export { DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, EMBED_CHARS_CEILING, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiParseError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiTransactionError, chunkText, configureRandomSource, parseEmbedding, safeSlice, validateManifest } from './chunk-PBUZLSOM.mjs';
3
+ import { deriveTrustTier, isStaleAfter, appendRelatedSection, buildConceptDocument, buildLogMd, buildEntityIndexMd, buildRootIndexMd, isAllowedOkfPath, parseRootIndexMd, parseEntityIndexMd, parseConcept, splitRelatedSection, extractMarkdownLinks, parseLogMd, parseEventIdComment, latestVerified, formatSourcesJson, appendEventIdComment, parseVerifiedFlexible, parseCitationsList } from '@equationalapplications/core-okf';
4
4
 
5
5
  // src/db/schema.ts
6
6
  async function setupDatabase(db, prefix) {
@@ -548,7 +548,7 @@ function mapRowToFactWithBlobs(row) {
548
548
  const embeddingBlob = normalizeEmbeddingBlobValue(row.embedding_blob);
549
549
  return embeddingBlob ? { ...base, embedding_blob: embeddingBlob } : base;
550
550
  }
551
- var EntryRepository = class extends BaseRepository {
551
+ var _EntryRepository = class _EntryRepository extends BaseRepository {
552
552
  constructor(db, prefix, outbox) {
553
553
  super(db, prefix);
554
554
  this.outbox = outbox;
@@ -1233,14 +1233,34 @@ var EntryRepository = class extends BaseRepository {
1233
1233
  const executor = this.getExecutor(tx);
1234
1234
  if (entityId !== void 0) {
1235
1235
  return executor.getAllAsync(
1236
- `SELECT id, entity_id, title, body, tags FROM ${this.prefix}entries WHERE deleted_at IS NULL AND entity_id = ?`,
1236
+ `SELECT ${_EntryRepository.MINI_SEARCH_COLUMNS} FROM ${this.prefix}entries ${_EntryRepository.MINI_SEARCH_LIVE_WHERE} AND entity_id = ?`,
1237
1237
  [entityId]
1238
1238
  );
1239
1239
  }
1240
1240
  return executor.getAllAsync(
1241
- `SELECT id, entity_id, title, body, tags FROM ${this.prefix}entries WHERE deleted_at IS NULL`
1241
+ `SELECT ${_EntryRepository.MINI_SEARCH_COLUMNS} FROM ${this.prefix}entries ${_EntryRepository.MINI_SEARCH_LIVE_WHERE}`
1242
1242
  );
1243
1243
  }
1244
+ /**
1245
+ * Keyword-index rows for specific ids — the incremental counterpart of
1246
+ * {@link findMiniSearchRows}, with identical columns. Soft-deleted rows and
1247
+ * rows of other entities are omitted, so a caller can pass every id a write
1248
+ * touched and get back exactly what should be indexed. Spec 2026-09-28 §4.4.
1249
+ */
1250
+ async findMiniSearchRowsByIds(entityId, ids, tx) {
1251
+ if (ids.length === 0) return [];
1252
+ const executor = this.getExecutor(tx);
1253
+ const rows = [];
1254
+ for (let i = 0; i < ids.length; i += this.chunkSize) {
1255
+ const chunk = ids.slice(i, i + this.chunkSize);
1256
+ const placeholders = chunk.map(() => "?").join(",");
1257
+ rows.push(...await executor.getAllAsync(
1258
+ `SELECT ${_EntryRepository.MINI_SEARCH_COLUMNS} FROM ${this.prefix}entries ${_EntryRepository.MINI_SEARCH_LIVE_WHERE} AND entity_id = ? AND id IN (${placeholders})`,
1259
+ [entityId, ...chunk]
1260
+ ));
1261
+ }
1262
+ return rows;
1263
+ }
1244
1264
  async updateEmbeddingBlob(id, blob, tx) {
1245
1265
  const executor = this.getExecutor(tx);
1246
1266
  await executor.runAsync(
@@ -1781,6 +1801,15 @@ var EntryRepository = class extends BaseRepository {
1781
1801
  return rows.map((r) => ({ id: r.id, title: r.title }));
1782
1802
  }
1783
1803
  };
1804
+ /**
1805
+ * Column list and liveness predicate shared by findMiniSearchRows and
1806
+ * findMiniSearchRowsByIds, so the full rebuild and the incremental read
1807
+ * can never drift apart (spec 2026-09-28 §4.4: both must produce
1808
+ * identical documents).
1809
+ */
1810
+ _EntryRepository.MINI_SEARCH_COLUMNS = "id, entity_id, title, body, tags";
1811
+ _EntryRepository.MINI_SEARCH_LIVE_WHERE = "WHERE deleted_at IS NULL";
1812
+ var EntryRepository = _EntryRepository;
1784
1813
 
1785
1814
  // src/repositories/OutboxRepository.ts
1786
1815
  var OutboxRepository = class extends BaseRepository {
@@ -3446,6 +3475,7 @@ var WikiMemory = class {
3446
3475
  adapter,
3447
3476
  { diag: { buffer: diagBuffer, operation: "upsertGraph" } }
3448
3477
  );
3478
+ this.searchService.markStale(entityId);
3449
3479
  diagBuffer.flush(this.options);
3450
3480
  return result;
3451
3481
  }