@openai/agents-core 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.js +3 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +1 -0
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/memory/memorySession.d.ts +22 -0
  7. package/dist/memory/memorySession.js +64 -0
  8. package/dist/memory/memorySession.js.map +1 -0
  9. package/dist/memory/memorySession.mjs +60 -0
  10. package/dist/memory/memorySession.mjs.map +1 -0
  11. package/dist/memory/session.d.ts +36 -0
  12. package/dist/memory/session.js +3 -0
  13. package/dist/memory/session.js.map +1 -0
  14. package/dist/memory/session.mjs +2 -0
  15. package/dist/memory/session.mjs.map +1 -0
  16. package/dist/metadata.js +2 -2
  17. package/dist/metadata.mjs +2 -2
  18. package/dist/run.d.ts +88 -8
  19. package/dist/run.js +859 -347
  20. package/dist/run.js.map +1 -1
  21. package/dist/run.mjs +859 -347
  22. package/dist/run.mjs.map +1 -1
  23. package/dist/runImplementation.d.ts +21 -2
  24. package/dist/runImplementation.js +885 -346
  25. package/dist/runImplementation.js.map +1 -1
  26. package/dist/runImplementation.mjs +877 -344
  27. package/dist/runImplementation.mjs.map +1 -1
  28. package/dist/runState.d.ts +1360 -226
  29. package/dist/runState.js +16 -0
  30. package/dist/runState.js.map +1 -1
  31. package/dist/runState.mjs +16 -0
  32. package/dist/runState.mjs.map +1 -1
  33. package/dist/types/protocol.d.ts +1869 -193
  34. package/dist/types/protocol.js +1 -0
  35. package/dist/types/protocol.js.map +1 -1
  36. package/dist/types/protocol.mjs +1 -0
  37. package/dist/types/protocol.mjs.map +1 -1
  38. package/dist/utils/smartString.d.ts +9 -0
  39. package/dist/utils/smartString.js +15 -0
  40. package/dist/utils/smartString.js.map +1 -1
  41. package/dist/utils/smartString.mjs +14 -3
  42. package/dist/utils/smartString.mjs.map +1 -1
  43. package/package.json +1 -1
@@ -1515,167 +1515,364 @@ export declare const SerializedRunState: z.ZodObject<{
1515
1515
  providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1516
1516
  } & {
1517
1517
  id: z.ZodOptional<z.ZodString>;
1518
- type: z.ZodLiteral<"reasoning">;
1519
- content: z.ZodArray<z.ZodObject<{
1518
+ } & {
1519
+ type: z.ZodLiteral<"function_call_result">;
1520
+ name: z.ZodString;
1521
+ callId: z.ZodString;
1522
+ status: z.ZodEnum<["in_progress", "completed", "incomplete"]>;
1523
+ output: z.ZodUnion<[z.ZodString, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1520
1524
  providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1521
1525
  } & {
1522
- type: z.ZodLiteral<"input_text">;
1526
+ type: z.ZodLiteral<"text">;
1523
1527
  text: z.ZodString;
1524
1528
  }, "strip", z.ZodTypeAny, {
1525
- type: "input_text";
1529
+ type: "text";
1526
1530
  text: string;
1527
1531
  providerData?: Record<string, any> | undefined;
1528
1532
  }, {
1529
- type: "input_text";
1533
+ type: "text";
1530
1534
  text: string;
1531
1535
  providerData?: Record<string, any> | undefined;
1532
- }>, "many">;
1533
- rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
1536
+ }>, z.ZodObject<{
1534
1537
  providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1535
1538
  } & {
1536
- type: z.ZodLiteral<"reasoning_text">;
1537
- text: z.ZodString;
1539
+ type: z.ZodLiteral<"image">;
1540
+ image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodObject<{
1541
+ data: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>;
1542
+ mediaType: z.ZodOptional<z.ZodString>;
1543
+ }, "strip", z.ZodTypeAny, {
1544
+ data: string | Uint8Array<ArrayBuffer>;
1545
+ mediaType?: string | undefined;
1546
+ }, {
1547
+ data: string | Uint8Array<ArrayBuffer>;
1548
+ mediaType?: string | undefined;
1549
+ }>, z.ZodObject<{
1550
+ url: z.ZodString;
1551
+ }, "strip", z.ZodTypeAny, {
1552
+ url: string;
1553
+ }, {
1554
+ url: string;
1555
+ }>, z.ZodObject<{
1556
+ fileId: z.ZodString;
1557
+ }, "strip", z.ZodTypeAny, {
1558
+ fileId: string;
1559
+ }, {
1560
+ fileId: string;
1561
+ }>]>]>>;
1562
+ detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), z.ZodTypeDef, "low" | "high" | "auto" | (string & {})>>;
1538
1563
  }, "strip", z.ZodTypeAny, {
1539
- type: "reasoning_text";
1540
- text: string;
1564
+ type: "image";
1541
1565
  providerData?: Record<string, any> | undefined;
1566
+ image?: string | {
1567
+ data: string | Uint8Array<ArrayBuffer>;
1568
+ mediaType?: string | undefined;
1569
+ } | {
1570
+ url: string;
1571
+ } | {
1572
+ fileId: string;
1573
+ } | undefined;
1574
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
1542
1575
  }, {
1543
- type: "reasoning_text";
1544
- text: string;
1576
+ type: "image";
1545
1577
  providerData?: Record<string, any> | undefined;
1546
- }>, "many">>;
1547
- }, "strip", z.ZodTypeAny, {
1548
- type: "reasoning";
1549
- content: {
1550
- type: "input_text";
1551
- text: string;
1578
+ image?: string | {
1579
+ data: string | Uint8Array<ArrayBuffer>;
1580
+ mediaType?: string | undefined;
1581
+ } | {
1582
+ url: string;
1583
+ } | {
1584
+ fileId: string;
1585
+ } | undefined;
1586
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
1587
+ }>, z.ZodObject<{
1588
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1589
+ } & {
1590
+ type: z.ZodLiteral<"file">;
1591
+ file: z.ZodUnion<[z.ZodString, z.ZodObject<{
1592
+ data: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>;
1593
+ mediaType: z.ZodString;
1594
+ filename: z.ZodString;
1595
+ }, "strip", z.ZodTypeAny, {
1596
+ filename: string;
1597
+ data: string | Uint8Array<ArrayBuffer>;
1598
+ mediaType: string;
1599
+ }, {
1600
+ filename: string;
1601
+ data: string | Uint8Array<ArrayBuffer>;
1602
+ mediaType: string;
1603
+ }>, z.ZodObject<{
1604
+ url: z.ZodString;
1605
+ filename: z.ZodOptional<z.ZodString>;
1606
+ }, "strip", z.ZodTypeAny, {
1607
+ url: string;
1608
+ filename?: string | undefined;
1609
+ }, {
1610
+ url: string;
1611
+ filename?: string | undefined;
1612
+ }>, z.ZodObject<{
1613
+ id: z.ZodString;
1614
+ filename: z.ZodOptional<z.ZodString>;
1615
+ }, "strip", z.ZodTypeAny, {
1616
+ id: string;
1617
+ filename?: string | undefined;
1618
+ }, {
1619
+ id: string;
1620
+ filename?: string | undefined;
1621
+ }>]>;
1622
+ }, "strip", z.ZodTypeAny, {
1623
+ type: "file";
1624
+ file: string | {
1625
+ filename: string;
1626
+ data: string | Uint8Array<ArrayBuffer>;
1627
+ mediaType: string;
1628
+ } | {
1629
+ url: string;
1630
+ filename?: string | undefined;
1631
+ } | {
1632
+ id: string;
1633
+ filename?: string | undefined;
1634
+ };
1552
1635
  providerData?: Record<string, any> | undefined;
1553
- }[];
1554
- providerData?: Record<string, any> | undefined;
1555
- id?: string | undefined;
1556
- rawContent?: {
1557
- type: "reasoning_text";
1558
- text: string;
1636
+ }, {
1637
+ type: "file";
1638
+ file: string | {
1639
+ filename: string;
1640
+ data: string | Uint8Array<ArrayBuffer>;
1641
+ mediaType: string;
1642
+ } | {
1643
+ url: string;
1644
+ filename?: string | undefined;
1645
+ } | {
1646
+ id: string;
1647
+ filename?: string | undefined;
1648
+ };
1559
1649
  providerData?: Record<string, any> | undefined;
1560
- }[] | undefined;
1561
- }, {
1562
- type: "reasoning";
1563
- content: {
1650
+ }>]>, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1651
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1652
+ } & {
1653
+ type: z.ZodLiteral<"input_text">;
1654
+ text: z.ZodString;
1655
+ }, "strip", z.ZodTypeAny, {
1564
1656
  type: "input_text";
1565
1657
  text: string;
1566
1658
  providerData?: Record<string, any> | undefined;
1567
- }[];
1568
- providerData?: Record<string, any> | undefined;
1569
- id?: string | undefined;
1570
- rawContent?: {
1571
- type: "reasoning_text";
1659
+ }, {
1660
+ type: "input_text";
1572
1661
  text: string;
1573
1662
  providerData?: Record<string, any> | undefined;
1574
- }[] | undefined;
1575
- }>, z.ZodObject<{
1576
- providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1577
- } & {
1578
- id: z.ZodOptional<z.ZodString>;
1579
- } & {
1580
- type: z.ZodLiteral<"unknown">;
1663
+ }>, z.ZodObject<{
1664
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1665
+ } & {
1666
+ type: z.ZodLiteral<"input_image">;
1667
+ image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
1668
+ id: z.ZodString;
1669
+ }, "strip", z.ZodTypeAny, {
1670
+ id: string;
1671
+ }, {
1672
+ id: string;
1673
+ }>]>>;
1674
+ detail: z.ZodOptional<z.ZodString>;
1675
+ }, "strip", z.ZodTypeAny, {
1676
+ type: "input_image";
1677
+ providerData?: Record<string, any> | undefined;
1678
+ image?: string | {
1679
+ id: string;
1680
+ } | undefined;
1681
+ detail?: string | undefined;
1682
+ }, {
1683
+ type: "input_image";
1684
+ providerData?: Record<string, any> | undefined;
1685
+ image?: string | {
1686
+ id: string;
1687
+ } | undefined;
1688
+ detail?: string | undefined;
1689
+ }>, z.ZodObject<{
1690
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1691
+ } & {
1692
+ type: z.ZodLiteral<"input_file">;
1693
+ file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
1694
+ id: z.ZodString;
1695
+ }, "strip", z.ZodTypeAny, {
1696
+ id: string;
1697
+ }, {
1698
+ id: string;
1699
+ }>]>, z.ZodObject<{
1700
+ url: z.ZodString;
1701
+ }, "strip", z.ZodTypeAny, {
1702
+ url: string;
1703
+ }, {
1704
+ url: string;
1705
+ }>]>>;
1706
+ filename: z.ZodOptional<z.ZodString>;
1707
+ }, "strip", z.ZodTypeAny, {
1708
+ type: "input_file";
1709
+ providerData?: Record<string, any> | undefined;
1710
+ file?: string | {
1711
+ id: string;
1712
+ } | {
1713
+ url: string;
1714
+ } | undefined;
1715
+ filename?: string | undefined;
1716
+ }, {
1717
+ type: "input_file";
1718
+ providerData?: Record<string, any> | undefined;
1719
+ file?: string | {
1720
+ id: string;
1721
+ } | {
1722
+ url: string;
1723
+ } | undefined;
1724
+ filename?: string | undefined;
1725
+ }>]>, "many">]>;
1581
1726
  }, "strip", z.ZodTypeAny, {
1582
- type: "unknown";
1583
- providerData?: Record<string, any> | undefined;
1584
- id?: string | undefined;
1585
- }, {
1586
- type: "unknown";
1587
- providerData?: Record<string, any> | undefined;
1588
- id?: string | undefined;
1589
- }>]>, "many">;
1590
- responseId: z.ZodOptional<z.ZodString>;
1591
- providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1592
- }, "strip", z.ZodTypeAny, {
1593
- output: ({
1727
+ type: "function_call_result";
1594
1728
  status: "in_progress" | "completed" | "incomplete";
1595
- role: "assistant";
1596
- content: ({
1597
- type: "refusal";
1598
- refusal: string;
1599
- providerData?: Record<string, any> | undefined;
1600
- } | {
1601
- type: "output_text";
1729
+ name: string;
1730
+ output: string | {
1731
+ type: "text";
1602
1732
  text: string;
1603
1733
  providerData?: Record<string, any> | undefined;
1604
1734
  } | {
1605
- type: "audio";
1606
- audio: string | {
1607
- id: string;
1608
- };
1735
+ type: "image";
1609
1736
  providerData?: Record<string, any> | undefined;
1610
- format?: string | null | undefined;
1611
- transcript?: string | null | undefined;
1737
+ image?: string | {
1738
+ data: string | Uint8Array<ArrayBuffer>;
1739
+ mediaType?: string | undefined;
1740
+ } | {
1741
+ url: string;
1742
+ } | {
1743
+ fileId: string;
1744
+ } | undefined;
1745
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
1612
1746
  } | {
1613
- type: "image";
1614
- image: string;
1747
+ type: "file";
1748
+ file: string | {
1749
+ filename: string;
1750
+ data: string | Uint8Array<ArrayBuffer>;
1751
+ mediaType: string;
1752
+ } | {
1753
+ url: string;
1754
+ filename?: string | undefined;
1755
+ } | {
1756
+ id: string;
1757
+ filename?: string | undefined;
1758
+ };
1759
+ providerData?: Record<string, any> | undefined;
1760
+ } | ({
1761
+ type: "input_text";
1762
+ text: string;
1763
+ providerData?: Record<string, any> | undefined;
1764
+ } | {
1765
+ type: "input_image";
1766
+ providerData?: Record<string, any> | undefined;
1767
+ image?: string | {
1768
+ id: string;
1769
+ } | undefined;
1770
+ detail?: string | undefined;
1771
+ } | {
1772
+ type: "input_file";
1615
1773
  providerData?: Record<string, any> | undefined;
1774
+ file?: string | {
1775
+ id: string;
1776
+ } | {
1777
+ url: string;
1778
+ } | undefined;
1779
+ filename?: string | undefined;
1616
1780
  })[];
1617
- type?: "message" | undefined;
1618
- providerData?: Record<string, any> | undefined;
1619
- id?: string | undefined;
1620
- } | {
1621
- type: "hosted_tool_call";
1622
- name: string;
1623
- status?: string | undefined;
1624
- providerData?: Record<string, any> | undefined;
1625
- id?: string | undefined;
1626
- arguments?: string | undefined;
1627
- output?: string | undefined;
1628
- } | {
1629
- type: "function_call";
1630
- name: string;
1631
- arguments: string;
1632
1781
  callId: string;
1633
- status?: "in_progress" | "completed" | "incomplete" | undefined;
1634
1782
  providerData?: Record<string, any> | undefined;
1635
1783
  id?: string | undefined;
1636
- } | {
1637
- type: "computer_call";
1784
+ }, {
1785
+ type: "function_call_result";
1638
1786
  status: "in_progress" | "completed" | "incomplete";
1639
- callId: string;
1640
- action: {
1641
- type: "screenshot";
1642
- } | {
1643
- type: "click";
1644
- x: number;
1645
- y: number;
1646
- button: "left" | "right" | "wheel" | "back" | "forward";
1647
- } | {
1648
- type: "double_click";
1649
- x: number;
1650
- y: number;
1651
- } | {
1652
- type: "scroll";
1653
- x: number;
1654
- y: number;
1655
- scroll_x: number;
1656
- scroll_y: number;
1657
- } | {
1658
- type: "type";
1787
+ name: string;
1788
+ output: string | {
1789
+ type: "text";
1659
1790
  text: string;
1791
+ providerData?: Record<string, any> | undefined;
1660
1792
  } | {
1661
- type: "wait";
1793
+ type: "image";
1794
+ providerData?: Record<string, any> | undefined;
1795
+ image?: string | {
1796
+ data: string | Uint8Array<ArrayBuffer>;
1797
+ mediaType?: string | undefined;
1798
+ } | {
1799
+ url: string;
1800
+ } | {
1801
+ fileId: string;
1802
+ } | undefined;
1803
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
1662
1804
  } | {
1663
- type: "move";
1664
- x: number;
1665
- y: number;
1805
+ type: "file";
1806
+ file: string | {
1807
+ filename: string;
1808
+ data: string | Uint8Array<ArrayBuffer>;
1809
+ mediaType: string;
1810
+ } | {
1811
+ url: string;
1812
+ filename?: string | undefined;
1813
+ } | {
1814
+ id: string;
1815
+ filename?: string | undefined;
1816
+ };
1817
+ providerData?: Record<string, any> | undefined;
1818
+ } | ({
1819
+ type: "input_text";
1820
+ text: string;
1821
+ providerData?: Record<string, any> | undefined;
1666
1822
  } | {
1667
- keys: string[];
1668
- type: "keypress";
1823
+ type: "input_image";
1824
+ providerData?: Record<string, any> | undefined;
1825
+ image?: string | {
1826
+ id: string;
1827
+ } | undefined;
1828
+ detail?: string | undefined;
1669
1829
  } | {
1670
- path: {
1671
- x: number;
1672
- y: number;
1673
- }[];
1674
- type: "drag";
1675
- };
1830
+ type: "input_file";
1831
+ providerData?: Record<string, any> | undefined;
1832
+ file?: string | {
1833
+ id: string;
1834
+ } | {
1835
+ url: string;
1836
+ } | undefined;
1837
+ filename?: string | undefined;
1838
+ })[];
1839
+ callId: string;
1676
1840
  providerData?: Record<string, any> | undefined;
1677
1841
  id?: string | undefined;
1678
- } | {
1842
+ }>, z.ZodObject<{
1843
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1844
+ } & {
1845
+ id: z.ZodOptional<z.ZodString>;
1846
+ type: z.ZodLiteral<"reasoning">;
1847
+ content: z.ZodArray<z.ZodObject<{
1848
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1849
+ } & {
1850
+ type: z.ZodLiteral<"input_text">;
1851
+ text: z.ZodString;
1852
+ }, "strip", z.ZodTypeAny, {
1853
+ type: "input_text";
1854
+ text: string;
1855
+ providerData?: Record<string, any> | undefined;
1856
+ }, {
1857
+ type: "input_text";
1858
+ text: string;
1859
+ providerData?: Record<string, any> | undefined;
1860
+ }>, "many">;
1861
+ rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
1862
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1863
+ } & {
1864
+ type: z.ZodLiteral<"reasoning_text">;
1865
+ text: z.ZodString;
1866
+ }, "strip", z.ZodTypeAny, {
1867
+ type: "reasoning_text";
1868
+ text: string;
1869
+ providerData?: Record<string, any> | undefined;
1870
+ }, {
1871
+ type: "reasoning_text";
1872
+ text: string;
1873
+ providerData?: Record<string, any> | undefined;
1874
+ }>, "many">>;
1875
+ }, "strip", z.ZodTypeAny, {
1679
1876
  type: "reasoning";
1680
1877
  content: {
1681
1878
  type: "input_text";
@@ -1689,20 +1886,38 @@ export declare const SerializedRunState: z.ZodObject<{
1689
1886
  text: string;
1690
1887
  providerData?: Record<string, any> | undefined;
1691
1888
  }[] | undefined;
1692
- } | {
1889
+ }, {
1890
+ type: "reasoning";
1891
+ content: {
1892
+ type: "input_text";
1893
+ text: string;
1894
+ providerData?: Record<string, any> | undefined;
1895
+ }[];
1896
+ providerData?: Record<string, any> | undefined;
1897
+ id?: string | undefined;
1898
+ rawContent?: {
1899
+ type: "reasoning_text";
1900
+ text: string;
1901
+ providerData?: Record<string, any> | undefined;
1902
+ }[] | undefined;
1903
+ }>, z.ZodObject<{
1904
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1905
+ } & {
1906
+ id: z.ZodOptional<z.ZodString>;
1907
+ } & {
1908
+ type: z.ZodLiteral<"unknown">;
1909
+ }, "strip", z.ZodTypeAny, {
1693
1910
  type: "unknown";
1694
1911
  providerData?: Record<string, any> | undefined;
1695
1912
  id?: string | undefined;
1696
- })[];
1697
- usage: {
1698
- requests: number;
1699
- inputTokens: number;
1700
- outputTokens: number;
1701
- totalTokens: number;
1702
- };
1703
- providerData?: Record<string, any> | undefined;
1704
- responseId?: string | undefined;
1705
- }, {
1913
+ }, {
1914
+ type: "unknown";
1915
+ providerData?: Record<string, any> | undefined;
1916
+ id?: string | undefined;
1917
+ }>]>, "many">;
1918
+ responseId: z.ZodOptional<z.ZodString>;
1919
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1920
+ }, "strip", z.ZodTypeAny, {
1706
1921
  output: ({
1707
1922
  status: "in_progress" | "completed" | "incomplete";
1708
1923
  role: "assistant";
@@ -1747,41 +1962,270 @@ export declare const SerializedRunState: z.ZodObject<{
1747
1962
  providerData?: Record<string, any> | undefined;
1748
1963
  id?: string | undefined;
1749
1964
  } | {
1750
- type: "computer_call";
1965
+ type: "function_call_result";
1751
1966
  status: "in_progress" | "completed" | "incomplete";
1752
- callId: string;
1753
- action: {
1754
- type: "screenshot";
1755
- } | {
1756
- type: "click";
1757
- x: number;
1758
- y: number;
1759
- button: "left" | "right" | "wheel" | "back" | "forward";
1760
- } | {
1761
- type: "double_click";
1762
- x: number;
1763
- y: number;
1764
- } | {
1765
- type: "scroll";
1766
- x: number;
1767
- y: number;
1768
- scroll_x: number;
1769
- scroll_y: number;
1770
- } | {
1771
- type: "type";
1967
+ name: string;
1968
+ output: string | {
1969
+ type: "text";
1772
1970
  text: string;
1971
+ providerData?: Record<string, any> | undefined;
1773
1972
  } | {
1774
- type: "wait";
1775
- } | {
1776
- type: "move";
1777
- x: number;
1778
- y: number;
1779
- } | {
1780
- keys: string[];
1781
- type: "keypress";
1782
- } | {
1783
- path: {
1784
- x: number;
1973
+ type: "image";
1974
+ providerData?: Record<string, any> | undefined;
1975
+ image?: string | {
1976
+ data: string | Uint8Array<ArrayBuffer>;
1977
+ mediaType?: string | undefined;
1978
+ } | {
1979
+ url: string;
1980
+ } | {
1981
+ fileId: string;
1982
+ } | undefined;
1983
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
1984
+ } | {
1985
+ type: "file";
1986
+ file: string | {
1987
+ filename: string;
1988
+ data: string | Uint8Array<ArrayBuffer>;
1989
+ mediaType: string;
1990
+ } | {
1991
+ url: string;
1992
+ filename?: string | undefined;
1993
+ } | {
1994
+ id: string;
1995
+ filename?: string | undefined;
1996
+ };
1997
+ providerData?: Record<string, any> | undefined;
1998
+ } | ({
1999
+ type: "input_text";
2000
+ text: string;
2001
+ providerData?: Record<string, any> | undefined;
2002
+ } | {
2003
+ type: "input_image";
2004
+ providerData?: Record<string, any> | undefined;
2005
+ image?: string | {
2006
+ id: string;
2007
+ } | undefined;
2008
+ detail?: string | undefined;
2009
+ } | {
2010
+ type: "input_file";
2011
+ providerData?: Record<string, any> | undefined;
2012
+ file?: string | {
2013
+ id: string;
2014
+ } | {
2015
+ url: string;
2016
+ } | undefined;
2017
+ filename?: string | undefined;
2018
+ })[];
2019
+ callId: string;
2020
+ providerData?: Record<string, any> | undefined;
2021
+ id?: string | undefined;
2022
+ } | {
2023
+ type: "computer_call";
2024
+ status: "in_progress" | "completed" | "incomplete";
2025
+ callId: string;
2026
+ action: {
2027
+ type: "screenshot";
2028
+ } | {
2029
+ type: "click";
2030
+ x: number;
2031
+ y: number;
2032
+ button: "left" | "right" | "wheel" | "back" | "forward";
2033
+ } | {
2034
+ type: "double_click";
2035
+ x: number;
2036
+ y: number;
2037
+ } | {
2038
+ type: "scroll";
2039
+ x: number;
2040
+ y: number;
2041
+ scroll_x: number;
2042
+ scroll_y: number;
2043
+ } | {
2044
+ type: "type";
2045
+ text: string;
2046
+ } | {
2047
+ type: "wait";
2048
+ } | {
2049
+ type: "move";
2050
+ x: number;
2051
+ y: number;
2052
+ } | {
2053
+ keys: string[];
2054
+ type: "keypress";
2055
+ } | {
2056
+ path: {
2057
+ x: number;
2058
+ y: number;
2059
+ }[];
2060
+ type: "drag";
2061
+ };
2062
+ providerData?: Record<string, any> | undefined;
2063
+ id?: string | undefined;
2064
+ } | {
2065
+ type: "reasoning";
2066
+ content: {
2067
+ type: "input_text";
2068
+ text: string;
2069
+ providerData?: Record<string, any> | undefined;
2070
+ }[];
2071
+ providerData?: Record<string, any> | undefined;
2072
+ id?: string | undefined;
2073
+ rawContent?: {
2074
+ type: "reasoning_text";
2075
+ text: string;
2076
+ providerData?: Record<string, any> | undefined;
2077
+ }[] | undefined;
2078
+ } | {
2079
+ type: "unknown";
2080
+ providerData?: Record<string, any> | undefined;
2081
+ id?: string | undefined;
2082
+ })[];
2083
+ usage: {
2084
+ requests: number;
2085
+ inputTokens: number;
2086
+ outputTokens: number;
2087
+ totalTokens: number;
2088
+ };
2089
+ providerData?: Record<string, any> | undefined;
2090
+ responseId?: string | undefined;
2091
+ }, {
2092
+ output: ({
2093
+ status: "in_progress" | "completed" | "incomplete";
2094
+ role: "assistant";
2095
+ content: ({
2096
+ type: "refusal";
2097
+ refusal: string;
2098
+ providerData?: Record<string, any> | undefined;
2099
+ } | {
2100
+ type: "output_text";
2101
+ text: string;
2102
+ providerData?: Record<string, any> | undefined;
2103
+ } | {
2104
+ type: "audio";
2105
+ audio: string | {
2106
+ id: string;
2107
+ };
2108
+ providerData?: Record<string, any> | undefined;
2109
+ format?: string | null | undefined;
2110
+ transcript?: string | null | undefined;
2111
+ } | {
2112
+ type: "image";
2113
+ image: string;
2114
+ providerData?: Record<string, any> | undefined;
2115
+ })[];
2116
+ type?: "message" | undefined;
2117
+ providerData?: Record<string, any> | undefined;
2118
+ id?: string | undefined;
2119
+ } | {
2120
+ type: "hosted_tool_call";
2121
+ name: string;
2122
+ status?: string | undefined;
2123
+ providerData?: Record<string, any> | undefined;
2124
+ id?: string | undefined;
2125
+ arguments?: string | undefined;
2126
+ output?: string | undefined;
2127
+ } | {
2128
+ type: "function_call";
2129
+ name: string;
2130
+ arguments: string;
2131
+ callId: string;
2132
+ status?: "in_progress" | "completed" | "incomplete" | undefined;
2133
+ providerData?: Record<string, any> | undefined;
2134
+ id?: string | undefined;
2135
+ } | {
2136
+ type: "function_call_result";
2137
+ status: "in_progress" | "completed" | "incomplete";
2138
+ name: string;
2139
+ output: string | {
2140
+ type: "text";
2141
+ text: string;
2142
+ providerData?: Record<string, any> | undefined;
2143
+ } | {
2144
+ type: "image";
2145
+ providerData?: Record<string, any> | undefined;
2146
+ image?: string | {
2147
+ data: string | Uint8Array<ArrayBuffer>;
2148
+ mediaType?: string | undefined;
2149
+ } | {
2150
+ url: string;
2151
+ } | {
2152
+ fileId: string;
2153
+ } | undefined;
2154
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
2155
+ } | {
2156
+ type: "file";
2157
+ file: string | {
2158
+ filename: string;
2159
+ data: string | Uint8Array<ArrayBuffer>;
2160
+ mediaType: string;
2161
+ } | {
2162
+ url: string;
2163
+ filename?: string | undefined;
2164
+ } | {
2165
+ id: string;
2166
+ filename?: string | undefined;
2167
+ };
2168
+ providerData?: Record<string, any> | undefined;
2169
+ } | ({
2170
+ type: "input_text";
2171
+ text: string;
2172
+ providerData?: Record<string, any> | undefined;
2173
+ } | {
2174
+ type: "input_image";
2175
+ providerData?: Record<string, any> | undefined;
2176
+ image?: string | {
2177
+ id: string;
2178
+ } | undefined;
2179
+ detail?: string | undefined;
2180
+ } | {
2181
+ type: "input_file";
2182
+ providerData?: Record<string, any> | undefined;
2183
+ file?: string | {
2184
+ id: string;
2185
+ } | {
2186
+ url: string;
2187
+ } | undefined;
2188
+ filename?: string | undefined;
2189
+ })[];
2190
+ callId: string;
2191
+ providerData?: Record<string, any> | undefined;
2192
+ id?: string | undefined;
2193
+ } | {
2194
+ type: "computer_call";
2195
+ status: "in_progress" | "completed" | "incomplete";
2196
+ callId: string;
2197
+ action: {
2198
+ type: "screenshot";
2199
+ } | {
2200
+ type: "click";
2201
+ x: number;
2202
+ y: number;
2203
+ button: "left" | "right" | "wheel" | "back" | "forward";
2204
+ } | {
2205
+ type: "double_click";
2206
+ x: number;
2207
+ y: number;
2208
+ } | {
2209
+ type: "scroll";
2210
+ x: number;
2211
+ y: number;
2212
+ scroll_x: number;
2213
+ scroll_y: number;
2214
+ } | {
2215
+ type: "type";
2216
+ text: string;
2217
+ } | {
2218
+ type: "wait";
2219
+ } | {
2220
+ type: "move";
2221
+ x: number;
2222
+ y: number;
2223
+ } | {
2224
+ keys: string[];
2225
+ type: "keypress";
2226
+ } | {
2227
+ path: {
2228
+ x: number;
1785
2229
  y: number;
1786
2230
  }[];
1787
2231
  type: "drag";
@@ -2346,66 +2790,394 @@ export declare const SerializedRunState: z.ZodObject<{
2346
2790
  scroll_x: number;
2347
2791
  scroll_y: number;
2348
2792
  } | {
2349
- type: "type";
2793
+ type: "type";
2794
+ text: string;
2795
+ } | {
2796
+ type: "wait";
2797
+ } | {
2798
+ type: "move";
2799
+ x: number;
2800
+ y: number;
2801
+ } | {
2802
+ keys: string[];
2803
+ type: "keypress";
2804
+ } | {
2805
+ path: {
2806
+ x: number;
2807
+ y: number;
2808
+ }[];
2809
+ type: "drag";
2810
+ };
2811
+ providerData?: Record<string, any> | undefined;
2812
+ id?: string | undefined;
2813
+ }, {
2814
+ type: "computer_call";
2815
+ status: "in_progress" | "completed" | "incomplete";
2816
+ callId: string;
2817
+ action: {
2818
+ type: "screenshot";
2819
+ } | {
2820
+ type: "click";
2821
+ x: number;
2822
+ y: number;
2823
+ button: "left" | "right" | "wheel" | "back" | "forward";
2824
+ } | {
2825
+ type: "double_click";
2826
+ x: number;
2827
+ y: number;
2828
+ } | {
2829
+ type: "scroll";
2830
+ x: number;
2831
+ y: number;
2832
+ scroll_x: number;
2833
+ scroll_y: number;
2834
+ } | {
2835
+ type: "type";
2836
+ text: string;
2837
+ } | {
2838
+ type: "wait";
2839
+ } | {
2840
+ type: "move";
2841
+ x: number;
2842
+ y: number;
2843
+ } | {
2844
+ keys: string[];
2845
+ type: "keypress";
2846
+ } | {
2847
+ path: {
2848
+ x: number;
2849
+ y: number;
2850
+ }[];
2851
+ type: "drag";
2852
+ };
2853
+ providerData?: Record<string, any> | undefined;
2854
+ id?: string | undefined;
2855
+ }>, z.ZodObject<{
2856
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2857
+ } & {
2858
+ id: z.ZodOptional<z.ZodString>;
2859
+ } & {
2860
+ type: z.ZodLiteral<"function_call_result">;
2861
+ name: z.ZodString;
2862
+ callId: z.ZodString;
2863
+ status: z.ZodEnum<["in_progress", "completed", "incomplete"]>;
2864
+ output: z.ZodUnion<[z.ZodString, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2865
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2866
+ } & {
2867
+ type: z.ZodLiteral<"text">;
2868
+ text: z.ZodString;
2869
+ }, "strip", z.ZodTypeAny, {
2870
+ type: "text";
2871
+ text: string;
2872
+ providerData?: Record<string, any> | undefined;
2873
+ }, {
2874
+ type: "text";
2875
+ text: string;
2876
+ providerData?: Record<string, any> | undefined;
2877
+ }>, z.ZodObject<{
2878
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2879
+ } & {
2880
+ type: z.ZodLiteral<"image">;
2881
+ image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodObject<{
2882
+ data: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>;
2883
+ mediaType: z.ZodOptional<z.ZodString>;
2884
+ }, "strip", z.ZodTypeAny, {
2885
+ data: string | Uint8Array<ArrayBuffer>;
2886
+ mediaType?: string | undefined;
2887
+ }, {
2888
+ data: string | Uint8Array<ArrayBuffer>;
2889
+ mediaType?: string | undefined;
2890
+ }>, z.ZodObject<{
2891
+ url: z.ZodString;
2892
+ }, "strip", z.ZodTypeAny, {
2893
+ url: string;
2894
+ }, {
2895
+ url: string;
2896
+ }>, z.ZodObject<{
2897
+ fileId: z.ZodString;
2898
+ }, "strip", z.ZodTypeAny, {
2899
+ fileId: string;
2900
+ }, {
2901
+ fileId: string;
2902
+ }>]>]>>;
2903
+ detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), z.ZodTypeDef, "low" | "high" | "auto" | (string & {})>>;
2904
+ }, "strip", z.ZodTypeAny, {
2905
+ type: "image";
2906
+ providerData?: Record<string, any> | undefined;
2907
+ image?: string | {
2908
+ data: string | Uint8Array<ArrayBuffer>;
2909
+ mediaType?: string | undefined;
2910
+ } | {
2911
+ url: string;
2912
+ } | {
2913
+ fileId: string;
2914
+ } | undefined;
2915
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
2916
+ }, {
2917
+ type: "image";
2918
+ providerData?: Record<string, any> | undefined;
2919
+ image?: string | {
2920
+ data: string | Uint8Array<ArrayBuffer>;
2921
+ mediaType?: string | undefined;
2922
+ } | {
2923
+ url: string;
2924
+ } | {
2925
+ fileId: string;
2926
+ } | undefined;
2927
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
2928
+ }>, z.ZodObject<{
2929
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2930
+ } & {
2931
+ type: z.ZodLiteral<"file">;
2932
+ file: z.ZodUnion<[z.ZodString, z.ZodObject<{
2933
+ data: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>;
2934
+ mediaType: z.ZodString;
2935
+ filename: z.ZodString;
2936
+ }, "strip", z.ZodTypeAny, {
2937
+ filename: string;
2938
+ data: string | Uint8Array<ArrayBuffer>;
2939
+ mediaType: string;
2940
+ }, {
2941
+ filename: string;
2942
+ data: string | Uint8Array<ArrayBuffer>;
2943
+ mediaType: string;
2944
+ }>, z.ZodObject<{
2945
+ url: z.ZodString;
2946
+ filename: z.ZodOptional<z.ZodString>;
2947
+ }, "strip", z.ZodTypeAny, {
2948
+ url: string;
2949
+ filename?: string | undefined;
2950
+ }, {
2951
+ url: string;
2952
+ filename?: string | undefined;
2953
+ }>, z.ZodObject<{
2954
+ id: z.ZodString;
2955
+ filename: z.ZodOptional<z.ZodString>;
2956
+ }, "strip", z.ZodTypeAny, {
2957
+ id: string;
2958
+ filename?: string | undefined;
2959
+ }, {
2960
+ id: string;
2961
+ filename?: string | undefined;
2962
+ }>]>;
2963
+ }, "strip", z.ZodTypeAny, {
2964
+ type: "file";
2965
+ file: string | {
2966
+ filename: string;
2967
+ data: string | Uint8Array<ArrayBuffer>;
2968
+ mediaType: string;
2969
+ } | {
2970
+ url: string;
2971
+ filename?: string | undefined;
2972
+ } | {
2973
+ id: string;
2974
+ filename?: string | undefined;
2975
+ };
2976
+ providerData?: Record<string, any> | undefined;
2977
+ }, {
2978
+ type: "file";
2979
+ file: string | {
2980
+ filename: string;
2981
+ data: string | Uint8Array<ArrayBuffer>;
2982
+ mediaType: string;
2983
+ } | {
2984
+ url: string;
2985
+ filename?: string | undefined;
2986
+ } | {
2987
+ id: string;
2988
+ filename?: string | undefined;
2989
+ };
2990
+ providerData?: Record<string, any> | undefined;
2991
+ }>]>, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2992
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2993
+ } & {
2994
+ type: z.ZodLiteral<"input_text">;
2995
+ text: z.ZodString;
2996
+ }, "strip", z.ZodTypeAny, {
2997
+ type: "input_text";
2998
+ text: string;
2999
+ providerData?: Record<string, any> | undefined;
3000
+ }, {
3001
+ type: "input_text";
3002
+ text: string;
3003
+ providerData?: Record<string, any> | undefined;
3004
+ }>, z.ZodObject<{
3005
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
3006
+ } & {
3007
+ type: z.ZodLiteral<"input_image">;
3008
+ image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
3009
+ id: z.ZodString;
3010
+ }, "strip", z.ZodTypeAny, {
3011
+ id: string;
3012
+ }, {
3013
+ id: string;
3014
+ }>]>>;
3015
+ detail: z.ZodOptional<z.ZodString>;
3016
+ }, "strip", z.ZodTypeAny, {
3017
+ type: "input_image";
3018
+ providerData?: Record<string, any> | undefined;
3019
+ image?: string | {
3020
+ id: string;
3021
+ } | undefined;
3022
+ detail?: string | undefined;
3023
+ }, {
3024
+ type: "input_image";
3025
+ providerData?: Record<string, any> | undefined;
3026
+ image?: string | {
3027
+ id: string;
3028
+ } | undefined;
3029
+ detail?: string | undefined;
3030
+ }>, z.ZodObject<{
3031
+ providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
3032
+ } & {
3033
+ type: z.ZodLiteral<"input_file">;
3034
+ file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
3035
+ id: z.ZodString;
3036
+ }, "strip", z.ZodTypeAny, {
3037
+ id: string;
3038
+ }, {
3039
+ id: string;
3040
+ }>]>, z.ZodObject<{
3041
+ url: z.ZodString;
3042
+ }, "strip", z.ZodTypeAny, {
3043
+ url: string;
3044
+ }, {
3045
+ url: string;
3046
+ }>]>>;
3047
+ filename: z.ZodOptional<z.ZodString>;
3048
+ }, "strip", z.ZodTypeAny, {
3049
+ type: "input_file";
3050
+ providerData?: Record<string, any> | undefined;
3051
+ file?: string | {
3052
+ id: string;
3053
+ } | {
3054
+ url: string;
3055
+ } | undefined;
3056
+ filename?: string | undefined;
3057
+ }, {
3058
+ type: "input_file";
3059
+ providerData?: Record<string, any> | undefined;
3060
+ file?: string | {
3061
+ id: string;
3062
+ } | {
3063
+ url: string;
3064
+ } | undefined;
3065
+ filename?: string | undefined;
3066
+ }>]>, "many">]>;
3067
+ }, "strip", z.ZodTypeAny, {
3068
+ type: "function_call_result";
3069
+ status: "in_progress" | "completed" | "incomplete";
3070
+ name: string;
3071
+ output: string | {
3072
+ type: "text";
3073
+ text: string;
3074
+ providerData?: Record<string, any> | undefined;
3075
+ } | {
3076
+ type: "image";
3077
+ providerData?: Record<string, any> | undefined;
3078
+ image?: string | {
3079
+ data: string | Uint8Array<ArrayBuffer>;
3080
+ mediaType?: string | undefined;
3081
+ } | {
3082
+ url: string;
3083
+ } | {
3084
+ fileId: string;
3085
+ } | undefined;
3086
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
3087
+ } | {
3088
+ type: "file";
3089
+ file: string | {
3090
+ filename: string;
3091
+ data: string | Uint8Array<ArrayBuffer>;
3092
+ mediaType: string;
3093
+ } | {
3094
+ url: string;
3095
+ filename?: string | undefined;
3096
+ } | {
3097
+ id: string;
3098
+ filename?: string | undefined;
3099
+ };
3100
+ providerData?: Record<string, any> | undefined;
3101
+ } | ({
3102
+ type: "input_text";
2350
3103
  text: string;
3104
+ providerData?: Record<string, any> | undefined;
2351
3105
  } | {
2352
- type: "wait";
2353
- } | {
2354
- type: "move";
2355
- x: number;
2356
- y: number;
2357
- } | {
2358
- keys: string[];
2359
- type: "keypress";
3106
+ type: "input_image";
3107
+ providerData?: Record<string, any> | undefined;
3108
+ image?: string | {
3109
+ id: string;
3110
+ } | undefined;
3111
+ detail?: string | undefined;
2360
3112
  } | {
2361
- path: {
2362
- x: number;
2363
- y: number;
2364
- }[];
2365
- type: "drag";
2366
- };
3113
+ type: "input_file";
3114
+ providerData?: Record<string, any> | undefined;
3115
+ file?: string | {
3116
+ id: string;
3117
+ } | {
3118
+ url: string;
3119
+ } | undefined;
3120
+ filename?: string | undefined;
3121
+ })[];
3122
+ callId: string;
2367
3123
  providerData?: Record<string, any> | undefined;
2368
3124
  id?: string | undefined;
2369
3125
  }, {
2370
- type: "computer_call";
3126
+ type: "function_call_result";
2371
3127
  status: "in_progress" | "completed" | "incomplete";
2372
- callId: string;
2373
- action: {
2374
- type: "screenshot";
2375
- } | {
2376
- type: "click";
2377
- x: number;
2378
- y: number;
2379
- button: "left" | "right" | "wheel" | "back" | "forward";
2380
- } | {
2381
- type: "double_click";
2382
- x: number;
2383
- y: number;
2384
- } | {
2385
- type: "scroll";
2386
- x: number;
2387
- y: number;
2388
- scroll_x: number;
2389
- scroll_y: number;
2390
- } | {
2391
- type: "type";
3128
+ name: string;
3129
+ output: string | {
3130
+ type: "text";
2392
3131
  text: string;
3132
+ providerData?: Record<string, any> | undefined;
2393
3133
  } | {
2394
- type: "wait";
3134
+ type: "image";
3135
+ providerData?: Record<string, any> | undefined;
3136
+ image?: string | {
3137
+ data: string | Uint8Array<ArrayBuffer>;
3138
+ mediaType?: string | undefined;
3139
+ } | {
3140
+ url: string;
3141
+ } | {
3142
+ fileId: string;
3143
+ } | undefined;
3144
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
2395
3145
  } | {
2396
- type: "move";
2397
- x: number;
2398
- y: number;
3146
+ type: "file";
3147
+ file: string | {
3148
+ filename: string;
3149
+ data: string | Uint8Array<ArrayBuffer>;
3150
+ mediaType: string;
3151
+ } | {
3152
+ url: string;
3153
+ filename?: string | undefined;
3154
+ } | {
3155
+ id: string;
3156
+ filename?: string | undefined;
3157
+ };
3158
+ providerData?: Record<string, any> | undefined;
3159
+ } | ({
3160
+ type: "input_text";
3161
+ text: string;
3162
+ providerData?: Record<string, any> | undefined;
2399
3163
  } | {
2400
- keys: string[];
2401
- type: "keypress";
3164
+ type: "input_image";
3165
+ providerData?: Record<string, any> | undefined;
3166
+ image?: string | {
3167
+ id: string;
3168
+ } | undefined;
3169
+ detail?: string | undefined;
2402
3170
  } | {
2403
- path: {
2404
- x: number;
2405
- y: number;
2406
- }[];
2407
- type: "drag";
2408
- };
3171
+ type: "input_file";
3172
+ providerData?: Record<string, any> | undefined;
3173
+ file?: string | {
3174
+ id: string;
3175
+ } | {
3176
+ url: string;
3177
+ } | undefined;
3178
+ filename?: string | undefined;
3179
+ })[];
3180
+ callId: string;
2409
3181
  providerData?: Record<string, any> | undefined;
2410
3182
  id?: string | undefined;
2411
3183
  }>, z.ZodObject<{
@@ -2530,6 +3302,64 @@ export declare const SerializedRunState: z.ZodObject<{
2530
3302
  status?: "in_progress" | "completed" | "incomplete" | undefined;
2531
3303
  providerData?: Record<string, any> | undefined;
2532
3304
  id?: string | undefined;
3305
+ } | {
3306
+ type: "function_call_result";
3307
+ status: "in_progress" | "completed" | "incomplete";
3308
+ name: string;
3309
+ output: string | {
3310
+ type: "text";
3311
+ text: string;
3312
+ providerData?: Record<string, any> | undefined;
3313
+ } | {
3314
+ type: "image";
3315
+ providerData?: Record<string, any> | undefined;
3316
+ image?: string | {
3317
+ data: string | Uint8Array<ArrayBuffer>;
3318
+ mediaType?: string | undefined;
3319
+ } | {
3320
+ url: string;
3321
+ } | {
3322
+ fileId: string;
3323
+ } | undefined;
3324
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
3325
+ } | {
3326
+ type: "file";
3327
+ file: string | {
3328
+ filename: string;
3329
+ data: string | Uint8Array<ArrayBuffer>;
3330
+ mediaType: string;
3331
+ } | {
3332
+ url: string;
3333
+ filename?: string | undefined;
3334
+ } | {
3335
+ id: string;
3336
+ filename?: string | undefined;
3337
+ };
3338
+ providerData?: Record<string, any> | undefined;
3339
+ } | ({
3340
+ type: "input_text";
3341
+ text: string;
3342
+ providerData?: Record<string, any> | undefined;
3343
+ } | {
3344
+ type: "input_image";
3345
+ providerData?: Record<string, any> | undefined;
3346
+ image?: string | {
3347
+ id: string;
3348
+ } | undefined;
3349
+ detail?: string | undefined;
3350
+ } | {
3351
+ type: "input_file";
3352
+ providerData?: Record<string, any> | undefined;
3353
+ file?: string | {
3354
+ id: string;
3355
+ } | {
3356
+ url: string;
3357
+ } | undefined;
3358
+ filename?: string | undefined;
3359
+ })[];
3360
+ callId: string;
3361
+ providerData?: Record<string, any> | undefined;
3362
+ id?: string | undefined;
2533
3363
  } | {
2534
3364
  type: "computer_call";
2535
3365
  status: "in_progress" | "completed" | "incomplete";
@@ -2624,23 +3454,81 @@ export declare const SerializedRunState: z.ZodObject<{
2624
3454
  image: string;
2625
3455
  providerData?: Record<string, any> | undefined;
2626
3456
  })[];
2627
- type?: "message" | undefined;
2628
- providerData?: Record<string, any> | undefined;
2629
- id?: string | undefined;
2630
- } | {
2631
- type: "hosted_tool_call";
2632
- name: string;
2633
- status?: string | undefined;
2634
- providerData?: Record<string, any> | undefined;
2635
- id?: string | undefined;
2636
- arguments?: string | undefined;
2637
- output?: string | undefined;
2638
- } | {
2639
- type: "function_call";
2640
- name: string;
2641
- arguments: string;
3457
+ type?: "message" | undefined;
3458
+ providerData?: Record<string, any> | undefined;
3459
+ id?: string | undefined;
3460
+ } | {
3461
+ type: "hosted_tool_call";
3462
+ name: string;
3463
+ status?: string | undefined;
3464
+ providerData?: Record<string, any> | undefined;
3465
+ id?: string | undefined;
3466
+ arguments?: string | undefined;
3467
+ output?: string | undefined;
3468
+ } | {
3469
+ type: "function_call";
3470
+ name: string;
3471
+ arguments: string;
3472
+ callId: string;
3473
+ status?: "in_progress" | "completed" | "incomplete" | undefined;
3474
+ providerData?: Record<string, any> | undefined;
3475
+ id?: string | undefined;
3476
+ } | {
3477
+ type: "function_call_result";
3478
+ status: "in_progress" | "completed" | "incomplete";
3479
+ name: string;
3480
+ output: string | {
3481
+ type: "text";
3482
+ text: string;
3483
+ providerData?: Record<string, any> | undefined;
3484
+ } | {
3485
+ type: "image";
3486
+ providerData?: Record<string, any> | undefined;
3487
+ image?: string | {
3488
+ data: string | Uint8Array<ArrayBuffer>;
3489
+ mediaType?: string | undefined;
3490
+ } | {
3491
+ url: string;
3492
+ } | {
3493
+ fileId: string;
3494
+ } | undefined;
3495
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
3496
+ } | {
3497
+ type: "file";
3498
+ file: string | {
3499
+ filename: string;
3500
+ data: string | Uint8Array<ArrayBuffer>;
3501
+ mediaType: string;
3502
+ } | {
3503
+ url: string;
3504
+ filename?: string | undefined;
3505
+ } | {
3506
+ id: string;
3507
+ filename?: string | undefined;
3508
+ };
3509
+ providerData?: Record<string, any> | undefined;
3510
+ } | ({
3511
+ type: "input_text";
3512
+ text: string;
3513
+ providerData?: Record<string, any> | undefined;
3514
+ } | {
3515
+ type: "input_image";
3516
+ providerData?: Record<string, any> | undefined;
3517
+ image?: string | {
3518
+ id: string;
3519
+ } | undefined;
3520
+ detail?: string | undefined;
3521
+ } | {
3522
+ type: "input_file";
3523
+ providerData?: Record<string, any> | undefined;
3524
+ file?: string | {
3525
+ id: string;
3526
+ } | {
3527
+ url: string;
3528
+ } | undefined;
3529
+ filename?: string | undefined;
3530
+ })[];
2642
3531
  callId: string;
2643
- status?: "in_progress" | "completed" | "incomplete" | undefined;
2644
3532
  providerData?: Record<string, any> | undefined;
2645
3533
  id?: string | undefined;
2646
3534
  } | {
@@ -7185,6 +8073,7 @@ export declare const SerializedRunState: z.ZodObject<{
7185
8073
  };
7186
8074
  }[] | undefined;
7187
8075
  }>>;
8076
+ currentTurnPersistedItemCount: z.ZodOptional<z.ZodNumber>;
7188
8077
  trace: z.ZodNullable<z.ZodObject<{
7189
8078
  object: z.ZodLiteral<"trace">;
7190
8079
  id: z.ZodString;
@@ -7466,6 +8355,64 @@ export declare const SerializedRunState: z.ZodObject<{
7466
8355
  status?: "in_progress" | "completed" | "incomplete" | undefined;
7467
8356
  providerData?: Record<string, any> | undefined;
7468
8357
  id?: string | undefined;
8358
+ } | {
8359
+ type: "function_call_result";
8360
+ status: "in_progress" | "completed" | "incomplete";
8361
+ name: string;
8362
+ output: string | {
8363
+ type: "text";
8364
+ text: string;
8365
+ providerData?: Record<string, any> | undefined;
8366
+ } | {
8367
+ type: "image";
8368
+ providerData?: Record<string, any> | undefined;
8369
+ image?: string | {
8370
+ data: string | Uint8Array<ArrayBuffer>;
8371
+ mediaType?: string | undefined;
8372
+ } | {
8373
+ url: string;
8374
+ } | {
8375
+ fileId: string;
8376
+ } | undefined;
8377
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
8378
+ } | {
8379
+ type: "file";
8380
+ file: string | {
8381
+ filename: string;
8382
+ data: string | Uint8Array<ArrayBuffer>;
8383
+ mediaType: string;
8384
+ } | {
8385
+ url: string;
8386
+ filename?: string | undefined;
8387
+ } | {
8388
+ id: string;
8389
+ filename?: string | undefined;
8390
+ };
8391
+ providerData?: Record<string, any> | undefined;
8392
+ } | ({
8393
+ type: "input_text";
8394
+ text: string;
8395
+ providerData?: Record<string, any> | undefined;
8396
+ } | {
8397
+ type: "input_image";
8398
+ providerData?: Record<string, any> | undefined;
8399
+ image?: string | {
8400
+ id: string;
8401
+ } | undefined;
8402
+ detail?: string | undefined;
8403
+ } | {
8404
+ type: "input_file";
8405
+ providerData?: Record<string, any> | undefined;
8406
+ file?: string | {
8407
+ id: string;
8408
+ } | {
8409
+ url: string;
8410
+ } | undefined;
8411
+ filename?: string | undefined;
8412
+ })[];
8413
+ callId: string;
8414
+ providerData?: Record<string, any> | undefined;
8415
+ id?: string | undefined;
7469
8416
  } | {
7470
8417
  type: "computer_call";
7471
8418
  status: "in_progress" | "completed" | "incomplete";
@@ -7926,6 +8873,64 @@ export declare const SerializedRunState: z.ZodObject<{
7926
8873
  status?: "in_progress" | "completed" | "incomplete" | undefined;
7927
8874
  providerData?: Record<string, any> | undefined;
7928
8875
  id?: string | undefined;
8876
+ } | {
8877
+ type: "function_call_result";
8878
+ status: "in_progress" | "completed" | "incomplete";
8879
+ name: string;
8880
+ output: string | {
8881
+ type: "text";
8882
+ text: string;
8883
+ providerData?: Record<string, any> | undefined;
8884
+ } | {
8885
+ type: "image";
8886
+ providerData?: Record<string, any> | undefined;
8887
+ image?: string | {
8888
+ data: string | Uint8Array<ArrayBuffer>;
8889
+ mediaType?: string | undefined;
8890
+ } | {
8891
+ url: string;
8892
+ } | {
8893
+ fileId: string;
8894
+ } | undefined;
8895
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
8896
+ } | {
8897
+ type: "file";
8898
+ file: string | {
8899
+ filename: string;
8900
+ data: string | Uint8Array<ArrayBuffer>;
8901
+ mediaType: string;
8902
+ } | {
8903
+ url: string;
8904
+ filename?: string | undefined;
8905
+ } | {
8906
+ id: string;
8907
+ filename?: string | undefined;
8908
+ };
8909
+ providerData?: Record<string, any> | undefined;
8910
+ } | ({
8911
+ type: "input_text";
8912
+ text: string;
8913
+ providerData?: Record<string, any> | undefined;
8914
+ } | {
8915
+ type: "input_image";
8916
+ providerData?: Record<string, any> | undefined;
8917
+ image?: string | {
8918
+ id: string;
8919
+ } | undefined;
8920
+ detail?: string | undefined;
8921
+ } | {
8922
+ type: "input_file";
8923
+ providerData?: Record<string, any> | undefined;
8924
+ file?: string | {
8925
+ id: string;
8926
+ } | {
8927
+ url: string;
8928
+ } | undefined;
8929
+ filename?: string | undefined;
8930
+ })[];
8931
+ callId: string;
8932
+ providerData?: Record<string, any> | undefined;
8933
+ id?: string | undefined;
7929
8934
  } | {
7930
8935
  type: "computer_call";
7931
8936
  status: "in_progress" | "completed" | "incomplete";
@@ -8314,6 +9319,7 @@ export declare const SerializedRunState: z.ZodObject<{
8314
9319
  };
8315
9320
  }[] | undefined;
8316
9321
  } | undefined;
9322
+ currentTurnPersistedItemCount?: number | undefined;
8317
9323
  }, {
8318
9324
  $schemaVersion: "1.0";
8319
9325
  currentTurn: number;
@@ -8576,6 +9582,64 @@ export declare const SerializedRunState: z.ZodObject<{
8576
9582
  status?: "in_progress" | "completed" | "incomplete" | undefined;
8577
9583
  providerData?: Record<string, any> | undefined;
8578
9584
  id?: string | undefined;
9585
+ } | {
9586
+ type: "function_call_result";
9587
+ status: "in_progress" | "completed" | "incomplete";
9588
+ name: string;
9589
+ output: string | {
9590
+ type: "text";
9591
+ text: string;
9592
+ providerData?: Record<string, any> | undefined;
9593
+ } | {
9594
+ type: "image";
9595
+ providerData?: Record<string, any> | undefined;
9596
+ image?: string | {
9597
+ data: string | Uint8Array<ArrayBuffer>;
9598
+ mediaType?: string | undefined;
9599
+ } | {
9600
+ url: string;
9601
+ } | {
9602
+ fileId: string;
9603
+ } | undefined;
9604
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
9605
+ } | {
9606
+ type: "file";
9607
+ file: string | {
9608
+ filename: string;
9609
+ data: string | Uint8Array<ArrayBuffer>;
9610
+ mediaType: string;
9611
+ } | {
9612
+ url: string;
9613
+ filename?: string | undefined;
9614
+ } | {
9615
+ id: string;
9616
+ filename?: string | undefined;
9617
+ };
9618
+ providerData?: Record<string, any> | undefined;
9619
+ } | ({
9620
+ type: "input_text";
9621
+ text: string;
9622
+ providerData?: Record<string, any> | undefined;
9623
+ } | {
9624
+ type: "input_image";
9625
+ providerData?: Record<string, any> | undefined;
9626
+ image?: string | {
9627
+ id: string;
9628
+ } | undefined;
9629
+ detail?: string | undefined;
9630
+ } | {
9631
+ type: "input_file";
9632
+ providerData?: Record<string, any> | undefined;
9633
+ file?: string | {
9634
+ id: string;
9635
+ } | {
9636
+ url: string;
9637
+ } | undefined;
9638
+ filename?: string | undefined;
9639
+ })[];
9640
+ callId: string;
9641
+ providerData?: Record<string, any> | undefined;
9642
+ id?: string | undefined;
8579
9643
  } | {
8580
9644
  type: "computer_call";
8581
9645
  status: "in_progress" | "completed" | "incomplete";
@@ -9036,6 +10100,64 @@ export declare const SerializedRunState: z.ZodObject<{
9036
10100
  status?: "in_progress" | "completed" | "incomplete" | undefined;
9037
10101
  providerData?: Record<string, any> | undefined;
9038
10102
  id?: string | undefined;
10103
+ } | {
10104
+ type: "function_call_result";
10105
+ status: "in_progress" | "completed" | "incomplete";
10106
+ name: string;
10107
+ output: string | {
10108
+ type: "text";
10109
+ text: string;
10110
+ providerData?: Record<string, any> | undefined;
10111
+ } | {
10112
+ type: "image";
10113
+ providerData?: Record<string, any> | undefined;
10114
+ image?: string | {
10115
+ data: string | Uint8Array<ArrayBuffer>;
10116
+ mediaType?: string | undefined;
10117
+ } | {
10118
+ url: string;
10119
+ } | {
10120
+ fileId: string;
10121
+ } | undefined;
10122
+ detail?: "low" | "high" | "auto" | (string & {}) | undefined;
10123
+ } | {
10124
+ type: "file";
10125
+ file: string | {
10126
+ filename: string;
10127
+ data: string | Uint8Array<ArrayBuffer>;
10128
+ mediaType: string;
10129
+ } | {
10130
+ url: string;
10131
+ filename?: string | undefined;
10132
+ } | {
10133
+ id: string;
10134
+ filename?: string | undefined;
10135
+ };
10136
+ providerData?: Record<string, any> | undefined;
10137
+ } | ({
10138
+ type: "input_text";
10139
+ text: string;
10140
+ providerData?: Record<string, any> | undefined;
10141
+ } | {
10142
+ type: "input_image";
10143
+ providerData?: Record<string, any> | undefined;
10144
+ image?: string | {
10145
+ id: string;
10146
+ } | undefined;
10147
+ detail?: string | undefined;
10148
+ } | {
10149
+ type: "input_file";
10150
+ providerData?: Record<string, any> | undefined;
10151
+ file?: string | {
10152
+ id: string;
10153
+ } | {
10154
+ url: string;
10155
+ } | undefined;
10156
+ filename?: string | undefined;
10157
+ })[];
10158
+ callId: string;
10159
+ providerData?: Record<string, any> | undefined;
10160
+ id?: string | undefined;
9039
10161
  } | {
9040
10162
  type: "computer_call";
9041
10163
  status: "in_progress" | "completed" | "incomplete";
@@ -9424,6 +10546,7 @@ export declare const SerializedRunState: z.ZodObject<{
9424
10546
  };
9425
10547
  }[] | undefined;
9426
10548
  } | undefined;
10549
+ currentTurnPersistedItemCount?: number | undefined;
9427
10550
  }>;
9428
10551
  /**
9429
10552
  * Serializable snapshot of an agent's run, including context, usage and trace.
@@ -9466,6 +10589,17 @@ export declare class RunState<TContext, TAgent extends Agent<any, any>> {
9466
10589
  * Items generated by the agent during the run.
9467
10590
  */
9468
10591
  _generatedItems: RunItem[];
10592
+ /**
10593
+ * Number of `_generatedItems` already flushed to session storage for the current turn.
10594
+ *
10595
+ * Persisting the entire turn on every save would duplicate responses and tool outputs.
10596
+ * Instead, `saveToSession` appends only the delta since the previous write. This counter
10597
+ * tracks how many generated run items from *this turn* were already written so the next
10598
+ * save can slice off only the new entries. When a turn is interrupted (e.g., awaiting tool
10599
+ * approval) and later resumed, we rewind the counter before continuing so the pending tool
10600
+ * output still gets stored.
10601
+ */
10602
+ _currentTurnPersistedItemCount: number;
9469
10603
  /**
9470
10604
  * Maximum allowed turns before forcing termination.
9471
10605
  */