@equationalapplications/expo-llm-wiki 0.0.0-development
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/LICENSE +21 -0
- package/README.md +259 -0
- package/dist/WikiMemory-B-yFw9Dc.d.mts +118 -0
- package/dist/WikiMemory-B-yFw9Dc.d.ts +118 -0
- package/dist/WikiMemory-BI2Aizwv.d.mts +121 -0
- package/dist/WikiMemory-BI2Aizwv.d.ts +121 -0
- package/dist/WikiMemory-BWTt1Ynm.d.mts +103 -0
- package/dist/WikiMemory-BWTt1Ynm.d.ts +103 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +679 -0
- package/dist/index.mjs +651 -0
- package/dist/react/index.d.mts +72 -0
- package/dist/react/index.d.ts +72 -0
- package/dist/react/index.js +230 -0
- package/dist/react/index.mjs +197 -0
- package/package.json +67 -0
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
maxChunkLength?: 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
|
+
private activeMaintenanceJobs;
|
|
88
|
+
constructor(db: SQLite.SQLiteDatabase, options: WikiOptions);
|
|
89
|
+
setup(): Promise<void>;
|
|
90
|
+
private formatSearchQuery;
|
|
91
|
+
read(entityId: string, query: string): Promise<MemoryBundle>;
|
|
92
|
+
write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
|
|
93
|
+
private runLibrarianThenMaybeHeal;
|
|
94
|
+
private _doRunLibrarian;
|
|
95
|
+
private _doRunHeal;
|
|
96
|
+
runLibrarian(entityId: string): Promise<void>;
|
|
97
|
+
runHeal(entityId: string): Promise<void>;
|
|
98
|
+
forget(entityId: string, params: {
|
|
99
|
+
entryId?: string;
|
|
100
|
+
taskId?: string;
|
|
101
|
+
sourceRef?: string;
|
|
102
|
+
sourceHash?: string;
|
|
103
|
+
clearAll?: boolean;
|
|
104
|
+
}): Promise<{
|
|
105
|
+
deleted: {
|
|
106
|
+
entries: number;
|
|
107
|
+
tasks: number;
|
|
108
|
+
};
|
|
109
|
+
}>;
|
|
110
|
+
ingestDocument(entityId: string, params: {
|
|
111
|
+
sourceRef: string;
|
|
112
|
+
sourceHash: string;
|
|
113
|
+
documentChunk: string;
|
|
114
|
+
maxChunkLength?: number;
|
|
115
|
+
}): Promise<{
|
|
116
|
+
truncated: boolean;
|
|
117
|
+
chunks: number;
|
|
118
|
+
}>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
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 };
|
|
@@ -0,0 +1,103 @@
|
|
|
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 };
|
|
@@ -0,0 +1,103 @@
|
|
|
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 };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as SQLite from 'expo-sqlite';
|
|
2
|
+
import { W as WikiOptions, a as WikiMemory } from './WikiMemory-BI2Aizwv.mjs';
|
|
3
|
+
export { E as ExtractedFact, b as ExtractedTask, L as LLMProvider, M as MemoryBundle, c as WikiCheckpoint, d as WikiConfig, e as WikiEvent, f as WikiFact, g as WikiTask } from './WikiMemory-BI2Aizwv.mjs';
|
|
4
|
+
|
|
5
|
+
declare function createWiki(db: SQLite.SQLiteDatabase, options: WikiOptions): WikiMemory;
|
|
6
|
+
|
|
7
|
+
export { WikiMemory, WikiOptions, createWiki };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as SQLite from 'expo-sqlite';
|
|
2
|
+
import { W as WikiOptions, a as WikiMemory } from './WikiMemory-BI2Aizwv.js';
|
|
3
|
+
export { E as ExtractedFact, b as ExtractedTask, L as LLMProvider, M as MemoryBundle, c as WikiCheckpoint, d as WikiConfig, e as WikiEvent, f as WikiFact, g as WikiTask } from './WikiMemory-BI2Aizwv.js';
|
|
4
|
+
|
|
5
|
+
declare function createWiki(db: SQLite.SQLiteDatabase, options: WikiOptions): WikiMemory;
|
|
6
|
+
|
|
7
|
+
export { WikiMemory, WikiOptions, createWiki };
|