@perstack/runtime 0.0.66 → 0.0.68

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.
@@ -13,7 +13,7 @@ type PerstackAdapterOptions = {
13
13
  useDirectExecution?: boolean;
14
14
  };
15
15
  declare class PerstackAdapter extends BaseAdapter implements RuntimeAdapter {
16
- readonly name = "perstack";
16
+ readonly name = "local";
17
17
  protected version: string;
18
18
  private useDirectExecution;
19
19
  constructor(options?: PerstackAdapterOptions);
@@ -44,6 +44,17 @@ type RunOptions = {
44
44
  resolveExpertToRun?: ResolveExpertToRunFn;
45
45
  returnOnDelegationComplete?: boolean;
46
46
  };
47
+ /**
48
+ * Execute a run with the given parameters and options.
49
+ * This is the main entry point for the runtime.
50
+ *
51
+ * The run loop handles:
52
+ * - Job management
53
+ * - Delegation routing (single vs parallel)
54
+ * - Terminal state detection
55
+ *
56
+ * Each run execution is delegated to SingleRunExecutor.
57
+ */
47
58
  declare function run(runInput: RunParamsInput, options?: RunOptions): Promise<Checkpoint>;
48
59
 
49
60
  declare abstract class BaseSkillManager {
@@ -170,2436 +181,19 @@ declare const runtimeStateMachine: xstate.StateMachine<{
170
181
  eventListener: (event: RunEvent) => Promise<void>;
171
182
  skillManagers: Record<string, BaseSkillManager>;
172
183
  }, xstate.NonReducibleUnknown, xstate.EventObject, xstate.MetaObject, {
173
- /** @xstate-layout N4IgpgJg5mDOIC5QCUCuA7AdASXQSwBcBiWAgQwCcC10BtABgF1FQAHAe1kL3fRZAAeiAKz0AzJgDsAJgAsksZNlixs+gDZZAGhABPRIszCAjGIAcY4crPHhJyQF8HOmpgAKFMK0p50UAGLsFADKBF4k5FQA4mDoYBRkBDx0TPwcXEm8-EIIZmaymPRK8saSopL00tI6+gjq9JjSltLG9HnqZkqdTi4YmDFxCUl+ACrs7AA2AMJkExNEngQUugzMSCDp3FnrOcam0pgAnHbS9GeSZsIq6jWIh2KHUsYd9MbSwl2S6j0grgPxiV8UDGkxmcyIAGNZhMQRNVmlOFs+DtEPt1Jg3odpGVbFcrLcENIzOjbGYipIZMpnmYfn9YgDhsDxtNoZDobgwgkIUkAG5gWHw9abTLI0C7ImSTDqYTY2S45TCCwE54HUr1WRXSqHcRVWl9f5DIGwsHzKFzAAiYAmYCgiTAgrYiJF2VRYnoj1ehwskkOZTEz2EBMMJnMFnezxUF2+zl+fRNRuZCzgkz5sOQcFQEwIDo2TuSLoQpWJUvowl9Flk0sqBLlZik2Mkpjyan90d6WHjo0TnlgKf5AAt2KgoP3s6khXntmLUT6JL6PkoFJX1MZtHoRKIpdrK3sqorpG3Yx3oQnJknexM+W4IAAzfx4a054X5lGFn2PMTYlSyWQH32WAl1DKKV1Q6L1V1EWQ9WPOZT3mHs+2wABbMgYHvR9x0dDIX2nN8zEeOVjGORsmgsMQCTJYRMGJORwP9MwDxpGNXE7Jkz0SMIkNYAgpnYLjrRFJ9J1FQQZzJTBPxUfDDjlN1OgJIkSUVUtDlXCpsUPVx0wvHk4O0zNiBvXw8FgftjWhITsKnUTCU-SU92JMlfSaGtjDrGQKSbfJxGeaDMG0lMjUHYdRyIIz8FM8y5kspECyabFGneRz3RkN011qOwGnUbcVzeJKDz8gLLyBa87wfMAwuMyLmRNGLnVfeL7KSl5nPI9c6mA9RQPwmwNVLQrk2KvxkNQsB0Iq8KTLMmqLMw3MrJEnJGsSxUWtSgkfSU-JDmIqNKj8g1AT8Gh9KzSE+NYASwBoOqcJs+K61sDo5SKBifwU4tSRUtTKi+KDmLjE9hvQTkyG5PBU0TUh2FYGgACFdA5AFwchyZbus3YyklYRst-DUlDEaU2tqFUMS+NyPmlPZDiAvzWMta1bTCCIYfh3QGZtO10cWmcLiOQnG3qHHiSDbGvM-Ex1EjYk-PvCL+yBUJwghXhhlQfl2AAOTAAQCCV1hubiqxjCMRUZXMGSvVUZV6A1LcuorDp8I0WWqoVvx9ZZ2GMARgBRAQITASBIAAWTIAR9dgQ2Gs0Ki8nyK4bCuDVRZNzRwxse4GK6pwY3QdgIDgfgaARBaCxUBosU0cw5TLUiCQAWlkR4nPdbVCeyld-vbHB8AIUvYtfRQ6yr6xa6xcwCTLaiadj1dKxk1phD8jwvB8PxAhCMJWAH+rcKAyuyVaa5Wi+KeW9njV59xpeDvpQ0u1BaFd7u3Y2keDpO7LW2FDLc+Z6AnsPEO4ZYAxghMOCL8MaojsJKYi8cHZ5C9EGNoRg1CdH3GcZeYD-KDV0o-CYp1+4TjLg1cQkp-SfjDE9Ew1R2o-hNnsUs1MfR-UuANHSQUhwjmIVhQeuFTg-ilF8GUblTgKDoRlBQhQJEaiJMnfCHDAp+FKuNKBPNCSlgaOIeQttWxS0DO1bKdY9HvH9D+FotMcFFXwVAEaaFyrqLirbBo1M7KvFUDJCiRJGgalUM3LEMk5R30GEdKAJ0MxZicWQlQEklAyillWVoZgUF1isG0MoDEsF0yBnYkGyNeQa0mNE3CtgiIYnEEBToFwvS+mVPkU20l8JWG1OIHJsE-AcyZmAEpNlbBqEwLo7yVRbY3HatPfCXUOgfCsGSTQmk+hyymorbevSloykeFYCkrxfqrmJiIaRRQ7JbP8Q8PyoQYasEgGsxA2JWiNB-jjdQTRqb1IkP6OwRF8KMSAbnBwQA */
174
- readonly id: "Run";
175
- readonly initial: "Init";
176
- readonly context: ({ input }: {
177
- spawn: {
178
- <TSrc extends never>(logic: TSrc, ...[options]: never): xstate.ActorRefFromLogic<never>;
179
- <TLogic extends xstate.AnyActorLogic>(src: TLogic, ...[options]: xstate.ConditionalRequired<[options?: ({
180
- id?: never;
181
- systemId?: string;
182
- input?: xstate.InputFrom<TLogic> | undefined;
183
- syncSnapshot?: boolean;
184
- } & { [K in xstate.RequiredLogicInput<TLogic>]: unknown; }) | undefined], xstate.IsNotNever<xstate.RequiredLogicInput<TLogic>>>): xstate.ActorRefFromLogic<TLogic>;
185
- };
186
- input: {
187
- setting: RunSetting;
188
- initialCheckpoint: Checkpoint;
189
- eventListener: (event: RunEvent) => Promise<void>;
190
- skillManagers: Record<string, BaseSkillManager>;
191
- };
192
- self: xstate.ActorRef<xstate.MachineSnapshot<{
193
- setting: RunSetting;
194
- step: Step;
195
- checkpoint: Checkpoint;
196
- eventListener: (event: RunEvent) => Promise<void>;
197
- skillManagers: Record<string, BaseSkillManager>;
198
- }, (_perstack_core.BaseEvent & {
199
- type: "startRun";
200
- } & {
201
- initialCheckpoint: Checkpoint;
202
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
203
- }) | (_perstack_core.BaseEvent & {
204
- type: "startGeneration";
205
- } & {
206
- messages: _perstack_core.Message[];
207
- }) | (_perstack_core.BaseEvent & {
208
- type: "retry";
209
- } & {
210
- reason: string;
211
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
212
- toolCalls?: _perstack_core.ToolCall[];
213
- toolResults?: _perstack_core.ToolResult[];
214
- usage: _perstack_core.Usage;
215
- }) | (_perstack_core.BaseEvent & {
216
- type: "callTools";
217
- } & {
218
- newMessage: _perstack_core.ExpertMessage;
219
- toolCalls: _perstack_core.ToolCall[];
220
- usage: _perstack_core.Usage;
221
- }) | (_perstack_core.BaseEvent & {
222
- type: "callInteractiveTool";
223
- } & {
224
- newMessage: _perstack_core.ExpertMessage;
225
- toolCall: _perstack_core.ToolCall;
226
- usage: _perstack_core.Usage;
227
- }) | (_perstack_core.BaseEvent & {
228
- type: "callDelegate";
229
- } & {
230
- newMessage: _perstack_core.ExpertMessage;
231
- toolCalls: _perstack_core.ToolCall[];
232
- usage: _perstack_core.Usage;
233
- }) | (_perstack_core.BaseEvent & {
234
- type: "resolveToolResults";
235
- } & {
236
- toolResults: _perstack_core.ToolResult[];
237
- }) | (_perstack_core.BaseEvent & {
238
- type: "resolveThought";
239
- } & {
240
- toolResult: _perstack_core.ToolResult;
241
- }) | (_perstack_core.BaseEvent & {
242
- type: "attemptCompletion";
243
- } & {
244
- toolResult: _perstack_core.ToolResult;
245
- }) | (_perstack_core.BaseEvent & {
246
- type: "finishToolCall";
247
- } & {
248
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
249
- }) | (_perstack_core.BaseEvent & {
250
- type: "resumeToolCalls";
251
- } & {
252
- pendingToolCalls: _perstack_core.ToolCall[];
253
- partialToolResults: _perstack_core.ToolResult[];
254
- }) | (_perstack_core.BaseEvent & {
255
- type: "finishAllToolCalls";
256
- } & {
257
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
258
- }) | (_perstack_core.BaseEvent & {
259
- type: "continueToNextStep";
260
- } & {
261
- checkpoint: Checkpoint;
262
- step: Step;
263
- nextCheckpoint: Checkpoint;
264
- }) | (_perstack_core.BaseEvent & {
265
- type: "stopRunByInteractiveTool";
266
- } & {
267
- checkpoint: Checkpoint;
268
- step: Step;
269
- }) | (_perstack_core.BaseEvent & {
270
- type: "stopRunByDelegate";
271
- } & {
272
- checkpoint: Checkpoint;
273
- step: Step;
274
- }) | (_perstack_core.BaseEvent & {
275
- type: "stopRunByExceededMaxSteps";
276
- } & {
277
- checkpoint: Checkpoint;
278
- step: Step;
279
- }) | (_perstack_core.BaseEvent & {
280
- type: "completeRun";
281
- } & {
282
- checkpoint: Checkpoint;
283
- step: Step;
284
- text: string;
285
- usage: _perstack_core.Usage;
286
- }), Record<string, xstate.AnyActorRef | undefined>, xstate.StateValue, string, unknown, any, any>, (_perstack_core.BaseEvent & {
287
- type: "startRun";
288
- } & {
289
- initialCheckpoint: Checkpoint;
290
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
291
- }) | (_perstack_core.BaseEvent & {
292
- type: "startGeneration";
293
- } & {
294
- messages: _perstack_core.Message[];
295
- }) | (_perstack_core.BaseEvent & {
296
- type: "retry";
297
- } & {
298
- reason: string;
299
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
300
- toolCalls?: _perstack_core.ToolCall[];
301
- toolResults?: _perstack_core.ToolResult[];
302
- usage: _perstack_core.Usage;
303
- }) | (_perstack_core.BaseEvent & {
304
- type: "callTools";
305
- } & {
306
- newMessage: _perstack_core.ExpertMessage;
307
- toolCalls: _perstack_core.ToolCall[];
308
- usage: _perstack_core.Usage;
309
- }) | (_perstack_core.BaseEvent & {
310
- type: "callInteractiveTool";
311
- } & {
312
- newMessage: _perstack_core.ExpertMessage;
313
- toolCall: _perstack_core.ToolCall;
314
- usage: _perstack_core.Usage;
315
- }) | (_perstack_core.BaseEvent & {
316
- type: "callDelegate";
317
- } & {
318
- newMessage: _perstack_core.ExpertMessage;
319
- toolCalls: _perstack_core.ToolCall[];
320
- usage: _perstack_core.Usage;
321
- }) | (_perstack_core.BaseEvent & {
322
- type: "resolveToolResults";
323
- } & {
324
- toolResults: _perstack_core.ToolResult[];
325
- }) | (_perstack_core.BaseEvent & {
326
- type: "resolveThought";
327
- } & {
328
- toolResult: _perstack_core.ToolResult;
329
- }) | (_perstack_core.BaseEvent & {
330
- type: "attemptCompletion";
331
- } & {
332
- toolResult: _perstack_core.ToolResult;
333
- }) | (_perstack_core.BaseEvent & {
334
- type: "finishToolCall";
335
- } & {
336
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
337
- }) | (_perstack_core.BaseEvent & {
338
- type: "resumeToolCalls";
339
- } & {
340
- pendingToolCalls: _perstack_core.ToolCall[];
341
- partialToolResults: _perstack_core.ToolResult[];
342
- }) | (_perstack_core.BaseEvent & {
343
- type: "finishAllToolCalls";
344
- } & {
345
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
346
- }) | (_perstack_core.BaseEvent & {
347
- type: "continueToNextStep";
348
- } & {
349
- checkpoint: Checkpoint;
350
- step: Step;
351
- nextCheckpoint: Checkpoint;
352
- }) | (_perstack_core.BaseEvent & {
353
- type: "stopRunByInteractiveTool";
354
- } & {
355
- checkpoint: Checkpoint;
356
- step: Step;
357
- }) | (_perstack_core.BaseEvent & {
358
- type: "stopRunByDelegate";
359
- } & {
360
- checkpoint: Checkpoint;
361
- step: Step;
362
- }) | (_perstack_core.BaseEvent & {
363
- type: "stopRunByExceededMaxSteps";
364
- } & {
365
- checkpoint: Checkpoint;
366
- step: Step;
367
- }) | (_perstack_core.BaseEvent & {
368
- type: "completeRun";
369
- } & {
370
- checkpoint: Checkpoint;
371
- step: Step;
372
- text: string;
373
- usage: _perstack_core.Usage;
374
- }), xstate.AnyEventObject>;
375
- }) => {
376
- setting: RunSetting;
377
- checkpoint: Checkpoint;
378
- step: {
379
- stepNumber: number;
380
- inputMessages: never[];
381
- newMessages: never[];
382
- usage: _perstack_core.Usage;
383
- startedAt: number;
384
- };
385
- eventListener: (event: RunEvent) => Promise<void>;
386
- skillManagers: Record<string, BaseSkillManager>;
387
- };
388
- readonly states: {
389
- readonly Init: {
390
- readonly on: {
391
- readonly startRun: {
392
- readonly target: "PreparingForStep";
393
- readonly actions: xstate.ActionFunction<{
394
- setting: RunSetting;
395
- step: Step;
396
- checkpoint: Checkpoint;
397
- eventListener: (event: RunEvent) => Promise<void>;
398
- skillManagers: Record<string, BaseSkillManager>;
399
- }, _perstack_core.BaseEvent & {
400
- type: "startRun";
401
- } & {
402
- initialCheckpoint: Checkpoint;
403
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
404
- }, (_perstack_core.BaseEvent & {
405
- type: "startRun";
406
- } & {
407
- initialCheckpoint: Checkpoint;
408
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
409
- }) | (_perstack_core.BaseEvent & {
410
- type: "startGeneration";
411
- } & {
412
- messages: _perstack_core.Message[];
413
- }) | (_perstack_core.BaseEvent & {
414
- type: "retry";
415
- } & {
416
- reason: string;
417
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
418
- toolCalls?: _perstack_core.ToolCall[];
419
- toolResults?: _perstack_core.ToolResult[];
420
- usage: _perstack_core.Usage;
421
- }) | (_perstack_core.BaseEvent & {
422
- type: "callTools";
423
- } & {
424
- newMessage: _perstack_core.ExpertMessage;
425
- toolCalls: _perstack_core.ToolCall[];
426
- usage: _perstack_core.Usage;
427
- }) | (_perstack_core.BaseEvent & {
428
- type: "callInteractiveTool";
429
- } & {
430
- newMessage: _perstack_core.ExpertMessage;
431
- toolCall: _perstack_core.ToolCall;
432
- usage: _perstack_core.Usage;
433
- }) | (_perstack_core.BaseEvent & {
434
- type: "callDelegate";
435
- } & {
436
- newMessage: _perstack_core.ExpertMessage;
437
- toolCalls: _perstack_core.ToolCall[];
438
- usage: _perstack_core.Usage;
439
- }) | (_perstack_core.BaseEvent & {
440
- type: "resolveToolResults";
441
- } & {
442
- toolResults: _perstack_core.ToolResult[];
443
- }) | (_perstack_core.BaseEvent & {
444
- type: "resolveThought";
445
- } & {
446
- toolResult: _perstack_core.ToolResult;
447
- }) | (_perstack_core.BaseEvent & {
448
- type: "attemptCompletion";
449
- } & {
450
- toolResult: _perstack_core.ToolResult;
451
- }) | (_perstack_core.BaseEvent & {
452
- type: "finishToolCall";
453
- } & {
454
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
455
- }) | (_perstack_core.BaseEvent & {
456
- type: "resumeToolCalls";
457
- } & {
458
- pendingToolCalls: _perstack_core.ToolCall[];
459
- partialToolResults: _perstack_core.ToolResult[];
460
- }) | (_perstack_core.BaseEvent & {
461
- type: "finishAllToolCalls";
462
- } & {
463
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
464
- }) | (_perstack_core.BaseEvent & {
465
- type: "continueToNextStep";
466
- } & {
467
- checkpoint: Checkpoint;
468
- step: Step;
469
- nextCheckpoint: Checkpoint;
470
- }) | (_perstack_core.BaseEvent & {
471
- type: "stopRunByInteractiveTool";
472
- } & {
473
- checkpoint: Checkpoint;
474
- step: Step;
475
- }) | (_perstack_core.BaseEvent & {
476
- type: "stopRunByDelegate";
477
- } & {
478
- checkpoint: Checkpoint;
479
- step: Step;
480
- }) | (_perstack_core.BaseEvent & {
481
- type: "stopRunByExceededMaxSteps";
482
- } & {
483
- checkpoint: Checkpoint;
484
- step: Step;
485
- }) | (_perstack_core.BaseEvent & {
486
- type: "completeRun";
487
- } & {
488
- checkpoint: Checkpoint;
489
- step: Step;
490
- text: string;
491
- usage: _perstack_core.Usage;
492
- }), undefined, never, never, never, never, never>;
493
- };
494
- };
495
- };
496
- readonly PreparingForStep: {
497
- readonly on: {
498
- readonly startGeneration: {
499
- readonly target: "GeneratingToolCall";
500
- readonly actions: xstate.ActionFunction<{
501
- setting: RunSetting;
502
- step: Step;
503
- checkpoint: Checkpoint;
504
- eventListener: (event: RunEvent) => Promise<void>;
505
- skillManagers: Record<string, BaseSkillManager>;
506
- }, _perstack_core.BaseEvent & {
507
- type: "startGeneration";
508
- } & {
509
- messages: _perstack_core.Message[];
510
- }, (_perstack_core.BaseEvent & {
511
- type: "startRun";
512
- } & {
513
- initialCheckpoint: Checkpoint;
514
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
515
- }) | (_perstack_core.BaseEvent & {
516
- type: "startGeneration";
517
- } & {
518
- messages: _perstack_core.Message[];
519
- }) | (_perstack_core.BaseEvent & {
520
- type: "retry";
521
- } & {
522
- reason: string;
523
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
524
- toolCalls?: _perstack_core.ToolCall[];
525
- toolResults?: _perstack_core.ToolResult[];
526
- usage: _perstack_core.Usage;
527
- }) | (_perstack_core.BaseEvent & {
528
- type: "callTools";
529
- } & {
530
- newMessage: _perstack_core.ExpertMessage;
531
- toolCalls: _perstack_core.ToolCall[];
532
- usage: _perstack_core.Usage;
533
- }) | (_perstack_core.BaseEvent & {
534
- type: "callInteractiveTool";
535
- } & {
536
- newMessage: _perstack_core.ExpertMessage;
537
- toolCall: _perstack_core.ToolCall;
538
- usage: _perstack_core.Usage;
539
- }) | (_perstack_core.BaseEvent & {
540
- type: "callDelegate";
541
- } & {
542
- newMessage: _perstack_core.ExpertMessage;
543
- toolCalls: _perstack_core.ToolCall[];
544
- usage: _perstack_core.Usage;
545
- }) | (_perstack_core.BaseEvent & {
546
- type: "resolveToolResults";
547
- } & {
548
- toolResults: _perstack_core.ToolResult[];
549
- }) | (_perstack_core.BaseEvent & {
550
- type: "resolveThought";
551
- } & {
552
- toolResult: _perstack_core.ToolResult;
553
- }) | (_perstack_core.BaseEvent & {
554
- type: "attemptCompletion";
555
- } & {
556
- toolResult: _perstack_core.ToolResult;
557
- }) | (_perstack_core.BaseEvent & {
558
- type: "finishToolCall";
559
- } & {
560
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
561
- }) | (_perstack_core.BaseEvent & {
562
- type: "resumeToolCalls";
563
- } & {
564
- pendingToolCalls: _perstack_core.ToolCall[];
565
- partialToolResults: _perstack_core.ToolResult[];
566
- }) | (_perstack_core.BaseEvent & {
567
- type: "finishAllToolCalls";
568
- } & {
569
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
570
- }) | (_perstack_core.BaseEvent & {
571
- type: "continueToNextStep";
572
- } & {
573
- checkpoint: Checkpoint;
574
- step: Step;
575
- nextCheckpoint: Checkpoint;
576
- }) | (_perstack_core.BaseEvent & {
577
- type: "stopRunByInteractiveTool";
578
- } & {
579
- checkpoint: Checkpoint;
580
- step: Step;
581
- }) | (_perstack_core.BaseEvent & {
582
- type: "stopRunByDelegate";
583
- } & {
584
- checkpoint: Checkpoint;
585
- step: Step;
586
- }) | (_perstack_core.BaseEvent & {
587
- type: "stopRunByExceededMaxSteps";
588
- } & {
589
- checkpoint: Checkpoint;
590
- step: Step;
591
- }) | (_perstack_core.BaseEvent & {
592
- type: "completeRun";
593
- } & {
594
- checkpoint: Checkpoint;
595
- step: Step;
596
- text: string;
597
- usage: _perstack_core.Usage;
598
- }), undefined, never, never, never, never, never>;
599
- };
600
- readonly resumeToolCalls: {
601
- readonly target: "CallingTool";
602
- readonly actions: xstate.ActionFunction<{
603
- setting: RunSetting;
604
- step: Step;
605
- checkpoint: Checkpoint;
606
- eventListener: (event: RunEvent) => Promise<void>;
607
- skillManagers: Record<string, BaseSkillManager>;
608
- }, _perstack_core.BaseEvent & {
609
- type: "resumeToolCalls";
610
- } & {
611
- pendingToolCalls: _perstack_core.ToolCall[];
612
- partialToolResults: _perstack_core.ToolResult[];
613
- }, (_perstack_core.BaseEvent & {
614
- type: "startRun";
615
- } & {
616
- initialCheckpoint: Checkpoint;
617
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
618
- }) | (_perstack_core.BaseEvent & {
619
- type: "startGeneration";
620
- } & {
621
- messages: _perstack_core.Message[];
622
- }) | (_perstack_core.BaseEvent & {
623
- type: "retry";
624
- } & {
625
- reason: string;
626
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
627
- toolCalls?: _perstack_core.ToolCall[];
628
- toolResults?: _perstack_core.ToolResult[];
629
- usage: _perstack_core.Usage;
630
- }) | (_perstack_core.BaseEvent & {
631
- type: "callTools";
632
- } & {
633
- newMessage: _perstack_core.ExpertMessage;
634
- toolCalls: _perstack_core.ToolCall[];
635
- usage: _perstack_core.Usage;
636
- }) | (_perstack_core.BaseEvent & {
637
- type: "callInteractiveTool";
638
- } & {
639
- newMessage: _perstack_core.ExpertMessage;
640
- toolCall: _perstack_core.ToolCall;
641
- usage: _perstack_core.Usage;
642
- }) | (_perstack_core.BaseEvent & {
643
- type: "callDelegate";
644
- } & {
645
- newMessage: _perstack_core.ExpertMessage;
646
- toolCalls: _perstack_core.ToolCall[];
647
- usage: _perstack_core.Usage;
648
- }) | (_perstack_core.BaseEvent & {
649
- type: "resolveToolResults";
650
- } & {
651
- toolResults: _perstack_core.ToolResult[];
652
- }) | (_perstack_core.BaseEvent & {
653
- type: "resolveThought";
654
- } & {
655
- toolResult: _perstack_core.ToolResult;
656
- }) | (_perstack_core.BaseEvent & {
657
- type: "attemptCompletion";
658
- } & {
659
- toolResult: _perstack_core.ToolResult;
660
- }) | (_perstack_core.BaseEvent & {
661
- type: "finishToolCall";
662
- } & {
663
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
664
- }) | (_perstack_core.BaseEvent & {
665
- type: "resumeToolCalls";
666
- } & {
667
- pendingToolCalls: _perstack_core.ToolCall[];
668
- partialToolResults: _perstack_core.ToolResult[];
669
- }) | (_perstack_core.BaseEvent & {
670
- type: "finishAllToolCalls";
671
- } & {
672
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
673
- }) | (_perstack_core.BaseEvent & {
674
- type: "continueToNextStep";
675
- } & {
676
- checkpoint: Checkpoint;
677
- step: Step;
678
- nextCheckpoint: Checkpoint;
679
- }) | (_perstack_core.BaseEvent & {
680
- type: "stopRunByInteractiveTool";
681
- } & {
682
- checkpoint: Checkpoint;
683
- step: Step;
684
- }) | (_perstack_core.BaseEvent & {
685
- type: "stopRunByDelegate";
686
- } & {
687
- checkpoint: Checkpoint;
688
- step: Step;
689
- }) | (_perstack_core.BaseEvent & {
690
- type: "stopRunByExceededMaxSteps";
691
- } & {
692
- checkpoint: Checkpoint;
693
- step: Step;
694
- }) | (_perstack_core.BaseEvent & {
695
- type: "completeRun";
696
- } & {
697
- checkpoint: Checkpoint;
698
- step: Step;
699
- text: string;
700
- usage: _perstack_core.Usage;
701
- }), undefined, never, never, never, never, never>;
702
- };
703
- readonly finishAllToolCalls: {
704
- readonly target: "FinishingStep";
705
- readonly actions: xstate.ActionFunction<{
706
- setting: RunSetting;
707
- step: Step;
708
- checkpoint: Checkpoint;
709
- eventListener: (event: RunEvent) => Promise<void>;
710
- skillManagers: Record<string, BaseSkillManager>;
711
- }, _perstack_core.BaseEvent & {
712
- type: "finishAllToolCalls";
713
- } & {
714
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
715
- }, (_perstack_core.BaseEvent & {
716
- type: "startRun";
717
- } & {
718
- initialCheckpoint: Checkpoint;
719
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
720
- }) | (_perstack_core.BaseEvent & {
721
- type: "startGeneration";
722
- } & {
723
- messages: _perstack_core.Message[];
724
- }) | (_perstack_core.BaseEvent & {
725
- type: "retry";
726
- } & {
727
- reason: string;
728
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
729
- toolCalls?: _perstack_core.ToolCall[];
730
- toolResults?: _perstack_core.ToolResult[];
731
- usage: _perstack_core.Usage;
732
- }) | (_perstack_core.BaseEvent & {
733
- type: "callTools";
734
- } & {
735
- newMessage: _perstack_core.ExpertMessage;
736
- toolCalls: _perstack_core.ToolCall[];
737
- usage: _perstack_core.Usage;
738
- }) | (_perstack_core.BaseEvent & {
739
- type: "callInteractiveTool";
740
- } & {
741
- newMessage: _perstack_core.ExpertMessage;
742
- toolCall: _perstack_core.ToolCall;
743
- usage: _perstack_core.Usage;
744
- }) | (_perstack_core.BaseEvent & {
745
- type: "callDelegate";
746
- } & {
747
- newMessage: _perstack_core.ExpertMessage;
748
- toolCalls: _perstack_core.ToolCall[];
749
- usage: _perstack_core.Usage;
750
- }) | (_perstack_core.BaseEvent & {
751
- type: "resolveToolResults";
752
- } & {
753
- toolResults: _perstack_core.ToolResult[];
754
- }) | (_perstack_core.BaseEvent & {
755
- type: "resolveThought";
756
- } & {
757
- toolResult: _perstack_core.ToolResult;
758
- }) | (_perstack_core.BaseEvent & {
759
- type: "attemptCompletion";
760
- } & {
761
- toolResult: _perstack_core.ToolResult;
762
- }) | (_perstack_core.BaseEvent & {
763
- type: "finishToolCall";
764
- } & {
765
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
766
- }) | (_perstack_core.BaseEvent & {
767
- type: "resumeToolCalls";
768
- } & {
769
- pendingToolCalls: _perstack_core.ToolCall[];
770
- partialToolResults: _perstack_core.ToolResult[];
771
- }) | (_perstack_core.BaseEvent & {
772
- type: "finishAllToolCalls";
773
- } & {
774
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
775
- }) | (_perstack_core.BaseEvent & {
776
- type: "continueToNextStep";
777
- } & {
778
- checkpoint: Checkpoint;
779
- step: Step;
780
- nextCheckpoint: Checkpoint;
781
- }) | (_perstack_core.BaseEvent & {
782
- type: "stopRunByInteractiveTool";
783
- } & {
784
- checkpoint: Checkpoint;
785
- step: Step;
786
- }) | (_perstack_core.BaseEvent & {
787
- type: "stopRunByDelegate";
788
- } & {
789
- checkpoint: Checkpoint;
790
- step: Step;
791
- }) | (_perstack_core.BaseEvent & {
792
- type: "stopRunByExceededMaxSteps";
793
- } & {
794
- checkpoint: Checkpoint;
795
- step: Step;
796
- }) | (_perstack_core.BaseEvent & {
797
- type: "completeRun";
798
- } & {
799
- checkpoint: Checkpoint;
800
- step: Step;
801
- text: string;
802
- usage: _perstack_core.Usage;
803
- }), undefined, never, never, never, never, never>;
804
- };
805
- };
806
- };
807
- readonly GeneratingToolCall: {
808
- readonly on: {
809
- readonly retry: {
810
- readonly target: "FinishingStep";
811
- readonly actions: xstate.ActionFunction<{
812
- setting: RunSetting;
813
- step: Step;
814
- checkpoint: Checkpoint;
815
- eventListener: (event: RunEvent) => Promise<void>;
816
- skillManagers: Record<string, BaseSkillManager>;
817
- }, _perstack_core.BaseEvent & {
818
- type: "retry";
819
- } & {
820
- reason: string;
821
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
822
- toolCalls?: _perstack_core.ToolCall[];
823
- toolResults?: _perstack_core.ToolResult[];
824
- usage: _perstack_core.Usage;
825
- }, (_perstack_core.BaseEvent & {
826
- type: "startRun";
827
- } & {
828
- initialCheckpoint: Checkpoint;
829
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
830
- }) | (_perstack_core.BaseEvent & {
831
- type: "startGeneration";
832
- } & {
833
- messages: _perstack_core.Message[];
834
- }) | (_perstack_core.BaseEvent & {
835
- type: "retry";
836
- } & {
837
- reason: string;
838
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
839
- toolCalls?: _perstack_core.ToolCall[];
840
- toolResults?: _perstack_core.ToolResult[];
841
- usage: _perstack_core.Usage;
842
- }) | (_perstack_core.BaseEvent & {
843
- type: "callTools";
844
- } & {
845
- newMessage: _perstack_core.ExpertMessage;
846
- toolCalls: _perstack_core.ToolCall[];
847
- usage: _perstack_core.Usage;
848
- }) | (_perstack_core.BaseEvent & {
849
- type: "callInteractiveTool";
850
- } & {
851
- newMessage: _perstack_core.ExpertMessage;
852
- toolCall: _perstack_core.ToolCall;
853
- usage: _perstack_core.Usage;
854
- }) | (_perstack_core.BaseEvent & {
855
- type: "callDelegate";
856
- } & {
857
- newMessage: _perstack_core.ExpertMessage;
858
- toolCalls: _perstack_core.ToolCall[];
859
- usage: _perstack_core.Usage;
860
- }) | (_perstack_core.BaseEvent & {
861
- type: "resolveToolResults";
862
- } & {
863
- toolResults: _perstack_core.ToolResult[];
864
- }) | (_perstack_core.BaseEvent & {
865
- type: "resolveThought";
866
- } & {
867
- toolResult: _perstack_core.ToolResult;
868
- }) | (_perstack_core.BaseEvent & {
869
- type: "attemptCompletion";
870
- } & {
871
- toolResult: _perstack_core.ToolResult;
872
- }) | (_perstack_core.BaseEvent & {
873
- type: "finishToolCall";
874
- } & {
875
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
876
- }) | (_perstack_core.BaseEvent & {
877
- type: "resumeToolCalls";
878
- } & {
879
- pendingToolCalls: _perstack_core.ToolCall[];
880
- partialToolResults: _perstack_core.ToolResult[];
881
- }) | (_perstack_core.BaseEvent & {
882
- type: "finishAllToolCalls";
883
- } & {
884
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
885
- }) | (_perstack_core.BaseEvent & {
886
- type: "continueToNextStep";
887
- } & {
888
- checkpoint: Checkpoint;
889
- step: Step;
890
- nextCheckpoint: Checkpoint;
891
- }) | (_perstack_core.BaseEvent & {
892
- type: "stopRunByInteractiveTool";
893
- } & {
894
- checkpoint: Checkpoint;
895
- step: Step;
896
- }) | (_perstack_core.BaseEvent & {
897
- type: "stopRunByDelegate";
898
- } & {
899
- checkpoint: Checkpoint;
900
- step: Step;
901
- }) | (_perstack_core.BaseEvent & {
902
- type: "stopRunByExceededMaxSteps";
903
- } & {
904
- checkpoint: Checkpoint;
905
- step: Step;
906
- }) | (_perstack_core.BaseEvent & {
907
- type: "completeRun";
908
- } & {
909
- checkpoint: Checkpoint;
910
- step: Step;
911
- text: string;
912
- usage: _perstack_core.Usage;
913
- }), undefined, never, never, never, never, never>;
914
- };
915
- readonly callTools: {
916
- readonly target: "CallingTool";
917
- readonly actions: xstate.ActionFunction<{
918
- setting: RunSetting;
919
- step: Step;
920
- checkpoint: Checkpoint;
921
- eventListener: (event: RunEvent) => Promise<void>;
922
- skillManagers: Record<string, BaseSkillManager>;
923
- }, _perstack_core.BaseEvent & {
924
- type: "callTools";
925
- } & {
926
- newMessage: _perstack_core.ExpertMessage;
927
- toolCalls: _perstack_core.ToolCall[];
928
- usage: _perstack_core.Usage;
929
- }, (_perstack_core.BaseEvent & {
930
- type: "startRun";
931
- } & {
932
- initialCheckpoint: Checkpoint;
933
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
934
- }) | (_perstack_core.BaseEvent & {
935
- type: "startGeneration";
936
- } & {
937
- messages: _perstack_core.Message[];
938
- }) | (_perstack_core.BaseEvent & {
939
- type: "retry";
940
- } & {
941
- reason: string;
942
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
943
- toolCalls?: _perstack_core.ToolCall[];
944
- toolResults?: _perstack_core.ToolResult[];
945
- usage: _perstack_core.Usage;
946
- }) | (_perstack_core.BaseEvent & {
947
- type: "callTools";
948
- } & {
949
- newMessage: _perstack_core.ExpertMessage;
950
- toolCalls: _perstack_core.ToolCall[];
951
- usage: _perstack_core.Usage;
952
- }) | (_perstack_core.BaseEvent & {
953
- type: "callInteractiveTool";
954
- } & {
955
- newMessage: _perstack_core.ExpertMessage;
956
- toolCall: _perstack_core.ToolCall;
957
- usage: _perstack_core.Usage;
958
- }) | (_perstack_core.BaseEvent & {
959
- type: "callDelegate";
960
- } & {
961
- newMessage: _perstack_core.ExpertMessage;
962
- toolCalls: _perstack_core.ToolCall[];
963
- usage: _perstack_core.Usage;
964
- }) | (_perstack_core.BaseEvent & {
965
- type: "resolveToolResults";
966
- } & {
967
- toolResults: _perstack_core.ToolResult[];
968
- }) | (_perstack_core.BaseEvent & {
969
- type: "resolveThought";
970
- } & {
971
- toolResult: _perstack_core.ToolResult;
972
- }) | (_perstack_core.BaseEvent & {
973
- type: "attemptCompletion";
974
- } & {
975
- toolResult: _perstack_core.ToolResult;
976
- }) | (_perstack_core.BaseEvent & {
977
- type: "finishToolCall";
978
- } & {
979
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
980
- }) | (_perstack_core.BaseEvent & {
981
- type: "resumeToolCalls";
982
- } & {
983
- pendingToolCalls: _perstack_core.ToolCall[];
984
- partialToolResults: _perstack_core.ToolResult[];
985
- }) | (_perstack_core.BaseEvent & {
986
- type: "finishAllToolCalls";
987
- } & {
988
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
989
- }) | (_perstack_core.BaseEvent & {
990
- type: "continueToNextStep";
991
- } & {
992
- checkpoint: Checkpoint;
993
- step: Step;
994
- nextCheckpoint: Checkpoint;
995
- }) | (_perstack_core.BaseEvent & {
996
- type: "stopRunByInteractiveTool";
997
- } & {
998
- checkpoint: Checkpoint;
999
- step: Step;
1000
- }) | (_perstack_core.BaseEvent & {
1001
- type: "stopRunByDelegate";
1002
- } & {
1003
- checkpoint: Checkpoint;
1004
- step: Step;
1005
- }) | (_perstack_core.BaseEvent & {
1006
- type: "stopRunByExceededMaxSteps";
1007
- } & {
1008
- checkpoint: Checkpoint;
1009
- step: Step;
1010
- }) | (_perstack_core.BaseEvent & {
1011
- type: "completeRun";
1012
- } & {
1013
- checkpoint: Checkpoint;
1014
- step: Step;
1015
- text: string;
1016
- usage: _perstack_core.Usage;
1017
- }), undefined, never, never, never, never, never>;
1018
- };
1019
- readonly callInteractiveTool: {
1020
- readonly target: "CallingInteractiveTool";
1021
- readonly actions: xstate.ActionFunction<{
1022
- setting: RunSetting;
1023
- step: Step;
1024
- checkpoint: Checkpoint;
1025
- eventListener: (event: RunEvent) => Promise<void>;
1026
- skillManagers: Record<string, BaseSkillManager>;
1027
- }, _perstack_core.BaseEvent & {
1028
- type: "callInteractiveTool";
1029
- } & {
1030
- newMessage: _perstack_core.ExpertMessage;
1031
- toolCall: _perstack_core.ToolCall;
1032
- usage: _perstack_core.Usage;
1033
- }, (_perstack_core.BaseEvent & {
1034
- type: "startRun";
1035
- } & {
1036
- initialCheckpoint: Checkpoint;
1037
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1038
- }) | (_perstack_core.BaseEvent & {
1039
- type: "startGeneration";
1040
- } & {
1041
- messages: _perstack_core.Message[];
1042
- }) | (_perstack_core.BaseEvent & {
1043
- type: "retry";
1044
- } & {
1045
- reason: string;
1046
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1047
- toolCalls?: _perstack_core.ToolCall[];
1048
- toolResults?: _perstack_core.ToolResult[];
1049
- usage: _perstack_core.Usage;
1050
- }) | (_perstack_core.BaseEvent & {
1051
- type: "callTools";
1052
- } & {
1053
- newMessage: _perstack_core.ExpertMessage;
1054
- toolCalls: _perstack_core.ToolCall[];
1055
- usage: _perstack_core.Usage;
1056
- }) | (_perstack_core.BaseEvent & {
1057
- type: "callInteractiveTool";
1058
- } & {
1059
- newMessage: _perstack_core.ExpertMessage;
1060
- toolCall: _perstack_core.ToolCall;
1061
- usage: _perstack_core.Usage;
1062
- }) | (_perstack_core.BaseEvent & {
1063
- type: "callDelegate";
1064
- } & {
1065
- newMessage: _perstack_core.ExpertMessage;
1066
- toolCalls: _perstack_core.ToolCall[];
1067
- usage: _perstack_core.Usage;
1068
- }) | (_perstack_core.BaseEvent & {
1069
- type: "resolveToolResults";
1070
- } & {
1071
- toolResults: _perstack_core.ToolResult[];
1072
- }) | (_perstack_core.BaseEvent & {
1073
- type: "resolveThought";
1074
- } & {
1075
- toolResult: _perstack_core.ToolResult;
1076
- }) | (_perstack_core.BaseEvent & {
1077
- type: "attemptCompletion";
1078
- } & {
1079
- toolResult: _perstack_core.ToolResult;
1080
- }) | (_perstack_core.BaseEvent & {
1081
- type: "finishToolCall";
1082
- } & {
1083
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1084
- }) | (_perstack_core.BaseEvent & {
1085
- type: "resumeToolCalls";
1086
- } & {
1087
- pendingToolCalls: _perstack_core.ToolCall[];
1088
- partialToolResults: _perstack_core.ToolResult[];
1089
- }) | (_perstack_core.BaseEvent & {
1090
- type: "finishAllToolCalls";
1091
- } & {
1092
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1093
- }) | (_perstack_core.BaseEvent & {
1094
- type: "continueToNextStep";
1095
- } & {
1096
- checkpoint: Checkpoint;
1097
- step: Step;
1098
- nextCheckpoint: Checkpoint;
1099
- }) | (_perstack_core.BaseEvent & {
1100
- type: "stopRunByInteractiveTool";
1101
- } & {
1102
- checkpoint: Checkpoint;
1103
- step: Step;
1104
- }) | (_perstack_core.BaseEvent & {
1105
- type: "stopRunByDelegate";
1106
- } & {
1107
- checkpoint: Checkpoint;
1108
- step: Step;
1109
- }) | (_perstack_core.BaseEvent & {
1110
- type: "stopRunByExceededMaxSteps";
1111
- } & {
1112
- checkpoint: Checkpoint;
1113
- step: Step;
1114
- }) | (_perstack_core.BaseEvent & {
1115
- type: "completeRun";
1116
- } & {
1117
- checkpoint: Checkpoint;
1118
- step: Step;
1119
- text: string;
1120
- usage: _perstack_core.Usage;
1121
- }), undefined, never, never, never, never, never>;
1122
- };
1123
- readonly callDelegate: {
1124
- readonly target: "CallingDelegate";
1125
- readonly actions: xstate.ActionFunction<{
1126
- setting: RunSetting;
1127
- step: Step;
1128
- checkpoint: Checkpoint;
1129
- eventListener: (event: RunEvent) => Promise<void>;
1130
- skillManagers: Record<string, BaseSkillManager>;
1131
- }, _perstack_core.BaseEvent & {
1132
- type: "callDelegate";
1133
- } & {
1134
- newMessage: _perstack_core.ExpertMessage;
1135
- toolCalls: _perstack_core.ToolCall[];
1136
- usage: _perstack_core.Usage;
1137
- }, (_perstack_core.BaseEvent & {
1138
- type: "startRun";
1139
- } & {
1140
- initialCheckpoint: Checkpoint;
1141
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1142
- }) | (_perstack_core.BaseEvent & {
1143
- type: "startGeneration";
1144
- } & {
1145
- messages: _perstack_core.Message[];
1146
- }) | (_perstack_core.BaseEvent & {
1147
- type: "retry";
1148
- } & {
1149
- reason: string;
1150
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1151
- toolCalls?: _perstack_core.ToolCall[];
1152
- toolResults?: _perstack_core.ToolResult[];
1153
- usage: _perstack_core.Usage;
1154
- }) | (_perstack_core.BaseEvent & {
1155
- type: "callTools";
1156
- } & {
1157
- newMessage: _perstack_core.ExpertMessage;
1158
- toolCalls: _perstack_core.ToolCall[];
1159
- usage: _perstack_core.Usage;
1160
- }) | (_perstack_core.BaseEvent & {
1161
- type: "callInteractiveTool";
1162
- } & {
1163
- newMessage: _perstack_core.ExpertMessage;
1164
- toolCall: _perstack_core.ToolCall;
1165
- usage: _perstack_core.Usage;
1166
- }) | (_perstack_core.BaseEvent & {
1167
- type: "callDelegate";
1168
- } & {
1169
- newMessage: _perstack_core.ExpertMessage;
1170
- toolCalls: _perstack_core.ToolCall[];
1171
- usage: _perstack_core.Usage;
1172
- }) | (_perstack_core.BaseEvent & {
1173
- type: "resolveToolResults";
1174
- } & {
1175
- toolResults: _perstack_core.ToolResult[];
1176
- }) | (_perstack_core.BaseEvent & {
1177
- type: "resolveThought";
1178
- } & {
1179
- toolResult: _perstack_core.ToolResult;
1180
- }) | (_perstack_core.BaseEvent & {
1181
- type: "attemptCompletion";
1182
- } & {
1183
- toolResult: _perstack_core.ToolResult;
1184
- }) | (_perstack_core.BaseEvent & {
1185
- type: "finishToolCall";
1186
- } & {
1187
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1188
- }) | (_perstack_core.BaseEvent & {
1189
- type: "resumeToolCalls";
1190
- } & {
1191
- pendingToolCalls: _perstack_core.ToolCall[];
1192
- partialToolResults: _perstack_core.ToolResult[];
1193
- }) | (_perstack_core.BaseEvent & {
1194
- type: "finishAllToolCalls";
1195
- } & {
1196
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1197
- }) | (_perstack_core.BaseEvent & {
1198
- type: "continueToNextStep";
1199
- } & {
1200
- checkpoint: Checkpoint;
1201
- step: Step;
1202
- nextCheckpoint: Checkpoint;
1203
- }) | (_perstack_core.BaseEvent & {
1204
- type: "stopRunByInteractiveTool";
1205
- } & {
1206
- checkpoint: Checkpoint;
1207
- step: Step;
1208
- }) | (_perstack_core.BaseEvent & {
1209
- type: "stopRunByDelegate";
1210
- } & {
1211
- checkpoint: Checkpoint;
1212
- step: Step;
1213
- }) | (_perstack_core.BaseEvent & {
1214
- type: "stopRunByExceededMaxSteps";
1215
- } & {
1216
- checkpoint: Checkpoint;
1217
- step: Step;
1218
- }) | (_perstack_core.BaseEvent & {
1219
- type: "completeRun";
1220
- } & {
1221
- checkpoint: Checkpoint;
1222
- step: Step;
1223
- text: string;
1224
- usage: _perstack_core.Usage;
1225
- }), undefined, never, never, never, never, never>;
1226
- };
1227
- };
1228
- };
1229
- readonly CallingTool: {
1230
- readonly on: {
1231
- readonly resolveToolResults: {
1232
- readonly target: "ResolvingToolResult";
1233
- readonly actions: xstate.ActionFunction<{
1234
- setting: RunSetting;
1235
- step: Step;
1236
- checkpoint: Checkpoint;
1237
- eventListener: (event: RunEvent) => Promise<void>;
1238
- skillManagers: Record<string, BaseSkillManager>;
1239
- }, _perstack_core.BaseEvent & {
1240
- type: "resolveToolResults";
1241
- } & {
1242
- toolResults: _perstack_core.ToolResult[];
1243
- }, (_perstack_core.BaseEvent & {
1244
- type: "startRun";
1245
- } & {
1246
- initialCheckpoint: Checkpoint;
1247
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1248
- }) | (_perstack_core.BaseEvent & {
1249
- type: "startGeneration";
1250
- } & {
1251
- messages: _perstack_core.Message[];
1252
- }) | (_perstack_core.BaseEvent & {
1253
- type: "retry";
1254
- } & {
1255
- reason: string;
1256
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1257
- toolCalls?: _perstack_core.ToolCall[];
1258
- toolResults?: _perstack_core.ToolResult[];
1259
- usage: _perstack_core.Usage;
1260
- }) | (_perstack_core.BaseEvent & {
1261
- type: "callTools";
1262
- } & {
1263
- newMessage: _perstack_core.ExpertMessage;
1264
- toolCalls: _perstack_core.ToolCall[];
1265
- usage: _perstack_core.Usage;
1266
- }) | (_perstack_core.BaseEvent & {
1267
- type: "callInteractiveTool";
1268
- } & {
1269
- newMessage: _perstack_core.ExpertMessage;
1270
- toolCall: _perstack_core.ToolCall;
1271
- usage: _perstack_core.Usage;
1272
- }) | (_perstack_core.BaseEvent & {
1273
- type: "callDelegate";
1274
- } & {
1275
- newMessage: _perstack_core.ExpertMessage;
1276
- toolCalls: _perstack_core.ToolCall[];
1277
- usage: _perstack_core.Usage;
1278
- }) | (_perstack_core.BaseEvent & {
1279
- type: "resolveToolResults";
1280
- } & {
1281
- toolResults: _perstack_core.ToolResult[];
1282
- }) | (_perstack_core.BaseEvent & {
1283
- type: "resolveThought";
1284
- } & {
1285
- toolResult: _perstack_core.ToolResult;
1286
- }) | (_perstack_core.BaseEvent & {
1287
- type: "attemptCompletion";
1288
- } & {
1289
- toolResult: _perstack_core.ToolResult;
1290
- }) | (_perstack_core.BaseEvent & {
1291
- type: "finishToolCall";
1292
- } & {
1293
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1294
- }) | (_perstack_core.BaseEvent & {
1295
- type: "resumeToolCalls";
1296
- } & {
1297
- pendingToolCalls: _perstack_core.ToolCall[];
1298
- partialToolResults: _perstack_core.ToolResult[];
1299
- }) | (_perstack_core.BaseEvent & {
1300
- type: "finishAllToolCalls";
1301
- } & {
1302
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1303
- }) | (_perstack_core.BaseEvent & {
1304
- type: "continueToNextStep";
1305
- } & {
1306
- checkpoint: Checkpoint;
1307
- step: Step;
1308
- nextCheckpoint: Checkpoint;
1309
- }) | (_perstack_core.BaseEvent & {
1310
- type: "stopRunByInteractiveTool";
1311
- } & {
1312
- checkpoint: Checkpoint;
1313
- step: Step;
1314
- }) | (_perstack_core.BaseEvent & {
1315
- type: "stopRunByDelegate";
1316
- } & {
1317
- checkpoint: Checkpoint;
1318
- step: Step;
1319
- }) | (_perstack_core.BaseEvent & {
1320
- type: "stopRunByExceededMaxSteps";
1321
- } & {
1322
- checkpoint: Checkpoint;
1323
- step: Step;
1324
- }) | (_perstack_core.BaseEvent & {
1325
- type: "completeRun";
1326
- } & {
1327
- checkpoint: Checkpoint;
1328
- step: Step;
1329
- text: string;
1330
- usage: _perstack_core.Usage;
1331
- }), undefined, never, never, never, never, never>;
1332
- };
1333
- readonly resolveThought: {
1334
- readonly target: "ResolvingThought";
1335
- readonly actions: xstate.ActionFunction<{
1336
- setting: RunSetting;
1337
- step: Step;
1338
- checkpoint: Checkpoint;
1339
- eventListener: (event: RunEvent) => Promise<void>;
1340
- skillManagers: Record<string, BaseSkillManager>;
1341
- }, _perstack_core.BaseEvent & {
1342
- type: "resolveThought";
1343
- } & {
1344
- toolResult: _perstack_core.ToolResult;
1345
- }, (_perstack_core.BaseEvent & {
1346
- type: "startRun";
1347
- } & {
1348
- initialCheckpoint: Checkpoint;
1349
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1350
- }) | (_perstack_core.BaseEvent & {
1351
- type: "startGeneration";
1352
- } & {
1353
- messages: _perstack_core.Message[];
1354
- }) | (_perstack_core.BaseEvent & {
1355
- type: "retry";
1356
- } & {
1357
- reason: string;
1358
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1359
- toolCalls?: _perstack_core.ToolCall[];
1360
- toolResults?: _perstack_core.ToolResult[];
1361
- usage: _perstack_core.Usage;
1362
- }) | (_perstack_core.BaseEvent & {
1363
- type: "callTools";
1364
- } & {
1365
- newMessage: _perstack_core.ExpertMessage;
1366
- toolCalls: _perstack_core.ToolCall[];
1367
- usage: _perstack_core.Usage;
1368
- }) | (_perstack_core.BaseEvent & {
1369
- type: "callInteractiveTool";
1370
- } & {
1371
- newMessage: _perstack_core.ExpertMessage;
1372
- toolCall: _perstack_core.ToolCall;
1373
- usage: _perstack_core.Usage;
1374
- }) | (_perstack_core.BaseEvent & {
1375
- type: "callDelegate";
1376
- } & {
1377
- newMessage: _perstack_core.ExpertMessage;
1378
- toolCalls: _perstack_core.ToolCall[];
1379
- usage: _perstack_core.Usage;
1380
- }) | (_perstack_core.BaseEvent & {
1381
- type: "resolveToolResults";
1382
- } & {
1383
- toolResults: _perstack_core.ToolResult[];
1384
- }) | (_perstack_core.BaseEvent & {
1385
- type: "resolveThought";
1386
- } & {
1387
- toolResult: _perstack_core.ToolResult;
1388
- }) | (_perstack_core.BaseEvent & {
1389
- type: "attemptCompletion";
1390
- } & {
1391
- toolResult: _perstack_core.ToolResult;
1392
- }) | (_perstack_core.BaseEvent & {
1393
- type: "finishToolCall";
1394
- } & {
1395
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1396
- }) | (_perstack_core.BaseEvent & {
1397
- type: "resumeToolCalls";
1398
- } & {
1399
- pendingToolCalls: _perstack_core.ToolCall[];
1400
- partialToolResults: _perstack_core.ToolResult[];
1401
- }) | (_perstack_core.BaseEvent & {
1402
- type: "finishAllToolCalls";
1403
- } & {
1404
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1405
- }) | (_perstack_core.BaseEvent & {
1406
- type: "continueToNextStep";
1407
- } & {
1408
- checkpoint: Checkpoint;
1409
- step: Step;
1410
- nextCheckpoint: Checkpoint;
1411
- }) | (_perstack_core.BaseEvent & {
1412
- type: "stopRunByInteractiveTool";
1413
- } & {
1414
- checkpoint: Checkpoint;
1415
- step: Step;
1416
- }) | (_perstack_core.BaseEvent & {
1417
- type: "stopRunByDelegate";
1418
- } & {
1419
- checkpoint: Checkpoint;
1420
- step: Step;
1421
- }) | (_perstack_core.BaseEvent & {
1422
- type: "stopRunByExceededMaxSteps";
1423
- } & {
1424
- checkpoint: Checkpoint;
1425
- step: Step;
1426
- }) | (_perstack_core.BaseEvent & {
1427
- type: "completeRun";
1428
- } & {
1429
- checkpoint: Checkpoint;
1430
- step: Step;
1431
- text: string;
1432
- usage: _perstack_core.Usage;
1433
- }), undefined, never, never, never, never, never>;
1434
- };
1435
- readonly attemptCompletion: {
1436
- readonly target: "GeneratingRunResult";
1437
- readonly actions: xstate.ActionFunction<{
1438
- setting: RunSetting;
1439
- step: Step;
1440
- checkpoint: Checkpoint;
1441
- eventListener: (event: RunEvent) => Promise<void>;
1442
- skillManagers: Record<string, BaseSkillManager>;
1443
- }, _perstack_core.BaseEvent & {
1444
- type: "attemptCompletion";
1445
- } & {
1446
- toolResult: _perstack_core.ToolResult;
1447
- }, (_perstack_core.BaseEvent & {
1448
- type: "startRun";
1449
- } & {
1450
- initialCheckpoint: Checkpoint;
1451
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1452
- }) | (_perstack_core.BaseEvent & {
1453
- type: "startGeneration";
1454
- } & {
1455
- messages: _perstack_core.Message[];
1456
- }) | (_perstack_core.BaseEvent & {
1457
- type: "retry";
1458
- } & {
1459
- reason: string;
1460
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1461
- toolCalls?: _perstack_core.ToolCall[];
1462
- toolResults?: _perstack_core.ToolResult[];
1463
- usage: _perstack_core.Usage;
1464
- }) | (_perstack_core.BaseEvent & {
1465
- type: "callTools";
1466
- } & {
1467
- newMessage: _perstack_core.ExpertMessage;
1468
- toolCalls: _perstack_core.ToolCall[];
1469
- usage: _perstack_core.Usage;
1470
- }) | (_perstack_core.BaseEvent & {
1471
- type: "callInteractiveTool";
1472
- } & {
1473
- newMessage: _perstack_core.ExpertMessage;
1474
- toolCall: _perstack_core.ToolCall;
1475
- usage: _perstack_core.Usage;
1476
- }) | (_perstack_core.BaseEvent & {
1477
- type: "callDelegate";
1478
- } & {
1479
- newMessage: _perstack_core.ExpertMessage;
1480
- toolCalls: _perstack_core.ToolCall[];
1481
- usage: _perstack_core.Usage;
1482
- }) | (_perstack_core.BaseEvent & {
1483
- type: "resolveToolResults";
1484
- } & {
1485
- toolResults: _perstack_core.ToolResult[];
1486
- }) | (_perstack_core.BaseEvent & {
1487
- type: "resolveThought";
1488
- } & {
1489
- toolResult: _perstack_core.ToolResult;
1490
- }) | (_perstack_core.BaseEvent & {
1491
- type: "attemptCompletion";
1492
- } & {
1493
- toolResult: _perstack_core.ToolResult;
1494
- }) | (_perstack_core.BaseEvent & {
1495
- type: "finishToolCall";
1496
- } & {
1497
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1498
- }) | (_perstack_core.BaseEvent & {
1499
- type: "resumeToolCalls";
1500
- } & {
1501
- pendingToolCalls: _perstack_core.ToolCall[];
1502
- partialToolResults: _perstack_core.ToolResult[];
1503
- }) | (_perstack_core.BaseEvent & {
1504
- type: "finishAllToolCalls";
1505
- } & {
1506
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1507
- }) | (_perstack_core.BaseEvent & {
1508
- type: "continueToNextStep";
1509
- } & {
1510
- checkpoint: Checkpoint;
1511
- step: Step;
1512
- nextCheckpoint: Checkpoint;
1513
- }) | (_perstack_core.BaseEvent & {
1514
- type: "stopRunByInteractiveTool";
1515
- } & {
1516
- checkpoint: Checkpoint;
1517
- step: Step;
1518
- }) | (_perstack_core.BaseEvent & {
1519
- type: "stopRunByDelegate";
1520
- } & {
1521
- checkpoint: Checkpoint;
1522
- step: Step;
1523
- }) | (_perstack_core.BaseEvent & {
1524
- type: "stopRunByExceededMaxSteps";
1525
- } & {
1526
- checkpoint: Checkpoint;
1527
- step: Step;
1528
- }) | (_perstack_core.BaseEvent & {
1529
- type: "completeRun";
1530
- } & {
1531
- checkpoint: Checkpoint;
1532
- step: Step;
1533
- text: string;
1534
- usage: _perstack_core.Usage;
1535
- }), undefined, never, never, never, never, never>;
1536
- };
1537
- readonly callDelegate: {
1538
- readonly target: "CallingDelegate";
1539
- readonly actions: xstate.ActionFunction<{
1540
- setting: RunSetting;
1541
- step: Step;
1542
- checkpoint: Checkpoint;
1543
- eventListener: (event: RunEvent) => Promise<void>;
1544
- skillManagers: Record<string, BaseSkillManager>;
1545
- }, _perstack_core.BaseEvent & {
1546
- type: "callDelegate";
1547
- } & {
1548
- newMessage: _perstack_core.ExpertMessage;
1549
- toolCalls: _perstack_core.ToolCall[];
1550
- usage: _perstack_core.Usage;
1551
- }, (_perstack_core.BaseEvent & {
1552
- type: "startRun";
1553
- } & {
1554
- initialCheckpoint: Checkpoint;
1555
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1556
- }) | (_perstack_core.BaseEvent & {
1557
- type: "startGeneration";
1558
- } & {
1559
- messages: _perstack_core.Message[];
1560
- }) | (_perstack_core.BaseEvent & {
1561
- type: "retry";
1562
- } & {
1563
- reason: string;
1564
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1565
- toolCalls?: _perstack_core.ToolCall[];
1566
- toolResults?: _perstack_core.ToolResult[];
1567
- usage: _perstack_core.Usage;
1568
- }) | (_perstack_core.BaseEvent & {
1569
- type: "callTools";
1570
- } & {
1571
- newMessage: _perstack_core.ExpertMessage;
1572
- toolCalls: _perstack_core.ToolCall[];
1573
- usage: _perstack_core.Usage;
1574
- }) | (_perstack_core.BaseEvent & {
1575
- type: "callInteractiveTool";
1576
- } & {
1577
- newMessage: _perstack_core.ExpertMessage;
1578
- toolCall: _perstack_core.ToolCall;
1579
- usage: _perstack_core.Usage;
1580
- }) | (_perstack_core.BaseEvent & {
1581
- type: "callDelegate";
1582
- } & {
1583
- newMessage: _perstack_core.ExpertMessage;
1584
- toolCalls: _perstack_core.ToolCall[];
1585
- usage: _perstack_core.Usage;
1586
- }) | (_perstack_core.BaseEvent & {
1587
- type: "resolveToolResults";
1588
- } & {
1589
- toolResults: _perstack_core.ToolResult[];
1590
- }) | (_perstack_core.BaseEvent & {
1591
- type: "resolveThought";
1592
- } & {
1593
- toolResult: _perstack_core.ToolResult;
1594
- }) | (_perstack_core.BaseEvent & {
1595
- type: "attemptCompletion";
1596
- } & {
1597
- toolResult: _perstack_core.ToolResult;
1598
- }) | (_perstack_core.BaseEvent & {
1599
- type: "finishToolCall";
1600
- } & {
1601
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1602
- }) | (_perstack_core.BaseEvent & {
1603
- type: "resumeToolCalls";
1604
- } & {
1605
- pendingToolCalls: _perstack_core.ToolCall[];
1606
- partialToolResults: _perstack_core.ToolResult[];
1607
- }) | (_perstack_core.BaseEvent & {
1608
- type: "finishAllToolCalls";
1609
- } & {
1610
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1611
- }) | (_perstack_core.BaseEvent & {
1612
- type: "continueToNextStep";
1613
- } & {
1614
- checkpoint: Checkpoint;
1615
- step: Step;
1616
- nextCheckpoint: Checkpoint;
1617
- }) | (_perstack_core.BaseEvent & {
1618
- type: "stopRunByInteractiveTool";
1619
- } & {
1620
- checkpoint: Checkpoint;
1621
- step: Step;
1622
- }) | (_perstack_core.BaseEvent & {
1623
- type: "stopRunByDelegate";
1624
- } & {
1625
- checkpoint: Checkpoint;
1626
- step: Step;
1627
- }) | (_perstack_core.BaseEvent & {
1628
- type: "stopRunByExceededMaxSteps";
1629
- } & {
1630
- checkpoint: Checkpoint;
1631
- step: Step;
1632
- }) | (_perstack_core.BaseEvent & {
1633
- type: "completeRun";
1634
- } & {
1635
- checkpoint: Checkpoint;
1636
- step: Step;
1637
- text: string;
1638
- usage: _perstack_core.Usage;
1639
- }), undefined, never, never, never, never, never>;
1640
- };
1641
- readonly callInteractiveTool: {
1642
- readonly target: "CallingInteractiveTool";
1643
- readonly actions: xstate.ActionFunction<{
1644
- setting: RunSetting;
1645
- step: Step;
1646
- checkpoint: Checkpoint;
1647
- eventListener: (event: RunEvent) => Promise<void>;
1648
- skillManagers: Record<string, BaseSkillManager>;
1649
- }, _perstack_core.BaseEvent & {
1650
- type: "callInteractiveTool";
1651
- } & {
1652
- newMessage: _perstack_core.ExpertMessage;
1653
- toolCall: _perstack_core.ToolCall;
1654
- usage: _perstack_core.Usage;
1655
- }, (_perstack_core.BaseEvent & {
1656
- type: "startRun";
1657
- } & {
1658
- initialCheckpoint: Checkpoint;
1659
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1660
- }) | (_perstack_core.BaseEvent & {
1661
- type: "startGeneration";
1662
- } & {
1663
- messages: _perstack_core.Message[];
1664
- }) | (_perstack_core.BaseEvent & {
1665
- type: "retry";
1666
- } & {
1667
- reason: string;
1668
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1669
- toolCalls?: _perstack_core.ToolCall[];
1670
- toolResults?: _perstack_core.ToolResult[];
1671
- usage: _perstack_core.Usage;
1672
- }) | (_perstack_core.BaseEvent & {
1673
- type: "callTools";
1674
- } & {
1675
- newMessage: _perstack_core.ExpertMessage;
1676
- toolCalls: _perstack_core.ToolCall[];
1677
- usage: _perstack_core.Usage;
1678
- }) | (_perstack_core.BaseEvent & {
1679
- type: "callInteractiveTool";
1680
- } & {
1681
- newMessage: _perstack_core.ExpertMessage;
1682
- toolCall: _perstack_core.ToolCall;
1683
- usage: _perstack_core.Usage;
1684
- }) | (_perstack_core.BaseEvent & {
1685
- type: "callDelegate";
1686
- } & {
1687
- newMessage: _perstack_core.ExpertMessage;
1688
- toolCalls: _perstack_core.ToolCall[];
1689
- usage: _perstack_core.Usage;
1690
- }) | (_perstack_core.BaseEvent & {
1691
- type: "resolveToolResults";
1692
- } & {
1693
- toolResults: _perstack_core.ToolResult[];
1694
- }) | (_perstack_core.BaseEvent & {
1695
- type: "resolveThought";
1696
- } & {
1697
- toolResult: _perstack_core.ToolResult;
1698
- }) | (_perstack_core.BaseEvent & {
1699
- type: "attemptCompletion";
1700
- } & {
1701
- toolResult: _perstack_core.ToolResult;
1702
- }) | (_perstack_core.BaseEvent & {
1703
- type: "finishToolCall";
1704
- } & {
1705
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1706
- }) | (_perstack_core.BaseEvent & {
1707
- type: "resumeToolCalls";
1708
- } & {
1709
- pendingToolCalls: _perstack_core.ToolCall[];
1710
- partialToolResults: _perstack_core.ToolResult[];
1711
- }) | (_perstack_core.BaseEvent & {
1712
- type: "finishAllToolCalls";
1713
- } & {
1714
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1715
- }) | (_perstack_core.BaseEvent & {
1716
- type: "continueToNextStep";
1717
- } & {
1718
- checkpoint: Checkpoint;
1719
- step: Step;
1720
- nextCheckpoint: Checkpoint;
1721
- }) | (_perstack_core.BaseEvent & {
1722
- type: "stopRunByInteractiveTool";
1723
- } & {
1724
- checkpoint: Checkpoint;
1725
- step: Step;
1726
- }) | (_perstack_core.BaseEvent & {
1727
- type: "stopRunByDelegate";
1728
- } & {
1729
- checkpoint: Checkpoint;
1730
- step: Step;
1731
- }) | (_perstack_core.BaseEvent & {
1732
- type: "stopRunByExceededMaxSteps";
1733
- } & {
1734
- checkpoint: Checkpoint;
1735
- step: Step;
1736
- }) | (_perstack_core.BaseEvent & {
1737
- type: "completeRun";
1738
- } & {
1739
- checkpoint: Checkpoint;
1740
- step: Step;
1741
- text: string;
1742
- usage: _perstack_core.Usage;
1743
- }), undefined, never, never, never, never, never>;
1744
- };
1745
- };
1746
- };
1747
- readonly ResolvingToolResult: {
1748
- readonly on: {
1749
- readonly finishToolCall: {
1750
- readonly target: "FinishingStep";
1751
- readonly actions: xstate.ActionFunction<{
1752
- setting: RunSetting;
1753
- step: Step;
1754
- checkpoint: Checkpoint;
1755
- eventListener: (event: RunEvent) => Promise<void>;
1756
- skillManagers: Record<string, BaseSkillManager>;
1757
- }, _perstack_core.BaseEvent & {
1758
- type: "finishToolCall";
1759
- } & {
1760
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1761
- }, (_perstack_core.BaseEvent & {
1762
- type: "startRun";
1763
- } & {
1764
- initialCheckpoint: Checkpoint;
1765
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1766
- }) | (_perstack_core.BaseEvent & {
1767
- type: "startGeneration";
1768
- } & {
1769
- messages: _perstack_core.Message[];
1770
- }) | (_perstack_core.BaseEvent & {
1771
- type: "retry";
1772
- } & {
1773
- reason: string;
1774
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1775
- toolCalls?: _perstack_core.ToolCall[];
1776
- toolResults?: _perstack_core.ToolResult[];
1777
- usage: _perstack_core.Usage;
1778
- }) | (_perstack_core.BaseEvent & {
1779
- type: "callTools";
1780
- } & {
1781
- newMessage: _perstack_core.ExpertMessage;
1782
- toolCalls: _perstack_core.ToolCall[];
1783
- usage: _perstack_core.Usage;
1784
- }) | (_perstack_core.BaseEvent & {
1785
- type: "callInteractiveTool";
1786
- } & {
1787
- newMessage: _perstack_core.ExpertMessage;
1788
- toolCall: _perstack_core.ToolCall;
1789
- usage: _perstack_core.Usage;
1790
- }) | (_perstack_core.BaseEvent & {
1791
- type: "callDelegate";
1792
- } & {
1793
- newMessage: _perstack_core.ExpertMessage;
1794
- toolCalls: _perstack_core.ToolCall[];
1795
- usage: _perstack_core.Usage;
1796
- }) | (_perstack_core.BaseEvent & {
1797
- type: "resolveToolResults";
1798
- } & {
1799
- toolResults: _perstack_core.ToolResult[];
1800
- }) | (_perstack_core.BaseEvent & {
1801
- type: "resolveThought";
1802
- } & {
1803
- toolResult: _perstack_core.ToolResult;
1804
- }) | (_perstack_core.BaseEvent & {
1805
- type: "attemptCompletion";
1806
- } & {
1807
- toolResult: _perstack_core.ToolResult;
1808
- }) | (_perstack_core.BaseEvent & {
1809
- type: "finishToolCall";
1810
- } & {
1811
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1812
- }) | (_perstack_core.BaseEvent & {
1813
- type: "resumeToolCalls";
1814
- } & {
1815
- pendingToolCalls: _perstack_core.ToolCall[];
1816
- partialToolResults: _perstack_core.ToolResult[];
1817
- }) | (_perstack_core.BaseEvent & {
1818
- type: "finishAllToolCalls";
1819
- } & {
1820
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1821
- }) | (_perstack_core.BaseEvent & {
1822
- type: "continueToNextStep";
1823
- } & {
1824
- checkpoint: Checkpoint;
1825
- step: Step;
1826
- nextCheckpoint: Checkpoint;
1827
- }) | (_perstack_core.BaseEvent & {
1828
- type: "stopRunByInteractiveTool";
1829
- } & {
1830
- checkpoint: Checkpoint;
1831
- step: Step;
1832
- }) | (_perstack_core.BaseEvent & {
1833
- type: "stopRunByDelegate";
1834
- } & {
1835
- checkpoint: Checkpoint;
1836
- step: Step;
1837
- }) | (_perstack_core.BaseEvent & {
1838
- type: "stopRunByExceededMaxSteps";
1839
- } & {
1840
- checkpoint: Checkpoint;
1841
- step: Step;
1842
- }) | (_perstack_core.BaseEvent & {
1843
- type: "completeRun";
1844
- } & {
1845
- checkpoint: Checkpoint;
1846
- step: Step;
1847
- text: string;
1848
- usage: _perstack_core.Usage;
1849
- }), undefined, never, never, never, never, never>;
1850
- };
1851
- };
1852
- };
1853
- readonly ResolvingThought: {
1854
- readonly on: {
1855
- readonly finishToolCall: {
1856
- readonly target: "FinishingStep";
1857
- readonly actions: xstate.ActionFunction<{
1858
- setting: RunSetting;
1859
- step: Step;
1860
- checkpoint: Checkpoint;
1861
- eventListener: (event: RunEvent) => Promise<void>;
1862
- skillManagers: Record<string, BaseSkillManager>;
1863
- }, _perstack_core.BaseEvent & {
1864
- type: "finishToolCall";
1865
- } & {
1866
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1867
- }, (_perstack_core.BaseEvent & {
1868
- type: "startRun";
1869
- } & {
1870
- initialCheckpoint: Checkpoint;
1871
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1872
- }) | (_perstack_core.BaseEvent & {
1873
- type: "startGeneration";
1874
- } & {
1875
- messages: _perstack_core.Message[];
1876
- }) | (_perstack_core.BaseEvent & {
1877
- type: "retry";
1878
- } & {
1879
- reason: string;
1880
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1881
- toolCalls?: _perstack_core.ToolCall[];
1882
- toolResults?: _perstack_core.ToolResult[];
1883
- usage: _perstack_core.Usage;
1884
- }) | (_perstack_core.BaseEvent & {
1885
- type: "callTools";
1886
- } & {
1887
- newMessage: _perstack_core.ExpertMessage;
1888
- toolCalls: _perstack_core.ToolCall[];
1889
- usage: _perstack_core.Usage;
1890
- }) | (_perstack_core.BaseEvent & {
1891
- type: "callInteractiveTool";
1892
- } & {
1893
- newMessage: _perstack_core.ExpertMessage;
1894
- toolCall: _perstack_core.ToolCall;
1895
- usage: _perstack_core.Usage;
1896
- }) | (_perstack_core.BaseEvent & {
1897
- type: "callDelegate";
1898
- } & {
1899
- newMessage: _perstack_core.ExpertMessage;
1900
- toolCalls: _perstack_core.ToolCall[];
1901
- usage: _perstack_core.Usage;
1902
- }) | (_perstack_core.BaseEvent & {
1903
- type: "resolveToolResults";
1904
- } & {
1905
- toolResults: _perstack_core.ToolResult[];
1906
- }) | (_perstack_core.BaseEvent & {
1907
- type: "resolveThought";
1908
- } & {
1909
- toolResult: _perstack_core.ToolResult;
1910
- }) | (_perstack_core.BaseEvent & {
1911
- type: "attemptCompletion";
1912
- } & {
1913
- toolResult: _perstack_core.ToolResult;
1914
- }) | (_perstack_core.BaseEvent & {
1915
- type: "finishToolCall";
1916
- } & {
1917
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1918
- }) | (_perstack_core.BaseEvent & {
1919
- type: "resumeToolCalls";
1920
- } & {
1921
- pendingToolCalls: _perstack_core.ToolCall[];
1922
- partialToolResults: _perstack_core.ToolResult[];
1923
- }) | (_perstack_core.BaseEvent & {
1924
- type: "finishAllToolCalls";
1925
- } & {
1926
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1927
- }) | (_perstack_core.BaseEvent & {
1928
- type: "continueToNextStep";
1929
- } & {
1930
- checkpoint: Checkpoint;
1931
- step: Step;
1932
- nextCheckpoint: Checkpoint;
1933
- }) | (_perstack_core.BaseEvent & {
1934
- type: "stopRunByInteractiveTool";
1935
- } & {
1936
- checkpoint: Checkpoint;
1937
- step: Step;
1938
- }) | (_perstack_core.BaseEvent & {
1939
- type: "stopRunByDelegate";
1940
- } & {
1941
- checkpoint: Checkpoint;
1942
- step: Step;
1943
- }) | (_perstack_core.BaseEvent & {
1944
- type: "stopRunByExceededMaxSteps";
1945
- } & {
1946
- checkpoint: Checkpoint;
1947
- step: Step;
1948
- }) | (_perstack_core.BaseEvent & {
1949
- type: "completeRun";
1950
- } & {
1951
- checkpoint: Checkpoint;
1952
- step: Step;
1953
- text: string;
1954
- usage: _perstack_core.Usage;
1955
- }), undefined, never, never, never, never, never>;
1956
- };
1957
- };
1958
- };
1959
- readonly GeneratingRunResult: {
1960
- readonly on: {
1961
- readonly retry: {
1962
- readonly target: "FinishingStep";
1963
- readonly actions: xstate.ActionFunction<{
1964
- setting: RunSetting;
1965
- step: Step;
1966
- checkpoint: Checkpoint;
1967
- eventListener: (event: RunEvent) => Promise<void>;
1968
- skillManagers: Record<string, BaseSkillManager>;
1969
- }, _perstack_core.BaseEvent & {
1970
- type: "retry";
1971
- } & {
1972
- reason: string;
1973
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1974
- toolCalls?: _perstack_core.ToolCall[];
1975
- toolResults?: _perstack_core.ToolResult[];
1976
- usage: _perstack_core.Usage;
1977
- }, (_perstack_core.BaseEvent & {
1978
- type: "startRun";
1979
- } & {
1980
- initialCheckpoint: Checkpoint;
1981
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
1982
- }) | (_perstack_core.BaseEvent & {
1983
- type: "startGeneration";
1984
- } & {
1985
- messages: _perstack_core.Message[];
1986
- }) | (_perstack_core.BaseEvent & {
1987
- type: "retry";
1988
- } & {
1989
- reason: string;
1990
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
1991
- toolCalls?: _perstack_core.ToolCall[];
1992
- toolResults?: _perstack_core.ToolResult[];
1993
- usage: _perstack_core.Usage;
1994
- }) | (_perstack_core.BaseEvent & {
1995
- type: "callTools";
1996
- } & {
1997
- newMessage: _perstack_core.ExpertMessage;
1998
- toolCalls: _perstack_core.ToolCall[];
1999
- usage: _perstack_core.Usage;
2000
- }) | (_perstack_core.BaseEvent & {
2001
- type: "callInteractiveTool";
2002
- } & {
2003
- newMessage: _perstack_core.ExpertMessage;
2004
- toolCall: _perstack_core.ToolCall;
2005
- usage: _perstack_core.Usage;
2006
- }) | (_perstack_core.BaseEvent & {
2007
- type: "callDelegate";
2008
- } & {
2009
- newMessage: _perstack_core.ExpertMessage;
2010
- toolCalls: _perstack_core.ToolCall[];
2011
- usage: _perstack_core.Usage;
2012
- }) | (_perstack_core.BaseEvent & {
2013
- type: "resolveToolResults";
2014
- } & {
2015
- toolResults: _perstack_core.ToolResult[];
2016
- }) | (_perstack_core.BaseEvent & {
2017
- type: "resolveThought";
2018
- } & {
2019
- toolResult: _perstack_core.ToolResult;
2020
- }) | (_perstack_core.BaseEvent & {
2021
- type: "attemptCompletion";
2022
- } & {
2023
- toolResult: _perstack_core.ToolResult;
2024
- }) | (_perstack_core.BaseEvent & {
2025
- type: "finishToolCall";
2026
- } & {
2027
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2028
- }) | (_perstack_core.BaseEvent & {
2029
- type: "resumeToolCalls";
2030
- } & {
2031
- pendingToolCalls: _perstack_core.ToolCall[];
2032
- partialToolResults: _perstack_core.ToolResult[];
2033
- }) | (_perstack_core.BaseEvent & {
2034
- type: "finishAllToolCalls";
2035
- } & {
2036
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2037
- }) | (_perstack_core.BaseEvent & {
2038
- type: "continueToNextStep";
2039
- } & {
2040
- checkpoint: Checkpoint;
2041
- step: Step;
2042
- nextCheckpoint: Checkpoint;
2043
- }) | (_perstack_core.BaseEvent & {
2044
- type: "stopRunByInteractiveTool";
2045
- } & {
2046
- checkpoint: Checkpoint;
2047
- step: Step;
2048
- }) | (_perstack_core.BaseEvent & {
2049
- type: "stopRunByDelegate";
2050
- } & {
2051
- checkpoint: Checkpoint;
2052
- step: Step;
2053
- }) | (_perstack_core.BaseEvent & {
2054
- type: "stopRunByExceededMaxSteps";
2055
- } & {
2056
- checkpoint: Checkpoint;
2057
- step: Step;
2058
- }) | (_perstack_core.BaseEvent & {
2059
- type: "completeRun";
2060
- } & {
2061
- checkpoint: Checkpoint;
2062
- step: Step;
2063
- text: string;
2064
- usage: _perstack_core.Usage;
2065
- }), undefined, never, never, never, never, never>;
2066
- };
2067
- readonly completeRun: {
2068
- readonly target: "Stopped";
2069
- readonly actions: xstate.ActionFunction<{
2070
- setting: RunSetting;
2071
- step: Step;
2072
- checkpoint: Checkpoint;
2073
- eventListener: (event: RunEvent) => Promise<void>;
2074
- skillManagers: Record<string, BaseSkillManager>;
2075
- }, _perstack_core.BaseEvent & {
2076
- type: "completeRun";
2077
- } & {
2078
- checkpoint: Checkpoint;
2079
- step: Step;
2080
- text: string;
2081
- usage: _perstack_core.Usage;
2082
- }, (_perstack_core.BaseEvent & {
2083
- type: "startRun";
2084
- } & {
2085
- initialCheckpoint: Checkpoint;
2086
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2087
- }) | (_perstack_core.BaseEvent & {
2088
- type: "startGeneration";
2089
- } & {
2090
- messages: _perstack_core.Message[];
2091
- }) | (_perstack_core.BaseEvent & {
2092
- type: "retry";
2093
- } & {
2094
- reason: string;
2095
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
2096
- toolCalls?: _perstack_core.ToolCall[];
2097
- toolResults?: _perstack_core.ToolResult[];
2098
- usage: _perstack_core.Usage;
2099
- }) | (_perstack_core.BaseEvent & {
2100
- type: "callTools";
2101
- } & {
2102
- newMessage: _perstack_core.ExpertMessage;
2103
- toolCalls: _perstack_core.ToolCall[];
2104
- usage: _perstack_core.Usage;
2105
- }) | (_perstack_core.BaseEvent & {
2106
- type: "callInteractiveTool";
2107
- } & {
2108
- newMessage: _perstack_core.ExpertMessage;
2109
- toolCall: _perstack_core.ToolCall;
2110
- usage: _perstack_core.Usage;
2111
- }) | (_perstack_core.BaseEvent & {
2112
- type: "callDelegate";
2113
- } & {
2114
- newMessage: _perstack_core.ExpertMessage;
2115
- toolCalls: _perstack_core.ToolCall[];
2116
- usage: _perstack_core.Usage;
2117
- }) | (_perstack_core.BaseEvent & {
2118
- type: "resolveToolResults";
2119
- } & {
2120
- toolResults: _perstack_core.ToolResult[];
2121
- }) | (_perstack_core.BaseEvent & {
2122
- type: "resolveThought";
2123
- } & {
2124
- toolResult: _perstack_core.ToolResult;
2125
- }) | (_perstack_core.BaseEvent & {
2126
- type: "attemptCompletion";
2127
- } & {
2128
- toolResult: _perstack_core.ToolResult;
2129
- }) | (_perstack_core.BaseEvent & {
2130
- type: "finishToolCall";
2131
- } & {
2132
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2133
- }) | (_perstack_core.BaseEvent & {
2134
- type: "resumeToolCalls";
2135
- } & {
2136
- pendingToolCalls: _perstack_core.ToolCall[];
2137
- partialToolResults: _perstack_core.ToolResult[];
2138
- }) | (_perstack_core.BaseEvent & {
2139
- type: "finishAllToolCalls";
2140
- } & {
2141
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2142
- }) | (_perstack_core.BaseEvent & {
2143
- type: "continueToNextStep";
2144
- } & {
2145
- checkpoint: Checkpoint;
2146
- step: Step;
2147
- nextCheckpoint: Checkpoint;
2148
- }) | (_perstack_core.BaseEvent & {
2149
- type: "stopRunByInteractiveTool";
2150
- } & {
2151
- checkpoint: Checkpoint;
2152
- step: Step;
2153
- }) | (_perstack_core.BaseEvent & {
2154
- type: "stopRunByDelegate";
2155
- } & {
2156
- checkpoint: Checkpoint;
2157
- step: Step;
2158
- }) | (_perstack_core.BaseEvent & {
2159
- type: "stopRunByExceededMaxSteps";
2160
- } & {
2161
- checkpoint: Checkpoint;
2162
- step: Step;
2163
- }) | (_perstack_core.BaseEvent & {
2164
- type: "completeRun";
2165
- } & {
2166
- checkpoint: Checkpoint;
2167
- step: Step;
2168
- text: string;
2169
- usage: _perstack_core.Usage;
2170
- }), undefined, never, never, never, never, never>;
2171
- };
2172
- };
2173
- };
2174
- readonly CallingInteractiveTool: {
2175
- readonly on: {
2176
- readonly stopRunByInteractiveTool: {
2177
- readonly target: "Stopped";
2178
- readonly actions: xstate.ActionFunction<{
2179
- setting: RunSetting;
2180
- step: Step;
2181
- checkpoint: Checkpoint;
2182
- eventListener: (event: RunEvent) => Promise<void>;
2183
- skillManagers: Record<string, BaseSkillManager>;
2184
- }, _perstack_core.BaseEvent & {
2185
- type: "stopRunByInteractiveTool";
2186
- } & {
2187
- checkpoint: Checkpoint;
2188
- step: Step;
2189
- }, (_perstack_core.BaseEvent & {
2190
- type: "startRun";
2191
- } & {
2192
- initialCheckpoint: Checkpoint;
2193
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2194
- }) | (_perstack_core.BaseEvent & {
2195
- type: "startGeneration";
2196
- } & {
2197
- messages: _perstack_core.Message[];
2198
- }) | (_perstack_core.BaseEvent & {
2199
- type: "retry";
2200
- } & {
2201
- reason: string;
2202
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
2203
- toolCalls?: _perstack_core.ToolCall[];
2204
- toolResults?: _perstack_core.ToolResult[];
2205
- usage: _perstack_core.Usage;
2206
- }) | (_perstack_core.BaseEvent & {
2207
- type: "callTools";
2208
- } & {
2209
- newMessage: _perstack_core.ExpertMessage;
2210
- toolCalls: _perstack_core.ToolCall[];
2211
- usage: _perstack_core.Usage;
2212
- }) | (_perstack_core.BaseEvent & {
2213
- type: "callInteractiveTool";
2214
- } & {
2215
- newMessage: _perstack_core.ExpertMessage;
2216
- toolCall: _perstack_core.ToolCall;
2217
- usage: _perstack_core.Usage;
2218
- }) | (_perstack_core.BaseEvent & {
2219
- type: "callDelegate";
2220
- } & {
2221
- newMessage: _perstack_core.ExpertMessage;
2222
- toolCalls: _perstack_core.ToolCall[];
2223
- usage: _perstack_core.Usage;
2224
- }) | (_perstack_core.BaseEvent & {
2225
- type: "resolveToolResults";
2226
- } & {
2227
- toolResults: _perstack_core.ToolResult[];
2228
- }) | (_perstack_core.BaseEvent & {
2229
- type: "resolveThought";
2230
- } & {
2231
- toolResult: _perstack_core.ToolResult;
2232
- }) | (_perstack_core.BaseEvent & {
2233
- type: "attemptCompletion";
2234
- } & {
2235
- toolResult: _perstack_core.ToolResult;
2236
- }) | (_perstack_core.BaseEvent & {
2237
- type: "finishToolCall";
2238
- } & {
2239
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2240
- }) | (_perstack_core.BaseEvent & {
2241
- type: "resumeToolCalls";
2242
- } & {
2243
- pendingToolCalls: _perstack_core.ToolCall[];
2244
- partialToolResults: _perstack_core.ToolResult[];
2245
- }) | (_perstack_core.BaseEvent & {
2246
- type: "finishAllToolCalls";
2247
- } & {
2248
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2249
- }) | (_perstack_core.BaseEvent & {
2250
- type: "continueToNextStep";
2251
- } & {
2252
- checkpoint: Checkpoint;
2253
- step: Step;
2254
- nextCheckpoint: Checkpoint;
2255
- }) | (_perstack_core.BaseEvent & {
2256
- type: "stopRunByInteractiveTool";
2257
- } & {
2258
- checkpoint: Checkpoint;
2259
- step: Step;
2260
- }) | (_perstack_core.BaseEvent & {
2261
- type: "stopRunByDelegate";
2262
- } & {
2263
- checkpoint: Checkpoint;
2264
- step: Step;
2265
- }) | (_perstack_core.BaseEvent & {
2266
- type: "stopRunByExceededMaxSteps";
2267
- } & {
2268
- checkpoint: Checkpoint;
2269
- step: Step;
2270
- }) | (_perstack_core.BaseEvent & {
2271
- type: "completeRun";
2272
- } & {
2273
- checkpoint: Checkpoint;
2274
- step: Step;
2275
- text: string;
2276
- usage: _perstack_core.Usage;
2277
- }), undefined, never, never, never, never, never>;
2278
- };
2279
- };
2280
- };
2281
- readonly CallingDelegate: {
2282
- readonly on: {
2283
- readonly stopRunByDelegate: {
2284
- readonly target: "Stopped";
2285
- readonly actions: xstate.ActionFunction<{
2286
- setting: RunSetting;
2287
- step: Step;
2288
- checkpoint: Checkpoint;
2289
- eventListener: (event: RunEvent) => Promise<void>;
2290
- skillManagers: Record<string, BaseSkillManager>;
2291
- }, _perstack_core.BaseEvent & {
2292
- type: "stopRunByDelegate";
2293
- } & {
2294
- checkpoint: Checkpoint;
2295
- step: Step;
2296
- }, (_perstack_core.BaseEvent & {
2297
- type: "startRun";
2298
- } & {
2299
- initialCheckpoint: Checkpoint;
2300
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2301
- }) | (_perstack_core.BaseEvent & {
2302
- type: "startGeneration";
2303
- } & {
2304
- messages: _perstack_core.Message[];
2305
- }) | (_perstack_core.BaseEvent & {
2306
- type: "retry";
2307
- } & {
2308
- reason: string;
2309
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
2310
- toolCalls?: _perstack_core.ToolCall[];
2311
- toolResults?: _perstack_core.ToolResult[];
2312
- usage: _perstack_core.Usage;
2313
- }) | (_perstack_core.BaseEvent & {
2314
- type: "callTools";
2315
- } & {
2316
- newMessage: _perstack_core.ExpertMessage;
2317
- toolCalls: _perstack_core.ToolCall[];
2318
- usage: _perstack_core.Usage;
2319
- }) | (_perstack_core.BaseEvent & {
2320
- type: "callInteractiveTool";
2321
- } & {
2322
- newMessage: _perstack_core.ExpertMessage;
2323
- toolCall: _perstack_core.ToolCall;
2324
- usage: _perstack_core.Usage;
2325
- }) | (_perstack_core.BaseEvent & {
2326
- type: "callDelegate";
2327
- } & {
2328
- newMessage: _perstack_core.ExpertMessage;
2329
- toolCalls: _perstack_core.ToolCall[];
2330
- usage: _perstack_core.Usage;
2331
- }) | (_perstack_core.BaseEvent & {
2332
- type: "resolveToolResults";
2333
- } & {
2334
- toolResults: _perstack_core.ToolResult[];
2335
- }) | (_perstack_core.BaseEvent & {
2336
- type: "resolveThought";
2337
- } & {
2338
- toolResult: _perstack_core.ToolResult;
2339
- }) | (_perstack_core.BaseEvent & {
2340
- type: "attemptCompletion";
2341
- } & {
2342
- toolResult: _perstack_core.ToolResult;
2343
- }) | (_perstack_core.BaseEvent & {
2344
- type: "finishToolCall";
2345
- } & {
2346
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2347
- }) | (_perstack_core.BaseEvent & {
2348
- type: "resumeToolCalls";
2349
- } & {
2350
- pendingToolCalls: _perstack_core.ToolCall[];
2351
- partialToolResults: _perstack_core.ToolResult[];
2352
- }) | (_perstack_core.BaseEvent & {
2353
- type: "finishAllToolCalls";
2354
- } & {
2355
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2356
- }) | (_perstack_core.BaseEvent & {
2357
- type: "continueToNextStep";
2358
- } & {
2359
- checkpoint: Checkpoint;
2360
- step: Step;
2361
- nextCheckpoint: Checkpoint;
2362
- }) | (_perstack_core.BaseEvent & {
2363
- type: "stopRunByInteractiveTool";
2364
- } & {
2365
- checkpoint: Checkpoint;
2366
- step: Step;
2367
- }) | (_perstack_core.BaseEvent & {
2368
- type: "stopRunByDelegate";
2369
- } & {
2370
- checkpoint: Checkpoint;
2371
- step: Step;
2372
- }) | (_perstack_core.BaseEvent & {
2373
- type: "stopRunByExceededMaxSteps";
2374
- } & {
2375
- checkpoint: Checkpoint;
2376
- step: Step;
2377
- }) | (_perstack_core.BaseEvent & {
2378
- type: "completeRun";
2379
- } & {
2380
- checkpoint: Checkpoint;
2381
- step: Step;
2382
- text: string;
2383
- usage: _perstack_core.Usage;
2384
- }), undefined, never, never, never, never, never>;
2385
- };
2386
- };
2387
- };
2388
- readonly FinishingStep: {
2389
- readonly on: {
2390
- readonly continueToNextStep: {
2391
- readonly target: "PreparingForStep";
2392
- readonly actions: xstate.ActionFunction<{
2393
- setting: RunSetting;
2394
- step: Step;
2395
- checkpoint: Checkpoint;
2396
- eventListener: (event: RunEvent) => Promise<void>;
2397
- skillManagers: Record<string, BaseSkillManager>;
2398
- }, _perstack_core.BaseEvent & {
2399
- type: "continueToNextStep";
2400
- } & {
2401
- checkpoint: Checkpoint;
2402
- step: Step;
2403
- nextCheckpoint: Checkpoint;
2404
- }, (_perstack_core.BaseEvent & {
2405
- type: "startRun";
2406
- } & {
2407
- initialCheckpoint: Checkpoint;
2408
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2409
- }) | (_perstack_core.BaseEvent & {
2410
- type: "startGeneration";
2411
- } & {
2412
- messages: _perstack_core.Message[];
2413
- }) | (_perstack_core.BaseEvent & {
2414
- type: "retry";
2415
- } & {
2416
- reason: string;
2417
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
2418
- toolCalls?: _perstack_core.ToolCall[];
2419
- toolResults?: _perstack_core.ToolResult[];
2420
- usage: _perstack_core.Usage;
2421
- }) | (_perstack_core.BaseEvent & {
2422
- type: "callTools";
2423
- } & {
2424
- newMessage: _perstack_core.ExpertMessage;
2425
- toolCalls: _perstack_core.ToolCall[];
2426
- usage: _perstack_core.Usage;
2427
- }) | (_perstack_core.BaseEvent & {
2428
- type: "callInteractiveTool";
2429
- } & {
2430
- newMessage: _perstack_core.ExpertMessage;
2431
- toolCall: _perstack_core.ToolCall;
2432
- usage: _perstack_core.Usage;
2433
- }) | (_perstack_core.BaseEvent & {
2434
- type: "callDelegate";
2435
- } & {
2436
- newMessage: _perstack_core.ExpertMessage;
2437
- toolCalls: _perstack_core.ToolCall[];
2438
- usage: _perstack_core.Usage;
2439
- }) | (_perstack_core.BaseEvent & {
2440
- type: "resolveToolResults";
2441
- } & {
2442
- toolResults: _perstack_core.ToolResult[];
2443
- }) | (_perstack_core.BaseEvent & {
2444
- type: "resolveThought";
2445
- } & {
2446
- toolResult: _perstack_core.ToolResult;
2447
- }) | (_perstack_core.BaseEvent & {
2448
- type: "attemptCompletion";
2449
- } & {
2450
- toolResult: _perstack_core.ToolResult;
2451
- }) | (_perstack_core.BaseEvent & {
2452
- type: "finishToolCall";
2453
- } & {
2454
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2455
- }) | (_perstack_core.BaseEvent & {
2456
- type: "resumeToolCalls";
2457
- } & {
2458
- pendingToolCalls: _perstack_core.ToolCall[];
2459
- partialToolResults: _perstack_core.ToolResult[];
2460
- }) | (_perstack_core.BaseEvent & {
2461
- type: "finishAllToolCalls";
2462
- } & {
2463
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2464
- }) | (_perstack_core.BaseEvent & {
2465
- type: "continueToNextStep";
2466
- } & {
2467
- checkpoint: Checkpoint;
2468
- step: Step;
2469
- nextCheckpoint: Checkpoint;
2470
- }) | (_perstack_core.BaseEvent & {
2471
- type: "stopRunByInteractiveTool";
2472
- } & {
2473
- checkpoint: Checkpoint;
2474
- step: Step;
2475
- }) | (_perstack_core.BaseEvent & {
2476
- type: "stopRunByDelegate";
2477
- } & {
2478
- checkpoint: Checkpoint;
2479
- step: Step;
2480
- }) | (_perstack_core.BaseEvent & {
2481
- type: "stopRunByExceededMaxSteps";
2482
- } & {
2483
- checkpoint: Checkpoint;
2484
- step: Step;
2485
- }) | (_perstack_core.BaseEvent & {
2486
- type: "completeRun";
2487
- } & {
2488
- checkpoint: Checkpoint;
2489
- step: Step;
2490
- text: string;
2491
- usage: _perstack_core.Usage;
2492
- }), undefined, never, never, never, never, never>;
2493
- readonly reenter: true;
2494
- };
2495
- readonly stopRunByExceededMaxSteps: {
2496
- readonly target: "Stopped";
2497
- readonly actions: xstate.ActionFunction<{
2498
- setting: RunSetting;
2499
- step: Step;
2500
- checkpoint: Checkpoint;
2501
- eventListener: (event: RunEvent) => Promise<void>;
2502
- skillManagers: Record<string, BaseSkillManager>;
2503
- }, _perstack_core.BaseEvent & {
2504
- type: "stopRunByExceededMaxSteps";
2505
- } & {
2506
- checkpoint: Checkpoint;
2507
- step: Step;
2508
- }, (_perstack_core.BaseEvent & {
2509
- type: "startRun";
2510
- } & {
2511
- initialCheckpoint: Checkpoint;
2512
- inputMessages: (_perstack_core.InstructionMessage | _perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2513
- }) | (_perstack_core.BaseEvent & {
2514
- type: "startGeneration";
2515
- } & {
2516
- messages: _perstack_core.Message[];
2517
- }) | (_perstack_core.BaseEvent & {
2518
- type: "retry";
2519
- } & {
2520
- reason: string;
2521
- newMessages: (_perstack_core.UserMessage | _perstack_core.ExpertMessage | _perstack_core.ToolMessage)[];
2522
- toolCalls?: _perstack_core.ToolCall[];
2523
- toolResults?: _perstack_core.ToolResult[];
2524
- usage: _perstack_core.Usage;
2525
- }) | (_perstack_core.BaseEvent & {
2526
- type: "callTools";
2527
- } & {
2528
- newMessage: _perstack_core.ExpertMessage;
2529
- toolCalls: _perstack_core.ToolCall[];
2530
- usage: _perstack_core.Usage;
2531
- }) | (_perstack_core.BaseEvent & {
2532
- type: "callInteractiveTool";
2533
- } & {
2534
- newMessage: _perstack_core.ExpertMessage;
2535
- toolCall: _perstack_core.ToolCall;
2536
- usage: _perstack_core.Usage;
2537
- }) | (_perstack_core.BaseEvent & {
2538
- type: "callDelegate";
2539
- } & {
2540
- newMessage: _perstack_core.ExpertMessage;
2541
- toolCalls: _perstack_core.ToolCall[];
2542
- usage: _perstack_core.Usage;
2543
- }) | (_perstack_core.BaseEvent & {
2544
- type: "resolveToolResults";
2545
- } & {
2546
- toolResults: _perstack_core.ToolResult[];
2547
- }) | (_perstack_core.BaseEvent & {
2548
- type: "resolveThought";
2549
- } & {
2550
- toolResult: _perstack_core.ToolResult;
2551
- }) | (_perstack_core.BaseEvent & {
2552
- type: "attemptCompletion";
2553
- } & {
2554
- toolResult: _perstack_core.ToolResult;
2555
- }) | (_perstack_core.BaseEvent & {
2556
- type: "finishToolCall";
2557
- } & {
2558
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2559
- }) | (_perstack_core.BaseEvent & {
2560
- type: "resumeToolCalls";
2561
- } & {
2562
- pendingToolCalls: _perstack_core.ToolCall[];
2563
- partialToolResults: _perstack_core.ToolResult[];
2564
- }) | (_perstack_core.BaseEvent & {
2565
- type: "finishAllToolCalls";
2566
- } & {
2567
- newMessages: (_perstack_core.UserMessage | _perstack_core.ToolMessage)[];
2568
- }) | (_perstack_core.BaseEvent & {
2569
- type: "continueToNextStep";
2570
- } & {
2571
- checkpoint: Checkpoint;
2572
- step: Step;
2573
- nextCheckpoint: Checkpoint;
2574
- }) | (_perstack_core.BaseEvent & {
2575
- type: "stopRunByInteractiveTool";
2576
- } & {
2577
- checkpoint: Checkpoint;
2578
- step: Step;
2579
- }) | (_perstack_core.BaseEvent & {
2580
- type: "stopRunByDelegate";
2581
- } & {
2582
- checkpoint: Checkpoint;
2583
- step: Step;
2584
- }) | (_perstack_core.BaseEvent & {
2585
- type: "stopRunByExceededMaxSteps";
2586
- } & {
2587
- checkpoint: Checkpoint;
2588
- step: Step;
2589
- }) | (_perstack_core.BaseEvent & {
2590
- type: "completeRun";
2591
- } & {
2592
- checkpoint: Checkpoint;
2593
- step: Step;
2594
- text: string;
2595
- usage: _perstack_core.Usage;
2596
- }), undefined, never, never, never, never, never>;
2597
- };
2598
- };
2599
- };
2600
- readonly Stopped: {
2601
- readonly type: "final";
2602
- };
184
+ id: "Run";
185
+ states: {
186
+ readonly Init: {};
187
+ readonly PreparingForStep: {};
188
+ readonly GeneratingToolCall: {};
189
+ readonly CallingTool: {};
190
+ readonly ResolvingToolResult: {};
191
+ readonly ResolvingThought: {};
192
+ readonly GeneratingRunResult: {};
193
+ readonly CallingInteractiveTool: {};
194
+ readonly CallingDelegate: {};
195
+ readonly FinishingStep: {};
196
+ readonly Stopped: {};
2603
197
  };
2604
198
  }>;
2605
199
  type RunActor = ActorRefFrom<typeof runtimeStateMachine>;