chore: add agent-connection-watch for workspaces (#24507)

<!--

If you have used AI to produce some or all of this PR, please ensure you have read our [AI Contribution guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING) before submitting.

-->

relates to GRU-18  
  
Adds basic implementation for Workspace Agent Connection Watch and tests.  
  
Missing are handling of logs.
This commit is contained in:
Spike Curtis
2026-05-20 13:09:11 -04:00
committed by GitHub
parent 05e47b9c0f
commit 8dc4d76890
20 changed files with 1679 additions and 61 deletions
+95
View File
@@ -18616,6 +18616,101 @@ None
| `disable_direct_connections` | boolean | false | | |
| `hostname_suffix` | string | false | | |
## workspacesdk.AgentUpdate
```json
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"lifecycle": "created"
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|-------------|----------------------------------------------------------------------|----------|--------------|-------------|
| `id` | string | false | | |
| `lifecycle` | [codersdk.WorkspaceAgentLifecycle](#codersdkworkspaceagentlifecycle) | false | | |
## workspacesdk.BuildUpdate
```json
{
"job_status": "pending",
"transition": "start"
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|--------------|----------------------------------------------------------------|----------|--------------|-------------|
| `job_status` | [codersdk.ProvisionerJobStatus](#codersdkprovisionerjobstatus) | false | | |
| `transition` | [codersdk.WorkspaceTransition](#codersdkworkspacetransition) | false | | |
## workspacesdk.ConnectionWatchEvent
```json
{
"agent_update": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"lifecycle": "created"
},
"build_update": {
"job_status": "pending",
"transition": "start"
},
"error": {
"code": 0,
"details": "string",
"message": "string",
"retryable": true
}
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|----------------|------------------------------------------------------|----------|--------------|-------------|
| `agent_update` | [workspacesdk.AgentUpdate](#workspacesdkagentupdate) | false | | |
| `build_update` | [workspacesdk.BuildUpdate](#workspacesdkbuildupdate) | false | | |
| `error` | [workspacesdk.WatchError](#workspacesdkwatcherror) | false | | |
## workspacesdk.WatchError
```json
{
"code": 0,
"details": "string",
"message": "string",
"retryable": true
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|-------------|------------------------------------------------------------|----------|--------------|-------------|
| `code` | [workspacesdk.WatchErrorCode](#workspacesdkwatcherrorcode) | false | | |
| `details` | string | false | | |
| `message` | string | false | | |
| `retryable` | boolean | false | | |
## workspacesdk.WatchErrorCode
```json
0
```
### Properties
#### Enumerated Values
| Value(s) |
|-----------------------------------|
| `0`, `1`, `2`, `3`, `4`, `5`, `6` |
## wsproxysdk.CryptoKeysResponse
```json
+50
View File
@@ -1817,6 +1817,56 @@ curl -X PATCH http://coder-server:8080/api/v2/workspaces/{workspace}/acl \
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Workspace Agent Connection Watch
### Code samples
```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace}/agent-connection-watch \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`GET /api/v2/workspaces/{workspace}/agent-connection-watch`
### Parameters
| Name | In | Type | Required | Description |
|-------------|------|--------------|----------|--------------|
| `workspace` | path | string(uuid) | true | Workspace ID |
### Example responses
> 101 Response
```json
{
"agent_update": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"lifecycle": "created"
},
"build_update": {
"job_status": "pending",
"transition": "start"
},
"error": {
"code": 0,
"details": "string",
"message": "string",
"retryable": true
}
}
```
### Responses
| Status | Meaning | Description | Schema |
|--------|--------------------------------------------------------------------------|---------------------|----------------------------------------------------------------------------------|
| 101 | [Switching Protocols](https://tools.ietf.org/html/rfc7231#section-6.2.2) | Switching Protocols | [workspacesdk.ConnectionWatchEvent](schemas.md#workspacesdkconnectionwatchevent) |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Update workspace autostart schedule by ID
### Code samples