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:
Kyle Carberry
2025-03-31 10:55:44 -04:00
committed by GitHub
parent 489641d0be
commit 8ea956fc11
35 changed files with 1668 additions and 69 deletions
+25
View File
@@ -3060,6 +3060,7 @@ export interface Workspace {
readonly template_active_version_id: string;
readonly template_require_active_version: boolean;
readonly latest_build: WorkspaceBuild;
readonly latest_app_status: WorkspaceAppStatus | null;
readonly outdated: boolean;
readonly name: string;
readonly autostart_schedule?: string;
@@ -3307,6 +3308,7 @@ export interface WorkspaceApp {
readonly health: WorkspaceAppHealth;
readonly hidden: boolean;
readonly open_in: WorkspaceAppOpenIn;
readonly statuses: readonly WorkspaceAppStatus[];
}
// From codersdk/workspaceapps.go
@@ -3337,6 +3339,29 @@ export const WorkspaceAppSharingLevels: WorkspaceAppSharingLevel[] = [
"public",
];
// From codersdk/workspaceapps.go
export interface WorkspaceAppStatus {
readonly id: string;
readonly created_at: string;
readonly workspace_id: string;
readonly agent_id: string;
readonly app_id: string;
readonly state: WorkspaceAppStatusState;
readonly needs_user_attention: boolean;
readonly message: string;
readonly uri: string;
readonly icon: string;
}
// From codersdk/workspaceapps.go
export type WorkspaceAppStatusState = "complete" | "failure" | "working";
export const WorkspaceAppStatusStates: WorkspaceAppStatusState[] = [
"complete",
"failure",
"working",
];
// From codersdk/workspacebuilds.go
export interface WorkspaceBuild {
readonly id: string;
+2
View File
@@ -913,6 +913,7 @@ export const MockWorkspaceApp: TypesGen.WorkspaceApp = {
},
hidden: false,
open_in: "slim-window",
statuses: [],
};
export const MockWorkspaceAgentLogSource: TypesGen.WorkspaceAgentLogSource = {
@@ -1371,6 +1372,7 @@ export const MockWorkspace: TypesGen.Workspace = {
healthy: true,
failing_agents: [],
},
latest_app_status: null,
automatic_updates: "never",
allow_renames: true,
favorite: false,