@@ -70,6 +70,22 @@ import MetaCodable
7070 @CodedAs ( " local_shell_call_output " )
7171 case localShellCallOutput( Item . LocalShellCallOutput )
7272
73+ /// A tool call representing a request to execute one or more shell commands.
74+ @CodedAs ( " shell_call " )
75+ case shellCall( Item . ShellCall )
76+
77+ /// The streamed output items emitted by a function shell tool call.
78+ @CodedAs ( " shell_call_output " )
79+ case shellCallOutput( Item . ShellCallOutput )
80+
81+ /// A tool call representing a request to create, delete, or update files using diff patches.
82+ @CodedAs ( " apply_patch_call " )
83+ case applyPatchCall( Item . ApplyPatchCall )
84+
85+ /// The streamed output emitted by an apply patch tool call.
86+ @CodedAs ( " apply_patch_call_output " )
87+ case applyPatchCallOutput( Item . ApplyPatchCallOutput )
88+
7389 /// A list of tools available on an MCP server.
7490 @CodedAs ( " mcp_list_tools " )
7591 case mcpListTools( Item . MCPListTools )
@@ -226,6 +242,22 @@ import MetaCodable
226242 @CodedAs ( " local_shell_call " )
227243 case localShellCall( Item . LocalShellCall )
228244
245+ /// A tool call representing a request to execute one or more shell commands.
246+ @CodedAs ( " shell_call " )
247+ case shellCall( Item . ShellCall )
248+
249+ /// The streamed output items emitted by a function shell tool call.
250+ @CodedAs ( " shell_call_output " )
251+ case shellCallOutput( Item . ShellCallOutput )
252+
253+ /// A tool call representing a request to create, delete, or update files using diff patches.
254+ @CodedAs ( " apply_patch_call " )
255+ case applyPatchCall( Item . ApplyPatchCall )
256+
257+ /// The streamed output emitted by an apply patch tool call.
258+ @CodedAs ( " apply_patch_call_output " )
259+ case applyPatchCallOutput( Item . ApplyPatchCallOutput )
260+
229261 /// An invocation of a tool on an MCP server.
230262 @CodedAs ( " mcp_call " )
231263 case mcpToolCall( Item . MCPToolCall )
@@ -249,18 +281,22 @@ import MetaCodable
249281 /// A unique ID for this item.
250282 public var id : String {
251283 switch self {
284+ case let . shellCall( call) : call. id
252285 case let . fileSearch( call) : call. id
253286 case let . mcpToolCall( call) : call. id
254287 case let . message( message) : message. id
255288 case let . webSearchCall( call) : call. id
289+ case let . applyPatchCall( call) : call. id
256290 case let . mcpListTools( tools) : tools. id
291+ case let . shellCallOutput( call) : call. id
257292 case let . functionCall( call) : call. callId
258293 case let . customToolCall( call) : call. callId
259294 case let . localShellCall( call) : call. callId
260295 case let . reasoning( reasoning) : reasoning. id
261296 case let . imageGenerationCall( call) : call. id
262297 case let . codeInterpreterCall( call) : call. id
263298 case let . computerToolCall( call) : call. callId
299+ case let . applyPatchCallOutput( call) : call. id
264300 case let . mcpApprovalRequest( request) : request. id
265301 case let . customToolCallOutput( call) : call. callId
266302 }
@@ -1224,8 +1260,237 @@ import MetaCodable
12241260 }
12251261 }
12261262
1227- case output( Output )
1263+ /// A tool call that executes one or more shell commands in a managed environment.
1264+ @Codable @CodingKeys ( . snake_case) public struct ShellCall : Equatable , Hashable , Sendable {
1265+ /// The status of the function shell tool call.
1266+ public enum Status : String , CaseIterable , Equatable , Hashable , Codable , Sendable {
1267+ case completed, incomplete
1268+ case inProgress = " in_progress "
1269+ }
1270+
1271+ /// The shell commands and limits that describe how to run the tool call.
1272+ @Codable @CodingKeys ( . snake_case) public struct Action : Equatable , Hashable , Sendable {
1273+ /// The shell commands to run.
1274+ public var commands : [ String ]
1275+
1276+ /// Optional maximum number of characters to return from each command.
1277+ public var maxOutputLength : UInt ?
1278+
1279+ /// Optional timeout in milliseconds for the commands.
1280+ public var timeout : TimeInterval ?
1281+
1282+ /// Creates a new action to run shell commands.
1283+ /// - Parameter commands: The shell commands to run.
1284+ /// - Parameter maxOutputLength: Optional maximum number of characters to return from each command.
1285+ /// - Parameter timeout: Optional timeout in milliseconds for the commands.
1286+ public init ( commands: [ String ] , maxOutputLength: UInt ? = nil , timeout: TimeInterval ? = nil ) {
1287+ self . timeout = timeout
1288+ self . commands = commands
1289+ self . maxOutputLength = maxOutputLength
1290+ }
1291+ }
1292+
1293+ /// The unique ID of the function shell tool call.
1294+ public var id : String
1295+
1296+ /// The unique ID of the function shell tool call generated by the model.
1297+ public var callId : String
1298+
1299+ /// The status of the shell call.
1300+ public var status : Status
1301+
1302+ /// The ID of the entity that created this tool call.
1303+ public var createdBy : String ?
1304+
1305+ /// The shell commands and limits that describe how to run the tool call.
1306+ public var action : Action
1307+
1308+ /// Creates a new function shell tool call.
1309+ /// - Parameter id: The unique ID of the function shell tool call.
1310+ /// - Parameter callId: The unique ID of the function shell tool call generated by the model.
1311+ /// - Parameter status: The status of the shell call.
1312+ /// - Parameter createdBy: The ID of the entity that created this tool call.
1313+ /// - Parameter action: The shell commands and limits that describe how to run the tool call.
1314+ public init ( id: String , callId: String , status: Status , createdBy: String ? = nil , action: Action ) {
1315+ self . id = id
1316+ self . callId = callId
1317+ self . status = status
1318+ self . action = action
1319+ self . createdBy = createdBy
1320+ }
1321+ }
1322+
1323+ /// The output of a shell tool call.
1324+ @Codable @CodingKeys ( . snake_case) public struct ShellCallOutput : Equatable , Hashable , Sendable {
1325+ /// The content of a shell call output.
1326+ @Codable @CodingKeys ( . snake_case) public struct Output : Equatable , Hashable , Sendable {
1327+ @Codable @CodedAt ( " type " ) @CodingKeys ( . snake_case) public enum Outcome : Equatable , Hashable , Sendable {
1328+ /// Indicates that the function shell call exceeded its configured time limit.
1329+ case timeout
1330+
1331+ /// Indicates that the shell commands finished and returned an exit code.
1332+ /// - Parameter exitCode: Exit code from the shell process.
1333+ case exit( exitCode: Int )
1334+ }
1335+
1336+ /// Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.
1337+ public var outcome : Outcome
1338+
1339+ /// The standard error output from the shell command.
1340+ public var stderr : String
1341+
1342+ /// The standard output from the shell command.
1343+ public var stdout : String
1344+
1345+ /// The ID of the entity that created this tool call.
1346+ public var createdBy : String ?
1347+
1348+ /// Creates a new shell call output.
1349+ ///
1350+ /// - Parameter outcome: Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.
1351+ /// - Parameter stderr: The standard error output from the shell command.
1352+ /// - Parameter stdout: The standard output from the shell command.
1353+ /// - Parameter createdBy: The ID of the entity that created this tool call.
1354+ public init ( outcome: Outcome , stderr: String , stdout: String , createdBy: String ? = nil ) {
1355+ self . outcome = outcome
1356+ self . stderr = stderr
1357+ self . stdout = stdout
1358+ self . createdBy = createdBy
1359+ }
1360+ }
1361+
1362+ /// The unique ID of the shell call output.
1363+ public var id : String
1364+
1365+ /// The unique ID of the shell tool call generated by the model.
1366+ public var callId : String
1367+
1368+ /// The ID of the entity that created this tool call.
1369+ public var createdBy : String ?
1370+
1371+ /// The maximum length of the shell command output.
1372+ ///
1373+ /// This is generated by the model and should be passed back with the raw output.
1374+ public var maxOutputLength : UInt ?
1375+
1376+ /// An array of shell call output contents
1377+ public var output : [ Output ]
1378+
1379+ /// Creates a new shell tool call output.
1380+ ///
1381+ /// - Parameter id: The unique ID of the shell call output.
1382+ /// - Parameter callId: The unique ID of the shell tool call generated by the model.
1383+ /// - Parameter createdBy: The ID of the entity that created this tool call.
1384+ /// - Parameter maxOutputLength: The maximum length of the shell command output.
1385+ /// - Parameter output: An array of shell call output contents.
1386+ public init ( id: String , callId: String , createdBy: String ? = nil , maxOutputLength: UInt ? = nil , output: [ Output ] ) {
1387+ self . id = id
1388+ self . callId = callId
1389+ self . createdBy = createdBy
1390+ self . maxOutputLength = maxOutputLength
1391+ self . output = output
1392+ }
1393+ }
1394+
1395+ /// A tool call that applies file diffs by creating, deleting, or updating files.
1396+ @Codable @CodingKeys ( . snake_case) public struct ApplyPatchCall : Equatable , Hashable , Sendable {
1397+ /// The status of the apply patch tool call.
1398+ public enum Status : String , CaseIterable , Equatable , Hashable , Codable , Sendable {
1399+ case completed
1400+ case inProgress = " in_progress "
1401+ }
1402+
1403+ @Codable @CodedAt ( " type " ) @CodingKeys ( . snake_case) public enum Operation : Equatable , Hashable , Sendable {
1404+ /// Create a new file with the provided diff.
1405+ ///
1406+ /// - Parameter path: Path of the file to create.
1407+ /// - Parameter diff: Diff to apply.
1408+ @CodedAs ( " create_file " )
1409+ case create( path: String , diff: String )
1410+
1411+ /// Delete the specified file.
1412+ ///
1413+ /// - Parameter path: Path of the file to delete.
1414+ @CodedAs ( " delete_file " )
1415+ case delete
1416+
1417+ /// Update an existing file with the provided diff.
1418+ ///
1419+ /// - Parameter path: Path of the file to update.
1420+ /// - Parameter diff: Diff to apply.
1421+ @CodedAs ( " update_file " )
1422+ case update( path: String , diff: String )
1423+ }
1424+
1425+ /// The unique ID of the apply patch tool call.
1426+ public var id : String
1427+
1428+ /// The unique ID of the apply patch tool call generated by the model.
1429+ public var callId : String
1430+
1431+ /// The status of the apply patch tool call.
1432+ public var status : Status
1433+
1434+ /// The ID of the entity that created this tool call.
1435+ public var createdBy : String ?
1436+
1437+ /// The operation to apply.
1438+ public var operation : Operation
1439+
1440+ /// Creates a new apply patch tool call.
1441+ /// - Parameter id: The unique ID of the apply patch tool call.
1442+ /// - Parameter callId: The unique ID of the apply patch tool call generated by the model.
1443+ /// - Parameter status: The status of the apply patch tool call.
1444+ /// - Parameter createdBy: The ID of the entity that created this tool call.
1445+ /// - Parameter operation: The operation to apply.
1446+ public init ( id: String , callId: String , status: Status , createdBy: String ? = nil , operation: Operation ) {
1447+ self . id = id
1448+ self . callId = callId
1449+ self . status = status
1450+ self . createdBy = createdBy
1451+ self . operation = operation
1452+ }
1453+ }
1454+
1455+ /// The output emitted by an apply patch tool call.
1456+ @Codable @CodingKeys ( . snake_case) public struct ApplyPatchCallOutput : Equatable , Hashable , Sendable {
1457+ /// The status of the apply patch tool call output.
1458+ public enum Status : String , CaseIterable , Equatable , Hashable , Codable , Sendable {
1459+ case completed, failed
1460+ }
1461+
1462+ /// The unique ID of the apply patch tool call output.
1463+ public var id : String
1464+
1465+ /// The unique ID of the apply patch tool call generated by the model.
1466+ public var callId : String
1467+
1468+ /// The status of the apply patch tool call.
1469+ public var status : Status
1470+
1471+ /// The ID of the entity that created this tool call output.
1472+ public var createdBy : String ?
1473+
1474+ /// Optional textual output returned by the apply patch tool.
1475+ public var operation : String ?
1476+
1477+ /// Creates a new apply patch tool call output.
1478+ /// - Parameter id: The unique ID of the apply patch tool call output.
1479+ /// - Parameter callId: The unique ID of the apply patch tool call generated by the model.
1480+ /// - Parameter status: The status of the apply patch tool call.
1481+ /// - Parameter createdBy: The ID of the entity that created this tool call output.
1482+ /// - Parameter operation: Optional textual output returned by the apply patch tool.
1483+ public init ( id: String , callId: String , status: Status , createdBy: String ? = nil , operation: String ? = nil ) {
1484+ self . id = id
1485+ self . callId = callId
1486+ self . status = status
1487+ self . createdBy = createdBy
1488+ self . operation = operation
1489+ }
1490+ }
1491+
12281492 case input( Input )
1493+ case output( Output )
12291494}
12301495
12311496// MARK: - Item.Input Creating helpers
0 commit comments