@equationalapplications/expo-llm-wiki 4.15.2 → 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.
- package/README.md +63 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -18,8 +18,10 @@ 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
|
-
- **
|
|
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)
|
|
24
|
+
- **Interoperability:** Supports [Open Knowledge Format (OKF) v0.1](https://github.com/GoogleCloudPlatform/knowledge-catalog/tree/main/okf) import and export.
|
|
23
25
|
|
|
24
26
|
## Installation
|
|
25
27
|
|
|
@@ -232,6 +234,52 @@ export function EntityLoadingSpinner({ entityId }: { entityId: string }) {
|
|
|
232
234
|
}
|
|
233
235
|
```
|
|
234
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
|
+
|
|
235
283
|
## Component Lifecycle
|
|
236
284
|
|
|
237
285
|
```mermaid
|
|
@@ -243,6 +291,8 @@ flowchart TD
|
|
|
243
291
|
C -->|"useWikiIngest()"| F["[Ingest Document]"]
|
|
244
292
|
C -->|"useWikiForget()"| G["[Delete Memory]"]
|
|
245
293
|
C -->|"useWikiMaintenance()"| H["[Run Jobs]"]
|
|
294
|
+
C -->|"useOntologyManifest(entityId)"| S["[Read Ontology]"]
|
|
295
|
+
C -->|"useSetOntologyManifest()"| T["[Update Ontology]"]
|
|
246
296
|
D --> I{"entityId, query, wiki,<br/>or ReadOptions changed?"}
|
|
247
297
|
I -->|"Yes"| J["Auto-refetch"]
|
|
248
298
|
I -->|"No"| K["Return cached data"]
|
|
@@ -251,10 +301,17 @@ flowchart TD
|
|
|
251
301
|
M --> N["Phase 1: Score facts<br/>Phase 2: Fetch winners"]
|
|
252
302
|
N --> O["Update component state"]
|
|
253
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"]
|
|
254
310
|
E --> Q["Execute write()"]
|
|
255
311
|
F --> Q
|
|
256
312
|
G --> Q
|
|
257
313
|
H --> Q
|
|
314
|
+
T --> Q
|
|
258
315
|
Q --> R["Write completes"]
|
|
259
316
|
```
|
|
260
317
|
|
|
@@ -262,8 +319,10 @@ flowchart TD
|
|
|
262
319
|
1. **Wrap app** with `<WikiProvider wiki={wiki}>` — provides wiki context
|
|
263
320
|
2. **Use hooks** in components — access memory reactively
|
|
264
321
|
3. **Read operations** auto-refetch when `entityId`, `query`, `wiki`, or `ReadOptions` values change; call `refetch()` to refresh manually
|
|
265
|
-
4. **
|
|
266
|
-
5. **
|
|
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
|
|
267
326
|
|
|
268
327
|
## Retrieval Engine Internals
|
|
269
328
|
|
|
@@ -331,7 +390,7 @@ For full details on `{{mustache}}` prompt templating and the strict distinction
|
|
|
331
390
|
| Package | Purpose |
|
|
332
391
|
| ----- | ----- |
|
|
333
392
|
| [@equationalapplications/core-llm-wiki](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/core/README.md) | Persistent episodic memory |
|
|
334
|
-
| **@equationalapplications/expo-llm-wiki** | Persistent episodic memory for Expo/React Native |
|
|
393
|
+
| [**@equationalapplications/expo-llm-wiki**](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/expo/README.md) | Persistent episodic memory for Expo/React Native |
|
|
335
394
|
| [@equationalapplications/react-llm-wiki](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/react/README.md) | Persistent episodic memory for Web |
|
|
336
395
|
| [@equationalapplications/prisma-outbox](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/prisma-outbox/README.md) | Sync SQLite outbox events to Prisma |
|
|
337
396
|
| [@equationalapplications/core-llm-tools](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/core-llm-tools/README.md) | Gemini tool schemas and capability injector |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equationalapplications/expo-llm-wiki",
|
|
3
|
-
"version": "4.
|
|
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/
|
|
59
|
-
"@equationalapplications/
|
|
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",
|