@@ -2030,6 +2030,12 @@ components:
20302030 description: >-
20312031 The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff;
20322032 `delete_file` omits it.
2033+ discriminator:
2034+ mapping:
2035+ create_file: '#/components/schemas/ApplyPatchCreateFileOperation'
2036+ delete_file: '#/components/schemas/ApplyPatchDeleteFileOperation'
2037+ update_file: '#/components/schemas/ApplyPatchUpdateFileOperation'
2038+ propertyName: type
20332039 example:
20342040 diff: |-
20352041 @@ function main() {
@@ -2038,45 +2044,9 @@ components:
20382044 path: /src/main.ts
20392045 type: update_file
20402046 oneOf:
2041- - properties:
2042- diff:
2043- type: string
2044- path:
2045- type: string
2046- type:
2047- enum:
2048- - create_file
2049- type: string
2050- required:
2051- - type
2052- - path
2053- - diff
2054- type: object
2055- - properties:
2056- diff:
2057- type: string
2058- path:
2059- type: string
2060- type:
2061- enum:
2062- - update_file
2063- type: string
2064- required:
2065- - type
2066- - path
2067- - diff
2068- type: object
2069- - properties:
2070- path:
2071- type: string
2072- type:
2073- enum:
2074- - delete_file
2075- type: string
2076- required:
2077- - type
2078- - path
2079- type: object
2047+ - $ref: '#/components/schemas/ApplyPatchCreateFileOperation'
2048+ - $ref: '#/components/schemas/ApplyPatchUpdateFileOperation'
2049+ - $ref: '#/components/schemas/ApplyPatchDeleteFileOperation'
20802050 ApplyPatchCallOperationDiffDeltaEvent:
20812051 description: Incremental chunk of `operation.diff` for an `apply_patch_call`. Matches OpenAI's streaming shape.
20822052 example:
@@ -2175,6 +2145,61 @@ components:
21752145 - completed
21762146 example: completed
21772147 type: string
2148+ ApplyPatchCreateFileOperation:
2149+ description: >-
2150+ The `create_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing the new file
2151+ contents.
2152+ example:
2153+ diff: |
2154+ @@
2155+ +console.log("hi");
2156+ path: /src/main.ts
2157+ type: create_file
2158+ properties:
2159+ diff:
2160+ type: string
2161+ path:
2162+ type: string
2163+ type:
2164+ enum:
2165+ - create_file
2166+ type: string
2167+ required:
2168+ - type
2169+ - path
2170+ - diff
2171+ type: object
2172+ ApplyPatchDeleteFileOperation:
2173+ description: >-
2174+ The `delete_file` variant of an `apply_patch_call.operation`. Identifies the file to remove; no diff is
2175+ required.
2176+ example:
2177+ path: /src/main.ts
2178+ type: delete_file
2179+ properties:
2180+ path:
2181+ type: string
2182+ type:
2183+ enum:
2184+ - delete_file
2185+ type: string
2186+ required:
2187+ - type
2188+ - path
2189+ type: object
2190+ ApplyPatchEngineEnum:
2191+ description: >-
2192+ Which apply_patch engine to use. "auto" (default) uses native passthrough when the endpoint advertises native
2193+ apply_patch support, otherwise falls back to OpenRouter's HITL validator. "native" forces native passthrough —
2194+ when the endpoint does not support native, the request falls back to HITL. "openrouter" always runs the HITL
2195+ validator. Native passthrough streams the diff incrementally via `apply_patch_call_operation_diff.delta` events;
2196+ HITL buffers the diff for atomic delivery as a single delta.
2197+ enum:
2198+ - auto
2199+ - native
2200+ - openrouter
2201+ example: auto
2202+ type: string
21782203 ApplyPatchServerTool:
21792204 description: Apply patch tool configuration
21802205 example:
@@ -2205,8 +2230,36 @@ components:
22052230 type: object
22062231 ApplyPatchServerToolConfig:
22072232 description: Configuration for the openrouter:apply_patch server tool
2208- example: {}
2209- properties: {}
2233+ example:
2234+ engine: auto
2235+ properties:
2236+ engine:
2237+ $ref: '#/components/schemas/ApplyPatchEngineEnum'
2238+ type: object
2239+ ApplyPatchUpdateFileOperation:
2240+ description: >-
2241+ The `update_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing edits to an existing
2242+ file.
2243+ example:
2244+ diff: |-
2245+ @@ function main() {
2246+ + console.log("hi");
2247+ }
2248+ path: /src/main.ts
2249+ type: update_file
2250+ properties:
2251+ diff:
2252+ type: string
2253+ path:
2254+ type: string
2255+ type:
2256+ enum:
2257+ - update_file
2258+ type: string
2259+ required:
2260+ - type
2261+ - path
2262+ - diff
22102263 type: object
22112264 AutoRouterPlugin:
22122265 example:
@@ -3058,6 +3111,7 @@ components:
30583111 items:
30593112 discriminator:
30603113 mapping:
3114+ apply_patch_call: '#/components/schemas/OutputItemApplyPatchCall'
30613115 custom_tool_call: '#/components/schemas/OutputItemCustomToolCall'
30623116 file_search_call: '#/components/schemas/OutputItemFileSearchCall'
30633117 function_call: '#/components/schemas/OutputItemFunctionCall'
@@ -3074,6 +3128,7 @@ components:
30743128 - $ref: '#/components/schemas/OutputItemWebSearchCall'
30753129 - $ref: '#/components/schemas/OutputItemFileSearchCall'
30763130 - $ref: '#/components/schemas/OutputItemImageGenerationCall'
3131+ - $ref: '#/components/schemas/OutputItemApplyPatchCall'
30773132 type: array
30783133 output_text:
30793134 type: string
@@ -14066,6 +14121,7 @@ components:
1406614121 item:
1406714122 discriminator:
1406814123 mapping:
14124+ apply_patch_call: '#/components/schemas/OutputItemApplyPatchCall'
1406914125 custom_tool_call: '#/components/schemas/OutputItemCustomToolCall'
1407014126 file_search_call: '#/components/schemas/OutputItemFileSearchCall'
1407114127 function_call: '#/components/schemas/OutputItemFunctionCall'
@@ -14082,6 +14138,7 @@ components:
1408214138 - $ref: '#/components/schemas/OutputItemWebSearchCall'
1408314139 - $ref: '#/components/schemas/OutputItemFileSearchCall'
1408414140 - $ref: '#/components/schemas/OutputItemImageGenerationCall'
14141+ - $ref: '#/components/schemas/OutputItemApplyPatchCall'
1408514142 output_index:
1408614143 type: integer
1408714144 sequence_number:
@@ -14096,6 +14153,53 @@ components:
1409614153 - item
1409714154 - sequence_number
1409814155 type: object
14156+ OutputItemApplyPatchCall:
14157+ example:
14158+ call_id: call_abc123
14159+ id: apc_abc123
14160+ operation:
14161+ diff: |-
14162+ @@ function main() {
14163+ + console.log("hi");
14164+ }
14165+ path: /src/main.ts
14166+ type: update_file
14167+ status: completed
14168+ type: apply_patch_call
14169+ properties:
14170+ call_id:
14171+ type: string
14172+ created_by:
14173+ type: string
14174+ id:
14175+ type: string
14176+ operation:
14177+ discriminator:
14178+ mapping:
14179+ create_file: '#/components/schemas/ApplyPatchCreateFileOperation'
14180+ delete_file: '#/components/schemas/ApplyPatchDeleteFileOperation'
14181+ update_file: '#/components/schemas/ApplyPatchUpdateFileOperation'
14182+ propertyName: type
14183+ oneOf:
14184+ - $ref: '#/components/schemas/ApplyPatchCreateFileOperation'
14185+ - $ref: '#/components/schemas/ApplyPatchUpdateFileOperation'
14186+ - $ref: '#/components/schemas/ApplyPatchDeleteFileOperation'
14187+ status:
14188+ enum:
14189+ - in_progress
14190+ - completed
14191+ type: string
14192+ type:
14193+ enum:
14194+ - apply_patch_call
14195+ type: string
14196+ required:
14197+ - type
14198+ - id
14199+ - call_id
14200+ - operation
14201+ - status
14202+ type: object
1409914203 OutputItemCustomToolCall:
1410014204 example:
1410114205 call_id: call-abc123
@@ -14146,6 +14250,7 @@ components:
1414614250 item:
1414714251 discriminator:
1414814252 mapping:
14253+ apply_patch_call: '#/components/schemas/OutputItemApplyPatchCall'
1414914254 custom_tool_call: '#/components/schemas/OutputItemCustomToolCall'
1415014255 file_search_call: '#/components/schemas/OutputItemFileSearchCall'
1415114256 function_call: '#/components/schemas/OutputItemFunctionCall'
@@ -14162,6 +14267,7 @@ components:
1416214267 - $ref: '#/components/schemas/OutputItemWebSearchCall'
1416314268 - $ref: '#/components/schemas/OutputItemFileSearchCall'
1416414269 - $ref: '#/components/schemas/OutputItemImageGenerationCall'
14270+ - $ref: '#/components/schemas/OutputItemApplyPatchCall'
1416514271 output_index:
1416614272 type: integer
1416714273 sequence_number:
0 commit comments