@prometheus-ai/memory 0.5.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 +107 -0
- package/dist/types/cli.d.ts +35 -0
- package/dist/types/config.d.ts +77 -0
- package/dist/types/core/aaak.d.ts +55 -0
- package/dist/types/core/annotations.d.ts +75 -0
- package/dist/types/core/banks.d.ts +33 -0
- package/dist/types/core/beam/consolidate.d.ts +32 -0
- package/dist/types/core/beam/helpers.d.ts +76 -0
- package/dist/types/core/beam/index.d.ts +59 -0
- package/dist/types/core/beam/recall.d.ts +32 -0
- package/dist/types/core/beam/schema.d.ts +2 -0
- package/dist/types/core/beam/store.d.ts +35 -0
- package/dist/types/core/beam/types.d.ts +233 -0
- package/dist/types/core/binary-vectors.d.ts +54 -0
- package/dist/types/core/chat-normalize.d.ts +13 -0
- package/dist/types/core/content-sanitizer.d.ts +18 -0
- package/dist/types/core/cost-log.d.ts +13 -0
- package/dist/types/core/embeddings.d.ts +44 -0
- package/dist/types/core/entities.d.ts +7 -0
- package/dist/types/core/episodic-graph.d.ts +89 -0
- package/dist/types/core/extraction/client.d.ts +31 -0
- package/dist/types/core/extraction/diagnostics.d.ts +51 -0
- package/dist/types/core/extraction/prompts.d.ts +2 -0
- package/dist/types/core/extraction.d.ts +6 -0
- package/dist/types/core/index.d.ts +4 -0
- package/dist/types/core/llm-backends.d.ts +21 -0
- package/dist/types/core/local-llm.d.ts +15 -0
- package/dist/types/core/memory.d.ts +160 -0
- package/dist/types/core/migrations/e6-triplestore-split.d.ts +17 -0
- package/dist/types/core/migrations/index.d.ts +1 -0
- package/dist/types/core/mmr.d.ts +8 -0
- package/dist/types/core/orchestrator.d.ts +20 -0
- package/dist/types/core/patterns.d.ts +61 -0
- package/dist/types/core/plugins.d.ts +109 -0
- package/dist/types/core/polyphonic-recall.d.ts +66 -0
- package/dist/types/core/query-cache.d.ts +46 -0
- package/dist/types/core/query-intent.d.ts +20 -0
- package/dist/types/core/recall-diagnostics.d.ts +48 -0
- package/dist/types/core/runtime-options.d.ts +68 -0
- package/dist/types/core/shmr.d.ts +56 -0
- package/dist/types/core/streaming.d.ts +136 -0
- package/dist/types/core/synonyms.d.ts +46 -0
- package/dist/types/core/temporal-parser.d.ts +16 -0
- package/dist/types/core/token-counter.d.ts +8 -0
- package/dist/types/core/triples.d.ts +63 -0
- package/dist/types/core/typed-memory.d.ts +39 -0
- package/dist/types/core/vector-math.d.ts +1 -0
- package/dist/types/core/veracity-consolidation.d.ts +60 -0
- package/dist/types/core/weibull.d.ts +96 -0
- package/dist/types/db.d.ts +16 -0
- package/dist/types/diagnose.d.ts +24 -0
- package/dist/types/dr/index.d.ts +1 -0
- package/dist/types/dr/recovery.d.ts +68 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/mcp-server.d.ts +40 -0
- package/dist/types/mcp-tools.d.ts +484 -0
- package/dist/types/migrations/e6-triplestore-split.d.ts +1 -0
- package/dist/types/migrations/index.d.ts +1 -0
- package/dist/types/types.d.ts +145 -0
- package/dist/types/util/datetime.d.ts +8 -0
- package/dist/types/util/env.d.ts +10 -0
- package/dist/types/util/ids.d.ts +3 -0
- package/dist/types/util/lru.d.ts +12 -0
- package/dist/types/util/regex.d.ts +10 -0
- package/package.json +85 -0
- package/src/cli.ts +398 -0
- package/src/config.ts +326 -0
- package/src/core/aaak.ts +142 -0
- package/src/core/annotations.ts +457 -0
- package/src/core/banks.ts +133 -0
- package/src/core/beam/consolidate.ts +965 -0
- package/src/core/beam/helpers.ts +977 -0
- package/src/core/beam/index.ts +353 -0
- package/src/core/beam/recall.ts +1100 -0
- package/src/core/beam/schema.ts +423 -0
- package/src/core/beam/store.ts +829 -0
- package/src/core/beam/types.ts +268 -0
- package/src/core/binary-vectors.ts +317 -0
- package/src/core/chat-normalize.ts +160 -0
- package/src/core/content-sanitizer.ts +136 -0
- package/src/core/cost-log.ts +103 -0
- package/src/core/embeddings.ts +423 -0
- package/src/core/entities.ts +259 -0
- package/src/core/episodic-graph.ts +708 -0
- package/src/core/extraction/client.ts +162 -0
- package/src/core/extraction/diagnostics.ts +193 -0
- package/src/core/extraction/prompts.ts +31 -0
- package/src/core/extraction.ts +335 -0
- package/src/core/index.ts +30 -0
- package/src/core/llm-backends.ts +51 -0
- package/src/core/local-llm.ts +436 -0
- package/src/core/memory.ts +630 -0
- package/src/core/migrations/e6-triplestore-split.ts +211 -0
- package/src/core/migrations/index.ts +1 -0
- package/src/core/mmr.ts +71 -0
- package/src/core/orchestrator.ts +62 -0
- package/src/core/patterns.ts +484 -0
- package/src/core/plugins.ts +375 -0
- package/src/core/polyphonic-recall.ts +563 -0
- package/src/core/query-cache.ts +354 -0
- package/src/core/query-intent.ts +139 -0
- package/src/core/recall-diagnostics.ts +157 -0
- package/src/core/runtime-options.ts +119 -0
- package/src/core/shmr.ts +460 -0
- package/src/core/streaming.ts +419 -0
- package/src/core/synonyms.ts +197 -0
- package/src/core/temporal-parser.ts +363 -0
- package/src/core/token-counter.ts +30 -0
- package/src/core/triples.ts +454 -0
- package/src/core/typed-memory.ts +407 -0
- package/src/core/vector-math.ts +23 -0
- package/src/core/veracity-consolidation.ts +477 -0
- package/src/core/weibull.ts +124 -0
- package/src/db.ts +128 -0
- package/src/diagnose.ts +174 -0
- package/src/dr/index.ts +1 -0
- package/src/dr/recovery.ts +405 -0
- package/src/index.ts +33 -0
- package/src/mcp-server.ts +155 -0
- package/src/mcp-tools.ts +970 -0
- package/src/migrations/e6-triplestore-split.ts +1 -0
- package/src/migrations/index.ts +1 -0
- package/src/types.ts +157 -0
- package/src/util/datetime.ts +69 -0
- package/src/util/env.ts +65 -0
- package/src/util/ids.ts +19 -0
- package/src/util/lru.ts +48 -0
- package/src/util/regex.ts +165 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ToolArguments, type ToolDefinition } from "./mcp-tools";
|
|
2
|
+
export interface JsonRpcRequest {
|
|
3
|
+
readonly jsonrpc?: string;
|
|
4
|
+
readonly id?: string | number | null;
|
|
5
|
+
readonly method?: string;
|
|
6
|
+
readonly params?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface JsonRpcResponse {
|
|
9
|
+
readonly jsonrpc: "2.0";
|
|
10
|
+
readonly id: string | number | null;
|
|
11
|
+
readonly result?: unknown;
|
|
12
|
+
readonly error?: {
|
|
13
|
+
readonly code: number;
|
|
14
|
+
readonly message: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface ListToolsResponse {
|
|
18
|
+
readonly tools: readonly ToolDefinition[];
|
|
19
|
+
}
|
|
20
|
+
export interface CallToolContent {
|
|
21
|
+
readonly type: "text";
|
|
22
|
+
readonly text: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CallToolResponse {
|
|
25
|
+
readonly content: readonly CallToolContent[];
|
|
26
|
+
readonly isError?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface WritableOutput {
|
|
29
|
+
write(chunk: string): unknown;
|
|
30
|
+
}
|
|
31
|
+
export declare function listToolsJson(): ListToolsResponse;
|
|
32
|
+
export declare function callToolJson(name: string, args?: ToolArguments): Promise<CallToolResponse>;
|
|
33
|
+
export declare function handleJsonRpc(request: JsonRpcRequest): Promise<JsonRpcResponse | null>;
|
|
34
|
+
export declare function runStdio(input?: ReadableStream<Uint8Array>, output?: WritableOutput): Promise<void>;
|
|
35
|
+
export declare function runMcpServer(transport?: string, options?: {
|
|
36
|
+
port?: number;
|
|
37
|
+
bank?: string;
|
|
38
|
+
host?: string;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
export declare function main(argv?: readonly string[]): Promise<void>;
|
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
2
|
+
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
3
|
+
[key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
export type ToolArguments = Record<string, unknown>;
|
|
6
|
+
export type ToolResult = Record<string, unknown>;
|
|
7
|
+
export interface ToolDefinition {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly description: string;
|
|
10
|
+
readonly inputSchema: {
|
|
11
|
+
readonly type: "object";
|
|
12
|
+
readonly properties: Record<string, unknown>;
|
|
13
|
+
readonly required?: readonly string[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare const REMEMBER_SCHEMA: {
|
|
17
|
+
readonly type: "object";
|
|
18
|
+
readonly properties: {
|
|
19
|
+
readonly content: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "The memory content to store.";
|
|
22
|
+
};
|
|
23
|
+
readonly importance: {
|
|
24
|
+
readonly type: "number";
|
|
25
|
+
readonly description: "Importance score from 0.0 to 1.0.";
|
|
26
|
+
readonly default: 0.5;
|
|
27
|
+
};
|
|
28
|
+
readonly source: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly description: "Source tag for this memory.";
|
|
31
|
+
readonly default: "user";
|
|
32
|
+
};
|
|
33
|
+
readonly scope: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly description: "Memory scope: session, global, channel, or a custom scope.";
|
|
36
|
+
readonly default: "session";
|
|
37
|
+
};
|
|
38
|
+
readonly valid_until: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
readonly description: "Optional expiry date or timestamp.";
|
|
41
|
+
};
|
|
42
|
+
readonly extract_entities: {
|
|
43
|
+
readonly type: "boolean";
|
|
44
|
+
readonly description: "Extract named entities for fuzzy recall.";
|
|
45
|
+
readonly default: false;
|
|
46
|
+
};
|
|
47
|
+
readonly extract: {
|
|
48
|
+
readonly type: "boolean";
|
|
49
|
+
readonly description: "Extract structured facts from content.";
|
|
50
|
+
readonly default: false;
|
|
51
|
+
};
|
|
52
|
+
readonly metadata: {
|
|
53
|
+
readonly type: "object";
|
|
54
|
+
readonly description: "Optional key-value metadata.";
|
|
55
|
+
readonly default: {};
|
|
56
|
+
};
|
|
57
|
+
readonly veracity: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly description: "Confidence label for the memory.";
|
|
60
|
+
readonly default: "unknown";
|
|
61
|
+
};
|
|
62
|
+
readonly author_id: {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
readonly description: "Author identifier for this MCP call.";
|
|
65
|
+
};
|
|
66
|
+
readonly author_type: {
|
|
67
|
+
readonly type: "string";
|
|
68
|
+
readonly description: "Author type: human, agent, or system.";
|
|
69
|
+
};
|
|
70
|
+
readonly channel_id: {
|
|
71
|
+
readonly type: "string";
|
|
72
|
+
readonly description: "Channel or group this memory belongs to.";
|
|
73
|
+
};
|
|
74
|
+
readonly bank: {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
readonly description: "Memory bank to store in.";
|
|
77
|
+
readonly default: "default";
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
readonly required: readonly ["content"];
|
|
81
|
+
};
|
|
82
|
+
export declare const RECALL_SCHEMA: {
|
|
83
|
+
readonly type: "object";
|
|
84
|
+
readonly properties: {
|
|
85
|
+
readonly query: {
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
readonly description: "Natural-language search query.";
|
|
88
|
+
};
|
|
89
|
+
readonly limit: {
|
|
90
|
+
readonly type: "integer";
|
|
91
|
+
readonly description: "Maximum results to return.";
|
|
92
|
+
readonly default: 5;
|
|
93
|
+
};
|
|
94
|
+
readonly top_k: {
|
|
95
|
+
readonly type: "integer";
|
|
96
|
+
readonly description: "Maximum results to return.";
|
|
97
|
+
readonly default: 5;
|
|
98
|
+
};
|
|
99
|
+
readonly bank: {
|
|
100
|
+
readonly type: "string";
|
|
101
|
+
readonly description: "Memory bank to search.";
|
|
102
|
+
readonly default: "default";
|
|
103
|
+
};
|
|
104
|
+
readonly temporal_weight: {
|
|
105
|
+
readonly type: "number";
|
|
106
|
+
readonly description: "Temporal boost weight. 0.0 disables recency boost.";
|
|
107
|
+
readonly default: 0;
|
|
108
|
+
};
|
|
109
|
+
readonly query_time: {
|
|
110
|
+
readonly type: "string";
|
|
111
|
+
readonly description: "ISO timestamp to treat as now for temporal scoring.";
|
|
112
|
+
};
|
|
113
|
+
readonly temporal_halflife: {
|
|
114
|
+
readonly type: "number";
|
|
115
|
+
readonly description: "Temporal decay half-life in hours.";
|
|
116
|
+
readonly default: 24;
|
|
117
|
+
};
|
|
118
|
+
readonly vec_weight: {
|
|
119
|
+
readonly type: "number";
|
|
120
|
+
readonly description: "Vector similarity weight.";
|
|
121
|
+
};
|
|
122
|
+
readonly fts_weight: {
|
|
123
|
+
readonly type: "number";
|
|
124
|
+
readonly description: "Full-text search weight.";
|
|
125
|
+
};
|
|
126
|
+
readonly importance_weight: {
|
|
127
|
+
readonly type: "number";
|
|
128
|
+
readonly description: "Importance score weight.";
|
|
129
|
+
};
|
|
130
|
+
readonly author_id: {
|
|
131
|
+
readonly type: "string";
|
|
132
|
+
readonly description: "Filter by author identifier.";
|
|
133
|
+
};
|
|
134
|
+
readonly author_type: {
|
|
135
|
+
readonly type: "string";
|
|
136
|
+
readonly description: "Filter by author type.";
|
|
137
|
+
};
|
|
138
|
+
readonly channel_id: {
|
|
139
|
+
readonly type: "string";
|
|
140
|
+
readonly description: "Filter by channel/group.";
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
readonly required: readonly ["query"];
|
|
144
|
+
};
|
|
145
|
+
export declare const SHARED_REMEMBER_SCHEMA: {
|
|
146
|
+
readonly type: "object";
|
|
147
|
+
readonly properties: {
|
|
148
|
+
readonly content: {
|
|
149
|
+
readonly type: "string";
|
|
150
|
+
readonly description: "Surface memory content to store.";
|
|
151
|
+
};
|
|
152
|
+
readonly kind: {
|
|
153
|
+
readonly type: "string";
|
|
154
|
+
readonly description: "meta | preference | correction | identity";
|
|
155
|
+
readonly default: "meta";
|
|
156
|
+
};
|
|
157
|
+
readonly importance: {
|
|
158
|
+
readonly type: "number";
|
|
159
|
+
readonly description: "Importance score from 0.0 to 1.0.";
|
|
160
|
+
readonly default: 0.8;
|
|
161
|
+
};
|
|
162
|
+
readonly veracity: {
|
|
163
|
+
readonly type: "string";
|
|
164
|
+
readonly description: "Confidence label.";
|
|
165
|
+
readonly default: "unknown";
|
|
166
|
+
};
|
|
167
|
+
readonly metadata: {
|
|
168
|
+
readonly type: "object";
|
|
169
|
+
readonly description: "Optional metadata object.";
|
|
170
|
+
readonly default: {};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
readonly required: readonly ["content"];
|
|
174
|
+
};
|
|
175
|
+
export declare const SHARED_RECALL_SCHEMA: {
|
|
176
|
+
readonly type: "object";
|
|
177
|
+
readonly properties: {
|
|
178
|
+
readonly query: {
|
|
179
|
+
readonly type: "string";
|
|
180
|
+
readonly description: "Surface memory query.";
|
|
181
|
+
};
|
|
182
|
+
readonly limit: {
|
|
183
|
+
readonly type: "integer";
|
|
184
|
+
readonly default: 5;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
readonly required: readonly ["query"];
|
|
188
|
+
};
|
|
189
|
+
export declare const SHARED_FORGET_SCHEMA: {
|
|
190
|
+
readonly type: "object";
|
|
191
|
+
readonly properties: {
|
|
192
|
+
readonly memory_id: {
|
|
193
|
+
readonly type: "string";
|
|
194
|
+
readonly description: "Memory ID to delete.";
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
readonly required: readonly ["memory_id"];
|
|
198
|
+
};
|
|
199
|
+
export declare const SLEEP_SCHEMA: {
|
|
200
|
+
readonly type: "object";
|
|
201
|
+
readonly properties: {
|
|
202
|
+
readonly dry_run: {
|
|
203
|
+
readonly type: "boolean";
|
|
204
|
+
readonly description: "Preview consolidation without writes.";
|
|
205
|
+
readonly default: false;
|
|
206
|
+
};
|
|
207
|
+
readonly all_sessions: {
|
|
208
|
+
readonly type: "boolean";
|
|
209
|
+
readonly description: "Consolidate all eligible sessions.";
|
|
210
|
+
readonly default: false;
|
|
211
|
+
};
|
|
212
|
+
readonly bank: {
|
|
213
|
+
readonly type: "string";
|
|
214
|
+
readonly description: "Memory bank to consolidate.";
|
|
215
|
+
readonly default: "default";
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
export declare const INVALIDATE_SCHEMA: {
|
|
220
|
+
readonly type: "object";
|
|
221
|
+
readonly properties: {
|
|
222
|
+
readonly memory_id: {
|
|
223
|
+
readonly type: "string";
|
|
224
|
+
readonly description: "ID of memory to invalidate.";
|
|
225
|
+
};
|
|
226
|
+
readonly replacement_id: {
|
|
227
|
+
readonly type: "string";
|
|
228
|
+
readonly description: "Optional replacement memory ID.";
|
|
229
|
+
};
|
|
230
|
+
readonly bank: {
|
|
231
|
+
readonly type: "string";
|
|
232
|
+
readonly default: "default";
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
readonly required: readonly ["memory_id"];
|
|
236
|
+
};
|
|
237
|
+
export declare const VALIDATE_SCHEMA: {
|
|
238
|
+
readonly type: "object";
|
|
239
|
+
readonly properties: {
|
|
240
|
+
readonly memory_id: {
|
|
241
|
+
readonly type: "string";
|
|
242
|
+
readonly description: "ID of memory to validate.";
|
|
243
|
+
};
|
|
244
|
+
readonly action: {
|
|
245
|
+
readonly type: "string";
|
|
246
|
+
readonly enum: readonly ["attest", "update", "invalidate", "delete"];
|
|
247
|
+
};
|
|
248
|
+
readonly validator: {
|
|
249
|
+
readonly type: "string";
|
|
250
|
+
readonly description: "Agent identifier performing validation.";
|
|
251
|
+
};
|
|
252
|
+
readonly new_content: {
|
|
253
|
+
readonly type: "string";
|
|
254
|
+
readonly description: "New content for action=update.";
|
|
255
|
+
};
|
|
256
|
+
readonly note: {
|
|
257
|
+
readonly type: "string";
|
|
258
|
+
readonly description: "Optional reason or evidence.";
|
|
259
|
+
};
|
|
260
|
+
readonly bank: {
|
|
261
|
+
readonly type: "string";
|
|
262
|
+
readonly enum: readonly ["private", "surface"];
|
|
263
|
+
readonly default: "private";
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
readonly required: readonly ["memory_id", "action"];
|
|
267
|
+
};
|
|
268
|
+
export declare const GET_SCHEMA: {
|
|
269
|
+
readonly type: "object";
|
|
270
|
+
readonly properties: {
|
|
271
|
+
readonly memory_id: {
|
|
272
|
+
readonly type: "string";
|
|
273
|
+
readonly description: "The memory ID to retrieve.";
|
|
274
|
+
};
|
|
275
|
+
readonly bank: {
|
|
276
|
+
readonly type: "string";
|
|
277
|
+
readonly default: "default";
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
readonly required: readonly ["memory_id"];
|
|
281
|
+
};
|
|
282
|
+
export declare const TRIPLE_ADD_SCHEMA: {
|
|
283
|
+
readonly type: "object";
|
|
284
|
+
readonly properties: {
|
|
285
|
+
readonly subject: {
|
|
286
|
+
readonly type: "string";
|
|
287
|
+
};
|
|
288
|
+
readonly predicate: {
|
|
289
|
+
readonly type: "string";
|
|
290
|
+
};
|
|
291
|
+
readonly object: {
|
|
292
|
+
readonly type: "string";
|
|
293
|
+
};
|
|
294
|
+
readonly valid_from: {
|
|
295
|
+
readonly type: "string";
|
|
296
|
+
readonly description: "ISO date.";
|
|
297
|
+
};
|
|
298
|
+
readonly source: {
|
|
299
|
+
readonly type: "string";
|
|
300
|
+
readonly default: "conversation";
|
|
301
|
+
};
|
|
302
|
+
readonly confidence: {
|
|
303
|
+
readonly type: "number";
|
|
304
|
+
readonly default: 1;
|
|
305
|
+
};
|
|
306
|
+
readonly bank: {
|
|
307
|
+
readonly type: "string";
|
|
308
|
+
readonly default: "default";
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
readonly required: readonly ["subject", "predicate", "object"];
|
|
312
|
+
};
|
|
313
|
+
export declare const TRIPLE_QUERY_SCHEMA: {
|
|
314
|
+
readonly type: "object";
|
|
315
|
+
readonly properties: {
|
|
316
|
+
readonly subject: {
|
|
317
|
+
readonly type: "string";
|
|
318
|
+
};
|
|
319
|
+
readonly predicate: {
|
|
320
|
+
readonly type: "string";
|
|
321
|
+
};
|
|
322
|
+
readonly object: {
|
|
323
|
+
readonly type: "string";
|
|
324
|
+
};
|
|
325
|
+
readonly as_of: {
|
|
326
|
+
readonly type: "string";
|
|
327
|
+
};
|
|
328
|
+
readonly bank: {
|
|
329
|
+
readonly type: "string";
|
|
330
|
+
readonly default: "default";
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
export declare const SCRATCHPAD_WRITE_SCHEMA: {
|
|
335
|
+
readonly type: "object";
|
|
336
|
+
readonly properties: {
|
|
337
|
+
readonly content: {
|
|
338
|
+
readonly type: "string";
|
|
339
|
+
readonly description: "Content to write to scratchpad.";
|
|
340
|
+
};
|
|
341
|
+
readonly bank: {
|
|
342
|
+
readonly type: "string";
|
|
343
|
+
readonly default: "default";
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
readonly required: readonly ["content"];
|
|
347
|
+
};
|
|
348
|
+
export declare const SCRATCHPAD_READ_SCHEMA: {
|
|
349
|
+
readonly type: "object";
|
|
350
|
+
readonly properties: {
|
|
351
|
+
readonly bank: {
|
|
352
|
+
readonly type: "string";
|
|
353
|
+
readonly default: "default";
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
export declare const SCRATCHPAD_CLEAR_SCHEMA: {
|
|
358
|
+
readonly type: "object";
|
|
359
|
+
readonly properties: {
|
|
360
|
+
readonly bank: {
|
|
361
|
+
readonly type: "string";
|
|
362
|
+
readonly default: "default";
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
export declare const EXPORT_SCHEMA: {
|
|
367
|
+
readonly type: "object";
|
|
368
|
+
readonly properties: {
|
|
369
|
+
readonly output_path: {
|
|
370
|
+
readonly type: "string";
|
|
371
|
+
readonly description: "File path to write the export JSON.";
|
|
372
|
+
};
|
|
373
|
+
readonly bank: {
|
|
374
|
+
readonly type: "string";
|
|
375
|
+
readonly default: "default";
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
readonly required: readonly ["output_path"];
|
|
379
|
+
};
|
|
380
|
+
export declare const UPDATE_SCHEMA: {
|
|
381
|
+
readonly type: "object";
|
|
382
|
+
readonly properties: {
|
|
383
|
+
readonly memory_id: {
|
|
384
|
+
readonly type: "string";
|
|
385
|
+
readonly description: "ID of the memory to update.";
|
|
386
|
+
};
|
|
387
|
+
readonly content: {
|
|
388
|
+
readonly type: "string";
|
|
389
|
+
readonly description: "New content for the memory.";
|
|
390
|
+
};
|
|
391
|
+
readonly importance: {
|
|
392
|
+
readonly type: "number";
|
|
393
|
+
readonly description: "New importance score.";
|
|
394
|
+
};
|
|
395
|
+
readonly bank: {
|
|
396
|
+
readonly type: "string";
|
|
397
|
+
readonly default: "default";
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
readonly required: readonly ["memory_id", "content"];
|
|
401
|
+
};
|
|
402
|
+
export declare const FORGET_SCHEMA: {
|
|
403
|
+
readonly type: "object";
|
|
404
|
+
readonly properties: {
|
|
405
|
+
readonly memory_id: {
|
|
406
|
+
readonly type: "string";
|
|
407
|
+
readonly description: "ID of the memory to delete.";
|
|
408
|
+
};
|
|
409
|
+
readonly bank: {
|
|
410
|
+
readonly type: "string";
|
|
411
|
+
readonly default: "default";
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
readonly required: readonly ["memory_id"];
|
|
415
|
+
};
|
|
416
|
+
export declare const IMPORT_SCHEMA: {
|
|
417
|
+
readonly type: "object";
|
|
418
|
+
readonly properties: {
|
|
419
|
+
readonly input_path: {
|
|
420
|
+
readonly type: "string";
|
|
421
|
+
readonly description: "File path to read the export JSON from.";
|
|
422
|
+
};
|
|
423
|
+
readonly force: {
|
|
424
|
+
readonly type: "boolean";
|
|
425
|
+
readonly description: "Overwrite existing records instead of skipping.";
|
|
426
|
+
readonly default: false;
|
|
427
|
+
};
|
|
428
|
+
readonly bank: {
|
|
429
|
+
readonly type: "string";
|
|
430
|
+
readonly default: "default";
|
|
431
|
+
};
|
|
432
|
+
};
|
|
433
|
+
readonly required: readonly ["input_path"];
|
|
434
|
+
};
|
|
435
|
+
export declare const GRAPH_QUERY_SCHEMA: {
|
|
436
|
+
readonly type: "object";
|
|
437
|
+
readonly properties: {
|
|
438
|
+
readonly seed_memory_id: {
|
|
439
|
+
readonly type: "string";
|
|
440
|
+
};
|
|
441
|
+
readonly max_hops: {
|
|
442
|
+
readonly type: "integer";
|
|
443
|
+
readonly default: 2;
|
|
444
|
+
};
|
|
445
|
+
readonly edge_type: {
|
|
446
|
+
readonly type: "string";
|
|
447
|
+
};
|
|
448
|
+
readonly min_weight: {
|
|
449
|
+
readonly type: "number";
|
|
450
|
+
readonly default: 0;
|
|
451
|
+
};
|
|
452
|
+
readonly bank: {
|
|
453
|
+
readonly type: "string";
|
|
454
|
+
readonly default: "default";
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
readonly required: readonly ["seed_memory_id"];
|
|
458
|
+
};
|
|
459
|
+
export declare const GRAPH_LINK_SCHEMA: {
|
|
460
|
+
readonly type: "object";
|
|
461
|
+
readonly properties: {
|
|
462
|
+
readonly source_id: {
|
|
463
|
+
readonly type: "string";
|
|
464
|
+
};
|
|
465
|
+
readonly target_id: {
|
|
466
|
+
readonly type: "string";
|
|
467
|
+
};
|
|
468
|
+
readonly relationship: {
|
|
469
|
+
readonly type: "string";
|
|
470
|
+
};
|
|
471
|
+
readonly weight: {
|
|
472
|
+
readonly type: "number";
|
|
473
|
+
readonly default: 0.5;
|
|
474
|
+
};
|
|
475
|
+
readonly bank: {
|
|
476
|
+
readonly type: "string";
|
|
477
|
+
readonly default: "default";
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
readonly required: readonly ["source_id", "target_id", "relationship"];
|
|
481
|
+
};
|
|
482
|
+
export declare const TOOLS: readonly ToolDefinition[];
|
|
483
|
+
export declare function handleToolCall(name: string, args?: ToolArguments): Promise<ToolResult>;
|
|
484
|
+
export declare function getToolDefinitions(): readonly ToolDefinition[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../core/migrations/e6-triplestore-split";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./e6-triplestore-split";
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export type JsonScalar = string | number | boolean | null;
|
|
2
|
+
export type JsonValue = JsonScalar | JsonValue[] | {
|
|
3
|
+
[key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
export type Metadata = Record<string, JsonValue>;
|
|
6
|
+
export type Veracity = "stated" | "inferred" | "tool" | "imported" | "unknown" | (string & {});
|
|
7
|
+
export type Vector = Float32Array | readonly number[];
|
|
8
|
+
export type VecType = "float32" | "int8" | "bit";
|
|
9
|
+
export interface MemoryRow {
|
|
10
|
+
id: string;
|
|
11
|
+
content: string;
|
|
12
|
+
source: string | null;
|
|
13
|
+
timestamp: string | null;
|
|
14
|
+
session_id: string;
|
|
15
|
+
importance: number;
|
|
16
|
+
metadata_json: string | null;
|
|
17
|
+
veracity: Veracity;
|
|
18
|
+
created_at: string;
|
|
19
|
+
recall_count?: number | null;
|
|
20
|
+
last_recalled?: string | null;
|
|
21
|
+
valid_until?: string | null;
|
|
22
|
+
superseded_by?: string | null;
|
|
23
|
+
scope?: string | null;
|
|
24
|
+
memory_type?: string | null;
|
|
25
|
+
trust_tier?: string | null;
|
|
26
|
+
author_id?: string | null;
|
|
27
|
+
author_type?: string | null;
|
|
28
|
+
channel_id?: string | null;
|
|
29
|
+
topic?: string | null;
|
|
30
|
+
}
|
|
31
|
+
export type WorkingMemoryRow = MemoryRow;
|
|
32
|
+
export interface EpisodicMemoryRow extends MemoryRow {
|
|
33
|
+
rowid: number;
|
|
34
|
+
summary_of: string;
|
|
35
|
+
tier?: number | null;
|
|
36
|
+
degraded_at?: string | null;
|
|
37
|
+
event_date?: string | null;
|
|
38
|
+
episode_type?: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface MemoryInput {
|
|
41
|
+
content: string;
|
|
42
|
+
source?: string | null;
|
|
43
|
+
timestamp?: string | Date | null;
|
|
44
|
+
session_id?: string;
|
|
45
|
+
importance?: number;
|
|
46
|
+
metadata?: Metadata | null;
|
|
47
|
+
veracity?: Veracity;
|
|
48
|
+
scope?: string | null;
|
|
49
|
+
valid_until?: string | Date | null;
|
|
50
|
+
}
|
|
51
|
+
export interface WorkingMemory {
|
|
52
|
+
id: string;
|
|
53
|
+
content: string;
|
|
54
|
+
source: string | null;
|
|
55
|
+
timestamp: string | null;
|
|
56
|
+
sessionId: string;
|
|
57
|
+
importance: number;
|
|
58
|
+
metadata: Metadata | null;
|
|
59
|
+
veracity: Veracity;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
}
|
|
62
|
+
export interface EpisodicMemory extends WorkingMemory {
|
|
63
|
+
rowid: number;
|
|
64
|
+
summaryOf: string;
|
|
65
|
+
tier: number;
|
|
66
|
+
degradedAt: string | null;
|
|
67
|
+
}
|
|
68
|
+
export interface RecallResult {
|
|
69
|
+
id: string;
|
|
70
|
+
content: string;
|
|
71
|
+
source: string | null;
|
|
72
|
+
timestamp: string | null;
|
|
73
|
+
session_id?: string;
|
|
74
|
+
importance?: number;
|
|
75
|
+
metadata?: Metadata | null;
|
|
76
|
+
metadata_json?: string | null;
|
|
77
|
+
veracity?: Veracity;
|
|
78
|
+
score: number;
|
|
79
|
+
vec_score?: number;
|
|
80
|
+
fts_score?: number;
|
|
81
|
+
importance_score?: number;
|
|
82
|
+
recency_score?: number;
|
|
83
|
+
temporal_score?: number;
|
|
84
|
+
rank?: number;
|
|
85
|
+
distance?: number;
|
|
86
|
+
memory_type?: string | null;
|
|
87
|
+
trust_tier?: string | null;
|
|
88
|
+
}
|
|
89
|
+
export interface AnnotationRow {
|
|
90
|
+
id: number;
|
|
91
|
+
memory_id: string;
|
|
92
|
+
kind: string;
|
|
93
|
+
value: string;
|
|
94
|
+
source: string | null;
|
|
95
|
+
confidence: number;
|
|
96
|
+
created_at: string;
|
|
97
|
+
}
|
|
98
|
+
export interface TripleRow {
|
|
99
|
+
id: number;
|
|
100
|
+
subject: string;
|
|
101
|
+
predicate: string;
|
|
102
|
+
object: string;
|
|
103
|
+
valid_from: string;
|
|
104
|
+
valid_until: string | null;
|
|
105
|
+
source: string | null;
|
|
106
|
+
confidence: number;
|
|
107
|
+
created_at: string;
|
|
108
|
+
}
|
|
109
|
+
export interface FactRow {
|
|
110
|
+
fact_id: string;
|
|
111
|
+
session_id: string;
|
|
112
|
+
subject: string;
|
|
113
|
+
predicate: string;
|
|
114
|
+
object: string;
|
|
115
|
+
timestamp: string | null;
|
|
116
|
+
source_msg_id: string | null;
|
|
117
|
+
confidence: number;
|
|
118
|
+
created_at: string;
|
|
119
|
+
}
|
|
120
|
+
export interface EmbeddingRow {
|
|
121
|
+
memory_id: string;
|
|
122
|
+
embedding_json: string;
|
|
123
|
+
model: string | null;
|
|
124
|
+
created_at: string;
|
|
125
|
+
}
|
|
126
|
+
export interface EmbeddingResult {
|
|
127
|
+
memory_id: string;
|
|
128
|
+
embedding: Vector;
|
|
129
|
+
model: string | null;
|
|
130
|
+
dim: number;
|
|
131
|
+
}
|
|
132
|
+
export interface VectorSearchResult {
|
|
133
|
+
rowid?: number;
|
|
134
|
+
id?: string;
|
|
135
|
+
memory_id?: string;
|
|
136
|
+
distance: number;
|
|
137
|
+
score?: number;
|
|
138
|
+
}
|
|
139
|
+
export interface MemoryStats {
|
|
140
|
+
working_count: number;
|
|
141
|
+
episodic_count: number;
|
|
142
|
+
embedding_count?: number;
|
|
143
|
+
annotation_count?: number;
|
|
144
|
+
triple_count?: number;
|
|
145
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type QueryTime = string | Date | null | undefined;
|
|
2
|
+
export declare function parseIsoDateTimeUtc(value: string): Date;
|
|
3
|
+
export declare function normalizeDateTimeUtc(value: Date): Date;
|
|
4
|
+
export declare function parseQueryTime(value: QueryTime): Date;
|
|
5
|
+
export declare function parseTsFast(value: string): Date | undefined;
|
|
6
|
+
export declare function toUtcIso(value?: Date): string;
|
|
7
|
+
export declare function recencyDecay(timestamp: string | Date | null | undefined, halflifeHours?: number, now?: Date): number;
|
|
8
|
+
export declare function temporalBoost(memoryTimestamp: string, queryTime?: QueryTime, halflifeHours?: number): number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Env = Record<string, string | undefined>;
|
|
2
|
+
export declare function envValue(name: string, env?: Env): string | undefined;
|
|
3
|
+
export declare function envString(name: string, defaultValue?: string, env?: Env): string;
|
|
4
|
+
export declare function envOptionalString(name: string, env?: Env): string | undefined;
|
|
5
|
+
export declare function envTruthy(name: string, env?: Env): boolean;
|
|
6
|
+
export declare function envDisabled(name: string, env?: Env): boolean;
|
|
7
|
+
export declare function envBool(name: string, defaultValue: boolean, env?: Env): boolean;
|
|
8
|
+
export declare function envInt(name: string, defaultValue: number, env?: Env): number;
|
|
9
|
+
export declare function envFloat(name: string, defaultValue: number, env?: Env): number;
|
|
10
|
+
export declare function envOneOf<T extends string>(name: string, allowed: readonly T[], defaultValue: T, env?: Env): T;
|