mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: parse execute tool commands and render them in the chat UI (#25478)
When the execute tool runs a chained shell command, the UI previously
rendered the raw string. Long chains like "cd /repo && git pull &&
git add . && git commit -m fix" were hard to scan.
A new ChatMessagePart.ParsedCommands [][]string field on tool-call
parts carries one entry per simple command, parsed in chatd from args
via mvdan.cc/sh/v3/syntax. The frontend renders the joined list ("cd,
git pull, git add, git commit") in place of the raw command, and falls
back to the raw command when the field is absent.
Closes CODAGT-446
This commit is contained in:
Generated
+91
@@ -118,6 +118,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -250,6 +255,7 @@ Status Code **200**
|
||||
| `»»» valid` | boolean | false | | Valid is true if UUID is not NULL |
|
||||
| `»» media_type` | string | false | | |
|
||||
| `»» name` | string | false | | |
|
||||
| `»» parsed_commands` | array | false | | Parsed commands holds parsed programs from an execute tool call's shell command, one entry per simple command in source order. Each entry is [program] or [program, arg] where arg is the first non-flag positional argument. Only populated when ToolName is "execute" and the command parses successfully; nil otherwise. |
|
||||
| `»» provider_executed` | boolean | false | | Provider executed indicates the tool call was executed by the provider (e.g. Anthropic computer use). |
|
||||
| `»» provider_metadata` | array | false | | Provider metadata holds provider-specific response metadata (e.g. Anthropic cache control hints) as raw JSON. Internal only: stripped by db2sdk before API responses. |
|
||||
| `»» result` | array | false | | |
|
||||
@@ -456,6 +462,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -584,6 +595,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -863,6 +879,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -1045,6 +1066,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -1173,6 +1199,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -1436,6 +1467,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -1564,6 +1600,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -1688,6 +1729,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -1766,6 +1812,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -1896,6 +1947,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -1973,6 +2029,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -2101,6 +2162,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -2287,6 +2353,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -2361,6 +2432,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -2424,6 +2500,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -2674,6 +2755,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -2802,6 +2888,11 @@ Experimental: this endpoint is subject to change.
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
|
||||
Generated
+76
@@ -2308,6 +2308,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -2436,6 +2441,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -2889,6 +2899,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -2980,6 +2995,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -3029,6 +3049,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
| `mcp_server_config_id` | [uuid.NullUUID](#uuidnulluuid) | false | | |
|
||||
| `media_type` | string | false | | |
|
||||
| `name` | string | false | | |
|
||||
| `parsed_commands` | array of array | false | | Parsed commands holds parsed programs from an execute tool call's shell command, one entry per simple command in source order. Each entry is [program] or [program, arg] where arg is the first non-flag positional argument. Only populated when ToolName is "execute" and the command parses successfully; nil otherwise. |
|
||||
| `provider_executed` | boolean | false | | Provider executed indicates the tool call was executed by the provider (e.g. Anthropic computer use). |
|
||||
| `provider_metadata` | array of integer | false | | Provider metadata holds provider-specific response metadata (e.g. Anthropic cache control hints) as raw JSON. Internal only: stripped by db2sdk before API responses. |
|
||||
| `result` | array of integer | false | | |
|
||||
@@ -3145,6 +3166,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -3223,6 +3249,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -3441,6 +3472,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -3602,6 +3638,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -3676,6 +3717,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -3739,6 +3785,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -3850,6 +3901,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -4063,6 +4119,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -4507,6 +4568,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -4584,6 +4650,11 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
@@ -7014,6 +7085,11 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
},
|
||||
"media_type": "string",
|
||||
"name": "string",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"string"
|
||||
]
|
||||
],
|
||||
"provider_executed": true,
|
||||
"provider_metadata": [
|
||||
0
|
||||
|
||||
Reference in New Issue
Block a user