mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: chatd refactor (#26270)
Implements the chatd stabilization RFC. Combines: - https://github.com/coder/coder/pull/25908 - https://github.com/coder/coder/pull/25923 - https://github.com/coder/coder/pull/26109 - https://github.com/coder/coder/pull/26110 - https://github.com/coder/coder/pull/26111 - https://github.com/coder/coder/pull/26112
This commit is contained in:
Generated
+318
-2
@@ -300,7 +300,7 @@ Status Code **200**
|
||||
| `kind` | `auth`, `config`, `generic`, `missing_key`, `overloaded`, `provider_disabled`, `rate_limit`, `stream_silence_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` |
|
||||
| `status` | `completed`, `error`, `interrupting`, `paused`, `pending`, `requires_action`, `running`, `waiting` |
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
@@ -2279,6 +2279,319 @@ message in the chat.
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Reconcile invalid chat state
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X POST http://coder-server:8080/api/experimental/chats/{chat}/reconcile-invalid \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Coder-Session-Token: API_KEY'
|
||||
```
|
||||
|
||||
`POST /api/experimental/chats/{chat}/reconcile-invalid`
|
||||
|
||||
Experimental: this endpoint is subject to change.
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | In | Type | Required | Description |
|
||||
|--------|------|--------------|----------|-------------|
|
||||
| `chat` | path | string(uuid) | true | Chat ID |
|
||||
|
||||
### Example responses
|
||||
|
||||
> 200 Response
|
||||
|
||||
```json
|
||||
{
|
||||
"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",
|
||||
"completed_at": "2019-08-24T14:15:22Z",
|
||||
"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",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"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",
|
||||
"owner_name": "string",
|
||||
"owner_username": "string",
|
||||
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
||||
"pin_order": 0,
|
||||
"plan_mode": "plan",
|
||||
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
||||
"shared": true,
|
||||
"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",
|
||||
"completed_at": "2019-08-24T14:15:22Z",
|
||||
"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",
|
||||
"parsed_commands": [
|
||||
[
|
||||
"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",
|
||||
"owner_name": "string",
|
||||
"owner_username": "string",
|
||||
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
||||
"pin_order": 0,
|
||||
"plan_mode": "plan",
|
||||
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
||||
"shared": true,
|
||||
"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](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Chat](schemas.md#codersdkchat) |
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Stream chat events via WebSockets
|
||||
|
||||
### Code samples
|
||||
@@ -2406,6 +2719,8 @@ Experimental: this endpoint is subject to change.
|
||||
}
|
||||
},
|
||||
"message_part": {
|
||||
"generation_attempt": 0,
|
||||
"history_version": 0,
|
||||
"part": {
|
||||
"args": [
|
||||
0
|
||||
@@ -2468,7 +2783,8 @@ Experimental: this endpoint is subject to change.
|
||||
"type": "text",
|
||||
"url": "string"
|
||||
},
|
||||
"role": "system"
|
||||
"role": "system",
|
||||
"seq": 0
|
||||
},
|
||||
"queued_messages": [
|
||||
{
|
||||
|
||||
Generated
+21
-12
@@ -3256,9 +3256,9 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
|
||||
#### Enumerated Values
|
||||
|
||||
| Value(s) |
|
||||
|------------------------------------------------------------------------------------|
|
||||
| `completed`, `error`, `paused`, `pending`, `requires_action`, `running`, `waiting` |
|
||||
| Value(s) |
|
||||
|----------------------------------------------------------------------------------------------------|
|
||||
| `completed`, `error`, `interrupting`, `paused`, `pending`, `requires_action`, `running`, `waiting` |
|
||||
|
||||
## codersdk.ChatStreamActionRequired
|
||||
|
||||
@@ -3384,6 +3384,8 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
}
|
||||
},
|
||||
"message_part": {
|
||||
"generation_attempt": 0,
|
||||
"history_version": 0,
|
||||
"part": {
|
||||
"args": [
|
||||
0
|
||||
@@ -3446,7 +3448,8 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
"type": "text",
|
||||
"url": "string"
|
||||
},
|
||||
"role": "system"
|
||||
"role": "system",
|
||||
"seq": 0
|
||||
},
|
||||
"queued_messages": [
|
||||
{
|
||||
@@ -3560,14 +3563,16 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
|
||||
#### Enumerated Values
|
||||
|
||||
| Value(s) |
|
||||
|------------------------------------------------------------------------------------------|
|
||||
| `action_required`, `error`, `message`, `message_part`, `queue_update`, `retry`, `status` |
|
||||
| Value(s) |
|
||||
|----------------------------------------------------------------------------------------------------------------------------|
|
||||
| `action_required`, `error`, `history_reset`, `message`, `message_part`, `preview_reset`, `queue_update`, `retry`, `status` |
|
||||
|
||||
## codersdk.ChatStreamMessagePart
|
||||
|
||||
```json
|
||||
{
|
||||
"generation_attempt": 0,
|
||||
"history_version": 0,
|
||||
"part": {
|
||||
"args": [
|
||||
0
|
||||
@@ -3630,16 +3635,20 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
"type": "text",
|
||||
"url": "string"
|
||||
},
|
||||
"role": "system"
|
||||
"role": "system",
|
||||
"seq": 0
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|--------|------------------------------------------------------|----------|--------------|-------------|
|
||||
| `part` | [codersdk.ChatMessagePart](#codersdkchatmessagepart) | false | | |
|
||||
| `role` | [codersdk.ChatMessageRole](#codersdkchatmessagerole) | false | | |
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|----------------------|------------------------------------------------------|----------|--------------|-------------|
|
||||
| `generation_attempt` | integer | false | | |
|
||||
| `history_version` | integer | false | | |
|
||||
| `part` | [codersdk.ChatMessagePart](#codersdkchatmessagepart) | false | | |
|
||||
| `role` | [codersdk.ChatMessageRole](#codersdkchatmessagerole) | false | | |
|
||||
| `seq` | integer | false | | |
|
||||
|
||||
## codersdk.ChatStreamRetry
|
||||
|
||||
|
||||
Reference in New Issue
Block a user