@perstack/runtime 0.0.23 → 0.0.25

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.d.ts CHANGED
@@ -1,1304 +1,8 @@
1
- import { z } from 'zod';
2
1
  import * as xstate from 'xstate';
3
2
  import { SnapshotFrom, ActorRefFrom } from 'xstate';
4
-
5
- /**
6
- * perstack.toml config schema
7
- */
8
- declare const PerstackConfigSchema: z.ZodObject<{
9
- model: z.ZodOptional<z.ZodString>;
10
- temperature: z.ZodOptional<z.ZodNumber>;
11
- maxSteps: z.ZodOptional<z.ZodNumber>;
12
- maxRetries: z.ZodOptional<z.ZodNumber>;
13
- timeout: z.ZodOptional<z.ZodNumber>;
14
- experts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
15
- version: z.ZodOptional<z.ZodString>;
16
- minRuntimeVersion: z.ZodOptional<z.ZodString>;
17
- description: z.ZodOptional<z.ZodString>;
18
- instruction: z.ZodString;
19
- skills: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
20
- type: z.ZodLiteral<"mcpStdioSkill">;
21
- description: z.ZodOptional<z.ZodString>;
22
- rule: z.ZodOptional<z.ZodString>;
23
- pick: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
- omit: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
- command: z.ZodString;
26
- packageName: z.ZodOptional<z.ZodString>;
27
- args: z.ZodOptional<z.ZodArray<z.ZodString>>;
28
- requiredEnv: z.ZodOptional<z.ZodArray<z.ZodString>>;
29
- }, z.core.$strip>, z.ZodObject<{
30
- type: z.ZodLiteral<"mcpSseSkill">;
31
- description: z.ZodOptional<z.ZodString>;
32
- rule: z.ZodOptional<z.ZodString>;
33
- pick: z.ZodOptional<z.ZodArray<z.ZodString>>;
34
- omit: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
- endpoint: z.ZodString;
36
- }, z.core.$strip>, z.ZodObject<{
37
- type: z.ZodLiteral<"interactiveSkill">;
38
- description: z.ZodOptional<z.ZodString>;
39
- rule: z.ZodOptional<z.ZodString>;
40
- tools: z.ZodRecord<z.ZodString, z.ZodObject<{
41
- description: z.ZodOptional<z.ZodString>;
42
- inputJsonSchema: z.ZodString;
43
- }, z.core.$strip>>;
44
- }, z.core.$strip>]>>>;
45
- delegates: z.ZodOptional<z.ZodArray<z.ZodString>>;
46
- }, z.core.$strip>>>;
47
- }, z.core.$strip>;
48
- type PerstackConfig = z.infer<typeof PerstackConfigSchema>;
49
-
50
- declare const TextPartSchema: z.ZodObject<{
51
- id: z.ZodString;
52
- type: z.ZodLiteral<"textPart">;
53
- text: z.ZodString;
54
- }, z.core.$strip>;
55
- type TextPart = z.infer<typeof TextPartSchema>;
56
- declare const ImageUrlPartSchema: z.ZodObject<{
57
- id: z.ZodString;
58
- type: z.ZodLiteral<"imageUrlPart">;
59
- url: z.ZodString;
60
- mimeType: z.ZodString;
61
- }, z.core.$strip>;
62
- type ImageUrlPart = z.infer<typeof ImageUrlPartSchema>;
63
- declare const ImageInlinePartSchema: z.ZodObject<{
64
- id: z.ZodString;
65
- type: z.ZodLiteral<"imageInlinePart">;
66
- encodedData: z.ZodString;
67
- mimeType: z.ZodString;
68
- }, z.core.$strip>;
69
- type ImageInlinePart = z.infer<typeof ImageInlinePartSchema>;
70
- declare const ImageBinaryPartSchema: z.ZodObject<{
71
- id: z.ZodString;
72
- type: z.ZodLiteral<"imageBinaryPart">;
73
- data: z.ZodString;
74
- mimeType: z.ZodString;
75
- }, z.core.$strip>;
76
- type ImageBinaryPart = z.infer<typeof ImageBinaryPartSchema>;
77
- declare const FileUrlPartSchema: z.ZodObject<{
78
- id: z.ZodString;
79
- type: z.ZodLiteral<"fileUrlPart">;
80
- url: z.ZodString;
81
- mimeType: z.ZodString;
82
- }, z.core.$strip>;
83
- type FileUrlPart = z.infer<typeof FileUrlPartSchema>;
84
- declare const FileInlinePartSchema: z.ZodObject<{
85
- id: z.ZodString;
86
- type: z.ZodLiteral<"fileInlinePart">;
87
- encodedData: z.ZodString;
88
- mimeType: z.ZodString;
89
- }, z.core.$strip>;
90
- type FileInlinePart = z.infer<typeof FileInlinePartSchema>;
91
- declare const FileBinaryPartSchema: z.ZodObject<{
92
- id: z.ZodString;
93
- type: z.ZodLiteral<"fileBinaryPart">;
94
- data: z.ZodString;
95
- mimeType: z.ZodString;
96
- }, z.core.$strip>;
97
- type FileBinaryPart = z.infer<typeof FileBinaryPartSchema>;
98
- declare const ToolCallPartSchema: z.ZodObject<{
99
- id: z.ZodString;
100
- type: z.ZodLiteral<"toolCallPart">;
101
- toolCallId: z.ZodString;
102
- toolName: z.ZodString;
103
- args: z.ZodUnknown;
104
- }, z.core.$strip>;
105
- type ToolCallPart = z.infer<typeof ToolCallPartSchema>;
106
- declare const ToolResultPartSchema: z.ZodObject<{
107
- id: z.ZodString;
108
- type: z.ZodLiteral<"toolResultPart">;
109
- toolCallId: z.ZodString;
110
- toolName: z.ZodString;
111
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
112
- id: z.ZodString;
113
- type: z.ZodLiteral<"textPart">;
114
- text: z.ZodString;
115
- }, z.core.$strip>, z.ZodObject<{
116
- id: z.ZodString;
117
- type: z.ZodLiteral<"imageInlinePart">;
118
- encodedData: z.ZodString;
119
- mimeType: z.ZodString;
120
- }, z.core.$strip>]>>;
121
- isError: z.ZodOptional<z.ZodBoolean>;
122
- }, z.core.$strip>;
123
- type ToolResultPart = z.infer<typeof ToolResultPartSchema>;
124
- declare const InstructionMessageSchema: z.ZodObject<{
125
- id: z.ZodString;
126
- type: z.ZodLiteral<"instructionMessage">;
127
- contents: z.ZodArray<z.ZodObject<{
128
- id: z.ZodString;
129
- type: z.ZodLiteral<"textPart">;
130
- text: z.ZodString;
131
- }, z.core.$strip>>;
132
- cache: z.ZodOptional<z.ZodBoolean>;
133
- }, z.core.$strip>;
134
- type InstructionMessage = z.infer<typeof InstructionMessageSchema>;
135
- declare const UserMessageSchema: z.ZodObject<{
136
- id: z.ZodString;
137
- type: z.ZodLiteral<"userMessage">;
138
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
139
- id: z.ZodString;
140
- type: z.ZodLiteral<"textPart">;
141
- text: z.ZodString;
142
- }, z.core.$strip>, z.ZodObject<{
143
- id: z.ZodString;
144
- type: z.ZodLiteral<"imageUrlPart">;
145
- url: z.ZodString;
146
- mimeType: z.ZodString;
147
- }, z.core.$strip>, z.ZodObject<{
148
- id: z.ZodString;
149
- type: z.ZodLiteral<"imageInlinePart">;
150
- encodedData: z.ZodString;
151
- mimeType: z.ZodString;
152
- }, z.core.$strip>, z.ZodObject<{
153
- id: z.ZodString;
154
- type: z.ZodLiteral<"imageBinaryPart">;
155
- data: z.ZodString;
156
- mimeType: z.ZodString;
157
- }, z.core.$strip>, z.ZodObject<{
158
- id: z.ZodString;
159
- type: z.ZodLiteral<"fileUrlPart">;
160
- url: z.ZodString;
161
- mimeType: z.ZodString;
162
- }, z.core.$strip>, z.ZodObject<{
163
- id: z.ZodString;
164
- type: z.ZodLiteral<"fileInlinePart">;
165
- encodedData: z.ZodString;
166
- mimeType: z.ZodString;
167
- }, z.core.$strip>, z.ZodObject<{
168
- id: z.ZodString;
169
- type: z.ZodLiteral<"fileBinaryPart">;
170
- data: z.ZodString;
171
- mimeType: z.ZodString;
172
- }, z.core.$strip>]>>;
173
- cache: z.ZodOptional<z.ZodBoolean>;
174
- }, z.core.$strip>;
175
- type UserMessage = z.infer<typeof UserMessageSchema>;
176
- declare const ExpertMessageSchema: z.ZodObject<{
177
- id: z.ZodString;
178
- type: z.ZodLiteral<"expertMessage">;
179
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
180
- id: z.ZodString;
181
- type: z.ZodLiteral<"textPart">;
182
- text: z.ZodString;
183
- }, z.core.$strip>, z.ZodObject<{
184
- id: z.ZodString;
185
- type: z.ZodLiteral<"toolCallPart">;
186
- toolCallId: z.ZodString;
187
- toolName: z.ZodString;
188
- args: z.ZodUnknown;
189
- }, z.core.$strip>]>>;
190
- cache: z.ZodOptional<z.ZodBoolean>;
191
- }, z.core.$strip>;
192
- type ExpertMessage = z.infer<typeof ExpertMessageSchema>;
193
- declare const ToolMessageSchema: z.ZodObject<{
194
- id: z.ZodString;
195
- type: z.ZodLiteral<"toolMessage">;
196
- contents: z.ZodArray<z.ZodObject<{
197
- id: z.ZodString;
198
- type: z.ZodLiteral<"toolResultPart">;
199
- toolCallId: z.ZodString;
200
- toolName: z.ZodString;
201
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
202
- id: z.ZodString;
203
- type: z.ZodLiteral<"textPart">;
204
- text: z.ZodString;
205
- }, z.core.$strip>, z.ZodObject<{
206
- id: z.ZodString;
207
- type: z.ZodLiteral<"imageInlinePart">;
208
- encodedData: z.ZodString;
209
- mimeType: z.ZodString;
210
- }, z.core.$strip>]>>;
211
- isError: z.ZodOptional<z.ZodBoolean>;
212
- }, z.core.$strip>>;
213
- cache: z.ZodOptional<z.ZodBoolean>;
214
- }, z.core.$strip>;
215
- type ToolMessage = z.infer<typeof ToolMessageSchema>;
216
- declare const MessageSchema: z.ZodUnion<readonly [z.ZodObject<{
217
- id: z.ZodString;
218
- type: z.ZodLiteral<"instructionMessage">;
219
- contents: z.ZodArray<z.ZodObject<{
220
- id: z.ZodString;
221
- type: z.ZodLiteral<"textPart">;
222
- text: z.ZodString;
223
- }, z.core.$strip>>;
224
- cache: z.ZodOptional<z.ZodBoolean>;
225
- }, z.core.$strip>, z.ZodObject<{
226
- id: z.ZodString;
227
- type: z.ZodLiteral<"userMessage">;
228
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
229
- id: z.ZodString;
230
- type: z.ZodLiteral<"textPart">;
231
- text: z.ZodString;
232
- }, z.core.$strip>, z.ZodObject<{
233
- id: z.ZodString;
234
- type: z.ZodLiteral<"imageUrlPart">;
235
- url: z.ZodString;
236
- mimeType: z.ZodString;
237
- }, z.core.$strip>, z.ZodObject<{
238
- id: z.ZodString;
239
- type: z.ZodLiteral<"imageInlinePart">;
240
- encodedData: z.ZodString;
241
- mimeType: z.ZodString;
242
- }, z.core.$strip>, z.ZodObject<{
243
- id: z.ZodString;
244
- type: z.ZodLiteral<"imageBinaryPart">;
245
- data: z.ZodString;
246
- mimeType: z.ZodString;
247
- }, z.core.$strip>, z.ZodObject<{
248
- id: z.ZodString;
249
- type: z.ZodLiteral<"fileUrlPart">;
250
- url: z.ZodString;
251
- mimeType: z.ZodString;
252
- }, z.core.$strip>, z.ZodObject<{
253
- id: z.ZodString;
254
- type: z.ZodLiteral<"fileInlinePart">;
255
- encodedData: z.ZodString;
256
- mimeType: z.ZodString;
257
- }, z.core.$strip>, z.ZodObject<{
258
- id: z.ZodString;
259
- type: z.ZodLiteral<"fileBinaryPart">;
260
- data: z.ZodString;
261
- mimeType: z.ZodString;
262
- }, z.core.$strip>]>>;
263
- cache: z.ZodOptional<z.ZodBoolean>;
264
- }, z.core.$strip>, z.ZodObject<{
265
- id: z.ZodString;
266
- type: z.ZodLiteral<"expertMessage">;
267
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
268
- id: z.ZodString;
269
- type: z.ZodLiteral<"textPart">;
270
- text: z.ZodString;
271
- }, z.core.$strip>, z.ZodObject<{
272
- id: z.ZodString;
273
- type: z.ZodLiteral<"toolCallPart">;
274
- toolCallId: z.ZodString;
275
- toolName: z.ZodString;
276
- args: z.ZodUnknown;
277
- }, z.core.$strip>]>>;
278
- cache: z.ZodOptional<z.ZodBoolean>;
279
- }, z.core.$strip>, z.ZodObject<{
280
- id: z.ZodString;
281
- type: z.ZodLiteral<"toolMessage">;
282
- contents: z.ZodArray<z.ZodObject<{
283
- id: z.ZodString;
284
- type: z.ZodLiteral<"toolResultPart">;
285
- toolCallId: z.ZodString;
286
- toolName: z.ZodString;
287
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
288
- id: z.ZodString;
289
- type: z.ZodLiteral<"textPart">;
290
- text: z.ZodString;
291
- }, z.core.$strip>, z.ZodObject<{
292
- id: z.ZodString;
293
- type: z.ZodLiteral<"imageInlinePart">;
294
- encodedData: z.ZodString;
295
- mimeType: z.ZodString;
296
- }, z.core.$strip>]>>;
297
- isError: z.ZodOptional<z.ZodBoolean>;
298
- }, z.core.$strip>>;
299
- cache: z.ZodOptional<z.ZodBoolean>;
300
- }, z.core.$strip>]>;
301
- type Message = z.infer<typeof MessageSchema>;
302
-
303
- declare const expertNameRegex: RegExp;
304
- declare const versionRegex: RegExp;
305
- declare const tagNameRegex: RegExp;
306
- declare const expertKeyRegex: RegExp;
307
- declare const skillNameRegex: RegExp;
308
- declare const maxNameLength = 214;
309
- declare function parseExpertKey(expertKey: string): {
310
- key: string;
311
- name: string;
312
- version?: string;
313
- tag?: string;
314
- };
315
- declare const McpStdioSkillSchema: z.ZodObject<{
316
- type: z.ZodLiteral<"mcpStdioSkill">;
317
- name: z.ZodString;
318
- description: z.ZodOptional<z.ZodString>;
319
- rule: z.ZodOptional<z.ZodString>;
320
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
321
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
322
- command: z.ZodString;
323
- packageName: z.ZodOptional<z.ZodString>;
324
- args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
325
- requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
326
- }, z.core.$strip>;
327
- type McpStdioSkill = z.infer<typeof McpStdioSkillSchema>;
328
- declare const McpSseSkillSchema: z.ZodObject<{
329
- type: z.ZodLiteral<"mcpSseSkill">;
330
- name: z.ZodString;
331
- description: z.ZodOptional<z.ZodString>;
332
- rule: z.ZodOptional<z.ZodString>;
333
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
334
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
335
- endpoint: z.ZodString;
336
- }, z.core.$strip>;
337
- type McpSseSkill = z.infer<typeof McpSseSkillSchema>;
338
- declare const InteractiveToolSchema: z.ZodObject<{
339
- name: z.ZodString;
340
- description: z.ZodOptional<z.ZodString>;
341
- inputJsonSchema: z.ZodString;
342
- }, z.core.$strip>;
343
- declare const InteractiveSkillSchema: z.ZodObject<{
344
- type: z.ZodLiteral<"interactiveSkill">;
345
- name: z.ZodString;
346
- description: z.ZodOptional<z.ZodString>;
347
- rule: z.ZodOptional<z.ZodString>;
348
- tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
349
- description: z.ZodOptional<z.ZodString>;
350
- inputJsonSchema: z.ZodString;
351
- }, z.core.$strip>>, z.ZodTransform<{
352
- [k: string]: {
353
- name: string;
354
- inputJsonSchema: string;
355
- description?: string | undefined;
356
- };
357
- }, Record<string, {
358
- inputJsonSchema: string;
359
- description?: string | undefined;
360
- }>>>;
361
- }, z.core.$strip>;
362
- type InteractiveSkill = z.infer<typeof InteractiveSkillSchema>;
363
- declare const ExpertSchema: z.ZodObject<{
364
- key: z.ZodString;
365
- name: z.ZodString;
366
- version: z.ZodString;
367
- description: z.ZodOptional<z.ZodString>;
368
- instruction: z.ZodString;
369
- skills: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
370
- type: z.ZodLiteral<"mcpStdioSkill">;
371
- args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
372
- description: z.ZodOptional<z.ZodString>;
373
- rule: z.ZodOptional<z.ZodString>;
374
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
375
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
376
- command: z.ZodString;
377
- packageName: z.ZodOptional<z.ZodString>;
378
- requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
379
- }, z.core.$strip>, z.ZodObject<{
380
- type: z.ZodLiteral<"mcpSseSkill">;
381
- description: z.ZodOptional<z.ZodString>;
382
- rule: z.ZodOptional<z.ZodString>;
383
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
384
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
385
- endpoint: z.ZodString;
386
- }, z.core.$strip>, z.ZodObject<{
387
- type: z.ZodLiteral<"interactiveSkill">;
388
- description: z.ZodOptional<z.ZodString>;
389
- rule: z.ZodOptional<z.ZodString>;
390
- tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
391
- description: z.ZodOptional<z.ZodString>;
392
- inputJsonSchema: z.ZodString;
393
- }, z.core.$strip>>, z.ZodTransform<{
394
- [k: string]: {
395
- name: string;
396
- inputJsonSchema: string;
397
- description?: string | undefined;
398
- };
399
- }, Record<string, {
400
- inputJsonSchema: string;
401
- description?: string | undefined;
402
- }>>>;
403
- }, z.core.$strip>]>>>>, z.ZodTransform<{
404
- [k: string]: {
405
- type: "mcpStdioSkill";
406
- name: string;
407
- pick: string[];
408
- omit: string[];
409
- command: string;
410
- args: string[];
411
- requiredEnv: string[];
412
- description?: string | undefined;
413
- rule?: string | undefined;
414
- packageName?: string | undefined;
415
- } | {
416
- type: "mcpSseSkill";
417
- name: string;
418
- pick: string[];
419
- omit: string[];
420
- endpoint: string;
421
- description?: string | undefined;
422
- rule?: string | undefined;
423
- } | {
424
- type: "interactiveSkill";
425
- name: string;
426
- tools: {
427
- [k: string]: {
428
- name: string;
429
- inputJsonSchema: string;
430
- description?: string | undefined;
431
- };
432
- };
433
- description?: string | undefined;
434
- rule?: string | undefined;
435
- };
436
- }, Record<string, {
437
- type: "mcpStdioSkill";
438
- args: string[];
439
- pick: string[];
440
- omit: string[];
441
- command: string;
442
- requiredEnv: string[];
443
- description?: string | undefined;
444
- rule?: string | undefined;
445
- packageName?: string | undefined;
446
- } | {
447
- type: "mcpSseSkill";
448
- pick: string[];
449
- omit: string[];
450
- endpoint: string;
451
- description?: string | undefined;
452
- rule?: string | undefined;
453
- } | {
454
- type: "interactiveSkill";
455
- tools: {
456
- [k: string]: {
457
- name: string;
458
- inputJsonSchema: string;
459
- description?: string | undefined;
460
- };
461
- };
462
- description?: string | undefined;
463
- rule?: string | undefined;
464
- }>>>;
465
- delegates: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
466
- tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
467
- }, z.core.$strip>;
468
- type Expert = z.infer<typeof ExpertSchema>;
469
- declare const UsageSchema: z.ZodObject<{
470
- promptTokens: z.ZodNumber;
471
- completionTokens: z.ZodNumber;
472
- totalTokens: z.ZodNumber;
473
- cacheCreationInputTokens: z.ZodNumber;
474
- cacheReadInputTokens: z.ZodNumber;
475
- }, z.core.$strip>;
476
- type Usage = z.infer<typeof UsageSchema>;
477
- declare const CheckpointStatusSchema: z.ZodEnum<{
478
- init: "init";
479
- proceeding: "proceeding";
480
- completed: "completed";
481
- stoppedByInteractiveTool: "stoppedByInteractiveTool";
482
- stoppedByDelegate: "stoppedByDelegate";
483
- stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
484
- stoppedByError: "stoppedByError";
485
- }>;
486
- declare const CheckpointSchema: z.ZodObject<{
487
- id: z.ZodString;
488
- runId: z.ZodString;
489
- status: z.ZodEnum<{
490
- init: "init";
491
- proceeding: "proceeding";
492
- completed: "completed";
493
- stoppedByInteractiveTool: "stoppedByInteractiveTool";
494
- stoppedByDelegate: "stoppedByDelegate";
495
- stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
496
- stoppedByError: "stoppedByError";
497
- }>;
498
- stepNumber: z.ZodNumber;
499
- messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
500
- id: z.ZodString;
501
- type: z.ZodLiteral<"instructionMessage">;
502
- contents: z.ZodArray<z.ZodObject<{
503
- id: z.ZodString;
504
- type: z.ZodLiteral<"textPart">;
505
- text: z.ZodString;
506
- }, z.core.$strip>>;
507
- cache: z.ZodOptional<z.ZodBoolean>;
508
- }, z.core.$strip>, z.ZodObject<{
509
- id: z.ZodString;
510
- type: z.ZodLiteral<"userMessage">;
511
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
512
- id: z.ZodString;
513
- type: z.ZodLiteral<"textPart">;
514
- text: z.ZodString;
515
- }, z.core.$strip>, z.ZodObject<{
516
- id: z.ZodString;
517
- type: z.ZodLiteral<"imageUrlPart">;
518
- url: z.ZodString;
519
- mimeType: z.ZodString;
520
- }, z.core.$strip>, z.ZodObject<{
521
- id: z.ZodString;
522
- type: z.ZodLiteral<"imageInlinePart">;
523
- encodedData: z.ZodString;
524
- mimeType: z.ZodString;
525
- }, z.core.$strip>, z.ZodObject<{
526
- id: z.ZodString;
527
- type: z.ZodLiteral<"imageBinaryPart">;
528
- data: z.ZodString;
529
- mimeType: z.ZodString;
530
- }, z.core.$strip>, z.ZodObject<{
531
- id: z.ZodString;
532
- type: z.ZodLiteral<"fileUrlPart">;
533
- url: z.ZodString;
534
- mimeType: z.ZodString;
535
- }, z.core.$strip>, z.ZodObject<{
536
- id: z.ZodString;
537
- type: z.ZodLiteral<"fileInlinePart">;
538
- encodedData: z.ZodString;
539
- mimeType: z.ZodString;
540
- }, z.core.$strip>, z.ZodObject<{
541
- id: z.ZodString;
542
- type: z.ZodLiteral<"fileBinaryPart">;
543
- data: z.ZodString;
544
- mimeType: z.ZodString;
545
- }, z.core.$strip>]>>;
546
- cache: z.ZodOptional<z.ZodBoolean>;
547
- }, z.core.$strip>, z.ZodObject<{
548
- id: z.ZodString;
549
- type: z.ZodLiteral<"expertMessage">;
550
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
551
- id: z.ZodString;
552
- type: z.ZodLiteral<"textPart">;
553
- text: z.ZodString;
554
- }, z.core.$strip>, z.ZodObject<{
555
- id: z.ZodString;
556
- type: z.ZodLiteral<"toolCallPart">;
557
- toolCallId: z.ZodString;
558
- toolName: z.ZodString;
559
- args: z.ZodUnknown;
560
- }, z.core.$strip>]>>;
561
- cache: z.ZodOptional<z.ZodBoolean>;
562
- }, z.core.$strip>, z.ZodObject<{
563
- id: z.ZodString;
564
- type: z.ZodLiteral<"toolMessage">;
565
- contents: z.ZodArray<z.ZodObject<{
566
- id: z.ZodString;
567
- type: z.ZodLiteral<"toolResultPart">;
568
- toolCallId: z.ZodString;
569
- toolName: z.ZodString;
570
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
571
- id: z.ZodString;
572
- type: z.ZodLiteral<"textPart">;
573
- text: z.ZodString;
574
- }, z.core.$strip>, z.ZodObject<{
575
- id: z.ZodString;
576
- type: z.ZodLiteral<"imageInlinePart">;
577
- encodedData: z.ZodString;
578
- mimeType: z.ZodString;
579
- }, z.core.$strip>]>>;
580
- isError: z.ZodOptional<z.ZodBoolean>;
581
- }, z.core.$strip>>;
582
- cache: z.ZodOptional<z.ZodBoolean>;
583
- }, z.core.$strip>]>>;
584
- expert: z.ZodObject<{
585
- key: z.ZodString;
586
- name: z.ZodString;
587
- version: z.ZodString;
588
- }, z.core.$strip>;
589
- delegateTo: z.ZodOptional<z.ZodObject<{
590
- expert: z.ZodObject<{
591
- key: z.ZodString;
592
- name: z.ZodString;
593
- version: z.ZodString;
594
- }, z.core.$strip>;
595
- toolCallId: z.ZodString;
596
- toolName: z.ZodString;
597
- query: z.ZodString;
598
- }, z.core.$strip>>;
599
- delegatedBy: z.ZodOptional<z.ZodObject<{
600
- expert: z.ZodObject<{
601
- key: z.ZodString;
602
- name: z.ZodString;
603
- version: z.ZodString;
604
- }, z.core.$strip>;
605
- toolCallId: z.ZodString;
606
- toolName: z.ZodString;
607
- checkpointId: z.ZodString;
608
- }, z.core.$strip>>;
609
- usage: z.ZodObject<{
610
- promptTokens: z.ZodNumber;
611
- completionTokens: z.ZodNumber;
612
- totalTokens: z.ZodNumber;
613
- cacheCreationInputTokens: z.ZodNumber;
614
- cacheReadInputTokens: z.ZodNumber;
615
- }, z.core.$strip>;
616
- }, z.core.$strip>;
617
- type Checkpoint = z.infer<typeof CheckpointSchema>;
618
- declare const RunParamsSchema: z.ZodObject<{
619
- setting: z.ZodObject<{
620
- runId: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string | undefined>>;
621
- expertKey: z.ZodString;
622
- input: z.ZodObject<{
623
- text: z.ZodOptional<z.ZodString>;
624
- interactiveToolCallResult: z.ZodOptional<z.ZodObject<{
625
- toolCallId: z.ZodString;
626
- toolName: z.ZodString;
627
- text: z.ZodString;
628
- }, z.core.$strip>>;
629
- }, z.core.$strip>;
630
- experts: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
631
- version: z.ZodString;
632
- name: z.ZodString;
633
- description: z.ZodOptional<z.ZodString>;
634
- instruction: z.ZodString;
635
- skills: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
636
- type: z.ZodLiteral<"mcpStdioSkill">;
637
- args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
638
- description: z.ZodOptional<z.ZodString>;
639
- rule: z.ZodOptional<z.ZodString>;
640
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
641
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
642
- command: z.ZodString;
643
- packageName: z.ZodOptional<z.ZodString>;
644
- requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
645
- }, z.core.$strip>, z.ZodObject<{
646
- type: z.ZodLiteral<"mcpSseSkill">;
647
- description: z.ZodOptional<z.ZodString>;
648
- rule: z.ZodOptional<z.ZodString>;
649
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
650
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
651
- endpoint: z.ZodString;
652
- }, z.core.$strip>, z.ZodObject<{
653
- type: z.ZodLiteral<"interactiveSkill">;
654
- description: z.ZodOptional<z.ZodString>;
655
- rule: z.ZodOptional<z.ZodString>;
656
- tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
657
- description: z.ZodOptional<z.ZodString>;
658
- inputJsonSchema: z.ZodString;
659
- }, z.core.$strip>>, z.ZodTransform<{
660
- [k: string]: {
661
- name: string;
662
- inputJsonSchema: string;
663
- description?: string | undefined;
664
- };
665
- }, Record<string, {
666
- inputJsonSchema: string;
667
- description?: string | undefined;
668
- }>>>;
669
- }, z.core.$strip>]>>>>, z.ZodTransform<{
670
- [k: string]: {
671
- type: "mcpStdioSkill";
672
- name: string;
673
- pick: string[];
674
- omit: string[];
675
- command: string;
676
- args: string[];
677
- requiredEnv: string[];
678
- description?: string | undefined;
679
- rule?: string | undefined;
680
- packageName?: string | undefined;
681
- } | {
682
- type: "mcpSseSkill";
683
- name: string;
684
- pick: string[];
685
- omit: string[];
686
- endpoint: string;
687
- description?: string | undefined;
688
- rule?: string | undefined;
689
- } | {
690
- type: "interactiveSkill";
691
- name: string;
692
- tools: {
693
- [k: string]: {
694
- name: string;
695
- inputJsonSchema: string;
696
- description?: string | undefined;
697
- };
698
- };
699
- description?: string | undefined;
700
- rule?: string | undefined;
701
- };
702
- }, Record<string, {
703
- type: "mcpStdioSkill";
704
- args: string[];
705
- pick: string[];
706
- omit: string[];
707
- command: string;
708
- requiredEnv: string[];
709
- description?: string | undefined;
710
- rule?: string | undefined;
711
- packageName?: string | undefined;
712
- } | {
713
- type: "mcpSseSkill";
714
- pick: string[];
715
- omit: string[];
716
- endpoint: string;
717
- description?: string | undefined;
718
- rule?: string | undefined;
719
- } | {
720
- type: "interactiveSkill";
721
- tools: {
722
- [k: string]: {
723
- name: string;
724
- inputJsonSchema: string;
725
- description?: string | undefined;
726
- };
727
- };
728
- description?: string | undefined;
729
- rule?: string | undefined;
730
- }>>>;
731
- delegates: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
732
- tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
733
- }, z.core.$strip>>>>, z.ZodTransform<{
734
- [k: string]: {
735
- key: string;
736
- name: string;
737
- version: string;
738
- instruction: string;
739
- skills: {
740
- [k: string]: {
741
- type: "mcpStdioSkill";
742
- name: string;
743
- pick: string[];
744
- omit: string[];
745
- command: string;
746
- args: string[];
747
- requiredEnv: string[];
748
- description?: string | undefined;
749
- rule?: string | undefined;
750
- packageName?: string | undefined;
751
- } | {
752
- type: "mcpSseSkill";
753
- name: string;
754
- pick: string[];
755
- omit: string[];
756
- endpoint: string;
757
- description?: string | undefined;
758
- rule?: string | undefined;
759
- } | {
760
- type: "interactiveSkill";
761
- name: string;
762
- tools: {
763
- [k: string]: {
764
- name: string;
765
- inputJsonSchema: string;
766
- description?: string | undefined;
767
- };
768
- };
769
- description?: string | undefined;
770
- rule?: string | undefined;
771
- };
772
- };
773
- delegates: string[];
774
- tags: string[];
775
- description?: string | undefined;
776
- };
777
- }, Record<string, {
778
- version: string;
779
- name: string;
780
- instruction: string;
781
- skills: {
782
- [k: string]: {
783
- type: "mcpStdioSkill";
784
- name: string;
785
- pick: string[];
786
- omit: string[];
787
- command: string;
788
- args: string[];
789
- requiredEnv: string[];
790
- description?: string | undefined;
791
- rule?: string | undefined;
792
- packageName?: string | undefined;
793
- } | {
794
- type: "mcpSseSkill";
795
- name: string;
796
- pick: string[];
797
- omit: string[];
798
- endpoint: string;
799
- description?: string | undefined;
800
- rule?: string | undefined;
801
- } | {
802
- type: "interactiveSkill";
803
- name: string;
804
- tools: {
805
- [k: string]: {
806
- name: string;
807
- inputJsonSchema: string;
808
- description?: string | undefined;
809
- };
810
- };
811
- description?: string | undefined;
812
- rule?: string | undefined;
813
- };
814
- };
815
- delegates: string[];
816
- tags: string[];
817
- description?: string | undefined;
818
- }>>>;
819
- model: z.ZodDefault<z.ZodOptional<z.ZodString>>;
820
- temperature: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
821
- maxSteps: z.ZodOptional<z.ZodNumber>;
822
- maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
823
- timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
824
- workspace: z.ZodOptional<z.ZodString>;
825
- startedAt: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
826
- updatedAt: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
827
- }, z.core.$strip>;
828
- checkpoint: z.ZodOptional<z.ZodObject<{
829
- id: z.ZodString;
830
- runId: z.ZodString;
831
- status: z.ZodEnum<{
832
- init: "init";
833
- proceeding: "proceeding";
834
- completed: "completed";
835
- stoppedByInteractiveTool: "stoppedByInteractiveTool";
836
- stoppedByDelegate: "stoppedByDelegate";
837
- stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
838
- stoppedByError: "stoppedByError";
839
- }>;
840
- stepNumber: z.ZodNumber;
841
- messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
842
- id: z.ZodString;
843
- type: z.ZodLiteral<"instructionMessage">;
844
- contents: z.ZodArray<z.ZodObject<{
845
- id: z.ZodString;
846
- type: z.ZodLiteral<"textPart">;
847
- text: z.ZodString;
848
- }, z.core.$strip>>;
849
- cache: z.ZodOptional<z.ZodBoolean>;
850
- }, z.core.$strip>, z.ZodObject<{
851
- id: z.ZodString;
852
- type: z.ZodLiteral<"userMessage">;
853
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
854
- id: z.ZodString;
855
- type: z.ZodLiteral<"textPart">;
856
- text: z.ZodString;
857
- }, z.core.$strip>, z.ZodObject<{
858
- id: z.ZodString;
859
- type: z.ZodLiteral<"imageUrlPart">;
860
- url: z.ZodString;
861
- mimeType: z.ZodString;
862
- }, z.core.$strip>, z.ZodObject<{
863
- id: z.ZodString;
864
- type: z.ZodLiteral<"imageInlinePart">;
865
- encodedData: z.ZodString;
866
- mimeType: z.ZodString;
867
- }, z.core.$strip>, z.ZodObject<{
868
- id: z.ZodString;
869
- type: z.ZodLiteral<"imageBinaryPart">;
870
- data: z.ZodString;
871
- mimeType: z.ZodString;
872
- }, z.core.$strip>, z.ZodObject<{
873
- id: z.ZodString;
874
- type: z.ZodLiteral<"fileUrlPart">;
875
- url: z.ZodString;
876
- mimeType: z.ZodString;
877
- }, z.core.$strip>, z.ZodObject<{
878
- id: z.ZodString;
879
- type: z.ZodLiteral<"fileInlinePart">;
880
- encodedData: z.ZodString;
881
- mimeType: z.ZodString;
882
- }, z.core.$strip>, z.ZodObject<{
883
- id: z.ZodString;
884
- type: z.ZodLiteral<"fileBinaryPart">;
885
- data: z.ZodString;
886
- mimeType: z.ZodString;
887
- }, z.core.$strip>]>>;
888
- cache: z.ZodOptional<z.ZodBoolean>;
889
- }, z.core.$strip>, z.ZodObject<{
890
- id: z.ZodString;
891
- type: z.ZodLiteral<"expertMessage">;
892
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
893
- id: z.ZodString;
894
- type: z.ZodLiteral<"textPart">;
895
- text: z.ZodString;
896
- }, z.core.$strip>, z.ZodObject<{
897
- id: z.ZodString;
898
- type: z.ZodLiteral<"toolCallPart">;
899
- toolCallId: z.ZodString;
900
- toolName: z.ZodString;
901
- args: z.ZodUnknown;
902
- }, z.core.$strip>]>>;
903
- cache: z.ZodOptional<z.ZodBoolean>;
904
- }, z.core.$strip>, z.ZodObject<{
905
- id: z.ZodString;
906
- type: z.ZodLiteral<"toolMessage">;
907
- contents: z.ZodArray<z.ZodObject<{
908
- id: z.ZodString;
909
- type: z.ZodLiteral<"toolResultPart">;
910
- toolCallId: z.ZodString;
911
- toolName: z.ZodString;
912
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
913
- id: z.ZodString;
914
- type: z.ZodLiteral<"textPart">;
915
- text: z.ZodString;
916
- }, z.core.$strip>, z.ZodObject<{
917
- id: z.ZodString;
918
- type: z.ZodLiteral<"imageInlinePart">;
919
- encodedData: z.ZodString;
920
- mimeType: z.ZodString;
921
- }, z.core.$strip>]>>;
922
- isError: z.ZodOptional<z.ZodBoolean>;
923
- }, z.core.$strip>>;
924
- cache: z.ZodOptional<z.ZodBoolean>;
925
- }, z.core.$strip>]>>;
926
- expert: z.ZodObject<{
927
- key: z.ZodString;
928
- name: z.ZodString;
929
- version: z.ZodString;
930
- }, z.core.$strip>;
931
- delegateTo: z.ZodOptional<z.ZodObject<{
932
- expert: z.ZodObject<{
933
- key: z.ZodString;
934
- name: z.ZodString;
935
- version: z.ZodString;
936
- }, z.core.$strip>;
937
- toolCallId: z.ZodString;
938
- toolName: z.ZodString;
939
- query: z.ZodString;
940
- }, z.core.$strip>>;
941
- delegatedBy: z.ZodOptional<z.ZodObject<{
942
- expert: z.ZodObject<{
943
- key: z.ZodString;
944
- name: z.ZodString;
945
- version: z.ZodString;
946
- }, z.core.$strip>;
947
- toolCallId: z.ZodString;
948
- toolName: z.ZodString;
949
- checkpointId: z.ZodString;
950
- }, z.core.$strip>>;
951
- usage: z.ZodObject<{
952
- promptTokens: z.ZodNumber;
953
- completionTokens: z.ZodNumber;
954
- totalTokens: z.ZodNumber;
955
- cacheCreationInputTokens: z.ZodNumber;
956
- cacheReadInputTokens: z.ZodNumber;
957
- }, z.core.$strip>;
958
- }, z.core.$strip>>;
959
- }, z.core.$strip>;
960
- type RunParamsInput = z.input<typeof RunParamsSchema>;
961
- type RunParams = z.output<typeof RunParamsSchema>;
962
- type RunSetting = z.infer<typeof RunParamsSchema.shape.setting>;
963
- type RunInput = z.infer<typeof RunParamsSchema.shape.setting.shape.input>;
964
- type Step = {
965
- stepNumber: number;
966
- inputMessages?: (InstructionMessage | UserMessage | ToolMessage)[];
967
- newMessages: Message[];
968
- toolCall?: ToolCall;
969
- toolResult?: ToolResult;
970
- usage: Usage;
971
- startedAt: number;
972
- finishedAt?: number;
973
- };
974
- type ToolCall = {
975
- id: string;
976
- skillName: string;
977
- toolName: string;
978
- args: Record<string, unknown>;
979
- };
980
- type ToolResult = {
981
- id: string;
982
- skillName: string;
983
- toolName: string;
984
- result: (TextPart | ImageInlinePart | FileInlinePart)[];
985
- };
986
- /**
987
- * ExpertEvents can only contain deeply serializable properties.
988
- * This is important because these events are serialized using JSON.stringify() and stored in Cassandra,
989
- * and later used to restore state when resuming execution. Non-serializable properties would cause
990
- * issues during serialization/deserialization process.
991
- */
992
- type ExpertEventPayloads = {
993
- startRun: {
994
- initialCheckpoint: Checkpoint;
995
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
996
- };
997
- startGeneration: {
998
- messages: Message[];
999
- };
1000
- retry: {
1001
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1002
- toolCall?: ToolCall;
1003
- toolResult?: ToolResult;
1004
- usage: Usage;
1005
- };
1006
- callTool: {
1007
- newMessage: ExpertMessage;
1008
- toolCall: ToolCall;
1009
- usage: Usage;
1010
- };
1011
- callInteractiveTool: {
1012
- newMessage: ExpertMessage;
1013
- toolCall: ToolCall;
1014
- usage: Usage;
1015
- };
1016
- callDelegate: {
1017
- newMessage: ExpertMessage;
1018
- toolCall: ToolCall;
1019
- usage: Usage;
1020
- };
1021
- resolveToolResult: {
1022
- toolResult: ToolResult;
1023
- };
1024
- resolveThought: {
1025
- toolResult: ToolResult;
1026
- };
1027
- resolvePdfFile: {
1028
- toolResult: ToolResult;
1029
- };
1030
- resolveImageFile: {
1031
- toolResult: ToolResult;
1032
- };
1033
- attemptCompletion: {
1034
- toolResult: ToolResult;
1035
- };
1036
- finishToolCall: {
1037
- newMessages: (UserMessage | ToolMessage)[];
1038
- };
1039
- continueToNextStep: {
1040
- checkpoint: Checkpoint;
1041
- step: Step;
1042
- nextCheckpoint: Checkpoint;
1043
- };
1044
- stopRunByInteractiveTool: {
1045
- checkpoint: Checkpoint;
1046
- step: Step;
1047
- };
1048
- stopRunByDelegate: {
1049
- checkpoint: Checkpoint;
1050
- step: Step;
1051
- };
1052
- stopRunByExceededMaxSteps: {
1053
- checkpoint: Checkpoint;
1054
- step: Step;
1055
- };
1056
- completeRun: {
1057
- checkpoint: Checkpoint;
1058
- step: Step;
1059
- text: string;
1060
- usage: Usage;
1061
- };
1062
- };
1063
- type BaseEvent = {
1064
- id: string;
1065
- expertKey: string;
1066
- timestamp: number;
1067
- runId: string;
1068
- stepNumber: number;
1069
- };
1070
- type EventType = keyof ExpertEventPayloads;
1071
- type RunEvent = {
1072
- [K in EventType]: BaseEvent & {
1073
- type: K;
1074
- } & ExpertEventPayloads[K];
1075
- }[EventType];
1076
- type EventForType<T extends EventType> = Extract<RunEvent, {
1077
- type: T;
1078
- }>;
1079
- declare function createEvent<T extends EventType>(type: T): (setting: RunSetting, checkpoint: Checkpoint, data: Omit<EventForType<T>, "type" | "id" | "expertKey" | "timestamp" | "runId" | "stepNumber">) => EventForType<T>;
1080
- declare const startRun: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1081
- type: "startRun";
1082
- } & {
1083
- initialCheckpoint: Checkpoint;
1084
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1085
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1086
- type: "startRun";
1087
- } & {
1088
- initialCheckpoint: Checkpoint;
1089
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1090
- };
1091
- declare const startGeneration: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1092
- type: "startGeneration";
1093
- } & {
1094
- messages: Message[];
1095
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1096
- type: "startGeneration";
1097
- } & {
1098
- messages: Message[];
1099
- };
1100
- declare const retry: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1101
- type: "retry";
1102
- } & {
1103
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1104
- toolCall?: ToolCall;
1105
- toolResult?: ToolResult;
1106
- usage: Usage;
1107
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1108
- type: "retry";
1109
- } & {
1110
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1111
- toolCall?: ToolCall;
1112
- toolResult?: ToolResult;
1113
- usage: Usage;
1114
- };
1115
- declare const callTool: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1116
- type: "callTool";
1117
- } & {
1118
- newMessage: ExpertMessage;
1119
- toolCall: ToolCall;
1120
- usage: Usage;
1121
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1122
- type: "callTool";
1123
- } & {
1124
- newMessage: ExpertMessage;
1125
- toolCall: ToolCall;
1126
- usage: Usage;
1127
- };
1128
- declare const callInteractiveTool: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1129
- type: "callInteractiveTool";
1130
- } & {
1131
- newMessage: ExpertMessage;
1132
- toolCall: ToolCall;
1133
- usage: Usage;
1134
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1135
- type: "callInteractiveTool";
1136
- } & {
1137
- newMessage: ExpertMessage;
1138
- toolCall: ToolCall;
1139
- usage: Usage;
1140
- };
1141
- declare const callDelegate: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1142
- type: "callDelegate";
1143
- } & {
1144
- newMessage: ExpertMessage;
1145
- toolCall: ToolCall;
1146
- usage: Usage;
1147
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1148
- type: "callDelegate";
1149
- } & {
1150
- newMessage: ExpertMessage;
1151
- toolCall: ToolCall;
1152
- usage: Usage;
1153
- };
1154
- declare const resolveToolResult: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1155
- type: "resolveToolResult";
1156
- } & {
1157
- toolResult: ToolResult;
1158
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1159
- type: "resolveToolResult";
1160
- } & {
1161
- toolResult: ToolResult;
1162
- };
1163
- declare const resolveThought: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1164
- type: "resolveThought";
1165
- } & {
1166
- toolResult: ToolResult;
1167
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1168
- type: "resolveThought";
1169
- } & {
1170
- toolResult: ToolResult;
1171
- };
1172
- declare const resolvePdfFile: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1173
- type: "resolvePdfFile";
1174
- } & {
1175
- toolResult: ToolResult;
1176
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1177
- type: "resolvePdfFile";
1178
- } & {
1179
- toolResult: ToolResult;
1180
- };
1181
- declare const resolveImageFile: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1182
- type: "resolveImageFile";
1183
- } & {
1184
- toolResult: ToolResult;
1185
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1186
- type: "resolveImageFile";
1187
- } & {
1188
- toolResult: ToolResult;
1189
- };
1190
- declare const attemptCompletion: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1191
- type: "attemptCompletion";
1192
- } & {
1193
- toolResult: ToolResult;
1194
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1195
- type: "attemptCompletion";
1196
- } & {
1197
- toolResult: ToolResult;
1198
- };
1199
- declare const finishToolCall: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1200
- type: "finishToolCall";
1201
- } & {
1202
- newMessages: (UserMessage | ToolMessage)[];
1203
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1204
- type: "finishToolCall";
1205
- } & {
1206
- newMessages: (UserMessage | ToolMessage)[];
1207
- };
1208
- declare const completeRun: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1209
- type: "completeRun";
1210
- } & {
1211
- checkpoint: Checkpoint;
1212
- step: Step;
1213
- text: string;
1214
- usage: Usage;
1215
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1216
- type: "completeRun";
1217
- } & {
1218
- checkpoint: Checkpoint;
1219
- step: Step;
1220
- text: string;
1221
- usage: Usage;
1222
- };
1223
- declare const stopRunByInteractiveTool: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1224
- type: "stopRunByInteractiveTool";
1225
- } & {
1226
- checkpoint: Checkpoint;
1227
- step: Step;
1228
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1229
- type: "stopRunByInteractiveTool";
1230
- } & {
1231
- checkpoint: Checkpoint;
1232
- step: Step;
1233
- };
1234
- declare const stopRunByDelegate: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1235
- type: "stopRunByDelegate";
1236
- } & {
1237
- checkpoint: Checkpoint;
1238
- step: Step;
1239
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1240
- type: "stopRunByDelegate";
1241
- } & {
1242
- checkpoint: Checkpoint;
1243
- step: Step;
1244
- };
1245
- declare const stopRunByExceededMaxSteps: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1246
- type: "stopRunByExceededMaxSteps";
1247
- } & {
1248
- checkpoint: Checkpoint;
1249
- step: Step;
1250
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1251
- type: "stopRunByExceededMaxSteps";
1252
- } & {
1253
- checkpoint: Checkpoint;
1254
- step: Step;
1255
- };
1256
- declare const continueToNextStep: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1257
- type: "continueToNextStep";
1258
- } & {
1259
- checkpoint: Checkpoint;
1260
- step: Step;
1261
- nextCheckpoint: Checkpoint;
1262
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1263
- type: "continueToNextStep";
1264
- } & {
1265
- checkpoint: Checkpoint;
1266
- step: Step;
1267
- nextCheckpoint: Checkpoint;
1268
- };
1269
-
1270
- declare function run(runInput: RunParamsInput, options?: {
1271
- shouldContinueRun?: (setting: RunSetting, checkpoint: Checkpoint, step: Step) => Promise<boolean>;
1272
- retrieveCheckpoint?: (checkpointId: string) => Promise<Checkpoint>;
1273
- storeCheckpoint?: (checkpoint: Checkpoint, timestamp: number) => Promise<void>;
1274
- eventListener?: (event: RunEvent) => Promise<void>;
1275
- }): Promise<Checkpoint>;
1276
- declare function getRunDir(runId: string): string;
1277
- declare function parseConfig(config: string): Promise<PerstackConfig>;
1278
-
1279
- type SkillType = "mcp" | "interactive" | "delegate";
1280
- interface McpSkillManagerParams {
1281
- type: "mcp";
1282
- skill: McpStdioSkill | McpSseSkill;
1283
- }
1284
- interface InteractiveSkillManagerParams {
1285
- type: "interactive";
1286
- interactiveSkill: InteractiveSkill;
1287
- }
1288
- interface DelegateSkillManagerParams {
1289
- type: "delegate";
1290
- expert: Expert;
1291
- }
1292
- type SkillManagerParams = McpSkillManagerParams | InteractiveSkillManagerParams | DelegateSkillManagerParams;
1293
- interface ToolDefinition {
1294
- skillName: string;
1295
- name: string;
1296
- description?: string;
1297
- inputSchema: {
1298
- [k: string]: unknown;
1299
- };
1300
- interactive: boolean;
1301
- }
3
+ import * as _perstack_core from '@perstack/core';
4
+ import { ToolDefinition, SkillType, McpStdioSkill, McpSseSkill, InteractiveSkill, Expert, SkillManagerParams, TextPart, ImageInlinePart, FileInlinePart, RunSetting, Step, Checkpoint, RunEvent, RunParamsInput, ProviderConfig, ProviderName, Usage } from '@perstack/core';
5
+ import { LanguageModel } from 'ai';
1302
6
 
1303
7
  declare class SkillManager {
1304
8
  protected _toolDefinitions: ToolDefinition[];
@@ -1310,6 +14,7 @@ declare class SkillManager {
1310
14
  readonly expert?: Expert;
1311
15
  private _mcpClient?;
1312
16
  private _params;
17
+ private _env;
1313
18
  constructor(params: SkillManagerParams);
1314
19
  init(): Promise<void>;
1315
20
  private _initMcpSkill;
@@ -1341,7 +46,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1341
46
  type: "startRun";
1342
47
  } & {
1343
48
  initialCheckpoint: Checkpoint;
1344
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
49
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1345
50
  }) | ({
1346
51
  id: string;
1347
52
  expertKey: string;
@@ -1351,7 +56,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1351
56
  } & {
1352
57
  type: "startGeneration";
1353
58
  } & {
1354
- messages: Message[];
59
+ messages: _perstack_core.Message[];
1355
60
  }) | ({
1356
61
  id: string;
1357
62
  expertKey: string;
@@ -1361,10 +66,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1361
66
  } & {
1362
67
  type: "retry";
1363
68
  } & {
1364
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1365
- toolCall?: ToolCall;
1366
- toolResult?: ToolResult;
1367
- usage: Usage;
69
+ reason: string;
70
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
71
+ toolCall?: _perstack_core.ToolCall;
72
+ toolResult?: _perstack_core.ToolResult;
73
+ usage: _perstack_core.Usage;
1368
74
  }) | ({
1369
75
  id: string;
1370
76
  expertKey: string;
@@ -1374,9 +80,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1374
80
  } & {
1375
81
  type: "callTool";
1376
82
  } & {
1377
- newMessage: ExpertMessage;
1378
- toolCall: ToolCall;
1379
- usage: Usage;
83
+ newMessage: _perstack_core.ExpertMessage;
84
+ toolCall: _perstack_core.ToolCall;
85
+ usage: _perstack_core.Usage;
1380
86
  }) | ({
1381
87
  id: string;
1382
88
  expertKey: string;
@@ -1386,9 +92,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1386
92
  } & {
1387
93
  type: "callInteractiveTool";
1388
94
  } & {
1389
- newMessage: ExpertMessage;
1390
- toolCall: ToolCall;
1391
- usage: Usage;
95
+ newMessage: _perstack_core.ExpertMessage;
96
+ toolCall: _perstack_core.ToolCall;
97
+ usage: _perstack_core.Usage;
1392
98
  }) | ({
1393
99
  id: string;
1394
100
  expertKey: string;
@@ -1398,9 +104,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1398
104
  } & {
1399
105
  type: "callDelegate";
1400
106
  } & {
1401
- newMessage: ExpertMessage;
1402
- toolCall: ToolCall;
1403
- usage: Usage;
107
+ newMessage: _perstack_core.ExpertMessage;
108
+ toolCall: _perstack_core.ToolCall;
109
+ usage: _perstack_core.Usage;
1404
110
  }) | ({
1405
111
  id: string;
1406
112
  expertKey: string;
@@ -1410,7 +116,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1410
116
  } & {
1411
117
  type: "resolveToolResult";
1412
118
  } & {
1413
- toolResult: ToolResult;
119
+ toolResult: _perstack_core.ToolResult;
1414
120
  }) | ({
1415
121
  id: string;
1416
122
  expertKey: string;
@@ -1420,7 +126,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1420
126
  } & {
1421
127
  type: "resolveThought";
1422
128
  } & {
1423
- toolResult: ToolResult;
129
+ toolResult: _perstack_core.ToolResult;
1424
130
  }) | ({
1425
131
  id: string;
1426
132
  expertKey: string;
@@ -1430,7 +136,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1430
136
  } & {
1431
137
  type: "resolvePdfFile";
1432
138
  } & {
1433
- toolResult: ToolResult;
139
+ toolResult: _perstack_core.ToolResult;
1434
140
  }) | ({
1435
141
  id: string;
1436
142
  expertKey: string;
@@ -1440,7 +146,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1440
146
  } & {
1441
147
  type: "resolveImageFile";
1442
148
  } & {
1443
- toolResult: ToolResult;
149
+ toolResult: _perstack_core.ToolResult;
1444
150
  }) | ({
1445
151
  id: string;
1446
152
  expertKey: string;
@@ -1450,7 +156,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1450
156
  } & {
1451
157
  type: "attemptCompletion";
1452
158
  } & {
1453
- toolResult: ToolResult;
159
+ toolResult: _perstack_core.ToolResult;
1454
160
  }) | ({
1455
161
  id: string;
1456
162
  expertKey: string;
@@ -1460,7 +166,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1460
166
  } & {
1461
167
  type: "finishToolCall";
1462
168
  } & {
1463
- newMessages: (UserMessage | ToolMessage)[];
169
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1464
170
  }) | ({
1465
171
  id: string;
1466
172
  expertKey: string;
@@ -1518,7 +224,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1518
224
  checkpoint: Checkpoint;
1519
225
  step: Step;
1520
226
  text: string;
1521
- usage: Usage;
227
+ usage: _perstack_core.Usage;
1522
228
  }), {}, never, never, never, never, "Init" | "PreparingForStep" | "GeneratingToolCall" | "FinishingStep" | "CallingTool" | "CallingInteractiveTool" | "CallingDelegate" | "ResolvingToolResult" | "ResolvingThought" | "ResolvingPdfFile" | "ResolvingImageFile" | "GeneratingRunResult" | "Stopped", string, {
1523
229
  setting: RunSetting;
1524
230
  initialCheckpoint: Checkpoint;
@@ -1560,7 +266,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1560
266
  type: "startRun";
1561
267
  } & {
1562
268
  initialCheckpoint: Checkpoint;
1563
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
269
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1564
270
  }) | ({
1565
271
  id: string;
1566
272
  expertKey: string;
@@ -1570,7 +276,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1570
276
  } & {
1571
277
  type: "startGeneration";
1572
278
  } & {
1573
- messages: Message[];
279
+ messages: _perstack_core.Message[];
1574
280
  }) | ({
1575
281
  id: string;
1576
282
  expertKey: string;
@@ -1580,10 +286,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1580
286
  } & {
1581
287
  type: "retry";
1582
288
  } & {
1583
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1584
- toolCall?: ToolCall;
1585
- toolResult?: ToolResult;
1586
- usage: Usage;
289
+ reason: string;
290
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
291
+ toolCall?: _perstack_core.ToolCall;
292
+ toolResult?: _perstack_core.ToolResult;
293
+ usage: _perstack_core.Usage;
1587
294
  }) | ({
1588
295
  id: string;
1589
296
  expertKey: string;
@@ -1593,9 +300,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1593
300
  } & {
1594
301
  type: "callTool";
1595
302
  } & {
1596
- newMessage: ExpertMessage;
1597
- toolCall: ToolCall;
1598
- usage: Usage;
303
+ newMessage: _perstack_core.ExpertMessage;
304
+ toolCall: _perstack_core.ToolCall;
305
+ usage: _perstack_core.Usage;
1599
306
  }) | ({
1600
307
  id: string;
1601
308
  expertKey: string;
@@ -1605,9 +312,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1605
312
  } & {
1606
313
  type: "callInteractiveTool";
1607
314
  } & {
1608
- newMessage: ExpertMessage;
1609
- toolCall: ToolCall;
1610
- usage: Usage;
315
+ newMessage: _perstack_core.ExpertMessage;
316
+ toolCall: _perstack_core.ToolCall;
317
+ usage: _perstack_core.Usage;
1611
318
  }) | ({
1612
319
  id: string;
1613
320
  expertKey: string;
@@ -1617,9 +324,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1617
324
  } & {
1618
325
  type: "callDelegate";
1619
326
  } & {
1620
- newMessage: ExpertMessage;
1621
- toolCall: ToolCall;
1622
- usage: Usage;
327
+ newMessage: _perstack_core.ExpertMessage;
328
+ toolCall: _perstack_core.ToolCall;
329
+ usage: _perstack_core.Usage;
1623
330
  }) | ({
1624
331
  id: string;
1625
332
  expertKey: string;
@@ -1629,7 +336,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1629
336
  } & {
1630
337
  type: "resolveToolResult";
1631
338
  } & {
1632
- toolResult: ToolResult;
339
+ toolResult: _perstack_core.ToolResult;
1633
340
  }) | ({
1634
341
  id: string;
1635
342
  expertKey: string;
@@ -1639,7 +346,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1639
346
  } & {
1640
347
  type: "resolveThought";
1641
348
  } & {
1642
- toolResult: ToolResult;
349
+ toolResult: _perstack_core.ToolResult;
1643
350
  }) | ({
1644
351
  id: string;
1645
352
  expertKey: string;
@@ -1649,7 +356,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1649
356
  } & {
1650
357
  type: "resolvePdfFile";
1651
358
  } & {
1652
- toolResult: ToolResult;
359
+ toolResult: _perstack_core.ToolResult;
1653
360
  }) | ({
1654
361
  id: string;
1655
362
  expertKey: string;
@@ -1659,7 +366,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1659
366
  } & {
1660
367
  type: "resolveImageFile";
1661
368
  } & {
1662
- toolResult: ToolResult;
369
+ toolResult: _perstack_core.ToolResult;
1663
370
  }) | ({
1664
371
  id: string;
1665
372
  expertKey: string;
@@ -1669,7 +376,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1669
376
  } & {
1670
377
  type: "attemptCompletion";
1671
378
  } & {
1672
- toolResult: ToolResult;
379
+ toolResult: _perstack_core.ToolResult;
1673
380
  }) | ({
1674
381
  id: string;
1675
382
  expertKey: string;
@@ -1679,7 +386,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1679
386
  } & {
1680
387
  type: "finishToolCall";
1681
388
  } & {
1682
- newMessages: (UserMessage | ToolMessage)[];
389
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1683
390
  }) | ({
1684
391
  id: string;
1685
392
  expertKey: string;
@@ -1737,7 +444,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1737
444
  checkpoint: Checkpoint;
1738
445
  step: Step;
1739
446
  text: string;
1740
- usage: Usage;
447
+ usage: _perstack_core.Usage;
1741
448
  }), Record<string, xstate.AnyActorRef | undefined>, xstate.StateValue, string, unknown, any, any>, ({
1742
449
  id: string;
1743
450
  expertKey: string;
@@ -1748,7 +455,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1748
455
  type: "startRun";
1749
456
  } & {
1750
457
  initialCheckpoint: Checkpoint;
1751
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
458
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1752
459
  }) | ({
1753
460
  id: string;
1754
461
  expertKey: string;
@@ -1758,7 +465,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1758
465
  } & {
1759
466
  type: "startGeneration";
1760
467
  } & {
1761
- messages: Message[];
468
+ messages: _perstack_core.Message[];
1762
469
  }) | ({
1763
470
  id: string;
1764
471
  expertKey: string;
@@ -1768,10 +475,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1768
475
  } & {
1769
476
  type: "retry";
1770
477
  } & {
1771
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1772
- toolCall?: ToolCall;
1773
- toolResult?: ToolResult;
1774
- usage: Usage;
478
+ reason: string;
479
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
480
+ toolCall?: _perstack_core.ToolCall;
481
+ toolResult?: _perstack_core.ToolResult;
482
+ usage: _perstack_core.Usage;
1775
483
  }) | ({
1776
484
  id: string;
1777
485
  expertKey: string;
@@ -1781,9 +489,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1781
489
  } & {
1782
490
  type: "callTool";
1783
491
  } & {
1784
- newMessage: ExpertMessage;
1785
- toolCall: ToolCall;
1786
- usage: Usage;
492
+ newMessage: _perstack_core.ExpertMessage;
493
+ toolCall: _perstack_core.ToolCall;
494
+ usage: _perstack_core.Usage;
1787
495
  }) | ({
1788
496
  id: string;
1789
497
  expertKey: string;
@@ -1793,9 +501,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1793
501
  } & {
1794
502
  type: "callInteractiveTool";
1795
503
  } & {
1796
- newMessage: ExpertMessage;
1797
- toolCall: ToolCall;
1798
- usage: Usage;
504
+ newMessage: _perstack_core.ExpertMessage;
505
+ toolCall: _perstack_core.ToolCall;
506
+ usage: _perstack_core.Usage;
1799
507
  }) | ({
1800
508
  id: string;
1801
509
  expertKey: string;
@@ -1805,9 +513,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1805
513
  } & {
1806
514
  type: "callDelegate";
1807
515
  } & {
1808
- newMessage: ExpertMessage;
1809
- toolCall: ToolCall;
1810
- usage: Usage;
516
+ newMessage: _perstack_core.ExpertMessage;
517
+ toolCall: _perstack_core.ToolCall;
518
+ usage: _perstack_core.Usage;
1811
519
  }) | ({
1812
520
  id: string;
1813
521
  expertKey: string;
@@ -1817,7 +525,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1817
525
  } & {
1818
526
  type: "resolveToolResult";
1819
527
  } & {
1820
- toolResult: ToolResult;
528
+ toolResult: _perstack_core.ToolResult;
1821
529
  }) | ({
1822
530
  id: string;
1823
531
  expertKey: string;
@@ -1827,7 +535,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1827
535
  } & {
1828
536
  type: "resolveThought";
1829
537
  } & {
1830
- toolResult: ToolResult;
538
+ toolResult: _perstack_core.ToolResult;
1831
539
  }) | ({
1832
540
  id: string;
1833
541
  expertKey: string;
@@ -1837,7 +545,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1837
545
  } & {
1838
546
  type: "resolvePdfFile";
1839
547
  } & {
1840
- toolResult: ToolResult;
548
+ toolResult: _perstack_core.ToolResult;
1841
549
  }) | ({
1842
550
  id: string;
1843
551
  expertKey: string;
@@ -1847,7 +555,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1847
555
  } & {
1848
556
  type: "resolveImageFile";
1849
557
  } & {
1850
- toolResult: ToolResult;
558
+ toolResult: _perstack_core.ToolResult;
1851
559
  }) | ({
1852
560
  id: string;
1853
561
  expertKey: string;
@@ -1857,7 +565,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1857
565
  } & {
1858
566
  type: "attemptCompletion";
1859
567
  } & {
1860
- toolResult: ToolResult;
568
+ toolResult: _perstack_core.ToolResult;
1861
569
  }) | ({
1862
570
  id: string;
1863
571
  expertKey: string;
@@ -1867,7 +575,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1867
575
  } & {
1868
576
  type: "finishToolCall";
1869
577
  } & {
1870
- newMessages: (UserMessage | ToolMessage)[];
578
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1871
579
  }) | ({
1872
580
  id: string;
1873
581
  expertKey: string;
@@ -1925,10 +633,40 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1925
633
  checkpoint: Checkpoint;
1926
634
  step: Step;
1927
635
  text: string;
1928
- usage: Usage;
636
+ usage: _perstack_core.Usage;
1929
637
  }), xstate.AnyEventObject>;
1930
638
  }) => {
1931
639
  setting: {
640
+ model: string;
641
+ providerConfig: {
642
+ name: "anthropic";
643
+ apiKey: string;
644
+ baseUrl?: string | undefined;
645
+ } | {
646
+ name: "google";
647
+ apiKey: string;
648
+ baseUrl?: string | undefined;
649
+ } | {
650
+ name: "openai";
651
+ apiKey: string;
652
+ baseUrl?: string | undefined;
653
+ organization?: string | undefined;
654
+ project?: string | undefined;
655
+ } | {
656
+ name: "ollama";
657
+ baseUrl?: string | undefined;
658
+ } | {
659
+ name: "azure-openai";
660
+ apiKey: string;
661
+ resourceName: string;
662
+ apiVersion?: string | undefined;
663
+ } | {
664
+ name: "amazon-bedrock";
665
+ accessKeyId: string;
666
+ secretAccessKey: string;
667
+ region: string;
668
+ sessionToken?: string | undefined;
669
+ };
1932
670
  runId: string;
1933
671
  expertKey: string;
1934
672
  input: {
@@ -1984,14 +722,17 @@ declare const runtimeStateMachine: xstate.StateMachine<{
1984
722
  description?: string | undefined;
1985
723
  };
1986
724
  };
1987
- model: string;
1988
725
  temperature: number;
1989
726
  maxRetries: number;
1990
727
  timeout: number;
1991
728
  startedAt: number;
1992
729
  updatedAt: number;
730
+ perstackApiBaseUrl: string;
731
+ env: Record<string, string>;
1993
732
  maxSteps?: number | undefined;
1994
733
  workspace?: string | undefined;
734
+ perstackApiKey?: string | undefined;
735
+ perstackBaseSkillArgs?: string[] | undefined;
1995
736
  };
1996
737
  checkpoint: {
1997
738
  id: string;
@@ -2089,11 +830,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2089
830
  version: string;
2090
831
  };
2091
832
  usage: {
2092
- promptTokens: number;
2093
- completionTokens: number;
833
+ inputTokens: number;
834
+ outputTokens: number;
835
+ reasoningTokens: number;
2094
836
  totalTokens: number;
2095
- cacheCreationInputTokens: number;
2096
- cacheReadInputTokens: number;
837
+ cachedInputTokens: number;
2097
838
  };
2098
839
  delegateTo?: {
2099
840
  expert: {
@@ -2115,17 +856,19 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2115
856
  toolName: string;
2116
857
  checkpointId: string;
2117
858
  } | undefined;
859
+ contextWindow?: number | undefined;
860
+ contextWindowUsage?: number | undefined;
2118
861
  };
2119
862
  step: {
2120
863
  stepNumber: number;
2121
864
  inputMessages: never[];
2122
865
  newMessages: never[];
2123
866
  usage: {
2124
- promptTokens: number;
2125
- completionTokens: number;
867
+ inputTokens: number;
868
+ outputTokens: number;
869
+ reasoningTokens: number;
2126
870
  totalTokens: number;
2127
- cacheCreationInputTokens: number;
2128
- cacheReadInputTokens: number;
871
+ cachedInputTokens: number;
2129
872
  };
2130
873
  startedAt: number;
2131
874
  };
@@ -2153,7 +896,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2153
896
  type: "startRun";
2154
897
  } & {
2155
898
  initialCheckpoint: Checkpoint;
2156
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
899
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2157
900
  }, ({
2158
901
  id: string;
2159
902
  expertKey: string;
@@ -2164,7 +907,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2164
907
  type: "startRun";
2165
908
  } & {
2166
909
  initialCheckpoint: Checkpoint;
2167
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
910
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2168
911
  }) | ({
2169
912
  id: string;
2170
913
  expertKey: string;
@@ -2174,7 +917,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2174
917
  } & {
2175
918
  type: "startGeneration";
2176
919
  } & {
2177
- messages: Message[];
920
+ messages: _perstack_core.Message[];
2178
921
  }) | ({
2179
922
  id: string;
2180
923
  expertKey: string;
@@ -2184,10 +927,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2184
927
  } & {
2185
928
  type: "retry";
2186
929
  } & {
2187
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
2188
- toolCall?: ToolCall;
2189
- toolResult?: ToolResult;
2190
- usage: Usage;
930
+ reason: string;
931
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
932
+ toolCall?: _perstack_core.ToolCall;
933
+ toolResult?: _perstack_core.ToolResult;
934
+ usage: _perstack_core.Usage;
2191
935
  }) | ({
2192
936
  id: string;
2193
937
  expertKey: string;
@@ -2197,9 +941,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2197
941
  } & {
2198
942
  type: "callTool";
2199
943
  } & {
2200
- newMessage: ExpertMessage;
2201
- toolCall: ToolCall;
2202
- usage: Usage;
944
+ newMessage: _perstack_core.ExpertMessage;
945
+ toolCall: _perstack_core.ToolCall;
946
+ usage: _perstack_core.Usage;
2203
947
  }) | ({
2204
948
  id: string;
2205
949
  expertKey: string;
@@ -2209,9 +953,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2209
953
  } & {
2210
954
  type: "callInteractiveTool";
2211
955
  } & {
2212
- newMessage: ExpertMessage;
2213
- toolCall: ToolCall;
2214
- usage: Usage;
956
+ newMessage: _perstack_core.ExpertMessage;
957
+ toolCall: _perstack_core.ToolCall;
958
+ usage: _perstack_core.Usage;
2215
959
  }) | ({
2216
960
  id: string;
2217
961
  expertKey: string;
@@ -2221,9 +965,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2221
965
  } & {
2222
966
  type: "callDelegate";
2223
967
  } & {
2224
- newMessage: ExpertMessage;
2225
- toolCall: ToolCall;
2226
- usage: Usage;
968
+ newMessage: _perstack_core.ExpertMessage;
969
+ toolCall: _perstack_core.ToolCall;
970
+ usage: _perstack_core.Usage;
2227
971
  }) | ({
2228
972
  id: string;
2229
973
  expertKey: string;
@@ -2233,7 +977,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2233
977
  } & {
2234
978
  type: "resolveToolResult";
2235
979
  } & {
2236
- toolResult: ToolResult;
980
+ toolResult: _perstack_core.ToolResult;
2237
981
  }) | ({
2238
982
  id: string;
2239
983
  expertKey: string;
@@ -2243,7 +987,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2243
987
  } & {
2244
988
  type: "resolveThought";
2245
989
  } & {
2246
- toolResult: ToolResult;
990
+ toolResult: _perstack_core.ToolResult;
2247
991
  }) | ({
2248
992
  id: string;
2249
993
  expertKey: string;
@@ -2253,7 +997,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2253
997
  } & {
2254
998
  type: "resolvePdfFile";
2255
999
  } & {
2256
- toolResult: ToolResult;
1000
+ toolResult: _perstack_core.ToolResult;
2257
1001
  }) | ({
2258
1002
  id: string;
2259
1003
  expertKey: string;
@@ -2263,7 +1007,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2263
1007
  } & {
2264
1008
  type: "resolveImageFile";
2265
1009
  } & {
2266
- toolResult: ToolResult;
1010
+ toolResult: _perstack_core.ToolResult;
2267
1011
  }) | ({
2268
1012
  id: string;
2269
1013
  expertKey: string;
@@ -2273,7 +1017,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2273
1017
  } & {
2274
1018
  type: "attemptCompletion";
2275
1019
  } & {
2276
- toolResult: ToolResult;
1020
+ toolResult: _perstack_core.ToolResult;
2277
1021
  }) | ({
2278
1022
  id: string;
2279
1023
  expertKey: string;
@@ -2283,7 +1027,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2283
1027
  } & {
2284
1028
  type: "finishToolCall";
2285
1029
  } & {
2286
- newMessages: (UserMessage | ToolMessage)[];
1030
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2287
1031
  }) | ({
2288
1032
  id: string;
2289
1033
  expertKey: string;
@@ -2341,7 +1085,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2341
1085
  checkpoint: Checkpoint;
2342
1086
  step: Step;
2343
1087
  text: string;
2344
- usage: Usage;
1088
+ usage: _perstack_core.Usage;
2345
1089
  }), undefined, never, never, never, never, never>;
2346
1090
  };
2347
1091
  };
@@ -2365,7 +1109,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2365
1109
  } & {
2366
1110
  type: "startGeneration";
2367
1111
  } & {
2368
- messages: Message[];
1112
+ messages: _perstack_core.Message[];
2369
1113
  }, ({
2370
1114
  id: string;
2371
1115
  expertKey: string;
@@ -2376,7 +1120,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2376
1120
  type: "startRun";
2377
1121
  } & {
2378
1122
  initialCheckpoint: Checkpoint;
2379
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1123
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2380
1124
  }) | ({
2381
1125
  id: string;
2382
1126
  expertKey: string;
@@ -2386,7 +1130,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2386
1130
  } & {
2387
1131
  type: "startGeneration";
2388
1132
  } & {
2389
- messages: Message[];
1133
+ messages: _perstack_core.Message[];
2390
1134
  }) | ({
2391
1135
  id: string;
2392
1136
  expertKey: string;
@@ -2396,10 +1140,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2396
1140
  } & {
2397
1141
  type: "retry";
2398
1142
  } & {
2399
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
2400
- toolCall?: ToolCall;
2401
- toolResult?: ToolResult;
2402
- usage: Usage;
1143
+ reason: string;
1144
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1145
+ toolCall?: _perstack_core.ToolCall;
1146
+ toolResult?: _perstack_core.ToolResult;
1147
+ usage: _perstack_core.Usage;
2403
1148
  }) | ({
2404
1149
  id: string;
2405
1150
  expertKey: string;
@@ -2409,9 +1154,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2409
1154
  } & {
2410
1155
  type: "callTool";
2411
1156
  } & {
2412
- newMessage: ExpertMessage;
2413
- toolCall: ToolCall;
2414
- usage: Usage;
1157
+ newMessage: _perstack_core.ExpertMessage;
1158
+ toolCall: _perstack_core.ToolCall;
1159
+ usage: _perstack_core.Usage;
2415
1160
  }) | ({
2416
1161
  id: string;
2417
1162
  expertKey: string;
@@ -2421,9 +1166,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2421
1166
  } & {
2422
1167
  type: "callInteractiveTool";
2423
1168
  } & {
2424
- newMessage: ExpertMessage;
2425
- toolCall: ToolCall;
2426
- usage: Usage;
1169
+ newMessage: _perstack_core.ExpertMessage;
1170
+ toolCall: _perstack_core.ToolCall;
1171
+ usage: _perstack_core.Usage;
2427
1172
  }) | ({
2428
1173
  id: string;
2429
1174
  expertKey: string;
@@ -2433,9 +1178,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2433
1178
  } & {
2434
1179
  type: "callDelegate";
2435
1180
  } & {
2436
- newMessage: ExpertMessage;
2437
- toolCall: ToolCall;
2438
- usage: Usage;
1181
+ newMessage: _perstack_core.ExpertMessage;
1182
+ toolCall: _perstack_core.ToolCall;
1183
+ usage: _perstack_core.Usage;
2439
1184
  }) | ({
2440
1185
  id: string;
2441
1186
  expertKey: string;
@@ -2445,7 +1190,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2445
1190
  } & {
2446
1191
  type: "resolveToolResult";
2447
1192
  } & {
2448
- toolResult: ToolResult;
1193
+ toolResult: _perstack_core.ToolResult;
2449
1194
  }) | ({
2450
1195
  id: string;
2451
1196
  expertKey: string;
@@ -2455,7 +1200,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2455
1200
  } & {
2456
1201
  type: "resolveThought";
2457
1202
  } & {
2458
- toolResult: ToolResult;
1203
+ toolResult: _perstack_core.ToolResult;
2459
1204
  }) | ({
2460
1205
  id: string;
2461
1206
  expertKey: string;
@@ -2465,7 +1210,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2465
1210
  } & {
2466
1211
  type: "resolvePdfFile";
2467
1212
  } & {
2468
- toolResult: ToolResult;
1213
+ toolResult: _perstack_core.ToolResult;
2469
1214
  }) | ({
2470
1215
  id: string;
2471
1216
  expertKey: string;
@@ -2475,7 +1220,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2475
1220
  } & {
2476
1221
  type: "resolveImageFile";
2477
1222
  } & {
2478
- toolResult: ToolResult;
1223
+ toolResult: _perstack_core.ToolResult;
2479
1224
  }) | ({
2480
1225
  id: string;
2481
1226
  expertKey: string;
@@ -2485,7 +1230,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2485
1230
  } & {
2486
1231
  type: "attemptCompletion";
2487
1232
  } & {
2488
- toolResult: ToolResult;
1233
+ toolResult: _perstack_core.ToolResult;
2489
1234
  }) | ({
2490
1235
  id: string;
2491
1236
  expertKey: string;
@@ -2495,7 +1240,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2495
1240
  } & {
2496
1241
  type: "finishToolCall";
2497
1242
  } & {
2498
- newMessages: (UserMessage | ToolMessage)[];
1243
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2499
1244
  }) | ({
2500
1245
  id: string;
2501
1246
  expertKey: string;
@@ -2553,7 +1298,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2553
1298
  checkpoint: Checkpoint;
2554
1299
  step: Step;
2555
1300
  text: string;
2556
- usage: Usage;
1301
+ usage: _perstack_core.Usage;
2557
1302
  }), undefined, never, never, never, never, never>;
2558
1303
  };
2559
1304
  };
@@ -2577,10 +1322,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2577
1322
  } & {
2578
1323
  type: "retry";
2579
1324
  } & {
2580
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
2581
- toolCall?: ToolCall;
2582
- toolResult?: ToolResult;
2583
- usage: Usage;
1325
+ reason: string;
1326
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1327
+ toolCall?: _perstack_core.ToolCall;
1328
+ toolResult?: _perstack_core.ToolResult;
1329
+ usage: _perstack_core.Usage;
2584
1330
  }, ({
2585
1331
  id: string;
2586
1332
  expertKey: string;
@@ -2591,7 +1337,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2591
1337
  type: "startRun";
2592
1338
  } & {
2593
1339
  initialCheckpoint: Checkpoint;
2594
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1340
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2595
1341
  }) | ({
2596
1342
  id: string;
2597
1343
  expertKey: string;
@@ -2601,7 +1347,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2601
1347
  } & {
2602
1348
  type: "startGeneration";
2603
1349
  } & {
2604
- messages: Message[];
1350
+ messages: _perstack_core.Message[];
2605
1351
  }) | ({
2606
1352
  id: string;
2607
1353
  expertKey: string;
@@ -2611,10 +1357,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2611
1357
  } & {
2612
1358
  type: "retry";
2613
1359
  } & {
2614
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
2615
- toolCall?: ToolCall;
2616
- toolResult?: ToolResult;
2617
- usage: Usage;
1360
+ reason: string;
1361
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1362
+ toolCall?: _perstack_core.ToolCall;
1363
+ toolResult?: _perstack_core.ToolResult;
1364
+ usage: _perstack_core.Usage;
2618
1365
  }) | ({
2619
1366
  id: string;
2620
1367
  expertKey: string;
@@ -2624,9 +1371,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2624
1371
  } & {
2625
1372
  type: "callTool";
2626
1373
  } & {
2627
- newMessage: ExpertMessage;
2628
- toolCall: ToolCall;
2629
- usage: Usage;
1374
+ newMessage: _perstack_core.ExpertMessage;
1375
+ toolCall: _perstack_core.ToolCall;
1376
+ usage: _perstack_core.Usage;
2630
1377
  }) | ({
2631
1378
  id: string;
2632
1379
  expertKey: string;
@@ -2636,9 +1383,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2636
1383
  } & {
2637
1384
  type: "callInteractiveTool";
2638
1385
  } & {
2639
- newMessage: ExpertMessage;
2640
- toolCall: ToolCall;
2641
- usage: Usage;
1386
+ newMessage: _perstack_core.ExpertMessage;
1387
+ toolCall: _perstack_core.ToolCall;
1388
+ usage: _perstack_core.Usage;
2642
1389
  }) | ({
2643
1390
  id: string;
2644
1391
  expertKey: string;
@@ -2648,9 +1395,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2648
1395
  } & {
2649
1396
  type: "callDelegate";
2650
1397
  } & {
2651
- newMessage: ExpertMessage;
2652
- toolCall: ToolCall;
2653
- usage: Usage;
1398
+ newMessage: _perstack_core.ExpertMessage;
1399
+ toolCall: _perstack_core.ToolCall;
1400
+ usage: _perstack_core.Usage;
2654
1401
  }) | ({
2655
1402
  id: string;
2656
1403
  expertKey: string;
@@ -2660,7 +1407,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2660
1407
  } & {
2661
1408
  type: "resolveToolResult";
2662
1409
  } & {
2663
- toolResult: ToolResult;
1410
+ toolResult: _perstack_core.ToolResult;
2664
1411
  }) | ({
2665
1412
  id: string;
2666
1413
  expertKey: string;
@@ -2670,7 +1417,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2670
1417
  } & {
2671
1418
  type: "resolveThought";
2672
1419
  } & {
2673
- toolResult: ToolResult;
1420
+ toolResult: _perstack_core.ToolResult;
2674
1421
  }) | ({
2675
1422
  id: string;
2676
1423
  expertKey: string;
@@ -2680,7 +1427,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2680
1427
  } & {
2681
1428
  type: "resolvePdfFile";
2682
1429
  } & {
2683
- toolResult: ToolResult;
1430
+ toolResult: _perstack_core.ToolResult;
2684
1431
  }) | ({
2685
1432
  id: string;
2686
1433
  expertKey: string;
@@ -2690,7 +1437,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2690
1437
  } & {
2691
1438
  type: "resolveImageFile";
2692
1439
  } & {
2693
- toolResult: ToolResult;
1440
+ toolResult: _perstack_core.ToolResult;
2694
1441
  }) | ({
2695
1442
  id: string;
2696
1443
  expertKey: string;
@@ -2700,7 +1447,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2700
1447
  } & {
2701
1448
  type: "attemptCompletion";
2702
1449
  } & {
2703
- toolResult: ToolResult;
1450
+ toolResult: _perstack_core.ToolResult;
2704
1451
  }) | ({
2705
1452
  id: string;
2706
1453
  expertKey: string;
@@ -2710,7 +1457,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2710
1457
  } & {
2711
1458
  type: "finishToolCall";
2712
1459
  } & {
2713
- newMessages: (UserMessage | ToolMessage)[];
1460
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2714
1461
  }) | ({
2715
1462
  id: string;
2716
1463
  expertKey: string;
@@ -2768,7 +1515,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2768
1515
  checkpoint: Checkpoint;
2769
1516
  step: Step;
2770
1517
  text: string;
2771
- usage: Usage;
1518
+ usage: _perstack_core.Usage;
2772
1519
  }), undefined, never, never, never, never, never>;
2773
1520
  };
2774
1521
  readonly callTool: {
@@ -2788,9 +1535,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2788
1535
  } & {
2789
1536
  type: "callTool";
2790
1537
  } & {
2791
- newMessage: ExpertMessage;
2792
- toolCall: ToolCall;
2793
- usage: Usage;
1538
+ newMessage: _perstack_core.ExpertMessage;
1539
+ toolCall: _perstack_core.ToolCall;
1540
+ usage: _perstack_core.Usage;
2794
1541
  }, ({
2795
1542
  id: string;
2796
1543
  expertKey: string;
@@ -2801,7 +1548,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2801
1548
  type: "startRun";
2802
1549
  } & {
2803
1550
  initialCheckpoint: Checkpoint;
2804
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1551
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2805
1552
  }) | ({
2806
1553
  id: string;
2807
1554
  expertKey: string;
@@ -2811,7 +1558,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2811
1558
  } & {
2812
1559
  type: "startGeneration";
2813
1560
  } & {
2814
- messages: Message[];
1561
+ messages: _perstack_core.Message[];
2815
1562
  }) | ({
2816
1563
  id: string;
2817
1564
  expertKey: string;
@@ -2821,10 +1568,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2821
1568
  } & {
2822
1569
  type: "retry";
2823
1570
  } & {
2824
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
2825
- toolCall?: ToolCall;
2826
- toolResult?: ToolResult;
2827
- usage: Usage;
1571
+ reason: string;
1572
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1573
+ toolCall?: _perstack_core.ToolCall;
1574
+ toolResult?: _perstack_core.ToolResult;
1575
+ usage: _perstack_core.Usage;
2828
1576
  }) | ({
2829
1577
  id: string;
2830
1578
  expertKey: string;
@@ -2834,9 +1582,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2834
1582
  } & {
2835
1583
  type: "callTool";
2836
1584
  } & {
2837
- newMessage: ExpertMessage;
2838
- toolCall: ToolCall;
2839
- usage: Usage;
1585
+ newMessage: _perstack_core.ExpertMessage;
1586
+ toolCall: _perstack_core.ToolCall;
1587
+ usage: _perstack_core.Usage;
2840
1588
  }) | ({
2841
1589
  id: string;
2842
1590
  expertKey: string;
@@ -2846,9 +1594,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2846
1594
  } & {
2847
1595
  type: "callInteractiveTool";
2848
1596
  } & {
2849
- newMessage: ExpertMessage;
2850
- toolCall: ToolCall;
2851
- usage: Usage;
1597
+ newMessage: _perstack_core.ExpertMessage;
1598
+ toolCall: _perstack_core.ToolCall;
1599
+ usage: _perstack_core.Usage;
2852
1600
  }) | ({
2853
1601
  id: string;
2854
1602
  expertKey: string;
@@ -2858,9 +1606,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2858
1606
  } & {
2859
1607
  type: "callDelegate";
2860
1608
  } & {
2861
- newMessage: ExpertMessage;
2862
- toolCall: ToolCall;
2863
- usage: Usage;
1609
+ newMessage: _perstack_core.ExpertMessage;
1610
+ toolCall: _perstack_core.ToolCall;
1611
+ usage: _perstack_core.Usage;
2864
1612
  }) | ({
2865
1613
  id: string;
2866
1614
  expertKey: string;
@@ -2870,7 +1618,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2870
1618
  } & {
2871
1619
  type: "resolveToolResult";
2872
1620
  } & {
2873
- toolResult: ToolResult;
1621
+ toolResult: _perstack_core.ToolResult;
2874
1622
  }) | ({
2875
1623
  id: string;
2876
1624
  expertKey: string;
@@ -2880,7 +1628,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2880
1628
  } & {
2881
1629
  type: "resolveThought";
2882
1630
  } & {
2883
- toolResult: ToolResult;
1631
+ toolResult: _perstack_core.ToolResult;
2884
1632
  }) | ({
2885
1633
  id: string;
2886
1634
  expertKey: string;
@@ -2890,7 +1638,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2890
1638
  } & {
2891
1639
  type: "resolvePdfFile";
2892
1640
  } & {
2893
- toolResult: ToolResult;
1641
+ toolResult: _perstack_core.ToolResult;
2894
1642
  }) | ({
2895
1643
  id: string;
2896
1644
  expertKey: string;
@@ -2900,7 +1648,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2900
1648
  } & {
2901
1649
  type: "resolveImageFile";
2902
1650
  } & {
2903
- toolResult: ToolResult;
1651
+ toolResult: _perstack_core.ToolResult;
2904
1652
  }) | ({
2905
1653
  id: string;
2906
1654
  expertKey: string;
@@ -2910,7 +1658,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2910
1658
  } & {
2911
1659
  type: "attemptCompletion";
2912
1660
  } & {
2913
- toolResult: ToolResult;
1661
+ toolResult: _perstack_core.ToolResult;
2914
1662
  }) | ({
2915
1663
  id: string;
2916
1664
  expertKey: string;
@@ -2920,7 +1668,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2920
1668
  } & {
2921
1669
  type: "finishToolCall";
2922
1670
  } & {
2923
- newMessages: (UserMessage | ToolMessage)[];
1671
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2924
1672
  }) | ({
2925
1673
  id: string;
2926
1674
  expertKey: string;
@@ -2978,7 +1726,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2978
1726
  checkpoint: Checkpoint;
2979
1727
  step: Step;
2980
1728
  text: string;
2981
- usage: Usage;
1729
+ usage: _perstack_core.Usage;
2982
1730
  }), undefined, never, never, never, never, never>;
2983
1731
  };
2984
1732
  readonly callInteractiveTool: {
@@ -2998,9 +1746,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
2998
1746
  } & {
2999
1747
  type: "callInteractiveTool";
3000
1748
  } & {
3001
- newMessage: ExpertMessage;
3002
- toolCall: ToolCall;
3003
- usage: Usage;
1749
+ newMessage: _perstack_core.ExpertMessage;
1750
+ toolCall: _perstack_core.ToolCall;
1751
+ usage: _perstack_core.Usage;
3004
1752
  }, ({
3005
1753
  id: string;
3006
1754
  expertKey: string;
@@ -3011,7 +1759,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3011
1759
  type: "startRun";
3012
1760
  } & {
3013
1761
  initialCheckpoint: Checkpoint;
3014
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1762
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
3015
1763
  }) | ({
3016
1764
  id: string;
3017
1765
  expertKey: string;
@@ -3021,7 +1769,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3021
1769
  } & {
3022
1770
  type: "startGeneration";
3023
1771
  } & {
3024
- messages: Message[];
1772
+ messages: _perstack_core.Message[];
3025
1773
  }) | ({
3026
1774
  id: string;
3027
1775
  expertKey: string;
@@ -3031,10 +1779,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3031
1779
  } & {
3032
1780
  type: "retry";
3033
1781
  } & {
3034
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
3035
- toolCall?: ToolCall;
3036
- toolResult?: ToolResult;
3037
- usage: Usage;
1782
+ reason: string;
1783
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1784
+ toolCall?: _perstack_core.ToolCall;
1785
+ toolResult?: _perstack_core.ToolResult;
1786
+ usage: _perstack_core.Usage;
3038
1787
  }) | ({
3039
1788
  id: string;
3040
1789
  expertKey: string;
@@ -3044,9 +1793,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3044
1793
  } & {
3045
1794
  type: "callTool";
3046
1795
  } & {
3047
- newMessage: ExpertMessage;
3048
- toolCall: ToolCall;
3049
- usage: Usage;
1796
+ newMessage: _perstack_core.ExpertMessage;
1797
+ toolCall: _perstack_core.ToolCall;
1798
+ usage: _perstack_core.Usage;
3050
1799
  }) | ({
3051
1800
  id: string;
3052
1801
  expertKey: string;
@@ -3056,9 +1805,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3056
1805
  } & {
3057
1806
  type: "callInteractiveTool";
3058
1807
  } & {
3059
- newMessage: ExpertMessage;
3060
- toolCall: ToolCall;
3061
- usage: Usage;
1808
+ newMessage: _perstack_core.ExpertMessage;
1809
+ toolCall: _perstack_core.ToolCall;
1810
+ usage: _perstack_core.Usage;
3062
1811
  }) | ({
3063
1812
  id: string;
3064
1813
  expertKey: string;
@@ -3068,9 +1817,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3068
1817
  } & {
3069
1818
  type: "callDelegate";
3070
1819
  } & {
3071
- newMessage: ExpertMessage;
3072
- toolCall: ToolCall;
3073
- usage: Usage;
1820
+ newMessage: _perstack_core.ExpertMessage;
1821
+ toolCall: _perstack_core.ToolCall;
1822
+ usage: _perstack_core.Usage;
3074
1823
  }) | ({
3075
1824
  id: string;
3076
1825
  expertKey: string;
@@ -3080,7 +1829,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3080
1829
  } & {
3081
1830
  type: "resolveToolResult";
3082
1831
  } & {
3083
- toolResult: ToolResult;
1832
+ toolResult: _perstack_core.ToolResult;
3084
1833
  }) | ({
3085
1834
  id: string;
3086
1835
  expertKey: string;
@@ -3090,7 +1839,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3090
1839
  } & {
3091
1840
  type: "resolveThought";
3092
1841
  } & {
3093
- toolResult: ToolResult;
1842
+ toolResult: _perstack_core.ToolResult;
3094
1843
  }) | ({
3095
1844
  id: string;
3096
1845
  expertKey: string;
@@ -3100,7 +1849,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3100
1849
  } & {
3101
1850
  type: "resolvePdfFile";
3102
1851
  } & {
3103
- toolResult: ToolResult;
1852
+ toolResult: _perstack_core.ToolResult;
3104
1853
  }) | ({
3105
1854
  id: string;
3106
1855
  expertKey: string;
@@ -3110,7 +1859,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3110
1859
  } & {
3111
1860
  type: "resolveImageFile";
3112
1861
  } & {
3113
- toolResult: ToolResult;
1862
+ toolResult: _perstack_core.ToolResult;
3114
1863
  }) | ({
3115
1864
  id: string;
3116
1865
  expertKey: string;
@@ -3120,7 +1869,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3120
1869
  } & {
3121
1870
  type: "attemptCompletion";
3122
1871
  } & {
3123
- toolResult: ToolResult;
1872
+ toolResult: _perstack_core.ToolResult;
3124
1873
  }) | ({
3125
1874
  id: string;
3126
1875
  expertKey: string;
@@ -3130,7 +1879,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3130
1879
  } & {
3131
1880
  type: "finishToolCall";
3132
1881
  } & {
3133
- newMessages: (UserMessage | ToolMessage)[];
1882
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
3134
1883
  }) | ({
3135
1884
  id: string;
3136
1885
  expertKey: string;
@@ -3188,7 +1937,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3188
1937
  checkpoint: Checkpoint;
3189
1938
  step: Step;
3190
1939
  text: string;
3191
- usage: Usage;
1940
+ usage: _perstack_core.Usage;
3192
1941
  }), undefined, never, never, never, never, never>;
3193
1942
  };
3194
1943
  readonly callDelegate: {
@@ -3208,9 +1957,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3208
1957
  } & {
3209
1958
  type: "callDelegate";
3210
1959
  } & {
3211
- newMessage: ExpertMessage;
3212
- toolCall: ToolCall;
3213
- usage: Usage;
1960
+ newMessage: _perstack_core.ExpertMessage;
1961
+ toolCall: _perstack_core.ToolCall;
1962
+ usage: _perstack_core.Usage;
3214
1963
  }, ({
3215
1964
  id: string;
3216
1965
  expertKey: string;
@@ -3221,7 +1970,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3221
1970
  type: "startRun";
3222
1971
  } & {
3223
1972
  initialCheckpoint: Checkpoint;
3224
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1973
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
3225
1974
  }) | ({
3226
1975
  id: string;
3227
1976
  expertKey: string;
@@ -3231,7 +1980,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3231
1980
  } & {
3232
1981
  type: "startGeneration";
3233
1982
  } & {
3234
- messages: Message[];
1983
+ messages: _perstack_core.Message[];
3235
1984
  }) | ({
3236
1985
  id: string;
3237
1986
  expertKey: string;
@@ -3241,10 +1990,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3241
1990
  } & {
3242
1991
  type: "retry";
3243
1992
  } & {
3244
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
3245
- toolCall?: ToolCall;
3246
- toolResult?: ToolResult;
3247
- usage: Usage;
1993
+ reason: string;
1994
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1995
+ toolCall?: _perstack_core.ToolCall;
1996
+ toolResult?: _perstack_core.ToolResult;
1997
+ usage: _perstack_core.Usage;
3248
1998
  }) | ({
3249
1999
  id: string;
3250
2000
  expertKey: string;
@@ -3254,9 +2004,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3254
2004
  } & {
3255
2005
  type: "callTool";
3256
2006
  } & {
3257
- newMessage: ExpertMessage;
3258
- toolCall: ToolCall;
3259
- usage: Usage;
2007
+ newMessage: _perstack_core.ExpertMessage;
2008
+ toolCall: _perstack_core.ToolCall;
2009
+ usage: _perstack_core.Usage;
3260
2010
  }) | ({
3261
2011
  id: string;
3262
2012
  expertKey: string;
@@ -3266,9 +2016,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3266
2016
  } & {
3267
2017
  type: "callInteractiveTool";
3268
2018
  } & {
3269
- newMessage: ExpertMessage;
3270
- toolCall: ToolCall;
3271
- usage: Usage;
2019
+ newMessage: _perstack_core.ExpertMessage;
2020
+ toolCall: _perstack_core.ToolCall;
2021
+ usage: _perstack_core.Usage;
3272
2022
  }) | ({
3273
2023
  id: string;
3274
2024
  expertKey: string;
@@ -3278,9 +2028,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3278
2028
  } & {
3279
2029
  type: "callDelegate";
3280
2030
  } & {
3281
- newMessage: ExpertMessage;
3282
- toolCall: ToolCall;
3283
- usage: Usage;
2031
+ newMessage: _perstack_core.ExpertMessage;
2032
+ toolCall: _perstack_core.ToolCall;
2033
+ usage: _perstack_core.Usage;
3284
2034
  }) | ({
3285
2035
  id: string;
3286
2036
  expertKey: string;
@@ -3290,7 +2040,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3290
2040
  } & {
3291
2041
  type: "resolveToolResult";
3292
2042
  } & {
3293
- toolResult: ToolResult;
2043
+ toolResult: _perstack_core.ToolResult;
3294
2044
  }) | ({
3295
2045
  id: string;
3296
2046
  expertKey: string;
@@ -3300,7 +2050,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3300
2050
  } & {
3301
2051
  type: "resolveThought";
3302
2052
  } & {
3303
- toolResult: ToolResult;
2053
+ toolResult: _perstack_core.ToolResult;
3304
2054
  }) | ({
3305
2055
  id: string;
3306
2056
  expertKey: string;
@@ -3310,7 +2060,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3310
2060
  } & {
3311
2061
  type: "resolvePdfFile";
3312
2062
  } & {
3313
- toolResult: ToolResult;
2063
+ toolResult: _perstack_core.ToolResult;
3314
2064
  }) | ({
3315
2065
  id: string;
3316
2066
  expertKey: string;
@@ -3320,7 +2070,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3320
2070
  } & {
3321
2071
  type: "resolveImageFile";
3322
2072
  } & {
3323
- toolResult: ToolResult;
2073
+ toolResult: _perstack_core.ToolResult;
3324
2074
  }) | ({
3325
2075
  id: string;
3326
2076
  expertKey: string;
@@ -3330,7 +2080,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3330
2080
  } & {
3331
2081
  type: "attemptCompletion";
3332
2082
  } & {
3333
- toolResult: ToolResult;
2083
+ toolResult: _perstack_core.ToolResult;
3334
2084
  }) | ({
3335
2085
  id: string;
3336
2086
  expertKey: string;
@@ -3340,7 +2090,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3340
2090
  } & {
3341
2091
  type: "finishToolCall";
3342
2092
  } & {
3343
- newMessages: (UserMessage | ToolMessage)[];
2093
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
3344
2094
  }) | ({
3345
2095
  id: string;
3346
2096
  expertKey: string;
@@ -3398,7 +2148,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3398
2148
  checkpoint: Checkpoint;
3399
2149
  step: Step;
3400
2150
  text: string;
3401
- usage: Usage;
2151
+ usage: _perstack_core.Usage;
3402
2152
  }), undefined, never, never, never, never, never>;
3403
2153
  };
3404
2154
  };
@@ -3422,7 +2172,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3422
2172
  } & {
3423
2173
  type: "resolveToolResult";
3424
2174
  } & {
3425
- toolResult: ToolResult;
2175
+ toolResult: _perstack_core.ToolResult;
3426
2176
  }, ({
3427
2177
  id: string;
3428
2178
  expertKey: string;
@@ -3433,7 +2183,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3433
2183
  type: "startRun";
3434
2184
  } & {
3435
2185
  initialCheckpoint: Checkpoint;
3436
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
2186
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
3437
2187
  }) | ({
3438
2188
  id: string;
3439
2189
  expertKey: string;
@@ -3443,7 +2193,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3443
2193
  } & {
3444
2194
  type: "startGeneration";
3445
2195
  } & {
3446
- messages: Message[];
2196
+ messages: _perstack_core.Message[];
3447
2197
  }) | ({
3448
2198
  id: string;
3449
2199
  expertKey: string;
@@ -3453,10 +2203,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3453
2203
  } & {
3454
2204
  type: "retry";
3455
2205
  } & {
3456
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
3457
- toolCall?: ToolCall;
3458
- toolResult?: ToolResult;
3459
- usage: Usage;
2206
+ reason: string;
2207
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
2208
+ toolCall?: _perstack_core.ToolCall;
2209
+ toolResult?: _perstack_core.ToolResult;
2210
+ usage: _perstack_core.Usage;
3460
2211
  }) | ({
3461
2212
  id: string;
3462
2213
  expertKey: string;
@@ -3466,9 +2217,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3466
2217
  } & {
3467
2218
  type: "callTool";
3468
2219
  } & {
3469
- newMessage: ExpertMessage;
3470
- toolCall: ToolCall;
3471
- usage: Usage;
2220
+ newMessage: _perstack_core.ExpertMessage;
2221
+ toolCall: _perstack_core.ToolCall;
2222
+ usage: _perstack_core.Usage;
3472
2223
  }) | ({
3473
2224
  id: string;
3474
2225
  expertKey: string;
@@ -3478,9 +2229,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3478
2229
  } & {
3479
2230
  type: "callInteractiveTool";
3480
2231
  } & {
3481
- newMessage: ExpertMessage;
3482
- toolCall: ToolCall;
3483
- usage: Usage;
2232
+ newMessage: _perstack_core.ExpertMessage;
2233
+ toolCall: _perstack_core.ToolCall;
2234
+ usage: _perstack_core.Usage;
3484
2235
  }) | ({
3485
2236
  id: string;
3486
2237
  expertKey: string;
@@ -3490,9 +2241,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3490
2241
  } & {
3491
2242
  type: "callDelegate";
3492
2243
  } & {
3493
- newMessage: ExpertMessage;
3494
- toolCall: ToolCall;
3495
- usage: Usage;
2244
+ newMessage: _perstack_core.ExpertMessage;
2245
+ toolCall: _perstack_core.ToolCall;
2246
+ usage: _perstack_core.Usage;
3496
2247
  }) | ({
3497
2248
  id: string;
3498
2249
  expertKey: string;
@@ -3502,7 +2253,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3502
2253
  } & {
3503
2254
  type: "resolveToolResult";
3504
2255
  } & {
3505
- toolResult: ToolResult;
2256
+ toolResult: _perstack_core.ToolResult;
3506
2257
  }) | ({
3507
2258
  id: string;
3508
2259
  expertKey: string;
@@ -3512,7 +2263,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3512
2263
  } & {
3513
2264
  type: "resolveThought";
3514
2265
  } & {
3515
- toolResult: ToolResult;
2266
+ toolResult: _perstack_core.ToolResult;
3516
2267
  }) | ({
3517
2268
  id: string;
3518
2269
  expertKey: string;
@@ -3522,7 +2273,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3522
2273
  } & {
3523
2274
  type: "resolvePdfFile";
3524
2275
  } & {
3525
- toolResult: ToolResult;
2276
+ toolResult: _perstack_core.ToolResult;
3526
2277
  }) | ({
3527
2278
  id: string;
3528
2279
  expertKey: string;
@@ -3532,7 +2283,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3532
2283
  } & {
3533
2284
  type: "resolveImageFile";
3534
2285
  } & {
3535
- toolResult: ToolResult;
2286
+ toolResult: _perstack_core.ToolResult;
3536
2287
  }) | ({
3537
2288
  id: string;
3538
2289
  expertKey: string;
@@ -3542,7 +2293,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3542
2293
  } & {
3543
2294
  type: "attemptCompletion";
3544
2295
  } & {
3545
- toolResult: ToolResult;
2296
+ toolResult: _perstack_core.ToolResult;
3546
2297
  }) | ({
3547
2298
  id: string;
3548
2299
  expertKey: string;
@@ -3552,7 +2303,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3552
2303
  } & {
3553
2304
  type: "finishToolCall";
3554
2305
  } & {
3555
- newMessages: (UserMessage | ToolMessage)[];
2306
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
3556
2307
  }) | ({
3557
2308
  id: string;
3558
2309
  expertKey: string;
@@ -3610,7 +2361,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3610
2361
  checkpoint: Checkpoint;
3611
2362
  step: Step;
3612
2363
  text: string;
3613
- usage: Usage;
2364
+ usage: _perstack_core.Usage;
3614
2365
  }), undefined, never, never, never, never, never>;
3615
2366
  };
3616
2367
  readonly resolveThought: {
@@ -3630,7 +2381,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3630
2381
  } & {
3631
2382
  type: "resolveThought";
3632
2383
  } & {
3633
- toolResult: ToolResult;
2384
+ toolResult: _perstack_core.ToolResult;
3634
2385
  }, ({
3635
2386
  id: string;
3636
2387
  expertKey: string;
@@ -3641,7 +2392,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3641
2392
  type: "startRun";
3642
2393
  } & {
3643
2394
  initialCheckpoint: Checkpoint;
3644
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
2395
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
3645
2396
  }) | ({
3646
2397
  id: string;
3647
2398
  expertKey: string;
@@ -3651,7 +2402,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3651
2402
  } & {
3652
2403
  type: "startGeneration";
3653
2404
  } & {
3654
- messages: Message[];
2405
+ messages: _perstack_core.Message[];
3655
2406
  }) | ({
3656
2407
  id: string;
3657
2408
  expertKey: string;
@@ -3661,10 +2412,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3661
2412
  } & {
3662
2413
  type: "retry";
3663
2414
  } & {
3664
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
3665
- toolCall?: ToolCall;
3666
- toolResult?: ToolResult;
3667
- usage: Usage;
2415
+ reason: string;
2416
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
2417
+ toolCall?: _perstack_core.ToolCall;
2418
+ toolResult?: _perstack_core.ToolResult;
2419
+ usage: _perstack_core.Usage;
3668
2420
  }) | ({
3669
2421
  id: string;
3670
2422
  expertKey: string;
@@ -3674,9 +2426,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3674
2426
  } & {
3675
2427
  type: "callTool";
3676
2428
  } & {
3677
- newMessage: ExpertMessage;
3678
- toolCall: ToolCall;
3679
- usage: Usage;
2429
+ newMessage: _perstack_core.ExpertMessage;
2430
+ toolCall: _perstack_core.ToolCall;
2431
+ usage: _perstack_core.Usage;
3680
2432
  }) | ({
3681
2433
  id: string;
3682
2434
  expertKey: string;
@@ -3686,9 +2438,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3686
2438
  } & {
3687
2439
  type: "callInteractiveTool";
3688
2440
  } & {
3689
- newMessage: ExpertMessage;
3690
- toolCall: ToolCall;
3691
- usage: Usage;
2441
+ newMessage: _perstack_core.ExpertMessage;
2442
+ toolCall: _perstack_core.ToolCall;
2443
+ usage: _perstack_core.Usage;
3692
2444
  }) | ({
3693
2445
  id: string;
3694
2446
  expertKey: string;
@@ -3698,9 +2450,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3698
2450
  } & {
3699
2451
  type: "callDelegate";
3700
2452
  } & {
3701
- newMessage: ExpertMessage;
3702
- toolCall: ToolCall;
3703
- usage: Usage;
2453
+ newMessage: _perstack_core.ExpertMessage;
2454
+ toolCall: _perstack_core.ToolCall;
2455
+ usage: _perstack_core.Usage;
3704
2456
  }) | ({
3705
2457
  id: string;
3706
2458
  expertKey: string;
@@ -3710,7 +2462,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3710
2462
  } & {
3711
2463
  type: "resolveToolResult";
3712
2464
  } & {
3713
- toolResult: ToolResult;
2465
+ toolResult: _perstack_core.ToolResult;
3714
2466
  }) | ({
3715
2467
  id: string;
3716
2468
  expertKey: string;
@@ -3720,7 +2472,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3720
2472
  } & {
3721
2473
  type: "resolveThought";
3722
2474
  } & {
3723
- toolResult: ToolResult;
2475
+ toolResult: _perstack_core.ToolResult;
3724
2476
  }) | ({
3725
2477
  id: string;
3726
2478
  expertKey: string;
@@ -3730,7 +2482,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3730
2482
  } & {
3731
2483
  type: "resolvePdfFile";
3732
2484
  } & {
3733
- toolResult: ToolResult;
2485
+ toolResult: _perstack_core.ToolResult;
3734
2486
  }) | ({
3735
2487
  id: string;
3736
2488
  expertKey: string;
@@ -3740,7 +2492,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3740
2492
  } & {
3741
2493
  type: "resolveImageFile";
3742
2494
  } & {
3743
- toolResult: ToolResult;
2495
+ toolResult: _perstack_core.ToolResult;
3744
2496
  }) | ({
3745
2497
  id: string;
3746
2498
  expertKey: string;
@@ -3750,7 +2502,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3750
2502
  } & {
3751
2503
  type: "attemptCompletion";
3752
2504
  } & {
3753
- toolResult: ToolResult;
2505
+ toolResult: _perstack_core.ToolResult;
3754
2506
  }) | ({
3755
2507
  id: string;
3756
2508
  expertKey: string;
@@ -3760,7 +2512,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3760
2512
  } & {
3761
2513
  type: "finishToolCall";
3762
2514
  } & {
3763
- newMessages: (UserMessage | ToolMessage)[];
2515
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
3764
2516
  }) | ({
3765
2517
  id: string;
3766
2518
  expertKey: string;
@@ -3818,7 +2570,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3818
2570
  checkpoint: Checkpoint;
3819
2571
  step: Step;
3820
2572
  text: string;
3821
- usage: Usage;
2573
+ usage: _perstack_core.Usage;
3822
2574
  }), undefined, never, never, never, never, never>;
3823
2575
  };
3824
2576
  readonly resolvePdfFile: {
@@ -3838,7 +2590,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3838
2590
  } & {
3839
2591
  type: "resolvePdfFile";
3840
2592
  } & {
3841
- toolResult: ToolResult;
2593
+ toolResult: _perstack_core.ToolResult;
3842
2594
  }, ({
3843
2595
  id: string;
3844
2596
  expertKey: string;
@@ -3849,7 +2601,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3849
2601
  type: "startRun";
3850
2602
  } & {
3851
2603
  initialCheckpoint: Checkpoint;
3852
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
2604
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
3853
2605
  }) | ({
3854
2606
  id: string;
3855
2607
  expertKey: string;
@@ -3859,7 +2611,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3859
2611
  } & {
3860
2612
  type: "startGeneration";
3861
2613
  } & {
3862
- messages: Message[];
2614
+ messages: _perstack_core.Message[];
3863
2615
  }) | ({
3864
2616
  id: string;
3865
2617
  expertKey: string;
@@ -3869,10 +2621,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3869
2621
  } & {
3870
2622
  type: "retry";
3871
2623
  } & {
3872
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
3873
- toolCall?: ToolCall;
3874
- toolResult?: ToolResult;
3875
- usage: Usage;
2624
+ reason: string;
2625
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
2626
+ toolCall?: _perstack_core.ToolCall;
2627
+ toolResult?: _perstack_core.ToolResult;
2628
+ usage: _perstack_core.Usage;
3876
2629
  }) | ({
3877
2630
  id: string;
3878
2631
  expertKey: string;
@@ -3882,9 +2635,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3882
2635
  } & {
3883
2636
  type: "callTool";
3884
2637
  } & {
3885
- newMessage: ExpertMessage;
3886
- toolCall: ToolCall;
3887
- usage: Usage;
2638
+ newMessage: _perstack_core.ExpertMessage;
2639
+ toolCall: _perstack_core.ToolCall;
2640
+ usage: _perstack_core.Usage;
3888
2641
  }) | ({
3889
2642
  id: string;
3890
2643
  expertKey: string;
@@ -3894,9 +2647,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3894
2647
  } & {
3895
2648
  type: "callInteractiveTool";
3896
2649
  } & {
3897
- newMessage: ExpertMessage;
3898
- toolCall: ToolCall;
3899
- usage: Usage;
2650
+ newMessage: _perstack_core.ExpertMessage;
2651
+ toolCall: _perstack_core.ToolCall;
2652
+ usage: _perstack_core.Usage;
3900
2653
  }) | ({
3901
2654
  id: string;
3902
2655
  expertKey: string;
@@ -3906,9 +2659,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3906
2659
  } & {
3907
2660
  type: "callDelegate";
3908
2661
  } & {
3909
- newMessage: ExpertMessage;
3910
- toolCall: ToolCall;
3911
- usage: Usage;
2662
+ newMessage: _perstack_core.ExpertMessage;
2663
+ toolCall: _perstack_core.ToolCall;
2664
+ usage: _perstack_core.Usage;
3912
2665
  }) | ({
3913
2666
  id: string;
3914
2667
  expertKey: string;
@@ -3918,7 +2671,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3918
2671
  } & {
3919
2672
  type: "resolveToolResult";
3920
2673
  } & {
3921
- toolResult: ToolResult;
2674
+ toolResult: _perstack_core.ToolResult;
3922
2675
  }) | ({
3923
2676
  id: string;
3924
2677
  expertKey: string;
@@ -3928,7 +2681,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3928
2681
  } & {
3929
2682
  type: "resolveThought";
3930
2683
  } & {
3931
- toolResult: ToolResult;
2684
+ toolResult: _perstack_core.ToolResult;
3932
2685
  }) | ({
3933
2686
  id: string;
3934
2687
  expertKey: string;
@@ -3938,7 +2691,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3938
2691
  } & {
3939
2692
  type: "resolvePdfFile";
3940
2693
  } & {
3941
- toolResult: ToolResult;
2694
+ toolResult: _perstack_core.ToolResult;
3942
2695
  }) | ({
3943
2696
  id: string;
3944
2697
  expertKey: string;
@@ -3948,7 +2701,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3948
2701
  } & {
3949
2702
  type: "resolveImageFile";
3950
2703
  } & {
3951
- toolResult: ToolResult;
2704
+ toolResult: _perstack_core.ToolResult;
3952
2705
  }) | ({
3953
2706
  id: string;
3954
2707
  expertKey: string;
@@ -3958,7 +2711,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3958
2711
  } & {
3959
2712
  type: "attemptCompletion";
3960
2713
  } & {
3961
- toolResult: ToolResult;
2714
+ toolResult: _perstack_core.ToolResult;
3962
2715
  }) | ({
3963
2716
  id: string;
3964
2717
  expertKey: string;
@@ -3968,7 +2721,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
3968
2721
  } & {
3969
2722
  type: "finishToolCall";
3970
2723
  } & {
3971
- newMessages: (UserMessage | ToolMessage)[];
2724
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
3972
2725
  }) | ({
3973
2726
  id: string;
3974
2727
  expertKey: string;
@@ -4026,7 +2779,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4026
2779
  checkpoint: Checkpoint;
4027
2780
  step: Step;
4028
2781
  text: string;
4029
- usage: Usage;
2782
+ usage: _perstack_core.Usage;
4030
2783
  }), undefined, never, never, never, never, never>;
4031
2784
  };
4032
2785
  readonly resolveImageFile: {
@@ -4046,7 +2799,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4046
2799
  } & {
4047
2800
  type: "resolveImageFile";
4048
2801
  } & {
4049
- toolResult: ToolResult;
2802
+ toolResult: _perstack_core.ToolResult;
4050
2803
  }, ({
4051
2804
  id: string;
4052
2805
  expertKey: string;
@@ -4057,7 +2810,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4057
2810
  type: "startRun";
4058
2811
  } & {
4059
2812
  initialCheckpoint: Checkpoint;
4060
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
2813
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4061
2814
  }) | ({
4062
2815
  id: string;
4063
2816
  expertKey: string;
@@ -4067,7 +2820,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4067
2820
  } & {
4068
2821
  type: "startGeneration";
4069
2822
  } & {
4070
- messages: Message[];
2823
+ messages: _perstack_core.Message[];
4071
2824
  }) | ({
4072
2825
  id: string;
4073
2826
  expertKey: string;
@@ -4077,10 +2830,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4077
2830
  } & {
4078
2831
  type: "retry";
4079
2832
  } & {
4080
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
4081
- toolCall?: ToolCall;
4082
- toolResult?: ToolResult;
4083
- usage: Usage;
2833
+ reason: string;
2834
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
2835
+ toolCall?: _perstack_core.ToolCall;
2836
+ toolResult?: _perstack_core.ToolResult;
2837
+ usage: _perstack_core.Usage;
4084
2838
  }) | ({
4085
2839
  id: string;
4086
2840
  expertKey: string;
@@ -4090,9 +2844,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4090
2844
  } & {
4091
2845
  type: "callTool";
4092
2846
  } & {
4093
- newMessage: ExpertMessage;
4094
- toolCall: ToolCall;
4095
- usage: Usage;
2847
+ newMessage: _perstack_core.ExpertMessage;
2848
+ toolCall: _perstack_core.ToolCall;
2849
+ usage: _perstack_core.Usage;
4096
2850
  }) | ({
4097
2851
  id: string;
4098
2852
  expertKey: string;
@@ -4102,9 +2856,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4102
2856
  } & {
4103
2857
  type: "callInteractiveTool";
4104
2858
  } & {
4105
- newMessage: ExpertMessage;
4106
- toolCall: ToolCall;
4107
- usage: Usage;
2859
+ newMessage: _perstack_core.ExpertMessage;
2860
+ toolCall: _perstack_core.ToolCall;
2861
+ usage: _perstack_core.Usage;
4108
2862
  }) | ({
4109
2863
  id: string;
4110
2864
  expertKey: string;
@@ -4114,9 +2868,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4114
2868
  } & {
4115
2869
  type: "callDelegate";
4116
2870
  } & {
4117
- newMessage: ExpertMessage;
4118
- toolCall: ToolCall;
4119
- usage: Usage;
2871
+ newMessage: _perstack_core.ExpertMessage;
2872
+ toolCall: _perstack_core.ToolCall;
2873
+ usage: _perstack_core.Usage;
4120
2874
  }) | ({
4121
2875
  id: string;
4122
2876
  expertKey: string;
@@ -4126,7 +2880,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4126
2880
  } & {
4127
2881
  type: "resolveToolResult";
4128
2882
  } & {
4129
- toolResult: ToolResult;
2883
+ toolResult: _perstack_core.ToolResult;
4130
2884
  }) | ({
4131
2885
  id: string;
4132
2886
  expertKey: string;
@@ -4136,7 +2890,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4136
2890
  } & {
4137
2891
  type: "resolveThought";
4138
2892
  } & {
4139
- toolResult: ToolResult;
2893
+ toolResult: _perstack_core.ToolResult;
4140
2894
  }) | ({
4141
2895
  id: string;
4142
2896
  expertKey: string;
@@ -4146,7 +2900,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4146
2900
  } & {
4147
2901
  type: "resolvePdfFile";
4148
2902
  } & {
4149
- toolResult: ToolResult;
2903
+ toolResult: _perstack_core.ToolResult;
4150
2904
  }) | ({
4151
2905
  id: string;
4152
2906
  expertKey: string;
@@ -4156,7 +2910,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4156
2910
  } & {
4157
2911
  type: "resolveImageFile";
4158
2912
  } & {
4159
- toolResult: ToolResult;
2913
+ toolResult: _perstack_core.ToolResult;
4160
2914
  }) | ({
4161
2915
  id: string;
4162
2916
  expertKey: string;
@@ -4166,7 +2920,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4166
2920
  } & {
4167
2921
  type: "attemptCompletion";
4168
2922
  } & {
4169
- toolResult: ToolResult;
2923
+ toolResult: _perstack_core.ToolResult;
4170
2924
  }) | ({
4171
2925
  id: string;
4172
2926
  expertKey: string;
@@ -4176,7 +2930,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4176
2930
  } & {
4177
2931
  type: "finishToolCall";
4178
2932
  } & {
4179
- newMessages: (UserMessage | ToolMessage)[];
2933
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4180
2934
  }) | ({
4181
2935
  id: string;
4182
2936
  expertKey: string;
@@ -4234,7 +2988,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4234
2988
  checkpoint: Checkpoint;
4235
2989
  step: Step;
4236
2990
  text: string;
4237
- usage: Usage;
2991
+ usage: _perstack_core.Usage;
4238
2992
  }), undefined, never, never, never, never, never>;
4239
2993
  };
4240
2994
  readonly attemptCompletion: {
@@ -4254,7 +3008,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4254
3008
  } & {
4255
3009
  type: "attemptCompletion";
4256
3010
  } & {
4257
- toolResult: ToolResult;
3011
+ toolResult: _perstack_core.ToolResult;
4258
3012
  }, ({
4259
3013
  id: string;
4260
3014
  expertKey: string;
@@ -4265,7 +3019,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4265
3019
  type: "startRun";
4266
3020
  } & {
4267
3021
  initialCheckpoint: Checkpoint;
4268
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
3022
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4269
3023
  }) | ({
4270
3024
  id: string;
4271
3025
  expertKey: string;
@@ -4275,7 +3029,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4275
3029
  } & {
4276
3030
  type: "startGeneration";
4277
3031
  } & {
4278
- messages: Message[];
3032
+ messages: _perstack_core.Message[];
4279
3033
  }) | ({
4280
3034
  id: string;
4281
3035
  expertKey: string;
@@ -4285,10 +3039,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4285
3039
  } & {
4286
3040
  type: "retry";
4287
3041
  } & {
4288
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
4289
- toolCall?: ToolCall;
4290
- toolResult?: ToolResult;
4291
- usage: Usage;
3042
+ reason: string;
3043
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
3044
+ toolCall?: _perstack_core.ToolCall;
3045
+ toolResult?: _perstack_core.ToolResult;
3046
+ usage: _perstack_core.Usage;
4292
3047
  }) | ({
4293
3048
  id: string;
4294
3049
  expertKey: string;
@@ -4298,9 +3053,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4298
3053
  } & {
4299
3054
  type: "callTool";
4300
3055
  } & {
4301
- newMessage: ExpertMessage;
4302
- toolCall: ToolCall;
4303
- usage: Usage;
3056
+ newMessage: _perstack_core.ExpertMessage;
3057
+ toolCall: _perstack_core.ToolCall;
3058
+ usage: _perstack_core.Usage;
4304
3059
  }) | ({
4305
3060
  id: string;
4306
3061
  expertKey: string;
@@ -4310,9 +3065,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4310
3065
  } & {
4311
3066
  type: "callInteractiveTool";
4312
3067
  } & {
4313
- newMessage: ExpertMessage;
4314
- toolCall: ToolCall;
4315
- usage: Usage;
3068
+ newMessage: _perstack_core.ExpertMessage;
3069
+ toolCall: _perstack_core.ToolCall;
3070
+ usage: _perstack_core.Usage;
4316
3071
  }) | ({
4317
3072
  id: string;
4318
3073
  expertKey: string;
@@ -4322,9 +3077,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4322
3077
  } & {
4323
3078
  type: "callDelegate";
4324
3079
  } & {
4325
- newMessage: ExpertMessage;
4326
- toolCall: ToolCall;
4327
- usage: Usage;
3080
+ newMessage: _perstack_core.ExpertMessage;
3081
+ toolCall: _perstack_core.ToolCall;
3082
+ usage: _perstack_core.Usage;
4328
3083
  }) | ({
4329
3084
  id: string;
4330
3085
  expertKey: string;
@@ -4334,7 +3089,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4334
3089
  } & {
4335
3090
  type: "resolveToolResult";
4336
3091
  } & {
4337
- toolResult: ToolResult;
3092
+ toolResult: _perstack_core.ToolResult;
4338
3093
  }) | ({
4339
3094
  id: string;
4340
3095
  expertKey: string;
@@ -4344,7 +3099,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4344
3099
  } & {
4345
3100
  type: "resolveThought";
4346
3101
  } & {
4347
- toolResult: ToolResult;
3102
+ toolResult: _perstack_core.ToolResult;
4348
3103
  }) | ({
4349
3104
  id: string;
4350
3105
  expertKey: string;
@@ -4354,7 +3109,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4354
3109
  } & {
4355
3110
  type: "resolvePdfFile";
4356
3111
  } & {
4357
- toolResult: ToolResult;
3112
+ toolResult: _perstack_core.ToolResult;
4358
3113
  }) | ({
4359
3114
  id: string;
4360
3115
  expertKey: string;
@@ -4364,7 +3119,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4364
3119
  } & {
4365
3120
  type: "resolveImageFile";
4366
3121
  } & {
4367
- toolResult: ToolResult;
3122
+ toolResult: _perstack_core.ToolResult;
4368
3123
  }) | ({
4369
3124
  id: string;
4370
3125
  expertKey: string;
@@ -4374,7 +3129,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4374
3129
  } & {
4375
3130
  type: "attemptCompletion";
4376
3131
  } & {
4377
- toolResult: ToolResult;
3132
+ toolResult: _perstack_core.ToolResult;
4378
3133
  }) | ({
4379
3134
  id: string;
4380
3135
  expertKey: string;
@@ -4384,7 +3139,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4384
3139
  } & {
4385
3140
  type: "finishToolCall";
4386
3141
  } & {
4387
- newMessages: (UserMessage | ToolMessage)[];
3142
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4388
3143
  }) | ({
4389
3144
  id: string;
4390
3145
  expertKey: string;
@@ -4442,7 +3197,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4442
3197
  checkpoint: Checkpoint;
4443
3198
  step: Step;
4444
3199
  text: string;
4445
- usage: Usage;
3200
+ usage: _perstack_core.Usage;
4446
3201
  }), undefined, never, never, never, never, never>;
4447
3202
  };
4448
3203
  };
@@ -4466,7 +3221,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4466
3221
  } & {
4467
3222
  type: "finishToolCall";
4468
3223
  } & {
4469
- newMessages: (UserMessage | ToolMessage)[];
3224
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4470
3225
  }, ({
4471
3226
  id: string;
4472
3227
  expertKey: string;
@@ -4477,7 +3232,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4477
3232
  type: "startRun";
4478
3233
  } & {
4479
3234
  initialCheckpoint: Checkpoint;
4480
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
3235
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4481
3236
  }) | ({
4482
3237
  id: string;
4483
3238
  expertKey: string;
@@ -4487,7 +3242,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4487
3242
  } & {
4488
3243
  type: "startGeneration";
4489
3244
  } & {
4490
- messages: Message[];
3245
+ messages: _perstack_core.Message[];
4491
3246
  }) | ({
4492
3247
  id: string;
4493
3248
  expertKey: string;
@@ -4497,10 +3252,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4497
3252
  } & {
4498
3253
  type: "retry";
4499
3254
  } & {
4500
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
4501
- toolCall?: ToolCall;
4502
- toolResult?: ToolResult;
4503
- usage: Usage;
3255
+ reason: string;
3256
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
3257
+ toolCall?: _perstack_core.ToolCall;
3258
+ toolResult?: _perstack_core.ToolResult;
3259
+ usage: _perstack_core.Usage;
4504
3260
  }) | ({
4505
3261
  id: string;
4506
3262
  expertKey: string;
@@ -4510,9 +3266,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4510
3266
  } & {
4511
3267
  type: "callTool";
4512
3268
  } & {
4513
- newMessage: ExpertMessage;
4514
- toolCall: ToolCall;
4515
- usage: Usage;
3269
+ newMessage: _perstack_core.ExpertMessage;
3270
+ toolCall: _perstack_core.ToolCall;
3271
+ usage: _perstack_core.Usage;
4516
3272
  }) | ({
4517
3273
  id: string;
4518
3274
  expertKey: string;
@@ -4522,9 +3278,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4522
3278
  } & {
4523
3279
  type: "callInteractiveTool";
4524
3280
  } & {
4525
- newMessage: ExpertMessage;
4526
- toolCall: ToolCall;
4527
- usage: Usage;
3281
+ newMessage: _perstack_core.ExpertMessage;
3282
+ toolCall: _perstack_core.ToolCall;
3283
+ usage: _perstack_core.Usage;
4528
3284
  }) | ({
4529
3285
  id: string;
4530
3286
  expertKey: string;
@@ -4534,9 +3290,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4534
3290
  } & {
4535
3291
  type: "callDelegate";
4536
3292
  } & {
4537
- newMessage: ExpertMessage;
4538
- toolCall: ToolCall;
4539
- usage: Usage;
3293
+ newMessage: _perstack_core.ExpertMessage;
3294
+ toolCall: _perstack_core.ToolCall;
3295
+ usage: _perstack_core.Usage;
4540
3296
  }) | ({
4541
3297
  id: string;
4542
3298
  expertKey: string;
@@ -4546,7 +3302,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4546
3302
  } & {
4547
3303
  type: "resolveToolResult";
4548
3304
  } & {
4549
- toolResult: ToolResult;
3305
+ toolResult: _perstack_core.ToolResult;
4550
3306
  }) | ({
4551
3307
  id: string;
4552
3308
  expertKey: string;
@@ -4556,7 +3312,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4556
3312
  } & {
4557
3313
  type: "resolveThought";
4558
3314
  } & {
4559
- toolResult: ToolResult;
3315
+ toolResult: _perstack_core.ToolResult;
4560
3316
  }) | ({
4561
3317
  id: string;
4562
3318
  expertKey: string;
@@ -4566,7 +3322,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4566
3322
  } & {
4567
3323
  type: "resolvePdfFile";
4568
3324
  } & {
4569
- toolResult: ToolResult;
3325
+ toolResult: _perstack_core.ToolResult;
4570
3326
  }) | ({
4571
3327
  id: string;
4572
3328
  expertKey: string;
@@ -4576,7 +3332,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4576
3332
  } & {
4577
3333
  type: "resolveImageFile";
4578
3334
  } & {
4579
- toolResult: ToolResult;
3335
+ toolResult: _perstack_core.ToolResult;
4580
3336
  }) | ({
4581
3337
  id: string;
4582
3338
  expertKey: string;
@@ -4586,7 +3342,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4586
3342
  } & {
4587
3343
  type: "attemptCompletion";
4588
3344
  } & {
4589
- toolResult: ToolResult;
3345
+ toolResult: _perstack_core.ToolResult;
4590
3346
  }) | ({
4591
3347
  id: string;
4592
3348
  expertKey: string;
@@ -4596,7 +3352,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4596
3352
  } & {
4597
3353
  type: "finishToolCall";
4598
3354
  } & {
4599
- newMessages: (UserMessage | ToolMessage)[];
3355
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4600
3356
  }) | ({
4601
3357
  id: string;
4602
3358
  expertKey: string;
@@ -4654,7 +3410,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4654
3410
  checkpoint: Checkpoint;
4655
3411
  step: Step;
4656
3412
  text: string;
4657
- usage: Usage;
3413
+ usage: _perstack_core.Usage;
4658
3414
  }), undefined, never, never, never, never, never>;
4659
3415
  };
4660
3416
  };
@@ -4678,7 +3434,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4678
3434
  } & {
4679
3435
  type: "finishToolCall";
4680
3436
  } & {
4681
- newMessages: (UserMessage | ToolMessage)[];
3437
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4682
3438
  }, ({
4683
3439
  id: string;
4684
3440
  expertKey: string;
@@ -4689,7 +3445,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4689
3445
  type: "startRun";
4690
3446
  } & {
4691
3447
  initialCheckpoint: Checkpoint;
4692
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
3448
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4693
3449
  }) | ({
4694
3450
  id: string;
4695
3451
  expertKey: string;
@@ -4699,7 +3455,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4699
3455
  } & {
4700
3456
  type: "startGeneration";
4701
3457
  } & {
4702
- messages: Message[];
3458
+ messages: _perstack_core.Message[];
4703
3459
  }) | ({
4704
3460
  id: string;
4705
3461
  expertKey: string;
@@ -4709,10 +3465,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4709
3465
  } & {
4710
3466
  type: "retry";
4711
3467
  } & {
4712
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
4713
- toolCall?: ToolCall;
4714
- toolResult?: ToolResult;
4715
- usage: Usage;
3468
+ reason: string;
3469
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
3470
+ toolCall?: _perstack_core.ToolCall;
3471
+ toolResult?: _perstack_core.ToolResult;
3472
+ usage: _perstack_core.Usage;
4716
3473
  }) | ({
4717
3474
  id: string;
4718
3475
  expertKey: string;
@@ -4722,9 +3479,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4722
3479
  } & {
4723
3480
  type: "callTool";
4724
3481
  } & {
4725
- newMessage: ExpertMessage;
4726
- toolCall: ToolCall;
4727
- usage: Usage;
3482
+ newMessage: _perstack_core.ExpertMessage;
3483
+ toolCall: _perstack_core.ToolCall;
3484
+ usage: _perstack_core.Usage;
4728
3485
  }) | ({
4729
3486
  id: string;
4730
3487
  expertKey: string;
@@ -4734,9 +3491,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4734
3491
  } & {
4735
3492
  type: "callInteractiveTool";
4736
3493
  } & {
4737
- newMessage: ExpertMessage;
4738
- toolCall: ToolCall;
4739
- usage: Usage;
3494
+ newMessage: _perstack_core.ExpertMessage;
3495
+ toolCall: _perstack_core.ToolCall;
3496
+ usage: _perstack_core.Usage;
4740
3497
  }) | ({
4741
3498
  id: string;
4742
3499
  expertKey: string;
@@ -4746,9 +3503,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4746
3503
  } & {
4747
3504
  type: "callDelegate";
4748
3505
  } & {
4749
- newMessage: ExpertMessage;
4750
- toolCall: ToolCall;
4751
- usage: Usage;
3506
+ newMessage: _perstack_core.ExpertMessage;
3507
+ toolCall: _perstack_core.ToolCall;
3508
+ usage: _perstack_core.Usage;
4752
3509
  }) | ({
4753
3510
  id: string;
4754
3511
  expertKey: string;
@@ -4758,7 +3515,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4758
3515
  } & {
4759
3516
  type: "resolveToolResult";
4760
3517
  } & {
4761
- toolResult: ToolResult;
3518
+ toolResult: _perstack_core.ToolResult;
4762
3519
  }) | ({
4763
3520
  id: string;
4764
3521
  expertKey: string;
@@ -4768,7 +3525,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4768
3525
  } & {
4769
3526
  type: "resolveThought";
4770
3527
  } & {
4771
- toolResult: ToolResult;
3528
+ toolResult: _perstack_core.ToolResult;
4772
3529
  }) | ({
4773
3530
  id: string;
4774
3531
  expertKey: string;
@@ -4778,7 +3535,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4778
3535
  } & {
4779
3536
  type: "resolvePdfFile";
4780
3537
  } & {
4781
- toolResult: ToolResult;
3538
+ toolResult: _perstack_core.ToolResult;
4782
3539
  }) | ({
4783
3540
  id: string;
4784
3541
  expertKey: string;
@@ -4788,7 +3545,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4788
3545
  } & {
4789
3546
  type: "resolveImageFile";
4790
3547
  } & {
4791
- toolResult: ToolResult;
3548
+ toolResult: _perstack_core.ToolResult;
4792
3549
  }) | ({
4793
3550
  id: string;
4794
3551
  expertKey: string;
@@ -4798,7 +3555,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4798
3555
  } & {
4799
3556
  type: "attemptCompletion";
4800
3557
  } & {
4801
- toolResult: ToolResult;
3558
+ toolResult: _perstack_core.ToolResult;
4802
3559
  }) | ({
4803
3560
  id: string;
4804
3561
  expertKey: string;
@@ -4808,7 +3565,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4808
3565
  } & {
4809
3566
  type: "finishToolCall";
4810
3567
  } & {
4811
- newMessages: (UserMessage | ToolMessage)[];
3568
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4812
3569
  }) | ({
4813
3570
  id: string;
4814
3571
  expertKey: string;
@@ -4866,7 +3623,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4866
3623
  checkpoint: Checkpoint;
4867
3624
  step: Step;
4868
3625
  text: string;
4869
- usage: Usage;
3626
+ usage: _perstack_core.Usage;
4870
3627
  }), undefined, never, never, never, never, never>;
4871
3628
  };
4872
3629
  };
@@ -4890,7 +3647,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4890
3647
  } & {
4891
3648
  type: "finishToolCall";
4892
3649
  } & {
4893
- newMessages: (UserMessage | ToolMessage)[];
3650
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4894
3651
  }, ({
4895
3652
  id: string;
4896
3653
  expertKey: string;
@@ -4901,7 +3658,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4901
3658
  type: "startRun";
4902
3659
  } & {
4903
3660
  initialCheckpoint: Checkpoint;
4904
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
3661
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
4905
3662
  }) | ({
4906
3663
  id: string;
4907
3664
  expertKey: string;
@@ -4911,7 +3668,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4911
3668
  } & {
4912
3669
  type: "startGeneration";
4913
3670
  } & {
4914
- messages: Message[];
3671
+ messages: _perstack_core.Message[];
4915
3672
  }) | ({
4916
3673
  id: string;
4917
3674
  expertKey: string;
@@ -4921,10 +3678,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4921
3678
  } & {
4922
3679
  type: "retry";
4923
3680
  } & {
4924
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
4925
- toolCall?: ToolCall;
4926
- toolResult?: ToolResult;
4927
- usage: Usage;
3681
+ reason: string;
3682
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
3683
+ toolCall?: _perstack_core.ToolCall;
3684
+ toolResult?: _perstack_core.ToolResult;
3685
+ usage: _perstack_core.Usage;
4928
3686
  }) | ({
4929
3687
  id: string;
4930
3688
  expertKey: string;
@@ -4934,9 +3692,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4934
3692
  } & {
4935
3693
  type: "callTool";
4936
3694
  } & {
4937
- newMessage: ExpertMessage;
4938
- toolCall: ToolCall;
4939
- usage: Usage;
3695
+ newMessage: _perstack_core.ExpertMessage;
3696
+ toolCall: _perstack_core.ToolCall;
3697
+ usage: _perstack_core.Usage;
4940
3698
  }) | ({
4941
3699
  id: string;
4942
3700
  expertKey: string;
@@ -4946,9 +3704,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4946
3704
  } & {
4947
3705
  type: "callInteractiveTool";
4948
3706
  } & {
4949
- newMessage: ExpertMessage;
4950
- toolCall: ToolCall;
4951
- usage: Usage;
3707
+ newMessage: _perstack_core.ExpertMessage;
3708
+ toolCall: _perstack_core.ToolCall;
3709
+ usage: _perstack_core.Usage;
4952
3710
  }) | ({
4953
3711
  id: string;
4954
3712
  expertKey: string;
@@ -4958,9 +3716,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4958
3716
  } & {
4959
3717
  type: "callDelegate";
4960
3718
  } & {
4961
- newMessage: ExpertMessage;
4962
- toolCall: ToolCall;
4963
- usage: Usage;
3719
+ newMessage: _perstack_core.ExpertMessage;
3720
+ toolCall: _perstack_core.ToolCall;
3721
+ usage: _perstack_core.Usage;
4964
3722
  }) | ({
4965
3723
  id: string;
4966
3724
  expertKey: string;
@@ -4970,7 +3728,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4970
3728
  } & {
4971
3729
  type: "resolveToolResult";
4972
3730
  } & {
4973
- toolResult: ToolResult;
3731
+ toolResult: _perstack_core.ToolResult;
4974
3732
  }) | ({
4975
3733
  id: string;
4976
3734
  expertKey: string;
@@ -4980,7 +3738,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4980
3738
  } & {
4981
3739
  type: "resolveThought";
4982
3740
  } & {
4983
- toolResult: ToolResult;
3741
+ toolResult: _perstack_core.ToolResult;
4984
3742
  }) | ({
4985
3743
  id: string;
4986
3744
  expertKey: string;
@@ -4990,7 +3748,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
4990
3748
  } & {
4991
3749
  type: "resolvePdfFile";
4992
3750
  } & {
4993
- toolResult: ToolResult;
3751
+ toolResult: _perstack_core.ToolResult;
4994
3752
  }) | ({
4995
3753
  id: string;
4996
3754
  expertKey: string;
@@ -5000,7 +3758,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5000
3758
  } & {
5001
3759
  type: "resolveImageFile";
5002
3760
  } & {
5003
- toolResult: ToolResult;
3761
+ toolResult: _perstack_core.ToolResult;
5004
3762
  }) | ({
5005
3763
  id: string;
5006
3764
  expertKey: string;
@@ -5010,7 +3768,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5010
3768
  } & {
5011
3769
  type: "attemptCompletion";
5012
3770
  } & {
5013
- toolResult: ToolResult;
3771
+ toolResult: _perstack_core.ToolResult;
5014
3772
  }) | ({
5015
3773
  id: string;
5016
3774
  expertKey: string;
@@ -5020,7 +3778,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5020
3778
  } & {
5021
3779
  type: "finishToolCall";
5022
3780
  } & {
5023
- newMessages: (UserMessage | ToolMessage)[];
3781
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5024
3782
  }) | ({
5025
3783
  id: string;
5026
3784
  expertKey: string;
@@ -5078,7 +3836,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5078
3836
  checkpoint: Checkpoint;
5079
3837
  step: Step;
5080
3838
  text: string;
5081
- usage: Usage;
3839
+ usage: _perstack_core.Usage;
5082
3840
  }), undefined, never, never, never, never, never>;
5083
3841
  };
5084
3842
  };
@@ -5102,7 +3860,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5102
3860
  } & {
5103
3861
  type: "finishToolCall";
5104
3862
  } & {
5105
- newMessages: (UserMessage | ToolMessage)[];
3863
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5106
3864
  }, ({
5107
3865
  id: string;
5108
3866
  expertKey: string;
@@ -5113,7 +3871,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5113
3871
  type: "startRun";
5114
3872
  } & {
5115
3873
  initialCheckpoint: Checkpoint;
5116
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
3874
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5117
3875
  }) | ({
5118
3876
  id: string;
5119
3877
  expertKey: string;
@@ -5123,7 +3881,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5123
3881
  } & {
5124
3882
  type: "startGeneration";
5125
3883
  } & {
5126
- messages: Message[];
3884
+ messages: _perstack_core.Message[];
5127
3885
  }) | ({
5128
3886
  id: string;
5129
3887
  expertKey: string;
@@ -5133,10 +3891,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5133
3891
  } & {
5134
3892
  type: "retry";
5135
3893
  } & {
5136
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
5137
- toolCall?: ToolCall;
5138
- toolResult?: ToolResult;
5139
- usage: Usage;
3894
+ reason: string;
3895
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
3896
+ toolCall?: _perstack_core.ToolCall;
3897
+ toolResult?: _perstack_core.ToolResult;
3898
+ usage: _perstack_core.Usage;
5140
3899
  }) | ({
5141
3900
  id: string;
5142
3901
  expertKey: string;
@@ -5146,9 +3905,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5146
3905
  } & {
5147
3906
  type: "callTool";
5148
3907
  } & {
5149
- newMessage: ExpertMessage;
5150
- toolCall: ToolCall;
5151
- usage: Usage;
3908
+ newMessage: _perstack_core.ExpertMessage;
3909
+ toolCall: _perstack_core.ToolCall;
3910
+ usage: _perstack_core.Usage;
5152
3911
  }) | ({
5153
3912
  id: string;
5154
3913
  expertKey: string;
@@ -5158,9 +3917,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5158
3917
  } & {
5159
3918
  type: "callInteractiveTool";
5160
3919
  } & {
5161
- newMessage: ExpertMessage;
5162
- toolCall: ToolCall;
5163
- usage: Usage;
3920
+ newMessage: _perstack_core.ExpertMessage;
3921
+ toolCall: _perstack_core.ToolCall;
3922
+ usage: _perstack_core.Usage;
5164
3923
  }) | ({
5165
3924
  id: string;
5166
3925
  expertKey: string;
@@ -5170,9 +3929,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5170
3929
  } & {
5171
3930
  type: "callDelegate";
5172
3931
  } & {
5173
- newMessage: ExpertMessage;
5174
- toolCall: ToolCall;
5175
- usage: Usage;
3932
+ newMessage: _perstack_core.ExpertMessage;
3933
+ toolCall: _perstack_core.ToolCall;
3934
+ usage: _perstack_core.Usage;
5176
3935
  }) | ({
5177
3936
  id: string;
5178
3937
  expertKey: string;
@@ -5182,7 +3941,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5182
3941
  } & {
5183
3942
  type: "resolveToolResult";
5184
3943
  } & {
5185
- toolResult: ToolResult;
3944
+ toolResult: _perstack_core.ToolResult;
5186
3945
  }) | ({
5187
3946
  id: string;
5188
3947
  expertKey: string;
@@ -5192,7 +3951,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5192
3951
  } & {
5193
3952
  type: "resolveThought";
5194
3953
  } & {
5195
- toolResult: ToolResult;
3954
+ toolResult: _perstack_core.ToolResult;
5196
3955
  }) | ({
5197
3956
  id: string;
5198
3957
  expertKey: string;
@@ -5202,7 +3961,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5202
3961
  } & {
5203
3962
  type: "resolvePdfFile";
5204
3963
  } & {
5205
- toolResult: ToolResult;
3964
+ toolResult: _perstack_core.ToolResult;
5206
3965
  }) | ({
5207
3966
  id: string;
5208
3967
  expertKey: string;
@@ -5212,7 +3971,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5212
3971
  } & {
5213
3972
  type: "resolveImageFile";
5214
3973
  } & {
5215
- toolResult: ToolResult;
3974
+ toolResult: _perstack_core.ToolResult;
5216
3975
  }) | ({
5217
3976
  id: string;
5218
3977
  expertKey: string;
@@ -5222,7 +3981,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5222
3981
  } & {
5223
3982
  type: "attemptCompletion";
5224
3983
  } & {
5225
- toolResult: ToolResult;
3984
+ toolResult: _perstack_core.ToolResult;
5226
3985
  }) | ({
5227
3986
  id: string;
5228
3987
  expertKey: string;
@@ -5232,7 +3991,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5232
3991
  } & {
5233
3992
  type: "finishToolCall";
5234
3993
  } & {
5235
- newMessages: (UserMessage | ToolMessage)[];
3994
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5236
3995
  }) | ({
5237
3996
  id: string;
5238
3997
  expertKey: string;
@@ -5290,7 +4049,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5290
4049
  checkpoint: Checkpoint;
5291
4050
  step: Step;
5292
4051
  text: string;
5293
- usage: Usage;
4052
+ usage: _perstack_core.Usage;
5294
4053
  }), undefined, never, never, never, never, never>;
5295
4054
  };
5296
4055
  };
@@ -5314,10 +4073,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5314
4073
  } & {
5315
4074
  type: "retry";
5316
4075
  } & {
5317
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
5318
- toolCall?: ToolCall;
5319
- toolResult?: ToolResult;
5320
- usage: Usage;
4076
+ reason: string;
4077
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
4078
+ toolCall?: _perstack_core.ToolCall;
4079
+ toolResult?: _perstack_core.ToolResult;
4080
+ usage: _perstack_core.Usage;
5321
4081
  }, ({
5322
4082
  id: string;
5323
4083
  expertKey: string;
@@ -5328,7 +4088,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5328
4088
  type: "startRun";
5329
4089
  } & {
5330
4090
  initialCheckpoint: Checkpoint;
5331
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
4091
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5332
4092
  }) | ({
5333
4093
  id: string;
5334
4094
  expertKey: string;
@@ -5338,7 +4098,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5338
4098
  } & {
5339
4099
  type: "startGeneration";
5340
4100
  } & {
5341
- messages: Message[];
4101
+ messages: _perstack_core.Message[];
5342
4102
  }) | ({
5343
4103
  id: string;
5344
4104
  expertKey: string;
@@ -5348,10 +4108,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5348
4108
  } & {
5349
4109
  type: "retry";
5350
4110
  } & {
5351
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
5352
- toolCall?: ToolCall;
5353
- toolResult?: ToolResult;
5354
- usage: Usage;
4111
+ reason: string;
4112
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
4113
+ toolCall?: _perstack_core.ToolCall;
4114
+ toolResult?: _perstack_core.ToolResult;
4115
+ usage: _perstack_core.Usage;
5355
4116
  }) | ({
5356
4117
  id: string;
5357
4118
  expertKey: string;
@@ -5361,9 +4122,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5361
4122
  } & {
5362
4123
  type: "callTool";
5363
4124
  } & {
5364
- newMessage: ExpertMessage;
5365
- toolCall: ToolCall;
5366
- usage: Usage;
4125
+ newMessage: _perstack_core.ExpertMessage;
4126
+ toolCall: _perstack_core.ToolCall;
4127
+ usage: _perstack_core.Usage;
5367
4128
  }) | ({
5368
4129
  id: string;
5369
4130
  expertKey: string;
@@ -5373,9 +4134,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5373
4134
  } & {
5374
4135
  type: "callInteractiveTool";
5375
4136
  } & {
5376
- newMessage: ExpertMessage;
5377
- toolCall: ToolCall;
5378
- usage: Usage;
4137
+ newMessage: _perstack_core.ExpertMessage;
4138
+ toolCall: _perstack_core.ToolCall;
4139
+ usage: _perstack_core.Usage;
5379
4140
  }) | ({
5380
4141
  id: string;
5381
4142
  expertKey: string;
@@ -5385,9 +4146,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5385
4146
  } & {
5386
4147
  type: "callDelegate";
5387
4148
  } & {
5388
- newMessage: ExpertMessage;
5389
- toolCall: ToolCall;
5390
- usage: Usage;
4149
+ newMessage: _perstack_core.ExpertMessage;
4150
+ toolCall: _perstack_core.ToolCall;
4151
+ usage: _perstack_core.Usage;
5391
4152
  }) | ({
5392
4153
  id: string;
5393
4154
  expertKey: string;
@@ -5397,7 +4158,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5397
4158
  } & {
5398
4159
  type: "resolveToolResult";
5399
4160
  } & {
5400
- toolResult: ToolResult;
4161
+ toolResult: _perstack_core.ToolResult;
5401
4162
  }) | ({
5402
4163
  id: string;
5403
4164
  expertKey: string;
@@ -5407,7 +4168,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5407
4168
  } & {
5408
4169
  type: "resolveThought";
5409
4170
  } & {
5410
- toolResult: ToolResult;
4171
+ toolResult: _perstack_core.ToolResult;
5411
4172
  }) | ({
5412
4173
  id: string;
5413
4174
  expertKey: string;
@@ -5417,7 +4178,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5417
4178
  } & {
5418
4179
  type: "resolvePdfFile";
5419
4180
  } & {
5420
- toolResult: ToolResult;
4181
+ toolResult: _perstack_core.ToolResult;
5421
4182
  }) | ({
5422
4183
  id: string;
5423
4184
  expertKey: string;
@@ -5427,7 +4188,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5427
4188
  } & {
5428
4189
  type: "resolveImageFile";
5429
4190
  } & {
5430
- toolResult: ToolResult;
4191
+ toolResult: _perstack_core.ToolResult;
5431
4192
  }) | ({
5432
4193
  id: string;
5433
4194
  expertKey: string;
@@ -5437,7 +4198,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5437
4198
  } & {
5438
4199
  type: "attemptCompletion";
5439
4200
  } & {
5440
- toolResult: ToolResult;
4201
+ toolResult: _perstack_core.ToolResult;
5441
4202
  }) | ({
5442
4203
  id: string;
5443
4204
  expertKey: string;
@@ -5447,7 +4208,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5447
4208
  } & {
5448
4209
  type: "finishToolCall";
5449
4210
  } & {
5450
- newMessages: (UserMessage | ToolMessage)[];
4211
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5451
4212
  }) | ({
5452
4213
  id: string;
5453
4214
  expertKey: string;
@@ -5505,7 +4266,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5505
4266
  checkpoint: Checkpoint;
5506
4267
  step: Step;
5507
4268
  text: string;
5508
- usage: Usage;
4269
+ usage: _perstack_core.Usage;
5509
4270
  }), undefined, never, never, never, never, never>;
5510
4271
  };
5511
4272
  readonly completeRun: {
@@ -5528,7 +4289,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5528
4289
  checkpoint: Checkpoint;
5529
4290
  step: Step;
5530
4291
  text: string;
5531
- usage: Usage;
4292
+ usage: _perstack_core.Usage;
5532
4293
  }, ({
5533
4294
  id: string;
5534
4295
  expertKey: string;
@@ -5539,7 +4300,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5539
4300
  type: "startRun";
5540
4301
  } & {
5541
4302
  initialCheckpoint: Checkpoint;
5542
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
4303
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5543
4304
  }) | ({
5544
4305
  id: string;
5545
4306
  expertKey: string;
@@ -5549,7 +4310,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5549
4310
  } & {
5550
4311
  type: "startGeneration";
5551
4312
  } & {
5552
- messages: Message[];
4313
+ messages: _perstack_core.Message[];
5553
4314
  }) | ({
5554
4315
  id: string;
5555
4316
  expertKey: string;
@@ -5559,10 +4320,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5559
4320
  } & {
5560
4321
  type: "retry";
5561
4322
  } & {
5562
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
5563
- toolCall?: ToolCall;
5564
- toolResult?: ToolResult;
5565
- usage: Usage;
4323
+ reason: string;
4324
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
4325
+ toolCall?: _perstack_core.ToolCall;
4326
+ toolResult?: _perstack_core.ToolResult;
4327
+ usage: _perstack_core.Usage;
5566
4328
  }) | ({
5567
4329
  id: string;
5568
4330
  expertKey: string;
@@ -5572,9 +4334,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5572
4334
  } & {
5573
4335
  type: "callTool";
5574
4336
  } & {
5575
- newMessage: ExpertMessage;
5576
- toolCall: ToolCall;
5577
- usage: Usage;
4337
+ newMessage: _perstack_core.ExpertMessage;
4338
+ toolCall: _perstack_core.ToolCall;
4339
+ usage: _perstack_core.Usage;
5578
4340
  }) | ({
5579
4341
  id: string;
5580
4342
  expertKey: string;
@@ -5584,9 +4346,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5584
4346
  } & {
5585
4347
  type: "callInteractiveTool";
5586
4348
  } & {
5587
- newMessage: ExpertMessage;
5588
- toolCall: ToolCall;
5589
- usage: Usage;
4349
+ newMessage: _perstack_core.ExpertMessage;
4350
+ toolCall: _perstack_core.ToolCall;
4351
+ usage: _perstack_core.Usage;
5590
4352
  }) | ({
5591
4353
  id: string;
5592
4354
  expertKey: string;
@@ -5596,9 +4358,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5596
4358
  } & {
5597
4359
  type: "callDelegate";
5598
4360
  } & {
5599
- newMessage: ExpertMessage;
5600
- toolCall: ToolCall;
5601
- usage: Usage;
4361
+ newMessage: _perstack_core.ExpertMessage;
4362
+ toolCall: _perstack_core.ToolCall;
4363
+ usage: _perstack_core.Usage;
5602
4364
  }) | ({
5603
4365
  id: string;
5604
4366
  expertKey: string;
@@ -5608,7 +4370,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5608
4370
  } & {
5609
4371
  type: "resolveToolResult";
5610
4372
  } & {
5611
- toolResult: ToolResult;
4373
+ toolResult: _perstack_core.ToolResult;
5612
4374
  }) | ({
5613
4375
  id: string;
5614
4376
  expertKey: string;
@@ -5618,7 +4380,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5618
4380
  } & {
5619
4381
  type: "resolveThought";
5620
4382
  } & {
5621
- toolResult: ToolResult;
4383
+ toolResult: _perstack_core.ToolResult;
5622
4384
  }) | ({
5623
4385
  id: string;
5624
4386
  expertKey: string;
@@ -5628,7 +4390,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5628
4390
  } & {
5629
4391
  type: "resolvePdfFile";
5630
4392
  } & {
5631
- toolResult: ToolResult;
4393
+ toolResult: _perstack_core.ToolResult;
5632
4394
  }) | ({
5633
4395
  id: string;
5634
4396
  expertKey: string;
@@ -5638,7 +4400,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5638
4400
  } & {
5639
4401
  type: "resolveImageFile";
5640
4402
  } & {
5641
- toolResult: ToolResult;
4403
+ toolResult: _perstack_core.ToolResult;
5642
4404
  }) | ({
5643
4405
  id: string;
5644
4406
  expertKey: string;
@@ -5648,7 +4410,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5648
4410
  } & {
5649
4411
  type: "attemptCompletion";
5650
4412
  } & {
5651
- toolResult: ToolResult;
4413
+ toolResult: _perstack_core.ToolResult;
5652
4414
  }) | ({
5653
4415
  id: string;
5654
4416
  expertKey: string;
@@ -5658,7 +4420,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5658
4420
  } & {
5659
4421
  type: "finishToolCall";
5660
4422
  } & {
5661
- newMessages: (UserMessage | ToolMessage)[];
4423
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5662
4424
  }) | ({
5663
4425
  id: string;
5664
4426
  expertKey: string;
@@ -5716,7 +4478,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5716
4478
  checkpoint: Checkpoint;
5717
4479
  step: Step;
5718
4480
  text: string;
5719
- usage: Usage;
4481
+ usage: _perstack_core.Usage;
5720
4482
  }), undefined, never, never, never, never, never>;
5721
4483
  };
5722
4484
  };
@@ -5752,7 +4514,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5752
4514
  type: "startRun";
5753
4515
  } & {
5754
4516
  initialCheckpoint: Checkpoint;
5755
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
4517
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5756
4518
  }) | ({
5757
4519
  id: string;
5758
4520
  expertKey: string;
@@ -5762,7 +4524,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5762
4524
  } & {
5763
4525
  type: "startGeneration";
5764
4526
  } & {
5765
- messages: Message[];
4527
+ messages: _perstack_core.Message[];
5766
4528
  }) | ({
5767
4529
  id: string;
5768
4530
  expertKey: string;
@@ -5772,10 +4534,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5772
4534
  } & {
5773
4535
  type: "retry";
5774
4536
  } & {
5775
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
5776
- toolCall?: ToolCall;
5777
- toolResult?: ToolResult;
5778
- usage: Usage;
4537
+ reason: string;
4538
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
4539
+ toolCall?: _perstack_core.ToolCall;
4540
+ toolResult?: _perstack_core.ToolResult;
4541
+ usage: _perstack_core.Usage;
5779
4542
  }) | ({
5780
4543
  id: string;
5781
4544
  expertKey: string;
@@ -5785,9 +4548,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5785
4548
  } & {
5786
4549
  type: "callTool";
5787
4550
  } & {
5788
- newMessage: ExpertMessage;
5789
- toolCall: ToolCall;
5790
- usage: Usage;
4551
+ newMessage: _perstack_core.ExpertMessage;
4552
+ toolCall: _perstack_core.ToolCall;
4553
+ usage: _perstack_core.Usage;
5791
4554
  }) | ({
5792
4555
  id: string;
5793
4556
  expertKey: string;
@@ -5797,9 +4560,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5797
4560
  } & {
5798
4561
  type: "callInteractiveTool";
5799
4562
  } & {
5800
- newMessage: ExpertMessage;
5801
- toolCall: ToolCall;
5802
- usage: Usage;
4563
+ newMessage: _perstack_core.ExpertMessage;
4564
+ toolCall: _perstack_core.ToolCall;
4565
+ usage: _perstack_core.Usage;
5803
4566
  }) | ({
5804
4567
  id: string;
5805
4568
  expertKey: string;
@@ -5809,9 +4572,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5809
4572
  } & {
5810
4573
  type: "callDelegate";
5811
4574
  } & {
5812
- newMessage: ExpertMessage;
5813
- toolCall: ToolCall;
5814
- usage: Usage;
4575
+ newMessage: _perstack_core.ExpertMessage;
4576
+ toolCall: _perstack_core.ToolCall;
4577
+ usage: _perstack_core.Usage;
5815
4578
  }) | ({
5816
4579
  id: string;
5817
4580
  expertKey: string;
@@ -5821,7 +4584,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5821
4584
  } & {
5822
4585
  type: "resolveToolResult";
5823
4586
  } & {
5824
- toolResult: ToolResult;
4587
+ toolResult: _perstack_core.ToolResult;
5825
4588
  }) | ({
5826
4589
  id: string;
5827
4590
  expertKey: string;
@@ -5831,7 +4594,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5831
4594
  } & {
5832
4595
  type: "resolveThought";
5833
4596
  } & {
5834
- toolResult: ToolResult;
4597
+ toolResult: _perstack_core.ToolResult;
5835
4598
  }) | ({
5836
4599
  id: string;
5837
4600
  expertKey: string;
@@ -5841,7 +4604,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5841
4604
  } & {
5842
4605
  type: "resolvePdfFile";
5843
4606
  } & {
5844
- toolResult: ToolResult;
4607
+ toolResult: _perstack_core.ToolResult;
5845
4608
  }) | ({
5846
4609
  id: string;
5847
4610
  expertKey: string;
@@ -5851,7 +4614,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5851
4614
  } & {
5852
4615
  type: "resolveImageFile";
5853
4616
  } & {
5854
- toolResult: ToolResult;
4617
+ toolResult: _perstack_core.ToolResult;
5855
4618
  }) | ({
5856
4619
  id: string;
5857
4620
  expertKey: string;
@@ -5861,7 +4624,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5861
4624
  } & {
5862
4625
  type: "attemptCompletion";
5863
4626
  } & {
5864
- toolResult: ToolResult;
4627
+ toolResult: _perstack_core.ToolResult;
5865
4628
  }) | ({
5866
4629
  id: string;
5867
4630
  expertKey: string;
@@ -5871,7 +4634,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5871
4634
  } & {
5872
4635
  type: "finishToolCall";
5873
4636
  } & {
5874
- newMessages: (UserMessage | ToolMessage)[];
4637
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5875
4638
  }) | ({
5876
4639
  id: string;
5877
4640
  expertKey: string;
@@ -5929,7 +4692,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5929
4692
  checkpoint: Checkpoint;
5930
4693
  step: Step;
5931
4694
  text: string;
5932
- usage: Usage;
4695
+ usage: _perstack_core.Usage;
5933
4696
  }), undefined, never, never, never, never, never>;
5934
4697
  };
5935
4698
  };
@@ -5965,7 +4728,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5965
4728
  type: "startRun";
5966
4729
  } & {
5967
4730
  initialCheckpoint: Checkpoint;
5968
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
4731
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
5969
4732
  }) | ({
5970
4733
  id: string;
5971
4734
  expertKey: string;
@@ -5975,7 +4738,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5975
4738
  } & {
5976
4739
  type: "startGeneration";
5977
4740
  } & {
5978
- messages: Message[];
4741
+ messages: _perstack_core.Message[];
5979
4742
  }) | ({
5980
4743
  id: string;
5981
4744
  expertKey: string;
@@ -5985,10 +4748,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5985
4748
  } & {
5986
4749
  type: "retry";
5987
4750
  } & {
5988
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
5989
- toolCall?: ToolCall;
5990
- toolResult?: ToolResult;
5991
- usage: Usage;
4751
+ reason: string;
4752
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
4753
+ toolCall?: _perstack_core.ToolCall;
4754
+ toolResult?: _perstack_core.ToolResult;
4755
+ usage: _perstack_core.Usage;
5992
4756
  }) | ({
5993
4757
  id: string;
5994
4758
  expertKey: string;
@@ -5998,9 +4762,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
5998
4762
  } & {
5999
4763
  type: "callTool";
6000
4764
  } & {
6001
- newMessage: ExpertMessage;
6002
- toolCall: ToolCall;
6003
- usage: Usage;
4765
+ newMessage: _perstack_core.ExpertMessage;
4766
+ toolCall: _perstack_core.ToolCall;
4767
+ usage: _perstack_core.Usage;
6004
4768
  }) | ({
6005
4769
  id: string;
6006
4770
  expertKey: string;
@@ -6010,9 +4774,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6010
4774
  } & {
6011
4775
  type: "callInteractiveTool";
6012
4776
  } & {
6013
- newMessage: ExpertMessage;
6014
- toolCall: ToolCall;
6015
- usage: Usage;
4777
+ newMessage: _perstack_core.ExpertMessage;
4778
+ toolCall: _perstack_core.ToolCall;
4779
+ usage: _perstack_core.Usage;
6016
4780
  }) | ({
6017
4781
  id: string;
6018
4782
  expertKey: string;
@@ -6022,9 +4786,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6022
4786
  } & {
6023
4787
  type: "callDelegate";
6024
4788
  } & {
6025
- newMessage: ExpertMessage;
6026
- toolCall: ToolCall;
6027
- usage: Usage;
4789
+ newMessage: _perstack_core.ExpertMessage;
4790
+ toolCall: _perstack_core.ToolCall;
4791
+ usage: _perstack_core.Usage;
6028
4792
  }) | ({
6029
4793
  id: string;
6030
4794
  expertKey: string;
@@ -6034,7 +4798,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6034
4798
  } & {
6035
4799
  type: "resolveToolResult";
6036
4800
  } & {
6037
- toolResult: ToolResult;
4801
+ toolResult: _perstack_core.ToolResult;
6038
4802
  }) | ({
6039
4803
  id: string;
6040
4804
  expertKey: string;
@@ -6044,7 +4808,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6044
4808
  } & {
6045
4809
  type: "resolveThought";
6046
4810
  } & {
6047
- toolResult: ToolResult;
4811
+ toolResult: _perstack_core.ToolResult;
6048
4812
  }) | ({
6049
4813
  id: string;
6050
4814
  expertKey: string;
@@ -6054,7 +4818,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6054
4818
  } & {
6055
4819
  type: "resolvePdfFile";
6056
4820
  } & {
6057
- toolResult: ToolResult;
4821
+ toolResult: _perstack_core.ToolResult;
6058
4822
  }) | ({
6059
4823
  id: string;
6060
4824
  expertKey: string;
@@ -6064,7 +4828,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6064
4828
  } & {
6065
4829
  type: "resolveImageFile";
6066
4830
  } & {
6067
- toolResult: ToolResult;
4831
+ toolResult: _perstack_core.ToolResult;
6068
4832
  }) | ({
6069
4833
  id: string;
6070
4834
  expertKey: string;
@@ -6074,7 +4838,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6074
4838
  } & {
6075
4839
  type: "attemptCompletion";
6076
4840
  } & {
6077
- toolResult: ToolResult;
4841
+ toolResult: _perstack_core.ToolResult;
6078
4842
  }) | ({
6079
4843
  id: string;
6080
4844
  expertKey: string;
@@ -6084,7 +4848,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6084
4848
  } & {
6085
4849
  type: "finishToolCall";
6086
4850
  } & {
6087
- newMessages: (UserMessage | ToolMessage)[];
4851
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
6088
4852
  }) | ({
6089
4853
  id: string;
6090
4854
  expertKey: string;
@@ -6142,7 +4906,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6142
4906
  checkpoint: Checkpoint;
6143
4907
  step: Step;
6144
4908
  text: string;
6145
- usage: Usage;
4909
+ usage: _perstack_core.Usage;
6146
4910
  }), undefined, never, never, never, never, never>;
6147
4911
  };
6148
4912
  };
@@ -6179,7 +4943,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6179
4943
  type: "startRun";
6180
4944
  } & {
6181
4945
  initialCheckpoint: Checkpoint;
6182
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
4946
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
6183
4947
  }) | ({
6184
4948
  id: string;
6185
4949
  expertKey: string;
@@ -6189,7 +4953,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6189
4953
  } & {
6190
4954
  type: "startGeneration";
6191
4955
  } & {
6192
- messages: Message[];
4956
+ messages: _perstack_core.Message[];
6193
4957
  }) | ({
6194
4958
  id: string;
6195
4959
  expertKey: string;
@@ -6199,10 +4963,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6199
4963
  } & {
6200
4964
  type: "retry";
6201
4965
  } & {
6202
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
6203
- toolCall?: ToolCall;
6204
- toolResult?: ToolResult;
6205
- usage: Usage;
4966
+ reason: string;
4967
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
4968
+ toolCall?: _perstack_core.ToolCall;
4969
+ toolResult?: _perstack_core.ToolResult;
4970
+ usage: _perstack_core.Usage;
6206
4971
  }) | ({
6207
4972
  id: string;
6208
4973
  expertKey: string;
@@ -6212,9 +4977,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6212
4977
  } & {
6213
4978
  type: "callTool";
6214
4979
  } & {
6215
- newMessage: ExpertMessage;
6216
- toolCall: ToolCall;
6217
- usage: Usage;
4980
+ newMessage: _perstack_core.ExpertMessage;
4981
+ toolCall: _perstack_core.ToolCall;
4982
+ usage: _perstack_core.Usage;
6218
4983
  }) | ({
6219
4984
  id: string;
6220
4985
  expertKey: string;
@@ -6224,9 +4989,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6224
4989
  } & {
6225
4990
  type: "callInteractiveTool";
6226
4991
  } & {
6227
- newMessage: ExpertMessage;
6228
- toolCall: ToolCall;
6229
- usage: Usage;
4992
+ newMessage: _perstack_core.ExpertMessage;
4993
+ toolCall: _perstack_core.ToolCall;
4994
+ usage: _perstack_core.Usage;
6230
4995
  }) | ({
6231
4996
  id: string;
6232
4997
  expertKey: string;
@@ -6236,9 +5001,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6236
5001
  } & {
6237
5002
  type: "callDelegate";
6238
5003
  } & {
6239
- newMessage: ExpertMessage;
6240
- toolCall: ToolCall;
6241
- usage: Usage;
5004
+ newMessage: _perstack_core.ExpertMessage;
5005
+ toolCall: _perstack_core.ToolCall;
5006
+ usage: _perstack_core.Usage;
6242
5007
  }) | ({
6243
5008
  id: string;
6244
5009
  expertKey: string;
@@ -6248,7 +5013,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6248
5013
  } & {
6249
5014
  type: "resolveToolResult";
6250
5015
  } & {
6251
- toolResult: ToolResult;
5016
+ toolResult: _perstack_core.ToolResult;
6252
5017
  }) | ({
6253
5018
  id: string;
6254
5019
  expertKey: string;
@@ -6258,7 +5023,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6258
5023
  } & {
6259
5024
  type: "resolveThought";
6260
5025
  } & {
6261
- toolResult: ToolResult;
5026
+ toolResult: _perstack_core.ToolResult;
6262
5027
  }) | ({
6263
5028
  id: string;
6264
5029
  expertKey: string;
@@ -6268,7 +5033,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6268
5033
  } & {
6269
5034
  type: "resolvePdfFile";
6270
5035
  } & {
6271
- toolResult: ToolResult;
5036
+ toolResult: _perstack_core.ToolResult;
6272
5037
  }) | ({
6273
5038
  id: string;
6274
5039
  expertKey: string;
@@ -6278,7 +5043,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6278
5043
  } & {
6279
5044
  type: "resolveImageFile";
6280
5045
  } & {
6281
- toolResult: ToolResult;
5046
+ toolResult: _perstack_core.ToolResult;
6282
5047
  }) | ({
6283
5048
  id: string;
6284
5049
  expertKey: string;
@@ -6288,7 +5053,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6288
5053
  } & {
6289
5054
  type: "attemptCompletion";
6290
5055
  } & {
6291
- toolResult: ToolResult;
5056
+ toolResult: _perstack_core.ToolResult;
6292
5057
  }) | ({
6293
5058
  id: string;
6294
5059
  expertKey: string;
@@ -6298,7 +5063,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6298
5063
  } & {
6299
5064
  type: "finishToolCall";
6300
5065
  } & {
6301
- newMessages: (UserMessage | ToolMessage)[];
5066
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
6302
5067
  }) | ({
6303
5068
  id: string;
6304
5069
  expertKey: string;
@@ -6356,7 +5121,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6356
5121
  checkpoint: Checkpoint;
6357
5122
  step: Step;
6358
5123
  text: string;
6359
- usage: Usage;
5124
+ usage: _perstack_core.Usage;
6360
5125
  }), undefined, never, never, never, never, never>;
6361
5126
  readonly reenter: true;
6362
5127
  };
@@ -6389,7 +5154,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6389
5154
  type: "startRun";
6390
5155
  } & {
6391
5156
  initialCheckpoint: Checkpoint;
6392
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
5157
+ inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
6393
5158
  }) | ({
6394
5159
  id: string;
6395
5160
  expertKey: string;
@@ -6399,7 +5164,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6399
5164
  } & {
6400
5165
  type: "startGeneration";
6401
5166
  } & {
6402
- messages: Message[];
5167
+ messages: _perstack_core.Message[];
6403
5168
  }) | ({
6404
5169
  id: string;
6405
5170
  expertKey: string;
@@ -6409,10 +5174,11 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6409
5174
  } & {
6410
5175
  type: "retry";
6411
5176
  } & {
6412
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
6413
- toolCall?: ToolCall;
6414
- toolResult?: ToolResult;
6415
- usage: Usage;
5177
+ reason: string;
5178
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
5179
+ toolCall?: _perstack_core.ToolCall;
5180
+ toolResult?: _perstack_core.ToolResult;
5181
+ usage: _perstack_core.Usage;
6416
5182
  }) | ({
6417
5183
  id: string;
6418
5184
  expertKey: string;
@@ -6422,9 +5188,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6422
5188
  } & {
6423
5189
  type: "callTool";
6424
5190
  } & {
6425
- newMessage: ExpertMessage;
6426
- toolCall: ToolCall;
6427
- usage: Usage;
5191
+ newMessage: _perstack_core.ExpertMessage;
5192
+ toolCall: _perstack_core.ToolCall;
5193
+ usage: _perstack_core.Usage;
6428
5194
  }) | ({
6429
5195
  id: string;
6430
5196
  expertKey: string;
@@ -6434,9 +5200,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6434
5200
  } & {
6435
5201
  type: "callInteractiveTool";
6436
5202
  } & {
6437
- newMessage: ExpertMessage;
6438
- toolCall: ToolCall;
6439
- usage: Usage;
5203
+ newMessage: _perstack_core.ExpertMessage;
5204
+ toolCall: _perstack_core.ToolCall;
5205
+ usage: _perstack_core.Usage;
6440
5206
  }) | ({
6441
5207
  id: string;
6442
5208
  expertKey: string;
@@ -6446,9 +5212,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6446
5212
  } & {
6447
5213
  type: "callDelegate";
6448
5214
  } & {
6449
- newMessage: ExpertMessage;
6450
- toolCall: ToolCall;
6451
- usage: Usage;
5215
+ newMessage: _perstack_core.ExpertMessage;
5216
+ toolCall: _perstack_core.ToolCall;
5217
+ usage: _perstack_core.Usage;
6452
5218
  }) | ({
6453
5219
  id: string;
6454
5220
  expertKey: string;
@@ -6458,7 +5224,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6458
5224
  } & {
6459
5225
  type: "resolveToolResult";
6460
5226
  } & {
6461
- toolResult: ToolResult;
5227
+ toolResult: _perstack_core.ToolResult;
6462
5228
  }) | ({
6463
5229
  id: string;
6464
5230
  expertKey: string;
@@ -6468,7 +5234,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6468
5234
  } & {
6469
5235
  type: "resolveThought";
6470
5236
  } & {
6471
- toolResult: ToolResult;
5237
+ toolResult: _perstack_core.ToolResult;
6472
5238
  }) | ({
6473
5239
  id: string;
6474
5240
  expertKey: string;
@@ -6478,7 +5244,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6478
5244
  } & {
6479
5245
  type: "resolvePdfFile";
6480
5246
  } & {
6481
- toolResult: ToolResult;
5247
+ toolResult: _perstack_core.ToolResult;
6482
5248
  }) | ({
6483
5249
  id: string;
6484
5250
  expertKey: string;
@@ -6488,7 +5254,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6488
5254
  } & {
6489
5255
  type: "resolveImageFile";
6490
5256
  } & {
6491
- toolResult: ToolResult;
5257
+ toolResult: _perstack_core.ToolResult;
6492
5258
  }) | ({
6493
5259
  id: string;
6494
5260
  expertKey: string;
@@ -6498,7 +5264,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6498
5264
  } & {
6499
5265
  type: "attemptCompletion";
6500
5266
  } & {
6501
- toolResult: ToolResult;
5267
+ toolResult: _perstack_core.ToolResult;
6502
5268
  }) | ({
6503
5269
  id: string;
6504
5270
  expertKey: string;
@@ -6508,7 +5274,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6508
5274
  } & {
6509
5275
  type: "finishToolCall";
6510
5276
  } & {
6511
- newMessages: (UserMessage | ToolMessage)[];
5277
+ newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
6512
5278
  }) | ({
6513
5279
  id: string;
6514
5280
  expertKey: string;
@@ -6566,7 +5332,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
6566
5332
  checkpoint: Checkpoint;
6567
5333
  step: Step;
6568
5334
  text: string;
6569
- usage: Usage;
5335
+ usage: _perstack_core.Usage;
6570
5336
  }), undefined, never, never, never, never, never>;
6571
5337
  };
6572
5338
  };
@@ -6580,79 +5346,18 @@ declare const StateMachineLogics: Record<Exclude<RunSnapshot["value"], "Stopped"
6580
5346
  type RunActor = ActorRefFrom<typeof runtimeStateMachine>;
6581
5347
  type RunSnapshot = SnapshotFrom<typeof runtimeStateMachine>;
6582
5348
 
6583
- declare const RegistryV1ExpertsGetResponseSchema: z.ZodObject<{
6584
- data: z.ZodObject<{
6585
- expert: z.ZodObject<{
6586
- name: z.ZodString;
6587
- version: z.ZodString;
6588
- minRuntimeVersion: z.ZodString;
6589
- description: z.ZodString;
6590
- instruction: z.ZodString;
6591
- skills: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
6592
- type: z.ZodLiteral<"mcpStdioSkill">;
6593
- args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
6594
- description: z.ZodOptional<z.ZodString>;
6595
- rule: z.ZodOptional<z.ZodString>;
6596
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
6597
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
6598
- command: z.ZodString;
6599
- packageName: z.ZodOptional<z.ZodString>;
6600
- requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
6601
- }, z.core.$strip>, z.ZodObject<{
6602
- type: z.ZodLiteral<"mcpSseSkill">;
6603
- description: z.ZodOptional<z.ZodString>;
6604
- rule: z.ZodOptional<z.ZodString>;
6605
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
6606
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
6607
- endpoint: z.ZodString;
6608
- }, z.core.$strip>, z.ZodObject<{
6609
- type: z.ZodLiteral<"interactiveSkill">;
6610
- description: z.ZodOptional<z.ZodString>;
6611
- rule: z.ZodOptional<z.ZodString>;
6612
- tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
6613
- description: z.ZodOptional<z.ZodString>;
6614
- inputJsonSchema: z.ZodString;
6615
- }, z.core.$strip>>, z.ZodTransform<{
6616
- [k: string]: {
6617
- name: string;
6618
- inputJsonSchema: string;
6619
- description?: string | undefined;
6620
- };
6621
- }, Record<string, {
6622
- inputJsonSchema: string;
6623
- description?: string | undefined;
6624
- }>>>;
6625
- }, z.core.$strip>]>>;
6626
- delegates: z.ZodArray<z.ZodString>;
6627
- tags: z.ZodArray<z.ZodString>;
6628
- status: z.ZodString;
6629
- owner: z.ZodObject<{
6630
- name: z.ZodString;
6631
- }, z.core.$strip>;
6632
- createdAt: z.ZodISODateTime;
6633
- updatedAt: z.ZodISODateTime;
6634
- }, z.core.$strip>;
6635
- }, z.core.$strip>;
6636
- }, z.core.$strip>;
6637
- type RegistryV1ExpertsGetResponse = z.infer<typeof RegistryV1ExpertsGetResponseSchema>;
5349
+ declare function run(runInput: RunParamsInput, options?: {
5350
+ shouldContinueRun?: (setting: RunSetting, checkpoint: Checkpoint, step: Step) => Promise<boolean>;
5351
+ retrieveCheckpoint?: (checkpointId: string) => Promise<Checkpoint>;
5352
+ storeCheckpoint?: (checkpoint: Checkpoint, timestamp: number) => Promise<void>;
5353
+ eventListener?: (event: RunEvent) => Promise<void>;
5354
+ }): Promise<Checkpoint>;
5355
+ declare function getRunDir(runId: string): string;
6638
5356
 
6639
- /**
6640
- * Run command input schema
6641
- */
6642
- declare const RunInputSchema: z.ZodObject<{
6643
- expertKey: z.ZodString;
6644
- query: z.ZodString;
6645
- options: z.ZodObject<{
6646
- config: z.ZodOptional<z.ZodString>;
6647
- model: z.ZodOptional<z.ZodString>;
6648
- temperature: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
6649
- maxSteps: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
6650
- maxRetries: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
6651
- timeout: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
6652
- runId: z.ZodOptional<z.ZodString>;
6653
- }, z.core.$strip>;
6654
- }, z.core.$strip>;
5357
+ declare function getModel(modelId: string, providerConfig: ProviderConfig): LanguageModel;
5358
+ declare function getContextWindow(providerName: ProviderName, modelId: string): number | undefined;
5359
+ declare function calculateContextWindowUsage(usage: Usage, contextWindow: number): number;
6655
5360
 
6656
5361
  declare function defaultEventListener(e: RunEvent): Promise<void>;
6657
5362
 
6658
- export { type Checkpoint, CheckpointSchema, CheckpointStatusSchema, type EventForType, type EventType, type Expert, type ExpertMessage, ExpertMessageSchema, ExpertSchema, type FileBinaryPart, FileBinaryPartSchema, type FileInlinePart, FileInlinePartSchema, type FileUrlPart, FileUrlPartSchema, type ImageBinaryPart, ImageBinaryPartSchema, type ImageInlinePart, ImageInlinePartSchema, type ImageUrlPart, ImageUrlPartSchema, type InstructionMessage, InstructionMessageSchema, type InteractiveSkill, InteractiveSkillSchema, InteractiveToolSchema, type McpSseSkill, McpSseSkillSchema, type McpStdioSkill, McpStdioSkillSchema, type Message, MessageSchema, type PerstackConfig, PerstackConfigSchema, type RegistryV1ExpertsGetResponse, RegistryV1ExpertsGetResponseSchema, type RunActor, type RunEvent, type RunInput, RunInputSchema, type RunParams, type RunParamsInput, RunParamsSchema, type RunSetting, type RunSnapshot, StateMachineLogics, type Step, type TextPart, TextPartSchema, type ToolCall, type ToolCallPart, ToolCallPartSchema, type ToolMessage, ToolMessageSchema, type ToolResult, type ToolResultPart, ToolResultPartSchema, type Usage, UsageSchema, type UserMessage, UserMessageSchema, attemptCompletion, callDelegate, callInteractiveTool, callTool, completeRun, continueToNextStep, createEvent, defaultEventListener, expertKeyRegex, expertNameRegex, finishToolCall, getRunDir, maxNameLength, parseConfig, parseExpertKey, resolveImageFile, resolvePdfFile, resolveThought, resolveToolResult, retry, run, runtimeStateMachine, skillNameRegex, startGeneration, startRun, stopRunByDelegate, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, versionRegex };
5363
+ export { type RunActor, type RunSnapshot, StateMachineLogics, calculateContextWindowUsage, defaultEventListener, getContextWindow, getModel, getRunDir, run, runtimeStateMachine };