@equationalapplications/core-llm-wiki 7.8.0 → 7.9.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 { BaseRepository, WikiGraphNodeOwnershipConflict, liveAtSql, __privateAdd, MetadataRepository, EmbeddingService, SearchService, TemporalService, 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, MAX_EMBED_ATTEMPTS, UsageMeter, WikiBusyError, WikiInvalidReadOptions, isLiveAt, packFactsByBudget, factTokenCost, WikiTransactionError, extractSqliteCode } from './chunk-M76CF2Q6.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, WikiSupersedeError, WikiTransactionError, chunkText, configureRandomSource, parseEmbedding, safeSlice, validateManifest } from './chunk-M76CF2Q6.mjs';
1
+ import { BaseRepository, WikiGraphNodeOwnershipConflict, liveAtSql, __privateAdd, MetadataRepository, EmbeddingService, SearchService, TemporalService, 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, MAX_EMBED_ATTEMPTS, UsageMeter, WikiBusyError, WikiInvalidReadOptions, isLiveAt, packFactsByBudget, factTokenCost, WikiTransactionError, extractSqliteCode } from './chunk-J2TWKOEE.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, WikiSupersedeError, WikiTransactionError, chunkText, configureRandomSource, parseEmbedding, safeSlice, validateManifest } from './chunk-J2TWKOEE.mjs';
3
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
@@ -3902,6 +3902,32 @@ var WikiMemory = class {
3902
3902
  clearVectorCache() {
3903
3903
  this.searchService.evictCache();
3904
3904
  }
3905
+ /**
3906
+ * Brings the keyword search index up to date with SQLite after a host
3907
+ * transaction that used `upsertGraph` has committed. Core never sees that
3908
+ * commit, so without this the nodes stay out of keyword, hybrid and
3909
+ * fallback retrieval until the entity's next core write.
3910
+ *
3911
+ * With `entityId`, rebuilds that entity if it is stale or has never been
3912
+ * indexed; otherwise it is a no-op that still waits for rebuilds already
3913
+ * queued. Without an argument, rebuilds every entity currently marked
3914
+ * stale; when none is, it resolves immediately and does not wait for rebuilds
3915
+ * already queued.
3916
+ *
3917
+ * Call only after the host's transaction commits: called inside it, the
3918
+ * rebuild may index rows that later roll back, or miss them and clear the
3919
+ * stale flag anyway. Serialized with core's internal index syncs and takes
3920
+ * no maintenance lock. Never rejects for a valid `entityId` — on failure the
3921
+ * entity stays stale and the next call retries it. Does not compute
3922
+ * embeddings; that remains the maintenance sweep's job.
3923
+ *
3924
+ * @throws {TypeError} when `entityId` is given but is not a non-empty string.
3925
+ */
3926
+ async syncSearchIndex(entityId) {
3927
+ if (entityId === void 0) return this.searchService.syncStale();
3928
+ assertEntityId(entityId);
3929
+ return this.searchService.syncEntries(entityId, []);
3930
+ }
3905
3931
  async exportDump(entityIds) {
3906
3932
  return this.importExportService.exportDump(entityIds);
3907
3933
  }
@@ -3948,9 +3974,11 @@ var WikiMemory = class {
3948
3974
  * MUST be called from inside an open `db.withTransactionAsync` callback —
3949
3975
  * the third argument is the caller's `tx`. The method does not open a
3950
3976
  * nested transaction, does not acquire any lock, and does not perform
3951
- * post-commit work (search sync, embedding, cache eviction). Hosts that
3952
- * want embeddings synced should drive the existing maintenance sweep
3953
- * (`runLibrarian` / `runHeal` / `runOntologyBackfill` / `runPrune`,
3977
+ * post-commit work (search sync, embedding, cache eviction). After the
3978
+ * transaction commits, call `syncSearchIndex(entityId)` — or
3979
+ * `syncSearchIndex()` after writing several entities in one transaction —
3980
+ * to make the new nodes keyword-searchable. Embeddings still come from the maintenance
3981
+ * sweep (`runLibrarian` / `runHeal` / `runOntologyBackfill` / `runPrune`,
3954
3982
  * scoped via `listEntityIds`).
3955
3983
  *
3956
3984
  * Contract (full pre-flight validation lives inside