@equationalapplications/core-llm-wiki 5.3.1 → 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
@@ -998,6 +1027,30 @@ The flowchart shows:
998
1027
  | [@equationalapplications/core-okf](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/okf/README.md) | Zero-dependency Open Knowledge Format (OKF) v0.1 primitives — parse and produce interoperable knowledge bundles. |
999
1028
  | [@equationalapplications/schema-org-llm-wiki](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/schema-org/README.md) | Curated schema.org warm-agent ontology manifest |
1000
1029
 
1030
+ ## OKF v0.2 conformance (llm-wiki/2)
1031
+
1032
+ `formatOkfBundle` defaults to `okf_version: 0.2` + `profile: llm-wiki/2`. To force a v0.1 export, pass `{ profile: 'llm-wiki/1' }`:
1033
+
1034
+ ```ts
1035
+ formatOkfBundle(dump, { profile: 'llm-wiki/1' });
1036
+ ```
1037
+
1038
+ `parseOkfBundle` auto-detects the profile from the root index frontmatter:
1039
+
1040
+ - `profile === 'llm-wiki/2'` → v0.2 path (new fields populated).
1041
+ - `profile === 'llm-wiki/1'` → v0.1 path (unchanged behavior).
1042
+ - `profile === undefined && okf_version === '0.1'` → v0.1 legacy path.
1043
+ - `profile === undefined && okf_version === undefined` → profile-0 (legacy) path.
1044
+
1045
+ New public methods on `WikiMemory` for OKF v0.2 trust/provenance writes (each DAO method omits `updated_at` from its SQL):
1046
+
1047
+ - `writeOkfTrust(entryId, entityId, verified)`
1048
+ - `writeOkfSources(entryId, entityId, sources)`
1049
+ - `setLifecycleStatus(entryId, entityId, status)`
1050
+ - `setStaleAfter(entryId, entityId, date | null)`
1051
+ - `setGeneratedBy(entryId, entityId, actor)`
1052
+ - (and `…Task` variants of all five)
1053
+
1001
1054
  ## License
1002
1055
 
1003
1056
  MIT