@equationalapplications/expo-llm-wiki 0.0.0-development → 2.0.2
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 +11 -1
- package/dist/{WikiMemory-BI2Aizwv.d.mts → WikiMemory-B54Gaa-K.d.mts} +37 -1
- package/dist/{WikiMemory-BI2Aizwv.d.ts → WikiMemory-B54Gaa-K.d.ts} +37 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +441 -65
- package/dist/index.mjs +438 -64
- package/dist/react/index.d.mts +9 -2
- package/dist/react/index.d.ts +9 -2
- package/dist/react/index.js +30 -0
- package/dist/react/index.mjs +29 -0
- package/package.json +9 -5
- package/dist/WikiMemory-B-yFw9Dc.d.mts +0 -118
- package/dist/WikiMemory-B-yFw9Dc.d.ts +0 -118
- package/dist/WikiMemory-BWTt1Ynm.d.mts +0 -103
- package/dist/WikiMemory-BWTt1Ynm.d.ts +0 -103
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# expo-llm-wiki
|
|
2
2
|
|
|
3
|
+
[](https://github.com/equationalapplications/expo-llm-wiki/tags)
|
|
4
|
+
[](https://www.npmjs.com/package/@equationalapplications/expo-llm-wiki)
|
|
5
|
+
[](https://www.npmjs.com/package/@equationalapplications/expo-llm-wiki)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
3
8
|
Offline-first, SQLite-backed memory for LLM apps built with Expo. Handles FTS5 search, episodic event logging, background fact extraction, and memory healing — bring your own LLM.
|
|
4
9
|
|
|
5
10
|
## Key Principles
|
|
@@ -135,7 +140,8 @@ const result = await wiki.ingestDocument('entity-123', {
|
|
|
135
140
|
sourceRef: 'preferences.md', // stable identifier
|
|
136
141
|
sourceHash: sha256(content), // for change detection
|
|
137
142
|
documentChunk: content,
|
|
138
|
-
maxChunkLength:
|
|
143
|
+
maxChunkLength: 12000, // optional, character count
|
|
144
|
+
chunkOverlap: 400, // optional, overlap in characters
|
|
139
145
|
});
|
|
140
146
|
// result: { truncated: boolean; chunks: number }
|
|
141
147
|
// truncated: true if at least one hard-split was required (no sentence boundary)
|
|
@@ -257,3 +263,7 @@ All mutation hooks follow the same pattern (`TResult` is specific per hook):
|
|
|
257
263
|
error: Error | null; // cleared on the next execute call
|
|
258
264
|
}
|
|
259
265
|
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
Made with ❤️ by Equational Applications LLC. [https://equationalapplications.com/](https://equationalapplications.com/)
|
|
@@ -9,6 +9,8 @@ interface WikiConfig {
|
|
|
9
9
|
orphanAfterDays?: number | null;
|
|
10
10
|
staleInferredAfterDays?: number | null;
|
|
11
11
|
maxChunkLength?: number;
|
|
12
|
+
chunkOverlap?: number;
|
|
13
|
+
chunkConcurrency?: number;
|
|
12
14
|
}
|
|
13
15
|
interface WikiFact {
|
|
14
16
|
id: string;
|
|
@@ -79,22 +81,54 @@ interface MemoryBundle {
|
|
|
79
81
|
tasks: WikiTask[];
|
|
80
82
|
events: WikiEvent[];
|
|
81
83
|
}
|
|
84
|
+
interface MemoryDump {
|
|
85
|
+
generatedAt: number;
|
|
86
|
+
entities: Record<string, MemoryBundle>;
|
|
87
|
+
}
|
|
88
|
+
interface FormattedMemoryDump {
|
|
89
|
+
manifest: string;
|
|
90
|
+
files: Array<{
|
|
91
|
+
name: string;
|
|
92
|
+
content: string;
|
|
93
|
+
}>;
|
|
94
|
+
}
|
|
95
|
+
interface EntityStatus {
|
|
96
|
+
ingesting: boolean;
|
|
97
|
+
librarian: boolean;
|
|
98
|
+
heal: boolean;
|
|
99
|
+
}
|
|
100
|
+
declare class WikiBusyError extends Error {
|
|
101
|
+
readonly operation: 'ingest' | 'librarian' | 'heal';
|
|
102
|
+
readonly entityId: string;
|
|
103
|
+
constructor(operation: 'ingest' | 'librarian' | 'heal', entityId: string);
|
|
104
|
+
}
|
|
82
105
|
|
|
83
106
|
declare class WikiMemory {
|
|
84
107
|
private db;
|
|
85
108
|
private prefix;
|
|
86
109
|
private options;
|
|
87
110
|
private activeMaintenanceJobs;
|
|
111
|
+
private activeIngestJobs;
|
|
112
|
+
private _librarianKey;
|
|
113
|
+
private _healKey;
|
|
114
|
+
private _warnCrossEntityCollision;
|
|
88
115
|
constructor(db: SQLite.SQLiteDatabase, options: WikiOptions);
|
|
89
116
|
setup(): Promise<void>;
|
|
90
117
|
private formatSearchQuery;
|
|
91
118
|
read(entityId: string, query: string): Promise<MemoryBundle>;
|
|
119
|
+
getMemoryBundle(entityId: string): Promise<MemoryBundle>;
|
|
92
120
|
write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
|
|
93
121
|
private runLibrarianThenMaybeHeal;
|
|
94
122
|
private _doRunLibrarian;
|
|
95
123
|
private _doRunHeal;
|
|
96
124
|
runLibrarian(entityId: string): Promise<void>;
|
|
97
125
|
runHeal(entityId: string): Promise<void>;
|
|
126
|
+
getEntityStatus(entityId: string): EntityStatus;
|
|
127
|
+
private _getFullBundle;
|
|
128
|
+
exportDump(entityIds?: string[]): Promise<MemoryDump>;
|
|
129
|
+
importDump(dump: MemoryDump, opts?: {
|
|
130
|
+
merge?: boolean;
|
|
131
|
+
}): Promise<void>;
|
|
98
132
|
forget(entityId: string, params: {
|
|
99
133
|
entryId?: string;
|
|
100
134
|
taskId?: string;
|
|
@@ -112,10 +146,12 @@ declare class WikiMemory {
|
|
|
112
146
|
sourceHash: string;
|
|
113
147
|
documentChunk: string;
|
|
114
148
|
maxChunkLength?: number;
|
|
149
|
+
chunkOverlap?: number;
|
|
150
|
+
chunkConcurrency?: number;
|
|
115
151
|
}): Promise<{
|
|
116
152
|
truncated: boolean;
|
|
117
153
|
chunks: number;
|
|
118
154
|
}>;
|
|
119
155
|
}
|
|
120
156
|
|
|
121
|
-
export { type
|
|
157
|
+
export { type EntityStatus as E, type FormattedMemoryDump as F, type LLMProvider as L, type MemoryDump as M, type WikiOptions as W, WikiMemory as a, type ExtractedFact as b, type ExtractedTask as c, type MemoryBundle as d, WikiBusyError as e, type WikiCheckpoint as f, type WikiConfig as g, type WikiEvent as h, type WikiFact as i, type WikiTask as j };
|
|
@@ -9,6 +9,8 @@ interface WikiConfig {
|
|
|
9
9
|
orphanAfterDays?: number | null;
|
|
10
10
|
staleInferredAfterDays?: number | null;
|
|
11
11
|
maxChunkLength?: number;
|
|
12
|
+
chunkOverlap?: number;
|
|
13
|
+
chunkConcurrency?: number;
|
|
12
14
|
}
|
|
13
15
|
interface WikiFact {
|
|
14
16
|
id: string;
|
|
@@ -79,22 +81,54 @@ interface MemoryBundle {
|
|
|
79
81
|
tasks: WikiTask[];
|
|
80
82
|
events: WikiEvent[];
|
|
81
83
|
}
|
|
84
|
+
interface MemoryDump {
|
|
85
|
+
generatedAt: number;
|
|
86
|
+
entities: Record<string, MemoryBundle>;
|
|
87
|
+
}
|
|
88
|
+
interface FormattedMemoryDump {
|
|
89
|
+
manifest: string;
|
|
90
|
+
files: Array<{
|
|
91
|
+
name: string;
|
|
92
|
+
content: string;
|
|
93
|
+
}>;
|
|
94
|
+
}
|
|
95
|
+
interface EntityStatus {
|
|
96
|
+
ingesting: boolean;
|
|
97
|
+
librarian: boolean;
|
|
98
|
+
heal: boolean;
|
|
99
|
+
}
|
|
100
|
+
declare class WikiBusyError extends Error {
|
|
101
|
+
readonly operation: 'ingest' | 'librarian' | 'heal';
|
|
102
|
+
readonly entityId: string;
|
|
103
|
+
constructor(operation: 'ingest' | 'librarian' | 'heal', entityId: string);
|
|
104
|
+
}
|
|
82
105
|
|
|
83
106
|
declare class WikiMemory {
|
|
84
107
|
private db;
|
|
85
108
|
private prefix;
|
|
86
109
|
private options;
|
|
87
110
|
private activeMaintenanceJobs;
|
|
111
|
+
private activeIngestJobs;
|
|
112
|
+
private _librarianKey;
|
|
113
|
+
private _healKey;
|
|
114
|
+
private _warnCrossEntityCollision;
|
|
88
115
|
constructor(db: SQLite.SQLiteDatabase, options: WikiOptions);
|
|
89
116
|
setup(): Promise<void>;
|
|
90
117
|
private formatSearchQuery;
|
|
91
118
|
read(entityId: string, query: string): Promise<MemoryBundle>;
|
|
119
|
+
getMemoryBundle(entityId: string): Promise<MemoryBundle>;
|
|
92
120
|
write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
|
|
93
121
|
private runLibrarianThenMaybeHeal;
|
|
94
122
|
private _doRunLibrarian;
|
|
95
123
|
private _doRunHeal;
|
|
96
124
|
runLibrarian(entityId: string): Promise<void>;
|
|
97
125
|
runHeal(entityId: string): Promise<void>;
|
|
126
|
+
getEntityStatus(entityId: string): EntityStatus;
|
|
127
|
+
private _getFullBundle;
|
|
128
|
+
exportDump(entityIds?: string[]): Promise<MemoryDump>;
|
|
129
|
+
importDump(dump: MemoryDump, opts?: {
|
|
130
|
+
merge?: boolean;
|
|
131
|
+
}): Promise<void>;
|
|
98
132
|
forget(entityId: string, params: {
|
|
99
133
|
entryId?: string;
|
|
100
134
|
taskId?: string;
|
|
@@ -112,10 +146,12 @@ declare class WikiMemory {
|
|
|
112
146
|
sourceHash: string;
|
|
113
147
|
documentChunk: string;
|
|
114
148
|
maxChunkLength?: number;
|
|
149
|
+
chunkOverlap?: number;
|
|
150
|
+
chunkConcurrency?: number;
|
|
115
151
|
}): Promise<{
|
|
116
152
|
truncated: boolean;
|
|
117
153
|
chunks: number;
|
|
118
154
|
}>;
|
|
119
155
|
}
|
|
120
156
|
|
|
121
|
-
export { type
|
|
157
|
+
export { type EntityStatus as E, type FormattedMemoryDump as F, type LLMProvider as L, type MemoryDump as M, type WikiOptions as W, WikiMemory as a, type ExtractedFact as b, type ExtractedTask as c, type MemoryBundle as d, WikiBusyError as e, type WikiCheckpoint as f, type WikiConfig as g, type WikiEvent as h, type WikiFact as i, type WikiTask as j };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as SQLite from 'expo-sqlite';
|
|
2
|
-
import { W as WikiOptions, a as WikiMemory } from './WikiMemory-
|
|
3
|
-
export { E as
|
|
2
|
+
import { M as MemoryDump, F as FormattedMemoryDump, W as WikiOptions, a as WikiMemory } from './WikiMemory-B54Gaa-K.mjs';
|
|
3
|
+
export { E as EntityStatus, b as ExtractedFact, c as ExtractedTask, L as LLMProvider, d as MemoryBundle, e as WikiBusyError, f as WikiCheckpoint, g as WikiConfig, h as WikiEvent, i as WikiFact, j as WikiTask } from './WikiMemory-B54Gaa-K.mjs';
|
|
4
|
+
|
|
5
|
+
declare function formatMemoryDump(dump: MemoryDump): FormattedMemoryDump;
|
|
4
6
|
|
|
5
7
|
declare function createWiki(db: SQLite.SQLiteDatabase, options: WikiOptions): WikiMemory;
|
|
6
8
|
|
|
7
|
-
export { WikiMemory, WikiOptions, createWiki };
|
|
9
|
+
export { FormattedMemoryDump, MemoryDump, WikiMemory, WikiOptions, createWiki, formatMemoryDump };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as SQLite from 'expo-sqlite';
|
|
2
|
-
import { W as WikiOptions, a as WikiMemory } from './WikiMemory-
|
|
3
|
-
export { E as
|
|
2
|
+
import { M as MemoryDump, F as FormattedMemoryDump, W as WikiOptions, a as WikiMemory } from './WikiMemory-B54Gaa-K.js';
|
|
3
|
+
export { E as EntityStatus, b as ExtractedFact, c as ExtractedTask, L as LLMProvider, d as MemoryBundle, e as WikiBusyError, f as WikiCheckpoint, g as WikiConfig, h as WikiEvent, i as WikiFact, j as WikiTask } from './WikiMemory-B54Gaa-K.js';
|
|
4
|
+
|
|
5
|
+
declare function formatMemoryDump(dump: MemoryDump): FormattedMemoryDump;
|
|
4
6
|
|
|
5
7
|
declare function createWiki(db: SQLite.SQLiteDatabase, options: WikiOptions): WikiMemory;
|
|
6
8
|
|
|
7
|
-
export { WikiMemory, WikiOptions, createWiki };
|
|
9
|
+
export { FormattedMemoryDump, MemoryDump, WikiMemory, WikiOptions, createWiki, formatMemoryDump };
|