@equationalapplications/core-llm-wiki 7.9.2 → 7.10.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/README.md +7 -0
- package/dist/{chunk-7FRLQ7ZO.mjs → chunk-LOVBNRCV.mjs} +33 -2
- package/dist/chunk-LOVBNRCV.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +319 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +290 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-Bf6etdUy.d.mts → testing-SxCsMt1q.d.mts} +45 -0
- package/dist/{testing-Bf6etdUy.d.ts → testing-SxCsMt1q.d.ts} +45 -0
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +31 -0
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +4 -2
- package/dist/chunk-7FRLQ7ZO.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -231,6 +231,13 @@ const wikiMemory = new WikiMemory(db, {
|
|
|
231
231
|
staleInferredAfterDays: 60, // default: 60 (days before runHeal downgrades inferred facts; null to disable)
|
|
232
232
|
preFilterLimit: 50, // default: undefined — MiniSearch pre-filter before cosine scan; recommended for >500 facts
|
|
233
233
|
hybridWeight: 0.7, // default: undefined — blend semantic (1.0) ↔ keyword (0.0); pure semantic when unset
|
|
234
|
+
// Keyword-index backend (#257): 'fts5' stores the index inside the database file, fed by triggers on the
|
|
235
|
+
// entries table, so memory stays flat at any size; setup() throws if the adapter's SQLite lacks FTS5 or json1.
|
|
236
|
+
// 'minisearch' (default) keeps the in-RAM MiniSearch index; 'auto' probes at setup() and uses FTS5 when present,
|
|
237
|
+
// else MiniSearch. The first setup() that attaches FTS5 to an existing database rebuilds the index in one
|
|
238
|
+
// transaction, holding the write lock for its whole duration. Server deployments with large databases should
|
|
239
|
+
// set 'fts5' (or 'auto'); MiniSearch memory grows with total stored text.
|
|
240
|
+
indexStrategy: 'minisearch', // default: 'minisearch' — 'fts5' | 'minisearch' | 'auto'
|
|
234
241
|
enableOutbox: false, // default: false — when true, entry/task mutations write to an internal SQLite outbox table for external sync (e.g. via @equationalapplications/prisma-outbox)
|
|
235
242
|
excludeDrafts: false, // default: false — engine default for read()/traverseGraph() excludeDrafts; see Draft Review
|
|
236
243
|
grounding: { mode: 'off' }, // default: off — 'draft' checks evidence quotes; see Grounding
|
|
@@ -474,6 +474,33 @@ var _SearchService = class _SearchService {
|
|
|
474
474
|
this.staleEpochs = /* @__PURE__ */ new Map();
|
|
475
475
|
this.indexStrategy = indexStrategy;
|
|
476
476
|
}
|
|
477
|
+
/**
|
|
478
|
+
* Install the strategy resolved by `WikiMemory.setup()`. Before setup, the
|
|
479
|
+
* service runs on an empty MiniSearch placeholder, as it always has.
|
|
480
|
+
*/
|
|
481
|
+
setIndexStrategy(strategy) {
|
|
482
|
+
this.indexStrategy = strategy;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* One serialized drain turn for strategies with a durable ledger. Like
|
|
486
|
+
* sync(), it never rejects: the keyword index is rebuildable, and a failed
|
|
487
|
+
* drain leaves the ledger rows in place for the next turn.
|
|
488
|
+
*/
|
|
489
|
+
drainTurn(entityId) {
|
|
490
|
+
const work = this.syncChain.then(async () => {
|
|
491
|
+
try {
|
|
492
|
+
try {
|
|
493
|
+
await this.indexStrategy.drain();
|
|
494
|
+
} finally {
|
|
495
|
+
this.evictCache(entityId);
|
|
496
|
+
}
|
|
497
|
+
} catch (err) {
|
|
498
|
+
console.warn(`[WikiMemory] search index drain failed for ${entityId ?? "*"}:`, err);
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
this.syncChain = work;
|
|
502
|
+
return work;
|
|
503
|
+
}
|
|
477
504
|
/**
|
|
478
505
|
* Rebuilds the search index and clears the vector cache for a given entity.
|
|
479
506
|
* A direct replacement for manually syncing state after a DB transaction.
|
|
@@ -483,6 +510,7 @@ var _SearchService = class _SearchService {
|
|
|
483
510
|
* correct failure mode and killing the host process is not.
|
|
484
511
|
*/
|
|
485
512
|
async sync(entityId) {
|
|
513
|
+
if (this.indexStrategy.drain) return this.drainTurn(entityId);
|
|
486
514
|
const work = this.syncChain.then(async () => {
|
|
487
515
|
try {
|
|
488
516
|
try {
|
|
@@ -525,6 +553,7 @@ var _SearchService = class _SearchService {
|
|
|
525
553
|
* already queued on the chain.
|
|
526
554
|
*/
|
|
527
555
|
async syncEntries(entityId, ids) {
|
|
556
|
+
if (this.indexStrategy.drain) return this.drainTurn(entityId);
|
|
528
557
|
const uniqueIds = [...new Set(ids)];
|
|
529
558
|
const indexed = this.indexStrategy.hasIndexedEntity?.(entityId);
|
|
530
559
|
if (uniqueIds.length === 0 && !this.staleEntities.has(entityId) && indexed === true) {
|
|
@@ -564,6 +593,7 @@ var _SearchService = class _SearchService {
|
|
|
564
593
|
* cannot index itself, such as upsertGraph inside a host transaction.
|
|
565
594
|
*/
|
|
566
595
|
markStale(entityId) {
|
|
596
|
+
if (this.indexStrategy.drain) return;
|
|
567
597
|
this.staleEntities.add(entityId);
|
|
568
598
|
this.staleEpochs.set(entityId, (this.staleEpochs.get(entityId) ?? 0) + 1);
|
|
569
599
|
}
|
|
@@ -574,6 +604,7 @@ var _SearchService = class _SearchService {
|
|
|
574
604
|
* stale it resolves at once, without waiting on work already on the chain.
|
|
575
605
|
*/
|
|
576
606
|
async syncStale() {
|
|
607
|
+
if (this.indexStrategy.drain) return this.drainTurn();
|
|
577
608
|
const ids = [...this.staleEntities];
|
|
578
609
|
await Promise.all(ids.map((id) => this.syncEntries(id, [])));
|
|
579
610
|
}
|
|
@@ -6740,5 +6771,5 @@ var WriteService = class {
|
|
|
6740
6771
|
};
|
|
6741
6772
|
|
|
6742
6773
|
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 };
|
|
6743
|
-
//# sourceMappingURL=chunk-
|
|
6744
|
-
//# sourceMappingURL=chunk-
|
|
6774
|
+
//# sourceMappingURL=chunk-LOVBNRCV.mjs.map
|
|
6775
|
+
//# sourceMappingURL=chunk-LOVBNRCV.mjs.map
|