{
    "schemes": ["http","https"],
    "swagger": "2.0",
    "info": {
        "description": "Kubernetes-native AI agent orchestrator for managing OpenCode agents.",
        "title": "Cortex API",
        "contact": {
            "name": "Cortex Team",
            "url": "https://github.com/pyck-cortex/cortex"
        },
        "license": {
            "name": "Proprietary"
        },
        "version": "1.0"
    },
    "host": "localhost:8080",
    "basePath": "/api",
    "paths": {
        "/agent-configs": {
            "get": {
                "description": "Returns a list of all agent configurations (global platform resources)",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "agent-configs"
                ],
                "summary": "List all agent configurations",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.AgentConfig"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Creates a new agent configuration (platform admin only)",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "agent-configs"
                ],
                "summary": "Create a new agent configuration",
                "parameters": [
                    {
                        "description": "Agent config creation request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.CreateAgentConfigRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/protocol.AgentConfig"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/agent-configs/{configID}": {
            "get": {
                "description": "Returns an agent configuration by ID",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "agent-configs"
                ],
                "summary": "Get an agent configuration",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent Config ID",
                        "name": "configID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.AgentConfig"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Updates an existing agent configuration (platform admin only)",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "agent-configs"
                ],
                "summary": "Update an agent configuration",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent Config ID",
                        "name": "configID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Agent config update request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.UpdateAgentConfigRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.AgentConfig"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Deletes an agent configuration (platform admin only)",
                "tags": [
                    "agent-configs"
                ],
                "summary": "Delete an agent configuration",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Agent Config ID",
                        "name": "configID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/api/admin/agents/graceful-restart": {
            "post": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Sends a graceful shutdown command to all active agents across all projects.\nEach agent will: (1) notify active users with a message,\n(2) commit all work, (3) shut down cleanly so Kubernetes restarts the pod\nwith the new container image. Requires platform_admin role.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "admin"
                ],
                "summary": "Graceful restart all active agents",
                "parameters": [
                    {
                        "description": "Restart configuration",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.GracefulRestartRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.GracefulRestartResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/api/admin/orgs": {
            "get": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Returns all organizations in the system. Requires platform_admin role.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "admin"
                ],
                "summary": "List all organizations (admin)",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.Organization"
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/api/admin/users": {
            "get": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Returns all users in the system. Requires platform_admin role.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "admin"
                ],
                "summary": "List all users (admin)",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.User"
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/api/config/export": {
            "post": {
                "description": "Exports task definitions, agent configs, and triggers to a git repository",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "config"
                ],
                "summary": "Export configuration to git",
                "parameters": [
                    {
                        "description": "Export parameters",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.ExportRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.ExportResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/api/config/import": {
            "post": {
                "description": "Imports task definitions, agent configs, and triggers from a git repository",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "config"
                ],
                "summary": "Import configuration from git",
                "parameters": [
                    {
                        "description": "Import parameters",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.ImportRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.ImportResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/assist/chat": {
            "post": {
                "description": "Send messages and receive an LLM response with Cortex context",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "assist"
                ],
                "summary": "Chat with LLM assistant",
                "parameters": [
                    {
                        "description": "Chat request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/handlers.ChatRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.ChatResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "502": {
                        "description": "Bad Gateway",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/github/app": {
            "get": {
                "description": "Returns the GitHub App slug and installation URL for the \"Connect GitHub\" flow",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "github"
                ],
                "summary": "Get GitHub App info",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.gitHubAppInfoResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/github/repos": {
            "get": {
                "description": "Lists repositories accessible to the org's GitHub App installation",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "github"
                ],
                "summary": "List GitHub repositories",
                "parameters": [
                    {
                        "type": "integer",
                        "default": 1,
                        "description": "Page number (1-indexed)",
                        "name": "page",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 30,
                        "description": "Results per page (max 100)",
                        "name": "per_page",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.listRepositoriesResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/github/repos/{owner}/{repo}/branches": {
            "get": {
                "description": "Lists branches for a specific repository accessible to the org's GitHub App installation",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "github"
                ],
                "summary": "List branches for a repository",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Repository owner (org or user)",
                        "name": "owner",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Repository name",
                        "name": "repo",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "default": 1,
                        "description": "Page number (1-indexed)",
                        "name": "page",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 30,
                        "description": "Results per page (max 100)",
                        "name": "per_page",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.listBranchesResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/health": {
            "get": {
                "description": "Returns basic health status of the API server",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "health"
                ],
                "summary": "Health check",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.HealthResponse"
                        }
                    }
                }
            }
        },
        "/me": {
            "get": {
                "description": "Returns the authenticated user and their organization memberships",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "me"
                ],
                "summary": "Get current user",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.MeResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/models": {
            "get": {
                "description": "Returns the curated list of LLM models available for agent creation",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "models"
                ],
                "summary": "List available models",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.ModelsResponse"
                        }
                    }
                }
            }
        },
        "/orgs": {
            "get": {
                "description": "Returns all organizations the authenticated user belongs to",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "organizations"
                ],
                "summary": "List organizations",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.Organization"
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Creates a new organization and adds the authenticated user as owner",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "organizations"
                ],
                "summary": "Create an organization",
                "parameters": [
                    {
                        "description": "Organization creation request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.CreateOrganizationRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/protocol.Organization"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/orgs/{orgID}": {
            "get": {
                "description": "Returns an organization by ID (user must be a member)",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "organizations"
                ],
                "summary": "Get an organization",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "orgID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.Organization"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Deletes an organization and all its resources (owner only)",
                "tags": [
                    "organizations"
                ],
                "summary": "Delete an organization",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "orgID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "patch": {
                "description": "Updates an organization (owner only)",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "organizations"
                ],
                "summary": "Update an organization",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "orgID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Organization update request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.UpdateOrganizationRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.Organization"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/orgs/{orgID}/members": {
            "get": {
                "description": "Returns all members of the organization",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "members"
                ],
                "summary": "List organization members",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "orgID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.OrgMember"
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Invites a user to the organization by email (owner only)",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "members"
                ],
                "summary": "Invite a member to the organization",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "orgID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Invite request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.InviteMemberRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/protocol.OrgMember"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/orgs/{orgID}/members/{userID}": {
            "delete": {
                "description": "Removes a member from the organization (owner only)",
                "tags": [
                    "members"
                ],
                "summary": "Remove a member from the organization",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "orgID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "User ID",
                        "name": "userID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "patch": {
                "description": "Updates a member's role in the organization (owner only)",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "members"
                ],
                "summary": "Update a member's role",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Organization ID",
                        "name": "orgID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "User ID",
                        "name": "userID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Role update request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.UpdateMemberRoleRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.OrgMember"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects": {
            "get": {
                "description": "Returns a list of all projects",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "projects"
                ],
                "summary": "List all projects",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.Project"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Creates a new project with optional auto-creation of GitHub repository",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "projects"
                ],
                "summary": "Create a new project",
                "parameters": [
                    {
                        "description": "Project creation request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.CreateProjectRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/protocol.Project"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}": {
            "get": {
                "description": "Returns a project by ID",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "projects"
                ],
                "summary": "Get a project",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.Project"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Deletes a project and optionally its auto-created repository",
                "tags": [
                    "projects"
                ],
                "summary": "Delete a project",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "patch": {
                "description": "Updates an existing project",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "projects"
                ],
                "summary": "Update a project",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Project update request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.UpdateProjectRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.Project"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/activity": {
            "get": {
                "description": "Returns a grouped activity feed for a project showing who changed what and when.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "activity"
                ],
                "summary": "List project activity",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "default": 30,
                        "description": "Maximum number of activity items",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.ActivityItem"
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/agents": {
            "get": {
                "description": "Returns all agents belonging to a project",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "agents"
                ],
                "summary": "List agents for a project",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.Agent"
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Creates a new agent for a project and starts its Kubernetes pod",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "agents"
                ],
                "summary": "Create an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Agent creation request",
                        "name": "request",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/protocol.CreateAgentRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/protocol.Agent"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/agents/{agentID}": {
            "get": {
                "description": "Returns an agent by ID",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "agents"
                ],
                "summary": "Get an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "agentID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.Agent"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Deletes an agent, sending shutdown command and removing its pod",
                "tags": [
                    "agents"
                ],
                "summary": "Delete an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "agentID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted"
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/agents/{agentID}/events": {
            "get": {
                "description": "Returns events for an agent, optionally filtered by event type. Use this to retrieve chat history by filtering for ai.opencode.message.updated and ai.opencode.message.part.updated event types.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "events"
                ],
                "summary": "List events for an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "agentID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Comma-separated event types to filter (e.g., ai.opencode.message.updated,ai.opencode.message.part.updated)",
                        "name": "type",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 100,
                        "description": "Maximum number of events",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.Event"
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/agents/{agentID}/files": {
            "get": {
                "description": "Returns a list of files in the specified directory of the agent's workspace",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "files"
                ],
                "summary": "List files in agent workspace",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "agentID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "default": "/",
                        "description": "Directory path to list",
                        "name": "path",
                        "in": "query"
                    },
                    {
                        "type": "boolean",
                        "default": false,
                        "description": "List files recursively",
                        "name": "recursive",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Glob pattern to filter files (e.g. *.bpmn, *.tsx)",
                        "name": "pattern",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.FileListResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "502": {
                        "description": "Bad Gateway",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/agents/{agentID}/files/{filepath}": {
            "get": {
                "description": "Returns the contents of a file from the agent's workspace",
                "produces": [
                    "application/octet-stream"
                ],
                "tags": [
                    "files"
                ],
                "summary": "Read a file from agent workspace",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "agentID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "File path",
                        "name": "filepath",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "file"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "502": {
                        "description": "Bad Gateway",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Creates or updates a file in the agent's workspace. Returns 201 for new files, 200 for updates.",
                "consumes": [
                    "application/octet-stream"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "files"
                ],
                "summary": "Write a file to agent workspace",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "agentID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "File path",
                        "name": "filepath",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "File content",
                        "name": "file",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.FileInfo"
                        }
                    },
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/protocol.FileInfo"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "502": {
                        "description": "Bad Gateway",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Deletes a file or directory from the agent's workspace",
                "tags": [
                    "files"
                ],
                "summary": "Delete a file from agent workspace",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "agentID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "File path",
                        "name": "filepath",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "boolean",
                        "default": false,
                        "description": "Delete directory recursively",
                        "name": "recursive",
                        "in": "query"
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "502": {
                        "description": "Bad Gateway",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/agents/{agentID}/schedule": {
            "get": {
                "description": "Get the active wakeup schedule for an agent",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "agents"
                ],
                "summary": "Get agent schedule",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "agentID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.AgentScheduleResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/agents/{agentID}/tasks/{slug}/execute": {
            "post": {
                "description": "Executes a task definition on the specified agent",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "execute"
                ],
                "summary": "Execute a task on an agent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "agentID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Task Definition Slug",
                        "name": "slug",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Task execution parameters",
                        "name": "request",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/protocol.ExecuteTaskRequest"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted",
                        "schema": {
                            "$ref": "#/definitions/protocol.ExecuteTaskResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/results": {
            "get": {
                "description": "Returns task results for a project, optionally filtered by task slug",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "task-results"
                ],
                "summary": "List task results for a project",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Task slug to filter by",
                        "name": "task",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "default": 100,
                        "description": "Maximum number of results",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.TaskResult"
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/tasks/{slug}/results": {
            "get": {
                "description": "Returns task results for a specific task in a project",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "task-results"
                ],
                "summary": "List task results for a specific task",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Task Definition Slug",
                        "name": "slug",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "default": 100,
                        "description": "Maximum number of results",
                        "name": "limit",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.TaskResult"
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/tasks/{slug}/results/latest": {
            "get": {
                "description": "Returns the most recent task result for a specific task in a project",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "task-results"
                ],
                "summary": "Get the latest task result",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Task Definition Slug",
                        "name": "slug",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.TaskResult"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/tasks/{slug}/results/{resultID}": {
            "get": {
                "description": "Returns a specific task result by ID",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "task-results"
                ],
                "summary": "Get a specific task result",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Task Definition Slug",
                        "name": "slug",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Task Result ID",
                        "name": "resultID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.TaskResult"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Deletes a specific task result by ID",
                "tags": [
                    "task-results"
                ],
                "summary": "Delete a task result",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Task Definition Slug",
                        "name": "slug",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Task Result ID",
                        "name": "resultID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/triggers": {
            "get": {
                "description": "Returns all enabled task triggers that apply to a project (global + project-specific)",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "triggers"
                ],
                "summary": "List task triggers for a project",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.TaskTriggerResponse"
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Creates a new task trigger for a project",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "triggers"
                ],
                "summary": "Create a task trigger",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Trigger creation request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.CreateTaskTriggerRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/protocol.TaskTriggerResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/projects/{projectID}/triggers/{id}": {
            "delete": {
                "description": "Deletes a task trigger",
                "tags": [
                    "triggers"
                ],
                "summary": "Delete a task trigger",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Trigger ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "patch": {
                "description": "Updates a project-specific task trigger",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "triggers"
                ],
                "summary": "Update a task trigger",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Trigger ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Trigger update request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.UpdateTaskTriggerRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.TaskTriggerResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/ready": {
            "get": {
                "description": "Returns readiness status including dependency health",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "health"
                ],
                "summary": "Readiness check",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/handlers.HealthResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.HealthResponse"
                        }
                    }
                }
            }
        },
        "/sites/{projectID}/{agentID}/{filepath}": {
            "get": {
                "description": "Proxies requests to the agent's static file server for serving HTML, CSS, JS, and other static assets",
                "produces": [
                    "text/html"
                ],
                "tags": [
                    "sites"
                ],
                "summary": "Serve static site content",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Project ID",
                        "name": "projectID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Agent ID",
                        "name": "agentID",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "File path within the static directory",
                        "name": "filepath",
                        "in": "path"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "file"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "502": {
                        "description": "Bad Gateway",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "503": {
                        "description": "Service Unavailable",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/tasks": {
            "get": {
                "description": "Returns a list of all task definitions (global platform resources)",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tasks"
                ],
                "summary": "List all task definitions",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.TaskDefinition"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Creates a new task definition (platform admin only)",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tasks"
                ],
                "summary": "Create a new task definition",
                "parameters": [
                    {
                        "description": "Task definition creation request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.CreateTaskDefinitionRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/protocol.TaskDefinition"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/tasks/{slug}": {
            "get": {
                "description": "Returns a task definition by slug",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tasks"
                ],
                "summary": "Get a task definition",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Task Definition Slug",
                        "name": "slug",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.TaskDefinition"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "Updates an existing task definition (platform admin only)",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "tasks"
                ],
                "summary": "Update a task definition",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Task Definition Slug",
                        "name": "slug",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Task definition update request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.UpdateTaskDefinitionRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.TaskDefinition"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "Deletes a task definition (platform admin only)",
                "tags": [
                    "tasks"
                ],
                "summary": "Delete a task definition",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Task Definition Slug",
                        "name": "slug",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/triggers": {
            "get": {
                "description": "Returns all enabled global task triggers",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "triggers"
                ],
                "summary": "List global task triggers",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/protocol.TaskTriggerResponse"
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "Creates a new global task trigger that fires for all projects",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "triggers"
                ],
                "summary": "Create a global task trigger",
                "parameters": [
                    {
                        "description": "Trigger creation request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.CreateTaskTriggerRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/protocol.TaskTriggerResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        },
        "/triggers/{id}": {
            "delete": {
                "description": "Deletes a global task trigger",
                "tags": [
                    "triggers"
                ],
                "summary": "Delete a global task trigger",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Trigger ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            },
            "patch": {
                "description": "Updates a global task trigger",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "triggers"
                ],
                "summary": "Update a global task trigger",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Trigger ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Trigger update request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/protocol.UpdateTaskTriggerRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/protocol.TaskTriggerResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/handlers.ErrorResponse"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "handlers.ChatMessage": {
            "type": "object",
            "required": [
                "content",
                "role"
            ],
            "properties": {
                "content": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                }
            }
        },
        "handlers.ChatRequest": {
            "type": "object",
            "required": [
                "messages"
            ],
            "properties": {
                "messages": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.ChatMessage"
                    }
                },
                "model": {
                    "type": "string"
                },
                "system": {
                    "type": "string"
                }
            }
        },
        "handlers.ChatResponse": {
            "type": "object",
            "required": [
                "message",
                "token_usage"
            ],
            "properties": {
                "message": {
                    "$ref": "#/definitions/handlers.ChatMessage"
                },
                "token_usage": {
                    "$ref": "#/definitions/handlers.TokenUsage"
                }
            }
        },
        "handlers.ConfigChange": {
            "type": "object",
            "required": [
                "action",
                "id",
                "kind"
            ],
            "properties": {
                "action": {
                    "description": "create, update, delete, export",
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "kind": {
                    "type": "string"
                }
            }
        },
        "handlers.ErrorResponse": {
            "type": "object",
            "required": [
                "error"
            ],
            "properties": {
                "error": {
                    "type": "string"
                }
            }
        },
        "handlers.ExportRequest": {
            "type": "object",
            "properties": {
                "branch": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                }
            }
        },
        "handlers.ExportResponse": {
            "type": "object",
            "required": [
                "changes"
            ],
            "properties": {
                "changes": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.ConfigChange"
                    }
                },
                "commit_sha": {
                    "type": "string"
                }
            }
        },
        "handlers.FileListResponse": {
            "type": "object",
            "required": [
                "files",
                "path"
            ],
            "properties": {
                "files": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/protocol.FileInfo"
                    }
                },
                "path": {
                    "type": "string"
                }
            }
        },
        "handlers.GracefulRestartRequest": {
            "type": "object",
            "properties": {
                "message": {
                    "description": "Message is the notification sent to active users before restart.\nDefaults to \"This agent is restarting for a container update. Back in a minute!\"",
                    "type": "string"
                },
                "timeout_seconds": {
                    "description": "TimeoutSeconds is the maximum time allowed for each agent to commit work.\nDefaults to 300 (5 minutes).",
                    "type": "integer"
                }
            }
        },
        "handlers.GracefulRestartResponse": {
            "type": "object",
            "properties": {
                "agents_targeted": {
                    "type": "integer"
                },
                "errors": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.RestartError"
                    }
                },
                "restart_initiated": {
                    "type": "integer"
                }
            }
        },
        "handlers.HealthResponse": {
            "type": "object",
            "required": [
                "status"
            ],
            "properties": {
                "services": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "status": {
                    "type": "string"
                }
            }
        },
        "handlers.ImportRequest": {
            "type": "object",
            "required": [
                "branch"
            ],
            "properties": {
                "branch": {
                    "type": "string"
                },
                "prune": {
                    "type": "boolean"
                }
            }
        },
        "handlers.ImportResponse": {
            "type": "object",
            "required": [
                "changes"
            ],
            "properties": {
                "changes": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.ConfigChange"
                    }
                }
            }
        },
        "handlers.RestartError": {
            "type": "object",
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "error": {
                    "type": "string"
                },
                "project_id": {
                    "type": "string"
                }
            }
        },
        "handlers.TokenUsage": {
            "type": "object",
            "required": [
                "input_tokens",
                "output_tokens"
            ],
            "properties": {
                "input_tokens": {
                    "type": "integer"
                },
                "output_tokens": {
                    "type": "integer"
                }
            }
        },
        "handlers.gitHubAppInfoResponse": {
            "type": "object",
            "required": [
                "app_slug",
                "installation_url"
            ],
            "properties": {
                "app_slug": {
                    "type": "string"
                },
                "installation_url": {
                    "type": "string"
                }
            }
        },
        "handlers.gitHubBranchResponse": {
            "type": "object",
            "required": [
                "author_date",
                "commit_url",
                "name",
                "protected",
                "sha"
            ],
            "properties": {
                "author_date": {
                    "type": "string"
                },
                "commit_url": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "protected": {
                    "type": "boolean"
                },
                "sha": {
                    "type": "string"
                }
            }
        },
        "handlers.gitHubRepoResponse": {
            "type": "object",
            "required": [
                "clone_url",
                "default_branch",
                "description",
                "full_name",
                "html_url",
                "name",
                "private"
            ],
            "properties": {
                "clone_url": {
                    "type": "string"
                },
                "default_branch": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "full_name": {
                    "type": "string"
                },
                "html_url": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "private": {
                    "type": "boolean"
                }
            }
        },
        "handlers.listBranchesResponse": {
            "type": "object",
            "required": [
                "branches"
            ],
            "properties": {
                "branches": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.gitHubBranchResponse"
                    }
                }
            }
        },
        "handlers.listRepositoriesResponse": {
            "type": "object",
            "required": [
                "repositories",
                "total_count"
            ],
            "properties": {
                "repositories": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/handlers.gitHubRepoResponse"
                    }
                },
                "total_count": {
                    "type": "integer"
                }
            }
        },
        "protocol.ActivityDetail": {
            "type": "object",
            "properties": {
                "branch": {
                    "type": "string"
                },
                "commit_sha": {
                    "type": "string"
                },
                "files": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/protocol.ActivityFile"
                    }
                },
                "prompt": {
                    "type": "string"
                },
                "session_title": {
                    "type": "string"
                },
                "total_changes": {
                    "type": "integer"
                }
            }
        },
        "protocol.ActivityFile": {
            "type": "object",
            "required": [
                "action",
                "name",
                "path"
            ],
            "properties": {
                "action": {
                    "description": "\"created\", \"modified\", \"deleted\"",
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "path": {
                    "type": "string"
                }
            }
        },
        "protocol.ActivityItem": {
            "type": "object",
            "required": [
                "id",
                "summary",
                "timestamp",
                "type"
            ],
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "detail": {
                    "$ref": "#/definitions/protocol.ActivityDetail"
                },
                "id": {
                    "type": "string"
                },
                "summary": {
                    "description": "Human-readable summary",
                    "type": "string"
                },
                "timestamp": {
                    "type": "string"
                },
                "triggered_by": {
                    "$ref": "#/definitions/protocol.TriggeredBy"
                },
                "type": {
                    "description": "e.g. \"files.saved\", \"task.started\", \"agent.started\"",
                    "type": "string"
                }
            }
        },
        "protocol.Agent": {
            "type": "object",
            "required": [
                "created_at",
                "id",
                "project_id",
                "status",
                "updated_at"
            ],
            "properties": {
                "agent_config_id": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "current_branch": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "last_seen_at": {
                    "type": "string"
                },
                "pod_ip": {
                    "type": "string"
                },
                "pod_name": {
                    "type": "string"
                },
                "project_id": {
                    "type": "string"
                },
                "spawned_by": {
                    "type": "string"
                },
                "started_at": {
                    "type": "string"
                },
                "status": {
                    "$ref": "#/definitions/protocol.AgentStatus"
                },
                "terminated_at": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "protocol.AgentConfig": {
            "type": "object",
            "required": [
                "chrome_enabled",
                "created_at",
                "id",
                "name",
                "prompt",
                "updated_at"
            ],
            "properties": {
                "chrome_enabled": {
                    "type": "boolean"
                },
                "created_at": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "prompt": {
                    "type": "string"
                },
                "tools": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    }
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "protocol.AgentScheduleResponse": {
            "type": "object",
            "required": [
                "active"
            ],
            "properties": {
                "active": {
                    "type": "boolean"
                },
                "expires_at": {
                    "type": "string"
                },
                "final_wakeup_at": {
                    "type": "string"
                },
                "first_wakeup_at": {
                    "type": "string"
                },
                "interval_seconds": {
                    "type": "integer"
                },
                "is_final_wakeup": {
                    "type": "boolean"
                },
                "last_wakeup_at": {
                    "type": "string"
                },
                "next_wakeup_at": {
                    "type": "string"
                },
                "prompt": {
                    "type": "string"
                },
                "reason": {
                    "type": "string"
                },
                "started_at": {
                    "type": "string"
                },
                "wakeup_count": {
                    "type": "integer"
                },
                "wakeups_remaining": {
                    "type": "integer"
                }
            }
        },
        "protocol.AgentStatus": {
            "type": "string",
            "enum": [
                "pending",
                "starting",
                "ready",
                "busy",
                "terminating",
                "terminated",
                "failed",
                "timeout"
            ],
            "x-enum-varnames": [
                "AgentStatusPending",
                "AgentStatusStarting",
                "AgentStatusReady",
                "AgentStatusBusy",
                "AgentStatusTerminating",
                "AgentStatusTerminated",
                "AgentStatusFailed",
                "AgentStatusTimeout"
            ]
        },
        "protocol.CreateAgentConfigRequest": {
            "type": "object",
            "required": [
                "name",
                "prompt"
            ],
            "properties": {
                "chrome_enabled": {
                    "type": "boolean"
                },
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "prompt": {
                    "type": "string"
                },
                "tools": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    }
                }
            }
        },
        "protocol.CreateAgentRequest": {
            "type": "object",
            "properties": {
                "agent_config_id": {
                    "type": "string"
                },
                "branch": {
                    "type": "string"
                },
                "model": {
                    "type": "string"
                }
            }
        },
        "protocol.CreateOrganizationRequest": {
            "type": "object",
            "required": [
                "name"
            ],
            "properties": {
                "name": {
                    "type": "string"
                },
                "slug": {
                    "type": "string"
                }
            }
        },
        "protocol.CreateProjectRequest": {
            "type": "object",
            "required": [
                "name"
            ],
            "properties": {
                "agent_image": {
                    "type": "string"
                },
                "default_model": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "max_agents": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "repository_branch": {
                    "type": "string"
                },
                "repository_url": {
                    "type": "string"
                }
            }
        },
        "protocol.CreateTaskDefinitionRequest": {
            "type": "object",
            "required": [
                "name",
                "prompt_template",
                "slug"
            ],
            "properties": {
                "description": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "prompt_template": {
                    "type": "string"
                },
                "result_schema": {
                    "type": "object"
                },
                "slug": {
                    "type": "string"
                }
            }
        },
        "protocol.CreateTaskTriggerRequest": {
            "type": "object",
            "required": [
                "pattern",
                "task_definition_slug"
            ],
            "properties": {
                "debounce_seconds": {
                    "type": "integer"
                },
                "filter": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "pattern": {
                    "type": "string"
                },
                "task_definition_slug": {
                    "type": "string"
                }
            }
        },
        "protocol.Event": {
            "type": "object",
            "required": [
                "created_at",
                "data",
                "event_id",
                "id",
                "project_id",
                "source",
                "timestamp",
                "type"
            ],
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "data": {
                    "type": "object"
                },
                "event_id": {
                    "type": "string"
                },
                "id": {
                    "type": "integer"
                },
                "metadata": {
                    "type": "object"
                },
                "project_id": {
                    "type": "string"
                },
                "source": {
                    "type": "string"
                },
                "subject": {
                    "type": "string"
                },
                "timestamp": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                }
            }
        },
        "protocol.ExecuteTaskRequest": {
            "type": "object",
            "properties": {
                "params": {
                    "type": "object"
                }
            }
        },
        "protocol.ExecuteTaskResponse": {
            "type": "object",
            "required": [
                "result_id"
            ],
            "properties": {
                "result_id": {
                    "type": "string"
                }
            }
        },
        "protocol.FileInfo": {
            "type": "object",
            "required": [
                "is_dir",
                "mod_time",
                "name",
                "path",
                "size"
            ],
            "properties": {
                "is_dir": {
                    "type": "boolean"
                },
                "mod_time": {
                    "description": "Unix timestamp",
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "path": {
                    "type": "string"
                },
                "size": {
                    "type": "integer"
                }
            }
        },
        "protocol.InviteMemberRequest": {
            "type": "object",
            "required": [
                "email",
                "role"
            ],
            "properties": {
                "email": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                }
            }
        },
        "protocol.MePermissions": {
            "type": "object",
            "required": [
                "can_access_admin",
                "can_import_export_config",
                "can_manage_agent_configs",
                "can_manage_tasks",
                "can_manage_triggers"
            ],
            "properties": {
                "can_access_admin": {
                    "type": "boolean"
                },
                "can_import_export_config": {
                    "type": "boolean"
                },
                "can_manage_agent_configs": {
                    "type": "boolean"
                },
                "can_manage_tasks": {
                    "type": "boolean"
                },
                "can_manage_triggers": {
                    "type": "boolean"
                }
            }
        },
        "protocol.MeResponse": {
            "type": "object",
            "required": [
                "is_platform_admin",
                "organizations",
                "permissions",
                "user"
            ],
            "properties": {
                "is_platform_admin": {
                    "type": "boolean"
                },
                "organizations": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/protocol.OrgWithRole"
                    }
                },
                "permissions": {
                    "$ref": "#/definitions/protocol.MePermissions"
                },
                "user": {
                    "$ref": "#/definitions/protocol.User"
                }
            }
        },
        "protocol.ModelCost": {
            "type": "object",
            "required": [
                "input",
                "output"
            ],
            "properties": {
                "input": {
                    "type": "number"
                },
                "output": {
                    "type": "number"
                }
            }
        },
        "protocol.ModelInfo": {
            "type": "object",
            "required": [
                "cost",
                "id",
                "limit",
                "name",
                "reasoning",
                "release_date"
            ],
            "properties": {
                "cost": {
                    "$ref": "#/definitions/protocol.ModelCost"
                },
                "id": {
                    "type": "string"
                },
                "limit": {
                    "$ref": "#/definitions/protocol.ModelLimit"
                },
                "name": {
                    "type": "string"
                },
                "reasoning": {
                    "type": "boolean"
                },
                "release_date": {
                    "type": "string"
                }
            }
        },
        "protocol.ModelLimit": {
            "type": "object",
            "required": [
                "context",
                "output"
            ],
            "properties": {
                "context": {
                    "type": "integer"
                },
                "output": {
                    "type": "integer"
                }
            }
        },
        "protocol.ModelsResponse": {
            "type": "object",
            "required": [
                "default",
                "models"
            ],
            "properties": {
                "default": {
                    "type": "string"
                },
                "models": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/protocol.ModelInfo"
                    }
                }
            }
        },
        "protocol.OrgMember": {
            "type": "object",
            "required": [
                "created_at",
                "id",
                "org_id",
                "role",
                "user_id"
            ],
            "properties": {
                "created_at": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "org_id": {
                    "type": "string"
                },
                "role": {
                    "description": "\"owner\" | \"member\"",
                    "type": "string"
                },
                "user": {
                    "$ref": "#/definitions/protocol.User"
                },
                "user_id": {
                    "type": "string"
                }
            }
        },
        "protocol.OrgWithRole": {
            "type": "object",
            "required": [
                "created_at",
                "id",
                "name",
                "role",
                "slug",
                "updated_at"
            ],
            "properties": {
                "created_at": {
                    "type": "string"
                },
                "github_installation_id": {
                    "type": "integer"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                },
                "slug": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "protocol.Organization": {
            "type": "object",
            "required": [
                "created_at",
                "id",
                "name",
                "slug",
                "updated_at"
            ],
            "properties": {
                "created_at": {
                    "type": "string"
                },
                "github_installation_id": {
                    "type": "integer"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "slug": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "protocol.Project": {
            "type": "object",
            "required": [
                "agent_image",
                "created_at",
                "default_model",
                "id",
                "max_agents",
                "name",
                "updated_at"
            ],
            "properties": {
                "agent_image": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "default_model": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "max_agents": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "org_id": {
                    "type": "string"
                },
                "repository_auto_created": {
                    "type": "boolean"
                },
                "repository_branch": {
                    "type": "string"
                },
                "repository_url": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "protocol.TaskDefinition": {
            "type": "object",
            "required": [
                "created_at",
                "id",
                "name",
                "prompt_template",
                "slug",
                "updated_at"
            ],
            "properties": {
                "created_at": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "prompt_template": {
                    "type": "string"
                },
                "result_schema": {
                    "type": "object"
                },
                "slug": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "protocol.TaskResult": {
            "type": "object",
            "required": [
                "agent_id",
                "created_at",
                "id",
                "project_id",
                "status",
                "task_definition_id"
            ],
            "properties": {
                "agent_id": {
                    "type": "string"
                },
                "completed_at": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "data": {
                    "type": "object"
                },
                "error": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "params": {
                    "type": "object"
                },
                "project_id": {
                    "type": "string"
                },
                "status": {
                    "$ref": "#/definitions/protocol.TaskResultStatus"
                },
                "task_definition_id": {
                    "type": "string"
                }
            }
        },
        "protocol.TaskResultStatus": {
            "type": "string",
            "enum": [
                "pending",
                "running",
                "completed",
                "failed"
            ],
            "x-enum-varnames": [
                "TaskResultStatusPending",
                "TaskResultStatusRunning",
                "TaskResultStatusCompleted",
                "TaskResultStatusFailed"
            ]
        },
        "protocol.TaskTriggerResponse": {
            "type": "object",
            "required": [
                "created_at",
                "debounce_seconds",
                "enabled",
                "id",
                "pattern",
                "scope",
                "task_definition_id"
            ],
            "properties": {
                "created_at": {
                    "type": "string"
                },
                "debounce_seconds": {
                    "type": "integer"
                },
                "enabled": {
                    "type": "boolean"
                },
                "filter": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "id": {
                    "type": "string"
                },
                "pattern": {
                    "type": "string"
                },
                "project_id": {
                    "type": "string"
                },
                "scope": {
                    "type": "string"
                },
                "task_definition_id": {
                    "type": "string"
                },
                "task_definition_slug": {
                    "type": "string"
                }
            }
        },
        "protocol.TriggeredBy": {
            "type": "object",
            "required": [
                "email",
                "user_id"
            ],
            "properties": {
                "email": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "user_id": {
                    "type": "string"
                }
            }
        },
        "protocol.UpdateAgentConfigRequest": {
            "type": "object",
            "properties": {
                "chrome_enabled": {
                    "type": "boolean"
                },
                "description": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "prompt": {
                    "type": "string"
                },
                "tools": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    }
                }
            }
        },
        "protocol.UpdateMemberRoleRequest": {
            "type": "object",
            "required": [
                "role"
            ],
            "properties": {
                "role": {
                    "type": "string"
                }
            }
        },
        "protocol.UpdateOrganizationRequest": {
            "type": "object",
            "properties": {
                "github_installation_id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "protocol.UpdateProjectRequest": {
            "type": "object",
            "properties": {
                "agent_image": {
                    "type": "string"
                },
                "default_model": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "max_agents": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "repository_branch": {
                    "type": "string"
                },
                "repository_url": {
                    "type": "string"
                }
            }
        },
        "protocol.UpdateTaskDefinitionRequest": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "prompt_template": {
                    "type": "string"
                },
                "result_schema": {
                    "type": "object"
                }
            }
        },
        "protocol.UpdateTaskTriggerRequest": {
            "type": "object",
            "properties": {
                "debounce_seconds": {
                    "type": "integer"
                },
                "enabled": {
                    "type": "boolean"
                },
                "filter": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "pattern": {
                    "type": "string"
                }
            }
        },
        "protocol.User": {
            "type": "object",
            "required": [
                "created_at",
                "display_name",
                "email",
                "id",
                "last_login",
                "updated_at"
            ],
            "properties": {
                "avatar_url": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "description": "OIDC 'sub' claim",
                    "type": "string"
                },
                "last_login": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        }
    }
}