@equationalapplications/core-llm-wiki 7.2.1 → 7.4.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 +48 -0
- package/dist/{chunk-TTECJ3S3.mjs → chunk-G5OR2VWD.mjs} +371 -49
- package/dist/chunk-G5OR2VWD.mjs.map +1 -0
- package/dist/index.d.mts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +501 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +134 -13
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-DYeMd9d1.d.mts → testing-Dmh1kfkd.d.mts} +171 -7
- package/dist/{testing-DYeMd9d1.d.ts → testing-Dmh1kfkd.d.ts} +171 -7
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +353 -46
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-TTECJ3S3.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -285,6 +285,31 @@ True cosine-range pure semantic ranking (including negative cosine values) is us
|
|
|
285
285
|
**Pre-filtering optimization:**
|
|
286
286
|
When `preFilterLimit: 50` is set with 1000 facts, cosine similarity is computed only for the top 50 MiniSearch keyword matches, reducing O(N) scoring to O(50).
|
|
287
287
|
|
|
288
|
+
## Draft Review
|
|
289
|
+
|
|
290
|
+
Facts can carry `lifecycle_status: 'draft'`, for example when a host marks model output as unreviewed. Drafts stay visible by default. To keep them out of results:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
await wiki.read('user-1', 'deploy process', { excludeDrafts: true });
|
|
294
|
+
await wiki.traverseGraph('user-1', { sourceId, excludeDrafts: true });
|
|
295
|
+
// or engine-wide:
|
|
296
|
+
createWiki(db, { llmProvider, config: { excludeDrafts: true } });
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
- On every `read()` path, drafts are removed **before** `maxResults`, `tierFloors`, and pre-filter cuts, so they never take slots from reviewed facts.
|
|
300
|
+
- In traversal, drafts are dead ends. The starting fact is always returned.
|
|
301
|
+
- Status is read from SQLite on every call. A promotion is visible immediately, with no re-indexing.
|
|
302
|
+
|
|
303
|
+
Review API:
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
const { facts, nextCursor } = await wiki.listDrafts('user-1', { limit: 50 });
|
|
307
|
+
await wiki.promoteDraft(facts[0].id, 'user-1', { by: 'human:alice' }); // → stable, trustTier 'human-reviewed'
|
|
308
|
+
// Reject with setLifecycleStatus(id, entityId, 'deprecated') or forget().
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
`promoteDraft` throws `WikiDraftNotFound` when no live draft with that id exists for the entity. The error is contextless by design. Promotion does not change `updated_at`, so a promoted fact keeps its recency position.
|
|
312
|
+
|
|
288
313
|
## Pluggable Vector Retrieval
|
|
289
314
|
|
|
290
315
|
When your entity corpus grows, in-process cosine similarity scoring becomes a bottleneck. The optional **`VectorRanker`** interface lets you delegate semantic ranking to [**sqlite-vec**](https://github.com/asg017/sqlite-vec), [**sqlite-vss**](https://github.com/asg017/sqlite-vss), or an external vector database while `WikiMemory` handles embedding validation, hybrid scoring, and tier-2 row hydration.
|
|
@@ -504,6 +529,29 @@ Notes:
|
|
|
504
529
|
- A throwing callback is caught (logged via `console.error`) and does not block other subscribers or the underlying job.
|
|
505
530
|
- Subscriptions are scoped to a single `entityId`. There is no wildcard or "all entities" form.
|
|
506
531
|
|
|
532
|
+
## Diagnostics
|
|
533
|
+
|
|
534
|
+
Pass `onDiagnostic` to receive typed, content-free reports of events core used to drop silently or only log: failed chunks, rejected facts and tasks, dedupe drops, dropped edges, embedding and host-hook failures, heal skips, and background-job failures.
|
|
535
|
+
|
|
536
|
+
```ts
|
|
537
|
+
const wiki = createWiki(db, {
|
|
538
|
+
llmProvider,
|
|
539
|
+
onDiagnostic: (d) => {
|
|
540
|
+
// d.code, d.severity ('info' | 'warn' | 'error'), d.operation, d.trigger ('call' | 'auto'),
|
|
541
|
+
// d.entityId, d.at, d.message, d.detail?: { factId, sourceRef, chunkIndex, itemIndex,
|
|
542
|
+
// edgeType, sourceNodeType, targetNodeType, reason, count, chunkIndexes }
|
|
543
|
+
telemetry.record(d);
|
|
544
|
+
},
|
|
545
|
+
});
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
- **Content-free.** Diagnostics carry IDs, indexes, counts, ontology slugs and reason slugs only. They never carry titles, bodies, LLM output, provider error messages, or hashes of content.
|
|
549
|
+
- **Isolated.** The hook is called synchronously. A throwing or rejecting hook never affects the operation, and its failure is logged with `console.warn`.
|
|
550
|
+
- **After commit.** Transactional diagnostics are delivered after the operation's transaction commits. An operation that throws delivers none; the exception is the signal. `upsertGraph` runs in your transaction, so its diagnostics are delivered when it resolves. Disregard them if you roll back.
|
|
551
|
+
- **`trigger`.** `'auto'` marks work started by `autoLibrarianThreshold` / `autoHealThreshold`. A failed background job is reported as `background_job_failed` with `operation` set to the job.
|
|
552
|
+
- **Forward-compatible.** New codes may be added in minor releases; ignore codes you don't recognize.
|
|
553
|
+
- **Console output is unchanged** when a hook is set and succeeds: every existing core line is identical. A throwing or rejecting hook adds only its own `console.warn`, and a non-function `onDiagnostic` warns once.
|
|
554
|
+
|
|
507
555
|
## Per-Entity Seeded Ontology
|
|
508
556
|
|
|
509
557
|
Control how librarian and ingest passes classify facts and extract graph relationships. The system defaults to **`off`** so existing deployments behave unchanged.
|