@perstack/core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1901 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const defaultPerstackApiBaseUrl = "https://api.perstack.ai";
4
+ declare const organizationNameRegex: RegExp;
5
+ declare const maxOrganizationNameLength = 128;
6
+ declare const maxApplicationNameLength = 255;
7
+ declare const expertKeyRegex: RegExp;
8
+ declare const expertNameRegex: RegExp;
9
+ declare const expertVersionRegex: RegExp;
10
+ declare const tagNameRegex: RegExp;
11
+ declare const maxExpertNameLength = 255;
12
+ declare const maxExpertVersionTagLength = 255;
13
+ declare const maxExpertKeyLength = 511;
14
+ declare const maxExpertDescriptionLength: number;
15
+ declare const maxExpertInstructionLength: number;
16
+ declare const maxExpertSkillItems = 255;
17
+ declare const maxExpertDelegateItems = 255;
18
+ declare const maxExpertTagItems = 8;
19
+ declare const defaultTemperature = 0;
20
+ declare const defaultMaxSteps: undefined;
21
+ declare const defaultMaxRetries = 5;
22
+ declare const defaultTimeout: number;
23
+ declare const maxExpertJobQueryLength: number;
24
+ declare const maxExpertJobFileNameLength: number;
25
+ declare const packageWithVersionRegex: RegExp;
26
+ declare const urlSafeRegex: RegExp;
27
+ declare const maxSkillNameLength = 255;
28
+ declare const maxSkillDescriptionLength: number;
29
+ declare const maxSkillRuleLength: number;
30
+ declare const maxSkillPickOmitItems = 255;
31
+ declare const maxSkillRequiredEnvItems = 255;
32
+ declare const maxSkillToolNameLength = 255;
33
+ declare const maxSkillEndpointLength: number;
34
+ declare const maxSkillInputJsonSchemaLength: number;
35
+ declare const maxSkillToolItems = 255;
36
+ declare const maxCheckpointToolCallIdLength = 255;
37
+ declare const envNameRegex: RegExp;
38
+ declare const maxEnvNameLength = 255;
39
+
40
+ declare const checkpointStatusSchema: z.ZodEnum<{
41
+ init: "init";
42
+ proceeding: "proceeding";
43
+ completed: "completed";
44
+ stoppedByInteractiveTool: "stoppedByInteractiveTool";
45
+ stoppedByDelegate: "stoppedByDelegate";
46
+ stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
47
+ stoppedByError: "stoppedByError";
48
+ }>;
49
+ type CheckpointStatus = z.infer<typeof checkpointStatusSchema>;
50
+ declare const checkpointSchema: z.ZodObject<{
51
+ id: z.ZodString;
52
+ runId: z.ZodString;
53
+ status: z.ZodEnum<{
54
+ init: "init";
55
+ proceeding: "proceeding";
56
+ completed: "completed";
57
+ stoppedByInteractiveTool: "stoppedByInteractiveTool";
58
+ stoppedByDelegate: "stoppedByDelegate";
59
+ stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
60
+ stoppedByError: "stoppedByError";
61
+ }>;
62
+ stepNumber: z.ZodNumber;
63
+ messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
64
+ id: z.ZodString;
65
+ type: z.ZodLiteral<"instructionMessage">;
66
+ contents: z.ZodArray<z.ZodObject<{
67
+ id: z.ZodString;
68
+ type: z.ZodLiteral<"textPart">;
69
+ text: z.ZodString;
70
+ }, z.core.$strip>>;
71
+ cache: z.ZodOptional<z.ZodBoolean>;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ id: z.ZodString;
74
+ type: z.ZodLiteral<"userMessage">;
75
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
76
+ id: z.ZodString;
77
+ type: z.ZodLiteral<"textPart">;
78
+ text: z.ZodString;
79
+ }, z.core.$strip>, z.ZodObject<{
80
+ id: z.ZodString;
81
+ type: z.ZodLiteral<"imageUrlPart">;
82
+ url: z.ZodURL;
83
+ mimeType: z.ZodString;
84
+ }, z.core.$strip>, z.ZodObject<{
85
+ id: z.ZodString;
86
+ type: z.ZodLiteral<"imageInlinePart">;
87
+ encodedData: z.ZodString;
88
+ mimeType: z.ZodString;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ id: z.ZodString;
91
+ type: z.ZodLiteral<"imageBinaryPart">;
92
+ data: z.ZodString;
93
+ mimeType: z.ZodString;
94
+ }, z.core.$strip>, z.ZodObject<{
95
+ id: z.ZodString;
96
+ type: z.ZodLiteral<"fileUrlPart">;
97
+ url: z.ZodString;
98
+ mimeType: z.ZodString;
99
+ }, z.core.$strip>, z.ZodObject<{
100
+ id: z.ZodString;
101
+ type: z.ZodLiteral<"fileInlinePart">;
102
+ encodedData: z.ZodString;
103
+ mimeType: z.ZodString;
104
+ }, z.core.$strip>, z.ZodObject<{
105
+ id: z.ZodString;
106
+ type: z.ZodLiteral<"fileBinaryPart">;
107
+ data: z.ZodString;
108
+ mimeType: z.ZodString;
109
+ }, z.core.$strip>]>>;
110
+ cache: z.ZodOptional<z.ZodBoolean>;
111
+ }, z.core.$strip>, z.ZodObject<{
112
+ id: z.ZodString;
113
+ type: z.ZodLiteral<"expertMessage">;
114
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
115
+ id: z.ZodString;
116
+ type: z.ZodLiteral<"textPart">;
117
+ text: z.ZodString;
118
+ }, z.core.$strip>, z.ZodObject<{
119
+ id: z.ZodString;
120
+ type: z.ZodLiteral<"toolCallPart">;
121
+ toolCallId: z.ZodString;
122
+ toolName: z.ZodString;
123
+ args: z.ZodUnknown;
124
+ }, z.core.$strip>]>>;
125
+ cache: z.ZodOptional<z.ZodBoolean>;
126
+ }, z.core.$strip>, z.ZodObject<{
127
+ id: z.ZodString;
128
+ type: z.ZodLiteral<"toolMessage">;
129
+ contents: z.ZodArray<z.ZodObject<{
130
+ id: z.ZodString;
131
+ type: z.ZodLiteral<"toolResultPart">;
132
+ toolCallId: z.ZodString;
133
+ toolName: z.ZodString;
134
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
135
+ id: z.ZodString;
136
+ type: z.ZodLiteral<"textPart">;
137
+ text: z.ZodString;
138
+ }, z.core.$strip>, z.ZodObject<{
139
+ id: z.ZodString;
140
+ type: z.ZodLiteral<"imageInlinePart">;
141
+ encodedData: z.ZodString;
142
+ mimeType: z.ZodString;
143
+ }, z.core.$strip>]>>;
144
+ isError: z.ZodOptional<z.ZodBoolean>;
145
+ }, z.core.$strip>>;
146
+ cache: z.ZodOptional<z.ZodBoolean>;
147
+ }, z.core.$strip>]>>;
148
+ expert: z.ZodObject<{
149
+ key: z.ZodString;
150
+ name: z.ZodString;
151
+ version: z.ZodString;
152
+ }, z.core.$strip>;
153
+ delegateTo: z.ZodOptional<z.ZodObject<{
154
+ expert: z.ZodObject<{
155
+ key: z.ZodString;
156
+ name: z.ZodString;
157
+ version: z.ZodString;
158
+ }, z.core.$strip>;
159
+ toolCallId: z.ZodString;
160
+ toolName: z.ZodString;
161
+ query: z.ZodString;
162
+ }, z.core.$strip>>;
163
+ delegatedBy: z.ZodOptional<z.ZodObject<{
164
+ expert: z.ZodObject<{
165
+ key: z.ZodString;
166
+ name: z.ZodString;
167
+ version: z.ZodString;
168
+ }, z.core.$strip>;
169
+ toolCallId: z.ZodString;
170
+ toolName: z.ZodString;
171
+ checkpointId: z.ZodString;
172
+ }, z.core.$strip>>;
173
+ usage: z.ZodObject<{
174
+ inputTokens: z.ZodNumber;
175
+ outputTokens: z.ZodNumber;
176
+ reasoningTokens: z.ZodNumber;
177
+ totalTokens: z.ZodNumber;
178
+ cachedInputTokens: z.ZodNumber;
179
+ }, z.core.$strip>;
180
+ contextWindow: z.ZodOptional<z.ZodNumber>;
181
+ contextWindowUsage: z.ZodOptional<z.ZodNumber>;
182
+ }, z.core.$strip>;
183
+ type Checkpoint = z.infer<typeof checkpointSchema>;
184
+
185
+ declare const expertSchema: z.ZodObject<{
186
+ key: z.ZodString;
187
+ name: z.ZodString;
188
+ version: z.ZodString;
189
+ description: z.ZodOptional<z.ZodString>;
190
+ instruction: z.ZodString;
191
+ skills: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
192
+ type: z.ZodLiteral<"mcpStdioSkill">;
193
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
194
+ description: z.ZodOptional<z.ZodString>;
195
+ rule: z.ZodOptional<z.ZodString>;
196
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
197
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
198
+ command: z.ZodString;
199
+ packageName: z.ZodOptional<z.ZodString>;
200
+ requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
201
+ }, z.core.$strip>, z.ZodObject<{
202
+ type: z.ZodLiteral<"mcpSseSkill">;
203
+ description: z.ZodOptional<z.ZodString>;
204
+ rule: z.ZodOptional<z.ZodString>;
205
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
206
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
207
+ endpoint: z.ZodString;
208
+ }, z.core.$strip>, z.ZodObject<{
209
+ type: z.ZodLiteral<"interactiveSkill">;
210
+ description: z.ZodOptional<z.ZodString>;
211
+ rule: z.ZodOptional<z.ZodString>;
212
+ tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
213
+ description: z.ZodOptional<z.ZodString>;
214
+ inputJsonSchema: z.ZodString;
215
+ }, z.core.$strip>>, z.ZodTransform<{
216
+ [k: string]: {
217
+ name: string;
218
+ inputJsonSchema: string;
219
+ description?: string | undefined;
220
+ };
221
+ }, Record<string, {
222
+ inputJsonSchema: string;
223
+ description?: string | undefined;
224
+ }>>>;
225
+ }, z.core.$strip>], "type">>>>, z.ZodTransform<{
226
+ [k: string]: {
227
+ type: "mcpStdioSkill";
228
+ name: string;
229
+ pick: string[];
230
+ omit: string[];
231
+ command: string;
232
+ args: string[];
233
+ requiredEnv: string[];
234
+ description?: string | undefined;
235
+ rule?: string | undefined;
236
+ packageName?: string | undefined;
237
+ } | {
238
+ type: "mcpSseSkill";
239
+ name: string;
240
+ pick: string[];
241
+ omit: string[];
242
+ endpoint: string;
243
+ description?: string | undefined;
244
+ rule?: string | undefined;
245
+ } | {
246
+ type: "interactiveSkill";
247
+ name: string;
248
+ tools: {
249
+ [k: string]: {
250
+ name: string;
251
+ inputJsonSchema: string;
252
+ description?: string | undefined;
253
+ };
254
+ };
255
+ description?: string | undefined;
256
+ rule?: string | undefined;
257
+ };
258
+ }, Record<string, {
259
+ type: "mcpStdioSkill";
260
+ args: string[];
261
+ pick: string[];
262
+ omit: string[];
263
+ command: string;
264
+ requiredEnv: string[];
265
+ description?: string | undefined;
266
+ rule?: string | undefined;
267
+ packageName?: string | undefined;
268
+ } | {
269
+ type: "mcpSseSkill";
270
+ pick: string[];
271
+ omit: string[];
272
+ endpoint: string;
273
+ description?: string | undefined;
274
+ rule?: string | undefined;
275
+ } | {
276
+ type: "interactiveSkill";
277
+ tools: {
278
+ [k: string]: {
279
+ name: string;
280
+ inputJsonSchema: string;
281
+ description?: string | undefined;
282
+ };
283
+ };
284
+ description?: string | undefined;
285
+ rule?: string | undefined;
286
+ }>>>;
287
+ delegates: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
288
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
289
+ }, z.core.$strip>;
290
+ type Expert = z.infer<typeof expertSchema>;
291
+
292
+ /**
293
+ * Message Part Schemas
294
+ */
295
+ declare const basePartSchema: z.ZodObject<{
296
+ id: z.ZodString;
297
+ }, z.core.$strip>;
298
+ type BasePart = z.infer<typeof basePartSchema>;
299
+ declare const textPartSchema: z.ZodObject<{
300
+ id: z.ZodString;
301
+ type: z.ZodLiteral<"textPart">;
302
+ text: z.ZodString;
303
+ }, z.core.$strip>;
304
+ type TextPart = z.infer<typeof textPartSchema>;
305
+ declare const imageUrlPartSchema: z.ZodObject<{
306
+ id: z.ZodString;
307
+ type: z.ZodLiteral<"imageUrlPart">;
308
+ url: z.ZodURL;
309
+ mimeType: z.ZodString;
310
+ }, z.core.$strip>;
311
+ type ImageUrlPart = z.infer<typeof imageUrlPartSchema>;
312
+ declare const imageInlinePartSchema: z.ZodObject<{
313
+ id: z.ZodString;
314
+ type: z.ZodLiteral<"imageInlinePart">;
315
+ encodedData: z.ZodString;
316
+ mimeType: z.ZodString;
317
+ }, z.core.$strip>;
318
+ type ImageInlinePart = z.infer<typeof imageInlinePartSchema>;
319
+ declare const imageBinaryPartSchema: z.ZodObject<{
320
+ id: z.ZodString;
321
+ type: z.ZodLiteral<"imageBinaryPart">;
322
+ data: z.ZodString;
323
+ mimeType: z.ZodString;
324
+ }, z.core.$strip>;
325
+ type ImageBinaryPart = z.infer<typeof imageBinaryPartSchema>;
326
+ declare const fileUrlPartSchema: z.ZodObject<{
327
+ id: z.ZodString;
328
+ type: z.ZodLiteral<"fileUrlPart">;
329
+ url: z.ZodString;
330
+ mimeType: z.ZodString;
331
+ }, z.core.$strip>;
332
+ type FileUrlPart = z.infer<typeof fileUrlPartSchema>;
333
+ declare const fileInlinePartSchema: z.ZodObject<{
334
+ id: z.ZodString;
335
+ type: z.ZodLiteral<"fileInlinePart">;
336
+ encodedData: z.ZodString;
337
+ mimeType: z.ZodString;
338
+ }, z.core.$strip>;
339
+ type FileInlinePart = z.infer<typeof fileInlinePartSchema>;
340
+ declare const fileBinaryPartSchema: z.ZodObject<{
341
+ id: z.ZodString;
342
+ type: z.ZodLiteral<"fileBinaryPart">;
343
+ data: z.ZodString;
344
+ mimeType: z.ZodString;
345
+ }, z.core.$strip>;
346
+ type FileBinaryPart = z.infer<typeof fileBinaryPartSchema>;
347
+ declare const toolCallPartSchema: z.ZodObject<{
348
+ id: z.ZodString;
349
+ type: z.ZodLiteral<"toolCallPart">;
350
+ toolCallId: z.ZodString;
351
+ toolName: z.ZodString;
352
+ args: z.ZodUnknown;
353
+ }, z.core.$strip>;
354
+ type ToolCallPart = z.infer<typeof toolCallPartSchema>;
355
+ declare const toolResultPartSchema: z.ZodObject<{
356
+ id: z.ZodString;
357
+ type: z.ZodLiteral<"toolResultPart">;
358
+ toolCallId: z.ZodString;
359
+ toolName: z.ZodString;
360
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
361
+ id: z.ZodString;
362
+ type: z.ZodLiteral<"textPart">;
363
+ text: z.ZodString;
364
+ }, z.core.$strip>, z.ZodObject<{
365
+ id: z.ZodString;
366
+ type: z.ZodLiteral<"imageInlinePart">;
367
+ encodedData: z.ZodString;
368
+ mimeType: z.ZodString;
369
+ }, z.core.$strip>]>>;
370
+ isError: z.ZodOptional<z.ZodBoolean>;
371
+ }, z.core.$strip>;
372
+ type ToolResultPart = z.infer<typeof toolResultPartSchema>;
373
+ declare const messagePartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
374
+ id: z.ZodString;
375
+ type: z.ZodLiteral<"textPart">;
376
+ text: z.ZodString;
377
+ }, z.core.$strip>, z.ZodObject<{
378
+ id: z.ZodString;
379
+ type: z.ZodLiteral<"imageUrlPart">;
380
+ url: z.ZodURL;
381
+ mimeType: z.ZodString;
382
+ }, z.core.$strip>, z.ZodObject<{
383
+ id: z.ZodString;
384
+ type: z.ZodLiteral<"imageInlinePart">;
385
+ encodedData: z.ZodString;
386
+ mimeType: z.ZodString;
387
+ }, z.core.$strip>, z.ZodObject<{
388
+ id: z.ZodString;
389
+ type: z.ZodLiteral<"imageBinaryPart">;
390
+ data: z.ZodString;
391
+ mimeType: z.ZodString;
392
+ }, z.core.$strip>, z.ZodObject<{
393
+ id: z.ZodString;
394
+ type: z.ZodLiteral<"fileUrlPart">;
395
+ url: z.ZodString;
396
+ mimeType: z.ZodString;
397
+ }, z.core.$strip>, z.ZodObject<{
398
+ id: z.ZodString;
399
+ type: z.ZodLiteral<"fileInlinePart">;
400
+ encodedData: z.ZodString;
401
+ mimeType: z.ZodString;
402
+ }, z.core.$strip>, z.ZodObject<{
403
+ id: z.ZodString;
404
+ type: z.ZodLiteral<"fileBinaryPart">;
405
+ data: z.ZodString;
406
+ mimeType: z.ZodString;
407
+ }, z.core.$strip>, z.ZodObject<{
408
+ id: z.ZodString;
409
+ type: z.ZodLiteral<"toolCallPart">;
410
+ toolCallId: z.ZodString;
411
+ toolName: z.ZodString;
412
+ args: z.ZodUnknown;
413
+ }, z.core.$strip>, z.ZodObject<{
414
+ id: z.ZodString;
415
+ type: z.ZodLiteral<"toolResultPart">;
416
+ toolCallId: z.ZodString;
417
+ toolName: z.ZodString;
418
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
419
+ id: z.ZodString;
420
+ type: z.ZodLiteral<"textPart">;
421
+ text: z.ZodString;
422
+ }, z.core.$strip>, z.ZodObject<{
423
+ id: z.ZodString;
424
+ type: z.ZodLiteral<"imageInlinePart">;
425
+ encodedData: z.ZodString;
426
+ mimeType: z.ZodString;
427
+ }, z.core.$strip>]>>;
428
+ isError: z.ZodOptional<z.ZodBoolean>;
429
+ }, z.core.$strip>], "type">;
430
+ type MessagePart = z.infer<typeof messagePartSchema>;
431
+
432
+ declare const instructionMessageSchema: z.ZodObject<{
433
+ id: z.ZodString;
434
+ type: z.ZodLiteral<"instructionMessage">;
435
+ contents: z.ZodArray<z.ZodObject<{
436
+ id: z.ZodString;
437
+ type: z.ZodLiteral<"textPart">;
438
+ text: z.ZodString;
439
+ }, z.core.$strip>>;
440
+ cache: z.ZodOptional<z.ZodBoolean>;
441
+ }, z.core.$strip>;
442
+ type InstructionMessage = z.infer<typeof instructionMessageSchema>;
443
+ declare const userMessageSchema: z.ZodObject<{
444
+ id: z.ZodString;
445
+ type: z.ZodLiteral<"userMessage">;
446
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
447
+ id: z.ZodString;
448
+ type: z.ZodLiteral<"textPart">;
449
+ text: z.ZodString;
450
+ }, z.core.$strip>, z.ZodObject<{
451
+ id: z.ZodString;
452
+ type: z.ZodLiteral<"imageUrlPart">;
453
+ url: z.ZodURL;
454
+ mimeType: z.ZodString;
455
+ }, z.core.$strip>, z.ZodObject<{
456
+ id: z.ZodString;
457
+ type: z.ZodLiteral<"imageInlinePart">;
458
+ encodedData: z.ZodString;
459
+ mimeType: z.ZodString;
460
+ }, z.core.$strip>, z.ZodObject<{
461
+ id: z.ZodString;
462
+ type: z.ZodLiteral<"imageBinaryPart">;
463
+ data: z.ZodString;
464
+ mimeType: z.ZodString;
465
+ }, z.core.$strip>, z.ZodObject<{
466
+ id: z.ZodString;
467
+ type: z.ZodLiteral<"fileUrlPart">;
468
+ url: z.ZodString;
469
+ mimeType: z.ZodString;
470
+ }, z.core.$strip>, z.ZodObject<{
471
+ id: z.ZodString;
472
+ type: z.ZodLiteral<"fileInlinePart">;
473
+ encodedData: z.ZodString;
474
+ mimeType: z.ZodString;
475
+ }, z.core.$strip>, z.ZodObject<{
476
+ id: z.ZodString;
477
+ type: z.ZodLiteral<"fileBinaryPart">;
478
+ data: z.ZodString;
479
+ mimeType: z.ZodString;
480
+ }, z.core.$strip>]>>;
481
+ cache: z.ZodOptional<z.ZodBoolean>;
482
+ }, z.core.$strip>;
483
+ type UserMessage = z.infer<typeof userMessageSchema>;
484
+ declare const expertMessageSchema: z.ZodObject<{
485
+ id: z.ZodString;
486
+ type: z.ZodLiteral<"expertMessage">;
487
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
488
+ id: z.ZodString;
489
+ type: z.ZodLiteral<"textPart">;
490
+ text: z.ZodString;
491
+ }, z.core.$strip>, z.ZodObject<{
492
+ id: z.ZodString;
493
+ type: z.ZodLiteral<"toolCallPart">;
494
+ toolCallId: z.ZodString;
495
+ toolName: z.ZodString;
496
+ args: z.ZodUnknown;
497
+ }, z.core.$strip>]>>;
498
+ cache: z.ZodOptional<z.ZodBoolean>;
499
+ }, z.core.$strip>;
500
+ type ExpertMessage = z.infer<typeof expertMessageSchema>;
501
+ declare const toolMessageSchema: z.ZodObject<{
502
+ id: z.ZodString;
503
+ type: z.ZodLiteral<"toolMessage">;
504
+ contents: z.ZodArray<z.ZodObject<{
505
+ id: z.ZodString;
506
+ type: z.ZodLiteral<"toolResultPart">;
507
+ toolCallId: z.ZodString;
508
+ toolName: z.ZodString;
509
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
510
+ id: z.ZodString;
511
+ type: z.ZodLiteral<"textPart">;
512
+ text: z.ZodString;
513
+ }, z.core.$strip>, z.ZodObject<{
514
+ id: z.ZodString;
515
+ type: z.ZodLiteral<"imageInlinePart">;
516
+ encodedData: z.ZodString;
517
+ mimeType: z.ZodString;
518
+ }, z.core.$strip>]>>;
519
+ isError: z.ZodOptional<z.ZodBoolean>;
520
+ }, z.core.$strip>>;
521
+ cache: z.ZodOptional<z.ZodBoolean>;
522
+ }, z.core.$strip>;
523
+ type ToolMessage = z.infer<typeof toolMessageSchema>;
524
+ declare const messageSchema: z.ZodUnion<readonly [z.ZodObject<{
525
+ id: z.ZodString;
526
+ type: z.ZodLiteral<"instructionMessage">;
527
+ contents: z.ZodArray<z.ZodObject<{
528
+ id: z.ZodString;
529
+ type: z.ZodLiteral<"textPart">;
530
+ text: z.ZodString;
531
+ }, z.core.$strip>>;
532
+ cache: z.ZodOptional<z.ZodBoolean>;
533
+ }, z.core.$strip>, z.ZodObject<{
534
+ id: z.ZodString;
535
+ type: z.ZodLiteral<"userMessage">;
536
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
537
+ id: z.ZodString;
538
+ type: z.ZodLiteral<"textPart">;
539
+ text: z.ZodString;
540
+ }, z.core.$strip>, z.ZodObject<{
541
+ id: z.ZodString;
542
+ type: z.ZodLiteral<"imageUrlPart">;
543
+ url: z.ZodURL;
544
+ mimeType: z.ZodString;
545
+ }, z.core.$strip>, z.ZodObject<{
546
+ id: z.ZodString;
547
+ type: z.ZodLiteral<"imageInlinePart">;
548
+ encodedData: z.ZodString;
549
+ mimeType: z.ZodString;
550
+ }, z.core.$strip>, z.ZodObject<{
551
+ id: z.ZodString;
552
+ type: z.ZodLiteral<"imageBinaryPart">;
553
+ data: z.ZodString;
554
+ mimeType: z.ZodString;
555
+ }, z.core.$strip>, z.ZodObject<{
556
+ id: z.ZodString;
557
+ type: z.ZodLiteral<"fileUrlPart">;
558
+ url: z.ZodString;
559
+ mimeType: z.ZodString;
560
+ }, z.core.$strip>, z.ZodObject<{
561
+ id: z.ZodString;
562
+ type: z.ZodLiteral<"fileInlinePart">;
563
+ encodedData: z.ZodString;
564
+ mimeType: z.ZodString;
565
+ }, z.core.$strip>, z.ZodObject<{
566
+ id: z.ZodString;
567
+ type: z.ZodLiteral<"fileBinaryPart">;
568
+ data: z.ZodString;
569
+ mimeType: z.ZodString;
570
+ }, z.core.$strip>]>>;
571
+ cache: z.ZodOptional<z.ZodBoolean>;
572
+ }, z.core.$strip>, z.ZodObject<{
573
+ id: z.ZodString;
574
+ type: z.ZodLiteral<"expertMessage">;
575
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
576
+ id: z.ZodString;
577
+ type: z.ZodLiteral<"textPart">;
578
+ text: z.ZodString;
579
+ }, z.core.$strip>, z.ZodObject<{
580
+ id: z.ZodString;
581
+ type: z.ZodLiteral<"toolCallPart">;
582
+ toolCallId: z.ZodString;
583
+ toolName: z.ZodString;
584
+ args: z.ZodUnknown;
585
+ }, z.core.$strip>]>>;
586
+ cache: z.ZodOptional<z.ZodBoolean>;
587
+ }, z.core.$strip>, z.ZodObject<{
588
+ id: z.ZodString;
589
+ type: z.ZodLiteral<"toolMessage">;
590
+ contents: z.ZodArray<z.ZodObject<{
591
+ id: z.ZodString;
592
+ type: z.ZodLiteral<"toolResultPart">;
593
+ toolCallId: z.ZodString;
594
+ toolName: z.ZodString;
595
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
596
+ id: z.ZodString;
597
+ type: z.ZodLiteral<"textPart">;
598
+ text: z.ZodString;
599
+ }, z.core.$strip>, z.ZodObject<{
600
+ id: z.ZodString;
601
+ type: z.ZodLiteral<"imageInlinePart">;
602
+ encodedData: z.ZodString;
603
+ mimeType: z.ZodString;
604
+ }, z.core.$strip>]>>;
605
+ isError: z.ZodOptional<z.ZodBoolean>;
606
+ }, z.core.$strip>>;
607
+ cache: z.ZodOptional<z.ZodBoolean>;
608
+ }, z.core.$strip>]>;
609
+ type Message = z.infer<typeof messageSchema>;
610
+
611
+ /**
612
+ * perstack.toml config schema
613
+ */
614
+ declare const perstackConfigSchema: z.ZodObject<{
615
+ provider: z.ZodOptional<z.ZodEnum<{
616
+ anthropic: "anthropic";
617
+ google: "google";
618
+ openai: "openai";
619
+ ollama: "ollama";
620
+ "azure-openai": "azure-openai";
621
+ "amazon-bedrock": "amazon-bedrock";
622
+ }>>;
623
+ model: z.ZodOptional<z.ZodString>;
624
+ temperature: z.ZodOptional<z.ZodNumber>;
625
+ maxSteps: z.ZodOptional<z.ZodNumber>;
626
+ maxRetries: z.ZodOptional<z.ZodNumber>;
627
+ timeout: z.ZodOptional<z.ZodNumber>;
628
+ experts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
629
+ version: z.ZodOptional<z.ZodString>;
630
+ minRuntimeVersion: z.ZodOptional<z.ZodString>;
631
+ description: z.ZodOptional<z.ZodString>;
632
+ instruction: z.ZodString;
633
+ skills: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
634
+ type: z.ZodLiteral<"mcpStdioSkill">;
635
+ description: z.ZodOptional<z.ZodString>;
636
+ rule: z.ZodOptional<z.ZodString>;
637
+ pick: z.ZodOptional<z.ZodArray<z.ZodString>>;
638
+ omit: z.ZodOptional<z.ZodArray<z.ZodString>>;
639
+ command: z.ZodString;
640
+ packageName: z.ZodOptional<z.ZodString>;
641
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
642
+ requiredEnv: z.ZodOptional<z.ZodArray<z.ZodString>>;
643
+ }, z.core.$strip>, z.ZodObject<{
644
+ type: z.ZodLiteral<"mcpSseSkill">;
645
+ description: z.ZodOptional<z.ZodString>;
646
+ rule: z.ZodOptional<z.ZodString>;
647
+ pick: z.ZodOptional<z.ZodArray<z.ZodString>>;
648
+ omit: z.ZodOptional<z.ZodArray<z.ZodString>>;
649
+ endpoint: z.ZodString;
650
+ }, z.core.$strip>, z.ZodObject<{
651
+ type: z.ZodLiteral<"interactiveSkill">;
652
+ description: z.ZodOptional<z.ZodString>;
653
+ rule: z.ZodOptional<z.ZodString>;
654
+ tools: z.ZodRecord<z.ZodString, z.ZodObject<{
655
+ description: z.ZodOptional<z.ZodString>;
656
+ inputJsonSchema: z.ZodString;
657
+ }, z.core.$strip>>;
658
+ }, z.core.$strip>], "type">>>;
659
+ delegates: z.ZodOptional<z.ZodArray<z.ZodString>>;
660
+ }, z.core.$strip>>>;
661
+ perstackApiBaseUrl: z.ZodOptional<z.ZodURL>;
662
+ perstackBaseSkillArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
663
+ envPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
664
+ }, z.core.$strip>;
665
+ type PerstackConfig = z.infer<typeof perstackConfigSchema>;
666
+
667
+ declare const providerNameSchema: z.ZodEnum<{
668
+ anthropic: "anthropic";
669
+ google: "google";
670
+ openai: "openai";
671
+ ollama: "ollama";
672
+ "azure-openai": "azure-openai";
673
+ "amazon-bedrock": "amazon-bedrock";
674
+ }>;
675
+ type ProviderName = z.infer<typeof providerNameSchema>;
676
+ declare const anthropicProviderConfigSchema: z.ZodObject<{
677
+ name: z.ZodLiteral<"anthropic">;
678
+ apiKey: z.ZodString;
679
+ baseUrl: z.ZodOptional<z.ZodString>;
680
+ }, z.core.$strip>;
681
+ type AnthropicProviderConfig = z.infer<typeof anthropicProviderConfigSchema>;
682
+ declare const googleGenerativeAiProviderConfigSchema: z.ZodObject<{
683
+ name: z.ZodLiteral<"google">;
684
+ apiKey: z.ZodString;
685
+ baseUrl: z.ZodOptional<z.ZodString>;
686
+ }, z.core.$strip>;
687
+ type GoogleGenerativeAiProviderConfig = z.infer<typeof googleGenerativeAiProviderConfigSchema>;
688
+ declare const openAiProviderConfigSchema: z.ZodObject<{
689
+ name: z.ZodLiteral<"openai">;
690
+ apiKey: z.ZodString;
691
+ baseUrl: z.ZodOptional<z.ZodString>;
692
+ organization: z.ZodOptional<z.ZodString>;
693
+ project: z.ZodOptional<z.ZodString>;
694
+ }, z.core.$strip>;
695
+ type OpenAiProviderConfig = z.infer<typeof openAiProviderConfigSchema>;
696
+ declare const ollamaProviderConfigSchema: z.ZodObject<{
697
+ name: z.ZodLiteral<"ollama">;
698
+ baseUrl: z.ZodOptional<z.ZodString>;
699
+ }, z.core.$strip>;
700
+ type OllamaProviderConfig = z.infer<typeof ollamaProviderConfigSchema>;
701
+ declare const azureOpenAiProviderConfigSchema: z.ZodObject<{
702
+ name: z.ZodLiteral<"azure-openai">;
703
+ apiKey: z.ZodString;
704
+ resourceName: z.ZodString;
705
+ apiVersion: z.ZodOptional<z.ZodString>;
706
+ }, z.core.$strip>;
707
+ type AzureOpenAiProviderConfig = z.infer<typeof azureOpenAiProviderConfigSchema>;
708
+ declare const amazonBedrockProviderConfigSchema: z.ZodObject<{
709
+ name: z.ZodLiteral<"amazon-bedrock">;
710
+ accessKeyId: z.ZodString;
711
+ secretAccessKey: z.ZodString;
712
+ region: z.ZodString;
713
+ sessionToken: z.ZodOptional<z.ZodString>;
714
+ }, z.core.$strip>;
715
+ type AmazonBedrockProviderConfig = z.infer<typeof amazonBedrockProviderConfigSchema>;
716
+ declare const providerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
717
+ name: z.ZodLiteral<"anthropic">;
718
+ apiKey: z.ZodString;
719
+ baseUrl: z.ZodOptional<z.ZodString>;
720
+ }, z.core.$strip>, z.ZodObject<{
721
+ name: z.ZodLiteral<"google">;
722
+ apiKey: z.ZodString;
723
+ baseUrl: z.ZodOptional<z.ZodString>;
724
+ }, z.core.$strip>, z.ZodObject<{
725
+ name: z.ZodLiteral<"openai">;
726
+ apiKey: z.ZodString;
727
+ baseUrl: z.ZodOptional<z.ZodString>;
728
+ organization: z.ZodOptional<z.ZodString>;
729
+ project: z.ZodOptional<z.ZodString>;
730
+ }, z.core.$strip>, z.ZodObject<{
731
+ name: z.ZodLiteral<"ollama">;
732
+ baseUrl: z.ZodOptional<z.ZodString>;
733
+ }, z.core.$strip>, z.ZodObject<{
734
+ name: z.ZodLiteral<"azure-openai">;
735
+ apiKey: z.ZodString;
736
+ resourceName: z.ZodString;
737
+ apiVersion: z.ZodOptional<z.ZodString>;
738
+ }, z.core.$strip>, z.ZodObject<{
739
+ name: z.ZodLiteral<"amazon-bedrock">;
740
+ accessKeyId: z.ZodString;
741
+ secretAccessKey: z.ZodString;
742
+ region: z.ZodString;
743
+ sessionToken: z.ZodOptional<z.ZodString>;
744
+ }, z.core.$strip>], "name">;
745
+ type ProviderConfig = z.infer<typeof providerConfigSchema>;
746
+
747
+ /**
748
+ * Run command input schema
749
+ */
750
+ declare const runCommandInputSchema: z.ZodObject<{
751
+ expertKey: z.ZodString;
752
+ query: z.ZodString;
753
+ options: z.ZodObject<{
754
+ config: z.ZodOptional<z.ZodString>;
755
+ provider: z.ZodOptional<z.ZodEnum<{
756
+ anthropic: "anthropic";
757
+ google: "google";
758
+ openai: "openai";
759
+ ollama: "ollama";
760
+ "azure-openai": "azure-openai";
761
+ "amazon-bedrock": "amazon-bedrock";
762
+ }>>;
763
+ model: z.ZodOptional<z.ZodString>;
764
+ temperature: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
765
+ maxSteps: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
766
+ maxRetries: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
767
+ timeout: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
768
+ runId: z.ZodOptional<z.ZodString>;
769
+ envPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
770
+ }, z.core.$strip>;
771
+ }, z.core.$strip>;
772
+ type RunCommandInput = z.infer<typeof runCommandInputSchema>;
773
+
774
+ declare const stepSchema: z.ZodObject<{
775
+ stepNumber: z.ZodNumber;
776
+ inputMessages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
777
+ id: z.ZodString;
778
+ type: z.ZodLiteral<"instructionMessage">;
779
+ contents: z.ZodArray<z.ZodObject<{
780
+ id: z.ZodString;
781
+ type: z.ZodLiteral<"textPart">;
782
+ text: z.ZodString;
783
+ }, z.core.$strip>>;
784
+ cache: z.ZodOptional<z.ZodBoolean>;
785
+ }, z.core.$strip>, z.ZodObject<{
786
+ id: z.ZodString;
787
+ type: z.ZodLiteral<"userMessage">;
788
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
789
+ id: z.ZodString;
790
+ type: z.ZodLiteral<"textPart">;
791
+ text: z.ZodString;
792
+ }, z.core.$strip>, z.ZodObject<{
793
+ id: z.ZodString;
794
+ type: z.ZodLiteral<"imageUrlPart">;
795
+ url: z.ZodURL;
796
+ mimeType: z.ZodString;
797
+ }, z.core.$strip>, z.ZodObject<{
798
+ id: z.ZodString;
799
+ type: z.ZodLiteral<"imageInlinePart">;
800
+ encodedData: z.ZodString;
801
+ mimeType: z.ZodString;
802
+ }, z.core.$strip>, z.ZodObject<{
803
+ id: z.ZodString;
804
+ type: z.ZodLiteral<"imageBinaryPart">;
805
+ data: z.ZodString;
806
+ mimeType: z.ZodString;
807
+ }, z.core.$strip>, z.ZodObject<{
808
+ id: z.ZodString;
809
+ type: z.ZodLiteral<"fileUrlPart">;
810
+ url: z.ZodString;
811
+ mimeType: z.ZodString;
812
+ }, z.core.$strip>, z.ZodObject<{
813
+ id: z.ZodString;
814
+ type: z.ZodLiteral<"fileInlinePart">;
815
+ encodedData: z.ZodString;
816
+ mimeType: z.ZodString;
817
+ }, z.core.$strip>, z.ZodObject<{
818
+ id: z.ZodString;
819
+ type: z.ZodLiteral<"fileBinaryPart">;
820
+ data: z.ZodString;
821
+ mimeType: z.ZodString;
822
+ }, z.core.$strip>]>>;
823
+ cache: z.ZodOptional<z.ZodBoolean>;
824
+ }, z.core.$strip>, z.ZodObject<{
825
+ id: z.ZodString;
826
+ type: z.ZodLiteral<"toolMessage">;
827
+ contents: z.ZodArray<z.ZodObject<{
828
+ id: z.ZodString;
829
+ type: z.ZodLiteral<"toolResultPart">;
830
+ toolCallId: z.ZodString;
831
+ toolName: z.ZodString;
832
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
833
+ id: z.ZodString;
834
+ type: z.ZodLiteral<"textPart">;
835
+ text: z.ZodString;
836
+ }, z.core.$strip>, z.ZodObject<{
837
+ id: z.ZodString;
838
+ type: z.ZodLiteral<"imageInlinePart">;
839
+ encodedData: z.ZodString;
840
+ mimeType: z.ZodString;
841
+ }, z.core.$strip>]>>;
842
+ isError: z.ZodOptional<z.ZodBoolean>;
843
+ }, z.core.$strip>>;
844
+ cache: z.ZodOptional<z.ZodBoolean>;
845
+ }, z.core.$strip>]>>>;
846
+ newMessages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
847
+ id: z.ZodString;
848
+ type: z.ZodLiteral<"instructionMessage">;
849
+ contents: z.ZodArray<z.ZodObject<{
850
+ id: z.ZodString;
851
+ type: z.ZodLiteral<"textPart">;
852
+ text: z.ZodString;
853
+ }, z.core.$strip>>;
854
+ cache: z.ZodOptional<z.ZodBoolean>;
855
+ }, z.core.$strip>, z.ZodObject<{
856
+ id: z.ZodString;
857
+ type: z.ZodLiteral<"userMessage">;
858
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
859
+ id: z.ZodString;
860
+ type: z.ZodLiteral<"textPart">;
861
+ text: z.ZodString;
862
+ }, z.core.$strip>, z.ZodObject<{
863
+ id: z.ZodString;
864
+ type: z.ZodLiteral<"imageUrlPart">;
865
+ url: z.ZodURL;
866
+ mimeType: z.ZodString;
867
+ }, z.core.$strip>, z.ZodObject<{
868
+ id: z.ZodString;
869
+ type: z.ZodLiteral<"imageInlinePart">;
870
+ encodedData: z.ZodString;
871
+ mimeType: z.ZodString;
872
+ }, z.core.$strip>, z.ZodObject<{
873
+ id: z.ZodString;
874
+ type: z.ZodLiteral<"imageBinaryPart">;
875
+ data: z.ZodString;
876
+ mimeType: z.ZodString;
877
+ }, z.core.$strip>, z.ZodObject<{
878
+ id: z.ZodString;
879
+ type: z.ZodLiteral<"fileUrlPart">;
880
+ url: z.ZodString;
881
+ mimeType: z.ZodString;
882
+ }, z.core.$strip>, z.ZodObject<{
883
+ id: z.ZodString;
884
+ type: z.ZodLiteral<"fileInlinePart">;
885
+ encodedData: z.ZodString;
886
+ mimeType: z.ZodString;
887
+ }, z.core.$strip>, z.ZodObject<{
888
+ id: z.ZodString;
889
+ type: z.ZodLiteral<"fileBinaryPart">;
890
+ data: z.ZodString;
891
+ mimeType: z.ZodString;
892
+ }, z.core.$strip>]>>;
893
+ cache: z.ZodOptional<z.ZodBoolean>;
894
+ }, z.core.$strip>, z.ZodObject<{
895
+ id: z.ZodString;
896
+ type: z.ZodLiteral<"expertMessage">;
897
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
898
+ id: z.ZodString;
899
+ type: z.ZodLiteral<"textPart">;
900
+ text: z.ZodString;
901
+ }, z.core.$strip>, z.ZodObject<{
902
+ id: z.ZodString;
903
+ type: z.ZodLiteral<"toolCallPart">;
904
+ toolCallId: z.ZodString;
905
+ toolName: z.ZodString;
906
+ args: z.ZodUnknown;
907
+ }, z.core.$strip>]>>;
908
+ cache: z.ZodOptional<z.ZodBoolean>;
909
+ }, z.core.$strip>, z.ZodObject<{
910
+ id: z.ZodString;
911
+ type: z.ZodLiteral<"toolMessage">;
912
+ contents: z.ZodArray<z.ZodObject<{
913
+ id: z.ZodString;
914
+ type: z.ZodLiteral<"toolResultPart">;
915
+ toolCallId: z.ZodString;
916
+ toolName: z.ZodString;
917
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
918
+ id: z.ZodString;
919
+ type: z.ZodLiteral<"textPart">;
920
+ text: z.ZodString;
921
+ }, z.core.$strip>, z.ZodObject<{
922
+ id: z.ZodString;
923
+ type: z.ZodLiteral<"imageInlinePart">;
924
+ encodedData: z.ZodString;
925
+ mimeType: z.ZodString;
926
+ }, z.core.$strip>]>>;
927
+ isError: z.ZodOptional<z.ZodBoolean>;
928
+ }, z.core.$strip>>;
929
+ cache: z.ZodOptional<z.ZodBoolean>;
930
+ }, z.core.$strip>]>>;
931
+ toolCall: z.ZodOptional<z.ZodObject<{
932
+ id: z.ZodString;
933
+ skillName: z.ZodString;
934
+ toolName: z.ZodString;
935
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
936
+ }, z.core.$strip>>;
937
+ toolResult: z.ZodOptional<z.ZodObject<{
938
+ id: z.ZodString;
939
+ skillName: z.ZodString;
940
+ toolName: z.ZodString;
941
+ result: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
942
+ id: z.ZodString;
943
+ type: z.ZodLiteral<"textPart">;
944
+ text: z.ZodString;
945
+ }, z.core.$strip>, z.ZodObject<{
946
+ id: z.ZodString;
947
+ type: z.ZodLiteral<"imageUrlPart">;
948
+ url: z.ZodURL;
949
+ mimeType: z.ZodString;
950
+ }, z.core.$strip>, z.ZodObject<{
951
+ id: z.ZodString;
952
+ type: z.ZodLiteral<"imageInlinePart">;
953
+ encodedData: z.ZodString;
954
+ mimeType: z.ZodString;
955
+ }, z.core.$strip>, z.ZodObject<{
956
+ id: z.ZodString;
957
+ type: z.ZodLiteral<"imageBinaryPart">;
958
+ data: z.ZodString;
959
+ mimeType: z.ZodString;
960
+ }, z.core.$strip>, z.ZodObject<{
961
+ id: z.ZodString;
962
+ type: z.ZodLiteral<"fileUrlPart">;
963
+ url: z.ZodString;
964
+ mimeType: z.ZodString;
965
+ }, z.core.$strip>, z.ZodObject<{
966
+ id: z.ZodString;
967
+ type: z.ZodLiteral<"fileInlinePart">;
968
+ encodedData: z.ZodString;
969
+ mimeType: z.ZodString;
970
+ }, z.core.$strip>, z.ZodObject<{
971
+ id: z.ZodString;
972
+ type: z.ZodLiteral<"fileBinaryPart">;
973
+ data: z.ZodString;
974
+ mimeType: z.ZodString;
975
+ }, z.core.$strip>, z.ZodObject<{
976
+ id: z.ZodString;
977
+ type: z.ZodLiteral<"toolCallPart">;
978
+ toolCallId: z.ZodString;
979
+ toolName: z.ZodString;
980
+ args: z.ZodUnknown;
981
+ }, z.core.$strip>, z.ZodObject<{
982
+ id: z.ZodString;
983
+ type: z.ZodLiteral<"toolResultPart">;
984
+ toolCallId: z.ZodString;
985
+ toolName: z.ZodString;
986
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
987
+ id: z.ZodString;
988
+ type: z.ZodLiteral<"textPart">;
989
+ text: z.ZodString;
990
+ }, z.core.$strip>, z.ZodObject<{
991
+ id: z.ZodString;
992
+ type: z.ZodLiteral<"imageInlinePart">;
993
+ encodedData: z.ZodString;
994
+ mimeType: z.ZodString;
995
+ }, z.core.$strip>]>>;
996
+ isError: z.ZodOptional<z.ZodBoolean>;
997
+ }, z.core.$strip>], "type">>;
998
+ }, z.core.$strip>>;
999
+ usage: z.ZodObject<{
1000
+ inputTokens: z.ZodNumber;
1001
+ outputTokens: z.ZodNumber;
1002
+ reasoningTokens: z.ZodNumber;
1003
+ totalTokens: z.ZodNumber;
1004
+ cachedInputTokens: z.ZodNumber;
1005
+ }, z.core.$strip>;
1006
+ startedAt: z.ZodNumber;
1007
+ finishedAt: z.ZodOptional<z.ZodNumber>;
1008
+ }, z.core.$strip>;
1009
+ type Step = z.infer<typeof stepSchema>;
1010
+
1011
+ declare const toolCallSchema: z.ZodObject<{
1012
+ id: z.ZodString;
1013
+ skillName: z.ZodString;
1014
+ toolName: z.ZodString;
1015
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1016
+ }, z.core.$strip>;
1017
+ type ToolCall = z.infer<typeof toolCallSchema>;
1018
+
1019
+ declare const toolResultSchema: z.ZodObject<{
1020
+ id: z.ZodString;
1021
+ skillName: z.ZodString;
1022
+ toolName: z.ZodString;
1023
+ result: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1024
+ id: z.ZodString;
1025
+ type: z.ZodLiteral<"textPart">;
1026
+ text: z.ZodString;
1027
+ }, z.core.$strip>, z.ZodObject<{
1028
+ id: z.ZodString;
1029
+ type: z.ZodLiteral<"imageUrlPart">;
1030
+ url: z.ZodURL;
1031
+ mimeType: z.ZodString;
1032
+ }, z.core.$strip>, z.ZodObject<{
1033
+ id: z.ZodString;
1034
+ type: z.ZodLiteral<"imageInlinePart">;
1035
+ encodedData: z.ZodString;
1036
+ mimeType: z.ZodString;
1037
+ }, z.core.$strip>, z.ZodObject<{
1038
+ id: z.ZodString;
1039
+ type: z.ZodLiteral<"imageBinaryPart">;
1040
+ data: z.ZodString;
1041
+ mimeType: z.ZodString;
1042
+ }, z.core.$strip>, z.ZodObject<{
1043
+ id: z.ZodString;
1044
+ type: z.ZodLiteral<"fileUrlPart">;
1045
+ url: z.ZodString;
1046
+ mimeType: z.ZodString;
1047
+ }, z.core.$strip>, z.ZodObject<{
1048
+ id: z.ZodString;
1049
+ type: z.ZodLiteral<"fileInlinePart">;
1050
+ encodedData: z.ZodString;
1051
+ mimeType: z.ZodString;
1052
+ }, z.core.$strip>, z.ZodObject<{
1053
+ id: z.ZodString;
1054
+ type: z.ZodLiteral<"fileBinaryPart">;
1055
+ data: z.ZodString;
1056
+ mimeType: z.ZodString;
1057
+ }, z.core.$strip>, z.ZodObject<{
1058
+ id: z.ZodString;
1059
+ type: z.ZodLiteral<"toolCallPart">;
1060
+ toolCallId: z.ZodString;
1061
+ toolName: z.ZodString;
1062
+ args: z.ZodUnknown;
1063
+ }, z.core.$strip>, z.ZodObject<{
1064
+ id: z.ZodString;
1065
+ type: z.ZodLiteral<"toolResultPart">;
1066
+ toolCallId: z.ZodString;
1067
+ toolName: z.ZodString;
1068
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1069
+ id: z.ZodString;
1070
+ type: z.ZodLiteral<"textPart">;
1071
+ text: z.ZodString;
1072
+ }, z.core.$strip>, z.ZodObject<{
1073
+ id: z.ZodString;
1074
+ type: z.ZodLiteral<"imageInlinePart">;
1075
+ encodedData: z.ZodString;
1076
+ mimeType: z.ZodString;
1077
+ }, z.core.$strip>]>>;
1078
+ isError: z.ZodOptional<z.ZodBoolean>;
1079
+ }, z.core.$strip>], "type">>;
1080
+ }, z.core.$strip>;
1081
+ type ToolResult = z.infer<typeof toolResultSchema>;
1082
+
1083
+ declare const usageSchema: z.ZodObject<{
1084
+ inputTokens: z.ZodNumber;
1085
+ outputTokens: z.ZodNumber;
1086
+ reasoningTokens: z.ZodNumber;
1087
+ totalTokens: z.ZodNumber;
1088
+ cachedInputTokens: z.ZodNumber;
1089
+ }, z.core.$strip>;
1090
+ type Usage = z.infer<typeof usageSchema>;
1091
+
1092
+ declare function parseExpertKey(expertKey: string): {
1093
+ key: string;
1094
+ name: string;
1095
+ version?: string;
1096
+ tag?: string;
1097
+ };
1098
+ declare const runParamsSchema: z.ZodObject<{
1099
+ setting: z.ZodObject<{
1100
+ model: z.ZodString;
1101
+ providerConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
1102
+ name: z.ZodLiteral<"anthropic">;
1103
+ apiKey: z.ZodString;
1104
+ baseUrl: z.ZodOptional<z.ZodString>;
1105
+ }, z.core.$strip>, z.ZodObject<{
1106
+ name: z.ZodLiteral<"google">;
1107
+ apiKey: z.ZodString;
1108
+ baseUrl: z.ZodOptional<z.ZodString>;
1109
+ }, z.core.$strip>, z.ZodObject<{
1110
+ name: z.ZodLiteral<"openai">;
1111
+ apiKey: z.ZodString;
1112
+ baseUrl: z.ZodOptional<z.ZodString>;
1113
+ organization: z.ZodOptional<z.ZodString>;
1114
+ project: z.ZodOptional<z.ZodString>;
1115
+ }, z.core.$strip>, z.ZodObject<{
1116
+ name: z.ZodLiteral<"ollama">;
1117
+ baseUrl: z.ZodOptional<z.ZodString>;
1118
+ }, z.core.$strip>, z.ZodObject<{
1119
+ name: z.ZodLiteral<"azure-openai">;
1120
+ apiKey: z.ZodString;
1121
+ resourceName: z.ZodString;
1122
+ apiVersion: z.ZodOptional<z.ZodString>;
1123
+ }, z.core.$strip>, z.ZodObject<{
1124
+ name: z.ZodLiteral<"amazon-bedrock">;
1125
+ accessKeyId: z.ZodString;
1126
+ secretAccessKey: z.ZodString;
1127
+ region: z.ZodString;
1128
+ sessionToken: z.ZodOptional<z.ZodString>;
1129
+ }, z.core.$strip>], "name">;
1130
+ runId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1131
+ expertKey: z.ZodString;
1132
+ input: z.ZodObject<{
1133
+ text: z.ZodOptional<z.ZodString>;
1134
+ interactiveToolCallResult: z.ZodOptional<z.ZodObject<{
1135
+ toolCallId: z.ZodString;
1136
+ toolName: z.ZodString;
1137
+ text: z.ZodString;
1138
+ }, z.core.$strip>>;
1139
+ }, z.core.$strip>;
1140
+ experts: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1141
+ name: z.ZodString;
1142
+ version: z.ZodString;
1143
+ description: z.ZodOptional<z.ZodString>;
1144
+ instruction: z.ZodString;
1145
+ skills: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
1146
+ type: z.ZodLiteral<"mcpStdioSkill">;
1147
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1148
+ description: z.ZodOptional<z.ZodString>;
1149
+ rule: z.ZodOptional<z.ZodString>;
1150
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1151
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1152
+ command: z.ZodString;
1153
+ packageName: z.ZodOptional<z.ZodString>;
1154
+ requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1155
+ }, z.core.$strip>, z.ZodObject<{
1156
+ type: z.ZodLiteral<"mcpSseSkill">;
1157
+ description: z.ZodOptional<z.ZodString>;
1158
+ rule: z.ZodOptional<z.ZodString>;
1159
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1160
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1161
+ endpoint: z.ZodString;
1162
+ }, z.core.$strip>, z.ZodObject<{
1163
+ type: z.ZodLiteral<"interactiveSkill">;
1164
+ description: z.ZodOptional<z.ZodString>;
1165
+ rule: z.ZodOptional<z.ZodString>;
1166
+ tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
1167
+ description: z.ZodOptional<z.ZodString>;
1168
+ inputJsonSchema: z.ZodString;
1169
+ }, z.core.$strip>>, z.ZodTransform<{
1170
+ [k: string]: {
1171
+ name: string;
1172
+ inputJsonSchema: string;
1173
+ description?: string | undefined;
1174
+ };
1175
+ }, Record<string, {
1176
+ inputJsonSchema: string;
1177
+ description?: string | undefined;
1178
+ }>>>;
1179
+ }, z.core.$strip>], "type">>>>, z.ZodTransform<{
1180
+ [k: string]: {
1181
+ type: "mcpStdioSkill";
1182
+ name: string;
1183
+ pick: string[];
1184
+ omit: string[];
1185
+ command: string;
1186
+ args: string[];
1187
+ requiredEnv: string[];
1188
+ description?: string | undefined;
1189
+ rule?: string | undefined;
1190
+ packageName?: string | undefined;
1191
+ } | {
1192
+ type: "mcpSseSkill";
1193
+ name: string;
1194
+ pick: string[];
1195
+ omit: string[];
1196
+ endpoint: string;
1197
+ description?: string | undefined;
1198
+ rule?: string | undefined;
1199
+ } | {
1200
+ type: "interactiveSkill";
1201
+ name: string;
1202
+ tools: {
1203
+ [k: string]: {
1204
+ name: string;
1205
+ inputJsonSchema: string;
1206
+ description?: string | undefined;
1207
+ };
1208
+ };
1209
+ description?: string | undefined;
1210
+ rule?: string | undefined;
1211
+ };
1212
+ }, Record<string, {
1213
+ type: "mcpStdioSkill";
1214
+ args: string[];
1215
+ pick: string[];
1216
+ omit: string[];
1217
+ command: string;
1218
+ requiredEnv: string[];
1219
+ description?: string | undefined;
1220
+ rule?: string | undefined;
1221
+ packageName?: string | undefined;
1222
+ } | {
1223
+ type: "mcpSseSkill";
1224
+ pick: string[];
1225
+ omit: string[];
1226
+ endpoint: string;
1227
+ description?: string | undefined;
1228
+ rule?: string | undefined;
1229
+ } | {
1230
+ type: "interactiveSkill";
1231
+ tools: {
1232
+ [k: string]: {
1233
+ name: string;
1234
+ inputJsonSchema: string;
1235
+ description?: string | undefined;
1236
+ };
1237
+ };
1238
+ description?: string | undefined;
1239
+ rule?: string | undefined;
1240
+ }>>>;
1241
+ delegates: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1242
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1243
+ }, z.core.$strip>>>>, z.ZodTransform<{
1244
+ [k: string]: {
1245
+ key: string;
1246
+ name: string;
1247
+ version: string;
1248
+ instruction: string;
1249
+ skills: {
1250
+ [k: string]: {
1251
+ type: "mcpStdioSkill";
1252
+ name: string;
1253
+ pick: string[];
1254
+ omit: string[];
1255
+ command: string;
1256
+ args: string[];
1257
+ requiredEnv: string[];
1258
+ description?: string | undefined;
1259
+ rule?: string | undefined;
1260
+ packageName?: string | undefined;
1261
+ } | {
1262
+ type: "mcpSseSkill";
1263
+ name: string;
1264
+ pick: string[];
1265
+ omit: string[];
1266
+ endpoint: string;
1267
+ description?: string | undefined;
1268
+ rule?: string | undefined;
1269
+ } | {
1270
+ type: "interactiveSkill";
1271
+ name: string;
1272
+ tools: {
1273
+ [k: string]: {
1274
+ name: string;
1275
+ inputJsonSchema: string;
1276
+ description?: string | undefined;
1277
+ };
1278
+ };
1279
+ description?: string | undefined;
1280
+ rule?: string | undefined;
1281
+ };
1282
+ };
1283
+ delegates: string[];
1284
+ tags: string[];
1285
+ description?: string | undefined;
1286
+ };
1287
+ }, Record<string, {
1288
+ name: string;
1289
+ version: string;
1290
+ instruction: string;
1291
+ skills: {
1292
+ [k: string]: {
1293
+ type: "mcpStdioSkill";
1294
+ name: string;
1295
+ pick: string[];
1296
+ omit: string[];
1297
+ command: string;
1298
+ args: string[];
1299
+ requiredEnv: string[];
1300
+ description?: string | undefined;
1301
+ rule?: string | undefined;
1302
+ packageName?: string | undefined;
1303
+ } | {
1304
+ type: "mcpSseSkill";
1305
+ name: string;
1306
+ pick: string[];
1307
+ omit: string[];
1308
+ endpoint: string;
1309
+ description?: string | undefined;
1310
+ rule?: string | undefined;
1311
+ } | {
1312
+ type: "interactiveSkill";
1313
+ name: string;
1314
+ tools: {
1315
+ [k: string]: {
1316
+ name: string;
1317
+ inputJsonSchema: string;
1318
+ description?: string | undefined;
1319
+ };
1320
+ };
1321
+ description?: string | undefined;
1322
+ rule?: string | undefined;
1323
+ };
1324
+ };
1325
+ delegates: string[];
1326
+ tags: string[];
1327
+ description?: string | undefined;
1328
+ }>>>;
1329
+ temperature: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1330
+ maxSteps: z.ZodOptional<z.ZodNumber>;
1331
+ maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1332
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1333
+ workspace: z.ZodOptional<z.ZodString>;
1334
+ startedAt: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1335
+ updatedAt: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1336
+ perstackApiBaseUrl: z.ZodDefault<z.ZodOptional<z.ZodURL>>;
1337
+ perstackApiKey: z.ZodOptional<z.ZodString>;
1338
+ perstackBaseSkillArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
1339
+ env: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
1340
+ }, z.core.$strip>;
1341
+ checkpoint: z.ZodOptional<z.ZodObject<{
1342
+ id: z.ZodString;
1343
+ runId: z.ZodString;
1344
+ status: z.ZodEnum<{
1345
+ init: "init";
1346
+ proceeding: "proceeding";
1347
+ completed: "completed";
1348
+ stoppedByInteractiveTool: "stoppedByInteractiveTool";
1349
+ stoppedByDelegate: "stoppedByDelegate";
1350
+ stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
1351
+ stoppedByError: "stoppedByError";
1352
+ }>;
1353
+ stepNumber: z.ZodNumber;
1354
+ messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1355
+ id: z.ZodString;
1356
+ type: z.ZodLiteral<"instructionMessage">;
1357
+ contents: z.ZodArray<z.ZodObject<{
1358
+ id: z.ZodString;
1359
+ type: z.ZodLiteral<"textPart">;
1360
+ text: z.ZodString;
1361
+ }, z.core.$strip>>;
1362
+ cache: z.ZodOptional<z.ZodBoolean>;
1363
+ }, z.core.$strip>, z.ZodObject<{
1364
+ id: z.ZodString;
1365
+ type: z.ZodLiteral<"userMessage">;
1366
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1367
+ id: z.ZodString;
1368
+ type: z.ZodLiteral<"textPart">;
1369
+ text: z.ZodString;
1370
+ }, z.core.$strip>, z.ZodObject<{
1371
+ id: z.ZodString;
1372
+ type: z.ZodLiteral<"imageUrlPart">;
1373
+ url: z.ZodURL;
1374
+ mimeType: z.ZodString;
1375
+ }, z.core.$strip>, z.ZodObject<{
1376
+ id: z.ZodString;
1377
+ type: z.ZodLiteral<"imageInlinePart">;
1378
+ encodedData: z.ZodString;
1379
+ mimeType: z.ZodString;
1380
+ }, z.core.$strip>, z.ZodObject<{
1381
+ id: z.ZodString;
1382
+ type: z.ZodLiteral<"imageBinaryPart">;
1383
+ data: z.ZodString;
1384
+ mimeType: z.ZodString;
1385
+ }, z.core.$strip>, z.ZodObject<{
1386
+ id: z.ZodString;
1387
+ type: z.ZodLiteral<"fileUrlPart">;
1388
+ url: z.ZodString;
1389
+ mimeType: z.ZodString;
1390
+ }, z.core.$strip>, z.ZodObject<{
1391
+ id: z.ZodString;
1392
+ type: z.ZodLiteral<"fileInlinePart">;
1393
+ encodedData: z.ZodString;
1394
+ mimeType: z.ZodString;
1395
+ }, z.core.$strip>, z.ZodObject<{
1396
+ id: z.ZodString;
1397
+ type: z.ZodLiteral<"fileBinaryPart">;
1398
+ data: z.ZodString;
1399
+ mimeType: z.ZodString;
1400
+ }, z.core.$strip>]>>;
1401
+ cache: z.ZodOptional<z.ZodBoolean>;
1402
+ }, z.core.$strip>, z.ZodObject<{
1403
+ id: z.ZodString;
1404
+ type: z.ZodLiteral<"expertMessage">;
1405
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1406
+ id: z.ZodString;
1407
+ type: z.ZodLiteral<"textPart">;
1408
+ text: z.ZodString;
1409
+ }, z.core.$strip>, z.ZodObject<{
1410
+ id: z.ZodString;
1411
+ type: z.ZodLiteral<"toolCallPart">;
1412
+ toolCallId: z.ZodString;
1413
+ toolName: z.ZodString;
1414
+ args: z.ZodUnknown;
1415
+ }, z.core.$strip>]>>;
1416
+ cache: z.ZodOptional<z.ZodBoolean>;
1417
+ }, z.core.$strip>, z.ZodObject<{
1418
+ id: z.ZodString;
1419
+ type: z.ZodLiteral<"toolMessage">;
1420
+ contents: z.ZodArray<z.ZodObject<{
1421
+ id: z.ZodString;
1422
+ type: z.ZodLiteral<"toolResultPart">;
1423
+ toolCallId: z.ZodString;
1424
+ toolName: z.ZodString;
1425
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1426
+ id: z.ZodString;
1427
+ type: z.ZodLiteral<"textPart">;
1428
+ text: z.ZodString;
1429
+ }, z.core.$strip>, z.ZodObject<{
1430
+ id: z.ZodString;
1431
+ type: z.ZodLiteral<"imageInlinePart">;
1432
+ encodedData: z.ZodString;
1433
+ mimeType: z.ZodString;
1434
+ }, z.core.$strip>]>>;
1435
+ isError: z.ZodOptional<z.ZodBoolean>;
1436
+ }, z.core.$strip>>;
1437
+ cache: z.ZodOptional<z.ZodBoolean>;
1438
+ }, z.core.$strip>]>>;
1439
+ expert: z.ZodObject<{
1440
+ key: z.ZodString;
1441
+ name: z.ZodString;
1442
+ version: z.ZodString;
1443
+ }, z.core.$strip>;
1444
+ delegateTo: z.ZodOptional<z.ZodObject<{
1445
+ expert: z.ZodObject<{
1446
+ key: z.ZodString;
1447
+ name: z.ZodString;
1448
+ version: z.ZodString;
1449
+ }, z.core.$strip>;
1450
+ toolCallId: z.ZodString;
1451
+ toolName: z.ZodString;
1452
+ query: z.ZodString;
1453
+ }, z.core.$strip>>;
1454
+ delegatedBy: z.ZodOptional<z.ZodObject<{
1455
+ expert: z.ZodObject<{
1456
+ key: z.ZodString;
1457
+ name: z.ZodString;
1458
+ version: z.ZodString;
1459
+ }, z.core.$strip>;
1460
+ toolCallId: z.ZodString;
1461
+ toolName: z.ZodString;
1462
+ checkpointId: z.ZodString;
1463
+ }, z.core.$strip>>;
1464
+ usage: z.ZodObject<{
1465
+ inputTokens: z.ZodNumber;
1466
+ outputTokens: z.ZodNumber;
1467
+ reasoningTokens: z.ZodNumber;
1468
+ totalTokens: z.ZodNumber;
1469
+ cachedInputTokens: z.ZodNumber;
1470
+ }, z.core.$strip>;
1471
+ contextWindow: z.ZodOptional<z.ZodNumber>;
1472
+ contextWindowUsage: z.ZodOptional<z.ZodNumber>;
1473
+ }, z.core.$strip>>;
1474
+ }, z.core.$strip>;
1475
+ type RunParamsInput = z.input<typeof runParamsSchema>;
1476
+ type RunParams = z.output<typeof runParamsSchema>;
1477
+ type RunSetting = z.infer<typeof runParamsSchema.shape.setting>;
1478
+ type RunInput = z.infer<typeof runParamsSchema.shape.setting.shape.input>;
1479
+ /**
1480
+ * ExpertEvents can only contain deeply serializable properties.
1481
+ * This is important because these events are serialized using JSON.stringify() and stored in Cassandra,
1482
+ * and later used to restore state when resuming execution. Non-serializable properties would cause
1483
+ * issues during serialization/deserialization process.
1484
+ */
1485
+ type ExpertEventPayloads = {
1486
+ startRun: {
1487
+ initialCheckpoint: Checkpoint;
1488
+ inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1489
+ };
1490
+ startGeneration: {
1491
+ messages: Message[];
1492
+ };
1493
+ retry: {
1494
+ reason: string;
1495
+ newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1496
+ toolCall?: ToolCall;
1497
+ toolResult?: ToolResult;
1498
+ usage: Usage;
1499
+ };
1500
+ callTool: {
1501
+ newMessage: ExpertMessage;
1502
+ toolCall: ToolCall;
1503
+ usage: Usage;
1504
+ };
1505
+ callInteractiveTool: {
1506
+ newMessage: ExpertMessage;
1507
+ toolCall: ToolCall;
1508
+ usage: Usage;
1509
+ };
1510
+ callDelegate: {
1511
+ newMessage: ExpertMessage;
1512
+ toolCall: ToolCall;
1513
+ usage: Usage;
1514
+ };
1515
+ resolveToolResult: {
1516
+ toolResult: ToolResult;
1517
+ };
1518
+ resolveThought: {
1519
+ toolResult: ToolResult;
1520
+ };
1521
+ resolvePdfFile: {
1522
+ toolResult: ToolResult;
1523
+ };
1524
+ resolveImageFile: {
1525
+ toolResult: ToolResult;
1526
+ };
1527
+ attemptCompletion: {
1528
+ toolResult: ToolResult;
1529
+ };
1530
+ finishToolCall: {
1531
+ newMessages: (UserMessage | ToolMessage)[];
1532
+ };
1533
+ continueToNextStep: {
1534
+ checkpoint: Checkpoint;
1535
+ step: Step;
1536
+ nextCheckpoint: Checkpoint;
1537
+ };
1538
+ stopRunByInteractiveTool: {
1539
+ checkpoint: Checkpoint;
1540
+ step: Step;
1541
+ };
1542
+ stopRunByDelegate: {
1543
+ checkpoint: Checkpoint;
1544
+ step: Step;
1545
+ };
1546
+ stopRunByExceededMaxSteps: {
1547
+ checkpoint: Checkpoint;
1548
+ step: Step;
1549
+ };
1550
+ completeRun: {
1551
+ checkpoint: Checkpoint;
1552
+ step: Step;
1553
+ text: string;
1554
+ usage: Usage;
1555
+ };
1556
+ };
1557
+ type BaseEvent = {
1558
+ id: string;
1559
+ expertKey: string;
1560
+ timestamp: number;
1561
+ runId: string;
1562
+ stepNumber: number;
1563
+ };
1564
+ type EventType = keyof ExpertEventPayloads;
1565
+ type RunEvent = {
1566
+ [K in EventType]: BaseEvent & {
1567
+ type: K;
1568
+ } & ExpertEventPayloads[K];
1569
+ }[EventType];
1570
+ type EventForType<T extends EventType> = Extract<RunEvent, {
1571
+ type: T;
1572
+ }>;
1573
+ declare function createEvent<T extends EventType>(type: T): (setting: RunSetting, checkpoint: Checkpoint, data: Omit<EventForType<T>, "type" | "id" | "expertKey" | "timestamp" | "runId" | "stepNumber">) => EventForType<T>;
1574
+ declare const startRun: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1575
+ type: "startRun";
1576
+ } & {
1577
+ initialCheckpoint: Checkpoint;
1578
+ inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1579
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1580
+ type: "startRun";
1581
+ } & {
1582
+ initialCheckpoint: Checkpoint;
1583
+ inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1584
+ };
1585
+ declare const startGeneration: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1586
+ type: "startGeneration";
1587
+ } & {
1588
+ messages: Message[];
1589
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1590
+ type: "startGeneration";
1591
+ } & {
1592
+ messages: Message[];
1593
+ };
1594
+ declare const retry: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1595
+ type: "retry";
1596
+ } & {
1597
+ reason: string;
1598
+ newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1599
+ toolCall?: ToolCall;
1600
+ toolResult?: ToolResult;
1601
+ usage: Usage;
1602
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1603
+ type: "retry";
1604
+ } & {
1605
+ reason: string;
1606
+ newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1607
+ toolCall?: ToolCall;
1608
+ toolResult?: ToolResult;
1609
+ usage: Usage;
1610
+ };
1611
+ declare const callTool: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1612
+ type: "callTool";
1613
+ } & {
1614
+ newMessage: ExpertMessage;
1615
+ toolCall: ToolCall;
1616
+ usage: Usage;
1617
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1618
+ type: "callTool";
1619
+ } & {
1620
+ newMessage: ExpertMessage;
1621
+ toolCall: ToolCall;
1622
+ usage: Usage;
1623
+ };
1624
+ declare const callInteractiveTool: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1625
+ type: "callInteractiveTool";
1626
+ } & {
1627
+ newMessage: ExpertMessage;
1628
+ toolCall: ToolCall;
1629
+ usage: Usage;
1630
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1631
+ type: "callInteractiveTool";
1632
+ } & {
1633
+ newMessage: ExpertMessage;
1634
+ toolCall: ToolCall;
1635
+ usage: Usage;
1636
+ };
1637
+ declare const callDelegate: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1638
+ type: "callDelegate";
1639
+ } & {
1640
+ newMessage: ExpertMessage;
1641
+ toolCall: ToolCall;
1642
+ usage: Usage;
1643
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1644
+ type: "callDelegate";
1645
+ } & {
1646
+ newMessage: ExpertMessage;
1647
+ toolCall: ToolCall;
1648
+ usage: Usage;
1649
+ };
1650
+ declare const resolveToolResult: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1651
+ type: "resolveToolResult";
1652
+ } & {
1653
+ toolResult: ToolResult;
1654
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1655
+ type: "resolveToolResult";
1656
+ } & {
1657
+ toolResult: ToolResult;
1658
+ };
1659
+ declare const resolveThought: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1660
+ type: "resolveThought";
1661
+ } & {
1662
+ toolResult: ToolResult;
1663
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1664
+ type: "resolveThought";
1665
+ } & {
1666
+ toolResult: ToolResult;
1667
+ };
1668
+ declare const resolvePdfFile: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1669
+ type: "resolvePdfFile";
1670
+ } & {
1671
+ toolResult: ToolResult;
1672
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1673
+ type: "resolvePdfFile";
1674
+ } & {
1675
+ toolResult: ToolResult;
1676
+ };
1677
+ declare const resolveImageFile: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1678
+ type: "resolveImageFile";
1679
+ } & {
1680
+ toolResult: ToolResult;
1681
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1682
+ type: "resolveImageFile";
1683
+ } & {
1684
+ toolResult: ToolResult;
1685
+ };
1686
+ declare const attemptCompletion: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1687
+ type: "attemptCompletion";
1688
+ } & {
1689
+ toolResult: ToolResult;
1690
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1691
+ type: "attemptCompletion";
1692
+ } & {
1693
+ toolResult: ToolResult;
1694
+ };
1695
+ declare const finishToolCall: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1696
+ type: "finishToolCall";
1697
+ } & {
1698
+ newMessages: (UserMessage | ToolMessage)[];
1699
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1700
+ type: "finishToolCall";
1701
+ } & {
1702
+ newMessages: (UserMessage | ToolMessage)[];
1703
+ };
1704
+ declare const completeRun: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1705
+ type: "completeRun";
1706
+ } & {
1707
+ checkpoint: Checkpoint;
1708
+ step: Step;
1709
+ text: string;
1710
+ usage: Usage;
1711
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1712
+ type: "completeRun";
1713
+ } & {
1714
+ checkpoint: Checkpoint;
1715
+ step: Step;
1716
+ text: string;
1717
+ usage: Usage;
1718
+ };
1719
+ declare const stopRunByInteractiveTool: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1720
+ type: "stopRunByInteractiveTool";
1721
+ } & {
1722
+ checkpoint: Checkpoint;
1723
+ step: Step;
1724
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1725
+ type: "stopRunByInteractiveTool";
1726
+ } & {
1727
+ checkpoint: Checkpoint;
1728
+ step: Step;
1729
+ };
1730
+ declare const stopRunByDelegate: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1731
+ type: "stopRunByDelegate";
1732
+ } & {
1733
+ checkpoint: Checkpoint;
1734
+ step: Step;
1735
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1736
+ type: "stopRunByDelegate";
1737
+ } & {
1738
+ checkpoint: Checkpoint;
1739
+ step: Step;
1740
+ };
1741
+ declare const stopRunByExceededMaxSteps: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1742
+ type: "stopRunByExceededMaxSteps";
1743
+ } & {
1744
+ checkpoint: Checkpoint;
1745
+ step: Step;
1746
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1747
+ type: "stopRunByExceededMaxSteps";
1748
+ } & {
1749
+ checkpoint: Checkpoint;
1750
+ step: Step;
1751
+ };
1752
+ declare const continueToNextStep: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1753
+ type: "continueToNextStep";
1754
+ } & {
1755
+ checkpoint: Checkpoint;
1756
+ step: Step;
1757
+ nextCheckpoint: Checkpoint;
1758
+ }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1759
+ type: "continueToNextStep";
1760
+ } & {
1761
+ checkpoint: Checkpoint;
1762
+ step: Step;
1763
+ nextCheckpoint: Checkpoint;
1764
+ };
1765
+
1766
+ declare const mcpStdioSkillSchema: z.ZodObject<{
1767
+ type: z.ZodLiteral<"mcpStdioSkill">;
1768
+ name: z.ZodString;
1769
+ description: z.ZodOptional<z.ZodString>;
1770
+ rule: z.ZodOptional<z.ZodString>;
1771
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1772
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1773
+ command: z.ZodString;
1774
+ packageName: z.ZodOptional<z.ZodString>;
1775
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1776
+ requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1777
+ }, z.core.$strip>;
1778
+ type McpStdioSkill = z.infer<typeof mcpStdioSkillSchema>;
1779
+ declare const mcpSseSkillSchema: z.ZodObject<{
1780
+ type: z.ZodLiteral<"mcpSseSkill">;
1781
+ name: z.ZodString;
1782
+ description: z.ZodOptional<z.ZodString>;
1783
+ rule: z.ZodOptional<z.ZodString>;
1784
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1785
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1786
+ endpoint: z.ZodString;
1787
+ }, z.core.$strip>;
1788
+ type McpSseSkill = z.infer<typeof mcpSseSkillSchema>;
1789
+ declare const interactiveToolSchema: z.ZodObject<{
1790
+ name: z.ZodString;
1791
+ description: z.ZodOptional<z.ZodString>;
1792
+ inputJsonSchema: z.ZodString;
1793
+ }, z.core.$strip>;
1794
+ type InteractiveTool = z.infer<typeof interactiveToolSchema>;
1795
+ declare const interactiveSkillSchema: z.ZodObject<{
1796
+ type: z.ZodLiteral<"interactiveSkill">;
1797
+ name: z.ZodString;
1798
+ description: z.ZodOptional<z.ZodString>;
1799
+ rule: z.ZodOptional<z.ZodString>;
1800
+ tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
1801
+ description: z.ZodOptional<z.ZodString>;
1802
+ inputJsonSchema: z.ZodString;
1803
+ }, z.core.$strip>>, z.ZodTransform<{
1804
+ [k: string]: {
1805
+ name: string;
1806
+ inputJsonSchema: string;
1807
+ description?: string | undefined;
1808
+ };
1809
+ }, Record<string, {
1810
+ inputJsonSchema: string;
1811
+ description?: string | undefined;
1812
+ }>>>;
1813
+ }, z.core.$strip>;
1814
+ type InteractiveSkill = z.infer<typeof interactiveSkillSchema>;
1815
+ declare const skillSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1816
+ type: z.ZodLiteral<"mcpStdioSkill">;
1817
+ name: z.ZodString;
1818
+ description: z.ZodOptional<z.ZodString>;
1819
+ rule: z.ZodOptional<z.ZodString>;
1820
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1821
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1822
+ command: z.ZodString;
1823
+ packageName: z.ZodOptional<z.ZodString>;
1824
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1825
+ requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1826
+ }, z.core.$strip>, z.ZodObject<{
1827
+ type: z.ZodLiteral<"mcpSseSkill">;
1828
+ name: z.ZodString;
1829
+ description: z.ZodOptional<z.ZodString>;
1830
+ rule: z.ZodOptional<z.ZodString>;
1831
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1832
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1833
+ endpoint: z.ZodString;
1834
+ }, z.core.$strip>, z.ZodObject<{
1835
+ type: z.ZodLiteral<"interactiveSkill">;
1836
+ name: z.ZodString;
1837
+ description: z.ZodOptional<z.ZodString>;
1838
+ rule: z.ZodOptional<z.ZodString>;
1839
+ tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
1840
+ description: z.ZodOptional<z.ZodString>;
1841
+ inputJsonSchema: z.ZodString;
1842
+ }, z.core.$strip>>, z.ZodTransform<{
1843
+ [k: string]: {
1844
+ name: string;
1845
+ inputJsonSchema: string;
1846
+ description?: string | undefined;
1847
+ };
1848
+ }, Record<string, {
1849
+ inputJsonSchema: string;
1850
+ description?: string | undefined;
1851
+ }>>>;
1852
+ }, z.core.$strip>], "type">;
1853
+ type Skill = z.infer<typeof skillSchema>;
1854
+
1855
+ type SkillType = "mcp" | "interactive" | "delegate";
1856
+ interface McpSkillManagerParams {
1857
+ type: "mcp";
1858
+ skill: McpStdioSkill | McpSseSkill;
1859
+ env: Record<string, string>;
1860
+ }
1861
+ interface InteractiveSkillManagerParams {
1862
+ type: "interactive";
1863
+ interactiveSkill: InteractiveSkill;
1864
+ }
1865
+ interface DelegateSkillManagerParams {
1866
+ type: "delegate";
1867
+ expert: Expert;
1868
+ }
1869
+ type SkillManagerParams = McpSkillManagerParams | InteractiveSkillManagerParams | DelegateSkillManagerParams;
1870
+ interface ToolDefinition {
1871
+ skillName: string;
1872
+ name: string;
1873
+ description?: string;
1874
+ inputSchema: {
1875
+ [k: string]: unknown;
1876
+ };
1877
+ interactive: boolean;
1878
+ }
1879
+ type CallToolResultContent = {
1880
+ type: "text" | "image" | "resource";
1881
+ text?: string;
1882
+ data?: string;
1883
+ mimeType?: string;
1884
+ resource?: Resource;
1885
+ };
1886
+ type Resource = {
1887
+ mimeType?: string;
1888
+ text?: string;
1889
+ blob?: string;
1890
+ };
1891
+
1892
+ declare const knownModels: {
1893
+ provider: string;
1894
+ models: {
1895
+ name: string;
1896
+ contextWindow: number;
1897
+ maxOutputTokens: number;
1898
+ }[];
1899
+ }[];
1900
+
1901
+ export { type AmazonBedrockProviderConfig, type AnthropicProviderConfig, type AzureOpenAiProviderConfig, type BasePart, type CallToolResultContent, type Checkpoint, type CheckpointStatus, type DelegateSkillManagerParams, type EventForType, type EventType, type Expert, type ExpertMessage, type FileBinaryPart, type FileInlinePart, type FileUrlPart, type GoogleGenerativeAiProviderConfig, type ImageBinaryPart, type ImageInlinePart, type ImageUrlPart, type InstructionMessage, type InteractiveSkill, type InteractiveSkillManagerParams, type InteractiveTool, type McpSkillManagerParams, type McpSseSkill, type McpStdioSkill, type Message, type MessagePart, type OllamaProviderConfig, type OpenAiProviderConfig, type PerstackConfig, type ProviderConfig, type ProviderName, type Resource, type RunCommandInput, type RunEvent, type RunInput, type RunParams, type RunParamsInput, type RunSetting, type Skill, type SkillManagerParams, type SkillType, type Step, type TextPart, type ToolCall, type ToolCallPart, type ToolDefinition, type ToolMessage, type ToolResult, type ToolResultPart, type Usage, type UserMessage, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, attemptCompletion, azureOpenAiProviderConfigSchema, basePartSchema, callDelegate, callInteractiveTool, callTool, checkpointSchema, checkpointStatusSchema, completeRun, continueToNextStep, createEvent, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultTemperature, defaultTimeout, envNameRegex, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileUrlPartSchema, finishToolCall, googleGenerativeAiProviderConfigSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolSchema, knownModels, maxApplicationNameLength, maxCheckpointToolCallIdLength, maxEnvNameLength, maxExpertDelegateItems, maxExpertDescriptionLength, maxExpertInstructionLength, maxExpertJobFileNameLength, maxExpertJobQueryLength, maxExpertKeyLength, maxExpertNameLength, maxExpertSkillItems, maxExpertTagItems, maxExpertVersionTagLength, maxOrganizationNameLength, maxSkillDescriptionLength, maxSkillEndpointLength, maxSkillInputJsonSchemaLength, maxSkillNameLength, maxSkillPickOmitItems, maxSkillRequiredEnvItems, maxSkillRuleLength, maxSkillToolItems, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, organizationNameRegex, packageWithVersionRegex, parseExpertKey, perstackConfigSchema, providerConfigSchema, providerNameSchema, resolveImageFile, resolvePdfFile, resolveThought, resolveToolResult, retry, runCommandInputSchema, runParamsSchema, skillSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, urlSafeRegex, usageSchema, userMessageSchema };