@equationalapplications/core-llm-wiki 7.11.2 → 7.12.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
@@ -238,6 +238,11 @@ const wikiMemory = new WikiMemory(db, {
238
238
  // The first setup() that attaches FTS5 to an existing database rebuilds the index in one transaction, holding
239
239
  // the write lock for its whole duration. Keyword rankings differ between the two backends; set 'minisearch'
240
240
  // to keep the pre-7.11 behavior.
241
+ // Under 'auto', a failed FTS5 init is retried once, then setup() completes with keyword search unavailable
242
+ // (queries throw WikiSearchUnavailableError); it never silently demotes to MiniSearch. While unavailable,
243
+ // runHeal returns searchUnavailable: true, runPendingMaintenance lists skipped jobs in perEntity[].searchUnavailable,
244
+ // and a no-arg syncSearchIndex() retries the init (after a failure, backing off from 5 s up to 5 min). MiniSearch holds all
245
+ // entry text in the JS heap — the measured ceiling is ~1M entries on a default Node heap (--max-old-space-size).
241
246
  indexStrategy: 'auto', // default: 'auto' — 'fts5' | 'minisearch' | 'auto'
242
247
  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)
243
248
  excludeDrafts: false, // default: false — engine default for read()/traverseGraph() excludeDrafts; see Draft Review
@@ -263,6 +268,23 @@ const wikiMemory = new WikiMemory(db, {
263
268
  });
264
269
  ```
265
270
 
271
+ ### Opening inside a writer lease
272
+
273
+ One-time upgrade work (schema migrations, the `source_ref` normalize) can take minutes on a large store. If you open the store inside a time-limited writer lease, refuse that work instead of running it:
274
+
275
+ ```typescript
276
+ try {
277
+ await wiki.setup({ migrations: 'refuse' }); // also settable as config.migrations
278
+ } catch (err) {
279
+ if (!(err instanceof WikiMigrationRequiredError)) throw err;
280
+ // err.pendingWork says what is pending. Release the lease, then:
281
+ await wiki.setup(); // runs the work out of lease (resumable if interrupted)
282
+ // ...re-acquire the lease and open again with 'refuse'.
283
+ }
284
+ ```
285
+
286
+ `'allow'` (default) runs everything; `'auto'` throws on a pending schema migration but runs a pending normalize. Await `setup()` before any other call on the instance.
287
+
266
288
  ## Prompt Management & Overrides
267
289
 
268
290
  Core maintenance tasks (`ingestDocument`, `runLibrarian`, `runHeal`) use system prompts to instruct the LLM. You can customize these prompts using `{{mustache}}` style variables to inject context dynamically.