{
  "openapi": "3.1.0",
  "info": {
    "title": "StateSet Sandbox API",
    "version": "1.0.0",
    "description": "Secure code execution infrastructure for AI agents. Provides isolated Kubernetes pods for running code safely.",
    "contact": {
      "name": "StateSet Engineering",
      "url": "https://stateset.io"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "servers": [
    {
      "url": "https://api.sandbox.stateset.app",
      "description": "Production"
    },
    {
      "url": "http://localhost:8080",
      "description": "Local development"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    },
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/api/v1/sandbox/create": {
      "post": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "Create a new sandbox",
        "operationId": "createSandbox",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSandboxRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sandbox created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SandboxResponse"
                }
              }
            }
          },
          "202": {
            "description": "Request queued due to concurrency limits"
          },
          "400": {
            "description": "Invalid request (including RESOURCE_CLASS_UNAVAILABLE: resource_class shared is not enabled)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Payment required (including RESOURCE_CLASS_NOT_BILLABLE: the subscription has no shared compute items)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Concurrent limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[!-~]+$"
            },
            "description": "Persist before first dispatch; exact retries retain principal, route, body and original result. Do not change keys to escape an uncertain mutation."
          }
        ]
      }
    },
    "/api/v1/sandbox/{id}": {
      "get": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "Get sandbox details",
        "operationId": "getSandbox",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "Sandbox details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SandboxResponse"
                }
              }
            }
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "Delete a sandbox (alias for stop)",
        "operationId": "deleteSandbox",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "Sandbox deleted"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandboxes": {
      "get": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "List sandboxes for the authenticated organization",
        "operationId": "listSandboxes",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Max results (1-100, default 20)"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Results offset (default 0)"
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated state filter (e.g. running,paused)"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of sandboxes"
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/stop": {
      "post": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "Stop and delete a sandbox",
        "operationId": "stopSandbox",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "Sandbox stopped"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/extend": {
      "post": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "Extend sandbox expiration window",
        "operationId": "extendSandbox",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExtendSandboxRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sandbox extended (clamped to createdAt + min(plan max runtime, 24h); durable: the plan durable cap)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SandboxResponse"
                }
              }
            }
          },
          "402": {
            "description": "PAYMENT_REQUIRED: the org no longer passes the billing gate creates pass",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "SANDBOX_INVALID_STATE, details.reason max_lifetime_reached: already at its lifetime cap",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/status": {
      "get": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "Get sandbox status (lightweight)",
        "operationId": "getSandboxStatus",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "Sandbox status"
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/pause": {
      "post": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "Pause a running sandbox (snapshot mode: durable only; filesystem kept, memory not)",
        "operationId": "pauseSandbox",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PauseResumeSandboxRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sandbox paused (or already paused)"
          },
          "202": {
            "description": "Pause in progress (wait=false, or the wait ran out)"
          },
          "400": {
            "description": "Pause/resume not enabled (FEATURE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "SANDBOX_NOT_PAUSABLE (not durable, or the org paused limit) or SANDBOX_INVALID_STATE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/resume": {
      "post": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "Resume a paused sandbox",
        "operationId": "resumeSandbox",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PauseResumeSandboxRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sandbox running (resumed, or already running)"
          },
          "202": {
            "description": "Resume in progress (wait=false, or the wait ran out)"
          },
          "402": {
            "description": "Billing does not allow compute",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "SANDBOX_INVALID_STATE (e.g. still pausing)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Concurrent limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "RESUME_FAILED: the pod did not come up; the sandbox stays paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/execute": {
      "post": {
        "tags": [
          "Execution"
        ],
        "summary": "Execute a command in a sandbox",
        "operationId": "executeCommand",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[!-~]+$"
            },
            "description": "Persist before first dispatch; exact retries retain principal, route, body and original result. Do not change keys to escape an uncertain mutation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecuteCommandRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Command result (system_error exec_stream_lost + outcome unknown when the exec connection was lost mid-command). record_pending means the durable journal holds the result while its receipt summary awaits recovery; do not resubmit the command."
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "CONFLICT with details.reason execution_result_unconfirmed: the command returned but result storage could not be confirmed within the persistence deadline. Inspect details.execution_id; retryable is false and the same idempotency key stays reserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Sandbox starting, recovering or unreachable (SERVICE_UNAVAILABLE, details.reason): the command did not start; retry after Retry-After. A connection lost after it may have started is a 200 with system_error exec_stream_lost, outcome unknown (not retried).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/executions": {
      "get": {
        "tags": [
          "Execution"
        ],
        "summary": "List executions for a sandbox",
        "operationId": "listExecutions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "List of executions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionListResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/executions/{executionId}": {
      "get": {
        "tags": [
          "Execution"
        ],
        "summary": "Get execution details",
        "operationId": "getExecution",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "executionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Execution identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "Execution details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionDetails"
                }
              }
            }
          },
          "404": {
            "description": "Execution not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/executions/{executionId}/stream": {
      "get": {
        "tags": [
          "Execution"
        ],
        "summary": "Stream execution output via SSE",
        "operationId": "streamExecution",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "executionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Execution identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "SSE event stream"
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/files": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Write files to a sandbox",
        "operationId": "writeFiles",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WriteFilesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Files written"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Read a file from a sandbox",
        "operationId": "readFile",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "path",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Exact file path to read, returned as base64 bytes"
          }
        ],
        "responses": {
          "200": {
            "description": "File content"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Files"
        ],
        "summary": "Delete a file or directory from the sandbox",
        "operationId": "deleteFile",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteFileRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "File or directory deleted"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/files/glob": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Find files matching a glob pattern",
        "operationId": "globFiles",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GlobQueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Matching files"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/files/mkdir": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Create a directory in the sandbox",
        "operationId": "mkdirFile",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MkdirRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Directory created"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/files/move": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Move or rename a file",
        "operationId": "moveFile",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveFileRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "File moved"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/files/copy": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Copy a file or directory",
        "operationId": "copyFile",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CopyFileRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "File copied"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/files/watch": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Watch for file changes via SSE",
        "operationId": "watchFiles",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Directory to watch (default /workspace)"
          }
        ],
        "responses": {
          "200": {
            "description": "SSE stream of file change events"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/screenshot": {
      "get": {
        "tags": [
          "Computer Use"
        ],
        "summary": "Capture a screenshot of the sandbox desktop",
        "operationId": "getScreenshot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "Screenshot as base64-encoded image"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Screenshot capture failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Computer Use"
        ],
        "summary": "Capture a screenshot with options (format, quality, region)",
        "operationId": "takeScreenshot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScreenshotRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Screenshot as base64-encoded image"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Screenshot capture failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/mouse": {
      "post": {
        "tags": [
          "Computer Use"
        ],
        "summary": "Perform a mouse action (click, move, drag, double-click)",
        "operationId": "mouseAction",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MouseActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Mouse action executed successfully"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Mouse action failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/keyboard": {
      "post": {
        "tags": [
          "Computer Use"
        ],
        "summary": "Perform a keyboard action (type, key, hotkey)",
        "operationId": "keyboardAction",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyboardActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Keyboard action executed successfully"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Keyboard action failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/screen": {
      "get": {
        "tags": [
          "Computer Use"
        ],
        "summary": "Get screen dimensions of the sandbox desktop",
        "operationId": "getScreenSize",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "Screen dimensions (width, height)"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Failed to get screen size",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/status": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Public service status (no auth required)",
        "operationId": "getServiceStatus",
        "responses": {
          "200": {
            "description": "Services operational or degraded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceStatusResponse"
                }
              }
            }
          },
          "503": {
            "description": "Service outage detected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceStatusResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/api-keys": {
      "post": {
        "tags": [
          "API Keys"
        ],
        "summary": "Create a new API key",
        "operationId": "createApiKey",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "API key created"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "API Keys"
        ],
        "summary": "List API keys",
        "operationId": "listApiKeys",
        "responses": {
          "200": {
            "description": "List of API keys"
          }
        }
      }
    },
    "/api/v1/api-keys/{id}": {
      "delete": {
        "tags": [
          "API Keys"
        ],
        "summary": "Revoke an API key",
        "operationId": "revokeApiKey",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "API key identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "API key revoked"
          },
          "404": {
            "description": "API key not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/secrets": {
      "post": {
        "tags": [
          "Secrets"
        ],
        "summary": "Create a new secret",
        "operationId": "createSecret",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSecretRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Secret created"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Secrets"
        ],
        "summary": "List secrets",
        "operationId": "listSecrets",
        "responses": {
          "200": {
            "description": "List of secrets (values redacted)"
          }
        }
      }
    },
    "/api/v1/secrets/{name}": {
      "put": {
        "tags": [
          "Secrets"
        ],
        "summary": "Update a secret",
        "operationId": "updateSecret",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Secret name"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Secret updated"
          },
          "404": {
            "description": "Secret not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Secrets"
        ],
        "summary": "Delete a secret",
        "operationId": "deleteSecret",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Secret name"
          }
        ],
        "responses": {
          "200": {
            "description": "Secret deleted"
          },
          "404": {
            "description": "Secret not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/webhooks": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Register a webhook endpoint",
        "operationId": "createWebhook",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook registered"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List registered webhooks",
        "operationId": "listWebhooks",
        "responses": {
          "200": {
            "description": "List of webhooks"
          }
        }
      }
    },
    "/api/v1/register": {
      "post": {
        "tags": [
          "Registration"
        ],
        "summary": "Register a new organization",
        "operationId": "registerOrganization",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterOrganizationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Organization registered"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Organization already exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Health check",
        "operationId": "healthCheck",
        "responses": {
          "200": {
            "description": "Service is healthy"
          }
        }
      }
    },
    "/ready": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Readiness check",
        "operationId": "readinessCheck",
        "responses": {
          "200": {
            "description": "Service is ready"
          },
          "503": {
            "description": "Service is not ready"
          }
        }
      }
    },
    "/api/v1/usage/current": {
      "get": {
        "tags": [
          "Usage"
        ],
        "summary": "Get current billing period usage",
        "operationId": "getCurrentUsage",
        "responses": {
          "200": {
            "description": "Current usage data"
          }
        }
      }
    },
    "/api/v1/usage/history": {
      "get": {
        "tags": [
          "Usage"
        ],
        "summary": "Get usage history",
        "operationId": "getUsageHistory",
        "parameters": [
          {
            "name": "start_date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Start date"
          },
          {
            "name": "end_date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "End date"
          },
          {
            "name": "granularity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "hourly, daily, or monthly"
          }
        ],
        "responses": {
          "200": {
            "description": "Usage history data"
          }
        }
      }
    },
    "/api/v1/sandbox/create-from-template": {
      "post": {
        "operationId": "createSandboxFromTemplate",
        "summary": "Create sandbox from a template",
        "description": "Creates a new sandbox pre-configured from a named template\n\nServed by the live controller (answers 401 unauthenticated) but absent from its published `/openapi.json` \u2014 verified 2026-08-31.",
        "tags": [
          "Sandbox Lifecycle"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFromTemplateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sandbox created from template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateSandboxResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[!-~]+$"
            },
            "description": "Persist before first dispatch; exact retries retain principal, route, body and original result. Do not change keys to escape an uncertain mutation."
          }
        ]
      }
    },
    "/api/v1/sandbox/{id}/tunnels": {
      "post": {
        "operationId": "createTunnel",
        "summary": "Create a tunnel",
        "description": "Creates a token-authenticated tunnel to a sandbox port. Shared storage and replay guarantees require the configured database stores and migration 069. An unavailable or expired replay receipt must not trigger a new tunnel with a different key.",
        "tags": [
          "Sandbox Lifecycle"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SandboxId"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[!-~]+$"
            },
            "description": "Persist before first dispatch; exact retries retain principal, route, body and original result. Do not change keys to escape an uncertain mutation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTunnelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tunnel created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tunnel"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "get": {
        "operationId": "listTunnels",
        "summary": "List tunnels",
        "description": "Lists active tunnels for the authenticated sandbox. Tokens are returned only by creation, not by listing.",
        "tags": [
          "Sandbox Lifecycle"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SandboxId"
          }
        ],
        "responses": {
          "200": {
            "description": "Tunnel list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TunnelListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/tunnels/{id}": {
      "delete": {
        "operationId": "deleteTunnel",
        "summary": "Close a tunnel",
        "description": "Closes an active tunnel\n\nServed by the live controller (answers 401 unauthenticated) but absent from its published `/openapi.json` \u2014 verified 2026-08-31.",
        "tags": [
          "Sandbox Lifecycle"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TunnelId"
          }
        ],
        "responses": {
          "200": {
            "description": "Tunnel closed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/files/download": {
      "get": {
        "operationId": "downloadFile",
        "summary": "Download a file from sandbox",
        "description": "Downloads a file as binary content\n\nServed by the live controller (answers 401 unauthenticated) but absent from its published `/openapi.json` \u2014 verified 2026-08-31.",
        "tags": [
          "File Operations"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SandboxId"
          },
          {
            "name": "path",
            "in": "query",
            "required": true,
            "description": "Path to the file in the sandbox",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "File binary content",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/files/list": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "List files in a sandbox directory",
        "operationId": "listFiles",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Directory path (default /workspace)"
          },
          {
            "name": "recursive",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Recurse into subdirectories (true/false)"
          }
        ],
        "responses": {
          "200": {
            "description": "File listing"
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/inference": {
      "post": {
        "operationId": "proxyInference",
        "summary": "Proxy an LLM inference request",
        "description": "Forwards an inference request to a supported LLM provider from within the sandbox context\n\nServed by the live controller (answers 401 unauthenticated) but absent from its published `/openapi.json` \u2014 verified 2026-08-31.",
        "tags": [
          "Inference"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SandboxId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InferenceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Inference response from provider",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferenceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/agent-tasks": {
      "post": {
        "tags": [
          "Agent Tasks"
        ],
        "summary": "Register private task metadata with server-checked parent lineage",
        "operationId": "registerAgentTask",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterAgentTaskRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Task registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisteredAgentTask"
                }
              }
            }
          },
          "400": {
            "description": "Invalid task request or query"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Insufficient scope, task role or sandbox permission"
          },
          "404": {
            "description": "Task unavailable to this principal"
          },
          "409": {
            "description": "Task ID already registered; read it without replaying a launch"
          }
        }
      },
      "get": {
        "tags": [
          "Agent Tasks"
        ],
        "summary": "List only task families this principal can read",
        "operationId": "listRegisteredAgentTasks",
        "parameters": [
          {
            "name": "root_task_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "parent_task_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Readable registry page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisteredAgentTaskPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid task request or query"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Insufficient scope, task role or sandbox permission"
          },
          "404": {
            "description": "Task unavailable to this principal"
          }
        }
      }
    },
    "/api/v1/agent-tasks/{taskId}": {
      "get": {
        "tags": [
          "Agent Tasks"
        ],
        "summary": "Read server-registered task metadata",
        "operationId": "getRegisteredAgentTask",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Registered task",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisteredAgentTask"
                }
              }
            }
          },
          "400": {
            "description": "Invalid task request or query"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Insufficient scope, task role or sandbox permission"
          },
          "404": {
            "description": "Task unavailable to this principal"
          }
        }
      }
    },
    "/api/v1/agent-tasks/{taskId}/grants": {
      "get": {
        "tags": [
          "Agent Tasks"
        ],
        "summary": "Root owner reviews current task-family access grants",
        "operationId": "listAgentTaskGrants",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current root-family grants"
          },
          "400": {
            "description": "Invalid task request or query"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Insufficient scope, task role or sandbox permission"
          },
          "404": {
            "description": "Task unavailable to this principal"
          }
        }
      },
      "put": {
        "tags": [
          "Agent Tasks"
        ],
        "summary": "Root owner grants viewer or operator access to the task family",
        "operationId": "grantAgentTaskAccess",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentTaskGrantRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Root-family grant saved"
          },
          "400": {
            "description": "Invalid task request or query"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Insufficient scope, task role or sandbox permission"
          },
          "404": {
            "description": "Task unavailable to this principal"
          }
        }
      }
    },
    "/api/v1/agent-tasks/{taskId}/grants/{principal}": {
      "delete": {
        "tags": [
          "Agent Tasks"
        ],
        "summary": "Root owner revokes a task-family grant",
        "operationId": "revokeAgentTaskAccess",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "principal",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Grant revoked"
          },
          "400": {
            "description": "Invalid task request or query"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Insufficient scope, task role or sandbox permission"
          },
          "404": {
            "description": "Task unavailable to this principal"
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/executions/{executionId}/cancel": {
      "post": {
        "tags": [
          "Execution"
        ],
        "summary": "Request process-group cancellation from any controller replica",
        "operationId": "cancelExecution",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "executionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Cancellation requested",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelExecutionResponse"
                }
              }
            }
          },
          "404": {
            "description": "Execution not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/processes": {
      "post": {
        "tags": [
          "Processes"
        ],
        "summary": "Start a supervised background process",
        "operationId": "startProcess",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartProcessRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Process started"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many running processes in the sandbox",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "501": {
            "description": "The sandbox's exec agent does not support supervised processes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Processes"
        ],
        "summary": "List supervised processes",
        "operationId": "listProcesses",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "Processes in the sandbox"
          },
          "404": {
            "description": "Sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/processes/{processId}": {
      "get": {
        "tags": [
          "Processes"
        ],
        "summary": "Get a supervised process",
        "operationId": "getProcess",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Process identifier (proc_...)"
          }
        ],
        "responses": {
          "200": {
            "description": "Process status"
          },
          "404": {
            "description": "Sandbox or process not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Processes"
        ],
        "summary": "Kill a supervised process (TERM, then KILL after grace_seconds) and stop restarting it",
        "operationId": "killProcess",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Process identifier (proc_...)"
          },
          {
            "name": "grace_seconds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            },
            "description": "Seconds between TERM and KILL (default 10, max 60)"
          }
        ],
        "responses": {
          "200": {
            "description": "Final process status"
          },
          "404": {
            "description": "Sandbox or process not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/processes/{processId}/result": {
      "get": {
        "tags": [
          "Processes"
        ],
        "summary": "Read a bounded worker result; incomplete snapshots are safe to read again",
        "operationId": "getProcessResult",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Process identifier (proc_...)"
          },
          {
            "name": "tail_bytes",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1048576,
              "default": 16384
            },
            "description": "Maximum tail bytes per stream; base64 preserves binary output. No process mutations."
          }
        ],
        "responses": {
          "200": {
            "description": "Process outcome and bounded stdout/stderr; complete=false requires a later read for a final result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or identifiers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Read access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Sandbox or process not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Sandbox is not running",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "501": {
            "description": "Exec agent does not support supervised processes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Exec agent temporarily unavailable; retry the read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/processes/{processId}/logs": {
      "get": {
        "tags": [
          "Processes"
        ],
        "summary": "Read or follow a process log by absolute byte offset",
        "operationId": "getProcessLogs",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Process identifier (proc_...)"
          },
          {
            "name": "stream",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "stdout (default) or stderr"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Absolute byte offset (negative: from the end); default 0"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Bytes to read (max 4194304)"
          },
          {
            "name": "follow",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Stream as server-sent events; the event id is the byte offset (resume with Last-Event-ID)"
          }
        ],
        "responses": {
          "200": {
            "description": "Log chunk (base64 data, next_offset, eof), or an SSE stream when follow=true"
          },
          "404": {
            "description": "Sandbox or process not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/processes/{processId}/stdin": {
      "post": {
        "tags": [
          "Processes"
        ],
        "summary": "Write to a supervised process stdin",
        "operationId": "writeProcessStdin",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Process identifier (proc_...)"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessStdinRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bytes written"
          },
          "409": {
            "description": "Process not running or started without stdin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/processes/{processId}/signal": {
      "post": {
        "tags": [
          "Processes"
        ],
        "summary": "Signal a supervised process group",
        "operationId": "signalProcess",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Process identifier (proc_...)"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessSignalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signal delivered"
          },
          "409": {
            "description": "Process not running",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/fork": {
      "post": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "Fork a sandbox from a durable checkpoint",
        "operationId": "forkSandbox",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[!-~]+$"
            },
            "description": "Persist before first dispatch; exact retries retain principal, route, body and original result. Do not change keys to escape an uncertain mutation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForkSandboxRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sandbox forked successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForkSandboxResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid branch request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Source sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Checkpoint service unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/{id}/promote": {
      "post": {
        "tags": [
          "Sandbox Lifecycle"
        ],
        "summary": "Restore a sandbox into a different isolation tier",
        "operationId": "promoteSandbox",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sandbox identifier"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[!-~]+$"
            },
            "description": "Persist before first dispatch; exact retries retain principal, route, body and original result. Do not change keys to escape an uncertain mutation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromoteSandboxRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sandbox promoted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromoteSandboxResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid target isolation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Source sandbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Checkpoint service unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sandbox/self/token": {
      "post": {
        "tags": [
          "Sandbox Self"
        ],
        "summary": "Delegate a subset of sandbox scopes for at most five minutes",
        "operationId": "delegateSandboxToken",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DelegateSandboxTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pod-bound token, scopes and expiration"
          },
          "403": {
            "description": "Scope escalation refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateSandboxRequest": {
        "type": "object",
        "properties": {
          "session_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "cpus": {
            "type": "string",
            "pattern": "^(\\d+(\\.\\d+)?|\\d+m)$"
          },
          "memory": {
            "type": "string",
            "pattern": "^\\d+(Mi|Gi|Ki|M|G|K)$"
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9._-]{0,62}$"
          },
          "isolation": {
            "type": "string",
            "enum": [
              "container",
              "gvisor",
              "microvm",
              "kata"
            ]
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 604800
          },
          "env": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "maxLength": 256,
              "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 10000
            }
          },
          "gpu": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": 1,
                "maximum": 8
              },
              "type": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "memory_gb": {
                "type": "integer",
                "minimum": 1,
                "maximum": 256
              }
            }
          },
          "workspace": {
            "type": "object",
            "properties": {
              "persistence": {
                "default": "ephemeral",
                "type": "string",
                "enum": [
                  "ephemeral",
                  "persistent"
                ]
              },
              "size": {
                "type": "string",
                "pattern": "^([1-9]\\d*)Gi$"
              }
            }
          },
          "durable": {
            "type": "boolean"
          },
          "ephemeral_storage": {
            "type": "string",
            "pattern": "^([1-9]\\d*)Gi$"
          },
          "image": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "desktop_os": {
            "default": "linux",
            "type": "string",
            "enum": [
              "linux",
              "windows",
              "macos"
            ]
          },
          "resource_class": {
            "type": "string",
            "enum": [
              "shared",
              "dedicated"
            ]
          },
          "inference": {
            "type": "object",
            "properties": {
              "anthropic": {
                "type": "object",
                "properties": {
                  "secret_name": {
                    "type": "string",
                    "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,255}$"
                  }
                },
                "additionalProperties": false
              },
              "openai": {
                "type": "object",
                "properties": {
                  "secret_name": {
                    "type": "string",
                    "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,255}$"
                  }
                },
                "additionalProperties": false
              },
              "max_output_tokens_per_hour": {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000000000
              }
            },
            "additionalProperties": false
          },
          "egress": {
            "type": "object",
            "properties": {
              "allow": {
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 253
                }
              },
              "deny": {
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 253
                }
              }
            },
            "additionalProperties": false
          },
          "credentials": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "host": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 253
                },
                "header": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "format": {
                  "type": "string",
                  "minLength": 8,
                  "maxLength": 256
                },
                "secret": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "path_prefix": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                }
              },
              "required": [
                "host",
                "secret"
              ],
              "additionalProperties": false
            }
          },
          "budget": {
            "type": "object",
            "properties": {
              "max_cost_cents": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100000000
              },
              "max_llm_tokens": {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000000000000
              },
              "max_runtime_seconds": {
                "type": "integer",
                "minimum": 60,
                "maximum": 2592000
              },
              "on_exhausted": {
                "type": "string",
                "enum": [
                  "stop",
                  "pause",
                  "notify"
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "description": "Request to create a new isolated sandbox for code execution"
      },
      "ExecuteCommandRequest": {
        "type": "object",
        "properties": {
          "command": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 100000
              },
              {
                "minItems": 1,
                "maxItems": 1000,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 10000
                }
              },
              {
                "type": "object",
                "properties": {
                  "cmd": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "args": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 10000
                    }
                  },
                  "shell": {
                    "type": "boolean",
                    "const": false
                  }
                },
                "required": [
                  "cmd"
                ]
              }
            ]
          },
          "working_dir": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "env": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "maxLength": 256,
              "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 10000
            }
          },
          "stream": {
            "type": "boolean"
          },
          "timeout": {
            "type": "integer",
            "minimum": 1000,
            "maximum": 600000
          },
          "sandbox_epoch": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "command"
        ],
        "description": "Request to execute a command in a sandbox"
      },
      "WriteFilesRequest": {
        "type": "object",
        "properties": {
          "files": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 4096
                },
                "content": {
                  "type": "string",
                  "maxLength": 10485760
                }
              },
              "required": [
                "path",
                "content"
              ]
            }
          }
        },
        "required": [
          "files"
        ],
        "description": "Request to write one or more files into a sandbox"
      },
      "ReadFileQuery": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          }
        },
        "required": [
          "path"
        ],
        "additionalProperties": false,
        "description": "Query parameters for reading a file from a sandbox"
      },
      "ListFilesQuery": {
        "type": "object",
        "properties": {
          "path": {
            "default": "/workspace",
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "recursive": {}
        },
        "required": [
          "path",
          "recursive"
        ],
        "additionalProperties": false,
        "description": "Query parameters for listing files in a sandbox"
      },
      "ExtendSandboxRequest": {
        "type": "object",
        "properties": {
          "additional_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400
          }
        },
        "required": [
          "additional_seconds"
        ],
        "description": "Request to extend sandbox expiration window"
      },
      "CreateApiKeyRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "scopes": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "sandbox:create",
                "sandbox:read",
                "sandbox:write",
                "sandbox:*"
              ]
            }
          },
          "expires_in_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          }
        },
        "required": [
          "name"
        ],
        "description": "Request to create a new API key"
      },
      "CreateSecretRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[A-Z_][A-Z0-9_]*$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 65536
          },
          "scope": {
            "default": "sandbox",
            "type": "string",
            "enum": [
              "sandbox",
              "global",
              "registry",
              "egress"
            ]
          },
          "allowed_sandbox_patterns": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "allowed_hosts": {
            "default": [],
            "maxItems": 64,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^(\\*\\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$"
            }
          },
          "expires_in_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          }
        },
        "required": [
          "name",
          "value"
        ],
        "description": "Request to create a new secret"
      },
      "UpdateSecretRequest": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 65536
          },
          "scope": {
            "type": "string",
            "enum": [
              "sandbox",
              "global",
              "registry",
              "egress"
            ]
          },
          "allowed_sandbox_patterns": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "allowed_hosts": {
            "maxItems": 64,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^(\\*\\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$"
            }
          },
          "expires_in_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          }
        },
        "description": "Request to update an existing secret"
      },
      "CreateWebhookRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "secret": {
            "type": "string",
            "minLength": 16,
            "maxLength": 256
          }
        },
        "required": [
          "url",
          "events"
        ],
        "description": "Request to register a webhook endpoint"
      },
      "RegisterOrganizationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "plan": {
            "default": "hobby",
            "type": "string",
            "enum": [
              "hobby",
              "pro",
              "team",
              "enterprise"
            ]
          }
        },
        "required": [
          "name",
          "email"
        ],
        "description": "Request to register a new organization"
      },
      "ListSandboxesQuery": {
        "type": "object",
        "properties": {
          "limit": {
            "default": 20,
            "description": "Maximum number of results to return",
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "offset": {
            "default": 0,
            "description": "Number of results to skip",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "state": {
            "description": "Comma-separated state filter (e.g. running,paused)"
          }
        },
        "required": [
          "limit",
          "offset"
        ],
        "additionalProperties": false,
        "description": "Query parameters for listing sandboxes with optional state filtering"
      },
      "ScreenshotRequest": {
        "type": "object",
        "properties": {
          "format": {
            "default": "png",
            "type": "string",
            "enum": [
              "png",
              "jpg",
              "jpeg"
            ]
          },
          "quality": {
            "default": 85,
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "region": {
            "type": "object",
            "properties": {
              "x": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "y": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "width": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "height": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "x",
              "y",
              "width",
              "height"
            ]
          }
        },
        "description": "Options for capturing a screenshot (format, quality, region)"
      },
      "MouseActionRequest": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "click",
              "move",
              "double_click",
              "drag"
            ]
          },
          "x": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "y": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "button": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 3
              },
              {
                "type": "string",
                "enum": [
                  "1",
                  "2",
                  "3",
                  "left",
                  "middle",
                  "right"
                ]
              }
            ]
          },
          "endX": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "endY": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "action",
          "x",
          "y"
        ],
        "description": "Mouse action to perform on the sandbox desktop"
      },
      "KeyboardActionRequest": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "type",
              "key",
              "hotkey",
              "press"
            ]
          },
          "text": {
            "type": "string",
            "maxLength": 10000
          },
          "key": {
            "type": "string",
            "maxLength": 50,
            "pattern": "^[A-Za-z0-9_]+$"
          },
          "keys": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 50,
              "pattern": "^[A-Za-z0-9_]+$"
            }
          },
          "modifiers": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 50,
              "pattern": "^[A-Za-z0-9_]+$"
            }
          },
          "delayMs": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          }
        },
        "required": [
          "action"
        ],
        "description": "Keyboard action to perform on the sandbox desktop"
      },
      "SandboxResponse": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
            "description": "Unique sandbox identifier"
          },
          "org_id": {
            "type": "string",
            "description": "Organization that owns this sandbox"
          },
          "session_id": {
            "type": "string",
            "description": "Session identifier"
          },
          "status": {
            "type": "string",
            "enum": [
              "creating",
              "running",
              "pausing",
              "paused",
              "resuming",
              "terminating",
              "terminated",
              "error"
            ],
            "description": "Current sandbox status"
          },
          "pod_ip": {
            "description": "Internal pod IP address",
            "type": "string"
          },
          "sandbox_epoch": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Sandbox recycle epoch counter"
          },
          "allocated_vcpu": {
            "description": "Allocated vCPU cores",
            "type": "number"
          },
          "allocated_memory_gib": {
            "description": "Allocated memory in GiB",
            "type": "number"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "ISO 8601 creation timestamp"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "ISO 8601 expiration timestamp"
          },
          "max_expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "Maximum possible expiration"
          },
          "max_lifetime_seconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Maximum sandbox lifetime in seconds"
          },
          "remaining_extend_seconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Seconds available for extension"
          },
          "lifetime_used_seconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Seconds of lifetime consumed"
          },
          "lifetime_used_percent": {
            "type": "number",
            "description": "Percentage of lifetime consumed"
          },
          "resource_class": {
            "type": "string",
            "enum": [
              "shared",
              "dedicated"
            ],
            "description": "Resource class: dedicated (guaranteed) or shared (burstable, preemptible Spot capacity)"
          },
          "workspace": {
            "type": "object",
            "properties": {
              "persistence": {
                "type": "string",
                "enum": [
                  "ephemeral",
                  "persistent"
                ]
              },
              "pvc_name": {
                "type": "string"
              },
              "size": {
                "type": "string"
              }
            },
            "required": [
              "persistence"
            ],
            "additionalProperties": false,
            "description": "Workspace storage backing"
          },
          "startup_metrics": {
            "description": "Startup timing breakdown",
            "type": "object",
            "properties": {
              "total_ms": {
                "type": "number",
                "description": "Total startup time in milliseconds"
              },
              "pod_creation_ms": {
                "type": "number",
                "description": "Pod creation time"
              },
              "pod_ready_ms": {
                "type": "number",
                "description": "Time until pod ready"
              },
              "phases": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "durationMs": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "name",
                    "durationMs"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "total_ms",
              "pod_creation_ms",
              "pod_ready_ms",
              "phases"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "sandbox_id",
          "org_id",
          "session_id",
          "status",
          "sandbox_epoch",
          "created_at",
          "expires_at",
          "max_expires_at",
          "max_lifetime_seconds",
          "remaining_extend_seconds",
          "lifetime_used_seconds",
          "lifetime_used_percent",
          "resource_class",
          "workspace"
        ],
        "additionalProperties": false,
        "description": "Sandbox resource representation"
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Machine-readable error code"
              },
              "message": {
                "type": "string",
                "description": "Human-readable error message"
              },
              "details": {
                "description": "Additional error context",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "description": "Standard error response"
      },
      "CreateTunnelRequest": {
        "type": "object",
        "required": [
          "port"
        ],
        "properties": {
          "port": {
            "type": "integer",
            "description": "Port to expose",
            "minimum": 1,
            "maximum": 65535,
            "example": 8080
          },
          "protocol": {
            "type": "string",
            "description": "Protocol (http or https)",
            "enum": [
              "http",
              "https"
            ]
          },
          "expires_in": {
            "type": "integer",
            "description": "TTL in seconds",
            "minimum": 60,
            "maximum": 86400
          },
          "public": {
            "type": "boolean",
            "description": "Retained for compatibility; all tunnels require a token, including when true.",
            "example": false
          }
        }
      },
      "Tunnel": {
        "type": "object",
        "properties": {
          "tunnel_id": {
            "type": "string"
          },
          "sandbox_id": {
            "type": "string"
          },
          "port": {
            "type": "integer"
          },
          "protocol": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "token": {
            "type": "string"
          }
        }
      },
      "TunnelListResponse": {
        "type": "object",
        "properties": {
          "tunnels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TunnelSummary"
            }
          }
        }
      },
      "CreateSandboxResponse": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "format": "uuid"
          },
          "session_id": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/SandboxStatusEnum"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Sandbox": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string"
          },
          "session_id": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/SandboxStatusEnum"
          },
          "pod_ip": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SandboxSummary": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string"
          },
          "session_id": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/SandboxStatusEnum"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SandboxStatus": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/SandboxStatusEnum"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SandboxStatusEnum": {
        "type": "string",
        "enum": [
          "creating",
          "running",
          "terminating",
          "terminated",
          "error"
        ]
      },
      "FileContent": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "format": "byte",
            "description": "Base64-encoded file content"
          },
          "size": {
            "type": "integer",
            "description": "File size in bytes"
          }
        }
      },
      "ExecuteRequest": {
        "type": "object",
        "required": [
          "command"
        ],
        "properties": {
          "command": {
            "oneOf": [
              {
                "type": "string",
                "description": "Shell command to execute"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Command and arguments array"
              }
            ]
          },
          "working_dir": {
            "type": "string",
            "description": "Working directory",
            "default": "/workspace"
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Additional environment variables"
          },
          "stream": {
            "type": "boolean",
            "description": "Enable SSE streaming mode",
            "default": false
          }
        }
      },
      "ExecuteResponse": {
        "type": "object",
        "properties": {
          "exit_code": {
            "type": "integer"
          },
          "stdout": {
            "type": "string"
          },
          "stderr": {
            "type": "string"
          }
        }
      },
      "SuccessResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        }
      },
      "DeleteSandboxResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string",
            "description": "Human-readable confirmation message"
          }
        }
      },
      "ExtendSandboxResponse": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/SandboxStatusEnum"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "New expiration time after extension"
          },
          "max_expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Maximum allowed expiration time"
          },
          "max_lifetime_seconds": {
            "type": "integer",
            "description": "Maximum lifetime in seconds for the sandbox"
          },
          "remaining_extend_seconds": {
            "type": "integer",
            "description": "Seconds still available for future extensions"
          },
          "requested_additional_seconds": {
            "type": "integer",
            "description": "The number of seconds that were requested"
          },
          "applied_additional_seconds": {
            "type": "integer",
            "description": "The number of seconds actually applied (may be capped)"
          }
        }
      },
      "FileListEntry": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "File or directory name"
          },
          "path": {
            "type": "string",
            "description": "Full path within the sandbox"
          },
          "type": {
            "type": "string",
            "enum": [
              "file",
              "directory"
            ],
            "description": "Whether this entry is a file or directory"
          },
          "size": {
            "type": "integer",
            "description": "File size in bytes (0 for directories)"
          },
          "modified_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last modification timestamp"
          }
        }
      },
      "FileListResponse": {
        "type": "object",
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileListEntry"
            }
          }
        }
      },
      "InferenceRequest": {
        "type": "object",
        "required": [
          "provider",
          "path",
          "body"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "anthropic",
              "openai",
              "google"
            ],
            "description": "LLM provider to route the request to"
          },
          "path": {
            "type": "string",
            "description": "API path on the provider (e.g., \"/v1/messages\")"
          },
          "body": {
            "type": "object",
            "description": "Request body to forward to the provider"
          },
          "secret_name": {
            "type": "string",
            "description": "Name of the stored secret containing the provider API key"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Additional headers to include in the provider request"
          }
        }
      },
      "InferenceResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP status code from the provider"
          },
          "body": {
            "type": "object",
            "description": "Response body from the provider"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Response headers from the provider"
          }
        }
      },
      "CreateFromTemplateRequest": {
        "type": "object",
        "required": [
          "template_id"
        ],
        "properties": {
          "template_id": {
            "type": "string",
            "description": "Identifier of the template to use"
          },
          "timeout_seconds": {
            "type": "integer",
            "description": "Timeout in seconds (30-3600)",
            "minimum": 30,
            "maximum": 3600
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Environment variables to inject"
          },
          "override_cpus": {
            "type": "string",
            "description": "Override template CPU limit (e.g., \"2\", \"500m\")"
          },
          "override_memory": {
            "type": "string",
            "description": "Override template memory limit (e.g., \"2Gi\", \"512Mi\")"
          }
        }
      },
      "WarmPoolStatsSimple": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "ready": {
            "type": "integer"
          },
          "creating": {
            "type": "integer"
          },
          "claimed": {
            "type": "integer"
          }
        }
      },
      "WarmPoolProfileStats": {
        "type": "object",
        "properties": {
          "cpus": {
            "type": "string"
          },
          "memory": {
            "type": "string"
          },
          "stats": {
            "$ref": "#/components/schemas/WarmPoolStatsSimple"
          }
        }
      },
      "WarmPoolStats": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WarmPoolStatsSimple"
          },
          {
            "type": "object",
            "properties": {
              "pools": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WarmPoolProfileStats"
                }
              }
            }
          }
        ]
      },
      "WarmPoolClaimResponse": {
        "type": "object",
        "properties": {
          "pod_name": {
            "type": "string"
          },
          "pod_ip": {
            "type": "string"
          },
          "pool": {
            "type": "object",
            "properties": {
              "cpus": {
                "type": "string"
              },
              "memory": {
                "type": "string"
              }
            }
          }
        }
      },
      "WarmPoolConfigureRequest": {
        "type": "object",
        "required": [
          "pod_name",
          "sandbox_id",
          "org_id"
        ],
        "properties": {
          "pod_name": {
            "type": "string"
          },
          "sandbox_id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "session_id": {
            "type": "string"
          },
          "timeout_seconds": {
            "type": "integer"
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "WarmPoolReplenishResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "current_stats": {
            "$ref": "#/components/schemas/WarmPoolStats"
          }
        }
      },
      "DelegateSandboxTokenRequest": {
        "type": "object",
        "properties": {
          "scopes": {
            "minItems": 1,
            "maxItems": 4,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "inference",
                "keepalive",
                "self:read",
                "events:emit"
              ]
            }
          },
          "ttl_seconds": {
            "default": 300,
            "type": "integer",
            "minimum": 1,
            "maximum": 300
          }
        },
        "required": [
          "scopes"
        ],
        "additionalProperties": false,
        "description": "Delegate reduced pod-bound scopes for at most five minutes"
      },
      "ExecutionDetails": {
        "type": "object",
        "properties": {
          "execution_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "sandbox_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "starting",
              "running",
              "completed",
              "failed",
              "timeout",
              "cancelled",
              "outcome_unknown"
            ]
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "working_dir": {
            "type": "string"
          },
          "exit_code": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "stdout": {
            "type": "string"
          },
          "stderr": {
            "type": "string"
          },
          "output_truncated": {
            "type": "boolean"
          },
          "duration_ms": {
            "type": "number"
          },
          "started_at": {
            "type": "string"
          },
          "completed_at": {
            "type": "string"
          },
          "error_message": {
            "type": "string"
          }
        },
        "required": [
          "execution_id",
          "sandbox_id",
          "status",
          "command",
          "output_truncated",
          "started_at"
        ],
        "additionalProperties": false,
        "description": "Durable execution record and outcome"
      },
      "ExecutionListResponse": {
        "type": "object",
        "properties": {
          "executions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "execution_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "sandbox_id": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "queued",
                    "starting",
                    "running",
                    "completed",
                    "failed",
                    "timeout",
                    "cancelled",
                    "outcome_unknown"
                  ]
                },
                "command": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "working_dir": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "stdout": {
                  "type": "string"
                },
                "stderr": {
                  "type": "string"
                },
                "output_truncated": {
                  "type": "boolean"
                },
                "duration_ms": {
                  "type": "number"
                },
                "started_at": {
                  "type": "string"
                },
                "completed_at": {
                  "type": "string"
                },
                "error_message": {
                  "type": "string"
                }
              },
              "required": [
                "execution_id",
                "sandbox_id",
                "status",
                "command",
                "output_truncated",
                "started_at"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "executions"
        ],
        "additionalProperties": false,
        "description": "Recent execution records"
      },
      "CancelExecutionResponse": {
        "type": "object",
        "properties": {
          "execution_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "cancellation_requested": {
            "type": "boolean"
          }
        },
        "required": [
          "execution_id",
          "cancellation_requested"
        ],
        "additionalProperties": false,
        "description": "Durable execution cancellation acknowledgment"
      },
      "ProcessResult": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "process_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "exit_code": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "signal": {
            "type": [
              "string",
              "null"
            ]
          },
          "restarts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "exited_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed",
              "cancelled",
              "timed_out",
              "unknown"
            ],
            "description": "Process outcome only; exit zero does not validate the semantic success of an agent task"
          },
          "complete": {
            "type": "boolean",
            "description": "A stable terminal process and its final log ends were verified; output can still be truncated"
          },
          "output_capture_failed": {
            "type": "boolean",
            "description": "The exec agent reported a log capture failure; available output may be incomplete"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "stdout": {
            "type": "object",
            "properties": {
              "process_id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,64}$"
              },
              "stream": {
                "type": "string",
                "enum": [
                  "stdout",
                  "stderr"
                ]
              },
              "offset": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "next_offset": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "end_offset": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "earliest_offset": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "eof": {
                "type": "boolean"
              },
              "truncated": {
                "type": "boolean",
                "description": "Some output was omitted by the tail budget, rotation, or an incomplete read"
              },
              "data": {
                "type": "string",
                "description": "Base64 output bytes; decode as UTF-8 only for text workers"
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "process_id",
              "stream",
              "offset",
              "next_offset",
              "end_offset",
              "earliest_offset",
              "eof",
              "truncated",
              "data",
              "status"
            ],
            "additionalProperties": false
          },
          "stderr": {
            "type": "object",
            "properties": {
              "process_id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,64}$"
              },
              "stream": {
                "type": "string",
                "enum": [
                  "stdout",
                  "stderr"
                ]
              },
              "offset": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "next_offset": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "end_offset": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "earliest_offset": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "eof": {
                "type": "boolean"
              },
              "truncated": {
                "type": "boolean",
                "description": "Some output was omitted by the tail budget, rotation, or an incomplete read"
              },
              "data": {
                "type": "string",
                "description": "Base64 output bytes; decode as UTF-8 only for text workers"
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "process_id",
              "stream",
              "offset",
              "next_offset",
              "end_offset",
              "earliest_offset",
              "eof",
              "truncated",
              "data",
              "status"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "sandbox_id",
          "process_id",
          "status",
          "exit_code",
          "signal",
          "restarts",
          "started_at",
          "exited_at",
          "outcome",
          "complete",
          "output_capture_failed",
          "observed_at",
          "stdout",
          "stderr"
        ],
        "additionalProperties": false,
        "description": "Bounded supervised worker result, available while the sandbox and process logs exist"
      },
      "StartProcessRequest": {
        "type": "object",
        "properties": {
          "command": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 100000
              },
              {
                "minItems": 1,
                "maxItems": 1000,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 10000
                }
              }
            ]
          },
          "working_dir": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "env": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "maxLength": 256,
              "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 10000
            }
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "restart": {
            "default": "never",
            "type": "string",
            "enum": [
              "never",
              "on-failure",
              "always"
            ]
          },
          "max_restarts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "restart_backoff_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300000
          },
          "stdin": {
            "default": false,
            "type": "boolean"
          },
          "timeout_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 2592000
              },
              {
                "type": "null"
              }
            ]
          },
          "log": {
            "type": "object",
            "properties": {
              "max_bytes": {
                "type": "integer",
                "minimum": 4096,
                "maximum": 17179869184
              },
              "keep_rotations": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              }
            }
          }
        },
        "required": [
          "command"
        ],
        "description": "Start a supervised background process (outlives the request; restart policy, rotated logs, optional stdin)"
      },
      "ProcessStdinRequest": {
        "type": "object",
        "properties": {
          "data": {
            "default": "",
            "type": "string",
            "maxLength": 699052
          },
          "eof": {
            "default": false,
            "type": "boolean"
          }
        },
        "description": "Write base64 data to a supervised process stdin, optionally closing it"
      },
      "ProcessSignalRequest": {
        "type": "object",
        "properties": {
          "signal": {
            "type": "string",
            "enum": [
              "TERM",
              "INT",
              "KILL",
              "HUP",
              "USR1",
              "USR2",
              "QUIT"
            ]
          }
        },
        "required": [
          "signal"
        ],
        "description": "Send a signal to a supervised process group"
      },
      "PauseResumeSandboxRequest": {
        "type": "object",
        "properties": {
          "wait": {
            "default": true,
            "description": "Wait for the transition (default true); false answers 202 at once",
            "type": "boolean"
          },
          "timeout_seconds": {
            "description": "Longest wait before answering 202 with the transition still running (max 120)",
            "type": "integer",
            "minimum": 1,
            "maximum": 120
          },
          "auto_resume": {
            "description": "Pause only: a later exec/files/processes/REPL call resumes the sandbox on its own (default false)",
            "type": "boolean"
          }
        },
        "description": "Pause or resume a sandbox (both fields optional; the body may be empty)"
      },
      "ForkSandboxRequest": {
        "type": "object",
        "properties": {
          "cpus": {
            "type": "string",
            "pattern": "^(\\d+(\\.\\d+)?|\\d+m)$"
          },
          "memory": {
            "type": "string",
            "pattern": "^\\d+(Mi|Gi|Ki|M|G|K)$"
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400
          },
          "isolation": {
            "type": "string",
            "enum": [
              "container",
              "gvisor",
              "microvm",
              "kata",
              "wasm"
            ]
          },
          "include_env": {
            "default": true,
            "type": "boolean"
          },
          "checkpoint_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "checkpoint_description": {
            "type": "string",
            "maxLength": 1000
          }
        },
        "description": "Checkpoint and fork a sandbox"
      },
      "PromoteSandboxRequest": {
        "type": "object",
        "properties": {
          "cpus": {
            "type": "string",
            "pattern": "^(\\d+(\\.\\d+)?|\\d+m)$"
          },
          "memory": {
            "type": "string",
            "pattern": "^\\d+(Mi|Gi|Ki|M|G|K)$"
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400
          },
          "include_env": {
            "default": true,
            "type": "boolean"
          },
          "checkpoint_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "checkpoint_description": {
            "type": "string",
            "maxLength": 1000
          },
          "target_isolation": {
            "type": "string",
            "enum": [
              "container",
              "gvisor",
              "microvm",
              "kata",
              "wasm"
            ]
          },
          "stop_source": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "target_isolation"
        ],
        "description": "Restore a sandbox into another isolation tier"
      },
      "RegisterImageRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9._-]{0,62}$"
          },
          "image": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "pull_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[A-Z_][A-Z0-9_]*$"
          },
          "run_image_command": {
            "type": "boolean"
          },
          "prewarm": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "image"
        ],
        "additionalProperties": false,
        "description": "Register a custom sandbox image (pinned to its linux/amd64 digest at registration)"
      },
      "SecretEgressRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          },
          "method": {
            "default": "POST",
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "headers": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 8192
            }
          },
          "secret_headers": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$"
            },
            "additionalProperties": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[A-Z_][A-Z0-9_]*$"
            }
          },
          "body": {
            "type": "string",
            "maxLength": 1048576
          }
        },
        "required": [
          "url",
          "secret_headers"
        ],
        "description": "Destination-bound HTTPS request with controller-side secret header injection"
      },
      "ForkSandboxResponse": {
        "type": "object",
        "properties": {
          "parent_id": {
            "type": "string"
          },
          "forked_id": {
            "type": "string"
          },
          "checkpoint_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "expires_at": {
            "type": "string"
          },
          "workspace_strategy": {
            "type": "string",
            "enum": [
              "file-checkpoint",
              "csi-snapshot"
            ]
          },
          "startup_metrics": {}
        },
        "required": [
          "parent_id",
          "forked_id",
          "checkpoint_id",
          "status",
          "created_at",
          "expires_at",
          "workspace_strategy"
        ],
        "additionalProperties": false,
        "description": "Result of a sandbox fork"
      },
      "PromoteSandboxResponse": {
        "type": "object",
        "properties": {
          "source_id": {
            "type": "string"
          },
          "promoted_id": {
            "type": "string"
          },
          "checkpoint_id": {
            "type": "string"
          },
          "source_status": {
            "type": "string"
          },
          "promoted_status": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "expires_at": {
            "type": "string"
          },
          "workspace_strategy": {
            "type": "string",
            "enum": [
              "file-checkpoint",
              "csi-snapshot"
            ]
          },
          "startup_metrics": {}
        },
        "required": [
          "source_id",
          "promoted_id",
          "checkpoint_id",
          "source_status",
          "promoted_status",
          "created_at",
          "expires_at",
          "workspace_strategy"
        ],
        "additionalProperties": false,
        "description": "Result of an isolation promotion"
      },
      "ServiceStatusResponse": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "region": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "operational",
              "degraded",
              "outage"
            ]
          },
          "services": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "enum": [
                    "operational",
                    "degraded",
                    "outage",
                    "not_configured"
                  ]
                },
                "latency_ms": {
                  "type": "number"
                }
              },
              "required": [
                "status"
              ],
              "additionalProperties": false
            }
          },
          "capabilities": {
            "type": "object",
            "properties": {
              "workspace": {
                "type": "object",
                "properties": {
                  "persistent_workspaces": {
                    "type": "object",
                    "properties": {
                      "configured": {
                        "type": "boolean"
                      },
                      "available": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "configured",
                      "available"
                    ],
                    "additionalProperties": false
                  },
                  "csi_snapshots": {
                    "type": "object",
                    "properties": {
                      "configured": {
                        "type": "boolean"
                      },
                      "available": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "configured",
                      "available"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "persistent_workspaces",
                  "csi_snapshots"
                ],
                "additionalProperties": false
              },
              "lifecycle": {
                "type": "object",
                "properties": {
                  "pause_resume": {
                    "type": "boolean"
                  },
                  "pause_mode": {
                    "type": "string",
                    "enum": [
                      "disabled",
                      "annotation",
                      "runtime",
                      "snapshot"
                    ]
                  },
                  "suspends_compute": {
                    "type": "boolean"
                  },
                  "preserves_memory": {
                    "type": "boolean"
                  },
                  "pause_preserves": {
                    "type": "object",
                    "properties": {
                      "filesystem": {
                        "type": "boolean"
                      },
                      "memory": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "filesystem",
                      "memory"
                    ],
                    "additionalProperties": false
                  },
                  "stop_start": {
                    "type": "boolean"
                  },
                  "archive": {
                    "type": "boolean"
                  },
                  "hot_snapshots": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "pause_resume",
                  "pause_mode",
                  "suspends_compute",
                  "preserves_memory",
                  "stop_start",
                  "archive",
                  "hot_snapshots"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "workspace",
              "lifecycle"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "timestamp",
          "region",
          "status",
          "services",
          "capabilities"
        ],
        "additionalProperties": false,
        "description": "Public service health and execution capability report"
      },
      "RegisterAgentTaskRequest": {
        "type": "object",
        "properties": {
          "task_id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
              }
            ]
          },
          "parent_task_id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
              }
            ]
          },
          "sandbox_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,199}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "objective": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16000
          },
          "command_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "task_id",
          "sandbox_id",
          "name",
          "objective",
          "command_sha256"
        ],
        "additionalProperties": false,
        "description": "Register metadata under a server-authorized task parent; does not start a worker"
      },
      "AgentTaskGrantRequest": {
        "type": "object",
        "properties": {
          "principal": {
            "type": "string",
            "pattern": "^(?:apikey:)?[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
          },
          "role": {
            "type": "string",
            "enum": [
              "viewer",
              "operator"
            ]
          }
        },
        "required": [
          "principal",
          "role"
        ],
        "additionalProperties": false,
        "description": "Grant root-family metadata access to an existing organization principal"
      },
      "RegisteredAgentTask": {
        "type": "object",
        "properties": {
          "task_id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
              }
            ]
          },
          "parent_task_id": {
            "anyOf": [
              {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sandbox_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,199}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "objective": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16000
          },
          "command_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "root_task_id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
              }
            ]
          },
          "depth": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "access_role": {
            "type": "string",
            "enum": [
              "owner",
              "operator",
              "viewer"
            ]
          },
          "lineage": {
            "type": "string",
            "const": "server_verified"
          },
          "worker_status": {
            "type": "string",
            "const": "not_observed"
          }
        },
        "required": [
          "task_id",
          "parent_task_id",
          "sandbox_id",
          "name",
          "objective",
          "command_sha256",
          "root_task_id",
          "depth",
          "created_at",
          "access_role",
          "lineage",
          "worker_status"
        ],
        "additionalProperties": false,
        "description": "Server-verified lineage and current task metadata access role; worker state is not observed"
      },
      "RegisteredAgentTaskPage": {
        "type": "object",
        "properties": {
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "task_id": {
                  "type": "string",
                  "allOf": [
                    {
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                    }
                  ]
                },
                "parent_task_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        {
                          "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "sandbox_id": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,199}$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "objective": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 16000
                },
                "command_sha256": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "root_task_id": {
                  "type": "string",
                  "allOf": [
                    {
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
                    }
                  ]
                },
                "depth": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 16
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "access_role": {
                  "type": "string",
                  "enum": [
                    "owner",
                    "operator",
                    "viewer"
                  ]
                },
                "lineage": {
                  "type": "string",
                  "const": "server_verified"
                },
                "worker_status": {
                  "type": "string",
                  "const": "not_observed"
                }
              },
              "required": [
                "task_id",
                "parent_task_id",
                "sandbox_id",
                "name",
                "objective",
                "command_sha256",
                "root_task_id",
                "depth",
                "created_at",
                "access_role",
                "lineage",
                "worker_status"
              ],
              "additionalProperties": false
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "tasks",
          "next_cursor"
        ],
        "additionalProperties": false,
        "description": "Private task registry page"
      },
      "TunnelSummary": {
        "type": "object",
        "properties": {
          "tunnel_id": {
            "type": "string"
          },
          "sandbox_id": {
            "type": "string"
          },
          "port": {
            "type": "integer"
          },
          "protocol": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "parameters": {
      "SandboxId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1
        },
        "description": "Sandbox identity returned by create or list."
      },
      "TunnelId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1
        },
        "description": "Tunnel identity returned by tunnel creation."
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "InternalError": {
        "description": "Internal error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "NotFound": {
        "description": "Resource not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Authentication required",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    }
  },
  "x-stateset-provenance": {
    "reviewed_at": "2026-10-20",
    "repository": "stateset-sandbox",
    "source_revision": "67bc23702f05fb44c79dd783eeae4e84bd4461c4",
    "source_export": "controller/src/openapi/generator.ts::generateOpenApiDocument (offline, no server startup)",
    "scope": "Selected public core routes, retaining verified metadata for inventory placeholders and correcting handler disagreements in overlays/sandbox.json. Not the complete source route inventory or a deployment statement."
  }
}
