@equationalapplications/expo-llm-wiki 4.15.3 → 4.16.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.
Files changed (2) hide show
  1. package/README.md +61 -3
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -18,7 +18,8 @@ Local-first LLM memory for Expo and React Native. Combines the core semantic sea
18
18
  - **Retrieval tuning** — Per-call overrides for search behavior (pre-filter, hybrid blend, tier weights)
19
19
  - **Multi-entity reads** — Search across multiple `entity_id` namespaces in one pass with `tierWeights`
20
20
  - **Source provenance** — `WikiFact.source_type` distinguishes immutable document facts (`immutable_document`) from mutable derived/user facts. Immutable document content is protected from librarian/heal rewriting and only changed by `forget()` or re-ingest.
21
- - **React hooks** — `WikiProvider`, `useMemoryRead`, and all other hooks are re-exported directly from `@equationalapplications/expo-llm-wiki`
21
+ - **Seeded ontologies** — Enforce strict taxonomies or allow emergent graph relationship extraction (`useOntologyManifest`, `useSetOntologyManifest`; Strict, Emergent, or Off; defaults to Off).
22
+ - **React hooks** — `WikiProvider`, `useMemoryRead`, `useOntologyManifest`, `useSetOntologyManifest`, and all other hooks re-exported from `@equationalapplications/expo-llm-wiki`
22
23
  - **Full-featured memory** — Facts, tasks, events, maintenance jobs (librarian, heal, reembed, prune)
23
24
  - **Interoperability:** Supports [Open Knowledge Format (OKF) v0.1](https://github.com/GoogleCloudPlatform/knowledge-catalog/tree/main/okf) import and export.
24
25
 
@@ -233,6 +234,52 @@ export function EntityLoadingSpinner({ entityId }: { entityId: string }) {
233
234
  }
234
235
  ```
235
236
 
237
+ ### `useOntologyManifest(entityId)`
238
+
239
+ Reactive read — fetches on mount and when `entityId` or `wiki` changes:
240
+
241
+ ```typescript
242
+ import { useOntologyManifest } from '@equationalapplications/expo-llm-wiki';
243
+
244
+ const { manifest, mode, isPending, error, refetch } = useOntologyManifest('user-123');
245
+ // manifest: OntologyManifest | null
246
+ // mode: OntologyMode | null ('strict' | 'emergent' | 'off' when present)
247
+ ```
248
+
249
+ Note: `manifest` and `mode` are `null` when the entity has no persisted or seeded manifest (`getOntologyManifest` returned `null`). Call `refetch()` after mutations to refresh.
250
+
251
+ ### `useSetOntologyManifest()`
252
+
253
+ Mutation — same `{ execute, isPending, error, lastResult }` contract as `useWikiWrite`:
254
+
255
+ ```typescript
256
+ import { useOntologyManifest, useSetOntologyManifest } from '@equationalapplications/expo-llm-wiki';
257
+
258
+ export function OntologySettings({ entityId }: { entityId: string }) {
259
+ const { manifest, mode, refetch } = useOntologyManifest(entityId);
260
+ const { execute, isPending, error } = useSetOntologyManifest();
261
+
262
+ const handleSave = async () => {
263
+ await execute(entityId, {
264
+ node_types: [{ type: 'person', description: 'An individual.' }],
265
+ edge_types: [{
266
+ type: 'reports_to',
267
+ source_type: 'person',
268
+ target_type: 'person',
269
+ description: 'Reporting hierarchy.',
270
+ }],
271
+ }, { mode: 'strict' });
272
+ refetch();
273
+ };
274
+
275
+ // render manifest/mode; wire handleSave to a save button
276
+ }
277
+ ```
278
+
279
+ Global defaults and `seedManifests` bootstrap are configured at construction time via `createWiki(..., { config: { ontology: ... } })`. See the [core package README § Per-Entity Seeded Ontology](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/core/README.md#per-entity-seeded-ontology) for mode semantics and manifest schema.
280
+
281
+ `useSetOntologyManifest` does not automatically refresh `useOntologyManifest` — call `refetch()` after a successful `execute()`, same as `useWikiWrite` + `useMemoryRead`.
282
+
236
283
  ## Component Lifecycle
237
284
 
238
285
  ```mermaid
@@ -244,6 +291,8 @@ flowchart TD
244
291
  C -->|"useWikiIngest()"| F["[Ingest Document]"]
245
292
  C -->|"useWikiForget()"| G["[Delete Memory]"]
246
293
  C -->|"useWikiMaintenance()"| H["[Run Jobs]"]
294
+ C -->|"useOntologyManifest(entityId)"| S["[Read Ontology]"]
295
+ C -->|"useSetOntologyManifest()"| T["[Update Ontology]"]
247
296
  D --> I{"entityId, query, wiki,<br/>or ReadOptions changed?"}
248
297
  I -->|"Yes"| J["Auto-refetch"]
249
298
  I -->|"No"| K["Return cached data"]
@@ -252,10 +301,17 @@ flowchart TD
252
301
  M --> N["Phase 1: Score facts<br/>Phase 2: Fetch winners"]
253
302
  N --> O["Update component state"]
254
303
  O --> P["Re-render with data"]
304
+ S --> I2{"entityId or wiki changed?"}
305
+ I2 -->|"Yes"| J2["Auto-refetch"]
306
+ I2 -->|"No"| K2["Return cached manifest/mode"]
307
+ J2 --> L2["Trigger getOntologyManifest()"]
308
+ L2 --> O2["Update component state"]
309
+ O2 --> P2["Re-render with manifest/mode"]
255
310
  E --> Q["Execute write()"]
256
311
  F --> Q
257
312
  G --> Q
258
313
  H --> Q
314
+ T --> Q
259
315
  Q --> R["Write completes"]
260
316
  ```
261
317
 
@@ -263,8 +319,10 @@ flowchart TD
263
319
  1. **Wrap app** with `<WikiProvider wiki={wiki}>` — provides wiki context
264
320
  2. **Use hooks** in components — access memory reactively
265
321
  3. **Read operations** auto-refetch when `entityId`, `query`, `wiki`, or `ReadOptions` values change; call `refetch()` to refresh manually
266
- 4. **Write operations** (write, ingest, forget, maintenance) do not automatically re-trigger `useMemoryRead`; call `refetch()` after a write to refresh read results
267
- 5. **Re-render** with new data flowing back to UI
322
+ 4. **Ontology reads** auto-refetch when `entityId` or `wiki` changes; call `refetch()` manually after ontology mutations
323
+ 5. **Write operations** (write, ingest, forget, maintenance) do not automatically re-trigger `useMemoryRead`; call `refetch()` after a write to refresh read results
324
+ 6. **Ontology writes** (`useSetOntologyManifest`) do not automatically re-trigger `useOntologyManifest` in the same component unless `refetch()` is called after `execute()` succeeds
325
+ 7. **Re-render** with new data flowing back to UI
268
326
 
269
327
  ## Retrieval Engine Internals
270
328
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equationalapplications/expo-llm-wiki",
3
- "version": "4.15.3",
3
+ "version": "4.16.0",
4
4
  "description": "Local-first LLM memory for Expo and React Native. Combines the core semantic search and extraction engine with expo-sqlite and ready-to-use React hooks.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -55,8 +55,8 @@
55
55
  "registry": "https://registry.npmjs.org"
56
56
  },
57
57
  "dependencies": {
58
- "@equationalapplications/react-llm-wiki": "4.15.3",
59
- "@equationalapplications/core-llm-wiki": "4.15.3"
58
+ "@equationalapplications/react-llm-wiki": "4.16.0",
59
+ "@equationalapplications/core-llm-wiki": "4.16.0"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "expo-sqlite": "^14.0.0 || ^15.0.0 || ^55.0.0 || ^56.0.0",