@equationalapplications/core-llm-wiki 7.0.0 → 7.1.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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyManifest, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-BtsN1pTK.mjs';
2
- export { C as ChunkFailure, D as DegradedRecord, E as EmbedFactResult, d as EmbedFailureKind, e as EmbeddingMarkerKind, f as EntityStatus, g as ExtractedFact, h as ExtractedFactEdge, i as ExtractedFactWithOntology, j as ExtractedTask, k as GraphTraversalOptions, H as HEAL_BATCH_SIZE, l as HEAL_RECHECK_MS, m as HOOK_TIMEOUT_MARKER, n as HealResult, I as IngestDocumentResult, L as LLMProvider, o as ONTOLOGY_BACKFILL_BATCH_SIZE, p as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, q as ONTOLOGY_BACKFILL_RECHECK_MS, r as OntologyBackfillResult, s as OntologyConfig, t as OntologyEdgeType, u as OntologyMode, v as OntologyNodeType, w as OntologyPromptContext, x as OntologyUpdates, P as PromptOverrides, y as PromptService, z as PrunePartialFailureError, A as ReembedResult, V as VectorRanker, B as VectorRankerFallback, J as VectorRankerRankArgs, K as VectorRankerSemanticResult, N as WikiBusyError, Q as WikiBusyOperation, T as WikiCheckpoint, U as WikiConfig, X as WikiDuplicateHashError, Y as WikiEdge, Z as WikiEvent, _ as WikiFact, $ as WikiIngestEmptyError, a0 as WikiInvalidReadOptions, a1 as WikiMemoryTestAccess, a2 as WikiOutboxEvent, a3 as WikiParseError, a4 as WikiSourceRefHashCollision, a5 as WikiStrictOntologyViolation, a6 as WikiTask, a7 as WikiTransactionError } from './testing-BtsN1pTK.mjs';
1
+ import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyManifest, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-CA7723qk.mjs';
2
+ export { C as ChunkFailure, D as DegradedRecord, E as EmbedFactResult, d as EmbedFailureKind, e as EmbeddingMarkerKind, f as EntityStatus, g as ExtractedFact, h as ExtractedFactEdge, i as ExtractedFactWithOntology, j as ExtractedTask, k as GraphTraversalOptions, H as HEAL_BATCH_SIZE, l as HEAL_RECHECK_MS, m as HOOK_TIMEOUT_MARKER, n as HealResult, I as IngestDocumentResult, L as LLMProvider, o as ONTOLOGY_BACKFILL_BATCH_SIZE, p as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, q as ONTOLOGY_BACKFILL_RECHECK_MS, r as OntologyBackfillResult, s as OntologyConfig, t as OntologyEdgeType, u as OntologyMode, v as OntologyNodeType, w as OntologyPromptContext, x as OntologyUpdates, P as PromptOverrides, y as PromptService, z as PrunePartialFailureError, A as ReembedResult, V as VectorRanker, B as VectorRankerFallback, J as VectorRankerRankArgs, K as VectorRankerSemanticResult, N as WikiBusyError, Q as WikiBusyOperation, T as WikiCheckpoint, U as WikiConfig, X as WikiDuplicateHashError, Y as WikiEdge, Z as WikiEvent, _ as WikiFact, $ as WikiIngestEmptyError, a0 as WikiInvalidReadOptions, a1 as WikiMemoryTestAccess, a2 as WikiOutboxEvent, a3 as WikiParseError, a4 as WikiSourceRefHashCollision, a5 as WikiStrictOntologyViolation, a6 as WikiTask, a7 as WikiTransactionError } from './testing-CA7723qk.mjs';
3
3
  import { OkfFile } from '@equationalapplications/core-okf';
4
4
  import 'minisearch';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyManifest, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-BtsN1pTK.js';
2
- export { C as ChunkFailure, D as DegradedRecord, E as EmbedFactResult, d as EmbedFailureKind, e as EmbeddingMarkerKind, f as EntityStatus, g as ExtractedFact, h as ExtractedFactEdge, i as ExtractedFactWithOntology, j as ExtractedTask, k as GraphTraversalOptions, H as HEAL_BATCH_SIZE, l as HEAL_RECHECK_MS, m as HOOK_TIMEOUT_MARKER, n as HealResult, I as IngestDocumentResult, L as LLMProvider, o as ONTOLOGY_BACKFILL_BATCH_SIZE, p as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, q as ONTOLOGY_BACKFILL_RECHECK_MS, r as OntologyBackfillResult, s as OntologyConfig, t as OntologyEdgeType, u as OntologyMode, v as OntologyNodeType, w as OntologyPromptContext, x as OntologyUpdates, P as PromptOverrides, y as PromptService, z as PrunePartialFailureError, A as ReembedResult, V as VectorRanker, B as VectorRankerFallback, J as VectorRankerRankArgs, K as VectorRankerSemanticResult, N as WikiBusyError, Q as WikiBusyOperation, T as WikiCheckpoint, U as WikiConfig, X as WikiDuplicateHashError, Y as WikiEdge, Z as WikiEvent, _ as WikiFact, $ as WikiIngestEmptyError, a0 as WikiInvalidReadOptions, a1 as WikiMemoryTestAccess, a2 as WikiOutboxEvent, a3 as WikiParseError, a4 as WikiSourceRefHashCollision, a5 as WikiStrictOntologyViolation, a6 as WikiTask, a7 as WikiTransactionError } from './testing-BtsN1pTK.js';
1
+ import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyManifest, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-CA7723qk.js';
2
+ export { C as ChunkFailure, D as DegradedRecord, E as EmbedFactResult, d as EmbedFailureKind, e as EmbeddingMarkerKind, f as EntityStatus, g as ExtractedFact, h as ExtractedFactEdge, i as ExtractedFactWithOntology, j as ExtractedTask, k as GraphTraversalOptions, H as HEAL_BATCH_SIZE, l as HEAL_RECHECK_MS, m as HOOK_TIMEOUT_MARKER, n as HealResult, I as IngestDocumentResult, L as LLMProvider, o as ONTOLOGY_BACKFILL_BATCH_SIZE, p as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, q as ONTOLOGY_BACKFILL_RECHECK_MS, r as OntologyBackfillResult, s as OntologyConfig, t as OntologyEdgeType, u as OntologyMode, v as OntologyNodeType, w as OntologyPromptContext, x as OntologyUpdates, P as PromptOverrides, y as PromptService, z as PrunePartialFailureError, A as ReembedResult, V as VectorRanker, B as VectorRankerFallback, J as VectorRankerRankArgs, K as VectorRankerSemanticResult, N as WikiBusyError, Q as WikiBusyOperation, T as WikiCheckpoint, U as WikiConfig, X as WikiDuplicateHashError, Y as WikiEdge, Z as WikiEvent, _ as WikiFact, $ as WikiIngestEmptyError, a0 as WikiInvalidReadOptions, a1 as WikiMemoryTestAccess, a2 as WikiOutboxEvent, a3 as WikiParseError, a4 as WikiSourceRefHashCollision, a5 as WikiStrictOntologyViolation, a6 as WikiTask, a7 as WikiTransactionError } from './testing-CA7723qk.js';
3
3
  import { OkfFile } from '@equationalapplications/core-okf';
4
4
  import 'minisearch';
5
5
 
package/dist/index.js CHANGED
@@ -3297,6 +3297,22 @@ var JobManager = class {
3297
3297
  _isReembedActive(entityId) {
3298
3298
  return this.activeMaintenanceJobs.has(this._reembedKey(entityId)) || this.activeMaintenanceJobs.has(this._globalReembedKey());
3299
3299
  }
3300
+ /**
3301
+ * True while any reembed sweep is in flight — per-entity or global.
3302
+ *
3303
+ * Read-only; acquires nothing. Callers that mutate embedding failure
3304
+ * markers across ALL entities (the dimension-promotion clear) must gate on
3305
+ * this and defer, rather than resurrect rows an in-flight sweep already
3306
+ * classified. See spec 2026-09-05-reembed-lock-scope-design.md §2.
3307
+ *
3308
+ * The global key `${prefix}:reembed` also ends in ':reembed', so the suffix
3309
+ * scan alone would already match it. The explicit check is kept because it
3310
+ * documents the intent and survives any future change to the global key's
3311
+ * format.
3312
+ */
3313
+ isAnyReembedActive() {
3314
+ return this.activeMaintenanceJobs.has(this._globalReembedKey()) || this._isAnyMaintenanceActiveWithSuffix(":reembed");
3315
+ }
3300
3316
  _isImportActiveFor(entityId) {
3301
3317
  return this.activeMaintenanceJobs.has(this._importKey(entityId)) || this.activeMaintenanceJobs.has(this._globalImportKey());
3302
3318
  }
@@ -3470,10 +3486,13 @@ var JobManager = class {
3470
3486
  }
3471
3487
  }
3472
3488
  /**
3473
- * Auto-heal historically only gated on the heal self-key. Keep that behavior
3474
- * for write() auto-trigger paths while preserving stricter checks in acquireLock().
3489
+ * Auto-heal historically only gated on the heal self-key. Keep that
3490
+ * permissiveness for write() auto-trigger paths — stricter checks stay in
3491
+ * acquireLock() — with one exception: reembed sweeps, which are excluded
3492
+ * structurally rather than by accident (see below).
3475
3493
  */
3476
3494
  tryAcquireAutoHealLock(entityId) {
3495
+ if (this.isAnyReembedActive()) return false;
3477
3496
  const healKey = this._healKey(entityId);
3478
3497
  if (this.activeMaintenanceJobs.has(healKey)) return false;
3479
3498
  this.activeMaintenanceJobs.add(healKey);
@@ -5063,6 +5082,15 @@ var MaintenanceService = class {
5063
5082
  * sets embedding_dimension_mismatch, so promotion never fires and markers
5064
5083
  * survive the swap. Use `runReembed({ force: true })` to clear that state —
5065
5084
  * `force` bypasses classification entirely and retries every row.
5085
+ *
5086
+ * Lock scope (spec 2026-09-05 §2): a marker mutation is legal while a sweep
5087
+ * is in flight if and only if it cannot resurrect a row the sweep has
5088
+ * classified. Mutations scoped to entities not under an active sweep key are
5089
+ * legal — the entity-scoped ingest/import lock checks enforce that. The one
5090
+ * mutation that spans every entity, `reconcileEmbeddingDimension`'s marker
5091
+ * clear, is made legal by DEFERRING (importDump gates on
5092
+ * `JobManager.isAnyReembedActive()`), never by widening a lock. Auto-heal is
5093
+ * excluded from sweeps for the same reason.
5066
5094
  */
5067
5095
  async runReembed(entityId, opts) {
5068
5096
  const embedFn = this.options.llmProvider.embed;
@@ -6210,7 +6238,13 @@ var ImportExportService = class {
6210
6238
  this.db
6211
6239
  );
6212
6240
  }
6213
- await this.embeddingService.reconcileEmbeddingDimension();
6241
+ if (this.jobManager.isAnyReembedActive()) {
6242
+ console.info(
6243
+ "[WikiMemory] importDump: embedding-dimension promotion deferred; a reembed sweep is in flight"
6244
+ );
6245
+ } else {
6246
+ await this.embeddingService.reconcileEmbeddingDimension();
6247
+ }
6214
6248
  } else {
6215
6249
  await this.metadataRepo.setMeta(
6216
6250
  "embedding_dimension_mismatch",
@@ -6317,6 +6351,19 @@ var EmbeddingService = class {
6317
6351
  * Revived rows are NOT embedded here. They become eligible and are picked up
6318
6352
  * by the NEXT sweep, because runReembed calls this after its candidates were
6319
6353
  * already classified; same-sweep revival would be re-entrant.
6354
+ *
6355
+ * Caller contract (spec 2026-09-05 §3.2): callers must not invoke this while
6356
+ * a reembed sweep is in flight unless they hold that sweep's lock, because
6357
+ * the marker clear spans every entity. `runReembed`'s tail call is exempt —
6358
+ * by the tail, the sweep's classification phase is complete, so the clear
6359
+ * cannot resurrect a row THIS sweep classified; any overlap with a
6360
+ * concurrent import's entity-scoped, blob-guarded writes (an importDump of a
6361
+ * different entity can run during a per-entity sweep) is bounded redundant
6362
+ * work. External callers
6363
+ * gate on `JobManager.isAnyReembedActive()` and defer. This service
6364
+ * deliberately holds no `JobManager` reference: gating here instead of at
6365
+ * the call site would make `runReembed`'s own tail call see its own lock and
6366
+ * defer forever.
6320
6367
  */
6321
6368
  async reconcileEmbeddingDimension() {
6322
6369
  const mismatchValue = await this.metadataRepo.getMeta("embedding_dimension_mismatch");