@openai/agents-core 0.3.0 → 0.3.2

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 (76) hide show
  1. package/dist/agent.d.ts +2 -0
  2. package/dist/agent.js +5 -0
  3. package/dist/agent.js.map +1 -1
  4. package/dist/agent.mjs +5 -0
  5. package/dist/agent.mjs.map +1 -1
  6. package/dist/editor.d.ts +38 -0
  7. package/dist/editor.js +3 -0
  8. package/dist/editor.js.map +1 -0
  9. package/dist/editor.mjs +2 -0
  10. package/dist/editor.mjs.map +1 -0
  11. package/dist/extensions/handoffFilters.js +4 -0
  12. package/dist/extensions/handoffFilters.js.map +1 -1
  13. package/dist/extensions/handoffFilters.mjs +4 -0
  14. package/dist/extensions/handoffFilters.mjs.map +1 -1
  15. package/dist/index.d.ts +5 -2
  16. package/dist/index.js +6 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +2 -1
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/items.d.ts +518 -4
  21. package/dist/items.js +22 -1
  22. package/dist/items.js.map +1 -1
  23. package/dist/items.mjs +22 -1
  24. package/dist/items.mjs.map +1 -1
  25. package/dist/metadata.js +2 -2
  26. package/dist/metadata.mjs +2 -2
  27. package/dist/model.d.ts +17 -3
  28. package/dist/run.js +3 -0
  29. package/dist/run.js.map +1 -1
  30. package/dist/run.mjs +3 -0
  31. package/dist/run.mjs.map +1 -1
  32. package/dist/runContext.js +2 -2
  33. package/dist/runContext.js.map +1 -1
  34. package/dist/runContext.mjs +2 -2
  35. package/dist/runContext.mjs.map +1 -1
  36. package/dist/runImplementation.d.ts +16 -1
  37. package/dist/runImplementation.js +262 -4
  38. package/dist/runImplementation.js.map +1 -1
  39. package/dist/runImplementation.mjs +260 -4
  40. package/dist/runImplementation.mjs.map +1 -1
  41. package/dist/runState.d.ts +2554 -20
  42. package/dist/runState.js +46 -3
  43. package/dist/runState.js.map +1 -1
  44. package/dist/runState.mjs +46 -3
  45. package/dist/runState.mjs.map +1 -1
  46. package/dist/shell.d.ts +36 -0
  47. package/dist/shell.js +3 -0
  48. package/dist/shell.js.map +1 -0
  49. package/dist/shell.mjs +2 -0
  50. package/dist/shell.mjs.map +1 -0
  51. package/dist/tool.d.ts +62 -1
  52. package/dist/tool.js +30 -0
  53. package/dist/tool.js.map +1 -1
  54. package/dist/tool.mjs +28 -0
  55. package/dist/tool.mjs.map +1 -1
  56. package/dist/types/aliases.d.ts +3 -3
  57. package/dist/types/protocol.d.ts +2317 -42
  58. package/dist/types/protocol.js +73 -1
  59. package/dist/types/protocol.js.map +1 -1
  60. package/dist/types/protocol.mjs +72 -0
  61. package/dist/types/protocol.mjs.map +1 -1
  62. package/dist/utils/applyDiff.d.ts +9 -0
  63. package/dist/utils/applyDiff.js +275 -0
  64. package/dist/utils/applyDiff.js.map +1 -0
  65. package/dist/utils/applyDiff.mjs +272 -0
  66. package/dist/utils/applyDiff.mjs.map +1 -0
  67. package/dist/utils/index.d.ts +1 -0
  68. package/dist/utils/index.js +3 -1
  69. package/dist/utils/index.js.map +1 -1
  70. package/dist/utils/index.mjs +1 -0
  71. package/dist/utils/index.mjs.map +1 -1
  72. package/dist/utils/serialize.js +12 -0
  73. package/dist/utils/serialize.js.map +1 -1
  74. package/dist/utils/serialize.mjs +12 -0
  75. package/dist/utils/serialize.mjs.map +1 -1
  76. package/package.json +3 -3
package/dist/items.d.ts CHANGED
@@ -198,6 +198,68 @@ export declare class RunItemBase {
198
198
  callId: string;
199
199
  providerData?: Record<string, any> | undefined;
200
200
  id?: string | undefined;
201
+ } | {
202
+ type: "shell_call";
203
+ callId: string;
204
+ action: {
205
+ commands: string[];
206
+ timeoutMs?: number | undefined;
207
+ maxOutputLength?: number | undefined;
208
+ };
209
+ status?: "in_progress" | "completed" | "incomplete" | undefined;
210
+ providerData?: Record<string, any> | undefined;
211
+ id?: string | undefined;
212
+ } | {
213
+ type: "shell_call_output";
214
+ output: import("zod").objectOutputType<{
215
+ stdout: import("zod").ZodString;
216
+ stderr: import("zod").ZodString;
217
+ outcome: import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
218
+ type: import("zod").ZodLiteral<"timeout">;
219
+ }, "strip", import("zod").ZodTypeAny, {
220
+ type: "timeout";
221
+ }, {
222
+ type: "timeout";
223
+ }>, import("zod").ZodObject<{
224
+ type: import("zod").ZodLiteral<"exit">;
225
+ exitCode: import("zod").ZodNullable<import("zod").ZodNumber>;
226
+ }, "strip", import("zod").ZodTypeAny, {
227
+ type: "exit";
228
+ exitCode: number | null;
229
+ }, {
230
+ type: "exit";
231
+ exitCode: number | null;
232
+ }>]>;
233
+ }, import("zod").ZodTypeAny, "passthrough">[];
234
+ callId: string;
235
+ providerData?: Record<string, any> | undefined;
236
+ id?: string | undefined;
237
+ maxOutputLength?: number | undefined;
238
+ } | {
239
+ type: "apply_patch_call";
240
+ status: "in_progress" | "completed";
241
+ callId: string;
242
+ operation: {
243
+ path: string;
244
+ type: "create_file";
245
+ diff: string;
246
+ } | {
247
+ path: string;
248
+ type: "update_file";
249
+ diff: string;
250
+ } | {
251
+ path: string;
252
+ type: "delete_file";
253
+ };
254
+ providerData?: Record<string, any> | undefined;
255
+ id?: string | undefined;
256
+ } | {
257
+ type: "apply_patch_call_output";
258
+ status: "completed" | "failed";
259
+ callId: string;
260
+ providerData?: Record<string, any> | undefined;
261
+ id?: string | undefined;
262
+ output?: string | undefined;
201
263
  } | {
202
264
  type: "reasoning";
203
265
  content: {
@@ -422,6 +484,68 @@ export declare class RunMessageOutputItem extends RunItemBase {
422
484
  callId: string;
423
485
  providerData?: Record<string, any> | undefined;
424
486
  id?: string | undefined;
487
+ } | {
488
+ type: "shell_call";
489
+ callId: string;
490
+ action: {
491
+ commands: string[];
492
+ timeoutMs?: number | undefined;
493
+ maxOutputLength?: number | undefined;
494
+ };
495
+ status?: "in_progress" | "completed" | "incomplete" | undefined;
496
+ providerData?: Record<string, any> | undefined;
497
+ id?: string | undefined;
498
+ } | {
499
+ type: "shell_call_output";
500
+ output: import("zod").objectOutputType<{
501
+ stdout: import("zod").ZodString;
502
+ stderr: import("zod").ZodString;
503
+ outcome: import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
504
+ type: import("zod").ZodLiteral<"timeout">;
505
+ }, "strip", import("zod").ZodTypeAny, {
506
+ type: "timeout";
507
+ }, {
508
+ type: "timeout";
509
+ }>, import("zod").ZodObject<{
510
+ type: import("zod").ZodLiteral<"exit">;
511
+ exitCode: import("zod").ZodNullable<import("zod").ZodNumber>;
512
+ }, "strip", import("zod").ZodTypeAny, {
513
+ type: "exit";
514
+ exitCode: number | null;
515
+ }, {
516
+ type: "exit";
517
+ exitCode: number | null;
518
+ }>]>;
519
+ }, import("zod").ZodTypeAny, "passthrough">[];
520
+ callId: string;
521
+ providerData?: Record<string, any> | undefined;
522
+ id?: string | undefined;
523
+ maxOutputLength?: number | undefined;
524
+ } | {
525
+ type: "apply_patch_call";
526
+ status: "in_progress" | "completed";
527
+ callId: string;
528
+ operation: {
529
+ path: string;
530
+ type: "create_file";
531
+ diff: string;
532
+ } | {
533
+ path: string;
534
+ type: "update_file";
535
+ diff: string;
536
+ } | {
537
+ path: string;
538
+ type: "delete_file";
539
+ };
540
+ providerData?: Record<string, any> | undefined;
541
+ id?: string | undefined;
542
+ } | {
543
+ type: "apply_patch_call_output";
544
+ status: "completed" | "failed";
545
+ callId: string;
546
+ providerData?: Record<string, any> | undefined;
547
+ id?: string | undefined;
548
+ output?: string | undefined;
425
549
  } | {
426
550
  type: "reasoning";
427
551
  content: {
@@ -647,6 +771,68 @@ export declare class RunToolCallItem extends RunItemBase {
647
771
  callId: string;
648
772
  providerData?: Record<string, any> | undefined;
649
773
  id?: string | undefined;
774
+ } | {
775
+ type: "shell_call";
776
+ callId: string;
777
+ action: {
778
+ commands: string[];
779
+ timeoutMs?: number | undefined;
780
+ maxOutputLength?: number | undefined;
781
+ };
782
+ status?: "in_progress" | "completed" | "incomplete" | undefined;
783
+ providerData?: Record<string, any> | undefined;
784
+ id?: string | undefined;
785
+ } | {
786
+ type: "shell_call_output";
787
+ output: import("zod").objectOutputType<{
788
+ stdout: import("zod").ZodString;
789
+ stderr: import("zod").ZodString;
790
+ outcome: import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
791
+ type: import("zod").ZodLiteral<"timeout">;
792
+ }, "strip", import("zod").ZodTypeAny, {
793
+ type: "timeout";
794
+ }, {
795
+ type: "timeout";
796
+ }>, import("zod").ZodObject<{
797
+ type: import("zod").ZodLiteral<"exit">;
798
+ exitCode: import("zod").ZodNullable<import("zod").ZodNumber>;
799
+ }, "strip", import("zod").ZodTypeAny, {
800
+ type: "exit";
801
+ exitCode: number | null;
802
+ }, {
803
+ type: "exit";
804
+ exitCode: number | null;
805
+ }>]>;
806
+ }, import("zod").ZodTypeAny, "passthrough">[];
807
+ callId: string;
808
+ providerData?: Record<string, any> | undefined;
809
+ id?: string | undefined;
810
+ maxOutputLength?: number | undefined;
811
+ } | {
812
+ type: "apply_patch_call";
813
+ status: "in_progress" | "completed";
814
+ callId: string;
815
+ operation: {
816
+ path: string;
817
+ type: "create_file";
818
+ diff: string;
819
+ } | {
820
+ path: string;
821
+ type: "update_file";
822
+ diff: string;
823
+ } | {
824
+ path: string;
825
+ type: "delete_file";
826
+ };
827
+ providerData?: Record<string, any> | undefined;
828
+ id?: string | undefined;
829
+ } | {
830
+ type: "apply_patch_call_output";
831
+ status: "completed" | "failed";
832
+ callId: string;
833
+ providerData?: Record<string, any> | undefined;
834
+ id?: string | undefined;
835
+ output?: string | undefined;
650
836
  } | {
651
837
  type: "reasoning";
652
838
  content: {
@@ -669,11 +855,11 @@ export declare class RunToolCallItem extends RunItemBase {
669
855
  };
670
856
  }
671
857
  export declare class RunToolCallOutputItem extends RunItemBase {
672
- rawItem: protocol.FunctionCallResultItem | protocol.ComputerCallResultItem;
858
+ rawItem: protocol.FunctionCallResultItem | protocol.ComputerCallResultItem | protocol.ShellCallResultItem | protocol.ApplyPatchCallResultItem;
673
859
  agent: Agent<any, any>;
674
860
  output: string | unknown;
675
861
  readonly type: "tool_call_output_item";
676
- constructor(rawItem: protocol.FunctionCallResultItem | protocol.ComputerCallResultItem, agent: Agent<any, any>, output: string | unknown);
862
+ constructor(rawItem: protocol.FunctionCallResultItem | protocol.ComputerCallResultItem | protocol.ShellCallResultItem | protocol.ApplyPatchCallResultItem, agent: Agent<any, any>, output: string | unknown);
677
863
  toJSON(): {
678
864
  agent: {
679
865
  name: string;
@@ -873,6 +1059,68 @@ export declare class RunToolCallOutputItem extends RunItemBase {
873
1059
  callId: string;
874
1060
  providerData?: Record<string, any> | undefined;
875
1061
  id?: string | undefined;
1062
+ } | {
1063
+ type: "shell_call";
1064
+ callId: string;
1065
+ action: {
1066
+ commands: string[];
1067
+ timeoutMs?: number | undefined;
1068
+ maxOutputLength?: number | undefined;
1069
+ };
1070
+ status?: "in_progress" | "completed" | "incomplete" | undefined;
1071
+ providerData?: Record<string, any> | undefined;
1072
+ id?: string | undefined;
1073
+ } | {
1074
+ type: "shell_call_output";
1075
+ output: import("zod").objectOutputType<{
1076
+ stdout: import("zod").ZodString;
1077
+ stderr: import("zod").ZodString;
1078
+ outcome: import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
1079
+ type: import("zod").ZodLiteral<"timeout">;
1080
+ }, "strip", import("zod").ZodTypeAny, {
1081
+ type: "timeout";
1082
+ }, {
1083
+ type: "timeout";
1084
+ }>, import("zod").ZodObject<{
1085
+ type: import("zod").ZodLiteral<"exit">;
1086
+ exitCode: import("zod").ZodNullable<import("zod").ZodNumber>;
1087
+ }, "strip", import("zod").ZodTypeAny, {
1088
+ type: "exit";
1089
+ exitCode: number | null;
1090
+ }, {
1091
+ type: "exit";
1092
+ exitCode: number | null;
1093
+ }>]>;
1094
+ }, import("zod").ZodTypeAny, "passthrough">[];
1095
+ callId: string;
1096
+ providerData?: Record<string, any> | undefined;
1097
+ id?: string | undefined;
1098
+ maxOutputLength?: number | undefined;
1099
+ } | {
1100
+ type: "apply_patch_call";
1101
+ status: "in_progress" | "completed";
1102
+ callId: string;
1103
+ operation: {
1104
+ path: string;
1105
+ type: "create_file";
1106
+ diff: string;
1107
+ } | {
1108
+ path: string;
1109
+ type: "update_file";
1110
+ diff: string;
1111
+ } | {
1112
+ path: string;
1113
+ type: "delete_file";
1114
+ };
1115
+ providerData?: Record<string, any> | undefined;
1116
+ id?: string | undefined;
1117
+ } | {
1118
+ type: "apply_patch_call_output";
1119
+ status: "completed" | "failed";
1120
+ callId: string;
1121
+ providerData?: Record<string, any> | undefined;
1122
+ id?: string | undefined;
1123
+ output?: string | undefined;
876
1124
  } | {
877
1125
  type: "reasoning";
878
1126
  content: {
@@ -1097,6 +1345,68 @@ export declare class RunReasoningItem extends RunItemBase {
1097
1345
  callId: string;
1098
1346
  providerData?: Record<string, any> | undefined;
1099
1347
  id?: string | undefined;
1348
+ } | {
1349
+ type: "shell_call";
1350
+ callId: string;
1351
+ action: {
1352
+ commands: string[];
1353
+ timeoutMs?: number | undefined;
1354
+ maxOutputLength?: number | undefined;
1355
+ };
1356
+ status?: "in_progress" | "completed" | "incomplete" | undefined;
1357
+ providerData?: Record<string, any> | undefined;
1358
+ id?: string | undefined;
1359
+ } | {
1360
+ type: "shell_call_output";
1361
+ output: import("zod").objectOutputType<{
1362
+ stdout: import("zod").ZodString;
1363
+ stderr: import("zod").ZodString;
1364
+ outcome: import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
1365
+ type: import("zod").ZodLiteral<"timeout">;
1366
+ }, "strip", import("zod").ZodTypeAny, {
1367
+ type: "timeout";
1368
+ }, {
1369
+ type: "timeout";
1370
+ }>, import("zod").ZodObject<{
1371
+ type: import("zod").ZodLiteral<"exit">;
1372
+ exitCode: import("zod").ZodNullable<import("zod").ZodNumber>;
1373
+ }, "strip", import("zod").ZodTypeAny, {
1374
+ type: "exit";
1375
+ exitCode: number | null;
1376
+ }, {
1377
+ type: "exit";
1378
+ exitCode: number | null;
1379
+ }>]>;
1380
+ }, import("zod").ZodTypeAny, "passthrough">[];
1381
+ callId: string;
1382
+ providerData?: Record<string, any> | undefined;
1383
+ id?: string | undefined;
1384
+ maxOutputLength?: number | undefined;
1385
+ } | {
1386
+ type: "apply_patch_call";
1387
+ status: "in_progress" | "completed";
1388
+ callId: string;
1389
+ operation: {
1390
+ path: string;
1391
+ type: "create_file";
1392
+ diff: string;
1393
+ } | {
1394
+ path: string;
1395
+ type: "update_file";
1396
+ diff: string;
1397
+ } | {
1398
+ path: string;
1399
+ type: "delete_file";
1400
+ };
1401
+ providerData?: Record<string, any> | undefined;
1402
+ id?: string | undefined;
1403
+ } | {
1404
+ type: "apply_patch_call_output";
1405
+ status: "completed" | "failed";
1406
+ callId: string;
1407
+ providerData?: Record<string, any> | undefined;
1408
+ id?: string | undefined;
1409
+ output?: string | undefined;
1100
1410
  } | {
1101
1411
  type: "reasoning";
1102
1412
  content: {
@@ -1321,6 +1631,68 @@ export declare class RunHandoffCallItem extends RunItemBase {
1321
1631
  callId: string;
1322
1632
  providerData?: Record<string, any> | undefined;
1323
1633
  id?: string | undefined;
1634
+ } | {
1635
+ type: "shell_call";
1636
+ callId: string;
1637
+ action: {
1638
+ commands: string[];
1639
+ timeoutMs?: number | undefined;
1640
+ maxOutputLength?: number | undefined;
1641
+ };
1642
+ status?: "in_progress" | "completed" | "incomplete" | undefined;
1643
+ providerData?: Record<string, any> | undefined;
1644
+ id?: string | undefined;
1645
+ } | {
1646
+ type: "shell_call_output";
1647
+ output: import("zod").objectOutputType<{
1648
+ stdout: import("zod").ZodString;
1649
+ stderr: import("zod").ZodString;
1650
+ outcome: import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
1651
+ type: import("zod").ZodLiteral<"timeout">;
1652
+ }, "strip", import("zod").ZodTypeAny, {
1653
+ type: "timeout";
1654
+ }, {
1655
+ type: "timeout";
1656
+ }>, import("zod").ZodObject<{
1657
+ type: import("zod").ZodLiteral<"exit">;
1658
+ exitCode: import("zod").ZodNullable<import("zod").ZodNumber>;
1659
+ }, "strip", import("zod").ZodTypeAny, {
1660
+ type: "exit";
1661
+ exitCode: number | null;
1662
+ }, {
1663
+ type: "exit";
1664
+ exitCode: number | null;
1665
+ }>]>;
1666
+ }, import("zod").ZodTypeAny, "passthrough">[];
1667
+ callId: string;
1668
+ providerData?: Record<string, any> | undefined;
1669
+ id?: string | undefined;
1670
+ maxOutputLength?: number | undefined;
1671
+ } | {
1672
+ type: "apply_patch_call";
1673
+ status: "in_progress" | "completed";
1674
+ callId: string;
1675
+ operation: {
1676
+ path: string;
1677
+ type: "create_file";
1678
+ diff: string;
1679
+ } | {
1680
+ path: string;
1681
+ type: "update_file";
1682
+ diff: string;
1683
+ } | {
1684
+ path: string;
1685
+ type: "delete_file";
1686
+ };
1687
+ providerData?: Record<string, any> | undefined;
1688
+ id?: string | undefined;
1689
+ } | {
1690
+ type: "apply_patch_call_output";
1691
+ status: "completed" | "failed";
1692
+ callId: string;
1693
+ providerData?: Record<string, any> | undefined;
1694
+ id?: string | undefined;
1695
+ output?: string | undefined;
1324
1696
  } | {
1325
1697
  type: "reasoning";
1326
1698
  content: {
@@ -1549,6 +1921,68 @@ export declare class RunHandoffOutputItem extends RunItemBase {
1549
1921
  callId: string;
1550
1922
  providerData?: Record<string, any> | undefined;
1551
1923
  id?: string | undefined;
1924
+ } | {
1925
+ type: "shell_call";
1926
+ callId: string;
1927
+ action: {
1928
+ commands: string[];
1929
+ timeoutMs?: number | undefined;
1930
+ maxOutputLength?: number | undefined;
1931
+ };
1932
+ status?: "in_progress" | "completed" | "incomplete" | undefined;
1933
+ providerData?: Record<string, any> | undefined;
1934
+ id?: string | undefined;
1935
+ } | {
1936
+ type: "shell_call_output";
1937
+ output: import("zod").objectOutputType<{
1938
+ stdout: import("zod").ZodString;
1939
+ stderr: import("zod").ZodString;
1940
+ outcome: import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
1941
+ type: import("zod").ZodLiteral<"timeout">;
1942
+ }, "strip", import("zod").ZodTypeAny, {
1943
+ type: "timeout";
1944
+ }, {
1945
+ type: "timeout";
1946
+ }>, import("zod").ZodObject<{
1947
+ type: import("zod").ZodLiteral<"exit">;
1948
+ exitCode: import("zod").ZodNullable<import("zod").ZodNumber>;
1949
+ }, "strip", import("zod").ZodTypeAny, {
1950
+ type: "exit";
1951
+ exitCode: number | null;
1952
+ }, {
1953
+ type: "exit";
1954
+ exitCode: number | null;
1955
+ }>]>;
1956
+ }, import("zod").ZodTypeAny, "passthrough">[];
1957
+ callId: string;
1958
+ providerData?: Record<string, any> | undefined;
1959
+ id?: string | undefined;
1960
+ maxOutputLength?: number | undefined;
1961
+ } | {
1962
+ type: "apply_patch_call";
1963
+ status: "in_progress" | "completed";
1964
+ callId: string;
1965
+ operation: {
1966
+ path: string;
1967
+ type: "create_file";
1968
+ diff: string;
1969
+ } | {
1970
+ path: string;
1971
+ type: "update_file";
1972
+ diff: string;
1973
+ } | {
1974
+ path: string;
1975
+ type: "delete_file";
1976
+ };
1977
+ providerData?: Record<string, any> | undefined;
1978
+ id?: string | undefined;
1979
+ } | {
1980
+ type: "apply_patch_call_output";
1981
+ status: "completed" | "failed";
1982
+ callId: string;
1983
+ providerData?: Record<string, any> | undefined;
1984
+ id?: string | undefined;
1985
+ output?: string | undefined;
1552
1986
  } | {
1553
1987
  type: "reasoning";
1554
1988
  content: {
@@ -1571,14 +2005,32 @@ export declare class RunHandoffOutputItem extends RunItemBase {
1571
2005
  };
1572
2006
  }
1573
2007
  export declare class RunToolApprovalItem extends RunItemBase {
1574
- rawItem: protocol.FunctionCallItem | protocol.HostedToolCallItem;
2008
+ rawItem: protocol.FunctionCallItem | protocol.HostedToolCallItem | protocol.ShellCallItem | protocol.ApplyPatchCallItem;
1575
2009
  agent: Agent<any, any>;
2010
+ /**
2011
+ * Explicit tool name to use for approval tracking when not present on the raw item.
2012
+ */
2013
+ toolName?: string | undefined;
1576
2014
  readonly type: "tool_approval_item";
1577
- constructor(rawItem: protocol.FunctionCallItem | protocol.HostedToolCallItem, agent: Agent<any, any>);
2015
+ constructor(rawItem: protocol.FunctionCallItem | protocol.HostedToolCallItem | protocol.ShellCallItem | protocol.ApplyPatchCallItem, agent: Agent<any, any>,
2016
+ /**
2017
+ * Explicit tool name to use for approval tracking when not present on the raw item.
2018
+ */
2019
+ toolName?: string | undefined);
2020
+ /**
2021
+ * Returns the tool name if available on the raw item or provided explicitly.
2022
+ * Kept for backwards compatibility with code that previously relied on `rawItem.name`.
2023
+ */
2024
+ get name(): string | undefined;
2025
+ /**
2026
+ * Returns the arguments if the raw item has an arguments property otherwise this will be undefined.
2027
+ */
2028
+ get arguments(): string | undefined;
1578
2029
  toJSON(): {
1579
2030
  agent: {
1580
2031
  name: string;
1581
2032
  };
2033
+ toolName: string | undefined;
1582
2034
  type: string;
1583
2035
  rawItem: {
1584
2036
  status: "in_progress" | "completed" | "incomplete";
@@ -1773,6 +2225,68 @@ export declare class RunToolApprovalItem extends RunItemBase {
1773
2225
  callId: string;
1774
2226
  providerData?: Record<string, any> | undefined;
1775
2227
  id?: string | undefined;
2228
+ } | {
2229
+ type: "shell_call";
2230
+ callId: string;
2231
+ action: {
2232
+ commands: string[];
2233
+ timeoutMs?: number | undefined;
2234
+ maxOutputLength?: number | undefined;
2235
+ };
2236
+ status?: "in_progress" | "completed" | "incomplete" | undefined;
2237
+ providerData?: Record<string, any> | undefined;
2238
+ id?: string | undefined;
2239
+ } | {
2240
+ type: "shell_call_output";
2241
+ output: import("zod").objectOutputType<{
2242
+ stdout: import("zod").ZodString;
2243
+ stderr: import("zod").ZodString;
2244
+ outcome: import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
2245
+ type: import("zod").ZodLiteral<"timeout">;
2246
+ }, "strip", import("zod").ZodTypeAny, {
2247
+ type: "timeout";
2248
+ }, {
2249
+ type: "timeout";
2250
+ }>, import("zod").ZodObject<{
2251
+ type: import("zod").ZodLiteral<"exit">;
2252
+ exitCode: import("zod").ZodNullable<import("zod").ZodNumber>;
2253
+ }, "strip", import("zod").ZodTypeAny, {
2254
+ type: "exit";
2255
+ exitCode: number | null;
2256
+ }, {
2257
+ type: "exit";
2258
+ exitCode: number | null;
2259
+ }>]>;
2260
+ }, import("zod").ZodTypeAny, "passthrough">[];
2261
+ callId: string;
2262
+ providerData?: Record<string, any> | undefined;
2263
+ id?: string | undefined;
2264
+ maxOutputLength?: number | undefined;
2265
+ } | {
2266
+ type: "apply_patch_call";
2267
+ status: "in_progress" | "completed";
2268
+ callId: string;
2269
+ operation: {
2270
+ path: string;
2271
+ type: "create_file";
2272
+ diff: string;
2273
+ } | {
2274
+ path: string;
2275
+ type: "update_file";
2276
+ diff: string;
2277
+ } | {
2278
+ path: string;
2279
+ type: "delete_file";
2280
+ };
2281
+ providerData?: Record<string, any> | undefined;
2282
+ id?: string | undefined;
2283
+ } | {
2284
+ type: "apply_patch_call_output";
2285
+ status: "completed" | "failed";
2286
+ callId: string;
2287
+ providerData?: Record<string, any> | undefined;
2288
+ id?: string | undefined;
2289
+ output?: string | undefined;
1776
2290
  } | {
1777
2291
  type: "reasoning";
1778
2292
  content: {
package/dist/items.js CHANGED
@@ -134,16 +134,37 @@ exports.RunHandoffOutputItem = RunHandoffOutputItem;
134
134
  class RunToolApprovalItem extends RunItemBase {
135
135
  rawItem;
136
136
  agent;
137
+ toolName;
137
138
  type = 'tool_approval_item';
138
- constructor(rawItem, agent) {
139
+ constructor(rawItem, agent,
140
+ /**
141
+ * Explicit tool name to use for approval tracking when not present on the raw item.
142
+ */
143
+ toolName) {
139
144
  super();
140
145
  this.rawItem = rawItem;
141
146
  this.agent = agent;
147
+ this.toolName = toolName;
148
+ this.toolName = toolName ?? rawItem.name;
149
+ }
150
+ /**
151
+ * Returns the tool name if available on the raw item or provided explicitly.
152
+ * Kept for backwards compatibility with code that previously relied on `rawItem.name`.
153
+ */
154
+ get name() {
155
+ return this.toolName ?? this.rawItem.name;
156
+ }
157
+ /**
158
+ * Returns the arguments if the raw item has an arguments property otherwise this will be undefined.
159
+ */
160
+ get arguments() {
161
+ return 'arguments' in this.rawItem ? this.rawItem.arguments : undefined;
142
162
  }
143
163
  toJSON() {
144
164
  return {
145
165
  ...super.toJSON(),
146
166
  agent: this.agent.toJSON(),
167
+ toolName: this.toolName,
147
168
  };
148
169
  }
149
170
  }
package/dist/items.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"items.js","sourceRoot":"","sources":["../src/items.ts"],"names":[],"mappings":";;;AA8KA,oDAKC;AAlLD,wDAAoD;AAGpD,MAAa,WAAW;IACN,IAAI,GAAW,WAAoB,CAAC;IAC7C,OAAO,CAAsB;IAEpC,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AAVD,kCAUC;AAED,MAAa,oBAAqB,SAAQ,WAAW;IAI1C;IACA;IAJO,IAAI,GAAG,qBAA8B,CAAC;IAEtD,YACS,OAAsC,EACtC,KAAY;QAEnB,KAAK,EAAE,CAAC;QAHD,YAAO,GAAP,OAAO,CAA+B;QACtC,UAAK,GAAL,KAAK,CAAO;IAGrB,CAAC;IAED,MAAM;QACJ,OAAO;YACL,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;SAC3B,CAAC;IACJ,CAAC;IAED,IAAI,OAAO;QACT,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACxC,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;gBAChC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC;YACvB,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA1BD,oDA0BC;AAED,MAAa,eAAgB,SAAQ,WAAW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