Kyle Carberry
075dfecd12
refactor: consolidate experimental chats API types (#23143)
## Summary
Consolidates three areas of type duplication in the experimental chats
API:
### 1. Merge archive/unarchive into `PATCH /{chat}`
- **Before:** `POST /{chat}/archive` + `POST /{chat}/unarchive` (two
endpoints, two handlers with mirrored logic)
- **After:** `PATCH /{chat}` accepting `{ "archived": true/false }` via
`UpdateChatRequest`
- Removes one endpoint and ~30 lines of duplicated handler code
### 2. Collapse identical request/response prompt types
- `ChatSystemPromptResponse` + `UpdateChatSystemPromptRequest` →
`ChatSystemPrompt`
- `UserChatCustomPromptResponse` + `UpdateUserChatCustomPromptRequest` →
`UserChatCustomPrompt`
- These pairs were field-for-field identical (single string field)
### 3. Merge duplicate reasoning options types
- `ChatModelOpenRouterReasoningOptions` +
`ChatModelVercelReasoningOptions` → `ChatModelReasoningOptions`
- Same 4 fields, same types — only field ordering and enum value sets
differed
- Unified type uses the superset of enum values
### Files changed
- `codersdk/chats.go` — SDK types and client methods
- `coderd/chats.go` — Handler consolidation
- `coderd/coderd.go` — Route change
- `coderd/chats_test.go` — Test updates
- `site/src/api/api.ts` — Frontend API client
- `site/src/api/queries/chats.ts` — Query mutations
- `site/src/api/queries/chats.test.ts` — Test mocks
- `site/src/pages/AgentsPage/AgentsPage.tsx` — Call site
- Generated files (`typesGenerated.ts`,
`chatModelOptionsGenerated.json`)
### Testing
- All Go tests pass (`TestArchiveChat`, `TestUnarchiveChat`,
`TestChatSystemPrompt`)
- All frontend tests pass (31/31 in `chats.test.ts`)
2026-03-17 14:31:11 +00:00
..
2026-03-04 21:52:22 +04:00
2025-05-13 11:24:51 -05:00
2025-06-20 13:16:55 -06:00
2026-03-10 18:46:01 +00:00
2026-03-16 16:17:33 +00:00
2026-03-16 16:17:33 +00:00
2026-01-08 15:24:11 +04:00
2026-02-17 15:43:02 +01:00
2025-10-23 20:22:51 +03:00
2026-03-03 16:34:33 +03:00
2025-10-09 14:53:08 +02:00
2025-10-09 14:53:08 +02:00
2026-02-27 16:50:56 +00:00
2026-02-24 15:27:03 +00:00
2026-03-16 15:30:25 -05:00
2024-07-29 19:58:48 -05:00
2026-03-17 01:24:03 +01:00
2026-03-17 14:31:11 +00:00
2025-06-24 13:06:02 +02:00
2026-01-08 15:24:11 +04:00
2026-03-04 21:57:23 -05:00
2025-09-15 12:30:17 +10:00
2025-07-30 13:42:39 -07:00
2024-11-15 12:05:21 -06:00
2025-08-29 10:41:32 +02:00
2025-04-15 10:55:30 +02:00
2026-03-13 14:09:39 +00:00
2025-06-20 13:16:55 -06:00
2026-02-20 09:01:00 -06:00
2026-03-13 20:37:41 -07:00
2025-12-15 17:41:47 +00:00
2024-01-31 14:49:55 +01:00
2025-02-18 13:06:19 +01:00
2025-07-07 11:01:17 -06:00
2025-01-31 12:14:24 -07:00
2025-03-31 09:40:24 -03:00
2025-08-19 10:41:33 +02:00
2026-03-04 12:54:39 +02:00
2026-02-20 12:56:00 +11:00
2025-06-20 13:16:55 -06:00
2026-01-09 15:40:26 -07:00
2026-03-06 10:48:58 +00:00
2026-01-15 12:41:28 +03:00
2026-02-23 12:18:44 +01:00
2025-10-06 13:58:37 +02:00
2025-06-20 13:16:55 -06:00
2023-01-13 12:27:21 +01:00
2026-02-03 14:10:49 -06:00
2025-07-02 15:05:42 +00:00
2025-07-28 15:02:26 +01:00
2026-03-02 19:32:36 +11:00
2026-02-27 16:50:56 +00:00
2025-02-27 06:23:18 -05:00
2023-01-29 15:47:24 -06:00
2025-05-29 08:55:19 -05:00
2025-06-20 13:16:55 -06:00
2026-02-03 14:10:49 -06:00
2025-10-27 17:14:16 -06:00
2025-09-26 11:43:32 +02:00
2024-02-14 17:14:49 +00:00
2026-02-13 19:44:50 -05:00
2024-07-24 14:11:29 +10:00
2026-01-08 15:24:11 +04:00
2025-08-19 10:41:33 +02:00
2025-06-20 13:16:55 -06:00
2022-08-25 19:10:42 +03:00
2023-01-29 15:47:24 -06:00
2024-09-10 20:55:50 +10:00
2026-03-11 10:19:08 -07:00
2024-12-19 00:51:30 +04:00
2024-12-19 00:51:30 +04:00
2025-06-16 16:15:59 -06:00
2026-02-06 15:52:54 +00:00
2026-03-06 10:47:55 +01:00
2025-09-10 11:01:54 -05:00
2026-02-17 15:11:04 +00:00
2025-06-20 13:16:55 -06:00
2022-11-08 17:12:06 +00:00
2026-01-08 15:24:11 +04:00
2026-03-13 20:37:41 -07:00
2026-03-04 11:14:52 -07:00