@lydia-agent/core 0.1.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/dist/index.cjs +8089 -0
- package/dist/index.d.cts +3434 -0
- package/dist/index.d.ts +3434 -0
- package/dist/index.js +7965 -0
- package/package.json +40 -0
- package/skills/README.md +17 -0
- package/skills/browser/automation.md +33 -0
- package/skills/docker/management.md +36 -0
- package/skills/git/advanced.md +43 -0
- package/skills/hello-world.md +15 -0
- package/skills/node/management.md +37 -0
- package/skills/system-health.md +15 -0
- package/skills/webapp-testing/LICENSE.txt +202 -0
- package/skills/webapp-testing/SKILL.md +96 -0
- package/skills/webapp-testing/examples/console_logging.py +35 -0
- package/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/skills/webapp-testing/scripts/with_server.py +106 -0
- package/strategies/base-v1.yml +62 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3434 @@
|
|
|
1
|
+
import * as zod from 'zod';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { EventEmitter } from 'node:events';
|
|
4
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
5
|
+
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
|
|
6
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
8
|
+
|
|
9
|
+
declare const RoleSchema: z.ZodEnum<["system", "user", "assistant", "tool"]>;
|
|
10
|
+
type Role = z.infer<typeof RoleSchema>;
|
|
11
|
+
declare const TextContentSchema: z.ZodObject<{
|
|
12
|
+
type: z.ZodLiteral<"text">;
|
|
13
|
+
text: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
type: "text";
|
|
16
|
+
text: string;
|
|
17
|
+
}, {
|
|
18
|
+
type: "text";
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
type TextContent = z.infer<typeof TextContentSchema>;
|
|
22
|
+
declare const ImageContentSchema: z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"image">;
|
|
24
|
+
source: z.ZodObject<{
|
|
25
|
+
type: z.ZodLiteral<"base64">;
|
|
26
|
+
media_type: z.ZodString;
|
|
27
|
+
data: z.ZodString;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
type: "base64";
|
|
30
|
+
media_type: string;
|
|
31
|
+
data: string;
|
|
32
|
+
}, {
|
|
33
|
+
type: "base64";
|
|
34
|
+
media_type: string;
|
|
35
|
+
data: string;
|
|
36
|
+
}>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
type: "image";
|
|
39
|
+
source: {
|
|
40
|
+
type: "base64";
|
|
41
|
+
media_type: string;
|
|
42
|
+
data: string;
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
type: "image";
|
|
46
|
+
source: {
|
|
47
|
+
type: "base64";
|
|
48
|
+
media_type: string;
|
|
49
|
+
data: string;
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
type ImageContent = z.infer<typeof ImageContentSchema>;
|
|
53
|
+
declare const ToolUseContentSchema: z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<"tool_use">;
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
type: "tool_use";
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
input: Record<string, unknown>;
|
|
63
|
+
}, {
|
|
64
|
+
type: "tool_use";
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
input: Record<string, unknown>;
|
|
68
|
+
}>;
|
|
69
|
+
type ToolUseContent = z.infer<typeof ToolUseContentSchema>;
|
|
70
|
+
declare const ToolResultContentSchema: z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"tool_result">;
|
|
72
|
+
tool_use_id: z.ZodString;
|
|
73
|
+
content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
74
|
+
type: z.ZodLiteral<"text">;
|
|
75
|
+
text: z.ZodString;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
type: "text";
|
|
78
|
+
text: string;
|
|
79
|
+
}, {
|
|
80
|
+
type: "text";
|
|
81
|
+
text: string;
|
|
82
|
+
}>, z.ZodObject<{
|
|
83
|
+
type: z.ZodLiteral<"image">;
|
|
84
|
+
source: z.ZodObject<{
|
|
85
|
+
type: z.ZodLiteral<"base64">;
|
|
86
|
+
media_type: z.ZodString;
|
|
87
|
+
data: z.ZodString;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
type: "base64";
|
|
90
|
+
media_type: string;
|
|
91
|
+
data: string;
|
|
92
|
+
}, {
|
|
93
|
+
type: "base64";
|
|
94
|
+
media_type: string;
|
|
95
|
+
data: string;
|
|
96
|
+
}>;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
type: "image";
|
|
99
|
+
source: {
|
|
100
|
+
type: "base64";
|
|
101
|
+
media_type: string;
|
|
102
|
+
data: string;
|
|
103
|
+
};
|
|
104
|
+
}, {
|
|
105
|
+
type: "image";
|
|
106
|
+
source: {
|
|
107
|
+
type: "base64";
|
|
108
|
+
media_type: string;
|
|
109
|
+
data: string;
|
|
110
|
+
};
|
|
111
|
+
}>]>, "many">]>;
|
|
112
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
+
}, "strip", z.ZodTypeAny, {
|
|
114
|
+
type: "tool_result";
|
|
115
|
+
tool_use_id: string;
|
|
116
|
+
content: string | ({
|
|
117
|
+
type: "text";
|
|
118
|
+
text: string;
|
|
119
|
+
} | {
|
|
120
|
+
type: "image";
|
|
121
|
+
source: {
|
|
122
|
+
type: "base64";
|
|
123
|
+
media_type: string;
|
|
124
|
+
data: string;
|
|
125
|
+
};
|
|
126
|
+
})[];
|
|
127
|
+
is_error?: boolean | undefined;
|
|
128
|
+
}, {
|
|
129
|
+
type: "tool_result";
|
|
130
|
+
tool_use_id: string;
|
|
131
|
+
content: string | ({
|
|
132
|
+
type: "text";
|
|
133
|
+
text: string;
|
|
134
|
+
} | {
|
|
135
|
+
type: "image";
|
|
136
|
+
source: {
|
|
137
|
+
type: "base64";
|
|
138
|
+
media_type: string;
|
|
139
|
+
data: string;
|
|
140
|
+
};
|
|
141
|
+
})[];
|
|
142
|
+
is_error?: boolean | undefined;
|
|
143
|
+
}>;
|
|
144
|
+
type ToolResultContent = z.infer<typeof ToolResultContentSchema>;
|
|
145
|
+
declare const ThinkingContentSchema: z.ZodObject<{
|
|
146
|
+
type: z.ZodLiteral<"thinking">;
|
|
147
|
+
thinking: z.ZodString;
|
|
148
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
type: "thinking";
|
|
151
|
+
thinking: string;
|
|
152
|
+
signature?: string | undefined;
|
|
153
|
+
}, {
|
|
154
|
+
type: "thinking";
|
|
155
|
+
thinking: string;
|
|
156
|
+
signature?: string | undefined;
|
|
157
|
+
}>;
|
|
158
|
+
type ThinkingContent = z.infer<typeof ThinkingContentSchema>;
|
|
159
|
+
declare const ContentBlockSchema: z.ZodUnion<[z.ZodObject<{
|
|
160
|
+
type: z.ZodLiteral<"text">;
|
|
161
|
+
text: z.ZodString;
|
|
162
|
+
}, "strip", z.ZodTypeAny, {
|
|
163
|
+
type: "text";
|
|
164
|
+
text: string;
|
|
165
|
+
}, {
|
|
166
|
+
type: "text";
|
|
167
|
+
text: string;
|
|
168
|
+
}>, z.ZodObject<{
|
|
169
|
+
type: z.ZodLiteral<"image">;
|
|
170
|
+
source: z.ZodObject<{
|
|
171
|
+
type: z.ZodLiteral<"base64">;
|
|
172
|
+
media_type: z.ZodString;
|
|
173
|
+
data: z.ZodString;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
type: "base64";
|
|
176
|
+
media_type: string;
|
|
177
|
+
data: string;
|
|
178
|
+
}, {
|
|
179
|
+
type: "base64";
|
|
180
|
+
media_type: string;
|
|
181
|
+
data: string;
|
|
182
|
+
}>;
|
|
183
|
+
}, "strip", z.ZodTypeAny, {
|
|
184
|
+
type: "image";
|
|
185
|
+
source: {
|
|
186
|
+
type: "base64";
|
|
187
|
+
media_type: string;
|
|
188
|
+
data: string;
|
|
189
|
+
};
|
|
190
|
+
}, {
|
|
191
|
+
type: "image";
|
|
192
|
+
source: {
|
|
193
|
+
type: "base64";
|
|
194
|
+
media_type: string;
|
|
195
|
+
data: string;
|
|
196
|
+
};
|
|
197
|
+
}>, z.ZodObject<{
|
|
198
|
+
type: z.ZodLiteral<"tool_use">;
|
|
199
|
+
id: z.ZodString;
|
|
200
|
+
name: z.ZodString;
|
|
201
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
type: "tool_use";
|
|
204
|
+
id: string;
|
|
205
|
+
name: string;
|
|
206
|
+
input: Record<string, unknown>;
|
|
207
|
+
}, {
|
|
208
|
+
type: "tool_use";
|
|
209
|
+
id: string;
|
|
210
|
+
name: string;
|
|
211
|
+
input: Record<string, unknown>;
|
|
212
|
+
}>, z.ZodObject<{
|
|
213
|
+
type: z.ZodLiteral<"tool_result">;
|
|
214
|
+
tool_use_id: z.ZodString;
|
|
215
|
+
content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
216
|
+
type: z.ZodLiteral<"text">;
|
|
217
|
+
text: z.ZodString;
|
|
218
|
+
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
type: "text";
|
|
220
|
+
text: string;
|
|
221
|
+
}, {
|
|
222
|
+
type: "text";
|
|
223
|
+
text: string;
|
|
224
|
+
}>, z.ZodObject<{
|
|
225
|
+
type: z.ZodLiteral<"image">;
|
|
226
|
+
source: z.ZodObject<{
|
|
227
|
+
type: z.ZodLiteral<"base64">;
|
|
228
|
+
media_type: z.ZodString;
|
|
229
|
+
data: z.ZodString;
|
|
230
|
+
}, "strip", z.ZodTypeAny, {
|
|
231
|
+
type: "base64";
|
|
232
|
+
media_type: string;
|
|
233
|
+
data: string;
|
|
234
|
+
}, {
|
|
235
|
+
type: "base64";
|
|
236
|
+
media_type: string;
|
|
237
|
+
data: string;
|
|
238
|
+
}>;
|
|
239
|
+
}, "strip", z.ZodTypeAny, {
|
|
240
|
+
type: "image";
|
|
241
|
+
source: {
|
|
242
|
+
type: "base64";
|
|
243
|
+
media_type: string;
|
|
244
|
+
data: string;
|
|
245
|
+
};
|
|
246
|
+
}, {
|
|
247
|
+
type: "image";
|
|
248
|
+
source: {
|
|
249
|
+
type: "base64";
|
|
250
|
+
media_type: string;
|
|
251
|
+
data: string;
|
|
252
|
+
};
|
|
253
|
+
}>]>, "many">]>;
|
|
254
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
255
|
+
}, "strip", z.ZodTypeAny, {
|
|
256
|
+
type: "tool_result";
|
|
257
|
+
tool_use_id: string;
|
|
258
|
+
content: string | ({
|
|
259
|
+
type: "text";
|
|
260
|
+
text: string;
|
|
261
|
+
} | {
|
|
262
|
+
type: "image";
|
|
263
|
+
source: {
|
|
264
|
+
type: "base64";
|
|
265
|
+
media_type: string;
|
|
266
|
+
data: string;
|
|
267
|
+
};
|
|
268
|
+
})[];
|
|
269
|
+
is_error?: boolean | undefined;
|
|
270
|
+
}, {
|
|
271
|
+
type: "tool_result";
|
|
272
|
+
tool_use_id: string;
|
|
273
|
+
content: string | ({
|
|
274
|
+
type: "text";
|
|
275
|
+
text: string;
|
|
276
|
+
} | {
|
|
277
|
+
type: "image";
|
|
278
|
+
source: {
|
|
279
|
+
type: "base64";
|
|
280
|
+
media_type: string;
|
|
281
|
+
data: string;
|
|
282
|
+
};
|
|
283
|
+
})[];
|
|
284
|
+
is_error?: boolean | undefined;
|
|
285
|
+
}>, z.ZodObject<{
|
|
286
|
+
type: z.ZodLiteral<"thinking">;
|
|
287
|
+
thinking: z.ZodString;
|
|
288
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
289
|
+
}, "strip", z.ZodTypeAny, {
|
|
290
|
+
type: "thinking";
|
|
291
|
+
thinking: string;
|
|
292
|
+
signature?: string | undefined;
|
|
293
|
+
}, {
|
|
294
|
+
type: "thinking";
|
|
295
|
+
thinking: string;
|
|
296
|
+
signature?: string | undefined;
|
|
297
|
+
}>]>;
|
|
298
|
+
type ContentBlock = z.infer<typeof ContentBlockSchema>;
|
|
299
|
+
declare const MessageSchema: z.ZodObject<{
|
|
300
|
+
role: z.ZodEnum<["system", "user", "assistant", "tool"]>;
|
|
301
|
+
content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
302
|
+
type: z.ZodLiteral<"text">;
|
|
303
|
+
text: z.ZodString;
|
|
304
|
+
}, "strip", z.ZodTypeAny, {
|
|
305
|
+
type: "text";
|
|
306
|
+
text: string;
|
|
307
|
+
}, {
|
|
308
|
+
type: "text";
|
|
309
|
+
text: string;
|
|
310
|
+
}>, z.ZodObject<{
|
|
311
|
+
type: z.ZodLiteral<"image">;
|
|
312
|
+
source: z.ZodObject<{
|
|
313
|
+
type: z.ZodLiteral<"base64">;
|
|
314
|
+
media_type: z.ZodString;
|
|
315
|
+
data: z.ZodString;
|
|
316
|
+
}, "strip", z.ZodTypeAny, {
|
|
317
|
+
type: "base64";
|
|
318
|
+
media_type: string;
|
|
319
|
+
data: string;
|
|
320
|
+
}, {
|
|
321
|
+
type: "base64";
|
|
322
|
+
media_type: string;
|
|
323
|
+
data: string;
|
|
324
|
+
}>;
|
|
325
|
+
}, "strip", z.ZodTypeAny, {
|
|
326
|
+
type: "image";
|
|
327
|
+
source: {
|
|
328
|
+
type: "base64";
|
|
329
|
+
media_type: string;
|
|
330
|
+
data: string;
|
|
331
|
+
};
|
|
332
|
+
}, {
|
|
333
|
+
type: "image";
|
|
334
|
+
source: {
|
|
335
|
+
type: "base64";
|
|
336
|
+
media_type: string;
|
|
337
|
+
data: string;
|
|
338
|
+
};
|
|
339
|
+
}>, z.ZodObject<{
|
|
340
|
+
type: z.ZodLiteral<"tool_use">;
|
|
341
|
+
id: z.ZodString;
|
|
342
|
+
name: z.ZodString;
|
|
343
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
344
|
+
}, "strip", z.ZodTypeAny, {
|
|
345
|
+
type: "tool_use";
|
|
346
|
+
id: string;
|
|
347
|
+
name: string;
|
|
348
|
+
input: Record<string, unknown>;
|
|
349
|
+
}, {
|
|
350
|
+
type: "tool_use";
|
|
351
|
+
id: string;
|
|
352
|
+
name: string;
|
|
353
|
+
input: Record<string, unknown>;
|
|
354
|
+
}>, z.ZodObject<{
|
|
355
|
+
type: z.ZodLiteral<"tool_result">;
|
|
356
|
+
tool_use_id: z.ZodString;
|
|
357
|
+
content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
358
|
+
type: z.ZodLiteral<"text">;
|
|
359
|
+
text: z.ZodString;
|
|
360
|
+
}, "strip", z.ZodTypeAny, {
|
|
361
|
+
type: "text";
|
|
362
|
+
text: string;
|
|
363
|
+
}, {
|
|
364
|
+
type: "text";
|
|
365
|
+
text: string;
|
|
366
|
+
}>, z.ZodObject<{
|
|
367
|
+
type: z.ZodLiteral<"image">;
|
|
368
|
+
source: z.ZodObject<{
|
|
369
|
+
type: z.ZodLiteral<"base64">;
|
|
370
|
+
media_type: z.ZodString;
|
|
371
|
+
data: z.ZodString;
|
|
372
|
+
}, "strip", z.ZodTypeAny, {
|
|
373
|
+
type: "base64";
|
|
374
|
+
media_type: string;
|
|
375
|
+
data: string;
|
|
376
|
+
}, {
|
|
377
|
+
type: "base64";
|
|
378
|
+
media_type: string;
|
|
379
|
+
data: string;
|
|
380
|
+
}>;
|
|
381
|
+
}, "strip", z.ZodTypeAny, {
|
|
382
|
+
type: "image";
|
|
383
|
+
source: {
|
|
384
|
+
type: "base64";
|
|
385
|
+
media_type: string;
|
|
386
|
+
data: string;
|
|
387
|
+
};
|
|
388
|
+
}, {
|
|
389
|
+
type: "image";
|
|
390
|
+
source: {
|
|
391
|
+
type: "base64";
|
|
392
|
+
media_type: string;
|
|
393
|
+
data: string;
|
|
394
|
+
};
|
|
395
|
+
}>]>, "many">]>;
|
|
396
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
397
|
+
}, "strip", z.ZodTypeAny, {
|
|
398
|
+
type: "tool_result";
|
|
399
|
+
tool_use_id: string;
|
|
400
|
+
content: string | ({
|
|
401
|
+
type: "text";
|
|
402
|
+
text: string;
|
|
403
|
+
} | {
|
|
404
|
+
type: "image";
|
|
405
|
+
source: {
|
|
406
|
+
type: "base64";
|
|
407
|
+
media_type: string;
|
|
408
|
+
data: string;
|
|
409
|
+
};
|
|
410
|
+
})[];
|
|
411
|
+
is_error?: boolean | undefined;
|
|
412
|
+
}, {
|
|
413
|
+
type: "tool_result";
|
|
414
|
+
tool_use_id: string;
|
|
415
|
+
content: string | ({
|
|
416
|
+
type: "text";
|
|
417
|
+
text: string;
|
|
418
|
+
} | {
|
|
419
|
+
type: "image";
|
|
420
|
+
source: {
|
|
421
|
+
type: "base64";
|
|
422
|
+
media_type: string;
|
|
423
|
+
data: string;
|
|
424
|
+
};
|
|
425
|
+
})[];
|
|
426
|
+
is_error?: boolean | undefined;
|
|
427
|
+
}>, z.ZodObject<{
|
|
428
|
+
type: z.ZodLiteral<"thinking">;
|
|
429
|
+
thinking: z.ZodString;
|
|
430
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
431
|
+
}, "strip", z.ZodTypeAny, {
|
|
432
|
+
type: "thinking";
|
|
433
|
+
thinking: string;
|
|
434
|
+
signature?: string | undefined;
|
|
435
|
+
}, {
|
|
436
|
+
type: "thinking";
|
|
437
|
+
thinking: string;
|
|
438
|
+
signature?: string | undefined;
|
|
439
|
+
}>]>, "many">]>;
|
|
440
|
+
name: z.ZodOptional<z.ZodString>;
|
|
441
|
+
}, "strip", z.ZodTypeAny, {
|
|
442
|
+
content: string | ({
|
|
443
|
+
type: "text";
|
|
444
|
+
text: string;
|
|
445
|
+
} | {
|
|
446
|
+
type: "image";
|
|
447
|
+
source: {
|
|
448
|
+
type: "base64";
|
|
449
|
+
media_type: string;
|
|
450
|
+
data: string;
|
|
451
|
+
};
|
|
452
|
+
} | {
|
|
453
|
+
type: "tool_use";
|
|
454
|
+
id: string;
|
|
455
|
+
name: string;
|
|
456
|
+
input: Record<string, unknown>;
|
|
457
|
+
} | {
|
|
458
|
+
type: "tool_result";
|
|
459
|
+
tool_use_id: string;
|
|
460
|
+
content: string | ({
|
|
461
|
+
type: "text";
|
|
462
|
+
text: string;
|
|
463
|
+
} | {
|
|
464
|
+
type: "image";
|
|
465
|
+
source: {
|
|
466
|
+
type: "base64";
|
|
467
|
+
media_type: string;
|
|
468
|
+
data: string;
|
|
469
|
+
};
|
|
470
|
+
})[];
|
|
471
|
+
is_error?: boolean | undefined;
|
|
472
|
+
} | {
|
|
473
|
+
type: "thinking";
|
|
474
|
+
thinking: string;
|
|
475
|
+
signature?: string | undefined;
|
|
476
|
+
})[];
|
|
477
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
478
|
+
name?: string | undefined;
|
|
479
|
+
}, {
|
|
480
|
+
content: string | ({
|
|
481
|
+
type: "text";
|
|
482
|
+
text: string;
|
|
483
|
+
} | {
|
|
484
|
+
type: "image";
|
|
485
|
+
source: {
|
|
486
|
+
type: "base64";
|
|
487
|
+
media_type: string;
|
|
488
|
+
data: string;
|
|
489
|
+
};
|
|
490
|
+
} | {
|
|
491
|
+
type: "tool_use";
|
|
492
|
+
id: string;
|
|
493
|
+
name: string;
|
|
494
|
+
input: Record<string, unknown>;
|
|
495
|
+
} | {
|
|
496
|
+
type: "tool_result";
|
|
497
|
+
tool_use_id: string;
|
|
498
|
+
content: string | ({
|
|
499
|
+
type: "text";
|
|
500
|
+
text: string;
|
|
501
|
+
} | {
|
|
502
|
+
type: "image";
|
|
503
|
+
source: {
|
|
504
|
+
type: "base64";
|
|
505
|
+
media_type: string;
|
|
506
|
+
data: string;
|
|
507
|
+
};
|
|
508
|
+
})[];
|
|
509
|
+
is_error?: boolean | undefined;
|
|
510
|
+
} | {
|
|
511
|
+
type: "thinking";
|
|
512
|
+
thinking: string;
|
|
513
|
+
signature?: string | undefined;
|
|
514
|
+
})[];
|
|
515
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
516
|
+
name?: string | undefined;
|
|
517
|
+
}>;
|
|
518
|
+
type Message = z.infer<typeof MessageSchema>;
|
|
519
|
+
declare const TokenUsageSchema: z.ZodObject<{
|
|
520
|
+
input_tokens: z.ZodNumber;
|
|
521
|
+
output_tokens: z.ZodNumber;
|
|
522
|
+
total_tokens: z.ZodNumber;
|
|
523
|
+
}, "strip", z.ZodTypeAny, {
|
|
524
|
+
input_tokens: number;
|
|
525
|
+
output_tokens: number;
|
|
526
|
+
total_tokens: number;
|
|
527
|
+
}, {
|
|
528
|
+
input_tokens: number;
|
|
529
|
+
output_tokens: number;
|
|
530
|
+
total_tokens: number;
|
|
531
|
+
}>;
|
|
532
|
+
type TokenUsage = z.infer<typeof TokenUsageSchema>;
|
|
533
|
+
declare const LLMResponseSchema: z.ZodObject<{
|
|
534
|
+
id: z.ZodString;
|
|
535
|
+
content: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
536
|
+
type: z.ZodLiteral<"text">;
|
|
537
|
+
text: z.ZodString;
|
|
538
|
+
}, "strip", z.ZodTypeAny, {
|
|
539
|
+
type: "text";
|
|
540
|
+
text: string;
|
|
541
|
+
}, {
|
|
542
|
+
type: "text";
|
|
543
|
+
text: string;
|
|
544
|
+
}>, z.ZodObject<{
|
|
545
|
+
type: z.ZodLiteral<"image">;
|
|
546
|
+
source: z.ZodObject<{
|
|
547
|
+
type: z.ZodLiteral<"base64">;
|
|
548
|
+
media_type: z.ZodString;
|
|
549
|
+
data: z.ZodString;
|
|
550
|
+
}, "strip", z.ZodTypeAny, {
|
|
551
|
+
type: "base64";
|
|
552
|
+
media_type: string;
|
|
553
|
+
data: string;
|
|
554
|
+
}, {
|
|
555
|
+
type: "base64";
|
|
556
|
+
media_type: string;
|
|
557
|
+
data: string;
|
|
558
|
+
}>;
|
|
559
|
+
}, "strip", z.ZodTypeAny, {
|
|
560
|
+
type: "image";
|
|
561
|
+
source: {
|
|
562
|
+
type: "base64";
|
|
563
|
+
media_type: string;
|
|
564
|
+
data: string;
|
|
565
|
+
};
|
|
566
|
+
}, {
|
|
567
|
+
type: "image";
|
|
568
|
+
source: {
|
|
569
|
+
type: "base64";
|
|
570
|
+
media_type: string;
|
|
571
|
+
data: string;
|
|
572
|
+
};
|
|
573
|
+
}>, z.ZodObject<{
|
|
574
|
+
type: z.ZodLiteral<"tool_use">;
|
|
575
|
+
id: z.ZodString;
|
|
576
|
+
name: z.ZodString;
|
|
577
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
578
|
+
}, "strip", z.ZodTypeAny, {
|
|
579
|
+
type: "tool_use";
|
|
580
|
+
id: string;
|
|
581
|
+
name: string;
|
|
582
|
+
input: Record<string, unknown>;
|
|
583
|
+
}, {
|
|
584
|
+
type: "tool_use";
|
|
585
|
+
id: string;
|
|
586
|
+
name: string;
|
|
587
|
+
input: Record<string, unknown>;
|
|
588
|
+
}>, z.ZodObject<{
|
|
589
|
+
type: z.ZodLiteral<"tool_result">;
|
|
590
|
+
tool_use_id: z.ZodString;
|
|
591
|
+
content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
592
|
+
type: z.ZodLiteral<"text">;
|
|
593
|
+
text: z.ZodString;
|
|
594
|
+
}, "strip", z.ZodTypeAny, {
|
|
595
|
+
type: "text";
|
|
596
|
+
text: string;
|
|
597
|
+
}, {
|
|
598
|
+
type: "text";
|
|
599
|
+
text: string;
|
|
600
|
+
}>, z.ZodObject<{
|
|
601
|
+
type: z.ZodLiteral<"image">;
|
|
602
|
+
source: z.ZodObject<{
|
|
603
|
+
type: z.ZodLiteral<"base64">;
|
|
604
|
+
media_type: z.ZodString;
|
|
605
|
+
data: z.ZodString;
|
|
606
|
+
}, "strip", z.ZodTypeAny, {
|
|
607
|
+
type: "base64";
|
|
608
|
+
media_type: string;
|
|
609
|
+
data: string;
|
|
610
|
+
}, {
|
|
611
|
+
type: "base64";
|
|
612
|
+
media_type: string;
|
|
613
|
+
data: string;
|
|
614
|
+
}>;
|
|
615
|
+
}, "strip", z.ZodTypeAny, {
|
|
616
|
+
type: "image";
|
|
617
|
+
source: {
|
|
618
|
+
type: "base64";
|
|
619
|
+
media_type: string;
|
|
620
|
+
data: string;
|
|
621
|
+
};
|
|
622
|
+
}, {
|
|
623
|
+
type: "image";
|
|
624
|
+
source: {
|
|
625
|
+
type: "base64";
|
|
626
|
+
media_type: string;
|
|
627
|
+
data: string;
|
|
628
|
+
};
|
|
629
|
+
}>]>, "many">]>;
|
|
630
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
631
|
+
}, "strip", z.ZodTypeAny, {
|
|
632
|
+
type: "tool_result";
|
|
633
|
+
tool_use_id: string;
|
|
634
|
+
content: string | ({
|
|
635
|
+
type: "text";
|
|
636
|
+
text: string;
|
|
637
|
+
} | {
|
|
638
|
+
type: "image";
|
|
639
|
+
source: {
|
|
640
|
+
type: "base64";
|
|
641
|
+
media_type: string;
|
|
642
|
+
data: string;
|
|
643
|
+
};
|
|
644
|
+
})[];
|
|
645
|
+
is_error?: boolean | undefined;
|
|
646
|
+
}, {
|
|
647
|
+
type: "tool_result";
|
|
648
|
+
tool_use_id: string;
|
|
649
|
+
content: string | ({
|
|
650
|
+
type: "text";
|
|
651
|
+
text: string;
|
|
652
|
+
} | {
|
|
653
|
+
type: "image";
|
|
654
|
+
source: {
|
|
655
|
+
type: "base64";
|
|
656
|
+
media_type: string;
|
|
657
|
+
data: string;
|
|
658
|
+
};
|
|
659
|
+
})[];
|
|
660
|
+
is_error?: boolean | undefined;
|
|
661
|
+
}>, z.ZodObject<{
|
|
662
|
+
type: z.ZodLiteral<"thinking">;
|
|
663
|
+
thinking: z.ZodString;
|
|
664
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
665
|
+
}, "strip", z.ZodTypeAny, {
|
|
666
|
+
type: "thinking";
|
|
667
|
+
thinking: string;
|
|
668
|
+
signature?: string | undefined;
|
|
669
|
+
}, {
|
|
670
|
+
type: "thinking";
|
|
671
|
+
thinking: string;
|
|
672
|
+
signature?: string | undefined;
|
|
673
|
+
}>]>, "many">;
|
|
674
|
+
role: z.ZodEnum<["system", "user", "assistant", "tool"]>;
|
|
675
|
+
model: z.ZodString;
|
|
676
|
+
stop_reason: z.ZodNullable<z.ZodEnum<["end_turn", "max_tokens", "stop_sequence", "tool_use", "error", "pause_turn"]>>;
|
|
677
|
+
usage: z.ZodObject<{
|
|
678
|
+
input_tokens: z.ZodNumber;
|
|
679
|
+
output_tokens: z.ZodNumber;
|
|
680
|
+
total_tokens: z.ZodNumber;
|
|
681
|
+
}, "strip", z.ZodTypeAny, {
|
|
682
|
+
input_tokens: number;
|
|
683
|
+
output_tokens: number;
|
|
684
|
+
total_tokens: number;
|
|
685
|
+
}, {
|
|
686
|
+
input_tokens: number;
|
|
687
|
+
output_tokens: number;
|
|
688
|
+
total_tokens: number;
|
|
689
|
+
}>;
|
|
690
|
+
}, "strip", z.ZodTypeAny, {
|
|
691
|
+
id: string;
|
|
692
|
+
content: ({
|
|
693
|
+
type: "text";
|
|
694
|
+
text: string;
|
|
695
|
+
} | {
|
|
696
|
+
type: "image";
|
|
697
|
+
source: {
|
|
698
|
+
type: "base64";
|
|
699
|
+
media_type: string;
|
|
700
|
+
data: string;
|
|
701
|
+
};
|
|
702
|
+
} | {
|
|
703
|
+
type: "tool_use";
|
|
704
|
+
id: string;
|
|
705
|
+
name: string;
|
|
706
|
+
input: Record<string, unknown>;
|
|
707
|
+
} | {
|
|
708
|
+
type: "tool_result";
|
|
709
|
+
tool_use_id: string;
|
|
710
|
+
content: string | ({
|
|
711
|
+
type: "text";
|
|
712
|
+
text: string;
|
|
713
|
+
} | {
|
|
714
|
+
type: "image";
|
|
715
|
+
source: {
|
|
716
|
+
type: "base64";
|
|
717
|
+
media_type: string;
|
|
718
|
+
data: string;
|
|
719
|
+
};
|
|
720
|
+
})[];
|
|
721
|
+
is_error?: boolean | undefined;
|
|
722
|
+
} | {
|
|
723
|
+
type: "thinking";
|
|
724
|
+
thinking: string;
|
|
725
|
+
signature?: string | undefined;
|
|
726
|
+
})[];
|
|
727
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
728
|
+
model: string;
|
|
729
|
+
stop_reason: "tool_use" | "end_turn" | "max_tokens" | "stop_sequence" | "error" | "pause_turn" | null;
|
|
730
|
+
usage: {
|
|
731
|
+
input_tokens: number;
|
|
732
|
+
output_tokens: number;
|
|
733
|
+
total_tokens: number;
|
|
734
|
+
};
|
|
735
|
+
}, {
|
|
736
|
+
id: string;
|
|
737
|
+
content: ({
|
|
738
|
+
type: "text";
|
|
739
|
+
text: string;
|
|
740
|
+
} | {
|
|
741
|
+
type: "image";
|
|
742
|
+
source: {
|
|
743
|
+
type: "base64";
|
|
744
|
+
media_type: string;
|
|
745
|
+
data: string;
|
|
746
|
+
};
|
|
747
|
+
} | {
|
|
748
|
+
type: "tool_use";
|
|
749
|
+
id: string;
|
|
750
|
+
name: string;
|
|
751
|
+
input: Record<string, unknown>;
|
|
752
|
+
} | {
|
|
753
|
+
type: "tool_result";
|
|
754
|
+
tool_use_id: string;
|
|
755
|
+
content: string | ({
|
|
756
|
+
type: "text";
|
|
757
|
+
text: string;
|
|
758
|
+
} | {
|
|
759
|
+
type: "image";
|
|
760
|
+
source: {
|
|
761
|
+
type: "base64";
|
|
762
|
+
media_type: string;
|
|
763
|
+
data: string;
|
|
764
|
+
};
|
|
765
|
+
})[];
|
|
766
|
+
is_error?: boolean | undefined;
|
|
767
|
+
} | {
|
|
768
|
+
type: "thinking";
|
|
769
|
+
thinking: string;
|
|
770
|
+
signature?: string | undefined;
|
|
771
|
+
})[];
|
|
772
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
773
|
+
model: string;
|
|
774
|
+
stop_reason: "tool_use" | "end_turn" | "max_tokens" | "stop_sequence" | "error" | "pause_turn" | null;
|
|
775
|
+
usage: {
|
|
776
|
+
input_tokens: number;
|
|
777
|
+
output_tokens: number;
|
|
778
|
+
total_tokens: number;
|
|
779
|
+
};
|
|
780
|
+
}>;
|
|
781
|
+
type LLMResponse = z.infer<typeof LLMResponseSchema>;
|
|
782
|
+
declare const ToolDefinitionSchema: z.ZodObject<{
|
|
783
|
+
name: z.ZodString;
|
|
784
|
+
description: z.ZodDefault<z.ZodString>;
|
|
785
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
786
|
+
}, "strip", z.ZodTypeAny, {
|
|
787
|
+
name: string;
|
|
788
|
+
description: string;
|
|
789
|
+
inputSchema: Record<string, unknown>;
|
|
790
|
+
}, {
|
|
791
|
+
name: string;
|
|
792
|
+
inputSchema: Record<string, unknown>;
|
|
793
|
+
description?: string | undefined;
|
|
794
|
+
}>;
|
|
795
|
+
type ToolDefinition = z.infer<typeof ToolDefinitionSchema>;
|
|
796
|
+
type StreamChunk = {
|
|
797
|
+
type: 'text_delta';
|
|
798
|
+
text: string;
|
|
799
|
+
} | {
|
|
800
|
+
type: 'thinking_delta';
|
|
801
|
+
thinking: string;
|
|
802
|
+
} | {
|
|
803
|
+
type: 'tool_use_start';
|
|
804
|
+
id: string;
|
|
805
|
+
name: string;
|
|
806
|
+
} | {
|
|
807
|
+
type: 'tool_use_delta';
|
|
808
|
+
id: string;
|
|
809
|
+
input_json: string;
|
|
810
|
+
} | {
|
|
811
|
+
type: 'tool_use_end';
|
|
812
|
+
id: string;
|
|
813
|
+
} | {
|
|
814
|
+
type: 'message_stop';
|
|
815
|
+
response: LLMResponse;
|
|
816
|
+
} | {
|
|
817
|
+
type: 'error';
|
|
818
|
+
error: string;
|
|
819
|
+
};
|
|
820
|
+
declare const LLMRequestSchema: z.ZodObject<{
|
|
821
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
822
|
+
role: z.ZodEnum<["system", "user", "assistant", "tool"]>;
|
|
823
|
+
content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
824
|
+
type: z.ZodLiteral<"text">;
|
|
825
|
+
text: z.ZodString;
|
|
826
|
+
}, "strip", z.ZodTypeAny, {
|
|
827
|
+
type: "text";
|
|
828
|
+
text: string;
|
|
829
|
+
}, {
|
|
830
|
+
type: "text";
|
|
831
|
+
text: string;
|
|
832
|
+
}>, z.ZodObject<{
|
|
833
|
+
type: z.ZodLiteral<"image">;
|
|
834
|
+
source: z.ZodObject<{
|
|
835
|
+
type: z.ZodLiteral<"base64">;
|
|
836
|
+
media_type: z.ZodString;
|
|
837
|
+
data: z.ZodString;
|
|
838
|
+
}, "strip", z.ZodTypeAny, {
|
|
839
|
+
type: "base64";
|
|
840
|
+
media_type: string;
|
|
841
|
+
data: string;
|
|
842
|
+
}, {
|
|
843
|
+
type: "base64";
|
|
844
|
+
media_type: string;
|
|
845
|
+
data: string;
|
|
846
|
+
}>;
|
|
847
|
+
}, "strip", z.ZodTypeAny, {
|
|
848
|
+
type: "image";
|
|
849
|
+
source: {
|
|
850
|
+
type: "base64";
|
|
851
|
+
media_type: string;
|
|
852
|
+
data: string;
|
|
853
|
+
};
|
|
854
|
+
}, {
|
|
855
|
+
type: "image";
|
|
856
|
+
source: {
|
|
857
|
+
type: "base64";
|
|
858
|
+
media_type: string;
|
|
859
|
+
data: string;
|
|
860
|
+
};
|
|
861
|
+
}>, z.ZodObject<{
|
|
862
|
+
type: z.ZodLiteral<"tool_use">;
|
|
863
|
+
id: z.ZodString;
|
|
864
|
+
name: z.ZodString;
|
|
865
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
866
|
+
}, "strip", z.ZodTypeAny, {
|
|
867
|
+
type: "tool_use";
|
|
868
|
+
id: string;
|
|
869
|
+
name: string;
|
|
870
|
+
input: Record<string, unknown>;
|
|
871
|
+
}, {
|
|
872
|
+
type: "tool_use";
|
|
873
|
+
id: string;
|
|
874
|
+
name: string;
|
|
875
|
+
input: Record<string, unknown>;
|
|
876
|
+
}>, z.ZodObject<{
|
|
877
|
+
type: z.ZodLiteral<"tool_result">;
|
|
878
|
+
tool_use_id: z.ZodString;
|
|
879
|
+
content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
880
|
+
type: z.ZodLiteral<"text">;
|
|
881
|
+
text: z.ZodString;
|
|
882
|
+
}, "strip", z.ZodTypeAny, {
|
|
883
|
+
type: "text";
|
|
884
|
+
text: string;
|
|
885
|
+
}, {
|
|
886
|
+
type: "text";
|
|
887
|
+
text: string;
|
|
888
|
+
}>, z.ZodObject<{
|
|
889
|
+
type: z.ZodLiteral<"image">;
|
|
890
|
+
source: z.ZodObject<{
|
|
891
|
+
type: z.ZodLiteral<"base64">;
|
|
892
|
+
media_type: z.ZodString;
|
|
893
|
+
data: z.ZodString;
|
|
894
|
+
}, "strip", z.ZodTypeAny, {
|
|
895
|
+
type: "base64";
|
|
896
|
+
media_type: string;
|
|
897
|
+
data: string;
|
|
898
|
+
}, {
|
|
899
|
+
type: "base64";
|
|
900
|
+
media_type: string;
|
|
901
|
+
data: string;
|
|
902
|
+
}>;
|
|
903
|
+
}, "strip", z.ZodTypeAny, {
|
|
904
|
+
type: "image";
|
|
905
|
+
source: {
|
|
906
|
+
type: "base64";
|
|
907
|
+
media_type: string;
|
|
908
|
+
data: string;
|
|
909
|
+
};
|
|
910
|
+
}, {
|
|
911
|
+
type: "image";
|
|
912
|
+
source: {
|
|
913
|
+
type: "base64";
|
|
914
|
+
media_type: string;
|
|
915
|
+
data: string;
|
|
916
|
+
};
|
|
917
|
+
}>]>, "many">]>;
|
|
918
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
919
|
+
}, "strip", z.ZodTypeAny, {
|
|
920
|
+
type: "tool_result";
|
|
921
|
+
tool_use_id: string;
|
|
922
|
+
content: string | ({
|
|
923
|
+
type: "text";
|
|
924
|
+
text: string;
|
|
925
|
+
} | {
|
|
926
|
+
type: "image";
|
|
927
|
+
source: {
|
|
928
|
+
type: "base64";
|
|
929
|
+
media_type: string;
|
|
930
|
+
data: string;
|
|
931
|
+
};
|
|
932
|
+
})[];
|
|
933
|
+
is_error?: boolean | undefined;
|
|
934
|
+
}, {
|
|
935
|
+
type: "tool_result";
|
|
936
|
+
tool_use_id: string;
|
|
937
|
+
content: string | ({
|
|
938
|
+
type: "text";
|
|
939
|
+
text: string;
|
|
940
|
+
} | {
|
|
941
|
+
type: "image";
|
|
942
|
+
source: {
|
|
943
|
+
type: "base64";
|
|
944
|
+
media_type: string;
|
|
945
|
+
data: string;
|
|
946
|
+
};
|
|
947
|
+
})[];
|
|
948
|
+
is_error?: boolean | undefined;
|
|
949
|
+
}>, z.ZodObject<{
|
|
950
|
+
type: z.ZodLiteral<"thinking">;
|
|
951
|
+
thinking: z.ZodString;
|
|
952
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
953
|
+
}, "strip", z.ZodTypeAny, {
|
|
954
|
+
type: "thinking";
|
|
955
|
+
thinking: string;
|
|
956
|
+
signature?: string | undefined;
|
|
957
|
+
}, {
|
|
958
|
+
type: "thinking";
|
|
959
|
+
thinking: string;
|
|
960
|
+
signature?: string | undefined;
|
|
961
|
+
}>]>, "many">]>;
|
|
962
|
+
name: z.ZodOptional<z.ZodString>;
|
|
963
|
+
}, "strip", z.ZodTypeAny, {
|
|
964
|
+
content: string | ({
|
|
965
|
+
type: "text";
|
|
966
|
+
text: string;
|
|
967
|
+
} | {
|
|
968
|
+
type: "image";
|
|
969
|
+
source: {
|
|
970
|
+
type: "base64";
|
|
971
|
+
media_type: string;
|
|
972
|
+
data: string;
|
|
973
|
+
};
|
|
974
|
+
} | {
|
|
975
|
+
type: "tool_use";
|
|
976
|
+
id: string;
|
|
977
|
+
name: string;
|
|
978
|
+
input: Record<string, unknown>;
|
|
979
|
+
} | {
|
|
980
|
+
type: "tool_result";
|
|
981
|
+
tool_use_id: string;
|
|
982
|
+
content: string | ({
|
|
983
|
+
type: "text";
|
|
984
|
+
text: string;
|
|
985
|
+
} | {
|
|
986
|
+
type: "image";
|
|
987
|
+
source: {
|
|
988
|
+
type: "base64";
|
|
989
|
+
media_type: string;
|
|
990
|
+
data: string;
|
|
991
|
+
};
|
|
992
|
+
})[];
|
|
993
|
+
is_error?: boolean | undefined;
|
|
994
|
+
} | {
|
|
995
|
+
type: "thinking";
|
|
996
|
+
thinking: string;
|
|
997
|
+
signature?: string | undefined;
|
|
998
|
+
})[];
|
|
999
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
1000
|
+
name?: string | undefined;
|
|
1001
|
+
}, {
|
|
1002
|
+
content: string | ({
|
|
1003
|
+
type: "text";
|
|
1004
|
+
text: string;
|
|
1005
|
+
} | {
|
|
1006
|
+
type: "image";
|
|
1007
|
+
source: {
|
|
1008
|
+
type: "base64";
|
|
1009
|
+
media_type: string;
|
|
1010
|
+
data: string;
|
|
1011
|
+
};
|
|
1012
|
+
} | {
|
|
1013
|
+
type: "tool_use";
|
|
1014
|
+
id: string;
|
|
1015
|
+
name: string;
|
|
1016
|
+
input: Record<string, unknown>;
|
|
1017
|
+
} | {
|
|
1018
|
+
type: "tool_result";
|
|
1019
|
+
tool_use_id: string;
|
|
1020
|
+
content: string | ({
|
|
1021
|
+
type: "text";
|
|
1022
|
+
text: string;
|
|
1023
|
+
} | {
|
|
1024
|
+
type: "image";
|
|
1025
|
+
source: {
|
|
1026
|
+
type: "base64";
|
|
1027
|
+
media_type: string;
|
|
1028
|
+
data: string;
|
|
1029
|
+
};
|
|
1030
|
+
})[];
|
|
1031
|
+
is_error?: boolean | undefined;
|
|
1032
|
+
} | {
|
|
1033
|
+
type: "thinking";
|
|
1034
|
+
thinking: string;
|
|
1035
|
+
signature?: string | undefined;
|
|
1036
|
+
})[];
|
|
1037
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
1038
|
+
name?: string | undefined;
|
|
1039
|
+
}>, "many">;
|
|
1040
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1041
|
+
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
1042
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
1043
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1044
|
+
name: z.ZodString;
|
|
1045
|
+
description: z.ZodDefault<z.ZodString>;
|
|
1046
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1047
|
+
}, "strip", z.ZodTypeAny, {
|
|
1048
|
+
name: string;
|
|
1049
|
+
description: string;
|
|
1050
|
+
inputSchema: Record<string, unknown>;
|
|
1051
|
+
}, {
|
|
1052
|
+
name: string;
|
|
1053
|
+
inputSchema: Record<string, unknown>;
|
|
1054
|
+
description?: string | undefined;
|
|
1055
|
+
}>, "many">>;
|
|
1056
|
+
system: z.ZodOptional<z.ZodString>;
|
|
1057
|
+
stop: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1058
|
+
}, "strip", z.ZodTypeAny, {
|
|
1059
|
+
messages: {
|
|
1060
|
+
content: string | ({
|
|
1061
|
+
type: "text";
|
|
1062
|
+
text: string;
|
|
1063
|
+
} | {
|
|
1064
|
+
type: "image";
|
|
1065
|
+
source: {
|
|
1066
|
+
type: "base64";
|
|
1067
|
+
media_type: string;
|
|
1068
|
+
data: string;
|
|
1069
|
+
};
|
|
1070
|
+
} | {
|
|
1071
|
+
type: "tool_use";
|
|
1072
|
+
id: string;
|
|
1073
|
+
name: string;
|
|
1074
|
+
input: Record<string, unknown>;
|
|
1075
|
+
} | {
|
|
1076
|
+
type: "tool_result";
|
|
1077
|
+
tool_use_id: string;
|
|
1078
|
+
content: string | ({
|
|
1079
|
+
type: "text";
|
|
1080
|
+
text: string;
|
|
1081
|
+
} | {
|
|
1082
|
+
type: "image";
|
|
1083
|
+
source: {
|
|
1084
|
+
type: "base64";
|
|
1085
|
+
media_type: string;
|
|
1086
|
+
data: string;
|
|
1087
|
+
};
|
|
1088
|
+
})[];
|
|
1089
|
+
is_error?: boolean | undefined;
|
|
1090
|
+
} | {
|
|
1091
|
+
type: "thinking";
|
|
1092
|
+
thinking: string;
|
|
1093
|
+
signature?: string | undefined;
|
|
1094
|
+
})[];
|
|
1095
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
1096
|
+
name?: string | undefined;
|
|
1097
|
+
}[];
|
|
1098
|
+
system?: string | undefined;
|
|
1099
|
+
model?: string | undefined;
|
|
1100
|
+
max_tokens?: number | undefined;
|
|
1101
|
+
temperature?: number | undefined;
|
|
1102
|
+
tools?: {
|
|
1103
|
+
name: string;
|
|
1104
|
+
description: string;
|
|
1105
|
+
inputSchema: Record<string, unknown>;
|
|
1106
|
+
}[] | undefined;
|
|
1107
|
+
stop?: string[] | undefined;
|
|
1108
|
+
}, {
|
|
1109
|
+
messages: {
|
|
1110
|
+
content: string | ({
|
|
1111
|
+
type: "text";
|
|
1112
|
+
text: string;
|
|
1113
|
+
} | {
|
|
1114
|
+
type: "image";
|
|
1115
|
+
source: {
|
|
1116
|
+
type: "base64";
|
|
1117
|
+
media_type: string;
|
|
1118
|
+
data: string;
|
|
1119
|
+
};
|
|
1120
|
+
} | {
|
|
1121
|
+
type: "tool_use";
|
|
1122
|
+
id: string;
|
|
1123
|
+
name: string;
|
|
1124
|
+
input: Record<string, unknown>;
|
|
1125
|
+
} | {
|
|
1126
|
+
type: "tool_result";
|
|
1127
|
+
tool_use_id: string;
|
|
1128
|
+
content: string | ({
|
|
1129
|
+
type: "text";
|
|
1130
|
+
text: string;
|
|
1131
|
+
} | {
|
|
1132
|
+
type: "image";
|
|
1133
|
+
source: {
|
|
1134
|
+
type: "base64";
|
|
1135
|
+
media_type: string;
|
|
1136
|
+
data: string;
|
|
1137
|
+
};
|
|
1138
|
+
})[];
|
|
1139
|
+
is_error?: boolean | undefined;
|
|
1140
|
+
} | {
|
|
1141
|
+
type: "thinking";
|
|
1142
|
+
thinking: string;
|
|
1143
|
+
signature?: string | undefined;
|
|
1144
|
+
})[];
|
|
1145
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
1146
|
+
name?: string | undefined;
|
|
1147
|
+
}[];
|
|
1148
|
+
system?: string | undefined;
|
|
1149
|
+
model?: string | undefined;
|
|
1150
|
+
max_tokens?: number | undefined;
|
|
1151
|
+
temperature?: number | undefined;
|
|
1152
|
+
tools?: {
|
|
1153
|
+
name: string;
|
|
1154
|
+
inputSchema: Record<string, unknown>;
|
|
1155
|
+
description?: string | undefined;
|
|
1156
|
+
}[] | undefined;
|
|
1157
|
+
stop?: string[] | undefined;
|
|
1158
|
+
}>;
|
|
1159
|
+
type LLMRequest = z.infer<typeof LLMRequestSchema>;
|
|
1160
|
+
|
|
1161
|
+
type ComputerUseDomain = 'browser' | 'desktop';
|
|
1162
|
+
interface CanonicalComputerUseAction {
|
|
1163
|
+
domain: ComputerUseDomain;
|
|
1164
|
+
toolName: string;
|
|
1165
|
+
requiredArgs: string[];
|
|
1166
|
+
description: string;
|
|
1167
|
+
aliases: string[];
|
|
1168
|
+
}
|
|
1169
|
+
declare function listCanonicalComputerUseActions(): CanonicalComputerUseAction[];
|
|
1170
|
+
declare function resolveCanonicalComputerUseToolName(toolName: string): string | undefined;
|
|
1171
|
+
declare function isCanonicalComputerUseTool(toolName: string): boolean;
|
|
1172
|
+
|
|
1173
|
+
declare const COMPUTER_USE_ERROR_CODES: readonly ["ARG_INVALID", "CAPABILITY_UNAVAILABLE", "POLICY_DENIED", "EXECUTION_FAILED", "OBSERVATION_MISSING"];
|
|
1174
|
+
type ComputerUseErrorCode = (typeof COMPUTER_USE_ERROR_CODES)[number];
|
|
1175
|
+
type ComputerUseRiskLevel = 'low' | 'medium' | 'high';
|
|
1176
|
+
type ObservationArtifactKind = 'download' | 'upload' | 'log';
|
|
1177
|
+
interface ComputerUseActionEnvelope {
|
|
1178
|
+
sessionId: string;
|
|
1179
|
+
actionId: string;
|
|
1180
|
+
domain: ComputerUseDomain;
|
|
1181
|
+
canonicalAction: string;
|
|
1182
|
+
args: Record<string, unknown>;
|
|
1183
|
+
riskLevel: ComputerUseRiskLevel;
|
|
1184
|
+
requestedAt: number;
|
|
1185
|
+
}
|
|
1186
|
+
type ObservationBlock = {
|
|
1187
|
+
type: 'text';
|
|
1188
|
+
text: string;
|
|
1189
|
+
} | {
|
|
1190
|
+
type: 'image';
|
|
1191
|
+
mediaType: string;
|
|
1192
|
+
dataRef: string;
|
|
1193
|
+
} | {
|
|
1194
|
+
type: 'artifact_ref';
|
|
1195
|
+
kind: ObservationArtifactKind;
|
|
1196
|
+
path: string;
|
|
1197
|
+
} | {
|
|
1198
|
+
type: 'structured_json';
|
|
1199
|
+
payload: Record<string, unknown>;
|
|
1200
|
+
};
|
|
1201
|
+
interface ObservationFrame {
|
|
1202
|
+
sessionId: string;
|
|
1203
|
+
actionId: string;
|
|
1204
|
+
frameId: string;
|
|
1205
|
+
blocks: ObservationBlock[];
|
|
1206
|
+
createdAt: number;
|
|
1207
|
+
}
|
|
1208
|
+
interface ComputerUseCheckpoint {
|
|
1209
|
+
sessionId: string;
|
|
1210
|
+
taskId: string;
|
|
1211
|
+
lastActionId?: string;
|
|
1212
|
+
latestFrameIds: string[];
|
|
1213
|
+
verificationFailures: number;
|
|
1214
|
+
updatedAt: number;
|
|
1215
|
+
}
|
|
1216
|
+
interface ComputerUseError {
|
|
1217
|
+
code: ComputerUseErrorCode;
|
|
1218
|
+
message: string;
|
|
1219
|
+
retryable: boolean;
|
|
1220
|
+
details?: Record<string, unknown>;
|
|
1221
|
+
}
|
|
1222
|
+
declare function isComputerUseErrorCode(value: string): value is ComputerUseErrorCode;
|
|
1223
|
+
|
|
1224
|
+
interface Fact {
|
|
1225
|
+
id?: number;
|
|
1226
|
+
key?: string;
|
|
1227
|
+
content: string;
|
|
1228
|
+
tags?: string[];
|
|
1229
|
+
created_at: number;
|
|
1230
|
+
}
|
|
1231
|
+
interface Episode {
|
|
1232
|
+
id?: number;
|
|
1233
|
+
task_id?: string;
|
|
1234
|
+
input: string;
|
|
1235
|
+
plan: string;
|
|
1236
|
+
result: string;
|
|
1237
|
+
strategy_id?: string;
|
|
1238
|
+
strategy_version?: string;
|
|
1239
|
+
created_at: number;
|
|
1240
|
+
}
|
|
1241
|
+
interface StrategyEpisodeSummary {
|
|
1242
|
+
strategy_id: string;
|
|
1243
|
+
strategy_version: string;
|
|
1244
|
+
total: number;
|
|
1245
|
+
success: number;
|
|
1246
|
+
failure: number;
|
|
1247
|
+
avg_duration_ms: number;
|
|
1248
|
+
}
|
|
1249
|
+
interface Trace {
|
|
1250
|
+
id?: number;
|
|
1251
|
+
episode_id?: number;
|
|
1252
|
+
step_index: number;
|
|
1253
|
+
tool_name: string;
|
|
1254
|
+
tool_args: string;
|
|
1255
|
+
tool_output: string;
|
|
1256
|
+
duration: number;
|
|
1257
|
+
status: 'success' | 'failed';
|
|
1258
|
+
}
|
|
1259
|
+
interface StrategyProposal {
|
|
1260
|
+
id?: number;
|
|
1261
|
+
strategy_path: string;
|
|
1262
|
+
status: 'pending_human' | 'approved' | 'rejected' | 'invalid';
|
|
1263
|
+
reason?: string;
|
|
1264
|
+
evaluation_json?: string;
|
|
1265
|
+
created_at: number;
|
|
1266
|
+
decided_at?: number;
|
|
1267
|
+
}
|
|
1268
|
+
interface TaskReportRecord {
|
|
1269
|
+
id?: number;
|
|
1270
|
+
task_id: string;
|
|
1271
|
+
report_json: string;
|
|
1272
|
+
created_at: number;
|
|
1273
|
+
}
|
|
1274
|
+
interface TaskFeedbackRecord {
|
|
1275
|
+
id?: number;
|
|
1276
|
+
task_id: string;
|
|
1277
|
+
feedback_json: string;
|
|
1278
|
+
created_at: number;
|
|
1279
|
+
}
|
|
1280
|
+
interface ObservationFrameRecord {
|
|
1281
|
+
id?: number;
|
|
1282
|
+
task_id: string;
|
|
1283
|
+
session_id: string;
|
|
1284
|
+
action_id: string;
|
|
1285
|
+
frame_id: string;
|
|
1286
|
+
frame_json: string;
|
|
1287
|
+
created_at: number;
|
|
1288
|
+
}
|
|
1289
|
+
interface ComputerUseSessionSummaryRecord {
|
|
1290
|
+
id?: number;
|
|
1291
|
+
session_id: string;
|
|
1292
|
+
task_id: string;
|
|
1293
|
+
last_action_id?: string;
|
|
1294
|
+
latest_frame_ids_json: string;
|
|
1295
|
+
verification_failures: number;
|
|
1296
|
+
status: 'active' | 'ended';
|
|
1297
|
+
started_at: number;
|
|
1298
|
+
ended_at?: number;
|
|
1299
|
+
updated_at: number;
|
|
1300
|
+
}
|
|
1301
|
+
interface ComputerUseSessionSummary {
|
|
1302
|
+
sessionId: string;
|
|
1303
|
+
taskId: string;
|
|
1304
|
+
lastActionId?: string;
|
|
1305
|
+
latestFrameIds: string[];
|
|
1306
|
+
verificationFailures: number;
|
|
1307
|
+
status: 'active' | 'ended';
|
|
1308
|
+
startedAt: number;
|
|
1309
|
+
endedAt?: number;
|
|
1310
|
+
updatedAt: number;
|
|
1311
|
+
}
|
|
1312
|
+
interface UpsertComputerUseSessionSummaryInput {
|
|
1313
|
+
sessionId: string;
|
|
1314
|
+
taskId: string;
|
|
1315
|
+
lastActionId?: string;
|
|
1316
|
+
latestFrameIds: string[];
|
|
1317
|
+
verificationFailures: number;
|
|
1318
|
+
status: 'active' | 'ended';
|
|
1319
|
+
startedAt?: number;
|
|
1320
|
+
endedAt?: number;
|
|
1321
|
+
updatedAt?: number;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Checkpoint captures the full execution state of an agentic loop iteration,
|
|
1325
|
+
* allowing interrupted tasks to be resumed from the last successful checkpoint.
|
|
1326
|
+
*/
|
|
1327
|
+
interface Checkpoint {
|
|
1328
|
+
taskId: string;
|
|
1329
|
+
runId: string;
|
|
1330
|
+
input: string;
|
|
1331
|
+
iteration: number;
|
|
1332
|
+
messagesJson: string;
|
|
1333
|
+
tracesJson: string;
|
|
1334
|
+
systemPrompt: string;
|
|
1335
|
+
toolsJson: string;
|
|
1336
|
+
computerUseSessionId?: string;
|
|
1337
|
+
computerUseLastActionId?: string;
|
|
1338
|
+
computerUseLatestFrameIdsJson?: string;
|
|
1339
|
+
computerUseVerificationFailures?: number;
|
|
1340
|
+
taskCreatedAt: number;
|
|
1341
|
+
updatedAt: number;
|
|
1342
|
+
}
|
|
1343
|
+
interface MemoryManagerOptions {
|
|
1344
|
+
checkpointTtlMs?: number;
|
|
1345
|
+
observationFrameTtlMs?: number;
|
|
1346
|
+
}
|
|
1347
|
+
declare class MemoryManager extends EventEmitter {
|
|
1348
|
+
private db;
|
|
1349
|
+
private checkpointTtlMs;
|
|
1350
|
+
private observationFrameTtlMs;
|
|
1351
|
+
constructor(dbPath: string, options?: MemoryManagerOptions);
|
|
1352
|
+
private init;
|
|
1353
|
+
/**
|
|
1354
|
+
* Remember a fact. If key is provided and exists, it updates the fact.
|
|
1355
|
+
*/
|
|
1356
|
+
rememberFact(content: string, key?: string, tags?: string[]): void;
|
|
1357
|
+
/**
|
|
1358
|
+
* Search for facts using Full-Text Search
|
|
1359
|
+
*/
|
|
1360
|
+
searchFacts(query: string, limit?: number): Fact[];
|
|
1361
|
+
getAllFacts(limit?: number): Fact[];
|
|
1362
|
+
getFactsByTag(tag: string, limit?: number): Fact[];
|
|
1363
|
+
getFactByKey(key: string): Fact | undefined;
|
|
1364
|
+
deleteFactById(id: number): boolean;
|
|
1365
|
+
deleteFactByKey(key: string): boolean;
|
|
1366
|
+
/**
|
|
1367
|
+
* Record a completed task execution and return its ID
|
|
1368
|
+
*/
|
|
1369
|
+
recordEpisode(episode: Episode): number;
|
|
1370
|
+
getEpisode(id: number): Episode | undefined;
|
|
1371
|
+
listEpisodes(limit?: number): Episode[];
|
|
1372
|
+
listEpisodesByStrategy(strategyId: string, strategyVersion: string, options?: {
|
|
1373
|
+
limit?: number;
|
|
1374
|
+
sinceMs?: number;
|
|
1375
|
+
}): Episode[];
|
|
1376
|
+
summarizeEpisodesByStrategy(strategyId: string, strategyVersion: string, options?: {
|
|
1377
|
+
limit?: number;
|
|
1378
|
+
sinceMs?: number;
|
|
1379
|
+
}): StrategyEpisodeSummary;
|
|
1380
|
+
recordStrategyProposal(proposal: StrategyProposal): number;
|
|
1381
|
+
updateStrategyProposal(id: number, status: StrategyProposal['status'], reason?: string, evaluation_json?: string): boolean;
|
|
1382
|
+
getStrategyProposal(id: number): StrategyProposal | undefined;
|
|
1383
|
+
listStrategyProposals(limit?: number): StrategyProposal[];
|
|
1384
|
+
recordTaskReport(taskId: string, report: unknown): number;
|
|
1385
|
+
listTaskReports(limit?: number): TaskReportRecord[];
|
|
1386
|
+
recordTaskFeedback(taskId: string, feedback: unknown): number;
|
|
1387
|
+
listTaskFeedback(limit?: number): TaskFeedbackRecord[];
|
|
1388
|
+
/**
|
|
1389
|
+
* Find relevant past episodes
|
|
1390
|
+
*/
|
|
1391
|
+
recallEpisodes(query: string, limit?: number): Episode[];
|
|
1392
|
+
/**
|
|
1393
|
+
* Record execution traces for an episode
|
|
1394
|
+
*/
|
|
1395
|
+
recordTraces(episodeId: number, traces: Trace[]): void;
|
|
1396
|
+
getTraces(episodeId: number): Trace[];
|
|
1397
|
+
recordObservationFrame(taskId: string, frame: ObservationFrame): number;
|
|
1398
|
+
listObservationFramesByTask(taskId: string, limit?: number): ObservationFrame[];
|
|
1399
|
+
listObservationFramesBySession(sessionId: string, limit?: number): ObservationFrame[];
|
|
1400
|
+
upsertComputerUseSessionSummary(input: UpsertComputerUseSessionSummaryInput): void;
|
|
1401
|
+
getComputerUseSessionSummary(sessionId: string): ComputerUseSessionSummary | null;
|
|
1402
|
+
private parseFrameIdsJson;
|
|
1403
|
+
/**
|
|
1404
|
+
* Save or update a checkpoint. Uses UPSERT (INSERT OR REPLACE) so each
|
|
1405
|
+
* task has at most one checkpoint row, updated in-place every iteration.
|
|
1406
|
+
*/
|
|
1407
|
+
saveCheckpoint(checkpoint: Checkpoint): void;
|
|
1408
|
+
/**
|
|
1409
|
+
* Load a checkpoint by task ID. Returns null if not found.
|
|
1410
|
+
*/
|
|
1411
|
+
loadCheckpoint(taskId: string): Checkpoint | null;
|
|
1412
|
+
/**
|
|
1413
|
+
* Delete a checkpoint after task completion or failure.
|
|
1414
|
+
*/
|
|
1415
|
+
deleteCheckpoint(taskId: string): boolean;
|
|
1416
|
+
/**
|
|
1417
|
+
* List all checkpoints that can be resumed (for UI and CLI).
|
|
1418
|
+
*/
|
|
1419
|
+
listCheckpoints(): Checkpoint[];
|
|
1420
|
+
/**
|
|
1421
|
+
* Remove checkpoints older than the TTL (default: 24 hours).
|
|
1422
|
+
*/
|
|
1423
|
+
cleanupStaleCheckpoints(ttlMs?: number): number;
|
|
1424
|
+
/**
|
|
1425
|
+
* Remove observation frames older than the TTL (default: 7 days).
|
|
1426
|
+
*/
|
|
1427
|
+
cleanupStaleObservationFrames(ttlMs?: number): number;
|
|
1428
|
+
getPerformanceMetrics(limit?: number): {
|
|
1429
|
+
total: number;
|
|
1430
|
+
success: number;
|
|
1431
|
+
failure: number;
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
declare const TaskStatusSchema: z.ZodEnum<["pending", "running", "completed", "failed", "cancelled"]>;
|
|
1436
|
+
type TaskStatus = z.infer<typeof TaskStatusSchema>;
|
|
1437
|
+
declare const TaskSchema: z.ZodObject<{
|
|
1438
|
+
id: z.ZodString;
|
|
1439
|
+
description: z.ZodString;
|
|
1440
|
+
createdAt: z.ZodNumber;
|
|
1441
|
+
status: z.ZodEnum<["pending", "running", "completed", "failed", "cancelled"]>;
|
|
1442
|
+
result: z.ZodOptional<z.ZodString>;
|
|
1443
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1444
|
+
}, "strip", z.ZodTypeAny, {
|
|
1445
|
+
status: "failed" | "pending" | "running" | "completed" | "cancelled";
|
|
1446
|
+
id: string;
|
|
1447
|
+
description: string;
|
|
1448
|
+
createdAt: number;
|
|
1449
|
+
result?: string | undefined;
|
|
1450
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1451
|
+
}, {
|
|
1452
|
+
status: "failed" | "pending" | "running" | "completed" | "cancelled";
|
|
1453
|
+
id: string;
|
|
1454
|
+
description: string;
|
|
1455
|
+
createdAt: number;
|
|
1456
|
+
result?: string | undefined;
|
|
1457
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1458
|
+
}>;
|
|
1459
|
+
type Task = z.infer<typeof TaskSchema>;
|
|
1460
|
+
declare const StepTypeSchema: z.ZodEnum<["thought", "action", "system"]>;
|
|
1461
|
+
type StepType = z.infer<typeof StepTypeSchema>;
|
|
1462
|
+
declare const StepStatusSchema: z.ZodEnum<["pending", "running", "completed", "failed", "skipped"]>;
|
|
1463
|
+
type StepStatus = z.infer<typeof StepStatusSchema>;
|
|
1464
|
+
declare const StepSchema: z.ZodObject<{
|
|
1465
|
+
id: z.ZodString;
|
|
1466
|
+
taskId: z.ZodString;
|
|
1467
|
+
type: z.ZodEnum<["thought", "action", "system"]>;
|
|
1468
|
+
description: z.ZodString;
|
|
1469
|
+
status: z.ZodEnum<["pending", "running", "completed", "failed", "skipped"]>;
|
|
1470
|
+
tool: z.ZodOptional<z.ZodString>;
|
|
1471
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1472
|
+
result: z.ZodOptional<z.ZodString>;
|
|
1473
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1474
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
1475
|
+
completedAt: z.ZodOptional<z.ZodNumber>;
|
|
1476
|
+
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1477
|
+
riskLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
1478
|
+
requiresConfirmation: z.ZodOptional<z.ZodBoolean>;
|
|
1479
|
+
verification: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1480
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1481
|
+
}, "strip", z.ZodTypeAny, {
|
|
1482
|
+
type: "system" | "thought" | "action";
|
|
1483
|
+
status: "failed" | "pending" | "running" | "completed" | "skipped";
|
|
1484
|
+
id: string;
|
|
1485
|
+
description: string;
|
|
1486
|
+
taskId: string;
|
|
1487
|
+
tool?: string | undefined;
|
|
1488
|
+
error?: string | undefined;
|
|
1489
|
+
startedAt?: number | undefined;
|
|
1490
|
+
result?: string | undefined;
|
|
1491
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1492
|
+
args?: Record<string, unknown> | undefined;
|
|
1493
|
+
completedAt?: number | undefined;
|
|
1494
|
+
dependsOn?: string[] | undefined;
|
|
1495
|
+
riskLevel?: "low" | "medium" | "high" | undefined;
|
|
1496
|
+
requiresConfirmation?: boolean | undefined;
|
|
1497
|
+
verification?: string[] | undefined;
|
|
1498
|
+
}, {
|
|
1499
|
+
type: "system" | "thought" | "action";
|
|
1500
|
+
status: "failed" | "pending" | "running" | "completed" | "skipped";
|
|
1501
|
+
id: string;
|
|
1502
|
+
description: string;
|
|
1503
|
+
taskId: string;
|
|
1504
|
+
tool?: string | undefined;
|
|
1505
|
+
error?: string | undefined;
|
|
1506
|
+
startedAt?: number | undefined;
|
|
1507
|
+
result?: string | undefined;
|
|
1508
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1509
|
+
args?: Record<string, unknown> | undefined;
|
|
1510
|
+
completedAt?: number | undefined;
|
|
1511
|
+
dependsOn?: string[] | undefined;
|
|
1512
|
+
riskLevel?: "low" | "medium" | "high" | undefined;
|
|
1513
|
+
requiresConfirmation?: boolean | undefined;
|
|
1514
|
+
verification?: string[] | undefined;
|
|
1515
|
+
}>;
|
|
1516
|
+
type Step = z.infer<typeof StepSchema>;
|
|
1517
|
+
interface AgentContext {
|
|
1518
|
+
taskId: string;
|
|
1519
|
+
history: Message[];
|
|
1520
|
+
state: Record<string, unknown>;
|
|
1521
|
+
taskContext?: TaskContext;
|
|
1522
|
+
}
|
|
1523
|
+
interface TaskContext {
|
|
1524
|
+
cwd: string;
|
|
1525
|
+
tools: string[];
|
|
1526
|
+
toolDefinitions?: Array<{
|
|
1527
|
+
name: string;
|
|
1528
|
+
description?: string;
|
|
1529
|
+
inputSchema?: Record<string, unknown>;
|
|
1530
|
+
}>;
|
|
1531
|
+
strategyId: string;
|
|
1532
|
+
strategyVersion: string;
|
|
1533
|
+
facts: Fact[];
|
|
1534
|
+
episodes: Episode[];
|
|
1535
|
+
riskPolicy: {
|
|
1536
|
+
requiresConfirmation: string[];
|
|
1537
|
+
deniedTools: string[];
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
interface IStrategy {
|
|
1541
|
+
id: string;
|
|
1542
|
+
name: string;
|
|
1543
|
+
description: string;
|
|
1544
|
+
/**
|
|
1545
|
+
* Initialize a task, potentially creating the first set of steps
|
|
1546
|
+
*/
|
|
1547
|
+
init(task: Task, context: AgentContext): Promise<Step[]>;
|
|
1548
|
+
/**
|
|
1549
|
+
* Update the plan based on the result of the last step
|
|
1550
|
+
*/
|
|
1551
|
+
next(task: Task, context: AgentContext, lastStep?: Step): Promise<Step | null>;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
interface ILLMProvider {
|
|
1555
|
+
/**
|
|
1556
|
+
* The unique identifier of the provider (e.g., "anthropic", "openai")
|
|
1557
|
+
*/
|
|
1558
|
+
id: string;
|
|
1559
|
+
/**
|
|
1560
|
+
* Generate a completion for the given messages
|
|
1561
|
+
*/
|
|
1562
|
+
generate(request: LLMRequest): Promise<LLMResponse>;
|
|
1563
|
+
/**
|
|
1564
|
+
* Generate a stream of completion chunks
|
|
1565
|
+
*/
|
|
1566
|
+
generateStream(request: LLMRequest): AsyncGenerator<StreamChunk, void, unknown>;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
interface CreateLLMOptions {
|
|
1570
|
+
/** Override provider choice (default: from config or 'auto') */
|
|
1571
|
+
provider?: string;
|
|
1572
|
+
/** Override default model */
|
|
1573
|
+
model?: string;
|
|
1574
|
+
/** Override config-backed llm settings for draft/testing scenarios */
|
|
1575
|
+
llmOverrides?: {
|
|
1576
|
+
provider?: string;
|
|
1577
|
+
defaultModel?: string;
|
|
1578
|
+
fallbackOrder?: string[];
|
|
1579
|
+
openaiApiKey?: string;
|
|
1580
|
+
anthropicApiKey?: string;
|
|
1581
|
+
openaiBaseUrl?: string;
|
|
1582
|
+
anthropicBaseUrl?: string;
|
|
1583
|
+
ollamaBaseUrl?: string;
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Create an LLM provider based on Lydia's config.
|
|
1588
|
+
*
|
|
1589
|
+
* Reads `~/.lydia/config.json` for provider settings, API keys come from
|
|
1590
|
+
* environment variables. Returns a single provider or a FallbackProvider
|
|
1591
|
+
* when `provider` is 'auto'.
|
|
1592
|
+
*
|
|
1593
|
+
* This is the single source of truth for provider initialization —
|
|
1594
|
+
* used by both the Server (dashboard) and CLI.
|
|
1595
|
+
*/
|
|
1596
|
+
declare function createLLMFromConfig(options?: CreateLLMOptions): Promise<ILLMProvider>;
|
|
1597
|
+
|
|
1598
|
+
declare class AnthropicProvider implements ILLMProvider {
|
|
1599
|
+
readonly id = "anthropic";
|
|
1600
|
+
private client;
|
|
1601
|
+
private defaultModel;
|
|
1602
|
+
constructor(options?: {
|
|
1603
|
+
apiKey?: string;
|
|
1604
|
+
baseURL?: string;
|
|
1605
|
+
defaultModel?: string;
|
|
1606
|
+
});
|
|
1607
|
+
generate(request: LLMRequest): Promise<LLMResponse>;
|
|
1608
|
+
generateStream(request: LLMRequest): AsyncGenerator<StreamChunk, void, unknown>;
|
|
1609
|
+
private convertMessages;
|
|
1610
|
+
private convertContentBlock;
|
|
1611
|
+
private convertResponse;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
declare class OllamaProvider implements ILLMProvider {
|
|
1615
|
+
readonly id = "ollama";
|
|
1616
|
+
private baseURL;
|
|
1617
|
+
private defaultModel;
|
|
1618
|
+
constructor(options?: {
|
|
1619
|
+
baseURL?: string;
|
|
1620
|
+
defaultModel?: string;
|
|
1621
|
+
});
|
|
1622
|
+
generate(request: LLMRequest): Promise<LLMResponse>;
|
|
1623
|
+
generateStream(request: LLMRequest): AsyncGenerator<StreamChunk, void, unknown>;
|
|
1624
|
+
private mapOptions;
|
|
1625
|
+
private convertMessages;
|
|
1626
|
+
private normalizeToolResult;
|
|
1627
|
+
private convertResponse;
|
|
1628
|
+
private mapStopReason;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
declare class FallbackProvider implements ILLMProvider {
|
|
1632
|
+
readonly id = "fallback";
|
|
1633
|
+
private providers;
|
|
1634
|
+
constructor(providers: ILLMProvider[]);
|
|
1635
|
+
generate(request: LLMRequest): Promise<LLMResponse>;
|
|
1636
|
+
generateStream(request: LLMRequest): AsyncGenerator<StreamChunk, void, unknown>;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
declare class OpenAIProvider implements ILLMProvider {
|
|
1640
|
+
readonly id = "openai";
|
|
1641
|
+
private client;
|
|
1642
|
+
private defaultModel;
|
|
1643
|
+
constructor(options?: {
|
|
1644
|
+
apiKey?: string;
|
|
1645
|
+
baseURL?: string;
|
|
1646
|
+
defaultModel?: string;
|
|
1647
|
+
});
|
|
1648
|
+
generate(request: LLMRequest): Promise<LLMResponse>;
|
|
1649
|
+
generateStream(request: LLMRequest): AsyncGenerator<StreamChunk, void, unknown>;
|
|
1650
|
+
private convertMessages;
|
|
1651
|
+
private convertMessageContent;
|
|
1652
|
+
private extractToolResult;
|
|
1653
|
+
private normalizeToolResultContent;
|
|
1654
|
+
private convertResponse;
|
|
1655
|
+
private mapStopReason;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
declare class MockProvider implements ILLMProvider {
|
|
1659
|
+
readonly id = "mock";
|
|
1660
|
+
requests: LLMRequest[];
|
|
1661
|
+
private responseQueue;
|
|
1662
|
+
/**
|
|
1663
|
+
* Queue a mock response to be returned by the next generate call
|
|
1664
|
+
*/
|
|
1665
|
+
enqueueResponse(response: Partial<LLMResponse> & {
|
|
1666
|
+
text?: string;
|
|
1667
|
+
}): void;
|
|
1668
|
+
generate(request: LLMRequest): Promise<LLMResponse>;
|
|
1669
|
+
generateStream(request: LLMRequest): AsyncGenerator<StreamChunk, void, unknown>;
|
|
1670
|
+
/**
|
|
1671
|
+
* Clear recorded requests and response queue
|
|
1672
|
+
*/
|
|
1673
|
+
clear(): void;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
declare const IntentSchema: z.ZodObject<{
|
|
1677
|
+
category: z.ZodEnum<["query", "action", "script", "unknown"]>;
|
|
1678
|
+
summary: z.ZodString;
|
|
1679
|
+
entities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1680
|
+
complexity: z.ZodEnum<["simple", "medium", "complex"]>;
|
|
1681
|
+
}, "strip", z.ZodTypeAny, {
|
|
1682
|
+
category: "unknown" | "action" | "query" | "script";
|
|
1683
|
+
summary: string;
|
|
1684
|
+
complexity: "medium" | "simple" | "complex";
|
|
1685
|
+
entities?: string[] | undefined;
|
|
1686
|
+
}, {
|
|
1687
|
+
category: "unknown" | "action" | "query" | "script";
|
|
1688
|
+
summary: string;
|
|
1689
|
+
complexity: "medium" | "simple" | "complex";
|
|
1690
|
+
entities?: string[] | undefined;
|
|
1691
|
+
}>;
|
|
1692
|
+
type Intent = z.infer<typeof IntentSchema>;
|
|
1693
|
+
declare const IntentProfileSchema: z.ZodObject<{
|
|
1694
|
+
category: z.ZodEnum<["query", "action", "script", "unknown"]>;
|
|
1695
|
+
summary: z.ZodString;
|
|
1696
|
+
entities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1697
|
+
complexity: z.ZodEnum<["simple", "medium", "complex"]>;
|
|
1698
|
+
} & {
|
|
1699
|
+
goal: z.ZodDefault<z.ZodString>;
|
|
1700
|
+
deliverables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1701
|
+
constraints: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1702
|
+
successCriteria: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1703
|
+
assumptions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1704
|
+
requiredTools: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1705
|
+
}, "strip", z.ZodTypeAny, {
|
|
1706
|
+
category: "unknown" | "action" | "query" | "script";
|
|
1707
|
+
summary: string;
|
|
1708
|
+
complexity: "medium" | "simple" | "complex";
|
|
1709
|
+
goal: string;
|
|
1710
|
+
deliverables: string[];
|
|
1711
|
+
constraints: string[];
|
|
1712
|
+
successCriteria: string[];
|
|
1713
|
+
assumptions: string[];
|
|
1714
|
+
requiredTools: string[];
|
|
1715
|
+
entities?: string[] | undefined;
|
|
1716
|
+
}, {
|
|
1717
|
+
category: "unknown" | "action" | "query" | "script";
|
|
1718
|
+
summary: string;
|
|
1719
|
+
complexity: "medium" | "simple" | "complex";
|
|
1720
|
+
entities?: string[] | undefined;
|
|
1721
|
+
goal?: string | undefined;
|
|
1722
|
+
deliverables?: string[] | undefined;
|
|
1723
|
+
constraints?: string[] | undefined;
|
|
1724
|
+
successCriteria?: string[] | undefined;
|
|
1725
|
+
assumptions?: string[] | undefined;
|
|
1726
|
+
requiredTools?: string[] | undefined;
|
|
1727
|
+
}>;
|
|
1728
|
+
type IntentProfile = z.infer<typeof IntentProfileSchema>;
|
|
1729
|
+
declare class IntentAnalyzer {
|
|
1730
|
+
private llm;
|
|
1731
|
+
constructor(llm: ILLMProvider);
|
|
1732
|
+
analyze(userInput: string): Promise<IntentProfile>;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
declare const SkillMetaSchema: z.ZodObject<{
|
|
1736
|
+
name: z.ZodString;
|
|
1737
|
+
description: z.ZodString;
|
|
1738
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1739
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1740
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1741
|
+
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1742
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["main", "fork"]>>>;
|
|
1743
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1744
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1745
|
+
name: z.ZodString;
|
|
1746
|
+
description: z.ZodString;
|
|
1747
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1748
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1749
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1750
|
+
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1751
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["main", "fork"]>>>;
|
|
1752
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1753
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1754
|
+
name: z.ZodString;
|
|
1755
|
+
description: z.ZodString;
|
|
1756
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1757
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1758
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1759
|
+
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1760
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["main", "fork"]>>>;
|
|
1761
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1762
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1763
|
+
type SkillMeta = z.infer<typeof SkillMetaSchema>;
|
|
1764
|
+
declare const StaticSkillSchema: z.ZodObject<{
|
|
1765
|
+
name: z.ZodString;
|
|
1766
|
+
description: z.ZodString;
|
|
1767
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1768
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1769
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1770
|
+
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1771
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["main", "fork"]>>>;
|
|
1772
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1773
|
+
} & {
|
|
1774
|
+
content: z.ZodString;
|
|
1775
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1776
|
+
name: z.ZodString;
|
|
1777
|
+
description: z.ZodString;
|
|
1778
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1779
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1780
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1781
|
+
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1782
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["main", "fork"]>>>;
|
|
1783
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1784
|
+
} & {
|
|
1785
|
+
content: z.ZodString;
|
|
1786
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1787
|
+
name: z.ZodString;
|
|
1788
|
+
description: z.ZodString;
|
|
1789
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1790
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1791
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1792
|
+
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1793
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["main", "fork"]>>>;
|
|
1794
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1795
|
+
} & {
|
|
1796
|
+
content: z.ZodString;
|
|
1797
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1798
|
+
type StaticSkill = z.infer<typeof StaticSkillSchema>;
|
|
1799
|
+
/** @deprecated Use StaticSkillSchema instead */
|
|
1800
|
+
declare const SkillSchema: z.ZodObject<{
|
|
1801
|
+
name: z.ZodString;
|
|
1802
|
+
description: z.ZodString;
|
|
1803
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1804
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1805
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1806
|
+
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1807
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["main", "fork"]>>>;
|
|
1808
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1809
|
+
} & {
|
|
1810
|
+
content: z.ZodString;
|
|
1811
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1812
|
+
name: z.ZodString;
|
|
1813
|
+
description: z.ZodString;
|
|
1814
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1815
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1816
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1817
|
+
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1818
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["main", "fork"]>>>;
|
|
1819
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1820
|
+
} & {
|
|
1821
|
+
content: z.ZodString;
|
|
1822
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1823
|
+
name: z.ZodString;
|
|
1824
|
+
description: z.ZodString;
|
|
1825
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1826
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1827
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1828
|
+
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1829
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["main", "fork"]>>>;
|
|
1830
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1831
|
+
} & {
|
|
1832
|
+
content: z.ZodString;
|
|
1833
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1834
|
+
type SkillContext = {
|
|
1835
|
+
agentId?: string;
|
|
1836
|
+
taskId?: string;
|
|
1837
|
+
};
|
|
1838
|
+
interface DynamicSkill {
|
|
1839
|
+
name: string;
|
|
1840
|
+
description: string;
|
|
1841
|
+
version: string;
|
|
1842
|
+
author?: string;
|
|
1843
|
+
tags?: string[];
|
|
1844
|
+
tools?: {
|
|
1845
|
+
name: string;
|
|
1846
|
+
description: string;
|
|
1847
|
+
inputSchema: any;
|
|
1848
|
+
}[];
|
|
1849
|
+
execute(toolName: string, args: any, context: SkillContext): Promise<string>;
|
|
1850
|
+
content?: string;
|
|
1851
|
+
path?: string;
|
|
1852
|
+
allowedTools?: string[];
|
|
1853
|
+
}
|
|
1854
|
+
type Skill = StaticSkill | DynamicSkill;
|
|
1855
|
+
/** Type guard: check if a skill is a DynamicSkill */
|
|
1856
|
+
declare function isDynamicSkill(skill: Skill | SkillMeta): skill is DynamicSkill;
|
|
1857
|
+
/** Type guard: check if a skill has content loaded */
|
|
1858
|
+
declare function hasContent(skill: Skill | SkillMeta): skill is StaticSkill | (DynamicSkill & {
|
|
1859
|
+
content: string;
|
|
1860
|
+
});
|
|
1861
|
+
/** Extract content from a skill safely */
|
|
1862
|
+
declare function getSkillContent(skill: Skill | SkillMeta): string;
|
|
1863
|
+
|
|
1864
|
+
declare const StrategyMetadataSchema: z.ZodObject<{
|
|
1865
|
+
id: z.ZodString;
|
|
1866
|
+
version: z.ZodString;
|
|
1867
|
+
name: z.ZodString;
|
|
1868
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1869
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1870
|
+
inheritFrom: z.ZodOptional<z.ZodString>;
|
|
1871
|
+
}, "strip", z.ZodTypeAny, {
|
|
1872
|
+
id: string;
|
|
1873
|
+
name: string;
|
|
1874
|
+
version: string;
|
|
1875
|
+
description?: string | undefined;
|
|
1876
|
+
author?: string | undefined;
|
|
1877
|
+
inheritFrom?: string | undefined;
|
|
1878
|
+
}, {
|
|
1879
|
+
id: string;
|
|
1880
|
+
name: string;
|
|
1881
|
+
version: string;
|
|
1882
|
+
description?: string | undefined;
|
|
1883
|
+
author?: string | undefined;
|
|
1884
|
+
inheritFrom?: string | undefined;
|
|
1885
|
+
}>;
|
|
1886
|
+
declare const StrategySystemSchema: z.ZodObject<{
|
|
1887
|
+
role: z.ZodString;
|
|
1888
|
+
personality: z.ZodOptional<z.ZodString>;
|
|
1889
|
+
constraints: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1890
|
+
goals: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1891
|
+
}, "strip", z.ZodTypeAny, {
|
|
1892
|
+
role: string;
|
|
1893
|
+
constraints: string[];
|
|
1894
|
+
goals: string[];
|
|
1895
|
+
personality?: string | undefined;
|
|
1896
|
+
}, {
|
|
1897
|
+
role: string;
|
|
1898
|
+
constraints?: string[] | undefined;
|
|
1899
|
+
personality?: string | undefined;
|
|
1900
|
+
goals?: string[] | undefined;
|
|
1901
|
+
}>;
|
|
1902
|
+
declare const StrategyPromptsSchema: z.ZodObject<{
|
|
1903
|
+
planning: z.ZodOptional<z.ZodString>;
|
|
1904
|
+
reflection: z.ZodOptional<z.ZodString>;
|
|
1905
|
+
intent: z.ZodOptional<z.ZodString>;
|
|
1906
|
+
}, "strip", z.ZodTypeAny, {
|
|
1907
|
+
planning?: string | undefined;
|
|
1908
|
+
reflection?: string | undefined;
|
|
1909
|
+
intent?: string | undefined;
|
|
1910
|
+
}, {
|
|
1911
|
+
planning?: string | undefined;
|
|
1912
|
+
reflection?: string | undefined;
|
|
1913
|
+
intent?: string | undefined;
|
|
1914
|
+
}>;
|
|
1915
|
+
declare const StrategyPlanningSchema: z.ZodObject<{
|
|
1916
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1917
|
+
temperature: z.ZodDefault<z.ZodNumber>;
|
|
1918
|
+
maxSteps: z.ZodDefault<z.ZodNumber>;
|
|
1919
|
+
thinkingProcess: z.ZodDefault<z.ZodBoolean>;
|
|
1920
|
+
}, "strip", z.ZodTypeAny, {
|
|
1921
|
+
temperature: number;
|
|
1922
|
+
maxSteps: number;
|
|
1923
|
+
thinkingProcess: boolean;
|
|
1924
|
+
model?: string | undefined;
|
|
1925
|
+
}, {
|
|
1926
|
+
model?: string | undefined;
|
|
1927
|
+
temperature?: number | undefined;
|
|
1928
|
+
maxSteps?: number | undefined;
|
|
1929
|
+
thinkingProcess?: boolean | undefined;
|
|
1930
|
+
}>;
|
|
1931
|
+
declare const StrategyExecutionSchema: z.ZodObject<{
|
|
1932
|
+
riskTolerance: z.ZodDefault<z.ZodEnum<["low", "medium", "high"]>>;
|
|
1933
|
+
requiresConfirmation: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1934
|
+
autoRetry: z.ZodDefault<z.ZodBoolean>;
|
|
1935
|
+
maxRetries: z.ZodDefault<z.ZodNumber>;
|
|
1936
|
+
}, "strip", z.ZodTypeAny, {
|
|
1937
|
+
requiresConfirmation: string[];
|
|
1938
|
+
maxRetries: number;
|
|
1939
|
+
riskTolerance: "low" | "medium" | "high";
|
|
1940
|
+
autoRetry: boolean;
|
|
1941
|
+
}, {
|
|
1942
|
+
requiresConfirmation?: string[] | undefined;
|
|
1943
|
+
maxRetries?: number | undefined;
|
|
1944
|
+
riskTolerance?: "low" | "medium" | "high" | undefined;
|
|
1945
|
+
autoRetry?: boolean | undefined;
|
|
1946
|
+
}>;
|
|
1947
|
+
declare const StrategyPreferencesSchema: z.ZodObject<{
|
|
1948
|
+
riskTolerance: z.ZodDefault<z.ZodNumber>;
|
|
1949
|
+
userConfirmation: z.ZodDefault<z.ZodNumber>;
|
|
1950
|
+
autonomyLevel: z.ZodDefault<z.ZodEnum<["manual", "assisted", "autonomous"]>>;
|
|
1951
|
+
responseSpeed: z.ZodDefault<z.ZodNumber>;
|
|
1952
|
+
}, "strip", z.ZodTypeAny, {
|
|
1953
|
+
riskTolerance: number;
|
|
1954
|
+
userConfirmation: number;
|
|
1955
|
+
autonomyLevel: "manual" | "assisted" | "autonomous";
|
|
1956
|
+
responseSpeed: number;
|
|
1957
|
+
}, {
|
|
1958
|
+
riskTolerance?: number | undefined;
|
|
1959
|
+
userConfirmation?: number | undefined;
|
|
1960
|
+
autonomyLevel?: "manual" | "assisted" | "autonomous" | undefined;
|
|
1961
|
+
responseSpeed?: number | undefined;
|
|
1962
|
+
}>;
|
|
1963
|
+
declare const StrategyConstraintsSchema: z.ZodObject<{
|
|
1964
|
+
mustConfirmBefore: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1965
|
+
neverSkipReviewFor: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1966
|
+
deniedTools: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1967
|
+
}, "strip", z.ZodTypeAny, {
|
|
1968
|
+
mustConfirmBefore: string[];
|
|
1969
|
+
neverSkipReviewFor: string[];
|
|
1970
|
+
deniedTools: string[];
|
|
1971
|
+
}, {
|
|
1972
|
+
mustConfirmBefore?: string[] | undefined;
|
|
1973
|
+
neverSkipReviewFor?: string[] | undefined;
|
|
1974
|
+
deniedTools?: string[] | undefined;
|
|
1975
|
+
}>;
|
|
1976
|
+
declare const StrategyEvolutionLimitsSchema: z.ZodObject<{
|
|
1977
|
+
maxAutonomyIncrease: z.ZodDefault<z.ZodNumber>;
|
|
1978
|
+
cooldownPeriod: z.ZodDefault<z.ZodString>;
|
|
1979
|
+
}, "strip", z.ZodTypeAny, {
|
|
1980
|
+
maxAutonomyIncrease: number;
|
|
1981
|
+
cooldownPeriod: string;
|
|
1982
|
+
}, {
|
|
1983
|
+
maxAutonomyIncrease?: number | undefined;
|
|
1984
|
+
cooldownPeriod?: string | undefined;
|
|
1985
|
+
}>;
|
|
1986
|
+
declare const StrategySchema: z.ZodObject<{
|
|
1987
|
+
metadata: z.ZodObject<{
|
|
1988
|
+
id: z.ZodString;
|
|
1989
|
+
version: z.ZodString;
|
|
1990
|
+
name: z.ZodString;
|
|
1991
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1992
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1993
|
+
inheritFrom: z.ZodOptional<z.ZodString>;
|
|
1994
|
+
}, "strip", z.ZodTypeAny, {
|
|
1995
|
+
id: string;
|
|
1996
|
+
name: string;
|
|
1997
|
+
version: string;
|
|
1998
|
+
description?: string | undefined;
|
|
1999
|
+
author?: string | undefined;
|
|
2000
|
+
inheritFrom?: string | undefined;
|
|
2001
|
+
}, {
|
|
2002
|
+
id: string;
|
|
2003
|
+
name: string;
|
|
2004
|
+
version: string;
|
|
2005
|
+
description?: string | undefined;
|
|
2006
|
+
author?: string | undefined;
|
|
2007
|
+
inheritFrom?: string | undefined;
|
|
2008
|
+
}>;
|
|
2009
|
+
system: z.ZodObject<{
|
|
2010
|
+
role: z.ZodString;
|
|
2011
|
+
personality: z.ZodOptional<z.ZodString>;
|
|
2012
|
+
constraints: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2013
|
+
goals: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2014
|
+
}, "strip", z.ZodTypeAny, {
|
|
2015
|
+
role: string;
|
|
2016
|
+
constraints: string[];
|
|
2017
|
+
goals: string[];
|
|
2018
|
+
personality?: string | undefined;
|
|
2019
|
+
}, {
|
|
2020
|
+
role: string;
|
|
2021
|
+
constraints?: string[] | undefined;
|
|
2022
|
+
personality?: string | undefined;
|
|
2023
|
+
goals?: string[] | undefined;
|
|
2024
|
+
}>;
|
|
2025
|
+
prompts: z.ZodOptional<z.ZodObject<{
|
|
2026
|
+
planning: z.ZodOptional<z.ZodString>;
|
|
2027
|
+
reflection: z.ZodOptional<z.ZodString>;
|
|
2028
|
+
intent: z.ZodOptional<z.ZodString>;
|
|
2029
|
+
}, "strip", z.ZodTypeAny, {
|
|
2030
|
+
planning?: string | undefined;
|
|
2031
|
+
reflection?: string | undefined;
|
|
2032
|
+
intent?: string | undefined;
|
|
2033
|
+
}, {
|
|
2034
|
+
planning?: string | undefined;
|
|
2035
|
+
reflection?: string | undefined;
|
|
2036
|
+
intent?: string | undefined;
|
|
2037
|
+
}>>;
|
|
2038
|
+
planning: z.ZodOptional<z.ZodObject<{
|
|
2039
|
+
model: z.ZodOptional<z.ZodString>;
|
|
2040
|
+
temperature: z.ZodDefault<z.ZodNumber>;
|
|
2041
|
+
maxSteps: z.ZodDefault<z.ZodNumber>;
|
|
2042
|
+
thinkingProcess: z.ZodDefault<z.ZodBoolean>;
|
|
2043
|
+
}, "strip", z.ZodTypeAny, {
|
|
2044
|
+
temperature: number;
|
|
2045
|
+
maxSteps: number;
|
|
2046
|
+
thinkingProcess: boolean;
|
|
2047
|
+
model?: string | undefined;
|
|
2048
|
+
}, {
|
|
2049
|
+
model?: string | undefined;
|
|
2050
|
+
temperature?: number | undefined;
|
|
2051
|
+
maxSteps?: number | undefined;
|
|
2052
|
+
thinkingProcess?: boolean | undefined;
|
|
2053
|
+
}>>;
|
|
2054
|
+
execution: z.ZodOptional<z.ZodObject<{
|
|
2055
|
+
riskTolerance: z.ZodDefault<z.ZodEnum<["low", "medium", "high"]>>;
|
|
2056
|
+
requiresConfirmation: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2057
|
+
autoRetry: z.ZodDefault<z.ZodBoolean>;
|
|
2058
|
+
maxRetries: z.ZodDefault<z.ZodNumber>;
|
|
2059
|
+
}, "strip", z.ZodTypeAny, {
|
|
2060
|
+
requiresConfirmation: string[];
|
|
2061
|
+
maxRetries: number;
|
|
2062
|
+
riskTolerance: "low" | "medium" | "high";
|
|
2063
|
+
autoRetry: boolean;
|
|
2064
|
+
}, {
|
|
2065
|
+
requiresConfirmation?: string[] | undefined;
|
|
2066
|
+
maxRetries?: number | undefined;
|
|
2067
|
+
riskTolerance?: "low" | "medium" | "high" | undefined;
|
|
2068
|
+
autoRetry?: boolean | undefined;
|
|
2069
|
+
}>>;
|
|
2070
|
+
preferences: z.ZodOptional<z.ZodObject<{
|
|
2071
|
+
riskTolerance: z.ZodDefault<z.ZodNumber>;
|
|
2072
|
+
userConfirmation: z.ZodDefault<z.ZodNumber>;
|
|
2073
|
+
autonomyLevel: z.ZodDefault<z.ZodEnum<["manual", "assisted", "autonomous"]>>;
|
|
2074
|
+
responseSpeed: z.ZodDefault<z.ZodNumber>;
|
|
2075
|
+
}, "strip", z.ZodTypeAny, {
|
|
2076
|
+
riskTolerance: number;
|
|
2077
|
+
userConfirmation: number;
|
|
2078
|
+
autonomyLevel: "manual" | "assisted" | "autonomous";
|
|
2079
|
+
responseSpeed: number;
|
|
2080
|
+
}, {
|
|
2081
|
+
riskTolerance?: number | undefined;
|
|
2082
|
+
userConfirmation?: number | undefined;
|
|
2083
|
+
autonomyLevel?: "manual" | "assisted" | "autonomous" | undefined;
|
|
2084
|
+
responseSpeed?: number | undefined;
|
|
2085
|
+
}>>;
|
|
2086
|
+
constraints: z.ZodOptional<z.ZodObject<{
|
|
2087
|
+
mustConfirmBefore: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2088
|
+
neverSkipReviewFor: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2089
|
+
deniedTools: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2090
|
+
}, "strip", z.ZodTypeAny, {
|
|
2091
|
+
mustConfirmBefore: string[];
|
|
2092
|
+
neverSkipReviewFor: string[];
|
|
2093
|
+
deniedTools: string[];
|
|
2094
|
+
}, {
|
|
2095
|
+
mustConfirmBefore?: string[] | undefined;
|
|
2096
|
+
neverSkipReviewFor?: string[] | undefined;
|
|
2097
|
+
deniedTools?: string[] | undefined;
|
|
2098
|
+
}>>;
|
|
2099
|
+
evolution_limits: z.ZodOptional<z.ZodObject<{
|
|
2100
|
+
maxAutonomyIncrease: z.ZodDefault<z.ZodNumber>;
|
|
2101
|
+
cooldownPeriod: z.ZodDefault<z.ZodString>;
|
|
2102
|
+
}, "strip", z.ZodTypeAny, {
|
|
2103
|
+
maxAutonomyIncrease: number;
|
|
2104
|
+
cooldownPeriod: string;
|
|
2105
|
+
}, {
|
|
2106
|
+
maxAutonomyIncrease?: number | undefined;
|
|
2107
|
+
cooldownPeriod?: string | undefined;
|
|
2108
|
+
}>>;
|
|
2109
|
+
}, "strip", z.ZodTypeAny, {
|
|
2110
|
+
system: {
|
|
2111
|
+
role: string;
|
|
2112
|
+
constraints: string[];
|
|
2113
|
+
goals: string[];
|
|
2114
|
+
personality?: string | undefined;
|
|
2115
|
+
};
|
|
2116
|
+
metadata: {
|
|
2117
|
+
id: string;
|
|
2118
|
+
name: string;
|
|
2119
|
+
version: string;
|
|
2120
|
+
description?: string | undefined;
|
|
2121
|
+
author?: string | undefined;
|
|
2122
|
+
inheritFrom?: string | undefined;
|
|
2123
|
+
};
|
|
2124
|
+
constraints?: {
|
|
2125
|
+
mustConfirmBefore: string[];
|
|
2126
|
+
neverSkipReviewFor: string[];
|
|
2127
|
+
deniedTools: string[];
|
|
2128
|
+
} | undefined;
|
|
2129
|
+
planning?: {
|
|
2130
|
+
temperature: number;
|
|
2131
|
+
maxSteps: number;
|
|
2132
|
+
thinkingProcess: boolean;
|
|
2133
|
+
model?: string | undefined;
|
|
2134
|
+
} | undefined;
|
|
2135
|
+
prompts?: {
|
|
2136
|
+
planning?: string | undefined;
|
|
2137
|
+
reflection?: string | undefined;
|
|
2138
|
+
intent?: string | undefined;
|
|
2139
|
+
} | undefined;
|
|
2140
|
+
execution?: {
|
|
2141
|
+
requiresConfirmation: string[];
|
|
2142
|
+
maxRetries: number;
|
|
2143
|
+
riskTolerance: "low" | "medium" | "high";
|
|
2144
|
+
autoRetry: boolean;
|
|
2145
|
+
} | undefined;
|
|
2146
|
+
preferences?: {
|
|
2147
|
+
riskTolerance: number;
|
|
2148
|
+
userConfirmation: number;
|
|
2149
|
+
autonomyLevel: "manual" | "assisted" | "autonomous";
|
|
2150
|
+
responseSpeed: number;
|
|
2151
|
+
} | undefined;
|
|
2152
|
+
evolution_limits?: {
|
|
2153
|
+
maxAutonomyIncrease: number;
|
|
2154
|
+
cooldownPeriod: string;
|
|
2155
|
+
} | undefined;
|
|
2156
|
+
}, {
|
|
2157
|
+
system: {
|
|
2158
|
+
role: string;
|
|
2159
|
+
constraints?: string[] | undefined;
|
|
2160
|
+
personality?: string | undefined;
|
|
2161
|
+
goals?: string[] | undefined;
|
|
2162
|
+
};
|
|
2163
|
+
metadata: {
|
|
2164
|
+
id: string;
|
|
2165
|
+
name: string;
|
|
2166
|
+
version: string;
|
|
2167
|
+
description?: string | undefined;
|
|
2168
|
+
author?: string | undefined;
|
|
2169
|
+
inheritFrom?: string | undefined;
|
|
2170
|
+
};
|
|
2171
|
+
constraints?: {
|
|
2172
|
+
mustConfirmBefore?: string[] | undefined;
|
|
2173
|
+
neverSkipReviewFor?: string[] | undefined;
|
|
2174
|
+
deniedTools?: string[] | undefined;
|
|
2175
|
+
} | undefined;
|
|
2176
|
+
planning?: {
|
|
2177
|
+
model?: string | undefined;
|
|
2178
|
+
temperature?: number | undefined;
|
|
2179
|
+
maxSteps?: number | undefined;
|
|
2180
|
+
thinkingProcess?: boolean | undefined;
|
|
2181
|
+
} | undefined;
|
|
2182
|
+
prompts?: {
|
|
2183
|
+
planning?: string | undefined;
|
|
2184
|
+
reflection?: string | undefined;
|
|
2185
|
+
intent?: string | undefined;
|
|
2186
|
+
} | undefined;
|
|
2187
|
+
execution?: {
|
|
2188
|
+
requiresConfirmation?: string[] | undefined;
|
|
2189
|
+
maxRetries?: number | undefined;
|
|
2190
|
+
riskTolerance?: "low" | "medium" | "high" | undefined;
|
|
2191
|
+
autoRetry?: boolean | undefined;
|
|
2192
|
+
} | undefined;
|
|
2193
|
+
preferences?: {
|
|
2194
|
+
riskTolerance?: number | undefined;
|
|
2195
|
+
userConfirmation?: number | undefined;
|
|
2196
|
+
autonomyLevel?: "manual" | "assisted" | "autonomous" | undefined;
|
|
2197
|
+
responseSpeed?: number | undefined;
|
|
2198
|
+
} | undefined;
|
|
2199
|
+
evolution_limits?: {
|
|
2200
|
+
maxAutonomyIncrease?: number | undefined;
|
|
2201
|
+
cooldownPeriod?: string | undefined;
|
|
2202
|
+
} | undefined;
|
|
2203
|
+
}>;
|
|
2204
|
+
type Strategy = z.infer<typeof StrategySchema>;
|
|
2205
|
+
type StrategyConfig = Strategy;
|
|
2206
|
+
|
|
2207
|
+
declare class SimplePlanner {
|
|
2208
|
+
private llm;
|
|
2209
|
+
private config;
|
|
2210
|
+
constructor(llm: ILLMProvider, config: StrategyConfig);
|
|
2211
|
+
private fillTemplate;
|
|
2212
|
+
private formatToolList;
|
|
2213
|
+
private formatToolArgs;
|
|
2214
|
+
createPlan(task: Task, intent: IntentProfile, context: AgentContext, skills?: Skill[], memories?: {
|
|
2215
|
+
facts: Fact[];
|
|
2216
|
+
episodes: Episode[];
|
|
2217
|
+
}): Promise<Step[]>;
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
declare class StrategyRegistry {
|
|
2221
|
+
private strategies;
|
|
2222
|
+
private activeId;
|
|
2223
|
+
loadDefault(): Promise<Strategy>;
|
|
2224
|
+
listFromDirectory(dirPath: string): Promise<Strategy[]>;
|
|
2225
|
+
loadFromFile(filePath: string): Promise<Strategy>;
|
|
2226
|
+
saveToFile(strategy: Strategy, filePath: string): Promise<void>;
|
|
2227
|
+
setActive(id: string): void;
|
|
2228
|
+
getActive(): Strategy;
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
declare const McpServerSchema: z.ZodObject<{
|
|
2232
|
+
command: z.ZodString;
|
|
2233
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2234
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2235
|
+
}, "strip", z.ZodTypeAny, {
|
|
2236
|
+
args: string[];
|
|
2237
|
+
command: string;
|
|
2238
|
+
env?: Record<string, string> | undefined;
|
|
2239
|
+
}, {
|
|
2240
|
+
command: string;
|
|
2241
|
+
args?: string[] | undefined;
|
|
2242
|
+
env?: Record<string, string> | undefined;
|
|
2243
|
+
}>;
|
|
2244
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
2245
|
+
llm: z.ZodDefault<z.ZodObject<{
|
|
2246
|
+
provider: z.ZodDefault<z.ZodEnum<["anthropic", "openai", "ollama", "mock", "auto"]>>;
|
|
2247
|
+
defaultModel: z.ZodDefault<z.ZodString>;
|
|
2248
|
+
fallbackOrder: z.ZodDefault<z.ZodArray<z.ZodEnum<["ollama", "openai", "anthropic", "mock"]>, "many">>;
|
|
2249
|
+
openaiApiKey: z.ZodDefault<z.ZodString>;
|
|
2250
|
+
anthropicApiKey: z.ZodDefault<z.ZodString>;
|
|
2251
|
+
openaiBaseUrl: z.ZodDefault<z.ZodString>;
|
|
2252
|
+
anthropicBaseUrl: z.ZodDefault<z.ZodString>;
|
|
2253
|
+
ollamaBaseUrl: z.ZodDefault<z.ZodString>;
|
|
2254
|
+
}, "strip", z.ZodTypeAny, {
|
|
2255
|
+
provider: "anthropic" | "openai" | "ollama" | "mock" | "auto";
|
|
2256
|
+
defaultModel: string;
|
|
2257
|
+
fallbackOrder: ("anthropic" | "openai" | "ollama" | "mock")[];
|
|
2258
|
+
openaiApiKey: string;
|
|
2259
|
+
anthropicApiKey: string;
|
|
2260
|
+
openaiBaseUrl: string;
|
|
2261
|
+
anthropicBaseUrl: string;
|
|
2262
|
+
ollamaBaseUrl: string;
|
|
2263
|
+
}, {
|
|
2264
|
+
provider?: "anthropic" | "openai" | "ollama" | "mock" | "auto" | undefined;
|
|
2265
|
+
defaultModel?: string | undefined;
|
|
2266
|
+
fallbackOrder?: ("anthropic" | "openai" | "ollama" | "mock")[] | undefined;
|
|
2267
|
+
openaiApiKey?: string | undefined;
|
|
2268
|
+
anthropicApiKey?: string | undefined;
|
|
2269
|
+
openaiBaseUrl?: string | undefined;
|
|
2270
|
+
anthropicBaseUrl?: string | undefined;
|
|
2271
|
+
ollamaBaseUrl?: string | undefined;
|
|
2272
|
+
}>>;
|
|
2273
|
+
mcpServers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2274
|
+
command: z.ZodString;
|
|
2275
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2276
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2277
|
+
}, "strip", z.ZodTypeAny, {
|
|
2278
|
+
args: string[];
|
|
2279
|
+
command: string;
|
|
2280
|
+
env?: Record<string, string> | undefined;
|
|
2281
|
+
}, {
|
|
2282
|
+
command: string;
|
|
2283
|
+
args?: string[] | undefined;
|
|
2284
|
+
env?: Record<string, string> | undefined;
|
|
2285
|
+
}>>>;
|
|
2286
|
+
strategy: z.ZodDefault<z.ZodObject<{
|
|
2287
|
+
activePath: z.ZodDefault<z.ZodString>;
|
|
2288
|
+
approvalCooldownDays: z.ZodDefault<z.ZodNumber>;
|
|
2289
|
+
approvalDailyLimit: z.ZodDefault<z.ZodNumber>;
|
|
2290
|
+
replayEpisodes: z.ZodDefault<z.ZodNumber>;
|
|
2291
|
+
shadowModeEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
2292
|
+
shadowRolloutMode: z.ZodDefault<z.ZodEnum<["shadow", "canary"]>>;
|
|
2293
|
+
shadowTrafficRatio: z.ZodDefault<z.ZodNumber>;
|
|
2294
|
+
shadowCandidatePaths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2295
|
+
autoPromoteEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
2296
|
+
autoPromoteMinTasks: z.ZodDefault<z.ZodNumber>;
|
|
2297
|
+
autoPromoteEvalInterval: z.ZodDefault<z.ZodNumber>;
|
|
2298
|
+
autoPromoteMinImprovement: z.ZodDefault<z.ZodNumber>;
|
|
2299
|
+
autoPromoteConfidence: z.ZodDefault<z.ZodNumber>;
|
|
2300
|
+
shadowWindowDays: z.ZodDefault<z.ZodNumber>;
|
|
2301
|
+
}, "strip", z.ZodTypeAny, {
|
|
2302
|
+
activePath: string;
|
|
2303
|
+
approvalCooldownDays: number;
|
|
2304
|
+
approvalDailyLimit: number;
|
|
2305
|
+
replayEpisodes: number;
|
|
2306
|
+
shadowModeEnabled: boolean;
|
|
2307
|
+
shadowRolloutMode: "shadow" | "canary";
|
|
2308
|
+
shadowTrafficRatio: number;
|
|
2309
|
+
shadowCandidatePaths: string[];
|
|
2310
|
+
autoPromoteEnabled: boolean;
|
|
2311
|
+
autoPromoteMinTasks: number;
|
|
2312
|
+
autoPromoteEvalInterval: number;
|
|
2313
|
+
autoPromoteMinImprovement: number;
|
|
2314
|
+
autoPromoteConfidence: number;
|
|
2315
|
+
shadowWindowDays: number;
|
|
2316
|
+
}, {
|
|
2317
|
+
activePath?: string | undefined;
|
|
2318
|
+
approvalCooldownDays?: number | undefined;
|
|
2319
|
+
approvalDailyLimit?: number | undefined;
|
|
2320
|
+
replayEpisodes?: number | undefined;
|
|
2321
|
+
shadowModeEnabled?: boolean | undefined;
|
|
2322
|
+
shadowRolloutMode?: "shadow" | "canary" | undefined;
|
|
2323
|
+
shadowTrafficRatio?: number | undefined;
|
|
2324
|
+
shadowCandidatePaths?: string[] | undefined;
|
|
2325
|
+
autoPromoteEnabled?: boolean | undefined;
|
|
2326
|
+
autoPromoteMinTasks?: number | undefined;
|
|
2327
|
+
autoPromoteEvalInterval?: number | undefined;
|
|
2328
|
+
autoPromoteMinImprovement?: number | undefined;
|
|
2329
|
+
autoPromoteConfidence?: number | undefined;
|
|
2330
|
+
shadowWindowDays?: number | undefined;
|
|
2331
|
+
}>>;
|
|
2332
|
+
safety: z.ZodDefault<z.ZodObject<{
|
|
2333
|
+
userDataDirs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2334
|
+
systemDirs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2335
|
+
allowPaths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2336
|
+
denyPaths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2337
|
+
rememberApprovals: z.ZodDefault<z.ZodBoolean>;
|
|
2338
|
+
}, "strip", z.ZodTypeAny, {
|
|
2339
|
+
userDataDirs: string[];
|
|
2340
|
+
systemDirs: string[];
|
|
2341
|
+
allowPaths: string[];
|
|
2342
|
+
denyPaths: string[];
|
|
2343
|
+
rememberApprovals: boolean;
|
|
2344
|
+
}, {
|
|
2345
|
+
userDataDirs?: string[] | undefined;
|
|
2346
|
+
systemDirs?: string[] | undefined;
|
|
2347
|
+
allowPaths?: string[] | undefined;
|
|
2348
|
+
denyPaths?: string[] | undefined;
|
|
2349
|
+
rememberApprovals?: boolean | undefined;
|
|
2350
|
+
}>>;
|
|
2351
|
+
agent: z.ZodDefault<z.ZodObject<{
|
|
2352
|
+
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
2353
|
+
intentAnalysis: z.ZodDefault<z.ZodBoolean>;
|
|
2354
|
+
failureReplan: z.ZodDefault<z.ZodBoolean>;
|
|
2355
|
+
maxRetries: z.ZodDefault<z.ZodNumber>;
|
|
2356
|
+
retryDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
2357
|
+
streaming: z.ZodDefault<z.ZodBoolean>;
|
|
2358
|
+
}, "strip", z.ZodTypeAny, {
|
|
2359
|
+
maxIterations: number;
|
|
2360
|
+
intentAnalysis: boolean;
|
|
2361
|
+
failureReplan: boolean;
|
|
2362
|
+
maxRetries: number;
|
|
2363
|
+
retryDelayMs: number;
|
|
2364
|
+
streaming: boolean;
|
|
2365
|
+
}, {
|
|
2366
|
+
maxIterations?: number | undefined;
|
|
2367
|
+
intentAnalysis?: boolean | undefined;
|
|
2368
|
+
failureReplan?: boolean | undefined;
|
|
2369
|
+
maxRetries?: number | undefined;
|
|
2370
|
+
retryDelayMs?: number | undefined;
|
|
2371
|
+
streaming?: boolean | undefined;
|
|
2372
|
+
}>>;
|
|
2373
|
+
server: z.ZodDefault<z.ZodObject<{
|
|
2374
|
+
apiToken: z.ZodDefault<z.ZodString>;
|
|
2375
|
+
sessionTtlHours: z.ZodDefault<z.ZodNumber>;
|
|
2376
|
+
}, "strip", z.ZodTypeAny, {
|
|
2377
|
+
apiToken: string;
|
|
2378
|
+
sessionTtlHours: number;
|
|
2379
|
+
}, {
|
|
2380
|
+
apiToken?: string | undefined;
|
|
2381
|
+
sessionTtlHours?: number | undefined;
|
|
2382
|
+
}>>;
|
|
2383
|
+
memory: z.ZodDefault<z.ZodObject<{
|
|
2384
|
+
checkpointTtlHours: z.ZodDefault<z.ZodNumber>;
|
|
2385
|
+
observationFrameTtlHours: z.ZodDefault<z.ZodNumber>;
|
|
2386
|
+
}, "strip", z.ZodTypeAny, {
|
|
2387
|
+
checkpointTtlHours: number;
|
|
2388
|
+
observationFrameTtlHours: number;
|
|
2389
|
+
}, {
|
|
2390
|
+
checkpointTtlHours?: number | undefined;
|
|
2391
|
+
observationFrameTtlHours?: number | undefined;
|
|
2392
|
+
}>>;
|
|
2393
|
+
skills: z.ZodDefault<z.ZodObject<{
|
|
2394
|
+
/** Maximum number of skills whose full content is injected into the prompt (default: 3) */
|
|
2395
|
+
matchTopK: z.ZodDefault<z.ZodNumber>;
|
|
2396
|
+
/** Enable file system watching for hot-reload of skills (default: true) */
|
|
2397
|
+
hotReload: z.ZodDefault<z.ZodBoolean>;
|
|
2398
|
+
/** Additional directories to scan for skills */
|
|
2399
|
+
extraDirs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2400
|
+
}, "strip", z.ZodTypeAny, {
|
|
2401
|
+
matchTopK: number;
|
|
2402
|
+
hotReload: boolean;
|
|
2403
|
+
extraDirs: string[];
|
|
2404
|
+
}, {
|
|
2405
|
+
matchTopK?: number | undefined;
|
|
2406
|
+
hotReload?: boolean | undefined;
|
|
2407
|
+
extraDirs?: string[] | undefined;
|
|
2408
|
+
}>>;
|
|
2409
|
+
}, "strip", z.ZodTypeAny, {
|
|
2410
|
+
llm: {
|
|
2411
|
+
provider: "anthropic" | "openai" | "ollama" | "mock" | "auto";
|
|
2412
|
+
defaultModel: string;
|
|
2413
|
+
fallbackOrder: ("anthropic" | "openai" | "ollama" | "mock")[];
|
|
2414
|
+
openaiApiKey: string;
|
|
2415
|
+
anthropicApiKey: string;
|
|
2416
|
+
openaiBaseUrl: string;
|
|
2417
|
+
anthropicBaseUrl: string;
|
|
2418
|
+
ollamaBaseUrl: string;
|
|
2419
|
+
};
|
|
2420
|
+
mcpServers: Record<string, {
|
|
2421
|
+
args: string[];
|
|
2422
|
+
command: string;
|
|
2423
|
+
env?: Record<string, string> | undefined;
|
|
2424
|
+
}>;
|
|
2425
|
+
strategy: {
|
|
2426
|
+
activePath: string;
|
|
2427
|
+
approvalCooldownDays: number;
|
|
2428
|
+
approvalDailyLimit: number;
|
|
2429
|
+
replayEpisodes: number;
|
|
2430
|
+
shadowModeEnabled: boolean;
|
|
2431
|
+
shadowRolloutMode: "shadow" | "canary";
|
|
2432
|
+
shadowTrafficRatio: number;
|
|
2433
|
+
shadowCandidatePaths: string[];
|
|
2434
|
+
autoPromoteEnabled: boolean;
|
|
2435
|
+
autoPromoteMinTasks: number;
|
|
2436
|
+
autoPromoteEvalInterval: number;
|
|
2437
|
+
autoPromoteMinImprovement: number;
|
|
2438
|
+
autoPromoteConfidence: number;
|
|
2439
|
+
shadowWindowDays: number;
|
|
2440
|
+
};
|
|
2441
|
+
safety: {
|
|
2442
|
+
userDataDirs: string[];
|
|
2443
|
+
systemDirs: string[];
|
|
2444
|
+
allowPaths: string[];
|
|
2445
|
+
denyPaths: string[];
|
|
2446
|
+
rememberApprovals: boolean;
|
|
2447
|
+
};
|
|
2448
|
+
agent: {
|
|
2449
|
+
maxIterations: number;
|
|
2450
|
+
intentAnalysis: boolean;
|
|
2451
|
+
failureReplan: boolean;
|
|
2452
|
+
maxRetries: number;
|
|
2453
|
+
retryDelayMs: number;
|
|
2454
|
+
streaming: boolean;
|
|
2455
|
+
};
|
|
2456
|
+
server: {
|
|
2457
|
+
apiToken: string;
|
|
2458
|
+
sessionTtlHours: number;
|
|
2459
|
+
};
|
|
2460
|
+
memory: {
|
|
2461
|
+
checkpointTtlHours: number;
|
|
2462
|
+
observationFrameTtlHours: number;
|
|
2463
|
+
};
|
|
2464
|
+
skills: {
|
|
2465
|
+
matchTopK: number;
|
|
2466
|
+
hotReload: boolean;
|
|
2467
|
+
extraDirs: string[];
|
|
2468
|
+
};
|
|
2469
|
+
}, {
|
|
2470
|
+
llm?: {
|
|
2471
|
+
provider?: "anthropic" | "openai" | "ollama" | "mock" | "auto" | undefined;
|
|
2472
|
+
defaultModel?: string | undefined;
|
|
2473
|
+
fallbackOrder?: ("anthropic" | "openai" | "ollama" | "mock")[] | undefined;
|
|
2474
|
+
openaiApiKey?: string | undefined;
|
|
2475
|
+
anthropicApiKey?: string | undefined;
|
|
2476
|
+
openaiBaseUrl?: string | undefined;
|
|
2477
|
+
anthropicBaseUrl?: string | undefined;
|
|
2478
|
+
ollamaBaseUrl?: string | undefined;
|
|
2479
|
+
} | undefined;
|
|
2480
|
+
mcpServers?: Record<string, {
|
|
2481
|
+
command: string;
|
|
2482
|
+
args?: string[] | undefined;
|
|
2483
|
+
env?: Record<string, string> | undefined;
|
|
2484
|
+
}> | undefined;
|
|
2485
|
+
strategy?: {
|
|
2486
|
+
activePath?: string | undefined;
|
|
2487
|
+
approvalCooldownDays?: number | undefined;
|
|
2488
|
+
approvalDailyLimit?: number | undefined;
|
|
2489
|
+
replayEpisodes?: number | undefined;
|
|
2490
|
+
shadowModeEnabled?: boolean | undefined;
|
|
2491
|
+
shadowRolloutMode?: "shadow" | "canary" | undefined;
|
|
2492
|
+
shadowTrafficRatio?: number | undefined;
|
|
2493
|
+
shadowCandidatePaths?: string[] | undefined;
|
|
2494
|
+
autoPromoteEnabled?: boolean | undefined;
|
|
2495
|
+
autoPromoteMinTasks?: number | undefined;
|
|
2496
|
+
autoPromoteEvalInterval?: number | undefined;
|
|
2497
|
+
autoPromoteMinImprovement?: number | undefined;
|
|
2498
|
+
autoPromoteConfidence?: number | undefined;
|
|
2499
|
+
shadowWindowDays?: number | undefined;
|
|
2500
|
+
} | undefined;
|
|
2501
|
+
safety?: {
|
|
2502
|
+
userDataDirs?: string[] | undefined;
|
|
2503
|
+
systemDirs?: string[] | undefined;
|
|
2504
|
+
allowPaths?: string[] | undefined;
|
|
2505
|
+
denyPaths?: string[] | undefined;
|
|
2506
|
+
rememberApprovals?: boolean | undefined;
|
|
2507
|
+
} | undefined;
|
|
2508
|
+
agent?: {
|
|
2509
|
+
maxIterations?: number | undefined;
|
|
2510
|
+
intentAnalysis?: boolean | undefined;
|
|
2511
|
+
failureReplan?: boolean | undefined;
|
|
2512
|
+
maxRetries?: number | undefined;
|
|
2513
|
+
retryDelayMs?: number | undefined;
|
|
2514
|
+
streaming?: boolean | undefined;
|
|
2515
|
+
} | undefined;
|
|
2516
|
+
server?: {
|
|
2517
|
+
apiToken?: string | undefined;
|
|
2518
|
+
sessionTtlHours?: number | undefined;
|
|
2519
|
+
} | undefined;
|
|
2520
|
+
memory?: {
|
|
2521
|
+
checkpointTtlHours?: number | undefined;
|
|
2522
|
+
observationFrameTtlHours?: number | undefined;
|
|
2523
|
+
} | undefined;
|
|
2524
|
+
skills?: {
|
|
2525
|
+
matchTopK?: number | undefined;
|
|
2526
|
+
hotReload?: boolean | undefined;
|
|
2527
|
+
extraDirs?: string[] | undefined;
|
|
2528
|
+
} | undefined;
|
|
2529
|
+
}>;
|
|
2530
|
+
type LydiaConfig = z.infer<typeof ConfigSchema>;
|
|
2531
|
+
|
|
2532
|
+
declare class ConfigLoader {
|
|
2533
|
+
private configPath;
|
|
2534
|
+
constructor();
|
|
2535
|
+
load(): Promise<LydiaConfig>;
|
|
2536
|
+
update(partial: Partial<LydiaConfig>): Promise<LydiaConfig>;
|
|
2537
|
+
private save;
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
declare class StrategyApprovalService {
|
|
2541
|
+
private memory;
|
|
2542
|
+
private configLoader;
|
|
2543
|
+
constructor(memoryManager?: MemoryManager, configLoader?: ConfigLoader);
|
|
2544
|
+
approveProposal(proposalId: number): Promise<{
|
|
2545
|
+
proposal: StrategyProposal;
|
|
2546
|
+
activePath: string;
|
|
2547
|
+
}>;
|
|
2548
|
+
rejectProposal(proposalId: number, reason?: string): Promise<{
|
|
2549
|
+
proposal: StrategyProposal;
|
|
2550
|
+
}>;
|
|
2551
|
+
private getPendingProposal;
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
interface RoutedStrategy {
|
|
2555
|
+
role: 'baseline' | 'candidate';
|
|
2556
|
+
path?: string;
|
|
2557
|
+
strategyId: string;
|
|
2558
|
+
strategyVersion: string;
|
|
2559
|
+
reason: string;
|
|
2560
|
+
}
|
|
2561
|
+
interface ShadowPromotionDecision {
|
|
2562
|
+
candidatePath: string;
|
|
2563
|
+
candidateId: string;
|
|
2564
|
+
candidateVersion: string;
|
|
2565
|
+
baselineId: string;
|
|
2566
|
+
baselineVersion: string;
|
|
2567
|
+
candidateSummary: StrategyEpisodeSummary;
|
|
2568
|
+
baselineSummary: StrategyEpisodeSummary;
|
|
2569
|
+
successImprovement: number;
|
|
2570
|
+
pValue: number;
|
|
2571
|
+
}
|
|
2572
|
+
declare class ShadowRouter {
|
|
2573
|
+
private memory;
|
|
2574
|
+
private registry;
|
|
2575
|
+
private random;
|
|
2576
|
+
constructor(memoryManager?: MemoryManager, strategyRegistry?: StrategyRegistry, random?: () => number);
|
|
2577
|
+
selectStrategy(config: LydiaConfig): Promise<RoutedStrategy>;
|
|
2578
|
+
evaluateAutoPromotion(config: LydiaConfig): Promise<ShadowPromotionDecision | null>;
|
|
2579
|
+
private loadBaseline;
|
|
2580
|
+
private loadCandidates;
|
|
2581
|
+
private computeUcbScore;
|
|
2582
|
+
private safeRate;
|
|
2583
|
+
private twoProportionPValue;
|
|
2584
|
+
private normalCdf;
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
interface GateResult {
|
|
2588
|
+
ok: boolean;
|
|
2589
|
+
reason?: string;
|
|
2590
|
+
}
|
|
2591
|
+
declare class BasicStrategyGate {
|
|
2592
|
+
/**
|
|
2593
|
+
* Minimal automatic validation rules for strategy proposals.
|
|
2594
|
+
* Rejects obvious unsafe or ambiguous configurations.
|
|
2595
|
+
*/
|
|
2596
|
+
static validate(strategy: Strategy): GateResult;
|
|
2597
|
+
}
|
|
2598
|
+
|
|
2599
|
+
interface ReviewFinding {
|
|
2600
|
+
tool: string;
|
|
2601
|
+
total: number;
|
|
2602
|
+
failed: number;
|
|
2603
|
+
failureRate: number;
|
|
2604
|
+
recommendation: string;
|
|
2605
|
+
}
|
|
2606
|
+
interface ReviewSummary {
|
|
2607
|
+
episodes: number;
|
|
2608
|
+
traces: number;
|
|
2609
|
+
findings: ReviewFinding[];
|
|
2610
|
+
suggestedConfirmations: string[];
|
|
2611
|
+
}
|
|
2612
|
+
interface ReviewOptions {
|
|
2613
|
+
episodeLimit?: number;
|
|
2614
|
+
minFailures?: number;
|
|
2615
|
+
minFailureRate?: number;
|
|
2616
|
+
}
|
|
2617
|
+
declare class StrategyReviewer {
|
|
2618
|
+
private memory;
|
|
2619
|
+
constructor(memory: MemoryManager);
|
|
2620
|
+
review(strategy: Strategy, options?: ReviewOptions): ReviewSummary;
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
interface StrategyBranch {
|
|
2624
|
+
name: string;
|
|
2625
|
+
version: string;
|
|
2626
|
+
path: string;
|
|
2627
|
+
parent?: string;
|
|
2628
|
+
createdAt: number;
|
|
2629
|
+
}
|
|
2630
|
+
declare class StrategyBranchManager {
|
|
2631
|
+
private baseDir;
|
|
2632
|
+
constructor(baseDir?: string);
|
|
2633
|
+
init(): Promise<void>;
|
|
2634
|
+
listBranches(): Promise<StrategyBranch[]>;
|
|
2635
|
+
createBranch(sourceStrategy: Strategy, newBranchName: string, modifications: Partial<Strategy>): Promise<Strategy>;
|
|
2636
|
+
getBranch(branchName: string): Promise<Strategy | null>;
|
|
2637
|
+
mergeBranch(branchName: string): Promise<void>;
|
|
2638
|
+
archiveBranch(branchName: string): Promise<void>;
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
interface AgentOptions {
|
|
2642
|
+
strategyPathOverride?: string;
|
|
2643
|
+
}
|
|
2644
|
+
declare class Agent extends EventEmitter {
|
|
2645
|
+
private llm;
|
|
2646
|
+
private intentAnalyzer;
|
|
2647
|
+
private mcpClientManager;
|
|
2648
|
+
private skillRegistry;
|
|
2649
|
+
private skillLoader;
|
|
2650
|
+
private strategyRegistry;
|
|
2651
|
+
private activeStrategy?;
|
|
2652
|
+
private configLoader;
|
|
2653
|
+
private memoryManager;
|
|
2654
|
+
private interactionServer?;
|
|
2655
|
+
private config?;
|
|
2656
|
+
private isInitialized;
|
|
2657
|
+
private traces;
|
|
2658
|
+
private stepResults;
|
|
2659
|
+
private taskApprovals;
|
|
2660
|
+
private planner?;
|
|
2661
|
+
private currentPlan;
|
|
2662
|
+
private executedPlanStepIds;
|
|
2663
|
+
private skippedPlanStepIds;
|
|
2664
|
+
private replannedFailures;
|
|
2665
|
+
private verificationFailureCount;
|
|
2666
|
+
private computerUseSessionId?;
|
|
2667
|
+
private computerUseCheckpoint?;
|
|
2668
|
+
private computerUseActionCounter;
|
|
2669
|
+
private branchManager;
|
|
2670
|
+
private reviewManager;
|
|
2671
|
+
private updateGate;
|
|
2672
|
+
private reporter;
|
|
2673
|
+
private feedbackCollector;
|
|
2674
|
+
private sessionMessages;
|
|
2675
|
+
private sessionSystemPrompt;
|
|
2676
|
+
private sessionTools;
|
|
2677
|
+
private sessionInitialized;
|
|
2678
|
+
private skillToolMap;
|
|
2679
|
+
private skillWatcher?;
|
|
2680
|
+
private currentTaskId?;
|
|
2681
|
+
private currentRunId?;
|
|
2682
|
+
private currentInput?;
|
|
2683
|
+
private currentTaskCreatedAt?;
|
|
2684
|
+
private builtinServerSpecs;
|
|
2685
|
+
private options;
|
|
2686
|
+
private computerUseAdapter;
|
|
2687
|
+
private computerUseOrchestrator;
|
|
2688
|
+
constructor(llm: ILLMProvider, options?: AgentOptions);
|
|
2689
|
+
private bindComputerUseEvents;
|
|
2690
|
+
init(): Promise<void>;
|
|
2691
|
+
private registerSkillTools;
|
|
2692
|
+
private isDynamicSkillCheck;
|
|
2693
|
+
private connectInMemoryServer;
|
|
2694
|
+
private connectBuiltinServers;
|
|
2695
|
+
private connectExternalMcpServers;
|
|
2696
|
+
private getAllToolDefinitions;
|
|
2697
|
+
/**
|
|
2698
|
+
* Collect allowedTools from matched skills and return a Set for filtering.
|
|
2699
|
+
* Returns null if no skill restricts tools (all tools are allowed).
|
|
2700
|
+
*/
|
|
2701
|
+
private getActiveAllowedTools;
|
|
2702
|
+
chat(userMessage: string): Promise<string>;
|
|
2703
|
+
resetSession(): void;
|
|
2704
|
+
run(userInput: string, runId?: string): Promise<Task>;
|
|
2705
|
+
/**
|
|
2706
|
+
* Resume an interrupted task from a persisted checkpoint.
|
|
2707
|
+
* Restores the conversation history, traces, and iteration counter,
|
|
2708
|
+
* then continues the agentic loop from where it left off.
|
|
2709
|
+
*/
|
|
2710
|
+
resume(taskId: string): Promise<Task>;
|
|
2711
|
+
private agenticLoop;
|
|
2712
|
+
private buildFallbackIntentProfile;
|
|
2713
|
+
private buildTaskContext;
|
|
2714
|
+
private createExecutionPlan;
|
|
2715
|
+
private buildPlanGuidance;
|
|
2716
|
+
private selectPlannedStepForTool;
|
|
2717
|
+
private markPlanStepExecuted;
|
|
2718
|
+
private recordStepResult;
|
|
2719
|
+
private markDownstreamStepsSkipped;
|
|
2720
|
+
private enqueueFailureReplan;
|
|
2721
|
+
private recordFailedStep;
|
|
2722
|
+
private evaluateStepVerification;
|
|
2723
|
+
private evaluateVerificationCriterion;
|
|
2724
|
+
private extractQuotedFragments;
|
|
2725
|
+
private containsPathLikeText;
|
|
2726
|
+
private looksLikeJson;
|
|
2727
|
+
private containsFailureSignals;
|
|
2728
|
+
private containsMissingSignals;
|
|
2729
|
+
private isLikelySuccessfulOutput;
|
|
2730
|
+
private buildVerificationFailureMessage;
|
|
2731
|
+
private truncateText;
|
|
2732
|
+
private parseCheckpointFrameIds;
|
|
2733
|
+
private executeToolWithComputerUseOrchestration;
|
|
2734
|
+
private resolveCanonicalComputerUseAction;
|
|
2735
|
+
private inferComputerUseDomain;
|
|
2736
|
+
private formatComputerUseFailure;
|
|
2737
|
+
private toDisplayText;
|
|
2738
|
+
private normalizeMcpResultForLoop;
|
|
2739
|
+
private extractMcpRichBlocks;
|
|
2740
|
+
private escalateRiskByVerificationState;
|
|
2741
|
+
private rehydrateStepResultsFromTraces;
|
|
2742
|
+
private persistReportAndFeedback;
|
|
2743
|
+
private callLLMWithRetry;
|
|
2744
|
+
private callLLM;
|
|
2745
|
+
private isRetryableError;
|
|
2746
|
+
private sleep;
|
|
2747
|
+
resolveInteraction(id: string, response: string): boolean;
|
|
2748
|
+
/**
|
|
2749
|
+
* Build the system prompt with progressive skill disclosure:
|
|
2750
|
+
* - Layer 1: Lightweight catalog of ALL registered skills (name + description)
|
|
2751
|
+
* - Layer 2: Full content of only the top-K matched skills
|
|
2752
|
+
*/
|
|
2753
|
+
private buildSystemPrompt;
|
|
2754
|
+
/**
|
|
2755
|
+
* Lazy-load content for matched skills that don't have content in memory yet.
|
|
2756
|
+
*/
|
|
2757
|
+
private ensureSkillContent;
|
|
2758
|
+
private buildApprovalKey;
|
|
2759
|
+
private getApprovalRecord;
|
|
2760
|
+
private recordApprovalPersistent;
|
|
2761
|
+
private recordApprovalHistory;
|
|
2762
|
+
private confirmRisk;
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
declare class ShellServer {
|
|
2766
|
+
server: Server;
|
|
2767
|
+
constructor();
|
|
2768
|
+
private setupHandlers;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
declare class FileSystemServer {
|
|
2772
|
+
server: Server;
|
|
2773
|
+
private allowedRootDir;
|
|
2774
|
+
constructor(allowedRootDir?: string);
|
|
2775
|
+
private validatePath;
|
|
2776
|
+
private setupHandlers;
|
|
2777
|
+
private ensureDestWritable;
|
|
2778
|
+
private moveFile;
|
|
2779
|
+
private searchByName;
|
|
2780
|
+
private buildMatcher;
|
|
2781
|
+
private createArchiveBundle;
|
|
2782
|
+
private parseArchiveBundle;
|
|
2783
|
+
private extractArchiveBundle;
|
|
2784
|
+
private decodeArchiveEntry;
|
|
2785
|
+
private prepareOutputDirectory;
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
declare class GitServer {
|
|
2789
|
+
server: Server;
|
|
2790
|
+
private git;
|
|
2791
|
+
constructor(baseDir?: string);
|
|
2792
|
+
private setupHandlers;
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2795
|
+
declare class MemoryServer {
|
|
2796
|
+
server: Server;
|
|
2797
|
+
private memoryManager;
|
|
2798
|
+
constructor(memoryManager: MemoryManager);
|
|
2799
|
+
private setupHandlers;
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
interface InteractionRequest {
|
|
2803
|
+
id: string;
|
|
2804
|
+
type: 'text' | 'confirm';
|
|
2805
|
+
prompt: string;
|
|
2806
|
+
}
|
|
2807
|
+
declare class InteractionServer extends EventEmitter {
|
|
2808
|
+
server: Server;
|
|
2809
|
+
private pendingInteractions;
|
|
2810
|
+
constructor();
|
|
2811
|
+
private setupHandlers;
|
|
2812
|
+
resolve(id: string, response: string): boolean;
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
interface McpServerConfig {
|
|
2816
|
+
id: string;
|
|
2817
|
+
type: 'stdio' | 'in-memory';
|
|
2818
|
+
command?: string;
|
|
2819
|
+
args?: string[];
|
|
2820
|
+
env?: Record<string, string>;
|
|
2821
|
+
transport?: InMemoryTransport;
|
|
2822
|
+
}
|
|
2823
|
+
declare class McpClientManager {
|
|
2824
|
+
private clients;
|
|
2825
|
+
private tools;
|
|
2826
|
+
private nameMap;
|
|
2827
|
+
connect(config: McpServerConfig): Promise<Client<{
|
|
2828
|
+
method: string;
|
|
2829
|
+
params?: zod.objectOutputType<{
|
|
2830
|
+
_meta: zod.ZodOptional<zod.ZodObject<{
|
|
2831
|
+
progressToken: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>>;
|
|
2832
|
+
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
2833
|
+
progressToken: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>>;
|
|
2834
|
+
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
2835
|
+
progressToken: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>>;
|
|
2836
|
+
}, zod.ZodTypeAny, "passthrough">>>;
|
|
2837
|
+
}, zod.ZodTypeAny, "passthrough"> | undefined;
|
|
2838
|
+
}, {
|
|
2839
|
+
method: string;
|
|
2840
|
+
params?: zod.objectOutputType<{
|
|
2841
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
2842
|
+
}, zod.ZodTypeAny, "passthrough"> | undefined;
|
|
2843
|
+
}, zod.objectOutputType<{
|
|
2844
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
2845
|
+
}, zod.ZodTypeAny, "passthrough">>>;
|
|
2846
|
+
refreshTools(serverId: string): Promise<void>;
|
|
2847
|
+
getTools(): Tool[];
|
|
2848
|
+
/**
|
|
2849
|
+
* Get tool definitions in LLM-provider-agnostic format.
|
|
2850
|
+
* Converts MCP Tool schemas to ToolDefinition for use with LLM function calling.
|
|
2851
|
+
* Returns de-conflicted names (prefixed where necessary).
|
|
2852
|
+
*/
|
|
2853
|
+
getToolDefinitions(): ToolDefinition[];
|
|
2854
|
+
getToolInfo(name: string): {
|
|
2855
|
+
serverId: string;
|
|
2856
|
+
tool: Tool;
|
|
2857
|
+
} | undefined;
|
|
2858
|
+
isToolExternal(name: string): boolean;
|
|
2859
|
+
callTool(name: string, args: any): Promise<zod.objectOutputType<{
|
|
2860
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
2861
|
+
} & {
|
|
2862
|
+
content: zod.ZodArray<zod.ZodUnion<[zod.ZodObject<{
|
|
2863
|
+
type: zod.ZodLiteral<"text">;
|
|
2864
|
+
text: zod.ZodString;
|
|
2865
|
+
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
2866
|
+
type: zod.ZodLiteral<"text">;
|
|
2867
|
+
text: zod.ZodString;
|
|
2868
|
+
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
2869
|
+
type: zod.ZodLiteral<"text">;
|
|
2870
|
+
text: zod.ZodString;
|
|
2871
|
+
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
2872
|
+
type: zod.ZodLiteral<"image">;
|
|
2873
|
+
data: zod.ZodString;
|
|
2874
|
+
mimeType: zod.ZodString;
|
|
2875
|
+
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
2876
|
+
type: zod.ZodLiteral<"image">;
|
|
2877
|
+
data: zod.ZodString;
|
|
2878
|
+
mimeType: zod.ZodString;
|
|
2879
|
+
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
2880
|
+
type: zod.ZodLiteral<"image">;
|
|
2881
|
+
data: zod.ZodString;
|
|
2882
|
+
mimeType: zod.ZodString;
|
|
2883
|
+
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
2884
|
+
type: zod.ZodLiteral<"resource">;
|
|
2885
|
+
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
2886
|
+
uri: zod.ZodString;
|
|
2887
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2888
|
+
}, {
|
|
2889
|
+
text: zod.ZodString;
|
|
2890
|
+
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
2891
|
+
uri: zod.ZodString;
|
|
2892
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2893
|
+
}, {
|
|
2894
|
+
text: zod.ZodString;
|
|
2895
|
+
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
2896
|
+
uri: zod.ZodString;
|
|
2897
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2898
|
+
}, {
|
|
2899
|
+
text: zod.ZodString;
|
|
2900
|
+
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
2901
|
+
uri: zod.ZodString;
|
|
2902
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2903
|
+
}, {
|
|
2904
|
+
blob: zod.ZodString;
|
|
2905
|
+
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
2906
|
+
uri: zod.ZodString;
|
|
2907
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2908
|
+
}, {
|
|
2909
|
+
blob: zod.ZodString;
|
|
2910
|
+
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
2911
|
+
uri: zod.ZodString;
|
|
2912
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2913
|
+
}, {
|
|
2914
|
+
blob: zod.ZodString;
|
|
2915
|
+
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
2916
|
+
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
2917
|
+
type: zod.ZodLiteral<"resource">;
|
|
2918
|
+
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
2919
|
+
uri: zod.ZodString;
|
|
2920
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2921
|
+
}, {
|
|
2922
|
+
text: zod.ZodString;
|
|
2923
|
+
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
2924
|
+
uri: zod.ZodString;
|
|
2925
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2926
|
+
}, {
|
|
2927
|
+
text: zod.ZodString;
|
|
2928
|
+
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
2929
|
+
uri: zod.ZodString;
|
|
2930
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2931
|
+
}, {
|
|
2932
|
+
text: zod.ZodString;
|
|
2933
|
+
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
2934
|
+
uri: zod.ZodString;
|
|
2935
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2936
|
+
}, {
|
|
2937
|
+
blob: zod.ZodString;
|
|
2938
|
+
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
2939
|
+
uri: zod.ZodString;
|
|
2940
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2941
|
+
}, {
|
|
2942
|
+
blob: zod.ZodString;
|
|
2943
|
+
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
2944
|
+
uri: zod.ZodString;
|
|
2945
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2946
|
+
}, {
|
|
2947
|
+
blob: zod.ZodString;
|
|
2948
|
+
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
2949
|
+
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
2950
|
+
type: zod.ZodLiteral<"resource">;
|
|
2951
|
+
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
2952
|
+
uri: zod.ZodString;
|
|
2953
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2954
|
+
}, {
|
|
2955
|
+
text: zod.ZodString;
|
|
2956
|
+
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
2957
|
+
uri: zod.ZodString;
|
|
2958
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2959
|
+
}, {
|
|
2960
|
+
text: zod.ZodString;
|
|
2961
|
+
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
2962
|
+
uri: zod.ZodString;
|
|
2963
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2964
|
+
}, {
|
|
2965
|
+
text: zod.ZodString;
|
|
2966
|
+
}>, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
2967
|
+
uri: zod.ZodString;
|
|
2968
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2969
|
+
}, {
|
|
2970
|
+
blob: zod.ZodString;
|
|
2971
|
+
}>, "passthrough", zod.ZodTypeAny, zod.objectOutputType<zod.objectUtil.extendShape<{
|
|
2972
|
+
uri: zod.ZodString;
|
|
2973
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2974
|
+
}, {
|
|
2975
|
+
blob: zod.ZodString;
|
|
2976
|
+
}>, zod.ZodTypeAny, "passthrough">, zod.objectInputType<zod.objectUtil.extendShape<{
|
|
2977
|
+
uri: zod.ZodString;
|
|
2978
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
2979
|
+
}, {
|
|
2980
|
+
blob: zod.ZodString;
|
|
2981
|
+
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
2982
|
+
}, zod.ZodTypeAny, "passthrough">>]>, "many">;
|
|
2983
|
+
isError: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
2984
|
+
}, zod.ZodTypeAny, "passthrough"> | zod.objectOutputType<{
|
|
2985
|
+
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
2986
|
+
} & {
|
|
2987
|
+
toolResult: zod.ZodUnknown;
|
|
2988
|
+
}, zod.ZodTypeAny, "passthrough">>;
|
|
2989
|
+
closeAll(): Promise<void>;
|
|
2990
|
+
private registerToolName;
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
type RiskLevel = 'low' | 'high';
|
|
2994
|
+
interface RiskAssessment {
|
|
2995
|
+
level: RiskLevel;
|
|
2996
|
+
reason?: string;
|
|
2997
|
+
signature?: string;
|
|
2998
|
+
details?: string;
|
|
2999
|
+
}
|
|
3000
|
+
declare function assessRisk(toolName: string, args: Record<string, unknown> | undefined, mcp: McpClientManager, config?: LydiaConfig): RiskAssessment;
|
|
3001
|
+
|
|
3002
|
+
interface EvaluationMetrics {
|
|
3003
|
+
duration: number;
|
|
3004
|
+
steps: number;
|
|
3005
|
+
cost?: number;
|
|
3006
|
+
driftDetected: boolean;
|
|
3007
|
+
riskEvents: number;
|
|
3008
|
+
humanInterrupts: number;
|
|
3009
|
+
observationFrames: number;
|
|
3010
|
+
multimodalFrames: number;
|
|
3011
|
+
}
|
|
3012
|
+
interface EvaluationResult {
|
|
3013
|
+
taskId: string;
|
|
3014
|
+
success: boolean;
|
|
3015
|
+
score: number;
|
|
3016
|
+
metrics: EvaluationMetrics;
|
|
3017
|
+
details?: string;
|
|
3018
|
+
}
|
|
3019
|
+
interface EvaluationSummary {
|
|
3020
|
+
tasks: number;
|
|
3021
|
+
successRate: number;
|
|
3022
|
+
averageScore: number;
|
|
3023
|
+
averageDuration: number;
|
|
3024
|
+
averageCost: number;
|
|
3025
|
+
driftRate: number;
|
|
3026
|
+
averageRiskEvents: number;
|
|
3027
|
+
averageHumanInterrupts: number;
|
|
3028
|
+
averageObservationFrames: number;
|
|
3029
|
+
averageMultimodalFrames: number;
|
|
3030
|
+
}
|
|
3031
|
+
interface StrategyComparison {
|
|
3032
|
+
baselineId: string;
|
|
3033
|
+
candidateId: string;
|
|
3034
|
+
tasksEvaluated: number;
|
|
3035
|
+
baselineScore: number;
|
|
3036
|
+
candidateScore: number;
|
|
3037
|
+
improvement: number;
|
|
3038
|
+
details: EvaluationResult[];
|
|
3039
|
+
baselineSummary: EvaluationSummary;
|
|
3040
|
+
candidateSummary: EvaluationSummary;
|
|
3041
|
+
delta: {
|
|
3042
|
+
successRate: number;
|
|
3043
|
+
averageScore: number;
|
|
3044
|
+
averageDuration: number;
|
|
3045
|
+
averageCost: number;
|
|
3046
|
+
driftRate: number;
|
|
3047
|
+
averageRiskEvents: number;
|
|
3048
|
+
averageHumanInterrupts: number;
|
|
3049
|
+
averageObservationFrames: number;
|
|
3050
|
+
averageMultimodalFrames: number;
|
|
3051
|
+
};
|
|
3052
|
+
}
|
|
3053
|
+
declare class StrategyEvaluator {
|
|
3054
|
+
evaluateTask(task: Task, originalResult: string | undefined, runtimeMetrics?: Partial<EvaluationMetrics>): EvaluationResult;
|
|
3055
|
+
compareResults(baseline: EvaluationResult[], candidate: EvaluationResult[]): StrategyComparison;
|
|
3056
|
+
private calculateAverageScore;
|
|
3057
|
+
summarize(results: EvaluationResult[]): EvaluationSummary;
|
|
3058
|
+
private computeScore;
|
|
3059
|
+
private computeTextSimilarity;
|
|
3060
|
+
private tokenize;
|
|
3061
|
+
private lowerIsBetter;
|
|
3062
|
+
private clamp01;
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
interface ValidationResult {
|
|
3066
|
+
status: 'PASS' | 'REJECT' | 'NEEDS_HUMAN';
|
|
3067
|
+
reason?: string;
|
|
3068
|
+
details?: any;
|
|
3069
|
+
}
|
|
3070
|
+
interface GateValidator {
|
|
3071
|
+
name: string;
|
|
3072
|
+
validate(candidate: Strategy, branch: StrategyBranch, evaluations?: EvaluationResult[], baseline?: Strategy): Promise<ValidationResult>;
|
|
3073
|
+
}
|
|
3074
|
+
declare class SyntaxValidator implements GateValidator {
|
|
3075
|
+
name: string;
|
|
3076
|
+
validate(candidate: Strategy): Promise<ValidationResult>;
|
|
3077
|
+
}
|
|
3078
|
+
declare class EvolutionLimitValidator implements GateValidator {
|
|
3079
|
+
name: string;
|
|
3080
|
+
validate(candidate: Strategy, _branch: StrategyBranch, _evaluations?: EvaluationResult[], baseline?: Strategy): Promise<ValidationResult>;
|
|
3081
|
+
}
|
|
3082
|
+
declare class ReplayPerformanceValidator implements GateValidator {
|
|
3083
|
+
name: string;
|
|
3084
|
+
validate(_candidate: Strategy, _branch: StrategyBranch, evaluations?: EvaluationResult[]): Promise<ValidationResult>;
|
|
3085
|
+
}
|
|
3086
|
+
declare class RiskSafetyValidator implements GateValidator {
|
|
3087
|
+
name: string;
|
|
3088
|
+
validate(candidate: Strategy, _branch: StrategyBranch, _evaluations?: EvaluationResult[], baseline?: Strategy): Promise<ValidationResult>;
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
declare class StrategyUpdateGate {
|
|
3092
|
+
private validators;
|
|
3093
|
+
private readonly enableLogs;
|
|
3094
|
+
constructor();
|
|
3095
|
+
process(candidate: Strategy, branch: StrategyBranch, evaluations?: EvaluationResult[], baseline?: Strategy): Promise<ValidationResult>;
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
interface ReviewRequest {
|
|
3099
|
+
id: number;
|
|
3100
|
+
source: string;
|
|
3101
|
+
timestamp: number;
|
|
3102
|
+
branchName: string;
|
|
3103
|
+
strategyId: string;
|
|
3104
|
+
strategyPath: string;
|
|
3105
|
+
diffSummary: string;
|
|
3106
|
+
validationResult: ValidationResult;
|
|
3107
|
+
analysis?: string;
|
|
3108
|
+
description?: string;
|
|
3109
|
+
status: 'pending' | 'approved' | 'rejected';
|
|
3110
|
+
}
|
|
3111
|
+
declare class ReviewManager {
|
|
3112
|
+
private memory;
|
|
3113
|
+
constructor(memoryManager?: MemoryManager);
|
|
3114
|
+
init(): Promise<void>;
|
|
3115
|
+
addRequest(request: Omit<ReviewRequest, 'id' | 'timestamp' | 'status'>): Promise<number>;
|
|
3116
|
+
listPending(): Promise<ReviewRequest[]>;
|
|
3117
|
+
getRequest(id: number): Promise<ReviewRequest | undefined>;
|
|
3118
|
+
updateStatus(id: number, status: 'approved' | 'rejected'): Promise<void>;
|
|
3119
|
+
private parseEvaluation;
|
|
3120
|
+
private mapStatus;
|
|
3121
|
+
private toReviewRequest;
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
interface ReplayDeterminismMismatch {
|
|
3125
|
+
run: number;
|
|
3126
|
+
signature: string;
|
|
3127
|
+
}
|
|
3128
|
+
interface ReplayDeterminismResult {
|
|
3129
|
+
episodeId: number;
|
|
3130
|
+
runs: number;
|
|
3131
|
+
consistentRuns: number;
|
|
3132
|
+
consistencyRate: number;
|
|
3133
|
+
ok: boolean;
|
|
3134
|
+
baselineSignature: string;
|
|
3135
|
+
mismatches: ReplayDeterminismMismatch[];
|
|
3136
|
+
}
|
|
3137
|
+
declare class ReplayManager {
|
|
3138
|
+
private memoryManager;
|
|
3139
|
+
private evaluator;
|
|
3140
|
+
constructor(memoryManager?: MemoryManager);
|
|
3141
|
+
replay(episodeId: number, customStrategy?: Strategy): Promise<EvaluationResult>;
|
|
3142
|
+
replayDeterminism(episodeId: number, options?: {
|
|
3143
|
+
runs?: number;
|
|
3144
|
+
minConsistencyRate?: number;
|
|
3145
|
+
strategy?: Strategy;
|
|
3146
|
+
}): Promise<ReplayDeterminismResult>;
|
|
3147
|
+
replayBatch(episodeIds: number[], strategy?: Strategy): Promise<EvaluationResult[]>;
|
|
3148
|
+
replayCompare(episodeIds: number[], baseline: Strategy, candidate: Strategy): Promise<StrategyComparison>;
|
|
3149
|
+
private buildDeterminismSignature;
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
declare class ReplayLLMProvider implements ILLMProvider {
|
|
3153
|
+
readonly id = "replay";
|
|
3154
|
+
private originalPlan;
|
|
3155
|
+
private callCount;
|
|
3156
|
+
constructor(originalPlan: string);
|
|
3157
|
+
generate(request: LLMRequest): Promise<LLMResponse>;
|
|
3158
|
+
generateStream(request: LLMRequest): AsyncGenerator<StreamChunk, void, unknown>;
|
|
3159
|
+
private normalizePlan;
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
type ReplayToolResult = {
|
|
3163
|
+
content: Array<{
|
|
3164
|
+
type: 'text';
|
|
3165
|
+
text: string;
|
|
3166
|
+
}>;
|
|
3167
|
+
isError?: boolean;
|
|
3168
|
+
};
|
|
3169
|
+
declare class ReplayMcpClientManager extends McpClientManager {
|
|
3170
|
+
private traces;
|
|
3171
|
+
private callIndex;
|
|
3172
|
+
drifts: Array<{
|
|
3173
|
+
index: number;
|
|
3174
|
+
expected: string;
|
|
3175
|
+
actual: string;
|
|
3176
|
+
type: 'tool' | 'args';
|
|
3177
|
+
}>;
|
|
3178
|
+
private readonly virtualRoot;
|
|
3179
|
+
private virtualFiles;
|
|
3180
|
+
private gitHeadFiles;
|
|
3181
|
+
private gitStagedFiles;
|
|
3182
|
+
private gitCommits;
|
|
3183
|
+
private invocationCount;
|
|
3184
|
+
private riskEventCount;
|
|
3185
|
+
private humanInterruptCount;
|
|
3186
|
+
private readonly highRiskTools;
|
|
3187
|
+
constructor(traces: Trace[]);
|
|
3188
|
+
connect(config: any): Promise<any>;
|
|
3189
|
+
callTool(name: string, args: any): Promise<ReplayToolResult>;
|
|
3190
|
+
getInvocationCount(): number;
|
|
3191
|
+
getRiskEventCount(): number;
|
|
3192
|
+
getHumanInterruptCount(): number;
|
|
3193
|
+
private isFsTool;
|
|
3194
|
+
private isGitTool;
|
|
3195
|
+
private recordInvocation;
|
|
3196
|
+
private executeFsTool;
|
|
3197
|
+
private executeShellTool;
|
|
3198
|
+
private mapShellGitCommand;
|
|
3199
|
+
private executeGitTool;
|
|
3200
|
+
private consumeTrace;
|
|
3201
|
+
private consumeTraceAt;
|
|
3202
|
+
private findTraceIndex;
|
|
3203
|
+
private recordToolDrift;
|
|
3204
|
+
private recordArgsDrift;
|
|
3205
|
+
private seedVirtualFileState;
|
|
3206
|
+
private initializeGitState;
|
|
3207
|
+
private computeGitChanges;
|
|
3208
|
+
private sortedArray;
|
|
3209
|
+
private normalizeFsPath;
|
|
3210
|
+
private listDirectoryEntries;
|
|
3211
|
+
private stableStringify;
|
|
3212
|
+
private safeParseJson;
|
|
3213
|
+
private normalizeToolOutput;
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
declare class SkillParser {
|
|
3217
|
+
/**
|
|
3218
|
+
* Parse a SKILL.md file content into a full StaticSkill object (metadata + content).
|
|
3219
|
+
*/
|
|
3220
|
+
static parse(fileContent: string, filePath?: string): StaticSkill;
|
|
3221
|
+
/**
|
|
3222
|
+
* Parse only the YAML frontmatter of a SKILL.md file into lightweight SkillMeta.
|
|
3223
|
+
* This avoids loading the full content body, saving memory for large skill sets.
|
|
3224
|
+
*/
|
|
3225
|
+
static parseMeta(fileContent: string, filePath?: string): SkillMeta;
|
|
3226
|
+
/**
|
|
3227
|
+
* Extract YAML frontmatter from markdown content
|
|
3228
|
+
*/
|
|
3229
|
+
static extractFrontmatter(content: string): {
|
|
3230
|
+
frontmatter: string | null;
|
|
3231
|
+
body: string;
|
|
3232
|
+
};
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
declare class SkillRegistry {
|
|
3236
|
+
private skills;
|
|
3237
|
+
private relevanceThreshold;
|
|
3238
|
+
register(skill: Skill | SkillMeta): void;
|
|
3239
|
+
unregister(name: string): boolean;
|
|
3240
|
+
get(name: string): Skill | SkillMeta | undefined;
|
|
3241
|
+
list(): (Skill | SkillMeta)[];
|
|
3242
|
+
/**
|
|
3243
|
+
* Find relevant skills using TF-IDF weighted scoring.
|
|
3244
|
+
* - name match: weight 3.0
|
|
3245
|
+
* - tags match: weight 2.5
|
|
3246
|
+
* - description match: weight 2.0
|
|
3247
|
+
* - content match: weight 1.0 (only if content is in memory)
|
|
3248
|
+
*
|
|
3249
|
+
* @param intent - The user's intent/query to match against
|
|
3250
|
+
* @param topK - Maximum number of results to return (default: 3)
|
|
3251
|
+
* @returns Sorted array of matched skills, limited to topK
|
|
3252
|
+
*/
|
|
3253
|
+
match(intent: string, topK?: number): (Skill | SkillMeta)[];
|
|
3254
|
+
private tokenize;
|
|
3255
|
+
private getSkillTokens;
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
declare class SkillLoader {
|
|
3259
|
+
private registry;
|
|
3260
|
+
/** Ordered list of directories to scan for skills */
|
|
3261
|
+
private directories;
|
|
3262
|
+
constructor(registry: SkillRegistry);
|
|
3263
|
+
/**
|
|
3264
|
+
* Get the list of skill directories in priority order.
|
|
3265
|
+
* Later directories override earlier ones (Project > User > Built-in).
|
|
3266
|
+
*/
|
|
3267
|
+
getDirectories(extraDirs?: string[]): string[];
|
|
3268
|
+
/**
|
|
3269
|
+
* Phase 1: Scan all skill directories and load ONLY frontmatter metadata.
|
|
3270
|
+
* Skill content bodies are NOT loaded into memory — they will be
|
|
3271
|
+
* lazy-loaded on demand when matched.
|
|
3272
|
+
*/
|
|
3273
|
+
loadAll(extraDirs?: string[]): Promise<void>;
|
|
3274
|
+
/**
|
|
3275
|
+
* Recursively scan a directory and register skill metadata (frontmatter only).
|
|
3276
|
+
*/
|
|
3277
|
+
loadMetadataFromDirectory(dirPath: string): Promise<void>;
|
|
3278
|
+
/**
|
|
3279
|
+
* Load only the frontmatter metadata from a skill file.
|
|
3280
|
+
* The markdown body content is NOT read into memory.
|
|
3281
|
+
*/
|
|
3282
|
+
private loadSkillMeta;
|
|
3283
|
+
/**
|
|
3284
|
+
* Phase 2: On-demand content loading.
|
|
3285
|
+
* Reads the full file content for a registered skill and returns
|
|
3286
|
+
* the parsed StaticSkill with the markdown body.
|
|
3287
|
+
*
|
|
3288
|
+
* @param name - The skill name to load content for
|
|
3289
|
+
* @returns The full skill content string, or null if not found
|
|
3290
|
+
*/
|
|
3291
|
+
loadContent(name: string): Promise<string | null>;
|
|
3292
|
+
/**
|
|
3293
|
+
* Load and return the full StaticSkill object for a given skill name.
|
|
3294
|
+
* This reads the file and parses both metadata and content.
|
|
3295
|
+
*/
|
|
3296
|
+
loadFull(name: string): Promise<StaticSkill | null>;
|
|
3297
|
+
/**
|
|
3298
|
+
* Reload a single skill file's metadata into the registry.
|
|
3299
|
+
* Used by the hot-reload watcher on file change.
|
|
3300
|
+
*/
|
|
3301
|
+
reloadSkillMeta(filePath: string): Promise<SkillMeta | null>;
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3304
|
+
declare class SkillWatcher extends EventEmitter {
|
|
3305
|
+
private directories;
|
|
3306
|
+
private registry;
|
|
3307
|
+
private loader;
|
|
3308
|
+
private watchers;
|
|
3309
|
+
private debounceTimers;
|
|
3310
|
+
private debounceMs;
|
|
3311
|
+
/** Map of file path -> skill name for tracking deletions */
|
|
3312
|
+
private pathToName;
|
|
3313
|
+
private running;
|
|
3314
|
+
constructor(directories: string[], registry: SkillRegistry, loader: SkillLoader, options?: {
|
|
3315
|
+
debounceMs?: number;
|
|
3316
|
+
});
|
|
3317
|
+
/**
|
|
3318
|
+
* Start watching all skill directories for changes.
|
|
3319
|
+
*/
|
|
3320
|
+
start(): void;
|
|
3321
|
+
/**
|
|
3322
|
+
* Stop all file watchers and clean up timers.
|
|
3323
|
+
*/
|
|
3324
|
+
stop(): void;
|
|
3325
|
+
private watchDirectory;
|
|
3326
|
+
private handleFileChange;
|
|
3327
|
+
private processFileChange;
|
|
3328
|
+
}
|
|
3329
|
+
|
|
3330
|
+
interface StepResult {
|
|
3331
|
+
stepId: string;
|
|
3332
|
+
status: 'completed' | 'failed' | 'skipped';
|
|
3333
|
+
output?: string;
|
|
3334
|
+
error?: string;
|
|
3335
|
+
durationMs?: number;
|
|
3336
|
+
verificationStatus?: 'pending' | 'passed' | 'failed';
|
|
3337
|
+
}
|
|
3338
|
+
interface ExecutionSummary {
|
|
3339
|
+
taskId: string;
|
|
3340
|
+
stepsTotal: number;
|
|
3341
|
+
stepsCompleted: number;
|
|
3342
|
+
stepsFailed: number;
|
|
3343
|
+
outputs: string[];
|
|
3344
|
+
failures: Array<{
|
|
3345
|
+
stepId: string;
|
|
3346
|
+
reason: string;
|
|
3347
|
+
}>;
|
|
3348
|
+
artifacts: Array<{
|
|
3349
|
+
path: string;
|
|
3350
|
+
description?: string;
|
|
3351
|
+
}>;
|
|
3352
|
+
}
|
|
3353
|
+
interface TaskReport {
|
|
3354
|
+
taskId: string;
|
|
3355
|
+
intentSummary: string;
|
|
3356
|
+
success: boolean;
|
|
3357
|
+
summary: string;
|
|
3358
|
+
outputs: string[];
|
|
3359
|
+
followUps: string[];
|
|
3360
|
+
steps: StepResult[];
|
|
3361
|
+
verificationNotes?: string[];
|
|
3362
|
+
createdAt: number;
|
|
3363
|
+
}
|
|
3364
|
+
declare class TaskReporter {
|
|
3365
|
+
buildSummary(taskId: string, results: StepResult[]): ExecutionSummary;
|
|
3366
|
+
generateReport(task: Task, intent: IntentProfile, results: StepResult[]): TaskReport;
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
interface TaskFeedback {
|
|
3370
|
+
taskId: string;
|
|
3371
|
+
rating?: 'positive' | 'neutral' | 'negative';
|
|
3372
|
+
comment?: string;
|
|
3373
|
+
corrections?: string[];
|
|
3374
|
+
createdAt: number;
|
|
3375
|
+
}
|
|
3376
|
+
declare class FeedbackCollector {
|
|
3377
|
+
collect(task: Task, report: TaskReport, askUser?: (prompt: string) => Promise<string>): Promise<TaskFeedback | null>;
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3380
|
+
interface ComputerUseAdapterContext {
|
|
3381
|
+
toolName: string;
|
|
3382
|
+
invokeTool: (toolName: string, args: Record<string, unknown>) => Promise<any>;
|
|
3383
|
+
createFrameId?: () => string;
|
|
3384
|
+
}
|
|
3385
|
+
interface ComputerUseAdapterResult {
|
|
3386
|
+
toolResult: any;
|
|
3387
|
+
frame: ObservationFrame;
|
|
3388
|
+
}
|
|
3389
|
+
interface ComputerUseCapabilityAdapter {
|
|
3390
|
+
id: string;
|
|
3391
|
+
execute(action: ComputerUseActionEnvelope, context: ComputerUseAdapterContext): Promise<ComputerUseAdapterResult>;
|
|
3392
|
+
}
|
|
3393
|
+
declare class McpCanonicalCapabilityAdapter implements ComputerUseCapabilityAdapter {
|
|
3394
|
+
readonly id = "mcp-canonical-adapter";
|
|
3395
|
+
private readonly maxInlineImageBase64Length;
|
|
3396
|
+
execute(action: ComputerUseActionEnvelope, context: ComputerUseAdapterContext): Promise<ComputerUseAdapterResult>;
|
|
3397
|
+
private validateActionArgs;
|
|
3398
|
+
private extractObservationBlocks;
|
|
3399
|
+
}
|
|
3400
|
+
declare function normalizeComputerUseError(error: unknown): ComputerUseError;
|
|
3401
|
+
|
|
3402
|
+
interface SessionState {
|
|
3403
|
+
sessionId: string;
|
|
3404
|
+
taskId: string;
|
|
3405
|
+
latestFrameIds: string[];
|
|
3406
|
+
lastActionId?: string;
|
|
3407
|
+
verificationFailures: number;
|
|
3408
|
+
}
|
|
3409
|
+
interface DispatchCanonicalActionRequest {
|
|
3410
|
+
taskId: string;
|
|
3411
|
+
action: ComputerUseActionEnvelope;
|
|
3412
|
+
adapter: ComputerUseCapabilityAdapter;
|
|
3413
|
+
toolName: string;
|
|
3414
|
+
invokeTool: (toolName: string, args: Record<string, unknown>) => Promise<any>;
|
|
3415
|
+
}
|
|
3416
|
+
interface DispatchCanonicalActionResult {
|
|
3417
|
+
sessionId: string;
|
|
3418
|
+
toolResult: any;
|
|
3419
|
+
frame: ObservationFrame;
|
|
3420
|
+
frameId: string;
|
|
3421
|
+
checkpoint: ComputerUseCheckpoint;
|
|
3422
|
+
}
|
|
3423
|
+
declare class ComputerUseSessionOrchestrator extends EventEmitter {
|
|
3424
|
+
private sessions;
|
|
3425
|
+
startSession(taskId: string, sessionId?: string): SessionState;
|
|
3426
|
+
dispatchCanonicalAction(request: DispatchCanonicalActionRequest): Promise<DispatchCanonicalActionResult>;
|
|
3427
|
+
endSession(sessionId: string): ComputerUseCheckpoint | undefined;
|
|
3428
|
+
getCheckpoint(sessionId: string): ComputerUseCheckpoint | undefined;
|
|
3429
|
+
restoreCheckpoint(checkpoint: ComputerUseCheckpoint): void;
|
|
3430
|
+
private buildCheckpoint;
|
|
3431
|
+
private normalizeError;
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3434
|
+
export { Agent, type AgentContext, type AgentOptions, AnthropicProvider, BasicStrategyGate, COMPUTER_USE_ERROR_CODES, type CanonicalComputerUseAction, type Checkpoint, type ComputerUseActionEnvelope, type ComputerUseAdapterContext, type ComputerUseAdapterResult, type ComputerUseCapabilityAdapter, type ComputerUseCheckpoint, type ComputerUseDomain, type ComputerUseError, type ComputerUseErrorCode, type ComputerUseRiskLevel, ComputerUseSessionOrchestrator, type ComputerUseSessionSummary, type ComputerUseSessionSummaryRecord, ConfigLoader, ConfigSchema, type ContentBlock, ContentBlockSchema, type CreateLLMOptions, type DispatchCanonicalActionRequest, type DispatchCanonicalActionResult, type DynamicSkill, type Episode, type EvaluationMetrics, type EvaluationResult, type EvaluationSummary, EvolutionLimitValidator, type ExecutionSummary, type Fact, FallbackProvider, FeedbackCollector, FileSystemServer, type GateResult, type GateValidator, GitServer, type ILLMProvider, type IStrategy, type ImageContent, ImageContentSchema, type Intent, IntentAnalyzer, type IntentProfile, IntentProfileSchema, IntentSchema, type InteractionRequest, InteractionServer, type LLMRequest, LLMRequestSchema, type LLMResponse, LLMResponseSchema, type LydiaConfig, McpCanonicalCapabilityAdapter, McpClientManager, type McpServerConfig, McpServerSchema, MemoryManager, type MemoryManagerOptions, MemoryServer, type Message, MessageSchema, MockProvider, type ObservationArtifactKind, type ObservationBlock, type ObservationFrame, type ObservationFrameRecord, OllamaProvider, OpenAIProvider, type ReplayDeterminismMismatch, type ReplayDeterminismResult, ReplayLLMProvider, ReplayManager, ReplayMcpClientManager, ReplayPerformanceValidator, type ReviewFinding, ReviewManager, type ReviewOptions, type ReviewRequest, type ReviewSummary, type RiskAssessment, type RiskLevel, RiskSafetyValidator, type Role, RoleSchema, type RoutedStrategy, type ShadowPromotionDecision, ShadowRouter, ShellServer, SimplePlanner, type Skill, type SkillContext, SkillLoader, type SkillMeta, SkillMetaSchema, SkillParser, SkillRegistry, SkillSchema, SkillWatcher, type StaticSkill, StaticSkillSchema, type Step, type StepResult, StepSchema, type StepStatus, StepStatusSchema, type StepType, StepTypeSchema, type Strategy, StrategyApprovalService, type StrategyBranch, StrategyBranchManager, type StrategyComparison, type StrategyConfig, StrategyConstraintsSchema, type StrategyEpisodeSummary, StrategyEvaluator, StrategyEvolutionLimitsSchema, StrategyExecutionSchema, StrategyMetadataSchema, StrategyPlanningSchema, StrategyPreferencesSchema, StrategyPromptsSchema, type StrategyProposal, StrategyRegistry, StrategyReviewer, StrategySchema, StrategySystemSchema, StrategyUpdateGate, type StreamChunk, SyntaxValidator, type Task, type TaskContext, type TaskFeedback, type TaskFeedbackRecord, type TaskReport, type TaskReportRecord, TaskReporter, TaskSchema, type TaskStatus, TaskStatusSchema, type TextContent, TextContentSchema, type ThinkingContent, ThinkingContentSchema, type TokenUsage, TokenUsageSchema, type ToolDefinition, ToolDefinitionSchema, type ToolResultContent, ToolResultContentSchema, type ToolUseContent, ToolUseContentSchema, type Trace, type UpsertComputerUseSessionSummaryInput, type ValidationResult, assessRisk, createLLMFromConfig, getSkillContent, hasContent, isCanonicalComputerUseTool, isComputerUseErrorCode, isDynamicSkill, listCanonicalComputerUseActions, normalizeComputerUseError, resolveCanonicalComputerUseToolName };
|