@perstack/core 0.0.20 → 0.0.22

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.
@@ -174,7 +174,7 @@ interface ToolResultPart extends BasePart {
174
174
  /** Name of the tool that was called */
175
175
  toolName: string;
176
176
  /** Content of the tool result */
177
- contents: (TextPart | ImageInlinePart)[];
177
+ contents: (TextPart | ImageInlinePart | FileInlinePart)[];
178
178
  /** Whether the tool call resulted in an error */
179
179
  isError?: boolean;
180
180
  }
@@ -192,6 +192,11 @@ declare const toolResultPartSchema: z.ZodObject<{
192
192
  type: z.ZodLiteral<"imageInlinePart">;
193
193
  encodedData: z.ZodString;
194
194
  mimeType: z.ZodString;
195
+ }, z.core.$strip>, z.ZodObject<{
196
+ id: z.ZodString;
197
+ type: z.ZodLiteral<"fileInlinePart">;
198
+ encodedData: z.ZodString;
199
+ mimeType: z.ZodString;
195
200
  }, z.core.$strip>]>>;
196
201
  isError: z.ZodOptional<z.ZodBoolean>;
197
202
  }, z.core.$strip>;
@@ -251,6 +256,11 @@ declare const messagePartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
251
256
  type: z.ZodLiteral<"imageInlinePart">;
252
257
  encodedData: z.ZodString;
253
258
  mimeType: z.ZodString;
259
+ }, z.core.$strip>, z.ZodObject<{
260
+ id: z.ZodString;
261
+ type: z.ZodLiteral<"fileInlinePart">;
262
+ encodedData: z.ZodString;
263
+ mimeType: z.ZodString;
254
264
  }, z.core.$strip>]>>;
255
265
  isError: z.ZodOptional<z.ZodBoolean>;
256
266
  }, z.core.$strip>], "type">;
@@ -375,6 +385,11 @@ declare const toolMessageSchema: z.ZodObject<{
375
385
  type: z.ZodLiteral<"imageInlinePart">;
376
386
  encodedData: z.ZodString;
377
387
  mimeType: z.ZodString;
388
+ }, z.core.$strip>, z.ZodObject<{
389
+ id: z.ZodString;
390
+ type: z.ZodLiteral<"fileInlinePart">;
391
+ encodedData: z.ZodString;
392
+ mimeType: z.ZodString;
378
393
  }, z.core.$strip>]>>;
379
394
  isError: z.ZodOptional<z.ZodBoolean>;
380
395
  }, z.core.$strip>>;
@@ -462,12 +477,114 @@ declare const messageSchema: z.ZodUnion<readonly [z.ZodObject<{
462
477
  type: z.ZodLiteral<"imageInlinePart">;
463
478
  encodedData: z.ZodString;
464
479
  mimeType: z.ZodString;
480
+ }, z.core.$strip>, z.ZodObject<{
481
+ id: z.ZodString;
482
+ type: z.ZodLiteral<"fileInlinePart">;
483
+ encodedData: z.ZodString;
484
+ mimeType: z.ZodString;
465
485
  }, z.core.$strip>]>>;
466
486
  isError: z.ZodOptional<z.ZodBoolean>;
467
487
  }, z.core.$strip>>;
468
488
  cache: z.ZodOptional<z.ZodBoolean>;
469
489
  }, z.core.$strip>]>;
470
490
 
491
+ /** A tool call made by an Expert during execution */
492
+ interface ToolCall {
493
+ /** Unique identifier for this tool call */
494
+ id: string;
495
+ /** Name of the skill providing the tool */
496
+ skillName: string;
497
+ /** Name of the tool being called */
498
+ toolName: string;
499
+ /** Arguments passed to the tool */
500
+ args: Record<string, unknown>;
501
+ }
502
+ declare const toolCallSchema: z.ZodObject<{
503
+ id: z.ZodString;
504
+ skillName: z.ZodString;
505
+ toolName: z.ZodString;
506
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
507
+ }, z.core.$strip>;
508
+
509
+ /** Result returned from a tool call */
510
+ interface ToolResult {
511
+ /** Unique identifier for this result */
512
+ id: string;
513
+ /** Name of the skill that provided the tool */
514
+ skillName: string;
515
+ /** Name of the tool that was called */
516
+ toolName: string;
517
+ /** Content parts returned by the tool */
518
+ result: MessagePart[];
519
+ }
520
+ declare const toolResultSchema: z.ZodObject<{
521
+ id: z.ZodString;
522
+ skillName: z.ZodString;
523
+ toolName: z.ZodString;
524
+ result: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
525
+ id: z.ZodString;
526
+ type: z.ZodLiteral<"textPart">;
527
+ text: z.ZodString;
528
+ }, z.core.$strip>, z.ZodObject<{
529
+ id: z.ZodString;
530
+ type: z.ZodLiteral<"imageUrlPart">;
531
+ url: z.ZodURL;
532
+ mimeType: z.ZodString;
533
+ }, z.core.$strip>, z.ZodObject<{
534
+ id: z.ZodString;
535
+ type: z.ZodLiteral<"imageInlinePart">;
536
+ encodedData: z.ZodString;
537
+ mimeType: z.ZodString;
538
+ }, z.core.$strip>, z.ZodObject<{
539
+ id: z.ZodString;
540
+ type: z.ZodLiteral<"imageBinaryPart">;
541
+ data: z.ZodString;
542
+ mimeType: z.ZodString;
543
+ }, z.core.$strip>, z.ZodObject<{
544
+ id: z.ZodString;
545
+ type: z.ZodLiteral<"fileUrlPart">;
546
+ url: z.ZodString;
547
+ mimeType: z.ZodString;
548
+ }, z.core.$strip>, z.ZodObject<{
549
+ id: z.ZodString;
550
+ type: z.ZodLiteral<"fileInlinePart">;
551
+ encodedData: z.ZodString;
552
+ mimeType: z.ZodString;
553
+ }, z.core.$strip>, z.ZodObject<{
554
+ id: z.ZodString;
555
+ type: z.ZodLiteral<"fileBinaryPart">;
556
+ data: z.ZodString;
557
+ mimeType: z.ZodString;
558
+ }, z.core.$strip>, z.ZodObject<{
559
+ id: z.ZodString;
560
+ type: z.ZodLiteral<"toolCallPart">;
561
+ toolCallId: z.ZodString;
562
+ toolName: z.ZodString;
563
+ args: z.ZodUnknown;
564
+ }, z.core.$strip>, z.ZodObject<{
565
+ id: z.ZodString;
566
+ type: z.ZodLiteral<"toolResultPart">;
567
+ toolCallId: z.ZodString;
568
+ toolName: z.ZodString;
569
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
570
+ id: z.ZodString;
571
+ type: z.ZodLiteral<"textPart">;
572
+ text: z.ZodString;
573
+ }, z.core.$strip>, z.ZodObject<{
574
+ id: z.ZodString;
575
+ type: z.ZodLiteral<"imageInlinePart">;
576
+ encodedData: z.ZodString;
577
+ mimeType: z.ZodString;
578
+ }, z.core.$strip>, z.ZodObject<{
579
+ id: z.ZodString;
580
+ type: z.ZodLiteral<"fileInlinePart">;
581
+ encodedData: z.ZodString;
582
+ mimeType: z.ZodString;
583
+ }, z.core.$strip>]>>;
584
+ isError: z.ZodOptional<z.ZodBoolean>;
585
+ }, z.core.$strip>], "type">>;
586
+ }, z.core.$strip>;
587
+
471
588
  /** Token usage statistics for a single step or run */
472
589
  interface Usage {
473
590
  /** Number of tokens in the input prompt */
@@ -500,6 +617,17 @@ declare const checkpointStatusSchema: z.ZodEnum<{
500
617
  stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
501
618
  stoppedByError: "stoppedByError";
502
619
  }>;
620
+ /** Information about a delegation target */
621
+ interface DelegationTarget {
622
+ expert: {
623
+ key: string;
624
+ name: string;
625
+ version: string;
626
+ };
627
+ toolCallId: string;
628
+ toolName: string;
629
+ query: string;
630
+ }
503
631
  /**
504
632
  * A checkpoint represents a point-in-time snapshot of an Expert's execution state.
505
633
  * Used for resuming, debugging, and observability.
@@ -507,11 +635,13 @@ declare const checkpointStatusSchema: z.ZodEnum<{
507
635
  interface Checkpoint {
508
636
  /** Unique identifier for this checkpoint */
509
637
  id: string;
638
+ /** Job ID this checkpoint belongs to */
639
+ jobId: string;
510
640
  /** Run ID this checkpoint belongs to */
511
641
  runId: string;
512
642
  /** Current execution status */
513
643
  status: CheckpointStatus;
514
- /** Current step number */
644
+ /** Current step number within this Run */
515
645
  stepNumber: number;
516
646
  /** All messages in the conversation so far */
517
647
  messages: Message[];
@@ -524,21 +654,8 @@ interface Checkpoint {
524
654
  /** Expert version */
525
655
  version: string;
526
656
  };
527
- /** If delegating, information about the target Expert */
528
- delegateTo?: {
529
- /** The Expert being delegated to */
530
- expert: {
531
- key: string;
532
- name: string;
533
- version: string;
534
- };
535
- /** Tool call ID that triggered delegation */
536
- toolCallId: string;
537
- /** Name of the delegation tool */
538
- toolName: string;
539
- /** Query passed to the delegate */
540
- query: string;
541
- };
657
+ /** If delegating, information about the target Expert(s) - supports parallel delegation */
658
+ delegateTo?: DelegationTarget[];
542
659
  /** If delegated, information about the parent Expert */
543
660
  delegatedBy?: {
544
661
  /** The parent Expert that delegated */
@@ -560,9 +677,24 @@ interface Checkpoint {
560
677
  contextWindow?: number;
561
678
  /** Context window usage ratio (0-1) */
562
679
  contextWindowUsage?: number;
680
+ /** Tool calls waiting to be processed (for resume after delegate/interactive) */
681
+ pendingToolCalls?: ToolCall[];
682
+ /** Partial tool results collected before stopping (for resume) */
683
+ partialToolResults?: ToolResult[];
563
684
  }
685
+ declare const delegationTargetSchema: z.ZodObject<{
686
+ expert: z.ZodObject<{
687
+ key: z.ZodString;
688
+ name: z.ZodString;
689
+ version: z.ZodString;
690
+ }, z.core.$strip>;
691
+ toolCallId: z.ZodString;
692
+ toolName: z.ZodString;
693
+ query: z.ZodString;
694
+ }, z.core.$strip>;
564
695
  declare const checkpointSchema: z.ZodObject<{
565
696
  id: z.ZodString;
697
+ jobId: z.ZodString;
566
698
  runId: z.ZodString;
567
699
  status: z.ZodEnum<{
568
700
  init: "init";
@@ -654,6 +786,11 @@ declare const checkpointSchema: z.ZodObject<{
654
786
  type: z.ZodLiteral<"imageInlinePart">;
655
787
  encodedData: z.ZodString;
656
788
  mimeType: z.ZodString;
789
+ }, z.core.$strip>, z.ZodObject<{
790
+ id: z.ZodString;
791
+ type: z.ZodLiteral<"fileInlinePart">;
792
+ encodedData: z.ZodString;
793
+ mimeType: z.ZodString;
657
794
  }, z.core.$strip>]>>;
658
795
  isError: z.ZodOptional<z.ZodBoolean>;
659
796
  }, z.core.$strip>>;
@@ -664,7 +801,7 @@ declare const checkpointSchema: z.ZodObject<{
664
801
  name: z.ZodString;
665
802
  version: z.ZodString;
666
803
  }, z.core.$strip>;
667
- delegateTo: z.ZodOptional<z.ZodObject<{
804
+ delegateTo: z.ZodOptional<z.ZodArray<z.ZodObject<{
668
805
  expert: z.ZodObject<{
669
806
  key: z.ZodString;
670
807
  name: z.ZodString;
@@ -673,7 +810,7 @@ declare const checkpointSchema: z.ZodObject<{
673
810
  toolCallId: z.ZodString;
674
811
  toolName: z.ZodString;
675
812
  query: z.ZodString;
676
- }, z.core.$strip>>;
813
+ }, z.core.$strip>>>;
677
814
  delegatedBy: z.ZodOptional<z.ZodObject<{
678
815
  expert: z.ZodObject<{
679
816
  key: z.ZodString;
@@ -693,6 +830,79 @@ declare const checkpointSchema: z.ZodObject<{
693
830
  }, z.core.$strip>;
694
831
  contextWindow: z.ZodOptional<z.ZodNumber>;
695
832
  contextWindowUsage: z.ZodOptional<z.ZodNumber>;
833
+ pendingToolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
834
+ id: z.ZodString;
835
+ skillName: z.ZodString;
836
+ toolName: z.ZodString;
837
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
838
+ }, z.core.$strip>>>;
839
+ partialToolResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
840
+ id: z.ZodString;
841
+ skillName: z.ZodString;
842
+ toolName: z.ZodString;
843
+ result: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
844
+ id: z.ZodString;
845
+ type: z.ZodLiteral<"textPart">;
846
+ text: z.ZodString;
847
+ }, z.core.$strip>, z.ZodObject<{
848
+ id: z.ZodString;
849
+ type: z.ZodLiteral<"imageUrlPart">;
850
+ url: z.ZodURL;
851
+ mimeType: z.ZodString;
852
+ }, z.core.$strip>, z.ZodObject<{
853
+ id: z.ZodString;
854
+ type: z.ZodLiteral<"imageInlinePart">;
855
+ encodedData: z.ZodString;
856
+ mimeType: z.ZodString;
857
+ }, z.core.$strip>, z.ZodObject<{
858
+ id: z.ZodString;
859
+ type: z.ZodLiteral<"imageBinaryPart">;
860
+ data: z.ZodString;
861
+ mimeType: z.ZodString;
862
+ }, z.core.$strip>, z.ZodObject<{
863
+ id: z.ZodString;
864
+ type: z.ZodLiteral<"fileUrlPart">;
865
+ url: z.ZodString;
866
+ mimeType: z.ZodString;
867
+ }, z.core.$strip>, z.ZodObject<{
868
+ id: z.ZodString;
869
+ type: z.ZodLiteral<"fileInlinePart">;
870
+ encodedData: z.ZodString;
871
+ mimeType: z.ZodString;
872
+ }, z.core.$strip>, z.ZodObject<{
873
+ id: z.ZodString;
874
+ type: z.ZodLiteral<"fileBinaryPart">;
875
+ data: z.ZodString;
876
+ mimeType: z.ZodString;
877
+ }, z.core.$strip>, z.ZodObject<{
878
+ id: z.ZodString;
879
+ type: z.ZodLiteral<"toolCallPart">;
880
+ toolCallId: z.ZodString;
881
+ toolName: z.ZodString;
882
+ args: z.ZodUnknown;
883
+ }, z.core.$strip>, z.ZodObject<{
884
+ id: z.ZodString;
885
+ type: z.ZodLiteral<"toolResultPart">;
886
+ toolCallId: z.ZodString;
887
+ toolName: z.ZodString;
888
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
889
+ id: z.ZodString;
890
+ type: z.ZodLiteral<"textPart">;
891
+ text: z.ZodString;
892
+ }, z.core.$strip>, z.ZodObject<{
893
+ id: z.ZodString;
894
+ type: z.ZodLiteral<"imageInlinePart">;
895
+ encodedData: z.ZodString;
896
+ mimeType: z.ZodString;
897
+ }, z.core.$strip>, z.ZodObject<{
898
+ id: z.ZodString;
899
+ type: z.ZodLiteral<"fileInlinePart">;
900
+ encodedData: z.ZodString;
901
+ mimeType: z.ZodString;
902
+ }, z.core.$strip>]>>;
903
+ isError: z.ZodOptional<z.ZodBoolean>;
904
+ }, z.core.$strip>], "type">>;
905
+ }, z.core.$strip>>>;
696
906
  }, z.core.$strip>;
697
907
 
698
908
  /** MCP skill using stdio transport */
@@ -975,6 +1185,47 @@ declare const expertSchema: z.ZodObject<{
975
1185
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
976
1186
  }, z.core.$strip>;
977
1187
 
1188
+ type JobStatus = "running" | "completed" | "stoppedByMaxSteps" | "stoppedByInteractiveTool" | "stoppedByError";
1189
+ declare const jobStatusSchema: z.ZodEnum<{
1190
+ completed: "completed";
1191
+ stoppedByInteractiveTool: "stoppedByInteractiveTool";
1192
+ stoppedByError: "stoppedByError";
1193
+ running: "running";
1194
+ stoppedByMaxSteps: "stoppedByMaxSteps";
1195
+ }>;
1196
+ interface Job {
1197
+ id: string;
1198
+ status: JobStatus;
1199
+ coordinatorExpertKey: string;
1200
+ totalSteps: number;
1201
+ maxSteps?: number;
1202
+ usage: Usage;
1203
+ startedAt: number;
1204
+ finishedAt?: number;
1205
+ }
1206
+ declare const jobSchema: z.ZodObject<{
1207
+ id: z.ZodString;
1208
+ status: z.ZodEnum<{
1209
+ completed: "completed";
1210
+ stoppedByInteractiveTool: "stoppedByInteractiveTool";
1211
+ stoppedByError: "stoppedByError";
1212
+ running: "running";
1213
+ stoppedByMaxSteps: "stoppedByMaxSteps";
1214
+ }>;
1215
+ coordinatorExpertKey: z.ZodString;
1216
+ totalSteps: z.ZodNumber;
1217
+ maxSteps: z.ZodOptional<z.ZodNumber>;
1218
+ usage: z.ZodObject<{
1219
+ inputTokens: z.ZodNumber;
1220
+ outputTokens: z.ZodNumber;
1221
+ reasoningTokens: z.ZodNumber;
1222
+ totalTokens: z.ZodNumber;
1223
+ cachedInputTokens: z.ZodNumber;
1224
+ }, z.core.$strip>;
1225
+ startedAt: z.ZodNumber;
1226
+ finishedAt: z.ZodOptional<z.ZodNumber>;
1227
+ }, z.core.$strip>;
1228
+
978
1229
  declare const anthropicSettingSchema: z.ZodObject<{
979
1230
  baseUrl: z.ZodOptional<z.ZodString>;
980
1231
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -1498,17 +1749,19 @@ interface CommandOptions {
1498
1749
  maxRetries?: number;
1499
1750
  /** Timeout in milliseconds */
1500
1751
  timeout?: number;
1752
+ /** Custom job ID */
1753
+ jobId?: string;
1501
1754
  /** Custom run ID */
1502
1755
  runId?: string;
1503
1756
  /** Paths to .env files */
1504
1757
  envPath?: string[];
1505
1758
  /** Enable verbose logging */
1506
1759
  verbose?: boolean;
1507
- /** Continue most recent run */
1760
+ /** Continue most recent job */
1508
1761
  continue?: boolean;
1509
- /** Continue specific run by ID */
1510
- continueRun?: string;
1511
- /** Resume from specific checkpoint */
1762
+ /** Continue specific job by ID */
1763
+ continueJob?: string;
1764
+ /** Resume from specific checkpoint (requires --continue or --continue-job) */
1512
1765
  resumeFrom?: string;
1513
1766
  /** Query is interactive tool call result */
1514
1767
  interactiveToolCallResult?: boolean;
@@ -1542,11 +1795,12 @@ declare const runCommandInputSchema: z.ZodObject<{
1542
1795
  maxSteps: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
1543
1796
  maxRetries: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
1544
1797
  timeout: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
1798
+ jobId: z.ZodOptional<z.ZodString>;
1545
1799
  runId: z.ZodOptional<z.ZodString>;
1546
1800
  envPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
1547
1801
  verbose: z.ZodOptional<z.ZodBoolean>;
1548
1802
  continue: z.ZodOptional<z.ZodBoolean>;
1549
- continueRun: z.ZodOptional<z.ZodString>;
1803
+ continueJob: z.ZodOptional<z.ZodString>;
1550
1804
  resumeFrom: z.ZodOptional<z.ZodString>;
1551
1805
  interactiveToolCallResult: z.ZodOptional<z.ZodBoolean>;
1552
1806
  }, z.core.$strip>;
@@ -1580,111 +1834,20 @@ declare const startCommandInputSchema: z.ZodObject<{
1580
1834
  maxSteps: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
1581
1835
  maxRetries: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
1582
1836
  timeout: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<number | undefined, string | undefined>>;
1837
+ jobId: z.ZodOptional<z.ZodString>;
1583
1838
  runId: z.ZodOptional<z.ZodString>;
1584
1839
  envPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
1585
1840
  verbose: z.ZodOptional<z.ZodBoolean>;
1586
1841
  continue: z.ZodOptional<z.ZodBoolean>;
1587
- continueRun: z.ZodOptional<z.ZodString>;
1842
+ continueJob: z.ZodOptional<z.ZodString>;
1588
1843
  resumeFrom: z.ZodOptional<z.ZodString>;
1589
1844
  interactiveToolCallResult: z.ZodOptional<z.ZodBoolean>;
1590
1845
  }, z.core.$strip>;
1591
1846
  }, z.core.$strip>;
1592
1847
 
1593
- /** A tool call made by an Expert during execution */
1594
- interface ToolCall {
1595
- /** Unique identifier for this tool call */
1596
- id: string;
1597
- /** Name of the skill providing the tool */
1598
- skillName: string;
1599
- /** Name of the tool being called */
1600
- toolName: string;
1601
- /** Arguments passed to the tool */
1602
- args: Record<string, unknown>;
1603
- }
1604
- declare const toolCallSchema: z.ZodObject<{
1605
- id: z.ZodString;
1606
- skillName: z.ZodString;
1607
- toolName: z.ZodString;
1608
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1609
- }, z.core.$strip>;
1610
-
1611
- /** Result returned from a tool call */
1612
- interface ToolResult {
1613
- /** Unique identifier for this result */
1614
- id: string;
1615
- /** Name of the skill that provided the tool */
1616
- skillName: string;
1617
- /** Name of the tool that was called */
1618
- toolName: string;
1619
- /** Content parts returned by the tool */
1620
- result: MessagePart[];
1621
- }
1622
- declare const toolResultSchema: z.ZodObject<{
1623
- id: z.ZodString;
1624
- skillName: z.ZodString;
1625
- toolName: z.ZodString;
1626
- result: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1627
- id: z.ZodString;
1628
- type: z.ZodLiteral<"textPart">;
1629
- text: z.ZodString;
1630
- }, z.core.$strip>, z.ZodObject<{
1631
- id: z.ZodString;
1632
- type: z.ZodLiteral<"imageUrlPart">;
1633
- url: z.ZodURL;
1634
- mimeType: z.ZodString;
1635
- }, z.core.$strip>, z.ZodObject<{
1636
- id: z.ZodString;
1637
- type: z.ZodLiteral<"imageInlinePart">;
1638
- encodedData: z.ZodString;
1639
- mimeType: z.ZodString;
1640
- }, z.core.$strip>, z.ZodObject<{
1641
- id: z.ZodString;
1642
- type: z.ZodLiteral<"imageBinaryPart">;
1643
- data: z.ZodString;
1644
- mimeType: z.ZodString;
1645
- }, z.core.$strip>, z.ZodObject<{
1646
- id: z.ZodString;
1647
- type: z.ZodLiteral<"fileUrlPart">;
1648
- url: z.ZodString;
1649
- mimeType: z.ZodString;
1650
- }, z.core.$strip>, z.ZodObject<{
1651
- id: z.ZodString;
1652
- type: z.ZodLiteral<"fileInlinePart">;
1653
- encodedData: z.ZodString;
1654
- mimeType: z.ZodString;
1655
- }, z.core.$strip>, z.ZodObject<{
1656
- id: z.ZodString;
1657
- type: z.ZodLiteral<"fileBinaryPart">;
1658
- data: z.ZodString;
1659
- mimeType: z.ZodString;
1660
- }, z.core.$strip>, z.ZodObject<{
1661
- id: z.ZodString;
1662
- type: z.ZodLiteral<"toolCallPart">;
1663
- toolCallId: z.ZodString;
1664
- toolName: z.ZodString;
1665
- args: z.ZodUnknown;
1666
- }, z.core.$strip>, z.ZodObject<{
1667
- id: z.ZodString;
1668
- type: z.ZodLiteral<"toolResultPart">;
1669
- toolCallId: z.ZodString;
1670
- toolName: z.ZodString;
1671
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1672
- id: z.ZodString;
1673
- type: z.ZodLiteral<"textPart">;
1674
- text: z.ZodString;
1675
- }, z.core.$strip>, z.ZodObject<{
1676
- id: z.ZodString;
1677
- type: z.ZodLiteral<"imageInlinePart">;
1678
- encodedData: z.ZodString;
1679
- mimeType: z.ZodString;
1680
- }, z.core.$strip>]>>;
1681
- isError: z.ZodOptional<z.ZodBoolean>;
1682
- }, z.core.$strip>], "type">>;
1683
- }, z.core.$strip>;
1684
-
1685
1848
  /**
1686
1849
  * A single execution step in an Expert run.
1687
- * Each step represents one LLM generation cycle, optionally followed by a tool call.
1850
+ * Each step represents one LLM generation cycle, optionally followed by tool calls.
1688
1851
  */
1689
1852
  interface Step {
1690
1853
  /** Sequential step number (1-indexed) */
@@ -1693,10 +1856,14 @@ interface Step {
1693
1856
  inputMessages?: (InstructionMessage | UserMessage | ToolMessage)[];
1694
1857
  /** Messages generated during this step */
1695
1858
  newMessages: Message[];
1696
- /** Tool call made during this step, if any */
1697
- toolCall?: ToolCall;
1698
- /** Result of the tool call, if any */
1699
- toolResult?: ToolResult;
1859
+ /** Tool calls made during this step, if any */
1860
+ toolCalls?: ToolCall[];
1861
+ /** Results of the tool calls, if any */
1862
+ toolResults?: ToolResult[];
1863
+ /** Tool calls waiting to be processed (sorted: MCP → Delegate → Interactive) */
1864
+ pendingToolCalls?: ToolCall[];
1865
+ /** Partial tool results collected so far (used during mixed tool call processing) */
1866
+ partialToolResults?: ToolResult[];
1700
1867
  /** Token usage for this step */
1701
1868
  usage: Usage;
1702
1869
  /** Unix timestamp (ms) when step started */
@@ -1771,6 +1938,11 @@ declare const stepSchema: z.ZodObject<{
1771
1938
  type: z.ZodLiteral<"imageInlinePart">;
1772
1939
  encodedData: z.ZodString;
1773
1940
  mimeType: z.ZodString;
1941
+ }, z.core.$strip>, z.ZodObject<{
1942
+ id: z.ZodString;
1943
+ type: z.ZodLiteral<"fileInlinePart">;
1944
+ encodedData: z.ZodString;
1945
+ mimeType: z.ZodString;
1774
1946
  }, z.core.$strip>]>>;
1775
1947
  isError: z.ZodOptional<z.ZodBoolean>;
1776
1948
  }, z.core.$strip>>;
@@ -1856,18 +2028,23 @@ declare const stepSchema: z.ZodObject<{
1856
2028
  type: z.ZodLiteral<"imageInlinePart">;
1857
2029
  encodedData: z.ZodString;
1858
2030
  mimeType: z.ZodString;
2031
+ }, z.core.$strip>, z.ZodObject<{
2032
+ id: z.ZodString;
2033
+ type: z.ZodLiteral<"fileInlinePart">;
2034
+ encodedData: z.ZodString;
2035
+ mimeType: z.ZodString;
1859
2036
  }, z.core.$strip>]>>;
1860
2037
  isError: z.ZodOptional<z.ZodBoolean>;
1861
2038
  }, z.core.$strip>>;
1862
2039
  cache: z.ZodOptional<z.ZodBoolean>;
1863
2040
  }, z.core.$strip>]>>;
1864
- toolCall: z.ZodOptional<z.ZodObject<{
2041
+ toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
1865
2042
  id: z.ZodString;
1866
2043
  skillName: z.ZodString;
1867
2044
  toolName: z.ZodString;
1868
2045
  args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1869
- }, z.core.$strip>>;
1870
- toolResult: z.ZodOptional<z.ZodObject<{
2046
+ }, z.core.$strip>>>;
2047
+ toolResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
1871
2048
  id: z.ZodString;
1872
2049
  skillName: z.ZodString;
1873
2050
  toolName: z.ZodString;
@@ -1925,10 +2102,88 @@ declare const stepSchema: z.ZodObject<{
1925
2102
  type: z.ZodLiteral<"imageInlinePart">;
1926
2103
  encodedData: z.ZodString;
1927
2104
  mimeType: z.ZodString;
2105
+ }, z.core.$strip>, z.ZodObject<{
2106
+ id: z.ZodString;
2107
+ type: z.ZodLiteral<"fileInlinePart">;
2108
+ encodedData: z.ZodString;
2109
+ mimeType: z.ZodString;
1928
2110
  }, z.core.$strip>]>>;
1929
2111
  isError: z.ZodOptional<z.ZodBoolean>;
1930
2112
  }, z.core.$strip>], "type">>;
1931
- }, z.core.$strip>>;
2113
+ }, z.core.$strip>>>;
2114
+ pendingToolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
2115
+ id: z.ZodString;
2116
+ skillName: z.ZodString;
2117
+ toolName: z.ZodString;
2118
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2119
+ }, z.core.$strip>>>;
2120
+ partialToolResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
2121
+ id: z.ZodString;
2122
+ skillName: z.ZodString;
2123
+ toolName: z.ZodString;
2124
+ result: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2125
+ id: z.ZodString;
2126
+ type: z.ZodLiteral<"textPart">;
2127
+ text: z.ZodString;
2128
+ }, z.core.$strip>, z.ZodObject<{
2129
+ id: z.ZodString;
2130
+ type: z.ZodLiteral<"imageUrlPart">;
2131
+ url: z.ZodURL;
2132
+ mimeType: z.ZodString;
2133
+ }, z.core.$strip>, z.ZodObject<{
2134
+ id: z.ZodString;
2135
+ type: z.ZodLiteral<"imageInlinePart">;
2136
+ encodedData: z.ZodString;
2137
+ mimeType: z.ZodString;
2138
+ }, z.core.$strip>, z.ZodObject<{
2139
+ id: z.ZodString;
2140
+ type: z.ZodLiteral<"imageBinaryPart">;
2141
+ data: z.ZodString;
2142
+ mimeType: z.ZodString;
2143
+ }, z.core.$strip>, z.ZodObject<{
2144
+ id: z.ZodString;
2145
+ type: z.ZodLiteral<"fileUrlPart">;
2146
+ url: z.ZodString;
2147
+ mimeType: z.ZodString;
2148
+ }, z.core.$strip>, z.ZodObject<{
2149
+ id: z.ZodString;
2150
+ type: z.ZodLiteral<"fileInlinePart">;
2151
+ encodedData: z.ZodString;
2152
+ mimeType: z.ZodString;
2153
+ }, z.core.$strip>, z.ZodObject<{
2154
+ id: z.ZodString;
2155
+ type: z.ZodLiteral<"fileBinaryPart">;
2156
+ data: z.ZodString;
2157
+ mimeType: z.ZodString;
2158
+ }, z.core.$strip>, z.ZodObject<{
2159
+ id: z.ZodString;
2160
+ type: z.ZodLiteral<"toolCallPart">;
2161
+ toolCallId: z.ZodString;
2162
+ toolName: z.ZodString;
2163
+ args: z.ZodUnknown;
2164
+ }, z.core.$strip>, z.ZodObject<{
2165
+ id: z.ZodString;
2166
+ type: z.ZodLiteral<"toolResultPart">;
2167
+ toolCallId: z.ZodString;
2168
+ toolName: z.ZodString;
2169
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
2170
+ id: z.ZodString;
2171
+ type: z.ZodLiteral<"textPart">;
2172
+ text: z.ZodString;
2173
+ }, z.core.$strip>, z.ZodObject<{
2174
+ id: z.ZodString;
2175
+ type: z.ZodLiteral<"imageInlinePart">;
2176
+ encodedData: z.ZodString;
2177
+ mimeType: z.ZodString;
2178
+ }, z.core.$strip>, z.ZodObject<{
2179
+ id: z.ZodString;
2180
+ type: z.ZodLiteral<"fileInlinePart">;
2181
+ encodedData: z.ZodString;
2182
+ mimeType: z.ZodString;
2183
+ }, z.core.$strip>]>>;
2184
+ isError: z.ZodOptional<z.ZodBoolean>;
2185
+ }, z.core.$strip>], "type">>;
2186
+ }, z.core.$strip>>>;
1932
2187
  usage: z.ZodObject<{
1933
2188
  inputTokens: z.ZodNumber;
1934
2189
  outputTokens: z.ZodNumber;
@@ -1955,6 +2210,7 @@ interface RunInput {
1955
2210
  interactiveToolCallResult?: {
1956
2211
  toolCallId: string;
1957
2212
  toolName: string;
2213
+ skillName: string;
1958
2214
  text: string;
1959
2215
  };
1960
2216
  }
@@ -1964,6 +2220,8 @@ interface RunSetting {
1964
2220
  model: string;
1965
2221
  /** Provider configuration */
1966
2222
  providerConfig: ProviderConfig;
2223
+ /** Job ID this run belongs to */
2224
+ jobId: string;
1967
2225
  /** Unique run identifier */
1968
2226
  runId: string;
1969
2227
  /** Expert key to run */
@@ -1974,7 +2232,7 @@ interface RunSetting {
1974
2232
  experts: Record<string, Expert>;
1975
2233
  /** Temperature for generation (0-1) */
1976
2234
  temperature: number;
1977
- /** Maximum steps before stopping */
2235
+ /** Maximum steps before stopping (applies to Job's totalSteps) */
1978
2236
  maxSteps?: number;
1979
2237
  /** Maximum retries on generation failure */
1980
2238
  maxRetries: number;
@@ -2015,6 +2273,7 @@ type RunParamsInput = {
2015
2273
  setting: {
2016
2274
  model: string;
2017
2275
  providerConfig: ProviderConfig;
2276
+ jobId?: string;
2018
2277
  runId?: string;
2019
2278
  expertKey: string;
2020
2279
  input: RunInput;
@@ -2082,6 +2341,7 @@ declare const runSettingSchema: z.ZodObject<{
2082
2341
  baseUrl: z.ZodOptional<z.ZodString>;
2083
2342
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2084
2343
  }, z.core.$strip>], "providerName">;
2344
+ jobId: z.ZodString;
2085
2345
  runId: z.ZodString;
2086
2346
  expertKey: z.ZodString;
2087
2347
  input: z.ZodObject<{
@@ -2089,6 +2349,7 @@ declare const runSettingSchema: z.ZodObject<{
2089
2349
  interactiveToolCallResult: z.ZodOptional<z.ZodObject<{
2090
2350
  toolCallId: z.ZodString;
2091
2351
  toolName: z.ZodString;
2352
+ skillName: z.ZodString;
2092
2353
  text: z.ZodString;
2093
2354
  }, z.core.$strip>>;
2094
2355
  }, z.core.$strip>;
@@ -2262,6 +2523,7 @@ declare const runParamsSchema: z.ZodObject<{
2262
2523
  baseUrl: z.ZodOptional<z.ZodString>;
2263
2524
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2264
2525
  }, z.core.$strip>], "providerName">;
2526
+ jobId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2265
2527
  runId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2266
2528
  expertKey: z.ZodString;
2267
2529
  input: z.ZodObject<{
@@ -2269,6 +2531,7 @@ declare const runParamsSchema: z.ZodObject<{
2269
2531
  interactiveToolCallResult: z.ZodOptional<z.ZodObject<{
2270
2532
  toolCallId: z.ZodString;
2271
2533
  toolName: z.ZodString;
2534
+ skillName: z.ZodString;
2272
2535
  text: z.ZodString;
2273
2536
  }, z.core.$strip>>;
2274
2537
  }, z.core.$strip>;
@@ -2479,6 +2742,7 @@ declare const runParamsSchema: z.ZodObject<{
2479
2742
  }, z.core.$strip>;
2480
2743
  checkpoint: z.ZodOptional<z.ZodObject<{
2481
2744
  id: z.ZodString;
2745
+ jobId: z.ZodString;
2482
2746
  runId: z.ZodString;
2483
2747
  status: z.ZodEnum<{
2484
2748
  init: "init";
@@ -2570,6 +2834,11 @@ declare const runParamsSchema: z.ZodObject<{
2570
2834
  type: z.ZodLiteral<"imageInlinePart">;
2571
2835
  encodedData: z.ZodString;
2572
2836
  mimeType: z.ZodString;
2837
+ }, z.core.$strip>, z.ZodObject<{
2838
+ id: z.ZodString;
2839
+ type: z.ZodLiteral<"fileInlinePart">;
2840
+ encodedData: z.ZodString;
2841
+ mimeType: z.ZodString;
2573
2842
  }, z.core.$strip>]>>;
2574
2843
  isError: z.ZodOptional<z.ZodBoolean>;
2575
2844
  }, z.core.$strip>>;
@@ -2580,7 +2849,7 @@ declare const runParamsSchema: z.ZodObject<{
2580
2849
  name: z.ZodString;
2581
2850
  version: z.ZodString;
2582
2851
  }, z.core.$strip>;
2583
- delegateTo: z.ZodOptional<z.ZodObject<{
2852
+ delegateTo: z.ZodOptional<z.ZodArray<z.ZodObject<{
2584
2853
  expert: z.ZodObject<{
2585
2854
  key: z.ZodString;
2586
2855
  name: z.ZodString;
@@ -2589,7 +2858,7 @@ declare const runParamsSchema: z.ZodObject<{
2589
2858
  toolCallId: z.ZodString;
2590
2859
  toolName: z.ZodString;
2591
2860
  query: z.ZodString;
2592
- }, z.core.$strip>>;
2861
+ }, z.core.$strip>>>;
2593
2862
  delegatedBy: z.ZodOptional<z.ZodObject<{
2594
2863
  expert: z.ZodObject<{
2595
2864
  key: z.ZodString;
@@ -2609,6 +2878,79 @@ declare const runParamsSchema: z.ZodObject<{
2609
2878
  }, z.core.$strip>;
2610
2879
  contextWindow: z.ZodOptional<z.ZodNumber>;
2611
2880
  contextWindowUsage: z.ZodOptional<z.ZodNumber>;
2881
+ pendingToolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
2882
+ id: z.ZodString;
2883
+ skillName: z.ZodString;
2884
+ toolName: z.ZodString;
2885
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2886
+ }, z.core.$strip>>>;
2887
+ partialToolResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
2888
+ id: z.ZodString;
2889
+ skillName: z.ZodString;
2890
+ toolName: z.ZodString;
2891
+ result: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2892
+ id: z.ZodString;
2893
+ type: z.ZodLiteral<"textPart">;
2894
+ text: z.ZodString;
2895
+ }, z.core.$strip>, z.ZodObject<{
2896
+ id: z.ZodString;
2897
+ type: z.ZodLiteral<"imageUrlPart">;
2898
+ url: z.ZodURL;
2899
+ mimeType: z.ZodString;
2900
+ }, z.core.$strip>, z.ZodObject<{
2901
+ id: z.ZodString;
2902
+ type: z.ZodLiteral<"imageInlinePart">;
2903
+ encodedData: z.ZodString;
2904
+ mimeType: z.ZodString;
2905
+ }, z.core.$strip>, z.ZodObject<{
2906
+ id: z.ZodString;
2907
+ type: z.ZodLiteral<"imageBinaryPart">;
2908
+ data: z.ZodString;
2909
+ mimeType: z.ZodString;
2910
+ }, z.core.$strip>, z.ZodObject<{
2911
+ id: z.ZodString;
2912
+ type: z.ZodLiteral<"fileUrlPart">;
2913
+ url: z.ZodString;
2914
+ mimeType: z.ZodString;
2915
+ }, z.core.$strip>, z.ZodObject<{
2916
+ id: z.ZodString;
2917
+ type: z.ZodLiteral<"fileInlinePart">;
2918
+ encodedData: z.ZodString;
2919
+ mimeType: z.ZodString;
2920
+ }, z.core.$strip>, z.ZodObject<{
2921
+ id: z.ZodString;
2922
+ type: z.ZodLiteral<"fileBinaryPart">;
2923
+ data: z.ZodString;
2924
+ mimeType: z.ZodString;
2925
+ }, z.core.$strip>, z.ZodObject<{
2926
+ id: z.ZodString;
2927
+ type: z.ZodLiteral<"toolCallPart">;
2928
+ toolCallId: z.ZodString;
2929
+ toolName: z.ZodString;
2930
+ args: z.ZodUnknown;
2931
+ }, z.core.$strip>, z.ZodObject<{
2932
+ id: z.ZodString;
2933
+ type: z.ZodLiteral<"toolResultPart">;
2934
+ toolCallId: z.ZodString;
2935
+ toolName: z.ZodString;
2936
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
2937
+ id: z.ZodString;
2938
+ type: z.ZodLiteral<"textPart">;
2939
+ text: z.ZodString;
2940
+ }, z.core.$strip>, z.ZodObject<{
2941
+ id: z.ZodString;
2942
+ type: z.ZodLiteral<"imageInlinePart">;
2943
+ encodedData: z.ZodString;
2944
+ mimeType: z.ZodString;
2945
+ }, z.core.$strip>, z.ZodObject<{
2946
+ id: z.ZodString;
2947
+ type: z.ZodLiteral<"fileInlinePart">;
2948
+ encodedData: z.ZodString;
2949
+ mimeType: z.ZodString;
2950
+ }, z.core.$strip>]>>;
2951
+ isError: z.ZodOptional<z.ZodBoolean>;
2952
+ }, z.core.$strip>], "type">>;
2953
+ }, z.core.$strip>>>;
2612
2954
  }, z.core.$strip>>;
2613
2955
  }, z.core.$strip>;
2614
2956
  /**
@@ -2626,13 +2968,13 @@ type ExpertEventPayloads = {
2626
2968
  retry: {
2627
2969
  reason: string;
2628
2970
  newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
2629
- toolCall?: ToolCall;
2630
- toolResult?: ToolResult;
2971
+ toolCalls?: ToolCall[];
2972
+ toolResults?: ToolResult[];
2631
2973
  usage: Usage;
2632
2974
  };
2633
- callTool: {
2975
+ callTools: {
2634
2976
  newMessage: ExpertMessage;
2635
- toolCall: ToolCall;
2977
+ toolCalls: ToolCall[];
2636
2978
  usage: Usage;
2637
2979
  };
2638
2980
  callInteractiveTool: {
@@ -2642,27 +2984,28 @@ type ExpertEventPayloads = {
2642
2984
  };
2643
2985
  callDelegate: {
2644
2986
  newMessage: ExpertMessage;
2645
- toolCall: ToolCall;
2987
+ toolCalls: ToolCall[];
2646
2988
  usage: Usage;
2647
2989
  };
2648
- resolveToolResult: {
2649
- toolResult: ToolResult;
2990
+ resolveToolResults: {
2991
+ toolResults: ToolResult[];
2650
2992
  };
2651
2993
  resolveThought: {
2652
2994
  toolResult: ToolResult;
2653
2995
  };
2654
- resolvePdfFile: {
2655
- toolResult: ToolResult;
2656
- };
2657
- resolveImageFile: {
2658
- toolResult: ToolResult;
2659
- };
2660
2996
  attemptCompletion: {
2661
2997
  toolResult: ToolResult;
2662
2998
  };
2663
2999
  finishToolCall: {
2664
3000
  newMessages: (UserMessage | ToolMessage)[];
2665
3001
  };
3002
+ resumeToolCalls: {
3003
+ pendingToolCalls: ToolCall[];
3004
+ partialToolResults: ToolResult[];
3005
+ };
3006
+ finishAllToolCalls: {
3007
+ newMessages: (UserMessage | ToolMessage)[];
3008
+ };
2666
3009
  continueToNextStep: {
2667
3010
  checkpoint: Checkpoint;
2668
3011
  step: Step;
@@ -2695,6 +3038,8 @@ interface BaseEvent {
2695
3038
  expertKey: string;
2696
3039
  /** Unix timestamp when event was emitted */
2697
3040
  timestamp: number;
3041
+ /** Job ID this event belongs to */
3042
+ jobId: string;
2698
3043
  /** Run ID this event belongs to */
2699
3044
  runId: string;
2700
3045
  /** Step number when event was emitted */
@@ -2713,13 +3058,13 @@ type EventForType<T extends EventType> = Extract<RunEvent, {
2713
3058
  type: T;
2714
3059
  }>;
2715
3060
  /** Factory function to create typed events */
2716
- declare function createEvent<T extends EventType>(type: T): (setting: RunSetting, checkpoint: Checkpoint, data: Omit<EventForType<T>, "type" | "id" | "expertKey" | "timestamp" | "runId" | "stepNumber">) => EventForType<T>;
3061
+ declare function createEvent<T extends EventType>(type: T): (setting: RunSetting, checkpoint: Checkpoint, data: Omit<EventForType<T>, "type" | "id" | "expertKey" | "timestamp" | "jobId" | "runId" | "stepNumber">) => EventForType<T>;
2717
3062
  declare const startRun: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
2718
3063
  type: "startRun";
2719
3064
  } & {
2720
3065
  initialCheckpoint: Checkpoint;
2721
3066
  inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
2722
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3067
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2723
3068
  type: "startRun";
2724
3069
  } & {
2725
3070
  initialCheckpoint: Checkpoint;
@@ -2729,7 +3074,7 @@ declare const startGeneration: (setting: RunSetting, checkpoint: Checkpoint, dat
2729
3074
  type: "startGeneration";
2730
3075
  } & {
2731
3076
  messages: Message[];
2732
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3077
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2733
3078
  type: "startGeneration";
2734
3079
  } & {
2735
3080
  messages: Message[];
@@ -2739,29 +3084,29 @@ declare const retry: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<Ba
2739
3084
  } & {
2740
3085
  reason: string;
2741
3086
  newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
2742
- toolCall?: ToolCall;
2743
- toolResult?: ToolResult;
3087
+ toolCalls?: ToolCall[];
3088
+ toolResults?: ToolResult[];
2744
3089
  usage: Usage;
2745
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3090
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2746
3091
  type: "retry";
2747
3092
  } & {
2748
3093
  reason: string;
2749
3094
  newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
2750
- toolCall?: ToolCall;
2751
- toolResult?: ToolResult;
3095
+ toolCalls?: ToolCall[];
3096
+ toolResults?: ToolResult[];
2752
3097
  usage: Usage;
2753
3098
  };
2754
- declare const callTool: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
2755
- type: "callTool";
3099
+ declare const callTools: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
3100
+ type: "callTools";
2756
3101
  } & {
2757
3102
  newMessage: ExpertMessage;
2758
- toolCall: ToolCall;
3103
+ toolCalls: ToolCall[];
2759
3104
  usage: Usage;
2760
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2761
- type: "callTool";
3105
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3106
+ type: "callTools";
2762
3107
  } & {
2763
3108
  newMessage: ExpertMessage;
2764
- toolCall: ToolCall;
3109
+ toolCalls: ToolCall[];
2765
3110
  usage: Usage;
2766
3111
  };
2767
3112
  declare const callInteractiveTool: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
@@ -2770,7 +3115,7 @@ declare const callInteractiveTool: (setting: RunSetting, checkpoint: Checkpoint,
2770
3115
  newMessage: ExpertMessage;
2771
3116
  toolCall: ToolCall;
2772
3117
  usage: Usage;
2773
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3118
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2774
3119
  type: "callInteractiveTool";
2775
3120
  } & {
2776
3121
  newMessage: ExpertMessage;
@@ -2781,56 +3126,38 @@ declare const callDelegate: (setting: RunSetting, checkpoint: Checkpoint, data:
2781
3126
  type: "callDelegate";
2782
3127
  } & {
2783
3128
  newMessage: ExpertMessage;
2784
- toolCall: ToolCall;
3129
+ toolCalls: ToolCall[];
2785
3130
  usage: Usage;
2786
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3131
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2787
3132
  type: "callDelegate";
2788
3133
  } & {
2789
3134
  newMessage: ExpertMessage;
2790
- toolCall: ToolCall;
3135
+ toolCalls: ToolCall[];
2791
3136
  usage: Usage;
2792
3137
  };
2793
- declare const resolveToolResult: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
2794
- type: "resolveToolResult";
3138
+ declare const resolveToolResults: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
3139
+ type: "resolveToolResults";
2795
3140
  } & {
2796
- toolResult: ToolResult;
2797
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2798
- type: "resolveToolResult";
3141
+ toolResults: ToolResult[];
3142
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3143
+ type: "resolveToolResults";
2799
3144
  } & {
2800
- toolResult: ToolResult;
3145
+ toolResults: ToolResult[];
2801
3146
  };
2802
3147
  declare const resolveThought: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
2803
3148
  type: "resolveThought";
2804
3149
  } & {
2805
3150
  toolResult: ToolResult;
2806
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3151
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2807
3152
  type: "resolveThought";
2808
3153
  } & {
2809
3154
  toolResult: ToolResult;
2810
3155
  };
2811
- declare const resolvePdfFile: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
2812
- type: "resolvePdfFile";
2813
- } & {
2814
- toolResult: ToolResult;
2815
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2816
- type: "resolvePdfFile";
2817
- } & {
2818
- toolResult: ToolResult;
2819
- };
2820
- declare const resolveImageFile: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
2821
- type: "resolveImageFile";
2822
- } & {
2823
- toolResult: ToolResult;
2824
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2825
- type: "resolveImageFile";
2826
- } & {
2827
- toolResult: ToolResult;
2828
- };
2829
3156
  declare const attemptCompletion: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
2830
3157
  type: "attemptCompletion";
2831
3158
  } & {
2832
3159
  toolResult: ToolResult;
2833
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3160
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2834
3161
  type: "attemptCompletion";
2835
3162
  } & {
2836
3163
  toolResult: ToolResult;
@@ -2839,11 +3166,31 @@ declare const finishToolCall: (setting: RunSetting, checkpoint: Checkpoint, data
2839
3166
  type: "finishToolCall";
2840
3167
  } & {
2841
3168
  newMessages: (UserMessage | ToolMessage)[];
2842
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3169
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2843
3170
  type: "finishToolCall";
2844
3171
  } & {
2845
3172
  newMessages: (UserMessage | ToolMessage)[];
2846
3173
  };
3174
+ declare const resumeToolCalls: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
3175
+ type: "resumeToolCalls";
3176
+ } & {
3177
+ pendingToolCalls: ToolCall[];
3178
+ partialToolResults: ToolResult[];
3179
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3180
+ type: "resumeToolCalls";
3181
+ } & {
3182
+ pendingToolCalls: ToolCall[];
3183
+ partialToolResults: ToolResult[];
3184
+ };
3185
+ declare const finishAllToolCalls: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
3186
+ type: "finishAllToolCalls";
3187
+ } & {
3188
+ newMessages: (UserMessage | ToolMessage)[];
3189
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3190
+ type: "finishAllToolCalls";
3191
+ } & {
3192
+ newMessages: (UserMessage | ToolMessage)[];
3193
+ };
2847
3194
  declare const completeRun: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
2848
3195
  type: "completeRun";
2849
3196
  } & {
@@ -2851,7 +3198,7 @@ declare const completeRun: (setting: RunSetting, checkpoint: Checkpoint, data: O
2851
3198
  step: Step;
2852
3199
  text: string;
2853
3200
  usage: Usage;
2854
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3201
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2855
3202
  type: "completeRun";
2856
3203
  } & {
2857
3204
  checkpoint: Checkpoint;
@@ -2864,7 +3211,7 @@ declare const stopRunByInteractiveTool: (setting: RunSetting, checkpoint: Checkp
2864
3211
  } & {
2865
3212
  checkpoint: Checkpoint;
2866
3213
  step: Step;
2867
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3214
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2868
3215
  type: "stopRunByInteractiveTool";
2869
3216
  } & {
2870
3217
  checkpoint: Checkpoint;
@@ -2875,7 +3222,7 @@ declare const stopRunByDelegate: (setting: RunSetting, checkpoint: Checkpoint, d
2875
3222
  } & {
2876
3223
  checkpoint: Checkpoint;
2877
3224
  step: Step;
2878
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3225
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2879
3226
  type: "stopRunByDelegate";
2880
3227
  } & {
2881
3228
  checkpoint: Checkpoint;
@@ -2886,7 +3233,7 @@ declare const stopRunByExceededMaxSteps: (setting: RunSetting, checkpoint: Check
2886
3233
  } & {
2887
3234
  checkpoint: Checkpoint;
2888
3235
  step: Step;
2889
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3236
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2890
3237
  type: "stopRunByExceededMaxSteps";
2891
3238
  } & {
2892
3239
  checkpoint: Checkpoint;
@@ -2898,7 +3245,7 @@ declare const continueToNextStep: (setting: RunSetting, checkpoint: Checkpoint,
2898
3245
  checkpoint: Checkpoint;
2899
3246
  step: Step;
2900
3247
  nextCheckpoint: Checkpoint;
2901
- }, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
3248
+ }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
2902
3249
  type: "continueToNextStep";
2903
3250
  } & {
2904
3251
  checkpoint: Checkpoint;
@@ -2911,6 +3258,8 @@ interface BaseRuntimeEvent {
2911
3258
  id: string;
2912
3259
  /** Unix timestamp */
2913
3260
  timestamp: number;
3261
+ /** Job ID */
3262
+ jobId: string;
2914
3263
  /** Run ID */
2915
3264
  runId: string;
2916
3265
  }
@@ -2967,7 +3316,7 @@ type RuntimeEventForType<T extends RuntimeEventType> = Extract<RuntimeEvent, {
2967
3316
  type: T;
2968
3317
  }>;
2969
3318
  /** Factory function to create runtime events */
2970
- declare function createRuntimeEvent<T extends RuntimeEventType>(type: T, runId: string, data: Omit<RuntimeEventForType<T>, "type" | "id" | "timestamp" | "runId">): RuntimeEventForType<T>;
3319
+ declare function createRuntimeEvent<T extends RuntimeEventType>(type: T, jobId: string, runId: string, data: Omit<RuntimeEventForType<T>, "type" | "id" | "timestamp" | "jobId" | "runId">): RuntimeEventForType<T>;
2971
3320
 
2972
3321
  /** Discriminator for skill manager types */
2973
3322
  type SkillType = "mcp" | "interactive" | "delegate";
@@ -3034,4 +3383,4 @@ type Resource = {
3034
3383
  declare function formatZodError(error: ZodError): string;
3035
3384
  declare function parseWithFriendlyError<T>(schema: ZodSchema<T>, data: unknown, context?: string): T;
3036
3385
 
3037
- export { type AmazonBedrockProviderConfig, type AnthropicProviderConfig, type AzureOpenAiProviderConfig, type BaseEvent, type BasePart, type CallToolResultContent, type Checkpoint, type CheckpointStatus, type CommandOptions, type DeepseekProviderConfig, type DelegateSkillManagerParams, type EventForType, type EventType, type Expert, type ExpertMessage, type FileBinaryPart, type FileInlinePart, type FileUrlPart, type GoogleGenerativeAiProviderConfig, type GoogleVertexProviderConfig, type Headers, type ImageBinaryPart, type ImageInlinePart, type ImageUrlPart, type InstructionMessage, type InteractiveSkill, type InteractiveSkillManagerParams, type InteractiveTool, type McpSkillManagerParams, type McpSseSkill, type McpStdioSkill, type Message, type MessagePart, type OllamaProviderConfig, type OpenAiProviderConfig, type PerstackConfig, type PerstackConfigExpert, type PerstackConfigSkill, type ProviderConfig, type ProviderName, type ProviderTable, type Resource, type RunCommandInput, type RunEvent, type RunInput, type RunParams, type RunParamsInput, type RunSetting, type RuntimeEvent, type RuntimeEventForType, type RuntimeEventType, type Skill, type SkillManagerParams, type SkillType, type StartCommandInput, type Step, type TextPart, type ToolCall, type ToolCallPart, type ToolDefinition, type ToolMessage, type ToolResult, type ToolResultPart, type Usage, type UserMessage, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, attemptCompletion, azureOpenAiProviderConfigSchema, basePartSchema, callDelegate, callInteractiveTool, callTool, checkpointSchema, checkpointStatusSchema, completeRun, continueToNextStep, createEvent, createRuntimeEvent, deepseekProviderConfigSchema, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultTemperature, defaultTimeout, envNameRegex, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileUrlPartSchema, finishToolCall, formatZodError, googleGenerativeAiProviderConfigSchema, googleVertexProviderConfigSchema, headersSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolSchema, knownModels, maxApplicationNameLength, maxCheckpointToolCallIdLength, maxEnvNameLength, maxExpertDelegateItems, maxExpertDescriptionLength, maxExpertInstructionLength, maxExpertJobFileNameLength, maxExpertJobQueryLength, maxExpertKeyLength, maxExpertNameLength, maxExpertSkillItems, maxExpertTagItems, maxExpertVersionTagLength, maxOrganizationNameLength, maxSkillDescriptionLength, maxSkillEndpointLength, maxSkillInputJsonSchemaLength, maxSkillNameLength, maxSkillPickOmitItems, maxSkillRequiredEnvItems, maxSkillRuleLength, maxSkillToolItems, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, organizationNameRegex, packageWithVersionRegex, parseExpertKey, parseWithFriendlyError, perstackConfigSchema, providerConfigSchema, providerNameSchema, providerTableSchema, resolveImageFile, resolvePdfFile, resolveThought, resolveToolResult, retry, runCommandInputSchema, runParamsSchema, runSettingSchema, skillSchema, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, urlSafeRegex, usageSchema, userMessageSchema };
3386
+ export { type AmazonBedrockProviderConfig, type AnthropicProviderConfig, type AzureOpenAiProviderConfig, type BaseEvent, type BasePart, type CallToolResultContent, type Checkpoint, type CheckpointStatus, type CommandOptions, type DeepseekProviderConfig, type DelegateSkillManagerParams, type DelegationTarget, type EventForType, type EventType, type Expert, type ExpertMessage, type FileBinaryPart, type FileInlinePart, type FileUrlPart, type GoogleGenerativeAiProviderConfig, type GoogleVertexProviderConfig, type Headers, type ImageBinaryPart, type ImageInlinePart, type ImageUrlPart, type InstructionMessage, type InteractiveSkill, type InteractiveSkillManagerParams, type InteractiveTool, type Job, type JobStatus, type McpSkillManagerParams, type McpSseSkill, type McpStdioSkill, type Message, type MessagePart, type OllamaProviderConfig, type OpenAiProviderConfig, type PerstackConfig, type PerstackConfigExpert, type PerstackConfigSkill, type ProviderConfig, type ProviderName, type ProviderTable, type Resource, type RunCommandInput, type RunEvent, type RunInput, type RunParams, type RunParamsInput, type RunSetting, type RuntimeEvent, type RuntimeEventForType, type RuntimeEventType, type Skill, type SkillManagerParams, type SkillType, type StartCommandInput, type Step, type TextPart, type ToolCall, type ToolCallPart, type ToolDefinition, type ToolMessage, type ToolResult, type ToolResultPart, type Usage, type UserMessage, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, attemptCompletion, azureOpenAiProviderConfigSchema, basePartSchema, callDelegate, callInteractiveTool, callTools, checkpointSchema, checkpointStatusSchema, completeRun, continueToNextStep, createEvent, createRuntimeEvent, deepseekProviderConfigSchema, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultTemperature, defaultTimeout, delegationTargetSchema, envNameRegex, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileUrlPartSchema, finishAllToolCalls, finishToolCall, formatZodError, googleGenerativeAiProviderConfigSchema, googleVertexProviderConfigSchema, headersSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolSchema, jobSchema, jobStatusSchema, knownModels, maxApplicationNameLength, maxCheckpointToolCallIdLength, maxEnvNameLength, maxExpertDelegateItems, maxExpertDescriptionLength, maxExpertInstructionLength, maxExpertJobFileNameLength, maxExpertJobQueryLength, maxExpertKeyLength, maxExpertNameLength, maxExpertSkillItems, maxExpertTagItems, maxExpertVersionTagLength, maxOrganizationNameLength, maxSkillDescriptionLength, maxSkillEndpointLength, maxSkillInputJsonSchemaLength, maxSkillNameLength, maxSkillPickOmitItems, maxSkillRequiredEnvItems, maxSkillRuleLength, maxSkillToolItems, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, organizationNameRegex, packageWithVersionRegex, parseExpertKey, parseWithFriendlyError, perstackConfigSchema, providerConfigSchema, providerNameSchema, providerTableSchema, resolveThought, resolveToolResults, resumeToolCalls, retry, runCommandInputSchema, runParamsSchema, runSettingSchema, skillSchema, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, urlSafeRegex, usageSchema, userMessageSchema };