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:
Generated
+127
@@ -8057,6 +8057,45 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/workspaceagents/me/app-status": {
|
||||
"patch": {
|
||||
"security": [
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Agents"
|
||||
],
|
||||
"summary": "Patch workspace agent app status",
|
||||
"operationId": "patch-workspace-agent-app-status",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "app status",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/agentsdk.PatchAppStatus"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/workspaceagents/me/external-auth": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -10245,6 +10284,29 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"agentsdk.PatchAppStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"app_slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"icon": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"needs_user_attention": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAppStatusState"
|
||||
},
|
||||
"uri": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"agentsdk.PatchLogs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -16273,6 +16335,9 @@ const docTemplate = `{
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"latest_app_status": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAppStatus"
|
||||
},
|
||||
"latest_build": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceBuild"
|
||||
},
|
||||
@@ -16872,6 +16937,13 @@ const docTemplate = `{
|
||||
"description": "Slug is a unique identifier within the agent.",
|
||||
"type": "string"
|
||||
},
|
||||
"statuses": {
|
||||
"description": "Statuses is a list of statuses for the app.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAppStatus"
|
||||
}
|
||||
},
|
||||
"subdomain": {
|
||||
"description": "Subdomain denotes whether the app should be accessed via a path on the\n` + "`" + `coder server` + "`" + ` or via a hostname-based dev URL. If this is set to true\nand there is no app wildcard configured on the server, the app will not\nbe accessible in the UI.",
|
||||
"type": "boolean"
|
||||
@@ -16925,6 +16997,61 @@ const docTemplate = `{
|
||||
"WorkspaceAppSharingLevelPublic"
|
||||
]
|
||||
},
|
||||
"codersdk.WorkspaceAppStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"app_id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"icon": {
|
||||
"description": "Icon is an external URL to an icon that will be rendered in the UI.",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"needs_user_attention": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAppStatusState"
|
||||
},
|
||||
"uri": {
|
||||
"description": "URI is the URI of the resource that the status is for.\ne.g. https://github.com/org/repo/pull/123\ne.g. file:///path/to/file",
|
||||
"type": "string"
|
||||
},
|
||||
"workspace_id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.WorkspaceAppStatusState": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"working",
|
||||
"complete",
|
||||
"failure"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"WorkspaceAppStatusStateWorking",
|
||||
"WorkspaceAppStatusStateComplete",
|
||||
"WorkspaceAppStatusStateFailure"
|
||||
]
|
||||
},
|
||||
"codersdk.WorkspaceBuild": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Generated
+117
@@ -7122,6 +7122,39 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/workspaceagents/me/app-status": {
|
||||
"patch": {
|
||||
"security": [
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
],
|
||||
"consumes": ["application/json"],
|
||||
"produces": ["application/json"],
|
||||
"tags": ["Agents"],
|
||||
"summary": "Patch workspace agent app status",
|
||||
"operationId": "patch-workspace-agent-app-status",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "app status",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/agentsdk.PatchAppStatus"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/workspaceagents/me/external-auth": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -9080,6 +9113,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"agentsdk.PatchAppStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"app_slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"icon": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"needs_user_attention": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAppStatusState"
|
||||
},
|
||||
"uri": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"agentsdk.PatchLogs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -14819,6 +14875,9 @@
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"latest_app_status": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAppStatus"
|
||||
},
|
||||
"latest_build": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceBuild"
|
||||
},
|
||||
@@ -15392,6 +15451,13 @@
|
||||
"description": "Slug is a unique identifier within the agent.",
|
||||
"type": "string"
|
||||
},
|
||||
"statuses": {
|
||||
"description": "Statuses is a list of statuses for the app.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAppStatus"
|
||||
}
|
||||
},
|
||||
"subdomain": {
|
||||
"description": "Subdomain denotes whether the app should be accessed via a path on the\n`coder server` or via a hostname-based dev URL. If this is set to true\nand there is no app wildcard configured on the server, the app will not\nbe accessible in the UI.",
|
||||
"type": "boolean"
|
||||
@@ -15433,6 +15499,57 @@
|
||||
"WorkspaceAppSharingLevelPublic"
|
||||
]
|
||||
},
|
||||
"codersdk.WorkspaceAppStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"app_id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"icon": {
|
||||
"description": "Icon is an external URL to an icon that will be rendered in the UI.",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"needs_user_attention": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAppStatusState"
|
||||
},
|
||||
"uri": {
|
||||
"description": "URI is the URI of the resource that the status is for.\ne.g. https://github.com/org/repo/pull/123\ne.g. file:///path/to/file",
|
||||
"type": "string"
|
||||
},
|
||||
"workspace_id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.WorkspaceAppStatusState": {
|
||||
"type": "string",
|
||||
"enum": ["working", "complete", "failure"],
|
||||
"x-enum-varnames": [
|
||||
"WorkspaceAppStatusStateWorking",
|
||||
"WorkspaceAppStatusStateComplete",
|
||||
"WorkspaceAppStatusStateFailure"
|
||||
]
|
||||
},
|
||||
"codersdk.WorkspaceBuild": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in New Issue
Block a user