mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add app status tracking to the backend (#17163)
This does ~95% of the backend work required to integrate the AI work. Most left to integrate from the tasks branch is just frontend, which will be a lot smaller I believe. The real difference between this branch and that one is the abstraction -- this now attaches statuses to apps, and returns the latest status reported as part of a workspace. This change enables us to have a similar UX to in the tasks branch, but for agents other than Claude Code as well. Any app can report status now.
This commit is contained in:
@@ -581,6 +581,28 @@ func (c *Client) PatchLogs(ctx context.Context, req PatchLogs) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// PatchAppStatus updates the status of a workspace app.
|
||||
type PatchAppStatus struct {
|
||||
AppSlug string `json:"app_slug"`
|
||||
NeedsUserAttention bool `json:"needs_user_attention"`
|
||||
State codersdk.WorkspaceAppStatusState `json:"state"`
|
||||
Message string `json:"message"`
|
||||
URI string `json:"uri"`
|
||||
Icon string `json:"icon"`
|
||||
}
|
||||
|
||||
func (c *Client) PatchAppStatus(ctx context.Context, req PatchAppStatus) error {
|
||||
res, err := c.SDK.Request(ctx, http.MethodPatch, "/api/v2/workspaceagents/me/app-status", req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != http.StatusOK {
|
||||
return codersdk.ReadBodyAsError(res)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PostLogSourceRequest struct {
|
||||
// ID is a unique identifier for the log source.
|
||||
// It is scoped to a workspace agent, and can be statically
|
||||
|
||||
Reference in New Issue
Block a user