@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/dist/react/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(react_exports, {
|
|
|
23
23
|
WikiProvider: () => WikiProvider,
|
|
24
24
|
useMemoryRead: () => useMemoryRead,
|
|
25
25
|
useWiki: () => useWiki,
|
|
26
|
+
useWikiExport: () => useWikiExport,
|
|
26
27
|
useWikiForget: () => useWikiForget,
|
|
27
28
|
useWikiIngest: () => useWikiIngest,
|
|
28
29
|
useWikiMaintenance: () => useWikiMaintenance,
|
|
@@ -218,11 +219,40 @@ function useWikiForget() {
|
|
|
218
219
|
}, []);
|
|
219
220
|
return { execute, lastResult, isPending, error };
|
|
220
221
|
}
|
|
222
|
+
|
|
223
|
+
// src/react/useWikiExport.ts
|
|
224
|
+
var import_react7 = require("react");
|
|
225
|
+
function useWikiExport() {
|
|
226
|
+
const wiki = useWiki();
|
|
227
|
+
const wikiRef = (0, import_react7.useRef)(wiki);
|
|
228
|
+
wikiRef.current = wiki;
|
|
229
|
+
const [isPending, setIsPending] = (0, import_react7.useState)(false);
|
|
230
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
231
|
+
const [lastResult, setLastResult] = (0, import_react7.useState)(null);
|
|
232
|
+
const execute = (0, import_react7.useCallback)(async (entityIds) => {
|
|
233
|
+
setError(null);
|
|
234
|
+
setIsPending(true);
|
|
235
|
+
setLastResult(null);
|
|
236
|
+
try {
|
|
237
|
+
const result = await wikiRef.current.exportDump(entityIds);
|
|
238
|
+
setLastResult(result);
|
|
239
|
+
return result;
|
|
240
|
+
} catch (e) {
|
|
241
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
242
|
+
setError(err);
|
|
243
|
+
throw err;
|
|
244
|
+
} finally {
|
|
245
|
+
setIsPending(false);
|
|
246
|
+
}
|
|
247
|
+
}, []);
|
|
248
|
+
return { execute, lastResult, isPending, error };
|
|
249
|
+
}
|
|
221
250
|
// Annotate the CommonJS export names for ESM import in node:
|
|
222
251
|
0 && (module.exports = {
|
|
223
252
|
WikiProvider,
|
|
224
253
|
useMemoryRead,
|
|
225
254
|
useWiki,
|
|
255
|
+
useWikiExport,
|
|
226
256
|
useWikiForget,
|
|
227
257
|
useWikiIngest,
|
|
228
258
|
useWikiMaintenance,
|
package/dist/react/index.mjs
CHANGED
|
@@ -186,10 +186,39 @@ function useWikiForget() {
|
|
|
186
186
|
}, []);
|
|
187
187
|
return { execute, lastResult, isPending, error };
|
|
188
188
|
}
|
|
189
|
+
|
|
190
|
+
// src/react/useWikiExport.ts
|
|
191
|
+
import { useState as useState6, useCallback as useCallback6, useRef as useRef6 } from "react";
|
|
192
|
+
function useWikiExport() {
|
|
193
|
+
const wiki = useWiki();
|
|
194
|
+
const wikiRef = useRef6(wiki);
|
|
195
|
+
wikiRef.current = wiki;
|
|
196
|
+
const [isPending, setIsPending] = useState6(false);
|
|
197
|
+
const [error, setError] = useState6(null);
|
|
198
|
+
const [lastResult, setLastResult] = useState6(null);
|
|
199
|
+
const execute = useCallback6(async (entityIds) => {
|
|
200
|
+
setError(null);
|
|
201
|
+
setIsPending(true);
|
|
202
|
+
setLastResult(null);
|
|
203
|
+
try {
|
|
204
|
+
const result = await wikiRef.current.exportDump(entityIds);
|
|
205
|
+
setLastResult(result);
|
|
206
|
+
return result;
|
|
207
|
+
} catch (e) {
|
|
208
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
209
|
+
setError(err);
|
|
210
|
+
throw err;
|
|
211
|
+
} finally {
|
|
212
|
+
setIsPending(false);
|
|
213
|
+
}
|
|
214
|
+
}, []);
|
|
215
|
+
return { execute, lastResult, isPending, error };
|
|
216
|
+
}
|
|
189
217
|
export {
|
|
190
218
|
WikiProvider,
|
|
191
219
|
useMemoryRead,
|
|
192
220
|
useWiki,
|
|
221
|
+
useWikiExport,
|
|
193
222
|
useWikiForget,
|
|
194
223
|
useWikiIngest,
|
|
195
224
|
useWikiMaintenance,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equationalapplications/expo-llm-wiki",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A standalone, general-purpose React Native/Expo package for LLM Wiki Memory.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "tsup src/index.ts src/react/index.ts --format cjs,esm --dts --external react",
|
|
22
22
|
"dev": "tsup src/index.ts src/react/index.ts --format cjs,esm --dts --external react --watch",
|
|
23
|
-
"test": "
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest"
|
|
24
25
|
},
|
|
25
26
|
"files": [
|
|
26
27
|
"dist",
|
|
@@ -38,10 +39,11 @@
|
|
|
38
39
|
"author": "",
|
|
39
40
|
"license": "MIT",
|
|
40
41
|
"publishConfig": {
|
|
41
|
-
"access": "public"
|
|
42
|
+
"access": "public",
|
|
43
|
+
"registry": "https://registry.npmjs.org"
|
|
42
44
|
},
|
|
43
45
|
"peerDependencies": {
|
|
44
|
-
"expo-sqlite": "^14.0.0 || ^15.0.0",
|
|
46
|
+
"expo-sqlite": "^14.0.0 || ^15.0.0 || ^55.0.0",
|
|
45
47
|
"react": ">=17"
|
|
46
48
|
},
|
|
47
49
|
"peerDependenciesMeta": {
|
|
@@ -54,11 +56,13 @@
|
|
|
54
56
|
"@semantic-release/git": "^10.0.0",
|
|
55
57
|
"@types/node": "^20.0.0",
|
|
56
58
|
"@types/react": "^19.0.0",
|
|
59
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
57
60
|
"expo-sqlite": "^55.0.15",
|
|
58
61
|
"react": "19.2.0",
|
|
59
62
|
"semantic-release": "^24.0.0",
|
|
60
63
|
"tsup": "^8.0.0",
|
|
61
|
-
"typescript": "^5.0.0"
|
|
64
|
+
"typescript": "^5.0.0",
|
|
65
|
+
"vitest": "^4.1.5"
|
|
62
66
|
},
|
|
63
67
|
"dependencies": {
|
|
64
68
|
"expo": "^55.0.18",
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import * as SQLite from 'expo-sqlite';
|
|
2
|
-
|
|
3
|
-
interface WikiConfig {
|
|
4
|
-
tablePrefix?: string;
|
|
5
|
-
maxFtsResults?: number;
|
|
6
|
-
pruneEventsAfter?: number;
|
|
7
|
-
autoLibrarianThreshold?: number;
|
|
8
|
-
autoHealThreshold?: number;
|
|
9
|
-
orphanAfterDays?: number | null;
|
|
10
|
-
staleInferredAfterDays?: number | null;
|
|
11
|
-
maxChunkBytes?: number;
|
|
12
|
-
}
|
|
13
|
-
interface WikiFact {
|
|
14
|
-
id: string;
|
|
15
|
-
entity_id: string;
|
|
16
|
-
title: string;
|
|
17
|
-
body: string;
|
|
18
|
-
tags: string[];
|
|
19
|
-
confidence: 'certain' | 'inferred' | 'tentative';
|
|
20
|
-
source_type: 'user_stated' | 'agent_inferred' | 'user_confirmed' | 'user_document';
|
|
21
|
-
source_hash: string | null;
|
|
22
|
-
source_ref: string | null;
|
|
23
|
-
created_at: number;
|
|
24
|
-
updated_at: number;
|
|
25
|
-
last_accessed_at: number | null;
|
|
26
|
-
access_count: number;
|
|
27
|
-
deleted_at: number | null;
|
|
28
|
-
}
|
|
29
|
-
interface WikiTask {
|
|
30
|
-
id: string;
|
|
31
|
-
entity_id: string;
|
|
32
|
-
description: string;
|
|
33
|
-
status: 'pending' | 'in_progress' | 'done' | 'abandoned';
|
|
34
|
-
priority: number;
|
|
35
|
-
created_at: number;
|
|
36
|
-
updated_at: number;
|
|
37
|
-
resolved_at: number | null;
|
|
38
|
-
deleted_at: number | null;
|
|
39
|
-
}
|
|
40
|
-
interface WikiEvent {
|
|
41
|
-
id: string;
|
|
42
|
-
entity_id: string;
|
|
43
|
-
event_type: 'observation' | 'decision' | 'action' | 'outcome';
|
|
44
|
-
summary: string;
|
|
45
|
-
related_entry_id?: string | null;
|
|
46
|
-
created_at: number;
|
|
47
|
-
}
|
|
48
|
-
interface WikiCheckpoint {
|
|
49
|
-
entity_id: string;
|
|
50
|
-
heal_checkpoint: number;
|
|
51
|
-
memory_checkpoint: number;
|
|
52
|
-
}
|
|
53
|
-
interface ExtractedFact {
|
|
54
|
-
title: string;
|
|
55
|
-
body: string;
|
|
56
|
-
tags: string[];
|
|
57
|
-
confidence: 'certain' | 'inferred' | 'tentative';
|
|
58
|
-
}
|
|
59
|
-
interface ExtractedTask {
|
|
60
|
-
description: string;
|
|
61
|
-
priority: number;
|
|
62
|
-
}
|
|
63
|
-
interface LLMProvider {
|
|
64
|
-
/**
|
|
65
|
-
* Generates text using the developer's LLM of choice.
|
|
66
|
-
* Expected to return the raw text response (typically a JSON string).
|
|
67
|
-
*/
|
|
68
|
-
generateText: (params: {
|
|
69
|
-
systemPrompt: string;
|
|
70
|
-
userPrompt: string;
|
|
71
|
-
}) => Promise<string>;
|
|
72
|
-
}
|
|
73
|
-
interface WikiOptions {
|
|
74
|
-
config?: WikiConfig;
|
|
75
|
-
llmProvider: LLMProvider;
|
|
76
|
-
}
|
|
77
|
-
interface MemoryBundle {
|
|
78
|
-
facts: WikiFact[];
|
|
79
|
-
tasks: WikiTask[];
|
|
80
|
-
events: WikiEvent[];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
declare class WikiMemory {
|
|
84
|
-
private db;
|
|
85
|
-
private prefix;
|
|
86
|
-
private options;
|
|
87
|
-
constructor(db: SQLite.SQLiteDatabase, options: WikiOptions);
|
|
88
|
-
setup(): Promise<void>;
|
|
89
|
-
private formatSearchQuery;
|
|
90
|
-
read(entityId: string, query: string): Promise<MemoryBundle>;
|
|
91
|
-
write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
|
|
92
|
-
private runLibrarianThenMaybeHeal;
|
|
93
|
-
runLibrarian(entityId: string): Promise<void>;
|
|
94
|
-
runHeal(entityId: string): Promise<void>;
|
|
95
|
-
forget(entityId: string, params: {
|
|
96
|
-
entryId?: string;
|
|
97
|
-
taskId?: string;
|
|
98
|
-
sourceRef?: string;
|
|
99
|
-
sourceHash?: string;
|
|
100
|
-
clearAll?: boolean;
|
|
101
|
-
}): Promise<{
|
|
102
|
-
deleted: {
|
|
103
|
-
entries: number;
|
|
104
|
-
tasks: number;
|
|
105
|
-
};
|
|
106
|
-
}>;
|
|
107
|
-
ingestDocument(entityId: string, params: {
|
|
108
|
-
sourceRef: string;
|
|
109
|
-
sourceHash: string;
|
|
110
|
-
documentChunk: string;
|
|
111
|
-
maxChunkBytes?: number;
|
|
112
|
-
}): Promise<{
|
|
113
|
-
truncated: boolean;
|
|
114
|
-
chunks: number;
|
|
115
|
-
}>;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export { type ExtractedFact as E, type LLMProvider as L, type MemoryBundle as M, type WikiOptions as W, WikiMemory as a, type ExtractedTask as b, type WikiCheckpoint as c, type WikiConfig as d, type WikiEvent as e, type WikiFact as f, type WikiTask as g };
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import * as SQLite from 'expo-sqlite';
|
|
2
|
-
|
|
3
|
-
interface WikiConfig {
|
|
4
|
-
tablePrefix?: string;
|
|
5
|
-
maxFtsResults?: number;
|
|
6
|
-
pruneEventsAfter?: number;
|
|
7
|
-
autoLibrarianThreshold?: number;
|
|
8
|
-
autoHealThreshold?: number;
|
|
9
|
-
orphanAfterDays?: number | null;
|
|
10
|
-
staleInferredAfterDays?: number | null;
|
|
11
|
-
maxChunkBytes?: number;
|
|
12
|
-
}
|
|
13
|
-
interface WikiFact {
|
|
14
|
-
id: string;
|
|
15
|
-
entity_id: string;
|
|
16
|
-
title: string;
|
|
17
|
-
body: string;
|
|
18
|
-
tags: string[];
|
|
19
|
-
confidence: 'certain' | 'inferred' | 'tentative';
|
|
20
|
-
source_type: 'user_stated' | 'agent_inferred' | 'user_confirmed' | 'user_document';
|
|
21
|
-
source_hash: string | null;
|
|
22
|
-
source_ref: string | null;
|
|
23
|
-
created_at: number;
|
|
24
|
-
updated_at: number;
|
|
25
|
-
last_accessed_at: number | null;
|
|
26
|
-
access_count: number;
|
|
27
|
-
deleted_at: number | null;
|
|
28
|
-
}
|
|
29
|
-
interface WikiTask {
|
|
30
|
-
id: string;
|
|
31
|
-
entity_id: string;
|
|
32
|
-
description: string;
|
|
33
|
-
status: 'pending' | 'in_progress' | 'done' | 'abandoned';
|
|
34
|
-
priority: number;
|
|
35
|
-
created_at: number;
|
|
36
|
-
updated_at: number;
|
|
37
|
-
resolved_at: number | null;
|
|
38
|
-
deleted_at: number | null;
|
|
39
|
-
}
|
|
40
|
-
interface WikiEvent {
|
|
41
|
-
id: string;
|
|
42
|
-
entity_id: string;
|
|
43
|
-
event_type: 'observation' | 'decision' | 'action' | 'outcome';
|
|
44
|
-
summary: string;
|
|
45
|
-
related_entry_id?: string | null;
|
|
46
|
-
created_at: number;
|
|
47
|
-
}
|
|
48
|
-
interface WikiCheckpoint {
|
|
49
|
-
entity_id: string;
|
|
50
|
-
heal_checkpoint: number;
|
|
51
|
-
memory_checkpoint: number;
|
|
52
|
-
}
|
|
53
|
-
interface ExtractedFact {
|
|
54
|
-
title: string;
|
|
55
|
-
body: string;
|
|
56
|
-
tags: string[];
|
|
57
|
-
confidence: 'certain' | 'inferred' | 'tentative';
|
|
58
|
-
}
|
|
59
|
-
interface ExtractedTask {
|
|
60
|
-
description: string;
|
|
61
|
-
priority: number;
|
|
62
|
-
}
|
|
63
|
-
interface LLMProvider {
|
|
64
|
-
/**
|
|
65
|
-
* Generates text using the developer's LLM of choice.
|
|
66
|
-
* Expected to return the raw text response (typically a JSON string).
|
|
67
|
-
*/
|
|
68
|
-
generateText: (params: {
|
|
69
|
-
systemPrompt: string;
|
|
70
|
-
userPrompt: string;
|
|
71
|
-
}) => Promise<string>;
|
|
72
|
-
}
|
|
73
|
-
interface WikiOptions {
|
|
74
|
-
config?: WikiConfig;
|
|
75
|
-
llmProvider: LLMProvider;
|
|
76
|
-
}
|
|
77
|
-
interface MemoryBundle {
|
|
78
|
-
facts: WikiFact[];
|
|
79
|
-
tasks: WikiTask[];
|
|
80
|
-
events: WikiEvent[];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
declare class WikiMemory {
|
|
84
|
-
private db;
|
|
85
|
-
private prefix;
|
|
86
|
-
private options;
|
|
87
|
-
constructor(db: SQLite.SQLiteDatabase, options: WikiOptions);
|
|
88
|
-
setup(): Promise<void>;
|
|
89
|
-
private formatSearchQuery;
|
|
90
|
-
read(entityId: string, query: string): Promise<MemoryBundle>;
|
|
91
|
-
write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
|
|
92
|
-
private runLibrarianThenMaybeHeal;
|
|
93
|
-
runLibrarian(entityId: string): Promise<void>;
|
|
94
|
-
runHeal(entityId: string): Promise<void>;
|
|
95
|
-
forget(entityId: string, params: {
|
|
96
|
-
entryId?: string;
|
|
97
|
-
taskId?: string;
|
|
98
|
-
sourceRef?: string;
|
|
99
|
-
sourceHash?: string;
|
|
100
|
-
clearAll?: boolean;
|
|
101
|
-
}): Promise<{
|
|
102
|
-
deleted: {
|
|
103
|
-
entries: number;
|
|
104
|
-
tasks: number;
|
|
105
|
-
};
|
|
106
|
-
}>;
|
|
107
|
-
ingestDocument(entityId: string, params: {
|
|
108
|
-
sourceRef: string;
|
|
109
|
-
sourceHash: string;
|
|
110
|
-
documentChunk: string;
|
|
111
|
-
maxChunkBytes?: number;
|
|
112
|
-
}): Promise<{
|
|
113
|
-
truncated: boolean;
|
|
114
|
-
chunks: number;
|
|
115
|
-
}>;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export { type ExtractedFact as E, type LLMProvider as L, type MemoryBundle as M, type WikiOptions as W, WikiMemory as a, type ExtractedTask as b, type WikiCheckpoint as c, type WikiConfig as d, type WikiEvent as e, type WikiFact as f, type WikiTask as g };
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import * as SQLite from 'expo-sqlite';
|
|
2
|
-
|
|
3
|
-
interface WikiConfig {
|
|
4
|
-
tablePrefix?: string;
|
|
5
|
-
maxFtsResults?: number;
|
|
6
|
-
pruneEventsAfter?: number;
|
|
7
|
-
autoLibrarianThreshold?: number;
|
|
8
|
-
}
|
|
9
|
-
interface WikiFact {
|
|
10
|
-
id: string;
|
|
11
|
-
entity_id: string;
|
|
12
|
-
title: string;
|
|
13
|
-
body: string;
|
|
14
|
-
tags: string[];
|
|
15
|
-
confidence: 'certain' | 'inferred' | 'tentative';
|
|
16
|
-
source_type: 'user_stated' | 'agent_inferred' | 'user_confirmed' | 'user_document';
|
|
17
|
-
source_hash: string | null;
|
|
18
|
-
source_ref: string | null;
|
|
19
|
-
created_at: number;
|
|
20
|
-
updated_at: number;
|
|
21
|
-
last_accessed_at: number | null;
|
|
22
|
-
access_count: number;
|
|
23
|
-
deleted_at: number | null;
|
|
24
|
-
}
|
|
25
|
-
interface WikiTask {
|
|
26
|
-
id: string;
|
|
27
|
-
entity_id: string;
|
|
28
|
-
description: string;
|
|
29
|
-
status: 'pending' | 'in_progress' | 'done' | 'abandoned';
|
|
30
|
-
priority: number;
|
|
31
|
-
created_at: number;
|
|
32
|
-
updated_at: number;
|
|
33
|
-
resolved_at: number | null;
|
|
34
|
-
deleted_at: number | null;
|
|
35
|
-
}
|
|
36
|
-
interface WikiEvent {
|
|
37
|
-
id: string;
|
|
38
|
-
entity_id: string;
|
|
39
|
-
event_type: 'observation' | 'decision' | 'action' | 'outcome';
|
|
40
|
-
summary: string;
|
|
41
|
-
related_entry_id?: string | null;
|
|
42
|
-
created_at: number;
|
|
43
|
-
}
|
|
44
|
-
interface WikiCheckpoint {
|
|
45
|
-
entity_id: string;
|
|
46
|
-
heal_checkpoint: number;
|
|
47
|
-
memory_checkpoint: number;
|
|
48
|
-
}
|
|
49
|
-
interface ExtractedFact {
|
|
50
|
-
title: string;
|
|
51
|
-
body: string;
|
|
52
|
-
tags: string[];
|
|
53
|
-
confidence: 'certain' | 'inferred' | 'tentative';
|
|
54
|
-
}
|
|
55
|
-
interface ExtractedTask {
|
|
56
|
-
description: string;
|
|
57
|
-
priority: number;
|
|
58
|
-
}
|
|
59
|
-
interface LLMProvider {
|
|
60
|
-
/**
|
|
61
|
-
* Generates text using the developer's LLM of choice.
|
|
62
|
-
* Expected to return the raw text response (typically a JSON string).
|
|
63
|
-
*/
|
|
64
|
-
generateText: (params: {
|
|
65
|
-
systemPrompt: string;
|
|
66
|
-
userPrompt: string;
|
|
67
|
-
}) => Promise<string>;
|
|
68
|
-
}
|
|
69
|
-
interface WikiOptions {
|
|
70
|
-
config?: WikiConfig;
|
|
71
|
-
llmProvider: LLMProvider;
|
|
72
|
-
}
|
|
73
|
-
interface MemoryBundle {
|
|
74
|
-
facts: WikiFact[];
|
|
75
|
-
tasks: WikiTask[];
|
|
76
|
-
events: WikiEvent[];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
declare class WikiMemory {
|
|
80
|
-
private db;
|
|
81
|
-
private prefix;
|
|
82
|
-
private options;
|
|
83
|
-
constructor(db: SQLite.SQLiteDatabase, options: WikiOptions);
|
|
84
|
-
setup(): Promise<void>;
|
|
85
|
-
private formatSearchQuery;
|
|
86
|
-
read(entityId: string, query: string): Promise<MemoryBundle>;
|
|
87
|
-
write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
|
|
88
|
-
runLibrarian(entityId: string): Promise<void>;
|
|
89
|
-
runHeal(entityId: string): Promise<void>;
|
|
90
|
-
forget(entityId: string, params: {
|
|
91
|
-
entryId?: string;
|
|
92
|
-
taskId?: string;
|
|
93
|
-
sourceRef?: string;
|
|
94
|
-
clearAll?: boolean;
|
|
95
|
-
}): Promise<void>;
|
|
96
|
-
ingestDocument(entityId: string, params: {
|
|
97
|
-
sourceRef: string;
|
|
98
|
-
sourceHash: string;
|
|
99
|
-
documentChunk: string;
|
|
100
|
-
}): Promise<void>;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export { type ExtractedFact as E, type LLMProvider as L, type MemoryBundle as M, type WikiOptions as W, WikiMemory as a, type ExtractedTask as b, type WikiCheckpoint as c, type WikiConfig as d, type WikiEvent as e, type WikiFact as f, type WikiTask as g };
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import * as SQLite from 'expo-sqlite';
|
|
2
|
-
|
|
3
|
-
interface WikiConfig {
|
|
4
|
-
tablePrefix?: string;
|
|
5
|
-
maxFtsResults?: number;
|
|
6
|
-
pruneEventsAfter?: number;
|
|
7
|
-
autoLibrarianThreshold?: number;
|
|
8
|
-
}
|
|
9
|
-
interface WikiFact {
|
|
10
|
-
id: string;
|
|
11
|
-
entity_id: string;
|
|
12
|
-
title: string;
|
|
13
|
-
body: string;
|
|
14
|
-
tags: string[];
|
|
15
|
-
confidence: 'certain' | 'inferred' | 'tentative';
|
|
16
|
-
source_type: 'user_stated' | 'agent_inferred' | 'user_confirmed' | 'user_document';
|
|
17
|
-
source_hash: string | null;
|
|
18
|
-
source_ref: string | null;
|
|
19
|
-
created_at: number;
|
|
20
|
-
updated_at: number;
|
|
21
|
-
last_accessed_at: number | null;
|
|
22
|
-
access_count: number;
|
|
23
|
-
deleted_at: number | null;
|
|
24
|
-
}
|
|
25
|
-
interface WikiTask {
|
|
26
|
-
id: string;
|
|
27
|
-
entity_id: string;
|
|
28
|
-
description: string;
|
|
29
|
-
status: 'pending' | 'in_progress' | 'done' | 'abandoned';
|
|
30
|
-
priority: number;
|
|
31
|
-
created_at: number;
|
|
32
|
-
updated_at: number;
|
|
33
|
-
resolved_at: number | null;
|
|
34
|
-
deleted_at: number | null;
|
|
35
|
-
}
|
|
36
|
-
interface WikiEvent {
|
|
37
|
-
id: string;
|
|
38
|
-
entity_id: string;
|
|
39
|
-
event_type: 'observation' | 'decision' | 'action' | 'outcome';
|
|
40
|
-
summary: string;
|
|
41
|
-
related_entry_id?: string | null;
|
|
42
|
-
created_at: number;
|
|
43
|
-
}
|
|
44
|
-
interface WikiCheckpoint {
|
|
45
|
-
entity_id: string;
|
|
46
|
-
heal_checkpoint: number;
|
|
47
|
-
memory_checkpoint: number;
|
|
48
|
-
}
|
|
49
|
-
interface ExtractedFact {
|
|
50
|
-
title: string;
|
|
51
|
-
body: string;
|
|
52
|
-
tags: string[];
|
|
53
|
-
confidence: 'certain' | 'inferred' | 'tentative';
|
|
54
|
-
}
|
|
55
|
-
interface ExtractedTask {
|
|
56
|
-
description: string;
|
|
57
|
-
priority: number;
|
|
58
|
-
}
|
|
59
|
-
interface LLMProvider {
|
|
60
|
-
/**
|
|
61
|
-
* Generates text using the developer's LLM of choice.
|
|
62
|
-
* Expected to return the raw text response (typically a JSON string).
|
|
63
|
-
*/
|
|
64
|
-
generateText: (params: {
|
|
65
|
-
systemPrompt: string;
|
|
66
|
-
userPrompt: string;
|
|
67
|
-
}) => Promise<string>;
|
|
68
|
-
}
|
|
69
|
-
interface WikiOptions {
|
|
70
|
-
config?: WikiConfig;
|
|
71
|
-
llmProvider: LLMProvider;
|
|
72
|
-
}
|
|
73
|
-
interface MemoryBundle {
|
|
74
|
-
facts: WikiFact[];
|
|
75
|
-
tasks: WikiTask[];
|
|
76
|
-
events: WikiEvent[];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
declare class WikiMemory {
|
|
80
|
-
private db;
|
|
81
|
-
private prefix;
|
|
82
|
-
private options;
|
|
83
|
-
constructor(db: SQLite.SQLiteDatabase, options: WikiOptions);
|
|
84
|
-
setup(): Promise<void>;
|
|
85
|
-
private formatSearchQuery;
|
|
86
|
-
read(entityId: string, query: string): Promise<MemoryBundle>;
|
|
87
|
-
write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
|
|
88
|
-
runLibrarian(entityId: string): Promise<void>;
|
|
89
|
-
runHeal(entityId: string): Promise<void>;
|
|
90
|
-
forget(entityId: string, params: {
|
|
91
|
-
entryId?: string;
|
|
92
|
-
taskId?: string;
|
|
93
|
-
sourceRef?: string;
|
|
94
|
-
clearAll?: boolean;
|
|
95
|
-
}): Promise<void>;
|
|
96
|
-
ingestDocument(entityId: string, params: {
|
|
97
|
-
sourceRef: string;
|
|
98
|
-
sourceHash: string;
|
|
99
|
-
documentChunk: string;
|
|
100
|
-
}): Promise<void>;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export { type ExtractedFact as E, type LLMProvider as L, type MemoryBundle as M, type WikiOptions as W, WikiMemory as a, type ExtractedTask as b, type WikiCheckpoint as c, type WikiConfig as d, type WikiEvent as e, type WikiFact as f, type WikiTask as g };
|