Follow-up to #25004. The merged change cycles only through messages
already loaded in the in-memory chat store (page size 50). Long chats
and chats whose oldest turns have rolled out of the page lose access to
their earlier prompts in the composer's up/down arrow cycle. This PR
adds a dedicated server endpoint that returns the full prompt history,
newest first, and rewires the composer to use it.
## What changed
### Endpoint
`GET /api/experimental/chats/{chat}/prompts?limit=N`
```go
type ChatPrompt struct { ID int64; Text string }
type ChatPromptsResponse struct { Prompts []ChatPrompt }
```
- `limit`: `0..2000`. `0` (the default) is treated as the server-side
default of 500; out-of-range values return `400`. Negative values are
rejected by the SDK's `PositiveInt32` parser before reaching the
handler.
- Auth: parent-chat read in `dbauthz`, mirroring
`GetChatMessagesByChatID`.
- The SQL filters `role='user'`, `deleted=false`, `visibility IN
('user','both')`, guards the lateral with `jsonb_typeof(content) =
'array'` so legacy V0 scalar-string rows are silently skipped, then
unrolls `content` JSONB with `WITH ORDINALITY` and concatenates only
`type='text'` parts in original order via `string_agg(... ORDER BY
ordinality)`. Messages whose joined text is whitespace-only are dropped
via `HAVING ... ~ '\S'` so cycling never lands on a blank entry.
### Partial index (migration `000494`)
```sql
CREATE INDEX idx_chat_messages_user_prompts
ON chat_messages (chat_id, id DESC)
WHERE deleted = false
AND role = 'user'
AND visibility IN ('user', 'both');
```
The partial WHERE matches the query's filter exactly and the key order
matches `ORDER BY id DESC`, so the planner gets both the filter and the
ordering from the index without a sort step.
`EXPLAIN ANALYZE` on a synthetic 51-chat × 5,000-message dataset (≈260k
rows, 10k user prompts in the target chat, `random_page_cost=1.1`):
| | Plan | Buffers hit | Time |
|---|---|---|---|
| Without index | `Index Scan Backward using chat_messages_pkey`,
**250,848 rows removed by filter** | 6,683 | 32.4 ms |
| With index | `Index Scan using idx_chat_messages_user_prompts`, no
filter | 38 | 1.3 ms |
≈25× faster, 175× fewer buffer hits.
### Frontend
- `chatPromptsKey` / `chatPromptsQuery` factories in
`site/src/api/queries/chats.ts` (`staleTime: 30s`, `enabled: chatId !==
""`, asks the server for 500 prompts).
- `ChatPageContent.tsx` replaces the in-memory derivation with
`useQuery(chatPromptsQuery(chatId ?? ""))`. The composer's existing
`cycleHistorySnapshotRef` anchors the in-flight cycle so a refetch
arriving mid-cycle cannot shift the indexed prompt out from under the
user.
- `getEditableUserMessagePayload` now concatenates user-message text
parts verbatim, mirroring the server's `string_agg(part->>'text', ''
ORDER BY ordinality)`, instead of routing through the streaming-oriented
`parseMessageContent` / `appendText` pipeline (which drops
whitespace-only chunks — correct for assistant streams, wrong for a
user's persisted message). This keeps the cycle and the edit path in
agreement on the same message. File blocks are still pulled separately
via
`parseMessageContent(...).blocks.filter(isEditableUserMessageFileBlock)`.
- Cache invalidation in `createChatMessage.onSuccess`,
`editChatMessage.onSettled`, and `useChatStore.upsertCacheMessages`
(only when an upserted message has `role === "user"`).
- Page-level stories pre-seed `chatPromptsKey(CHAT_ID)` from the same
`messagesData` to keep them offline.
## Tests
- New `TestGetChatUserPrompts` in `coderd/exp_chats_test.go` with five
subtests:
- `NewestFirstFiltering` — multi-part concatenation, non-text parts
skipped, whitespace-only filtered, soft-deleted excluded, `model`-only
visibility excluded, assistant-role excluded by `cm.role = 'user'`,
legacy V0 scalar row silently excluded by the `jsonb_typeof` guard,
ordering newest first.
- `LimitClampsResults` — explicit `limit=2` returns the two newest
prompts.
- `InvalidLimitRejected` — `limit=5000` is `400 Bad Request`.
- `NotFoundForOtherUsers` — a separate user in the same org gets `404`,
not the prompts.
- `EmptyResultIsJSONArray` — zero-message chat and assistant-only chat
both return `Prompts: []` (non-nil, empty).
- New unit test in `messageParsing.test.ts` asserting that
`getEditableUserMessagePayload(["hello", " ", "world"])` returns `"hello
world"`, locking in the agreement with the SQL `string_agg`.
- `dbauthz_test.go` adds the
`MethodTestSuite.TestChats/GetChatUserPromptsByChatID` entry, asserting
parent-chat `policy.ActionRead`.
- `pnpm test src/pages/AgentsPage` — 1159 passed, 2 skipped.
- `make gen` produces no diff.
## Manual verification
Seeded a dev chat with Claude Sonnet 4.6 via the aibridge Anthropic
provider and posted 20 user prompts end-to-end. Verified that the
`/prompts` endpoint returns 20 rows newest-first, that `limit=10` clamps
correctly, that `limit=0` uses the server default of 500, and that the
up/down keyboard cycle in the composer walks the same sequence (and
reverses correctly back to the empty draft).
## Out of scope
- Cross-chat history.
- Per-user opt-out for the cycle.
- File-reference / attachment cycling — the cycle continues to reproduce
plain text only, by design.
<details>
<summary>Implementation plan</summary>
# CODAGT-319 Follow-up — Dedicated `/prompts` endpoint
## Context
The merged feature ([#25004](https://github.com/coder/coder/pull/25004)
/ [d32842f](https://github.com/coder/coder/commit/d32842f)) cycles only
through messages already loaded in the in-memory chat store, which is
capped at the first 50 messages of the current page. Long chats and
chats whose oldest turns have rolled out of the page can no longer
recall their full prompt history. This follow-up exposes a dedicated
server endpoint that returns the user-authored prompts in a chat, newest
first, and rewires the composer to use it.
## Design
### Endpoint
`GET /api/experimental/chats/{chat}/prompts?limit=N`
Returns:
```go
type ChatPrompt struct {
ID int64
Text string
}
type ChatPromptsResponse struct {
Prompts []ChatPrompt
}
```
- `limit`: `0..2000`. `0` (the default) → server-side default of 500.
The wire-level default is encoded in SQL as `COALESCE(NULLIF($limit, 0),
500)`. Negatives are rejected upstream by `PositiveInt32`; the handler
only caps the upper bound.
- Auth: parent-chat read in `dbauthz`, mirroring
`GetChatMessagesByChatID`.
- Listed under the experimental router so we can iterate without API
guarantees.
### SQL
The query lives in `coderd/database/queries/chats.sql` as
`GetChatUserPromptsByChatID`:
- Filters `role='user'`, `deleted=false`, `visibility IN
('user','both')` to mirror the composer's "what the user actually typed
and can re-send" contract.
- Guards the lateral with `jsonb_typeof(content) = 'array'` so legacy V0
rows whose content is a scalar JSON string (predates migration `000434`)
are silently excluded instead of raising `"cannot extract elements from
a scalar"`.
- Unrolls `content` JSONB with `jsonb_array_elements WITH ORDINALITY`
and concatenates only `type='text'` parts, preserving original order via
`string_agg(... ORDER BY ordinality)`.
- Casts the result to `text` so sqlc emits a `string` field instead of
`[]byte`.
- Drops whitespace-only prompts via `HAVING string_agg(...) ~ '\S'` so
cycling never lands on a blank entry.
- Orders by `cm.id DESC` (`id` is a sequence, so this is "newest first"
without relying on `created_at`).
### Index
New partial index added in migration `000494`:
```sql
CREATE INDEX idx_chat_messages_user_prompts
ON chat_messages (chat_id, id DESC)
WHERE deleted = false
AND role = 'user'
AND visibility IN ('user', 'both');
```
The partial WHERE clause matches the query's filter exactly, so the
planner can use the index for both filtering and ordering without a sort
step.
### Frontend
- `chatPromptsKey(chatId)` and `chatPromptsQuery(chatId)` factories in
`site/src/api/queries/chats.ts`. `staleTime: 30s`, `enabled: chatId !==
""`. Asks the server for 500 prompts (well below the 2000 max, plenty
for the cycle).
- `ChatPageContent.tsx` replaces the in-memory derivation with
`useQuery(chatPromptsQuery(chatId ?? ""))`. The composer's
`cycleHistorySnapshotRef` already takes a stable snapshot at cycle
entry, so a refetch arriving mid-cycle cannot shift the indexed prompt
out from under the user.
- `getEditableUserMessagePayload` extracts the edit-path text from raw
user-message parts (filter `type === "text"`, join verbatim) instead of
going through `parseMessageContent` / `appendText`, which is built for
assistant streams and intentionally drops whitespace-only chunks.
Without this, cycling and clicking Edit on the same message could
produce different draft text for messages with whitespace-only
interleaved text parts.
- Cache invalidation: `createChatMessage.onSuccess`,
`editChatMessage.onSettled`, and `useChatStore.upsertCacheMessages`
(when at least one upserted message has `role === "user"`) all
invalidate `chatPromptsKey(chatId)`.
### Tests
- `TestGetChatUserPrompts` (`coderd/exp_chats_test.go`) covers:
- `NewestFirstFiltering` — multi-part concatenation, non-text parts
skipped, whitespace-only filtered, soft-deleted excluded, `model`-only
visibility excluded, assistant-role excluded by `cm.role = 'user'`,
legacy V0 scalar row silently excluded by the `jsonb_typeof` guard,
ordering newest first.
- `LimitClampsResults` — explicit `limit=2` returns the two newest
prompts.
- `InvalidLimitRejected` — `limit=5000` is `400 Bad Request`.
- `NotFoundForOtherUsers` — a separate user in the same org gets `404`,
not the prompts.
- `EmptyResultIsJSONArray` — zero-message chat and assistant-only chat
both return `Prompts: []` (non-nil, empty).
- `messageParsing.test.ts` adds a unit test asserting that
`getEditableUserMessagePayload(["hello", " ", "world"])` returns `"hello
world"`, locking in the agreement with the SQL `string_agg`.
- `dbauthz_test.go` adds the
`MethodTestSuite.TestChats/GetChatUserPromptsByChatID` entry, asserting
the parent-chat `policy.ActionRead`.
## Out of scope
- Cross-chat history.
- Per-user opt-out for the cycle.
- File-reference / attachment cycling — the cycle still reproduces plain
text only, by design.
</details>
<details>
<summary>coder-agents-review history</summary>
Four review rounds, eight unique findings, all addressed in this PR
(approved twice). Rebased onto `main` twice after R4: first to pick up
new migrations `000491` / `000492`, then again for
`000493_idx_chat_diff_statuses_url_lower`. The prompts-index migration
was renumbered `000491 → 000493 → 000494` via
`coderd/database/migrations/fix_migration_numbers.sh`; no other diff
changes.
| Round | Head | Outcome |
|---|---|---|
| R1 | `725422ab` | `COMMENTED` — 7 findings (DEREM-1..7) |
| R2 | `ab2a8936` | `COMMENTED` — 1 new (DEREM-10) + 1 reraised
(DEREM-5) |
| R3 | `648c5d1f` | **`APPROVED`** — 7 fixed, DEREM-5 deferred via
#25125 |
| R4 | `93b6f450` | **`APPROVED`** — DEREM-5 also fixed in-PR, #25125
closed |
| ID | Where | Resolution |
|---|---|---|
| DEREM-1 | `chats.sql` | Added `jsonb_typeof(content) = 'array'` guard
against V0 scalar rows |
| DEREM-2 | `exp_chats.go` | Removed dead `limit < 0` branch (SDK
rejects upstream) |
| DEREM-3 | `useChatStore.ts` | Rewrote misleading invalidation comment
|
| DEREM-4 | `exp_chats_test.go` | `NewestFirstFiltering` now inserts an
assistant-role message so the `role='user'` filter is exercised
end-to-end |
| DEREM-5 | `messageParsing.ts` | Rewrote
`getEditableUserMessagePayload` to concatenate text parts verbatim,
mirroring the SQL `string_agg` |
| DEREM-6 | `exp_chats.go` | Tightened swagger doc + error message to
spell out the 0–2000 range |
| DEREM-7 | `exp_chats_test.go` | Added `EmptyResultIsJSONArray` subtest
|
| DEREM-10 | `exp_chats_test.go` | `NewestFirstFiltering` now inserts a
raw V0 scalar-content row; verified locally that removing the guard
makes the test fail |
</details>
---
This PR was created on behalf of @ibetitsmike by Coder Agents.
118 KiB
Generated
Chats
List chats
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats
Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
q |
query | string | false | Search query. Supports archived:bool and diff_url: terms (quote URLs). |
label |
query | string | false | Filter by label as key:value. Repeat for multiple (AND logic). |
Example responses
200 Response
[
{
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"archived": true,
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
"children": [
{}
],
"client_type": "ui",
"created_at": "2019-08-24T14:15:22Z",
"diff_status": {
"additions": 0,
"approved": true,
"author_avatar_url": "string",
"author_login": "string",
"base_branch": "string",
"changed_files": 0,
"changes_requested": true,
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"commits": 0,
"deletions": 0,
"head_branch": "string",
"pr_number": 0,
"pull_request_draft": true,
"pull_request_state": "string",
"pull_request_title": "string",
"refreshed_at": "2019-08-24T14:15:22Z",
"reviewer_count": 0,
"stale_at": "2019-08-24T14:15:22Z",
"url": "string"
},
"files": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mime_type": "string",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"
}
],
"has_unread": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"labels": {
"property1": "string",
"property2": "string"
},
"last_error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"last_injected_context": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
"last_turn_summary": "string",
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
"pin_order": 0,
"plan_mode": "plan",
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
"status": "waiting",
"title": "string",
"updated_at": "2019-08-24T14:15:22Z",
"warnings": [
"string"
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | array of codersdk.Chat |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
[array item] |
array | false | ||
» agent_id |
string(uuid) | false | ||
» archived |
boolean | false | ||
» build_id |
string(uuid) | false | ||
» children |
codersdk.Chat | false | Children holds child (subagent) chats nested under this root chat. Always initialized to an empty slice so the JSON field is present as []. Child chats cannot create their own subagents, so nesting depth is capped at 1 and this slice is always empty for child chats. | |
» client_type |
codersdk.ChatClientType | false | ||
» created_at |
string(date-time) | false | ||
» diff_status |
codersdk.ChatDiffStatus | false | ||
»» additions |
integer | false | ||
»» approved |
boolean | false | ||
»» author_avatar_url |
string | false | ||
»» author_login |
string | false | ||
»» base_branch |
string | false | ||
»» changed_files |
integer | false | ||
»» changes_requested |
boolean | false | ||
»» chat_id |
string(uuid) | false | ||
»» commits |
integer | false | ||
»» deletions |
integer | false | ||
»» head_branch |
string | false | ||
»» pr_number |
integer | false | ||
»» pull_request_draft |
boolean | false | ||
»» pull_request_state |
string | false | ||
»» pull_request_title |
string | false | ||
»» refreshed_at |
string(date-time) | false | ||
»» reviewer_count |
integer | false | ||
»» stale_at |
string(date-time) | false | ||
»» url |
string | false | ||
» files |
array | false | ||
»» created_at |
string(date-time) | false | ||
»» id |
string(uuid) | false | ||
»» mime_type |
string | false | ||
»» name |
string | false | ||
»» organization_id |
string(uuid) | false | ||
»» owner_id |
string(uuid) | false | ||
» has_unread |
boolean | false | Has unread is true when assistant messages exist beyond the owner's read cursor, which updates on stream connect and disconnect. | |
» id |
string(uuid) | false | ||
» labels |
object | false | ||
»» [any property] |
string | false | ||
» last_error |
codersdk.ChatError | false | ||
»» detail |
string | false | Detail is optional provider-specific context shown alongside the normalized error message when available. | |
»» kind |
codersdk.ChatErrorKind | false | Kind classifies the error for consistent client rendering. | |
»» message |
string | false | Message is the normalized, user-facing error message. | |
»» provider |
string | false | Provider identifies the upstream model provider when known. | |
»» retryable |
boolean | false | Retryable reports whether the underlying error is transient. | |
»» status_code |
integer | false | Status code is the best-effort upstream HTTP status code. | |
» last_injected_context |
array | false | Last injected context holds the most recently persisted injected context parts (AGENTS.md files and skills). It is updated only when context changes, on first workspace attach or agent change. | |
»» args |
array | false | ||
»» args_delta |
string | false | ||
»» content |
string | false | The code content from the diff that was commented on. | |
»» context_file_agent_id |
uuid.NullUUID | false | Context file agent ID is the workspace agent that provided this context file. Used to detect when the agent changes (e.g. workspace rebuilt) so instruction files can be re-persisted with fresh content. | |
»»» uuid |
string | false | ||
»»» valid |
boolean | false | Valid is true if UUID is not NULL | |
»» context_file_content |
string | false | Context file content holds the file content sent to the LLM. Internal only: stripped before API responses to keep payloads small. The backend reads it when building the prompt via partsToMessageParts. | |
»» context_file_directory |
string | false | Context file directory is the working directory of the workspace agent. Internal only: same purpose as ContextFileOS. | |
»» context_file_os |
string | false | Context file os is the operating system of the workspace agent. Internal only: used during prompt expansion so the LLM knows the OS even on turns where InsertSystem is not called. | |
»» context_file_path |
string | false | Context file path is the absolute path of a file loaded into the LLM context (e.g. an AGENTS.md instruction file). | |
»» context_file_skill_meta_file |
string | false | Context file skill meta file is the basename of the skill meta file (e.g. "SKILL.md") at the time of persistence. Internal only: restored on subsequent turns so the read_skill tool uses the correct filename even when the agent configured a non-default value. | |
»» context_file_truncated |
boolean | false | Context file truncated indicates the file exceeded the 64KiB instruction file limit and was truncated. | |
»» created_at |
string(date-time) | false | Created at records when this part was produced. Present on tool-call and tool-result parts so the frontend can compute tool execution duration. | |
»» data |
array | false | ||
»» end_line |
integer | false | ||
»» file_id |
uuid.NullUUID | false | ||
»»» uuid |
string | false | ||
»»» valid |
boolean | false | Valid is true if UUID is not NULL | |
»» file_name |
string | false | ||
»» is_error |
boolean | false | ||
»» is_media |
boolean | false | ||
»» mcp_server_config_id |
uuid.NullUUID | false | ||
»»» uuid |
string | false | ||
»»» valid |
boolean | false | Valid is true if UUID is not NULL | |
»» media_type |
string | false | ||
»» name |
string | false | ||
»» 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 | ||
»» result_delta |
string | false | ||
»» result_reset |
boolean | false | ||
»» signature |
string | false | ||
»» skill_description |
string | false | Skill description is the short description from the skill's SKILL.md frontmatter. | |
»» skill_dir |
string | false | Skill dir is the absolute path to the skill directory inside the workspace filesystem. Internal only: used by read_skill/read_skill_file tools to locate skill files. | |
»» skill_name |
string | false | Skill name is the kebab-case name of a discovered skill from the workspace's .agents/skills/ directory. | |
»» source_id |
string | false | ||
»» start_line |
integer | false | ||
»» text |
string | false | ||
»» title |
string | false | ||
»» tool_call_id |
string | false | ||
»» tool_name |
string | false | ||
»» type |
codersdk.ChatMessagePartType | false | ||
»» url |
string | false | ||
» last_model_config_id |
string(uuid) | false | ||
» last_turn_summary |
string | false | ||
» mcp_server_ids |
array | false | ||
» organization_id |
string(uuid) | false | ||
» owner_id |
string(uuid) | false | ||
» parent_chat_id |
string(uuid) | false | ||
» pin_order |
integer | false | ||
» plan_mode |
codersdk.ChatPlanMode | false | ||
» root_chat_id |
string(uuid) | false | ||
» status |
codersdk.ChatStatus | false | ||
» title |
string | false | ||
» updated_at |
string(date-time) | false | ||
» warnings |
array | false | ||
» workspace_id |
string(uuid) | false |
Enumerated Values
| Property | Value(s) |
|---|---|
client_type |
api, ui |
kind |
auth, config, generic, overloaded, rate_limit, startup_timeout, timeout, usage_limit |
type |
context-file, file, file-reference, reasoning, skill, source, text, tool-call, tool-result |
plan_mode |
plan |
status |
completed, error, paused, pending, requires_action, running, waiting |
To perform this operation, you must be authenticated. Learn more.
Create chat
Code samples
# Example request using curl
curl -X POST http://coder-server:8080/api/experimental/chats \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
POST /api/experimental/chats
Experimental: this endpoint is subject to change.
Body parameter
{
"client_type": "ui",
"content": [
{
"content": "string",
"end_line": 0,
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
"file_name": "string",
"start_line": 0,
"text": "string",
"type": "text"
}
],
"labels": {
"property1": "string",
"property2": "string"
},
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"plan_mode": "plan",
"system_prompt": "string",
"unsafe_dynamic_tools": [
{
"description": "string",
"input_schema": [
0
],
"name": "string"
}
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
body |
body | codersdk.CreateChatRequest | true | Create chat request |
Example responses
201 Response
{
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"archived": true,
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
"children": [
{
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"archived": true,
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
"children": [],
"client_type": "ui",
"created_at": "2019-08-24T14:15:22Z",
"diff_status": {
"additions": 0,
"approved": true,
"author_avatar_url": "string",
"author_login": "string",
"base_branch": "string",
"changed_files": 0,
"changes_requested": true,
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"commits": 0,
"deletions": 0,
"head_branch": "string",
"pr_number": 0,
"pull_request_draft": true,
"pull_request_state": "string",
"pull_request_title": "string",
"refreshed_at": "2019-08-24T14:15:22Z",
"reviewer_count": 0,
"stale_at": "2019-08-24T14:15:22Z",
"url": "string"
},
"files": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mime_type": "string",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"
}
],
"has_unread": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"labels": {
"property1": "string",
"property2": "string"
},
"last_error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"last_injected_context": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
"last_turn_summary": "string",
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
"pin_order": 0,
"plan_mode": "plan",
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
"status": "waiting",
"title": "string",
"updated_at": "2019-08-24T14:15:22Z",
"warnings": [
"string"
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
],
"client_type": "ui",
"created_at": "2019-08-24T14:15:22Z",
"diff_status": {
"additions": 0,
"approved": true,
"author_avatar_url": "string",
"author_login": "string",
"base_branch": "string",
"changed_files": 0,
"changes_requested": true,
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"commits": 0,
"deletions": 0,
"head_branch": "string",
"pr_number": 0,
"pull_request_draft": true,
"pull_request_state": "string",
"pull_request_title": "string",
"refreshed_at": "2019-08-24T14:15:22Z",
"reviewer_count": 0,
"stale_at": "2019-08-24T14:15:22Z",
"url": "string"
},
"files": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mime_type": "string",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"
}
],
"has_unread": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"labels": {
"property1": "string",
"property2": "string"
},
"last_error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"last_injected_context": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
"last_turn_summary": "string",
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
"pin_order": 0,
"plan_mode": "plan",
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
"status": "waiting",
"title": "string",
"updated_at": "2019-08-24T14:15:22Z",
"warnings": [
"string"
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 201 | Created | Created | codersdk.Chat |
To perform this operation, you must be authenticated. Learn more.
Upload chat file
Code samples
# Example request using curl
curl -X POST http://coder-server:8080/api/experimental/chats/files?organization=497f6eca-6276-4993-bfeb-53cbbbba6f08 \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
POST /api/experimental/chats/files
Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
organization |
query | string(uuid) | true | Organization ID |
Example responses
201 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 201 | Created | Created | codersdk.UploadChatFileResponse |
To perform this operation, you must be authenticated. Learn more.
Get chat file
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats/files/{file} \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats/files/{file}
Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
file |
path | string(uuid) | true | File ID |
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK |
To perform this operation, you must be authenticated. Learn more.
List chat models
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats/models \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats/models
Experimental: this endpoint is subject to change.
Example responses
200 Response
{
"providers": [
{
"available": true,
"models": [
{
"display_name": "string",
"id": "string",
"model": "string",
"provider": "string"
}
],
"provider": "string",
"unavailable_reason": "missing_api_key"
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.ChatModelsResponse |
To perform this operation, you must be authenticated. Learn more.
Watch chat events for a user via WebSockets
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats/watch \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats/watch
Experimental: this endpoint is subject to change.
Example responses
200 Response
{
"chat": {
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"archived": true,
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
"children": [
{}
],
"client_type": "ui",
"created_at": "2019-08-24T14:15:22Z",
"diff_status": {
"additions": 0,
"approved": true,
"author_avatar_url": "string",
"author_login": "string",
"base_branch": "string",
"changed_files": 0,
"changes_requested": true,
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"commits": 0,
"deletions": 0,
"head_branch": "string",
"pr_number": 0,
"pull_request_draft": true,
"pull_request_state": "string",
"pull_request_title": "string",
"refreshed_at": "2019-08-24T14:15:22Z",
"reviewer_count": 0,
"stale_at": "2019-08-24T14:15:22Z",
"url": "string"
},
"files": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mime_type": "string",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"
}
],
"has_unread": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"labels": {
"property1": "string",
"property2": "string"
},
"last_error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"last_injected_context": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
"last_turn_summary": "string",
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
"pin_order": 0,
"plan_mode": "plan",
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
"status": "waiting",
"title": "string",
"updated_at": "2019-08-24T14:15:22Z",
"warnings": [
"string"
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
},
"kind": "status_change",
"tool_calls": [
{
"args": "string",
"tool_call_id": "string",
"tool_name": "string"
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.ChatWatchEvent |
To perform this operation, you must be authenticated. Learn more.
Get chat by ID
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats/{chat} \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats/{chat}
Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
Example responses
200 Response
{
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"archived": true,
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
"children": [
{
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"archived": true,
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
"children": [],
"client_type": "ui",
"created_at": "2019-08-24T14:15:22Z",
"diff_status": {
"additions": 0,
"approved": true,
"author_avatar_url": "string",
"author_login": "string",
"base_branch": "string",
"changed_files": 0,
"changes_requested": true,
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"commits": 0,
"deletions": 0,
"head_branch": "string",
"pr_number": 0,
"pull_request_draft": true,
"pull_request_state": "string",
"pull_request_title": "string",
"refreshed_at": "2019-08-24T14:15:22Z",
"reviewer_count": 0,
"stale_at": "2019-08-24T14:15:22Z",
"url": "string"
},
"files": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mime_type": "string",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"
}
],
"has_unread": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"labels": {
"property1": "string",
"property2": "string"
},
"last_error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"last_injected_context": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
"last_turn_summary": "string",
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
"pin_order": 0,
"plan_mode": "plan",
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
"status": "waiting",
"title": "string",
"updated_at": "2019-08-24T14:15:22Z",
"warnings": [
"string"
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
],
"client_type": "ui",
"created_at": "2019-08-24T14:15:22Z",
"diff_status": {
"additions": 0,
"approved": true,
"author_avatar_url": "string",
"author_login": "string",
"base_branch": "string",
"changed_files": 0,
"changes_requested": true,
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"commits": 0,
"deletions": 0,
"head_branch": "string",
"pr_number": 0,
"pull_request_draft": true,
"pull_request_state": "string",
"pull_request_title": "string",
"refreshed_at": "2019-08-24T14:15:22Z",
"reviewer_count": 0,
"stale_at": "2019-08-24T14:15:22Z",
"url": "string"
},
"files": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mime_type": "string",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"
}
],
"has_unread": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"labels": {
"property1": "string",
"property2": "string"
},
"last_error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"last_injected_context": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
"last_turn_summary": "string",
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
"pin_order": 0,
"plan_mode": "plan",
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
"status": "waiting",
"title": "string",
"updated_at": "2019-08-24T14:15:22Z",
"warnings": [
"string"
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.Chat |
To perform this operation, you must be authenticated. Learn more.
Update chat
Code samples
# Example request using curl
curl -X PATCH http://coder-server:8080/api/experimental/chats/{chat} \
-H 'Content-Type: application/json' \
-H 'Coder-Session-Token: API_KEY'
PATCH /api/experimental/chats/{chat}
Experimental: this endpoint is subject to change.
Body parameter
{
"archived": true,
"labels": {
"property1": "string",
"property2": "string"
},
"pin_order": 0,
"plan_mode": "plan",
"title": "string",
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
body |
body | codersdk.UpdateChatRequest | true | Update chat request |
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 204 | No Content | No Content |
To perform this operation, you must be authenticated. Learn more.
Get chat diff contents
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats/{chat}/diff \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats/{chat}/diff
Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
Example responses
200 Response
{
"branch": "string",
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"diff": "string",
"provider": "string",
"pull_request_url": "string",
"remote_origin": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.ChatDiffContents |
To perform this operation, you must be authenticated. Learn more.
Interrupt chat
Code samples
# Example request using curl
curl -X POST http://coder-server:8080/api/experimental/chats/{chat}/interrupt \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
POST /api/experimental/chats/{chat}/interrupt
Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
Example responses
200 Response
{
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"archived": true,
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
"children": [
{
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"archived": true,
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
"children": [],
"client_type": "ui",
"created_at": "2019-08-24T14:15:22Z",
"diff_status": {
"additions": 0,
"approved": true,
"author_avatar_url": "string",
"author_login": "string",
"base_branch": "string",
"changed_files": 0,
"changes_requested": true,
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"commits": 0,
"deletions": 0,
"head_branch": "string",
"pr_number": 0,
"pull_request_draft": true,
"pull_request_state": "string",
"pull_request_title": "string",
"refreshed_at": "2019-08-24T14:15:22Z",
"reviewer_count": 0,
"stale_at": "2019-08-24T14:15:22Z",
"url": "string"
},
"files": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mime_type": "string",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"
}
],
"has_unread": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"labels": {
"property1": "string",
"property2": "string"
},
"last_error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"last_injected_context": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
"last_turn_summary": "string",
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
"pin_order": 0,
"plan_mode": "plan",
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
"status": "waiting",
"title": "string",
"updated_at": "2019-08-24T14:15:22Z",
"warnings": [
"string"
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
],
"client_type": "ui",
"created_at": "2019-08-24T14:15:22Z",
"diff_status": {
"additions": 0,
"approved": true,
"author_avatar_url": "string",
"author_login": "string",
"base_branch": "string",
"changed_files": 0,
"changes_requested": true,
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"commits": 0,
"deletions": 0,
"head_branch": "string",
"pr_number": 0,
"pull_request_draft": true,
"pull_request_state": "string",
"pull_request_title": "string",
"refreshed_at": "2019-08-24T14:15:22Z",
"reviewer_count": 0,
"stale_at": "2019-08-24T14:15:22Z",
"url": "string"
},
"files": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mime_type": "string",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"
}
],
"has_unread": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"labels": {
"property1": "string",
"property2": "string"
},
"last_error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"last_injected_context": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
"last_turn_summary": "string",
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
"pin_order": 0,
"plan_mode": "plan",
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
"status": "waiting",
"title": "string",
"updated_at": "2019-08-24T14:15:22Z",
"warnings": [
"string"
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.Chat |
To perform this operation, you must be authenticated. Learn more.
List chat messages
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats/{chat}/messages \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats/{chat}/messages
Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
before_id |
query | integer | false | Return messages with id < before_id |
after_id |
query | integer | false | Return messages with id > after_id |
limit |
query | integer | false | Page size, 1 to 200. Defaults to 50. |
Example responses
200 Response
{
"has_more": true,
"messages": [
{
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"content": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
"id": 0,
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
"role": "system",
"usage": {
"cache_creation_tokens": 0,
"cache_read_tokens": 0,
"context_limit": 0,
"input_tokens": 0,
"output_tokens": 0,
"reasoning_tokens": 0,
"total_tokens": 0
}
}
],
"queued_messages": [
{
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"content": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"created_at": "2019-08-24T14:15:22Z",
"id": 0,
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205"
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.ChatMessagesResponse |
To perform this operation, you must be authenticated. Learn more.
Send chat message
Code samples
# Example request using curl
curl -X POST http://coder-server:8080/api/experimental/chats/{chat}/messages \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
POST /api/experimental/chats/{chat}/messages
Experimental: this endpoint is subject to change.
Body parameter
{
"busy_behavior": "queue",
"content": [
{
"content": "string",
"end_line": 0,
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
"file_name": "string",
"start_line": 0,
"text": "string",
"type": "text"
}
],
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
"plan_mode": "plan"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
body |
body | codersdk.CreateChatMessageRequest | true | Create chat message request |
Example responses
200 Response
{
"message": {
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"content": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
"id": 0,
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
"role": "system",
"usage": {
"cache_creation_tokens": 0,
"cache_read_tokens": 0,
"context_limit": 0,
"input_tokens": 0,
"output_tokens": 0,
"reasoning_tokens": 0,
"total_tokens": 0
}
},
"queued": true,
"queued_message": {
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"content": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"created_at": "2019-08-24T14:15:22Z",
"id": 0,
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205"
},
"warnings": [
"string"
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.CreateChatMessageResponse |
To perform this operation, you must be authenticated. Learn more.
Edit chat message
Code samples
# Example request using curl
curl -X PATCH http://coder-server:8080/api/experimental/chats/{chat}/messages/{message} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
PATCH /api/experimental/chats/{chat}/messages/{message}
Experimental: this endpoint is subject to change.
Body parameter
{
"content": [
{
"content": "string",
"end_line": 0,
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
"file_name": "string",
"start_line": 0,
"text": "string",
"type": "text"
}
],
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
message |
path | integer | true | Message ID |
body |
body | codersdk.EditChatMessageRequest | true | Edit chat message request |
Example responses
200 Response
{
"message": {
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"content": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
"id": 0,
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
"role": "system",
"usage": {
"cache_creation_tokens": 0,
"cache_read_tokens": 0,
"context_limit": 0,
"input_tokens": 0,
"output_tokens": 0,
"reasoning_tokens": 0,
"total_tokens": 0
}
},
"warnings": [
"string"
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.EditChatMessageResponse |
To perform this operation, you must be authenticated. Learn more.
List chat user prompts
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats/{chat}/prompts \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats/{chat}/prompts
Experimental: this endpoint is subject to change.
Returns the user-authored prompts in a chat, newest first, with each prompt's text parts concatenated in the order they were authored. Used by the composer to power the up/down arrow prompt-history cycle without paging through every message in the chat.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
limit |
query | integer | false | Page size, 0 to 2000. 0 (the default) means the server-side default of 500. |
Example responses
200 Response
{
"prompts": [
{
"id": 0,
"text": "string"
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.ChatPromptsResponse |
To perform this operation, you must be authenticated. Learn more.
Stream chat events via WebSockets
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats/{chat}/stream \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats/{chat}/stream
Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
Example responses
200 Response
{
"action_required": {
"tool_calls": [
{
"args": "string",
"tool_call_id": "string",
"tool_name": "string"
}
]
},
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"message": {
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"content": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
"id": 0,
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
"role": "system",
"usage": {
"cache_creation_tokens": 0,
"cache_read_tokens": 0,
"context_limit": 0,
"input_tokens": 0,
"output_tokens": 0,
"reasoning_tokens": 0,
"total_tokens": 0
}
},
"message_part": {
"part": {
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
},
"role": "system"
},
"queued_messages": [
{
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"content": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"created_at": "2019-08-24T14:15:22Z",
"id": 0,
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205"
}
],
"retry": {
"attempt": 0,
"delay_ms": 0,
"error": "string",
"kind": "generic",
"provider": "string",
"retrying_at": "2019-08-24T14:15:22Z",
"status_code": 0
},
"status": {
"status": "waiting"
},
"type": "message_part"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.ChatStreamEvent |
To perform this operation, you must be authenticated. Learn more.
Connect to chat workspace desktop via WebSockets
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats/{chat}/stream/desktop \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats/{chat}/stream/desktop
Raw binary WebSocket stream of the chat workspace desktop. Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 101 | Switching Protocols | Switching Protocols |
To perform this operation, you must be authenticated. Learn more.
Watch chat workspace git state via WebSockets
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/experimental/chats/{chat}/stream/git \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/experimental/chats/{chat}/stream/git
Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
Example responses
200 Response
{
"message": "string",
"repositories": [
{
"branch": "string",
"remote_origin": "string",
"removed": true,
"repo_root": "string",
"unified_diff": "string"
}
],
"scanned_at": "2019-08-24T14:15:22Z",
"type": "changes"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.WorkspaceAgentGitServerMessage |
To perform this operation, you must be authenticated. Learn more.
Regenerate chat title
Code samples
# Example request using curl
curl -X POST http://coder-server:8080/api/experimental/chats/{chat}/title/regenerate \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
POST /api/experimental/chats/{chat}/title/regenerate
Experimental: this endpoint is subject to change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
chat |
path | string(uuid) | true | Chat ID |
Example responses
200 Response
{
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"archived": true,
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
"children": [
{
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"archived": true,
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
"children": [],
"client_type": "ui",
"created_at": "2019-08-24T14:15:22Z",
"diff_status": {
"additions": 0,
"approved": true,
"author_avatar_url": "string",
"author_login": "string",
"base_branch": "string",
"changed_files": 0,
"changes_requested": true,
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"commits": 0,
"deletions": 0,
"head_branch": "string",
"pr_number": 0,
"pull_request_draft": true,
"pull_request_state": "string",
"pull_request_title": "string",
"refreshed_at": "2019-08-24T14:15:22Z",
"reviewer_count": 0,
"stale_at": "2019-08-24T14:15:22Z",
"url": "string"
},
"files": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mime_type": "string",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"
}
],
"has_unread": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"labels": {
"property1": "string",
"property2": "string"
},
"last_error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"last_injected_context": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
"last_turn_summary": "string",
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
"pin_order": 0,
"plan_mode": "plan",
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
"status": "waiting",
"title": "string",
"updated_at": "2019-08-24T14:15:22Z",
"warnings": [
"string"
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
],
"client_type": "ui",
"created_at": "2019-08-24T14:15:22Z",
"diff_status": {
"additions": 0,
"approved": true,
"author_avatar_url": "string",
"author_login": "string",
"base_branch": "string",
"changed_files": 0,
"changes_requested": true,
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
"commits": 0,
"deletions": 0,
"head_branch": "string",
"pr_number": 0,
"pull_request_draft": true,
"pull_request_state": "string",
"pull_request_title": "string",
"refreshed_at": "2019-08-24T14:15:22Z",
"reviewer_count": 0,
"stale_at": "2019-08-24T14:15:22Z",
"url": "string"
},
"files": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mime_type": "string",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"
}
],
"has_unread": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"labels": {
"property1": "string",
"property2": "string"
},
"last_error": {
"detail": "string",
"kind": "generic",
"message": "string",
"provider": "string",
"retryable": true,
"status_code": 0
},
"last_injected_context": [
{
"args": [
0
],
"args_delta": "string",
"content": "string",
"context_file_agent_id": {
"uuid": "string",
"valid": true
},
"context_file_content": "string",
"context_file_directory": "string",
"context_file_os": "string",
"context_file_path": "string",
"context_file_skill_meta_file": "string",
"context_file_truncated": true,
"created_at": "2019-08-24T14:15:22Z",
"data": [
0
],
"end_line": 0,
"file_id": {
"uuid": "string",
"valid": true
},
"file_name": "string",
"is_error": true,
"is_media": true,
"mcp_server_config_id": {
"uuid": "string",
"valid": true
},
"media_type": "string",
"name": "string",
"provider_executed": true,
"provider_metadata": [
0
],
"result": [
0
],
"result_delta": "string",
"result_reset": true,
"signature": "string",
"skill_description": "string",
"skill_dir": "string",
"skill_name": "string",
"source_id": "string",
"start_line": 0,
"text": "string",
"title": "string",
"tool_call_id": "string",
"tool_name": "string",
"type": "text",
"url": "string"
}
],
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
"last_turn_summary": "string",
"mcp_server_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
"pin_order": 0,
"plan_mode": "plan",
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
"status": "waiting",
"title": "string",
"updated_at": "2019-08-24T14:15:22Z",
"warnings": [
"string"
],
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.Chat |
To perform this operation, you must be authenticated. Learn more.