feat(agent/agentcontainers): add devcontainers list endpoint (#17389)

This change allows listing both predefined and runtime-detected
devcontainers, as well as showing whether or not the devcontainer is
running and which container represents it.

Fixes coder/internal#478
This commit is contained in:
Mathias Fredriksson
2025-04-15 17:53:37 +03:00
committed by GitHub
parent c8c4de5f7a
commit 00b5f56734
5 changed files with 487 additions and 19 deletions

View File

@ -392,6 +392,12 @@ func (c *Client) WorkspaceAgentListeningPorts(ctx context.Context, agentID uuid.
return listeningPorts, json.NewDecoder(res.Body).Decode(&listeningPorts)
}
// WorkspaceAgentDevcontainersResponse is the response to the devcontainers
// request.
type WorkspaceAgentDevcontainersResponse struct {
Devcontainers []WorkspaceAgentDevcontainer `json:"devcontainers"`
}
// WorkspaceAgentDevcontainer defines the location of a devcontainer
// configuration in a workspace that is visible to the workspace agent.
type WorkspaceAgentDevcontainer struct {
@ -399,6 +405,10 @@ type WorkspaceAgentDevcontainer struct {
Name string `json:"name"`
WorkspaceFolder string `json:"workspace_folder"`
ConfigPath string `json:"config_path,omitempty"`
// Additional runtime fields.
Running bool `json:"running"`
Container *WorkspaceAgentContainer `json:"container,omitempty"`
}
// WorkspaceAgentContainer describes a devcontainer of some sort