@equationalapplications/core-llm-wiki 5.4.0 → 5.5.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
@@ -10,6 +10,35 @@ Platform-agnostic TypeScript engine for hybrid LLM memory. Features episodic fac
10
10
 
11
11
  > Inspired by [Andrej Karpathy's LLM Wiki memory spec](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).
12
12
 
13
+ ## Recent changes
14
+
15
+ ### 5.4.1 — Ingest parse resilience (issue #92)
16
+
17
+ - `parseJsonResponse` now tolerates bare `"` characters in LLM output via a
18
+ container-aware repair pass. The function's signature is unchanged
19
+ (`parseJsonResponse<T>(text: string): T`); the runtime contract widens —
20
+ the new `WikiParseError` type carries `{ tier, position, slice }` instead
21
+ of an opaque `Error`, and `tier: 'repair'` is now reachable for balanced
22
+ invalid payloads (e.g. `{"facts":}`) where the walker found a candidate
23
+ span that `JSON.parse` ultimately rejected.
24
+ - `IngestionService.ingestDocument` no longer rejects the whole call when one
25
+ chunk fails. Sibling chunks commit; the result's `parseFailures[]` records
26
+ per-chunk failures. A new typed error `WikiIngestEmptyError` is thrown when
27
+ every chunk failed. New typed error `WikiParseError` carries `{tier,
28
+ position, slice}`. New result fields: `ingestedChunks`, `failedChunks`,
29
+ `parseFailures?`.
30
+ - Partial-commit semantics: when some chunks fail, the document's
31
+ `(entity, sourceHash) → sourceRef` ownership is **not** recorded and the
32
+ partial rows are stored with `source_hash = NULL`. Subsequent runs with
33
+ the same hash see `hasChanged` return `true` and the failed chunks retry
34
+ on the next pass; the retry's `appendPartialFacts` dedupes against the
35
+ prior partial's surviving rows so titles are never duplicated. On full
36
+ success the next run supersedes everything atomically.
37
+ - `INGEST_SYSTEM_PROMPT` and `ONTOLOGY_BACKFILL_SYSTEM_PROMPT` were tightened
38
+ to call out JSON-escape discipline explicitly.
39
+
40
+ **Hosts must update (host-facing migration)**: a host that today treats `ingestDocument` throwing as the only failure signal will, after 5.4.1, see a successful return with `parseFailures[]` set when a subset of chunks failed. Inspect `result.failedChunks` and surface `result.parseFailures[]` for observability — do not rely on the throw for partial failures. Only `WikiIngestEmptyError` (every chunk failed) still throws. Catch `WikiParseError` explicitly if you previously caught `Error` to log parse failures — the new `tier` field replaces the opaque `message`.
41
+
13
42
  ## Features
14
43
 
15
44
  - **Platform-agnostic** — Zero runtime dependencies; works with any SQLite driver via the `SQLiteAdapter` interface