@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/README.md CHANGED
@@ -1254,6 +1254,15 @@ const { nodesWritten, edgesWritten, superseded } = await wikiMemory.upsertGraph(
1254
1254
 
1255
1255
  `upsertGraph` is "the tail of `ingestDocument` with the middle (LLM extraction) step removed" — it accepts caller-supplied nodes (`{ id, type, title, body? }`) and edges (`{ type, sourceId, targetId, id? }`) and writes them under the same `(sourceRef, sourceHash)` semantics. If a *different* live `sourceRef` already holds the same `sourceHash`, it throws `WikiSourceRefHashCollision`; re-writing the identical `(sourceRef, sourceHash)` is a no-op returning zero counts. The adapter parameter is required so writes participate in the caller's transaction.
1256
1256
 
1257
+ Core never sees your transaction commit, so it can't index the new nodes itself. Until you tell it, they won't show up in keyword or hybrid `read()` results on the same instance. Call `syncSearchIndex` **after** the commit, not inside the transaction:
1258
+
1259
+ ```typescript
1260
+ await db.withTransactionAsync((tx) => wikiMemory.upsertGraph('entity-123', params, tx));
1261
+ await wikiMemory.syncSearchIndex('entity-123'); // or syncSearchIndex() for every entity written
1262
+ ```
1263
+
1264
+ It is cheap on an entity that is already current, runs in order with core's own index syncs, and never rejects for a valid `entityId` (an empty or non-string id throws `TypeError`). It does not compute embeddings; those still come from the maintenance sweep.
1265
+
1257
1266
  Entry IDs occupy one globally shared namespace within a database. An ID belongs
1258
1267
  to its existing entity while its row exists, including after soft deletion.
1259
1268
  Same-entity updates and resurrection retain their existing behavior; physically
@@ -578,6 +578,16 @@ var _SearchService = class _SearchService {
578
578
  this.staleEntities.add(entityId);
579
579
  this.staleEpochs.set(entityId, (this.staleEpochs.get(entityId) ?? 0) + 1);
580
580
  }
581
+ /**
582
+ * Runs syncEntries(id, []) for each entity marked stale when this is called,
583
+ * so only those entities are rebuilt. Each rebuild still takes its own turn
584
+ * on the sync chain, and like syncEntries this never rejects. With nothing
585
+ * stale it resolves at once, without waiting on work already on the chain.
586
+ */
587
+ async syncStale() {
588
+ const ids = [...this.staleEntities];
589
+ await Promise.all(ids.map((id) => this.syncEntries(id, [])));
590
+ }
581
591
  /**
582
592
  * Clears the parsed vector cache. Useful for mid-loop flush guarantees
583
593
  * or memory pressure evictions.
@@ -6786,5 +6796,5 @@ var WriteService = class {
6786
6796
  };
6787
6797
 
6788
6798
  export { BaseRepository, DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DiagnosticBuffer, EMBED_CHARS_CEILING, EmbeddingService, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MAX_EMBED_ATTEMPTS, MaintenanceService, MetadataRepository, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, RetrievalService, SearchService, TemporalService, UsageMeter, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiParseError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, WriteService, __privateAdd, __privateGet, __privateSet, chunkText, configureRandomSource, edgeTripleAllowed, emptyManifest, entitySummaryMetaKey, extractSqliteCode, factTokenCost, generateId, isLiveAt, liveAtSql, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, packFactsByBudget, parseEmbedding, resolveEdgeDefinitions, resolveGrounding, resolveNodeType, safeSlice, typeSatisfies, validateInlineEdges, validateManifest };
6789
- //# sourceMappingURL=chunk-M76CF2Q6.mjs.map
6790
- //# sourceMappingURL=chunk-M76CF2Q6.mjs.map
6799
+ //# sourceMappingURL=chunk-J2TWKOEE.mjs.map
6800
+ //# sourceMappingURL=chunk-J2TWKOEE.mjs.map