mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add experimental agents support (#22290)
feat: add AI chat system with agent tools and chat UI Introduce the chatd subsystem and Agents UI for AI-powered chat within Coder workspaces. - Add chatd package with chat loop, message compaction, prompt management, and LLM provider integration (OpenAI, Anthropic) - Add agent tools: create workspace, list/read templates, read/write/ edit files, execute commands - Add chat API endpoints with streaming, message editing, and durable reconnection - Add database schema and migrations for chats, chat messages, chat providers, and chat model configs - Add RBAC policies and dbauthz enforcement for chat resources - Add Agents UI pages with conversation timeline, queued messages list, diff viewer, and model configuration panel - Add comprehensive test coverage including coderd integration tests, chatd unit tests, and Storybook stories - Gate feature behind experiments flag --------- Co-authored-by: Cian Johnston <cian@coder.com> Co-authored-by: Danielle Maywood <danielle@themaywoods.com> Co-authored-by: Jeremy Ruppel <jeremy@coder.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Cian Johnston
Danielle Maywood
Jeremy Ruppel
Claude Sonnet 4.6
parent
67da4e8b56
commit
edee917d88
+114
@@ -0,0 +1,114 @@
|
||||
INSERT INTO chat_providers (
|
||||
id,
|
||||
provider,
|
||||
display_name,
|
||||
api_key,
|
||||
api_key_key_id,
|
||||
enabled,
|
||||
created_at,
|
||||
updated_at
|
||||
) VALUES (
|
||||
'0a8b2f84-b5a8-4c44-8c9f-e58c44a534a7',
|
||||
'openai',
|
||||
'OpenAI',
|
||||
'',
|
||||
NULL,
|
||||
TRUE,
|
||||
'2024-01-01 00:00:00+00',
|
||||
'2024-01-01 00:00:00+00'
|
||||
);
|
||||
|
||||
INSERT INTO chat_model_configs (
|
||||
id,
|
||||
provider,
|
||||
model,
|
||||
display_name,
|
||||
enabled,
|
||||
context_limit,
|
||||
compression_threshold,
|
||||
created_at,
|
||||
updated_at
|
||||
) VALUES (
|
||||
'9af5f8d5-6a57-4505-8a69-3d6c787b95fd',
|
||||
'openai',
|
||||
'gpt-5.2',
|
||||
'GPT 5.2',
|
||||
TRUE,
|
||||
200000,
|
||||
70,
|
||||
'2024-01-01 00:00:00+00',
|
||||
'2024-01-01 00:00:00+00'
|
||||
);
|
||||
|
||||
INSERT INTO chats (
|
||||
id,
|
||||
owner_id,
|
||||
last_model_config_id,
|
||||
title,
|
||||
status,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
SELECT
|
||||
'72c0438a-18eb-4688-ab80-e4c6a126ef96',
|
||||
id,
|
||||
'9af5f8d5-6a57-4505-8a69-3d6c787b95fd',
|
||||
'Fixture Chat',
|
||||
'completed',
|
||||
'2024-01-01 00:00:00+00',
|
||||
'2024-01-01 00:00:00+00'
|
||||
FROM users
|
||||
ORDER BY created_at, id
|
||||
LIMIT 1;
|
||||
|
||||
INSERT INTO chat_messages (
|
||||
chat_id,
|
||||
created_at,
|
||||
role,
|
||||
content
|
||||
) VALUES (
|
||||
'72c0438a-18eb-4688-ab80-e4c6a126ef96',
|
||||
'2024-01-01 00:00:00+00',
|
||||
'assistant',
|
||||
'{"type":"text","text":"fixture"}'::jsonb
|
||||
);
|
||||
|
||||
INSERT INTO chat_diff_statuses (
|
||||
chat_id,
|
||||
url,
|
||||
pull_request_state,
|
||||
changes_requested,
|
||||
additions,
|
||||
deletions,
|
||||
changed_files,
|
||||
refreshed_at,
|
||||
stale_at,
|
||||
created_at,
|
||||
updated_at,
|
||||
git_branch,
|
||||
git_remote_origin
|
||||
) VALUES (
|
||||
'72c0438a-18eb-4688-ab80-e4c6a126ef96',
|
||||
'https://example.com/pr/1',
|
||||
'open',
|
||||
FALSE,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
'2024-01-01 00:00:00+00',
|
||||
'2024-01-01 00:00:00+00',
|
||||
'2024-01-01 00:00:00+00',
|
||||
'2024-01-01 00:00:00+00',
|
||||
'main',
|
||||
'origin'
|
||||
);
|
||||
|
||||
INSERT INTO chat_queued_messages (
|
||||
chat_id,
|
||||
content,
|
||||
created_at
|
||||
) VALUES (
|
||||
'72c0438a-18eb-4688-ab80-e4c6a126ef96',
|
||||
'{"type":"text","text":"queued fixture"}'::jsonb,
|
||||
'2024-01-01 00:00:00+00'
|
||||
);
|
||||
Reference in New Issue
Block a user