feat: add Cmd/Ctrl+Enter send setting (#25062)

Adds an Agents General setting to require Cmd/Ctrl+Enter before sending
chat messages. When enabled, plain Enter inserts a newline in agent chat
inputs while the send button remains available.

The preference is now persisted server-side through
`/api/v2/users/{user}/preferences`, alongside the existing user
preference settings, and is applied to both the create-agent input and
existing chat composer. Storybook and API coverage verify the setting,
keyboard behavior, validation, and persistence.

<details>
<summary>Coder Agents notes</summary>

Generated by Coder Agents from a Slack request. Dogfooded with
agent-browser against the Storybook settings and chat input stories.

</details>
This commit is contained in:
Thomas Kosiewski
2026-05-12 10:09:34 +02:00
committed by GitHub
parent 376fc80451
commit 5c3b59151e
32 changed files with 720 additions and 63 deletions
+28 -10
View File
@@ -1412,6 +1412,20 @@
|-----------|--------|----------|--------------|-------------|
| `license` | string | true | | |
## codersdk.AgentChatSendShortcut
```json
"enter"
```
### Properties
#### Enumerated Values
| Value(s) |
|---------------------------|
| `enter`, `modifier_enter` |
## codersdk.AgentConnectionTiming
```json
@@ -12867,6 +12881,7 @@ Restarts will only happen on weekdays in this list on weeks which line up with W
```json
{
"agent_chat_send_shortcut": "enter",
"code_diff_display_mode": "auto",
"task_notification_alert_dismissed": true,
"thinking_display_mode": "auto"
@@ -12875,11 +12890,12 @@ Restarts will only happen on weekdays in this list on weeks which line up with W
### Properties
| Name | Type | Required | Restrictions | Description |
|-------------------------------------|--------------------------------------------------------------|----------|--------------|-------------|
| `code_diff_display_mode` | [codersdk.AgentDisplayMode](#codersdkagentdisplaymode) | false | | |
| `task_notification_alert_dismissed` | boolean | false | | |
| `thinking_display_mode` | [codersdk.ThinkingDisplayMode](#codersdkthinkingdisplaymode) | false | | |
| Name | Type | Required | Restrictions | Description |
|-------------------------------------|------------------------------------------------------------------|----------|--------------|-------------|
| `agent_chat_send_shortcut` | [codersdk.AgentChatSendShortcut](#codersdkagentchatsendshortcut) | false | | |
| `code_diff_display_mode` | [codersdk.AgentDisplayMode](#codersdkagentdisplaymode) | false | | |
| `task_notification_alert_dismissed` | boolean | false | | |
| `thinking_display_mode` | [codersdk.ThinkingDisplayMode](#codersdkthinkingdisplaymode) | false | | |
## codersdk.UpdateUserProfileRequest
@@ -13455,6 +13471,7 @@ If the schedule is empty, the user will be updated to use the default schedule.|
```json
{
"agent_chat_send_shortcut": "enter",
"code_diff_display_mode": "auto",
"task_notification_alert_dismissed": true,
"thinking_display_mode": "auto"
@@ -13463,11 +13480,12 @@ If the schedule is empty, the user will be updated to use the default schedule.|
### Properties
| Name | Type | Required | Restrictions | Description |
|-------------------------------------|--------------------------------------------------------------|----------|--------------|-------------|
| `code_diff_display_mode` | [codersdk.AgentDisplayMode](#codersdkagentdisplaymode) | false | | |
| `task_notification_alert_dismissed` | boolean | false | | |
| `thinking_display_mode` | [codersdk.ThinkingDisplayMode](#codersdkthinkingdisplaymode) | false | | |
| Name | Type | Required | Restrictions | Description |
|-------------------------------------|------------------------------------------------------------------|----------|--------------|-------------|
| `agent_chat_send_shortcut` | [codersdk.AgentChatSendShortcut](#codersdkagentchatsendshortcut) | false | | |
| `code_diff_display_mode` | [codersdk.AgentDisplayMode](#codersdkagentdisplaymode) | false | | |
| `task_notification_alert_dismissed` | boolean | false | | |
| `thinking_display_mode` | [codersdk.ThinkingDisplayMode](#codersdkthinkingdisplaymode) | false | | |
## codersdk.UserQuietHoursScheduleConfig
+3
View File
@@ -1301,6 +1301,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/preferences \
```json
{
"agent_chat_send_shortcut": "enter",
"code_diff_display_mode": "auto",
"task_notification_alert_dismissed": true,
"thinking_display_mode": "auto"
@@ -1333,6 +1334,7 @@ curl -X PUT http://coder-server:8080/api/v2/users/{user}/preferences \
```json
{
"agent_chat_send_shortcut": "enter",
"code_diff_display_mode": "auto",
"task_notification_alert_dismissed": true,
"thinking_display_mode": "auto"
@@ -1352,6 +1354,7 @@ curl -X PUT http://coder-server:8080/api/v2/users/{user}/preferences \
```json
{
"agent_chat_send_shortcut": "enter",
"code_diff_display_mode": "auto",
"task_notification_alert_dismissed": true,
"thinking_display_mode": "auto"