@tangleai/context 0.21.1 → 0.24.1
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/CHANGELOG.md +34 -0
- package/README.md +24 -23
- package/package.json +4 -4
- package/src/archive.d.ts +3 -3
- package/src/archive.js +49 -44
- package/src/environment.d.ts +52 -22
- package/src/environment.js +491 -548
- package/src/evidence.d.ts +5 -10
- package/src/evidence.js +49 -51
- package/src/index.d.ts +10 -9
- package/src/index.js +9 -10
- package/src/ledger.d.ts +123 -83
- package/src/ledger.js +1039 -1185
- package/src/recall.d.ts +44 -23
- package/src/recall.js +48 -68
- package/src/retention.d.ts +7 -7
- package/src/retention.js +88 -71
- package/src/schemas/evidence.d.ts +11 -10
- package/src/schemas/evidence.js +14 -21
- package/src/schemas/ledger.d.ts +737 -430
- package/src/schemas/ledger.js +130 -243
- package/src/schemas/patch.d.ts +122 -108
- package/src/schemas/patch.js +59 -64
- package/src/storage/memory.d.ts +3 -8
- package/src/storage/memory.js +41 -43
- package/src/storage/slot.d.ts +3 -4
- package/src/storage/slot.js +104 -96
- package/src/storage/transaction.d.ts +3 -18
- package/src/storage/transaction.js +22 -34
package/src/schemas/ledger.d.ts
CHANGED
|
@@ -1,147 +1,177 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The ledger's four record schemas, as plain JSON Schema documents
|
|
3
|
+
* compiled by `JarenValidator` when a ledger is constructed. A malformed
|
|
4
|
+
* write is rejected at the boundary exactly the way a malformed tool call
|
|
5
|
+
* is — the suite validating its own durable state with its own validator.
|
|
6
|
+
*
|
|
7
|
+
* They live in one module rather than four files because they are small,
|
|
8
|
+
* they share a vocabulary (`at` is an RFC 3339 timestamp everywhere, ids
|
|
9
|
+
* are non-empty strings everywhere), and one file is where a reader looks
|
|
10
|
+
* for "what may a ledger hold".
|
|
11
|
+
*
|
|
12
|
+
* Why four kinds and not one bag: they differ in every dimension that
|
|
13
|
+
* matters. Lifetime — a goal is superseded, a memory accumulates, a slot
|
|
14
|
+
* is garbage. Retrieval — a goal is always in context, memories are
|
|
15
|
+
* recalled by relevance, slots are addressed by name. Write rule — a
|
|
16
|
+
* memory or skill may be proposed by a model (and must therefore carry
|
|
17
|
+
* evidence), a slot is written by the harness and never proposed.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* One active objective. Singular by construction: a second `setGoal`
|
|
21
|
+
* supersedes this one and archives it, so "what am I doing" has exactly
|
|
22
|
+
* one answer at any moment.
|
|
23
|
+
*
|
|
24
|
+
* `progress` is storage only in this order — an append-only record of
|
|
25
|
+
* what happened, with the evidence for it. Nothing here interprets a
|
|
26
|
+
* progress entry or decides when a goal is done.
|
|
27
|
+
*/
|
|
28
|
+
export declare const GOAL_SCHEMA: {
|
|
29
|
+
$id: string;
|
|
30
|
+
type: string;
|
|
31
|
+
properties: {
|
|
32
|
+
objective: {
|
|
33
|
+
type: string;
|
|
34
|
+
minLength: number;
|
|
35
|
+
};
|
|
36
|
+
createdAt: {
|
|
37
|
+
type: string;
|
|
38
|
+
format: string;
|
|
39
|
+
pattern: string;
|
|
40
|
+
};
|
|
41
|
+
status: {
|
|
42
|
+
enum: string[];
|
|
43
|
+
};
|
|
44
|
+
progress: {
|
|
45
|
+
type: string;
|
|
46
|
+
items: {
|
|
47
|
+
type: string;
|
|
48
|
+
properties: {
|
|
49
|
+
at: {
|
|
50
|
+
type: string;
|
|
51
|
+
format: string;
|
|
52
|
+
pattern: string;
|
|
53
|
+
};
|
|
54
|
+
id: {
|
|
55
|
+
type: string;
|
|
56
|
+
minLength: number;
|
|
57
|
+
};
|
|
58
|
+
note: {
|
|
59
|
+
type: string;
|
|
60
|
+
minLength: number;
|
|
61
|
+
};
|
|
62
|
+
evidence: {
|
|
63
|
+
type: string;
|
|
64
|
+
minLength: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
required: string[];
|
|
68
|
+
additionalProperties: boolean;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
checkpoint: {
|
|
72
|
+
type: string;
|
|
73
|
+
properties: {
|
|
74
|
+
version: {
|
|
75
|
+
const: number;
|
|
76
|
+
};
|
|
77
|
+
records: {
|
|
78
|
+
type: string;
|
|
79
|
+
items: {
|
|
80
|
+
type: string;
|
|
81
|
+
properties: {
|
|
82
|
+
note: {
|
|
83
|
+
type: string;
|
|
84
|
+
minLength: number;
|
|
85
|
+
};
|
|
86
|
+
evidence: {
|
|
87
|
+
type: string;
|
|
88
|
+
minLength: number;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
required: string[];
|
|
92
|
+
additionalProperties: boolean;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
sources: {
|
|
96
|
+
type: string;
|
|
97
|
+
items: {
|
|
98
|
+
type: string;
|
|
99
|
+
properties: {
|
|
100
|
+
id: {
|
|
101
|
+
type: string;
|
|
102
|
+
minLength: number;
|
|
103
|
+
};
|
|
104
|
+
at: {
|
|
105
|
+
type: string;
|
|
106
|
+
format: string;
|
|
107
|
+
pattern: string;
|
|
108
|
+
};
|
|
109
|
+
record: {
|
|
110
|
+
type: string;
|
|
111
|
+
minimum: number;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
required: string[];
|
|
115
|
+
additionalProperties: boolean;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
required: string[];
|
|
120
|
+
additionalProperties: boolean;
|
|
121
|
+
};
|
|
122
|
+
retention: {
|
|
123
|
+
type: string;
|
|
124
|
+
properties: {
|
|
125
|
+
version: {
|
|
126
|
+
const: number;
|
|
127
|
+
};
|
|
128
|
+
reason: {
|
|
129
|
+
const: string;
|
|
130
|
+
};
|
|
131
|
+
retired: {
|
|
132
|
+
type: string;
|
|
133
|
+
items: {
|
|
134
|
+
type: string;
|
|
135
|
+
minLength: number;
|
|
136
|
+
};
|
|
137
|
+
uniqueItems: boolean;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
required: string[];
|
|
141
|
+
additionalProperties: boolean;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
required: string[];
|
|
145
|
+
additionalProperties: boolean;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* A fact worth carrying past this context window.
|
|
149
|
+
*
|
|
150
|
+
* `evidence` is REQUIRED, and that is the load-bearing part: a memory
|
|
151
|
+
* without evidence is not a memory, it is a guess, and a ledger full of
|
|
152
|
+
* guesses is worse than an empty one. It is also what makes a
|
|
153
|
+
* model-proposed refinement auditable — the reviewer of a patch can ask
|
|
154
|
+
* "on what basis" and get an answer from the record itself.
|
|
155
|
+
*
|
|
156
|
+
* `embedding` + `embeddedBy` are optional and travel together: a memory
|
|
157
|
+
* that carries them can be recalled by meaning through the embedder
|
|
158
|
+
* seam; one that does not is recalled by tag and recency exactly as
|
|
159
|
+
* before, and ranked recall reports it as skipped rather than scoring it.
|
|
160
|
+
*/
|
|
161
|
+
export declare const MEMORY_SCHEMA: {
|
|
162
|
+
$id: string;
|
|
163
|
+
type: string;
|
|
164
|
+
properties: {
|
|
165
|
+
id: {
|
|
166
|
+
type: string;
|
|
167
|
+
minLength: number;
|
|
168
|
+
};
|
|
169
|
+
text: {
|
|
170
|
+
type: string;
|
|
171
|
+
minLength: number;
|
|
172
|
+
};
|
|
173
|
+
evidence: {
|
|
174
|
+
anyOf: ({
|
|
145
175
|
type: "object";
|
|
146
176
|
properties: Record<string, object>;
|
|
147
177
|
required: string[];
|
|
@@ -150,199 +180,566 @@ export namespace MEMORY_SCHEMA {
|
|
|
150
180
|
type: string;
|
|
151
181
|
minLength: number;
|
|
152
182
|
})[];
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
export namespace environmentId {
|
|
198
|
-
let type_21: string;
|
|
199
|
-
export { type_21 as type };
|
|
200
|
-
let minLength_6: number;
|
|
201
|
-
export { minLength_6 as minLength };
|
|
202
|
-
}
|
|
203
|
-
export namespace schemaVersion {
|
|
204
|
-
let type_22: string;
|
|
205
|
-
export { type_22 as type };
|
|
206
|
-
let minLength_7: number;
|
|
207
|
-
export { minLength_7 as minLength };
|
|
208
|
-
}
|
|
209
|
-
export namespace document {
|
|
210
|
-
let type_23: string;
|
|
211
|
-
export { type_23 as type };
|
|
212
|
-
}
|
|
213
|
-
export namespace evidence_2 {
|
|
214
|
-
let type_24: string;
|
|
215
|
-
export { type_24 as type };
|
|
216
|
-
let minLength_8: number;
|
|
217
|
-
export { minLength_8 as minLength };
|
|
218
|
-
}
|
|
219
|
-
export { evidence_2 as evidence };
|
|
220
|
-
export namespace checked {
|
|
221
|
-
let _const_4: boolean;
|
|
222
|
-
export { _const_4 as const };
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
export { properties_7 as properties };
|
|
226
|
-
let required_7: string[];
|
|
227
|
-
export { required_7 as required };
|
|
228
|
-
let additionalProperties_7: boolean;
|
|
229
|
-
export { additionalProperties_7 as additionalProperties };
|
|
230
|
-
}
|
|
231
|
-
export namespace SKILL_SCHEMA {
|
|
232
|
-
let $id_2: string;
|
|
233
|
-
export { $id_2 as $id };
|
|
234
|
-
let type_25: string;
|
|
235
|
-
export { type_25 as type };
|
|
236
|
-
export namespace properties_8 {
|
|
237
|
-
export { ID as id };
|
|
238
|
-
export namespace name {
|
|
239
|
-
let type_26: string;
|
|
240
|
-
export { type_26 as type };
|
|
241
|
-
let minLength_9: number;
|
|
242
|
-
export { minLength_9 as minLength };
|
|
243
|
-
}
|
|
244
|
-
export namespace when {
|
|
245
|
-
let type_27: string;
|
|
246
|
-
export { type_27 as type };
|
|
247
|
-
let minLength_10: number;
|
|
248
|
-
export { minLength_10 as minLength };
|
|
249
|
-
}
|
|
250
|
-
export namespace instructions {
|
|
251
|
-
let type_28: string;
|
|
252
|
-
export { type_28 as type };
|
|
253
|
-
let minLength_11: number;
|
|
254
|
-
export { minLength_11 as minLength };
|
|
255
|
-
}
|
|
256
|
-
export { PROGRAM_SKILL_SCHEMA as program };
|
|
257
|
-
export namespace tools {
|
|
258
|
-
let type_29: string;
|
|
259
|
-
export { type_29 as type };
|
|
260
|
-
export namespace items_4 {
|
|
261
|
-
let type_30: string;
|
|
262
|
-
export { type_30 as type };
|
|
263
|
-
let minLength_12: number;
|
|
264
|
-
export { minLength_12 as minLength };
|
|
265
|
-
}
|
|
266
|
-
export { items_4 as items };
|
|
267
|
-
}
|
|
268
|
-
export { AT as at };
|
|
269
|
-
export { EMBEDDING as embedding };
|
|
270
|
-
export { EMBEDDED_BY as embeddedBy };
|
|
271
|
-
}
|
|
272
|
-
export { properties_8 as properties };
|
|
273
|
-
let required_8: string[];
|
|
274
|
-
export { required_8 as required };
|
|
275
|
-
export { EMBEDDING_PAIR as dependencies };
|
|
276
|
-
let additionalProperties_8: boolean;
|
|
277
|
-
export { additionalProperties_8 as additionalProperties };
|
|
278
|
-
}
|
|
279
|
-
export namespace SLOT_SCHEMA {
|
|
280
|
-
let $id_3: string;
|
|
281
|
-
export { $id_3 as $id };
|
|
282
|
-
let type_31: string;
|
|
283
|
-
export { type_31 as type };
|
|
284
|
-
export namespace properties_9 {
|
|
285
|
-
export { ID as name };
|
|
286
|
-
export namespace kind {
|
|
287
|
-
let type_32: string;
|
|
288
|
-
export { type_32 as type };
|
|
289
|
-
let minLength_13: number;
|
|
290
|
-
export { minLength_13 as minLength };
|
|
291
|
-
}
|
|
292
|
-
export namespace size {
|
|
293
|
-
let type_33: string;
|
|
294
|
-
export { type_33 as type };
|
|
295
|
-
let minimum_1: number;
|
|
296
|
-
export { minimum_1 as minimum };
|
|
297
|
-
}
|
|
298
|
-
export namespace excerpt {
|
|
299
|
-
let type_34: string;
|
|
300
|
-
export { type_34 as type };
|
|
301
|
-
}
|
|
302
|
-
export { AT as at };
|
|
303
|
-
export namespace count {
|
|
304
|
-
let type_35: string;
|
|
305
|
-
export { type_35 as type };
|
|
306
|
-
let minimum_2: number;
|
|
307
|
-
export { minimum_2 as minimum };
|
|
308
|
-
}
|
|
309
|
-
export namespace pinned {
|
|
310
|
-
let type_36: string;
|
|
311
|
-
export { type_36 as type };
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
export { properties_9 as properties };
|
|
315
|
-
let required_9: string[];
|
|
316
|
-
export { required_9 as required };
|
|
317
|
-
let additionalProperties_9: boolean;
|
|
318
|
-
export { additionalProperties_9 as additionalProperties };
|
|
319
|
-
}
|
|
320
|
-
export namespace LEDGER_SCHEMAS {
|
|
321
|
-
export { GOAL_SCHEMA as goal };
|
|
322
|
-
export { MEMORY_SCHEMA as memory };
|
|
323
|
-
export { SKILL_SCHEMA as skill };
|
|
324
|
-
export { SLOT_SCHEMA as slot };
|
|
325
|
-
}
|
|
183
|
+
};
|
|
184
|
+
tags: {
|
|
185
|
+
type: string;
|
|
186
|
+
items: {
|
|
187
|
+
type: string;
|
|
188
|
+
minLength: number;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
at: {
|
|
192
|
+
type: string;
|
|
193
|
+
format: string;
|
|
194
|
+
pattern: string;
|
|
195
|
+
};
|
|
196
|
+
embedding: {
|
|
197
|
+
type: string;
|
|
198
|
+
items: {
|
|
199
|
+
type: string;
|
|
200
|
+
};
|
|
201
|
+
minItems: number;
|
|
202
|
+
};
|
|
203
|
+
embeddedBy: {
|
|
204
|
+
type: string;
|
|
205
|
+
properties: {
|
|
206
|
+
model: {
|
|
207
|
+
type: string;
|
|
208
|
+
minLength: number;
|
|
209
|
+
};
|
|
210
|
+
dims: {
|
|
211
|
+
type: string;
|
|
212
|
+
minimum: number;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
required: string[];
|
|
216
|
+
additionalProperties: boolean;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
required: string[];
|
|
220
|
+
dependencies: {
|
|
221
|
+
embedding: string[];
|
|
222
|
+
embeddedBy: string[];
|
|
223
|
+
};
|
|
224
|
+
additionalProperties: boolean;
|
|
225
|
+
};
|
|
326
226
|
/**
|
|
327
|
-
*
|
|
227
|
+
* A reusable recipe: when it applies, what to do, and which tools it
|
|
228
|
+
* needs. Retrieved like a memory and composed into a system prompt by
|
|
229
|
+
* whatever drives the agent — the ledger stores it and nothing more.
|
|
328
230
|
*/
|
|
231
|
+
export declare const PROGRAM_SKILL_SCHEMA: {
|
|
232
|
+
type: string;
|
|
233
|
+
properties: {
|
|
234
|
+
version: {
|
|
235
|
+
const: number;
|
|
236
|
+
};
|
|
237
|
+
question: {
|
|
238
|
+
type: string;
|
|
239
|
+
minLength: number;
|
|
240
|
+
};
|
|
241
|
+
fingerprint: {
|
|
242
|
+
type: string;
|
|
243
|
+
pattern: string;
|
|
244
|
+
};
|
|
245
|
+
environmentId: {
|
|
246
|
+
type: string;
|
|
247
|
+
minLength: number;
|
|
248
|
+
};
|
|
249
|
+
schemaVersion: {
|
|
250
|
+
type: string;
|
|
251
|
+
minLength: number;
|
|
252
|
+
};
|
|
253
|
+
document: {
|
|
254
|
+
type: string;
|
|
255
|
+
};
|
|
256
|
+
evidence: {
|
|
257
|
+
type: string;
|
|
258
|
+
minLength: number;
|
|
259
|
+
};
|
|
260
|
+
checked: {
|
|
261
|
+
const: boolean;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
required: string[];
|
|
265
|
+
additionalProperties: boolean;
|
|
266
|
+
};
|
|
267
|
+
export declare const SKILL_SCHEMA: {
|
|
268
|
+
$id: string;
|
|
269
|
+
type: string;
|
|
270
|
+
properties: {
|
|
271
|
+
id: {
|
|
272
|
+
type: string;
|
|
273
|
+
minLength: number;
|
|
274
|
+
};
|
|
275
|
+
name: {
|
|
276
|
+
type: string;
|
|
277
|
+
minLength: number;
|
|
278
|
+
};
|
|
279
|
+
when: {
|
|
280
|
+
type: string;
|
|
281
|
+
minLength: number;
|
|
282
|
+
};
|
|
283
|
+
instructions: {
|
|
284
|
+
type: string;
|
|
285
|
+
minLength: number;
|
|
286
|
+
};
|
|
287
|
+
program: {
|
|
288
|
+
type: string;
|
|
289
|
+
properties: {
|
|
290
|
+
version: {
|
|
291
|
+
const: number;
|
|
292
|
+
};
|
|
293
|
+
question: {
|
|
294
|
+
type: string;
|
|
295
|
+
minLength: number;
|
|
296
|
+
};
|
|
297
|
+
fingerprint: {
|
|
298
|
+
type: string;
|
|
299
|
+
pattern: string;
|
|
300
|
+
};
|
|
301
|
+
environmentId: {
|
|
302
|
+
type: string;
|
|
303
|
+
minLength: number;
|
|
304
|
+
};
|
|
305
|
+
schemaVersion: {
|
|
306
|
+
type: string;
|
|
307
|
+
minLength: number;
|
|
308
|
+
};
|
|
309
|
+
document: {
|
|
310
|
+
type: string;
|
|
311
|
+
};
|
|
312
|
+
evidence: {
|
|
313
|
+
type: string;
|
|
314
|
+
minLength: number;
|
|
315
|
+
};
|
|
316
|
+
checked: {
|
|
317
|
+
const: boolean;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
required: string[];
|
|
321
|
+
additionalProperties: boolean;
|
|
322
|
+
};
|
|
323
|
+
tools: {
|
|
324
|
+
type: string;
|
|
325
|
+
items: {
|
|
326
|
+
type: string;
|
|
327
|
+
minLength: number;
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
at: {
|
|
331
|
+
type: string;
|
|
332
|
+
format: string;
|
|
333
|
+
pattern: string;
|
|
334
|
+
};
|
|
335
|
+
embedding: {
|
|
336
|
+
type: string;
|
|
337
|
+
items: {
|
|
338
|
+
type: string;
|
|
339
|
+
};
|
|
340
|
+
minItems: number;
|
|
341
|
+
};
|
|
342
|
+
embeddedBy: {
|
|
343
|
+
type: string;
|
|
344
|
+
properties: {
|
|
345
|
+
model: {
|
|
346
|
+
type: string;
|
|
347
|
+
minLength: number;
|
|
348
|
+
};
|
|
349
|
+
dims: {
|
|
350
|
+
type: string;
|
|
351
|
+
minimum: number;
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
required: string[];
|
|
355
|
+
additionalProperties: boolean;
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
required: string[];
|
|
359
|
+
dependencies: {
|
|
360
|
+
embedding: string[];
|
|
361
|
+
embeddedBy: string[];
|
|
362
|
+
};
|
|
363
|
+
additionalProperties: boolean;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* An addressable blob's METADATA. The content lives under a separate
|
|
367
|
+
* storage key and never travels with the metadata — that separation is
|
|
368
|
+
* the whole point: a root request may carry `{ name, kind, size, excerpt }`
|
|
369
|
+
* for a hundred slots without carrying one slot's content.
|
|
370
|
+
*/
|
|
371
|
+
export declare const SLOT_SCHEMA: {
|
|
372
|
+
$id: string;
|
|
373
|
+
type: string;
|
|
374
|
+
properties: {
|
|
375
|
+
name: {
|
|
376
|
+
type: string;
|
|
377
|
+
minLength: number;
|
|
378
|
+
};
|
|
379
|
+
kind: {
|
|
380
|
+
type: string;
|
|
381
|
+
minLength: number;
|
|
382
|
+
};
|
|
383
|
+
size: {
|
|
384
|
+
type: string;
|
|
385
|
+
minimum: number;
|
|
386
|
+
};
|
|
387
|
+
excerpt: {
|
|
388
|
+
type: string;
|
|
389
|
+
};
|
|
390
|
+
at: {
|
|
391
|
+
type: string;
|
|
392
|
+
format: string;
|
|
393
|
+
pattern: string;
|
|
394
|
+
};
|
|
395
|
+
count: {
|
|
396
|
+
type: string;
|
|
397
|
+
minimum: number;
|
|
398
|
+
};
|
|
399
|
+
pinned: {
|
|
400
|
+
type: string;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
required: string[];
|
|
404
|
+
additionalProperties: boolean;
|
|
405
|
+
};
|
|
406
|
+
/** Every ledger schema by kind — what `createLedger` compiles at construction. */
|
|
407
|
+
export declare const LEDGER_SCHEMAS: {
|
|
408
|
+
goal: {
|
|
409
|
+
$id: string;
|
|
410
|
+
type: string;
|
|
411
|
+
properties: {
|
|
412
|
+
objective: {
|
|
413
|
+
type: string;
|
|
414
|
+
minLength: number;
|
|
415
|
+
};
|
|
416
|
+
createdAt: {
|
|
417
|
+
type: string;
|
|
418
|
+
format: string;
|
|
419
|
+
pattern: string;
|
|
420
|
+
};
|
|
421
|
+
status: {
|
|
422
|
+
enum: string[];
|
|
423
|
+
};
|
|
424
|
+
progress: {
|
|
425
|
+
type: string;
|
|
426
|
+
items: {
|
|
427
|
+
type: string;
|
|
428
|
+
properties: {
|
|
429
|
+
at: {
|
|
430
|
+
type: string;
|
|
431
|
+
format: string;
|
|
432
|
+
pattern: string;
|
|
433
|
+
};
|
|
434
|
+
id: {
|
|
435
|
+
type: string;
|
|
436
|
+
minLength: number;
|
|
437
|
+
};
|
|
438
|
+
note: {
|
|
439
|
+
type: string;
|
|
440
|
+
minLength: number;
|
|
441
|
+
};
|
|
442
|
+
evidence: {
|
|
443
|
+
type: string;
|
|
444
|
+
minLength: number;
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
required: string[];
|
|
448
|
+
additionalProperties: boolean;
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
checkpoint: {
|
|
452
|
+
type: string;
|
|
453
|
+
properties: {
|
|
454
|
+
version: {
|
|
455
|
+
const: number;
|
|
456
|
+
};
|
|
457
|
+
records: {
|
|
458
|
+
type: string;
|
|
459
|
+
items: {
|
|
460
|
+
type: string;
|
|
461
|
+
properties: {
|
|
462
|
+
note: {
|
|
463
|
+
type: string;
|
|
464
|
+
minLength: number;
|
|
465
|
+
};
|
|
466
|
+
evidence: {
|
|
467
|
+
type: string;
|
|
468
|
+
minLength: number;
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
required: string[];
|
|
472
|
+
additionalProperties: boolean;
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
sources: {
|
|
476
|
+
type: string;
|
|
477
|
+
items: {
|
|
478
|
+
type: string;
|
|
479
|
+
properties: {
|
|
480
|
+
id: {
|
|
481
|
+
type: string;
|
|
482
|
+
minLength: number;
|
|
483
|
+
};
|
|
484
|
+
at: {
|
|
485
|
+
type: string;
|
|
486
|
+
format: string;
|
|
487
|
+
pattern: string;
|
|
488
|
+
};
|
|
489
|
+
record: {
|
|
490
|
+
type: string;
|
|
491
|
+
minimum: number;
|
|
492
|
+
};
|
|
493
|
+
};
|
|
494
|
+
required: string[];
|
|
495
|
+
additionalProperties: boolean;
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
required: string[];
|
|
500
|
+
additionalProperties: boolean;
|
|
501
|
+
};
|
|
502
|
+
retention: {
|
|
503
|
+
type: string;
|
|
504
|
+
properties: {
|
|
505
|
+
version: {
|
|
506
|
+
const: number;
|
|
507
|
+
};
|
|
508
|
+
reason: {
|
|
509
|
+
const: string;
|
|
510
|
+
};
|
|
511
|
+
retired: {
|
|
512
|
+
type: string;
|
|
513
|
+
items: {
|
|
514
|
+
type: string;
|
|
515
|
+
minLength: number;
|
|
516
|
+
};
|
|
517
|
+
uniqueItems: boolean;
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
required: string[];
|
|
521
|
+
additionalProperties: boolean;
|
|
522
|
+
};
|
|
523
|
+
};
|
|
524
|
+
required: string[];
|
|
525
|
+
additionalProperties: boolean;
|
|
526
|
+
};
|
|
527
|
+
memory: {
|
|
528
|
+
$id: string;
|
|
529
|
+
type: string;
|
|
530
|
+
properties: {
|
|
531
|
+
id: {
|
|
532
|
+
type: string;
|
|
533
|
+
minLength: number;
|
|
534
|
+
};
|
|
535
|
+
text: {
|
|
536
|
+
type: string;
|
|
537
|
+
minLength: number;
|
|
538
|
+
};
|
|
539
|
+
evidence: {
|
|
540
|
+
anyOf: ({
|
|
541
|
+
type: "object";
|
|
542
|
+
properties: Record<string, object>;
|
|
543
|
+
required: string[];
|
|
544
|
+
additionalProperties: false;
|
|
545
|
+
} | {
|
|
546
|
+
type: string;
|
|
547
|
+
minLength: number;
|
|
548
|
+
})[];
|
|
549
|
+
};
|
|
550
|
+
tags: {
|
|
551
|
+
type: string;
|
|
552
|
+
items: {
|
|
553
|
+
type: string;
|
|
554
|
+
minLength: number;
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
at: {
|
|
558
|
+
type: string;
|
|
559
|
+
format: string;
|
|
560
|
+
pattern: string;
|
|
561
|
+
};
|
|
562
|
+
embedding: {
|
|
563
|
+
type: string;
|
|
564
|
+
items: {
|
|
565
|
+
type: string;
|
|
566
|
+
};
|
|
567
|
+
minItems: number;
|
|
568
|
+
};
|
|
569
|
+
embeddedBy: {
|
|
570
|
+
type: string;
|
|
571
|
+
properties: {
|
|
572
|
+
model: {
|
|
573
|
+
type: string;
|
|
574
|
+
minLength: number;
|
|
575
|
+
};
|
|
576
|
+
dims: {
|
|
577
|
+
type: string;
|
|
578
|
+
minimum: number;
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
required: string[];
|
|
582
|
+
additionalProperties: boolean;
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
required: string[];
|
|
586
|
+
dependencies: {
|
|
587
|
+
embedding: string[];
|
|
588
|
+
embeddedBy: string[];
|
|
589
|
+
};
|
|
590
|
+
additionalProperties: boolean;
|
|
591
|
+
};
|
|
592
|
+
skill: {
|
|
593
|
+
$id: string;
|
|
594
|
+
type: string;
|
|
595
|
+
properties: {
|
|
596
|
+
id: {
|
|
597
|
+
type: string;
|
|
598
|
+
minLength: number;
|
|
599
|
+
};
|
|
600
|
+
name: {
|
|
601
|
+
type: string;
|
|
602
|
+
minLength: number;
|
|
603
|
+
};
|
|
604
|
+
when: {
|
|
605
|
+
type: string;
|
|
606
|
+
minLength: number;
|
|
607
|
+
};
|
|
608
|
+
instructions: {
|
|
609
|
+
type: string;
|
|
610
|
+
minLength: number;
|
|
611
|
+
};
|
|
612
|
+
program: {
|
|
613
|
+
type: string;
|
|
614
|
+
properties: {
|
|
615
|
+
version: {
|
|
616
|
+
const: number;
|
|
617
|
+
};
|
|
618
|
+
question: {
|
|
619
|
+
type: string;
|
|
620
|
+
minLength: number;
|
|
621
|
+
};
|
|
622
|
+
fingerprint: {
|
|
623
|
+
type: string;
|
|
624
|
+
pattern: string;
|
|
625
|
+
};
|
|
626
|
+
environmentId: {
|
|
627
|
+
type: string;
|
|
628
|
+
minLength: number;
|
|
629
|
+
};
|
|
630
|
+
schemaVersion: {
|
|
631
|
+
type: string;
|
|
632
|
+
minLength: number;
|
|
633
|
+
};
|
|
634
|
+
document: {
|
|
635
|
+
type: string;
|
|
636
|
+
};
|
|
637
|
+
evidence: {
|
|
638
|
+
type: string;
|
|
639
|
+
minLength: number;
|
|
640
|
+
};
|
|
641
|
+
checked: {
|
|
642
|
+
const: boolean;
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
required: string[];
|
|
646
|
+
additionalProperties: boolean;
|
|
647
|
+
};
|
|
648
|
+
tools: {
|
|
649
|
+
type: string;
|
|
650
|
+
items: {
|
|
651
|
+
type: string;
|
|
652
|
+
minLength: number;
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
at: {
|
|
656
|
+
type: string;
|
|
657
|
+
format: string;
|
|
658
|
+
pattern: string;
|
|
659
|
+
};
|
|
660
|
+
embedding: {
|
|
661
|
+
type: string;
|
|
662
|
+
items: {
|
|
663
|
+
type: string;
|
|
664
|
+
};
|
|
665
|
+
minItems: number;
|
|
666
|
+
};
|
|
667
|
+
embeddedBy: {
|
|
668
|
+
type: string;
|
|
669
|
+
properties: {
|
|
670
|
+
model: {
|
|
671
|
+
type: string;
|
|
672
|
+
minLength: number;
|
|
673
|
+
};
|
|
674
|
+
dims: {
|
|
675
|
+
type: string;
|
|
676
|
+
minimum: number;
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
required: string[];
|
|
680
|
+
additionalProperties: boolean;
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
required: string[];
|
|
684
|
+
dependencies: {
|
|
685
|
+
embedding: string[];
|
|
686
|
+
embeddedBy: string[];
|
|
687
|
+
};
|
|
688
|
+
additionalProperties: boolean;
|
|
689
|
+
};
|
|
690
|
+
slot: {
|
|
691
|
+
$id: string;
|
|
692
|
+
type: string;
|
|
693
|
+
properties: {
|
|
694
|
+
name: {
|
|
695
|
+
type: string;
|
|
696
|
+
minLength: number;
|
|
697
|
+
};
|
|
698
|
+
kind: {
|
|
699
|
+
type: string;
|
|
700
|
+
minLength: number;
|
|
701
|
+
};
|
|
702
|
+
size: {
|
|
703
|
+
type: string;
|
|
704
|
+
minimum: number;
|
|
705
|
+
};
|
|
706
|
+
excerpt: {
|
|
707
|
+
type: string;
|
|
708
|
+
};
|
|
709
|
+
at: {
|
|
710
|
+
type: string;
|
|
711
|
+
format: string;
|
|
712
|
+
pattern: string;
|
|
713
|
+
};
|
|
714
|
+
count: {
|
|
715
|
+
type: string;
|
|
716
|
+
minimum: number;
|
|
717
|
+
};
|
|
718
|
+
pinned: {
|
|
719
|
+
type: string;
|
|
720
|
+
};
|
|
721
|
+
};
|
|
722
|
+
required: string[];
|
|
723
|
+
additionalProperties: boolean;
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
/** One evidenced progress entry on the active goal. */
|
|
727
|
+
/** The one rejection shape every schema-guarded write answers with —
|
|
728
|
+
* produced by `invalidInput` in `check.ts`, named here because this is
|
|
729
|
+
* where a consumer of the ledger's API goes looking for "what comes
|
|
730
|
+
* back when a write is refused". */
|
|
329
731
|
export type LedgerProgressEntry = {
|
|
330
|
-
id?: string;
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
*/
|
|
732
|
+
id?: string; /**
|
|
733
|
+
* RFC 3339
|
|
734
|
+
*/
|
|
334
735
|
at: string;
|
|
335
736
|
note: string;
|
|
336
737
|
evidence: string;
|
|
337
738
|
};
|
|
338
|
-
/**
|
|
339
|
-
* The active (or archived) objective — see {@link GOAL_SCHEMA}.
|
|
340
|
-
*/
|
|
341
739
|
export type LedgerGoal = {
|
|
342
|
-
objective: string;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
*/
|
|
740
|
+
objective: string; /**
|
|
741
|
+
* RFC 3339
|
|
742
|
+
*/
|
|
346
743
|
createdAt: string;
|
|
347
744
|
status: "active" | "done" | "abandoned" | "superseded";
|
|
348
745
|
progress: LedgerProgressEntry[];
|
|
@@ -364,24 +761,10 @@ export type LedgerGoal = {
|
|
|
364
761
|
retired: string[];
|
|
365
762
|
};
|
|
366
763
|
};
|
|
367
|
-
/**
|
|
368
|
-
* A vector's identity — see {@link EMBEDDED_BY}. What `recall({ near })`
|
|
369
|
-
* compares against the query embedder's `{ model, dims }` before any
|
|
370
|
-
* arithmetic happens.
|
|
371
|
-
*/
|
|
372
764
|
export type LedgerEmbeddedBy = {
|
|
373
765
|
model: string;
|
|
374
766
|
dims: number;
|
|
375
767
|
};
|
|
376
|
-
/**
|
|
377
|
-
* The vector pair, both-or-neither — the schemas' `dependencies` rule
|
|
378
|
-
* (see {@link EMBEDDING_PAIR}) stated in the type: a record either
|
|
379
|
-
* carries `embedding` AND `embeddedBy`, or neither. `embedding` is the
|
|
380
|
-
* vector `recall({ near })` ranks by — plain numbers, never a typed
|
|
381
|
-
* array — and `embeddedBy` its identity. Narrow on either member and
|
|
382
|
-
* the other follows: `if (record.embedding) record.embeddedBy.dims`.
|
|
383
|
-
* An orphan vector does not type, just as the ledger refuses it.
|
|
384
|
-
*/
|
|
385
768
|
export type LedgerEmbeddingPair = {
|
|
386
769
|
embedding?: undefined;
|
|
387
770
|
embeddedBy?: undefined;
|
|
@@ -389,37 +772,24 @@ export type LedgerEmbeddingPair = {
|
|
|
389
772
|
embedding: number[];
|
|
390
773
|
embeddedBy: LedgerEmbeddedBy;
|
|
391
774
|
};
|
|
392
|
-
/**
|
|
393
|
-
* A stored memory's own members — see {@link MEMORY_SCHEMA}; the
|
|
394
|
-
* record is these plus {@link LedgerEmbeddingPair}.
|
|
395
|
-
*/
|
|
396
775
|
export type LedgerMemoryFields = {
|
|
397
776
|
id: string;
|
|
398
777
|
text: string;
|
|
399
|
-
evidence: string | import(
|
|
400
|
-
tags: string[];
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
*/
|
|
778
|
+
evidence: string | import('./evidence.ts').ClaimEvidenceEnvelope;
|
|
779
|
+
tags: string[]; /**
|
|
780
|
+
* RFC 3339
|
|
781
|
+
*/
|
|
404
782
|
at: string;
|
|
405
783
|
};
|
|
406
|
-
/**
|
|
407
|
-
* A stored memory — see {@link MEMORY_SCHEMA}.
|
|
408
|
-
*/
|
|
409
784
|
export type LedgerMemory = LedgerMemoryFields & LedgerEmbeddingPair;
|
|
410
|
-
/**
|
|
411
|
-
* A stored skill's own members — see {@link SKILL_SCHEMA}; the record
|
|
412
|
-
* is these plus {@link LedgerEmbeddingPair}.
|
|
413
|
-
*/
|
|
414
785
|
export type LedgerSkillFields = {
|
|
415
786
|
id: string;
|
|
416
787
|
name: string;
|
|
417
788
|
when: string;
|
|
418
789
|
instructions: string;
|
|
419
|
-
tools: string[];
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
*/
|
|
790
|
+
tools: string[]; /**
|
|
791
|
+
* RFC 3339
|
|
792
|
+
*/
|
|
423
793
|
at: string;
|
|
424
794
|
program?: {
|
|
425
795
|
version: 1;
|
|
@@ -432,84 +802,21 @@ export type LedgerSkillFields = {
|
|
|
432
802
|
checked: true;
|
|
433
803
|
};
|
|
434
804
|
};
|
|
435
|
-
/**
|
|
436
|
-
* A stored skill — see {@link SKILL_SCHEMA}.
|
|
437
|
-
*/
|
|
438
805
|
export type LedgerSkill = LedgerSkillFields & LedgerEmbeddingPair;
|
|
439
|
-
/**
|
|
440
|
-
* A slot's metadata — see {@link SLOT_SCHEMA}. Never the content.
|
|
441
|
-
*/
|
|
442
806
|
export type LedgerSlot = {
|
|
443
807
|
name: string;
|
|
444
808
|
kind: string;
|
|
445
809
|
size: number;
|
|
446
|
-
excerpt: string;
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
*/
|
|
810
|
+
excerpt: string; /**
|
|
811
|
+
* RFC 3339
|
|
812
|
+
*/
|
|
450
813
|
at: string;
|
|
451
814
|
count?: number;
|
|
452
815
|
pinned?: boolean;
|
|
453
816
|
};
|
|
454
|
-
/**
|
|
455
|
-
* The one rejection shape every schema-guarded write answers with —
|
|
456
|
-
* produced by `invalidInput` in `check.js`, named here because this is
|
|
457
|
-
* where a consumer of the ledger's API goes looking for "what comes
|
|
458
|
-
* back when a write is refused".
|
|
459
|
-
*/
|
|
460
817
|
export type LedgerRejection = {
|
|
461
818
|
error: string;
|
|
819
|
+
code?: string;
|
|
462
820
|
errors: any[];
|
|
463
821
|
inputSchema: any;
|
|
464
822
|
};
|
|
465
|
-
declare namespace AT {
|
|
466
|
-
let type_37: string;
|
|
467
|
-
export { type_37 as type };
|
|
468
|
-
export let format: string;
|
|
469
|
-
let pattern_1: string;
|
|
470
|
-
export { pattern_1 as pattern };
|
|
471
|
-
}
|
|
472
|
-
declare namespace ID {
|
|
473
|
-
let type_38: string;
|
|
474
|
-
export { type_38 as type };
|
|
475
|
-
let minLength_14: number;
|
|
476
|
-
export { minLength_14 as minLength };
|
|
477
|
-
}
|
|
478
|
-
declare namespace EMBEDDING {
|
|
479
|
-
let type_39: string;
|
|
480
|
-
export { type_39 as type };
|
|
481
|
-
export namespace items_5 {
|
|
482
|
-
let type_40: string;
|
|
483
|
-
export { type_40 as type };
|
|
484
|
-
}
|
|
485
|
-
export { items_5 as items };
|
|
486
|
-
export let minItems: number;
|
|
487
|
-
}
|
|
488
|
-
declare namespace EMBEDDED_BY {
|
|
489
|
-
let type_41: string;
|
|
490
|
-
export { type_41 as type };
|
|
491
|
-
export namespace properties_10 {
|
|
492
|
-
namespace model {
|
|
493
|
-
let type_42: string;
|
|
494
|
-
export { type_42 as type };
|
|
495
|
-
let minLength_15: number;
|
|
496
|
-
export { minLength_15 as minLength };
|
|
497
|
-
}
|
|
498
|
-
namespace dims {
|
|
499
|
-
let type_43: string;
|
|
500
|
-
export { type_43 as type };
|
|
501
|
-
let minimum_3: number;
|
|
502
|
-
export { minimum_3 as minimum };
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
export { properties_10 as properties };
|
|
506
|
-
let required_10: string[];
|
|
507
|
-
export { required_10 as required };
|
|
508
|
-
let additionalProperties_10: boolean;
|
|
509
|
-
export { additionalProperties_10 as additionalProperties };
|
|
510
|
-
}
|
|
511
|
-
declare namespace EMBEDDING_PAIR {
|
|
512
|
-
let embedding: string[];
|
|
513
|
-
let embeddedBy: string[];
|
|
514
|
-
}
|
|
515
|
-
export {};
|