{
  "openapi": "3.1.0",
  "info": {
    "title": "opencode HttpApi",
    "version": "0.0.1",
    "description": "Experimental HttpApi surface for selected instance routes."
  },
  "paths": {
    "/api/health": {
      "get": {
        "tags": ["health"],
        "operationId": "v2.health.get",
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "ServiceHealth",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceHealth"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Report the owning server process and its application status.",
        "summary": "Check server health"
      }
    },
    "/api/service/stop": {
      "post": {
        "tags": ["health"],
        "operationId": "v2.health.stop",
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "ServiceStopResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceStopResponse"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Request graceful shutdown of one exact managed server instance.",
        "summary": "Stop the managed server",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceStopRequest"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/server": {
      "get": {
        "tags": ["server"],
        "operationId": "v2.server.get",
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "urls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": ["urls"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Return the URLs that can be used to connect to this server.",
        "summary": "Get server information"
      }
    },
    "/api/location": {
      "get": {
        "tags": ["location"],
        "operationId": "v2.location.get",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Location.Info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Location.Info"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Resolve the requested location or the server default location.",
        "summary": "Get location"
      }
    },
    "/api/agent": {
      "get": {
        "tags": ["agent"],
        "operationId": "v2.agent.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Agent.Info"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve currently registered agents.",
        "summary": "List agents"
      }
    },
    "/api/agent/{agentID}": {
      "get": {
        "tags": ["agent"],
        "operationId": "v2.agent.get",
        "parameters": [
          {
            "name": "agentID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Agent.Info"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "AgentNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentNotFoundError"
                }
              }
            }
          }
        },
        "description": "Retrieve a single currently registered agent.",
        "summary": "Get agent"
      }
    },
    "/api/plugin": {
      "get": {
        "tags": ["plugin"],
        "operationId": "v2.plugin.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Plugin.Info"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve currently loaded plugins.",
        "summary": "List plugins"
      }
    },
    "/api/session": {
      "get": {
        "tags": ["session"],
        "operationId": "v2.session.list",
        "parameters": [
          {
            "name": "workspace",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "allOf": [
                    {
                      "pattern": "^wrk"
                    }
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of sessions to return. Defaults to the newest 50 sessions."
            },
            "required": false
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": ["asc", "desc"]
                },
                {
                  "type": "null"
                }
              ],
              "description": "Session order for the first page. Use desc for newest first or asc for oldest first."
            },
            "required": false
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          },
          {
            "name": "parentID",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^ses"
                        }
                      ]
                    },
                    {
                      "type": "string",
                      "enum": ["null"]
                    }
                  ],
                  "description": "Filter by parent session. Use null to return only root sessions."
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          },
          {
            "name": "directory",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          },
          {
            "name": "project",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          },
          {
            "name": "subpath",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Opaque pagination cursor returned as cursor.previous or cursor.next in the previous response."
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "SessionsResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionsResponse"
                }
              }
            }
          },
          "400": {
            "description": "InvalidCursorError | InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidCursorError"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list.",
        "summary": "List sessions"
      },
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.create",
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session.Info"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Create a session at the requested location.",
        "summary": "Create session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "allOf": [
                          {
                            "pattern": "^ses"
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "agent": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "model": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Model.Ref"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "location": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Location.Ref"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/import": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.import",
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session.Info"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "409": {
            "description": "ConflictError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConflictError"
                }
              }
            }
          }
        },
        "description": "Import a projected session transcript at the requested location.",
        "summary": "Import session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "info": {
                    "$ref": "#/components/schemas/Session.Info"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Session.Message.Info"
                    }
                  },
                  "location": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Location.Ref"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["info", "messages"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/export": {
      "get": {
        "tags": ["session"],
        "operationId": "v2.session.export",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "sanitize",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": ["true", "false"]
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SessionTransfer.Data"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionNotFoundError"
                }
              }
            }
          },
          "500": {
            "description": "UnknownError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnknownError"
                }
              }
            }
          }
        },
        "description": "Export a complete projected session transcript.",
        "summary": "Export session"
      }
    },
    "/api/session/active": {
      "get": {
        "tags": ["session"],
        "operationId": "v2.session.active",
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "patternProperties": {
                        "^ses": {
                          "$ref": "#/components/schemas/SessionActive"
                        }
                      }
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve foreground Session drains currently owned by this OpenCode process. Sessions absent from the result are inactive.",
        "summary": "List active sessions"
      }
    },
    "/api/session/{sessionID}": {
      "get": {
        "tags": ["session"],
        "operationId": "v2.session.get",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session.Info"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionNotFoundError"
                }
              }
            }
          }
        },
        "description": "Retrieve a session by ID.",
        "summary": "Get session"
      },
      "delete": {
        "tags": ["session"],
        "operationId": "v2.session.remove",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Delete a session and its child sessions.",
        "summary": "Delete session"
      }
    },
    "/api/session/{sessionID}/fork": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.fork",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session.Info"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError | MessageNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MessageNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Create a child session by copying projected history through or before a message boundary.",
        "summary": "Fork session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "boundary": {
                    "$ref": "#/components/schemas/Session.ForkRequestBoundary"
                  }
                },
                "required": ["boundary"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/agent": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.switchAgent",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Switch the agent used by subsequent provider turns.",
        "summary": "Switch session agent",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent": {
                    "type": "string"
                  }
                },
                "required": ["agent"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/model": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.switchModel",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Switch the model used by subsequent provider turns.",
        "summary": "Switch session model",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "$ref": "#/components/schemas/Model.Ref"
                  }
                },
                "required": ["model"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/rename": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.rename",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Update the session title.",
        "summary": "Rename session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  }
                },
                "required": ["title"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/move": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.move",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionNotFoundError"
                }
              }
            }
          }
        },
        "description": "Move a session to another project directory, optionally transferring local changes.",
        "summary": "Move session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "directory": {
                    "type": "string"
                  },
                  "workspaceID": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^wrk"
                      }
                    ]
                  },
                  "delivery": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Session.Inbox.Delivery"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["directory"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/prompt": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.prompt",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session.Inbox.User"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "ConflictError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConflictError"
                }
              }
            }
          }
        },
        "description": "Durably admit one session input and schedule agent-loop execution unless resume is false.",
        "summary": "Send message",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "allOf": [
                          {
                            "pattern": "^msg_"
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "text": {
                    "type": "string"
                  },
                  "files": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PromptInput.FileAttachment"
                    }
                  },
                  "agents": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Prompt.AgentAttachment"
                    }
                  },
                  "skills": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PromptInput.SkillAttachment"
                    }
                  },
                  "metadata": {
                    "type": "object"
                  },
                  "delivery": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Session.Inbox.Delivery"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "resume": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["text"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/command": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.command",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session.Inbox.User"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError | CommandNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/CommandNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "ConflictError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConflictError"
                }
              }
            }
          },
          "500": {
            "description": "CommandEvaluationError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandEvaluationError"
                }
              }
            }
          }
        },
        "description": "Resolve a slash command into prompt input, admit it durably, and schedule execution unless resume is false.",
        "summary": "Run command",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "allOf": [
                          {
                            "pattern": "^msg_"
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "command": {
                    "type": "string"
                  },
                  "arguments": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "agent": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "model": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Model.Ref"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "files": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PromptInput.FileAttachment"
                    }
                  },
                  "agents": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Prompt.AgentAttachment"
                    }
                  },
                  "skills": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PromptInput.SkillAttachment"
                    }
                  },
                  "delivery": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Session.Inbox.Delivery"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "resume": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["command"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/skill": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.skill",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError | SkillNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SkillNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Activate a skill for a session by appending a skill message and resuming execution.",
        "summary": "Activate skill",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "allOf": [
                          {
                            "pattern": "^msg_"
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "skill": {
                    "type": "string"
                  },
                  "resume": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["skill"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/synthetic": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.synthetic",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session.Inbox.Synthetic"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "ConflictError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConflictError"
                }
              }
            }
          }
        },
        "description": "Durably admit synthetic session input and schedule execution unless resume is false.",
        "summary": "Add synthetic message",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "allOf": [
                          {
                            "pattern": "^msg_"
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "text": {
                    "type": "string"
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "metadata": {
                    "type": "object"
                  },
                  "delivery": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Session.Inbox.Delivery"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "resume": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["text"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/shell": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.shell",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Execute one shell command in the session's working directory. Emits a shell.started event before execution and a shell.ended event with the merged output after.",
        "summary": "Run shell command",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "allOf": [
                          {
                            "pattern": "^evt_"
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "command": {
                    "type": "string"
                  }
                },
                "required": ["command"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/compact": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.compact",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session.Inbox.Compaction"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "ConflictError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConflictError"
                }
              }
            }
          }
        },
        "description": "Queue a durable session compaction request.",
        "summary": "Compact session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "allOf": [
                          {
                            "pattern": "^msg_"
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "delivery": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Session.Inbox.Delivery"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/wait": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.wait",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "ServiceUnavailableError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceUnavailableError"
                }
              }
            }
          }
        },
        "description": "Wait for a session agent loop to become idle.",
        "summary": "Wait for session"
      }
    },
    "/api/session/{sessionID}/revert/stage": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.revert.stage",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session.Revert"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "MessageNotFoundError | SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MessageNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "SessionBusyError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionBusyError"
                }
              }
            }
          },
          "500": {
            "description": "UnknownError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnknownError"
                }
              }
            }
          }
        },
        "description": "Stage or move a reversible session boundary and optionally apply its file changes.",
        "summary": "Stage session revert",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messageID": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^msg_"
                      }
                    ]
                  },
                  "files": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["messageID"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/revert/clear": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.revert.clear",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "SessionBusyError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionBusyError"
                }
              }
            }
          },
          "500": {
            "description": "UnknownError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnknownError"
                }
              }
            }
          }
        },
        "summary": "Clear staged revert"
      }
    },
    "/api/session/{sessionID}/revert/commit": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.revert.commit",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "SessionBusyError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionBusyError"
                }
              }
            }
          }
        },
        "summary": "Commit staged revert"
      }
    },
    "/api/session/{sessionID}/context": {
      "get": {
        "tags": ["session"],
        "operationId": "v2.session.context",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Session.Message.Info"
                      }
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionNotFoundError"
                }
              }
            }
          },
          "500": {
            "description": "UnknownError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnknownError"
                }
              }
            }
          }
        },
        "description": "Retrieve the active context messages for a session (all messages after the last compaction).",
        "summary": "Get session context"
      }
    },
    "/api/session/{sessionID}/inbox": {
      "get": {
        "tags": ["session"],
        "operationId": "v2.session.inbox.list",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Session.Inbox.Info"
                      }
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionNotFoundError"
                }
              }
            }
          }
        },
        "description": "List durable enqueued session work not yet delivered, ordered by enqueue sequence. Includes user, synthetic, compaction, and move items.",
        "summary": "List session inbox"
      }
    },
    "/api/session/{sessionID}/inbox/{inboxID}": {
      "delete": {
        "tags": ["session"],
        "operationId": "v2.session.inbox.cancel",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "inboxID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^msg_"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionNotFoundError"
                }
              }
            }
          },
          "409": {
            "description": "ConflictError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConflictError"
                }
              }
            }
          }
        },
        "description": "Cancel an inbox item that has not yet been delivered.",
        "summary": "Cancel inbox input"
      }
    },
    "/api/session/{sessionID}/inbox/{inboxID}/steer": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.inbox.steer",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "inboxID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^msg_"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionNotFoundError"
                }
              }
            }
          },
          "409": {
            "description": "ConflictError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConflictError"
                }
              }
            }
          }
        },
        "description": "Change a queued inbox item to steer delivery and wake session execution.",
        "summary": "Steer queued item"
      }
    },
    "/api/session/{sessionID}/inbox/{inboxID}/queue": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.inbox.queue",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "inboxID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^msg_"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionNotFoundError"
                }
              }
            }
          },
          "409": {
            "description": "ConflictError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConflictError"
                }
              }
            }
          }
        },
        "description": "Change a steered inbox item to queued delivery.",
        "summary": "Queue steered item"
      }
    },
    "/api/session/{sessionID}/instructions/entries": {
      "get": {
        "tags": ["session"],
        "operationId": "v2.session.instructions.entry.list",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InstructionEntry.Info"
                      }
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "List API-managed instruction entries attached to the session.",
        "summary": "List instruction entries"
      }
    },
    "/api/session/{sessionID}/instructions/entries/{key}": {
      "put": {
        "tags": ["session"],
        "operationId": "v2.session.instructions.entry.put",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "key",
            "in": "path",
            "schema": {
              "$ref": "#/components/schemas/InstructionEntry.Key"
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "413": {
            "description": "InstructionEntryValueTooLargeError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstructionEntryValueTooLargeError"
                }
              }
            }
          }
        },
        "description": "Attach or replace one durable instruction entry. Changes announce as updates at the next step boundary.",
        "summary": "Put instruction entry",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {}
                },
                "required": ["value"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      },
      "delete": {
        "tags": ["session"],
        "operationId": "v2.session.instructions.entry.remove",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "key",
            "in": "path",
            "schema": {
              "$ref": "#/components/schemas/InstructionEntry.Key"
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Remove one instruction entry; the removal is announced to the model at the next step boundary.",
        "summary": "Remove instruction entry"
      }
    },
    "/api/session/{sessionID}/generate": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.generate",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "SessionGenerateResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionGenerateResponse"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "ServiceUnavailableError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceUnavailableError"
                }
              }
            }
          }
        },
        "description": "Generate transient text from the current session context without mutating session history.",
        "summary": "Generate text from session context",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string"
                  }
                },
                "required": ["prompt"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/experimental/session/{sessionID}/log": {
      "get": {
        "tags": ["session"],
        "operationId": "v2.session.log",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          },
          {
            "name": "follow",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": ["true", "false"]
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "event": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/SessionLogItemJsonString"
                    }
                  },
                  "required": ["id", "event", "data"],
                  "additionalProperties": false
                },
                "x-effect-stream": {
                  "encoding": "sse",
                  "causeSchema": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "_tag": {
                              "type": "string",
                              "enum": ["Fail"]
                            },
                            "error": {
                              "not": {}
                            }
                          },
                          "required": ["_tag", "error"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "_tag": {
                              "type": "string",
                              "enum": ["Die"]
                            },
                            "defect": {}
                          },
                          "required": ["_tag", "defect"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "_tag": {
                              "type": "string",
                              "enum": ["Interrupt"]
                            },
                            "fiberId": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": ["_tag", "fiberId"],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "errorSchema": {
                    "not": {}
                  },
                  "failureEvent": "effect/httpapi/stream/failure"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionNotFoundError"
                }
              }
            }
          }
        },
        "description": "Experimental durable session event log. Reads events after an exclusive aggregate sequence and continues with live events when follow=true.",
        "summary": "Read the session log"
      }
    },
    "/api/session/{sessionID}/interrupt": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.interrupt",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "continue",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": ["true", "false"]
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Interrupt active execution owned by this OpenCode process. Idle interruption is a no-op. When continue=true, execution resumes pending steering input while queued work remains parked.",
        "summary": "Interrupt session execution"
      }
    },
    "/api/session/{sessionID}/background": {
      "post": {
        "tags": ["session"],
        "operationId": "v2.session.background",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Move active foreground backgroundable tools for this session into background observation. Idle requests are a no-op.",
        "summary": "Background blocking session tools"
      }
    },
    "/api/session/{sessionID}/message/{messageID}": {
      "get": {
        "tags": ["session"],
        "operationId": "v2.session.message",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "messageID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^msg_"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session.Message.Info"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError | MessageNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/MessageNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Retrieve one projected message owned by the Session.",
        "summary": "Get session message"
      }
    },
    "/api/session/{sessionID}/message": {
      "get": {
        "tags": ["session"],
        "operationId": "v2.message.list",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of messages to return. When omitted, the endpoint returns its default page size."
            },
            "required": false
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": ["asc", "desc"]
                },
                {
                  "type": "null"
                }
              ],
              "description": "Message order for the first page. Use desc for newest first or asc for oldest first."
            },
            "required": false
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Opaque pagination cursor returned as cursor.previous or cursor.next in the previous response. Do not combine with order."
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "SessionMessagesResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionMessagesResponse"
                }
              }
            }
          },
          "400": {
            "description": "InvalidCursorError | InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidCursorError"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionNotFoundError"
                }
              }
            }
          },
          "500": {
            "description": "UnknownError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnknownError"
                }
              }
            }
          }
        },
        "description": "Retrieve projected messages for a session. Items keep the requested order across pages; use cursor.next or cursor.previous to move through the ordered timeline.",
        "summary": "Get session messages"
      }
    },
    "/api/model": {
      "get": {
        "tags": ["model"],
        "operationId": "v2.model.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Model.Info"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "503": {
            "description": "ServiceUnavailableError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceUnavailableError"
                }
              }
            }
          }
        },
        "description": "Retrieve the current snapshot of available models ordered by release date. The snapshot may precede initial plugin settlement.",
        "summary": "List models"
      }
    },
    "/api/model/default": {
      "get": {
        "tags": ["model"],
        "operationId": "v2.model.default",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Model.Info"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "503": {
            "description": "ServiceUnavailableError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceUnavailableError"
                }
              }
            }
          }
        },
        "description": "Retrieve the model used when a session has no explicit model selection.",
        "summary": "Get default model"
      }
    },
    "/api/generate": {
      "post": {
        "tags": ["generate"],
        "operationId": "v2.generate.text",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "GenerateTextResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateTextResponse"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "503": {
            "description": "ServiceUnavailableError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceUnavailableError"
                }
              }
            }
          }
        },
        "description": "Run one stateless model generation at the requested location and return the assistant text. Uses the location's default model when none is specified.",
        "summary": "Generate text",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string"
                  },
                  "model": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Model.Ref"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["prompt"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/provider": {
      "get": {
        "tags": ["provider"],
        "operationId": "v2.provider.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Provider.Info"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "503": {
            "description": "ServiceUnavailableError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceUnavailableError"
                }
              }
            }
          }
        },
        "description": "Retrieve active AI providers so clients can show provider availability and configuration.",
        "summary": "List providers"
      }
    },
    "/api/provider/{providerID}": {
      "get": {
        "tags": ["provider"],
        "operationId": "v2.provider.get",
        "parameters": [
          {
            "name": "providerID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Provider.Info"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "ProviderNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderNotFoundError"
                }
              }
            }
          },
          "503": {
            "description": "ServiceUnavailableError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceUnavailableError"
                }
              }
            }
          }
        },
        "description": "Retrieve a single AI provider so clients can inspect its availability and endpoint settings.",
        "summary": "Get provider"
      }
    },
    "/api/integration": {
      "get": {
        "tags": ["integration"],
        "operationId": "v2.integration.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Integration.Info"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve available integrations and their authentication methods.",
        "summary": "List integrations"
      }
    },
    "/api/integration/{integrationID}": {
      "get": {
        "tags": ["integration"],
        "operationId": "v2.integration.get",
        "parameters": [
          {
            "name": "integrationID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Integration.Info"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve one integration and its authentication methods.",
        "summary": "Get integration"
      }
    },
    "/api/experimental/integration/wellknown": {
      "post": {
        "tags": ["integration"],
        "operationId": "v2.experimental.integration.wellknown.add",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Discover and persist an experimental wellknown integration source.",
        "summary": "Add wellknown integration",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  }
                },
                "required": ["url"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/integration/{integrationID}/connect/key": {
      "post": {
        "tags": ["integration"],
        "operationId": "v2.integration.connect.key",
        "parameters": [
          {
            "name": "integrationID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Run a key authentication method and store the resulting credential.",
        "summary": "Connect with key",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string"
                  },
                  "answer": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Form.Answer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "label": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["key"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/integration/{integrationID}/connect/oauth": {
      "post": {
        "tags": ["integration"],
        "operationId": "v2.integration.oauth.connect",
        "parameters": [
          {
            "name": "integrationID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Integration.Attempt"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Start an OAuth attempt and return the authorization details.",
        "summary": "Begin OAuth connection",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "methodID": {
                    "type": "string"
                  },
                  "answer": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Form.Answer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "label": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["methodID"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/integration/{integrationID}/connect/oauth/{attemptID}": {
      "get": {
        "tags": ["integration"],
        "operationId": "v2.integration.oauth.status",
        "parameters": [
          {
            "name": "integrationID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "attemptID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Integration.AttemptStatus"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Poll the current status of an OAuth attempt.",
        "summary": "Get OAuth attempt status"
      },
      "delete": {
        "tags": ["integration"],
        "operationId": "v2.integration.oauth.cancel",
        "parameters": [
          {
            "name": "integrationID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "attemptID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Cancel an OAuth attempt and release its resources.",
        "summary": "Cancel OAuth connection"
      }
    },
    "/api/integration/{integrationID}/connect/oauth/{attemptID}/complete": {
      "post": {
        "tags": ["integration"],
        "operationId": "v2.integration.oauth.complete",
        "parameters": [
          {
            "name": "integrationID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "attemptID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Complete a code-based OAuth attempt and store the resulting credential.",
        "summary": "Complete OAuth connection",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/integration/{integrationID}/connect/command": {
      "post": {
        "tags": ["integration"],
        "operationId": "v2.integration.command.connect",
        "parameters": [
          {
            "name": "integrationID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Integration.CommandAttempt"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Start a command authentication attempt.",
        "summary": "Begin command connection",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "methodID": {
                    "type": "string"
                  },
                  "label": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["methodID"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/integration/{integrationID}/connect/command/{attemptID}": {
      "get": {
        "tags": ["integration"],
        "operationId": "v2.integration.command.status",
        "parameters": [
          {
            "name": "integrationID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "attemptID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Integration.CommandAttemptStatus"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Poll the current status and output of a command authentication attempt.",
        "summary": "Get command attempt status"
      },
      "delete": {
        "tags": ["integration"],
        "operationId": "v2.integration.command.cancel",
        "parameters": [
          {
            "name": "integrationID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "attemptID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Cancel a command authentication attempt and terminate its process.",
        "summary": "Cancel command connection"
      }
    },
    "/api/mcp": {
      "get": {
        "tags": ["mcp"],
        "operationId": "v2.mcp.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Mcp.Server"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve configured MCP servers and their connection status.",
        "summary": "List MCP servers"
      }
    },
    "/api/mcp/{server}": {
      "put": {
        "tags": ["mcp"],
        "operationId": "v2.mcp.add",
        "parameters": [
          {
            "name": "server",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Add an MCP server at runtime or replace an existing one, connecting it immediately.",
        "summary": "Add MCP server",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "config": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Mcp.LocalConfig"
                      },
                      {
                        "$ref": "#/components/schemas/Mcp.RemoteConfig"
                      }
                    ]
                  }
                },
                "required": ["config"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      },
      "delete": {
        "tags": ["mcp"],
        "operationId": "v2.mcp.remove",
        "parameters": [
          {
            "name": "server",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "McpServerNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerNotFoundError"
                }
              }
            }
          }
        },
        "description": "Stop an MCP server and remove it from the runtime set until restart.",
        "summary": "Remove MCP server"
      }
    },
    "/api/mcp/{server}/connect": {
      "post": {
        "tags": ["mcp"],
        "operationId": "v2.mcp.connect",
        "parameters": [
          {
            "name": "server",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "McpServerNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerNotFoundError"
                }
              }
            }
          }
        },
        "description": "Connect an MCP server at runtime, overriding a disabled configuration until restart.",
        "summary": "Connect MCP server"
      }
    },
    "/api/mcp/{server}/disconnect": {
      "post": {
        "tags": ["mcp"],
        "operationId": "v2.mcp.disconnect",
        "parameters": [
          {
            "name": "server",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "McpServerNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpServerNotFoundError"
                }
              }
            }
          }
        },
        "description": "Disconnect an MCP server at runtime, removing its tools until reconnected.",
        "summary": "Disconnect MCP server"
      }
    },
    "/api/mcp/resource": {
      "get": {
        "tags": ["mcp"],
        "operationId": "v2.mcp.resource.catalog",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Mcp.ResourceCatalog"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve resources and resource templates from connected MCP servers.",
        "summary": "List MCP resources"
      }
    },
    "/api/credential/{credentialID}": {
      "patch": {
        "tags": ["credential"],
        "operationId": "v2.credential.update",
        "parameters": [
          {
            "name": "credentialID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Update a stored credential label.",
        "summary": "Update credential",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  }
                },
                "required": ["label"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      },
      "delete": {
        "tags": ["credential"],
        "operationId": "v2.credential.remove",
        "parameters": [
          {
            "name": "credentialID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Remove a stored integration credential.",
        "summary": "Remove credential"
      }
    },
    "/api/project": {
      "get": {
        "tags": ["project"],
        "operationId": "v2.project.list",
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Project"
                  }
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "List known projects.",
        "summary": "List projects"
      }
    },
    "/api/project/current": {
      "get": {
        "tags": ["project"],
        "operationId": "v2.project.current",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Project.Current",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project.Current"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Resolve the project for the requested location.",
        "summary": "Get current project"
      }
    },
    "/api/form/request": {
      "get": {
        "tags": ["form"],
        "operationId": "v2.form.request.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Form.Info"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve pending forms for a location.",
        "summary": "List pending form requests"
      }
    },
    "/api/session/{sessionID}/form": {
      "get": {
        "tags": ["form"],
        "operationId": "v2.session.form.list",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Form.Info"
                      }
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Retrieve pending forms for a session.",
        "summary": "List session forms"
      },
      "post": {
        "tags": ["form"],
        "operationId": "v2.session.form.create",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Form.Info"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "ConflictError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConflictError"
                }
              }
            }
          }
        },
        "description": "Create a form for a session.",
        "summary": "Create session form",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Form.CreatePayload"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/form/{formID}": {
      "get": {
        "tags": ["form"],
        "operationId": "v2.session.form.get",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "formID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^frm_"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Form.Info"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError | FormNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/FormNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Retrieve a form for a session.",
        "summary": "Get session form"
      }
    },
    "/api/session/{sessionID}/form/{formID}/state": {
      "get": {
        "tags": ["form"],
        "operationId": "v2.session.form.state",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "formID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^frm_"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Form.State"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError | FormNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/FormNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Retrieve the current state for a form.",
        "summary": "Get form state"
      }
    },
    "/api/session/{sessionID}/form/{formID}/reply": {
      "post": {
        "tags": ["form"],
        "operationId": "v2.session.form.reply",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "formID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^frm_"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "FormInvalidAnswerError | InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/FormInvalidAnswerError"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError | FormNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/FormNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "FormAlreadySettledError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormAlreadySettledError"
                }
              }
            }
          }
        },
        "description": "Submit an answer to a pending form.",
        "summary": "Reply to form",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Form.Reply"
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/session/{sessionID}/form/{formID}/cancel": {
      "post": {
        "tags": ["form"],
        "operationId": "v2.session.form.cancel",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "formID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^frm_"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError | FormNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/FormNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "FormAlreadySettledError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormAlreadySettledError"
                }
              }
            }
          }
        },
        "description": "Cancel a pending form.",
        "summary": "Cancel form"
      }
    },
    "/api/permission/request": {
      "get": {
        "tags": ["permission"],
        "operationId": "v2.permission.request.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Permission.Request"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve pending permission requests for a location.",
        "summary": "List pending permission requests"
      }
    },
    "/api/permission/saved": {
      "get": {
        "tags": ["permission"],
        "operationId": "v2.permission.saved.list",
        "parameters": [
          {
            "name": "projectID",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PermissionSaved.Info"
                      }
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve saved permissions, optionally filtered by project.",
        "summary": "List saved permissions"
      }
    },
    "/api/permission/saved/{id}": {
      "delete": {
        "tags": ["permission"],
        "operationId": "v2.permission.saved.remove",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Remove a saved permission by ID.",
        "summary": "Remove saved permission"
      }
    },
    "/api/session/{sessionID}/permission": {
      "post": {
        "tags": ["permission"],
        "operationId": "v2.session.permission.create",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "allOf": [
                            {
                              "pattern": "^per"
                            }
                          ]
                        },
                        "effect": {
                          "$ref": "#/components/schemas/Permission.Effect"
                        }
                      },
                      "required": ["id", "effect"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Evaluate and, when approval is required, create a permission request for a session.",
        "summary": "Create permission request",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "allOf": [
                          {
                            "pattern": "^per"
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "action": {
                    "type": "string"
                  },
                  "resources": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "save": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "metadata": {
                    "type": "object"
                  },
                  "source": {
                    "$ref": "#/components/schemas/Permission.Source"
                  },
                  "agent": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["action", "resources"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      },
      "get": {
        "tags": ["permission"],
        "operationId": "v2.session.permission.list",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Permission.Request"
                      }
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Retrieve pending permission requests owned by a session.",
        "summary": "List session permission requests"
      }
    },
    "/api/session/{sessionID}/permission/{requestID}": {
      "get": {
        "tags": ["permission"],
        "operationId": "v2.session.permission.get",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "requestID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^per"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Permission.Request"
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError | PermissionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PermissionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Retrieve a pending permission request owned by a session.",
        "summary": "Get permission request"
      }
    },
    "/api/session/{sessionID}/permission/{requestID}/reply": {
      "post": {
        "tags": ["permission"],
        "operationId": "v2.session.permission.reply",
        "parameters": [
          {
            "name": "sessionID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^ses"
                }
              ]
            },
            "required": true
          },
          {
            "name": "requestID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^per"
                }
              ]
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "SessionNotFoundError | PermissionNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PermissionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    },
                    {
                      "$ref": "#/components/schemas/SessionNotFoundError"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Respond to a pending permission request owned by a session.",
        "summary": "Reply to pending permission request",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reply": {
                    "$ref": "#/components/schemas/Permission.Reply"
                  },
                  "message": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["reply"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/fs/read/*": {
      "get": {
        "tags": ["filesystem"],
        "operationId": "v2.fs.read",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Serve one file relative to the requested location.",
        "summary": "Read file"
      }
    },
    "/api/fs/list": {
      "get": {
        "tags": ["filesystem"],
        "operationId": "v2.fs.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          },
          {
            "name": "path",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FileSystem.Entry"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "List direct children of one directory relative to the requested location.",
        "summary": "List directory"
      }
    },
    "/api/fs/find": {
      "get": {
        "tags": ["filesystem"],
        "operationId": "v2.fs.find",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          },
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": ["file", "directory"]
            },
            "required": false
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FileSystem.Entry"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Find recursively ranked filesystem entries relative to the requested location.",
        "summary": "Find files"
      }
    },
    "/api/command": {
      "get": {
        "tags": ["command"],
        "operationId": "v2.command.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Command.Info"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve currently registered commands.",
        "summary": "List commands"
      }
    },
    "/api/skill": {
      "get": {
        "tags": ["skill"],
        "operationId": "v2.skill.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Skill.Info"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Retrieve currently registered skills.",
        "summary": "List skills"
      }
    },
    "/api/event": {
      "get": {
        "tags": ["event"],
        "operationId": "v2.event.subscribe",
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "event": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/V2EventJsonString"
                    }
                  },
                  "required": ["id", "event", "data"],
                  "additionalProperties": false
                },
                "x-effect-stream": {
                  "encoding": "sse",
                  "causeSchema": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "_tag": {
                              "type": "string",
                              "enum": ["Fail"]
                            },
                            "error": {
                              "not": {}
                            }
                          },
                          "required": ["_tag", "error"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "_tag": {
                              "type": "string",
                              "enum": ["Die"]
                            },
                            "defect": {}
                          },
                          "required": ["_tag", "defect"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "_tag": {
                              "type": "string",
                              "enum": ["Interrupt"]
                            },
                            "fiberId": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": ["_tag", "fiberId"],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "errorSchema": {
                    "not": {}
                  },
                  "failureEvent": "effect/httpapi/stream/failure"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Subscribe to native event payloads for the server. Volatile by contract: a slow consumer overflows and fails the stream, and events during disconnection are missed.",
        "summary": "Subscribe to events"
      }
    },
    "/api/pty": {
      "get": {
        "tags": ["pty"],
        "operationId": "v2.pty.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Pty"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "List PTY sessions for a location, including exited sessions retained until removal.",
        "summary": "List PTY sessions"
      },
      "post": {
        "tags": ["pty"],
        "operationId": "v2.pty.create",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Pty"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Create a pseudo-terminal session for a location.",
        "summary": "Create PTY session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "command": {
                    "type": "string"
                  },
                  "args": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "cwd": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "env": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/pty/{ptyID}": {
      "get": {
        "tags": ["pty"],
        "operationId": "v2.pty.get",
        "parameters": [
          {
            "name": "ptyID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^pty"
                }
              ]
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Pty"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "PtyNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PtyNotFoundError"
                }
              }
            }
          }
        },
        "description": "Get one PTY session, including its exit code once exited.",
        "summary": "Get PTY session"
      },
      "put": {
        "tags": ["pty"],
        "operationId": "v2.pty.update",
        "parameters": [
          {
            "name": "ptyID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^pty"
                }
              ]
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Pty"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "PtyNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PtyNotFoundError"
                }
              }
            }
          }
        },
        "description": "Update the title or viewport size of one PTY session.",
        "summary": "Update PTY session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "size": {
                    "type": "object",
                    "properties": {
                      "rows": {
                        "type": "integer",
                        "allOf": [
                          {
                            "exclusiveMinimum": 0
                          }
                        ]
                      },
                      "cols": {
                        "type": "integer",
                        "allOf": [
                          {
                            "exclusiveMinimum": 0
                          }
                        ]
                      }
                    },
                    "required": ["rows", "cols"],
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      },
      "delete": {
        "tags": ["pty"],
        "operationId": "v2.pty.remove",
        "parameters": [
          {
            "name": "ptyID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^pty"
                }
              ]
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "PtyNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PtyNotFoundError"
                }
              }
            }
          }
        },
        "description": "Terminate and remove one PTY session.",
        "summary": "Remove PTY session"
      }
    },
    "/api/pty/{ptyID}/connect-token": {
      "post": {
        "tags": ["pty"],
        "operationId": "v2.pty.connect.token",
        "parameters": [
          {
            "name": "ptyID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^pty"
                }
              ]
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/PtyTicket.ConnectToken"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "403": {
            "description": "ForbiddenError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForbiddenError"
                }
              }
            }
          },
          "404": {
            "description": "PtyNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PtyNotFoundError"
                }
              }
            }
          }
        },
        "description": "Create a short-lived single-use ticket for opening a PTY WebSocket connection.",
        "summary": "Create PTY WebSocket token"
      }
    },
    "/api/pty/{ptyID}/connect": {
      "get": {
        "tags": ["pty"],
        "operationId": "v2.pty.connect",
        "parameters": [
          {
            "name": "ptyID",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^pty"
                }
              ]
            },
            "required": true
          },
          {
            "in": "query",
            "name": "location[directory]",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "location[workspace]",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ticket",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "403": {
            "description": "ForbiddenError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForbiddenError"
                }
              }
            }
          },
          "404": {
            "description": "PtyNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PtyNotFoundError"
                }
              }
            }
          }
        },
        "description": "Establish a WebSocket connection streaming PTY output and accepting terminal input.",
        "summary": "Connect to PTY session",
        "x-websocket": true
      }
    },
    "/api/shell": {
      "get": {
        "tags": ["shell"],
        "operationId": "v2.shell.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Shell.Info1"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "List currently running shell commands for a location. Exited commands are not included.",
        "summary": "List running shell commands"
      },
      "post": {
        "tags": ["shell"],
        "operationId": "v2.shell.create",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Shell.Info1"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Spawn one non-interactive shell command for a location. Combined stdout/stderr is captured to a file pageable via output.",
        "summary": "Run shell command",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "command": {
                    "type": "string"
                  },
                  "cwd": {
                    "type": "string"
                  },
                  "timeout": {
                    "type": "integer",
                    "allOf": [
                      {
                        "minimum": 0
                      }
                    ]
                  },
                  "metadata": {
                    "type": "object"
                  }
                },
                "required": ["command", "timeout"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/shell/{id}": {
      "get": {
        "tags": ["shell"],
        "operationId": "v2.shell.get",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^sh_"
                }
              ]
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Shell.Info1"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "ShellNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShellNotFoundError"
                }
              }
            }
          }
        },
        "description": "Get one shell command, including its status and exit code once exited.",
        "summary": "Get shell command"
      },
      "delete": {
        "tags": ["shell"],
        "operationId": "v2.shell.remove",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^sh_"
                }
              ]
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "ShellNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShellNotFoundError"
                }
              }
            }
          }
        },
        "description": "Terminate and remove one shell command and its retained output.",
        "summary": "Remove shell command"
      }
    },
    "/api/shell/{id}/timeout": {
      "patch": {
        "tags": ["shell"],
        "operationId": "v2.shell.timeout",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^sh_"
                }
              ]
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Shell.Info1"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "ShellNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShellNotFoundError"
                }
              }
            }
          }
        },
        "description": "Replace a running shell command's timeout from now, or clear it with zero.",
        "summary": "Update shell timeout",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "timeout": {
                    "type": "integer",
                    "allOf": [
                      {
                        "minimum": 0
                      }
                    ]
                  }
                },
                "required": ["timeout"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/shell/{id}/output": {
      "get": {
        "tags": ["shell"],
        "operationId": "v2.shell.output",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^sh_"
                }
              ]
            },
            "required": true
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?$"
                }
              ]
            },
            "required": false
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "string",
              "allOf": [
                {
                  "pattern": "^[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?$"
                }
              ]
            },
            "required": false
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "output": {
                          "type": "string"
                        },
                        "cursor": {
                          "type": "integer",
                          "allOf": [
                            {
                              "minimum": 0
                            }
                          ]
                        },
                        "size": {
                          "type": "integer",
                          "allOf": [
                            {
                              "minimum": 0
                            }
                          ]
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      },
                      "required": ["output", "cursor", "size", "truncated"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "404": {
            "description": "ShellNotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShellNotFoundError"
                }
              }
            }
          }
        },
        "description": "Page through captured combined output by absolute byte cursor.",
        "summary": "Read shell output"
      }
    },
    "/api/reference": {
      "get": {
        "tags": ["reference"],
        "operationId": "v2.reference.list",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Reference.Info"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "List references available in the requested location.",
        "summary": "List references"
      }
    },
    "/api/worktree/{projectID}": {
      "get": {
        "tags": ["worktree"],
        "operationId": "v2.worktree.list",
        "parameters": [
          {
            "name": "projectID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Worktree.List",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Worktree.List"
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "List known local worktrees for a project.",
        "summary": "List worktrees"
      },
      "post": {
        "tags": ["worktree"],
        "operationId": "v2.worktree.create",
        "parameters": [
          {
            "name": "projectID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Worktree.Info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Worktree.Info"
                }
              }
            }
          },
          "400": {
            "description": "WorktreeError | InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/WorktreeError"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Create a worktree for a project.",
        "summary": "Create worktree",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "strategy": {
                    "type": "string"
                  },
                  "from": {
                    "type": "string"
                  },
                  "directory": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": ["strategy", "directory"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      },
      "delete": {
        "tags": ["worktree"],
        "operationId": "v2.worktree.remove",
        "parameters": [
          {
            "name": "projectID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "WorktreeError | InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/WorktreeError"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Remove a managed worktree from a project.",
        "summary": "Remove worktree",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "directory": {
                    "type": "string"
                  },
                  "force": {
                    "type": "boolean"
                  }
                },
                "required": ["directory", "force"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/worktree/{projectID}/refresh": {
      "post": {
        "tags": ["worktree"],
        "operationId": "v2.worktree.refresh",
        "parameters": [
          {
            "name": "projectID",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "WorktreeError | InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/WorktreeError"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Reconcile stored worktrees with the project repositories.",
        "summary": "Refresh worktrees"
      }
    },
    "/api/vcs": {
      "get": {
        "tags": ["vcs"],
        "operationId": "v2.vcs.get",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Vcs.Info"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Get current and default branch information for the requested location.",
        "summary": "VCS info"
      }
    },
    "/api/vcs/status": {
      "get": {
        "tags": ["vcs"],
        "operationId": "v2.vcs.status",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Vcs.FileStatus"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "List uncommitted working-copy changes relative to the requested location.",
        "summary": "VCS status"
      }
    },
    "/api/vcs/diff": {
      "get": {
        "tags": ["vcs"],
        "operationId": "v2.vcs.diff",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          },
          {
            "name": "mode",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/Vcs.Mode"
            },
            "required": true
          },
          {
            "name": "context",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FileDiff.Info"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Diff the working copy against HEAD (mode git) or the default-branch merge base (mode branch) for the requested location.",
        "summary": "VCS diff"
      }
    },
    "/api/debug/location": {
      "get": {
        "tags": ["debug"],
        "operationId": "v2.debug.location.list",
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Location.Ref"
                  }
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "List locations currently loaded by the server.",
        "summary": "List loaded locations"
      },
      "delete": {
        "tags": ["debug"],
        "operationId": "v2.debug.location.evict",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "204": {
            "description": "<No Content>"
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Dispose the requested location's cached services so its next use boots them fresh.",
        "summary": "Evict a loaded location"
      }
    },
    "/api/experimental/migration/v1": {
      "get": {
        "tags": ["migration"],
        "operationId": "v2.experimental.migration.v1.status",
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["required", "completed"]
                        }
                      },
                      "required": ["status"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["running"]
                        },
                        "progress": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string"
                            },
                            "numerator": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "allOf": [
                                    {
                                      "minimum": 0
                                    }
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "denominator": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "allOf": [
                                    {
                                      "minimum": 0
                                    }
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": ["label"],
                          "additionalProperties": false
                        }
                      },
                      "required": ["status", "progress"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["error"]
                        },
                        "error": {
                          "type": "string"
                        }
                      },
                      "required": ["status", "error"],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Return the progress of the V1 to V2 session history migration.",
        "summary": "Get V1 migration status"
      }
    },
    "/api/websearch/provider": {
      "get": {
        "tags": ["websearch"],
        "operationId": "v2.websearch.providers",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebSearch.Provider"
                      }
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "503": {
            "description": "ServiceUnavailableError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceUnavailableError"
                }
              }
            }
          }
        },
        "description": "Return the registered web search providers.",
        "summary": "List web search providers"
      }
    },
    "/api/websearch": {
      "post": {
        "tags": ["websearch"],
        "operationId": "v2.websearch.query",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "$ref": "#/components/schemas/Location.Info"
                    },
                    "data": {
                      "$ref": "#/components/schemas/WebSearch.Response"
                    }
                  },
                  "required": ["location", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/InvalidRequestError1"
                    },
                    {
                      "$ref": "#/components/schemas/InvalidRequestError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          },
          "503": {
            "description": "ServiceUnavailableError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceUnavailableError"
                }
              }
            }
          }
        },
        "description": "Run one web search through the selected provider. Specify a provider to override the configured default.",
        "summary": "Search the web",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string"
                  },
                  "providerID": {
                    "type": "string"
                  }
                },
                "required": ["query"],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    },
    "/api/config": {
      "get": {
        "tags": ["config"],
        "operationId": "v2.config.get",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workspace": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "required": false,
            "style": "deepObject",
            "explode": true
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Config.Entry"
                  }
                }
              }
            }
          },
          "400": {
            "description": "InvalidRequestError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidRequestError"
                }
              }
            }
          },
          "401": {
            "description": "UnauthorizedError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedError"
                }
              }
            }
          }
        },
        "description": "Return configuration documents and discovery sources for the requested location, from lowest to highest priority.",
        "summary": "Get configuration"
      }
    }
  },
  "components": {
    "schemas": {
      "ServiceHealth": {
        "type": "object",
        "properties": {
          "healthy": {
            "type": "boolean",
            "enum": [true]
          },
          "version": {
            "type": "string"
          },
          "pid": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          }
        },
        "required": ["healthy", "version", "pid"],
        "additionalProperties": false
      },
      "UnauthorizedError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["UnauthorizedError"]
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "message"],
        "additionalProperties": false
      },
      "InvalidRequestError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["InvalidRequestError"]
          },
          "message": {
            "type": "string"
          },
          "kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "field": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["_tag", "message"],
        "additionalProperties": false
      },
      "ServiceStopRequest": {
        "type": "object",
        "properties": {
          "instanceID": {
            "type": "string"
          }
        },
        "required": ["instanceID"],
        "additionalProperties": false
      },
      "ServiceStopResponse": {
        "type": "object",
        "properties": {
          "accepted": {
            "type": "boolean"
          }
        },
        "required": ["accepted"],
        "additionalProperties": false
      },
      "Location.Info": {
        "type": "object",
        "properties": {
          "directory": {
            "type": "string"
          },
          "workspaceID": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^wrk"
              }
            ]
          },
          "project": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "directory": {
                "type": "string"
              },
              "canonical": {
                "type": "string"
              }
            },
            "required": ["id", "directory", "canonical"],
            "additionalProperties": false
          }
        },
        "required": ["directory", "project"],
        "additionalProperties": false
      },
      "Model.Ref": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "providerID": {
            "type": "string"
          },
          "variant": {
            "type": "string"
          }
        },
        "required": ["id", "providerID"],
        "additionalProperties": false
      },
      "Provider.Settings": {
        "type": "object"
      },
      "Provider.Request": {
        "type": "object",
        "properties": {
          "settings": {
            "$ref": "#/components/schemas/Provider.Settings"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "type": "object"
          }
        },
        "required": ["settings", "headers", "body"],
        "additionalProperties": false
      },
      "Agent.Color": {
        "type": "string"
      },
      "Permission.Effect": {
        "type": "string",
        "enum": ["allow", "deny", "ask"]
      },
      "Permission.Rule": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string"
          },
          "resource": {
            "type": "string"
          },
          "effect": {
            "$ref": "#/components/schemas/Permission.Effect"
          }
        },
        "required": ["action", "resource", "effect"],
        "additionalProperties": false
      },
      "Permission.Ruleset": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Permission.Rule"
        }
      },
      "Agent.Info": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "model": {
            "$ref": "#/components/schemas/Model.Ref"
          },
          "request": {
            "$ref": "#/components/schemas/Provider.Request"
          },
          "system": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": ["subagent", "primary", "all"]
          },
          "hidden": {
            "type": "boolean"
          },
          "color": {
            "$ref": "#/components/schemas/Agent.Color"
          },
          "steps": {
            "type": "integer",
            "allOf": [
              {
                "exclusiveMinimum": 0
              }
            ]
          },
          "permissions": {
            "$ref": "#/components/schemas/Permission.Ruleset"
          }
        },
        "required": ["id", "name", "request", "mode", "hidden", "permissions"],
        "additionalProperties": false
      },
      "AgentNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["AgentNotFoundError"]
          },
          "agentID": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "agentID", "message"],
        "additionalProperties": false
      },
      "Plugin.Info": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "required": ["id"],
        "additionalProperties": false
      },
      "Session.ForkBoundary": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["before"]
              },
              "messageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              }
            },
            "required": ["type", "messageID"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["through"]
              },
              "messageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              }
            },
            "required": ["type", "messageID"],
            "additionalProperties": false
          }
        ]
      },
      "Money.USD": {
        "type": "number"
      },
      "TokenUsage.Info": {
        "type": "object",
        "properties": {
          "input": {
            "type": "number"
          },
          "output": {
            "type": "number"
          },
          "reasoning": {
            "type": "number"
          },
          "cache": {
            "type": "object",
            "properties": {
              "read": {
                "type": "number"
              },
              "write": {
                "type": "number"
              }
            },
            "required": ["read", "write"],
            "additionalProperties": false
          }
        },
        "required": ["input", "output", "reasoning", "cache"],
        "additionalProperties": false
      },
      "Location.Ref": {
        "type": "object",
        "properties": {
          "directory": {
            "type": "string"
          },
          "workspaceID": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^wrk"
              }
            ]
          }
        },
        "required": ["directory"],
        "additionalProperties": false
      },
      "FileDiff.Info": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string"
          },
          "patch": {
            "type": "string"
          },
          "additions": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "deletions": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": ["added", "deleted", "modified"]
          }
        },
        "required": ["file", "patch", "additions", "deletions", "status"],
        "additionalProperties": false
      },
      "Session.Revert": {
        "type": "object",
        "properties": {
          "messageID": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "partID": {
            "type": "string"
          },
          "snapshot": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileDiff.Info"
            }
          }
        },
        "required": ["messageID"],
        "additionalProperties": false
      },
      "Session.Info": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^ses"
              }
            ]
          },
          "parentID": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^ses"
              }
            ]
          },
          "fork": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "boundary": {
                "$ref": "#/components/schemas/Session.ForkBoundary"
              }
            },
            "required": ["sessionID", "boundary"],
            "additionalProperties": false
          },
          "projectID": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "model": {
            "$ref": "#/components/schemas/Model.Ref"
          },
          "cost": {
            "$ref": "#/components/schemas/Money.USD"
          },
          "tokens": {
            "$ref": "#/components/schemas/TokenUsage.Info"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              },
              "archived": {
                "type": "number"
              }
            },
            "required": ["created", "updated"],
            "additionalProperties": false
          },
          "title": {
            "type": "string"
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "subpath": {
            "type": "string"
          },
          "revert": {
            "$ref": "#/components/schemas/Session.Revert"
          }
        },
        "required": ["id", "projectID", "cost", "tokens", "time", "location"],
        "additionalProperties": false
      },
      "SessionsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Session.Info"
            }
          },
          "cursor": {
            "type": "object",
            "properties": {
              "previous": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "next": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["data", "cursor"],
        "additionalProperties": false
      },
      "InvalidCursorError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["InvalidCursorError"]
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "message"],
        "additionalProperties": false
      },
      "InvalidRequestError1": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["InvalidRequestError"]
          },
          "message": {
            "type": "string"
          },
          "kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "field": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["_tag", "message"],
        "additionalProperties": false
      },
      "Session.Message.AgentSelected": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "type": {
            "type": "string",
            "enum": ["agent-switched"]
          },
          "agent": {
            "type": "string"
          },
          "previous": {
            "type": "string"
          }
        },
        "required": ["id", "time", "type", "agent"],
        "additionalProperties": false
      },
      "Session.Message.ModelSelected": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "type": {
            "type": "string",
            "enum": ["model-switched"]
          },
          "model": {
            "$ref": "#/components/schemas/Model.Ref"
          },
          "previous": {
            "$ref": "#/components/schemas/Model.Ref"
          }
        },
        "required": ["id", "time", "type", "model"],
        "additionalProperties": false
      },
      "Session.Message.LocationSwitched": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "type": {
            "type": "string",
            "enum": ["location-switched"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "projectID": {
            "type": "string"
          },
          "subpath": {
            "type": "string"
          },
          "previous": {
            "type": "object",
            "properties": {
              "location": {
                "$ref": "#/components/schemas/Location.Ref"
              },
              "projectID": {
                "type": "string"
              },
              "subpath": {
                "type": "string"
              }
            },
            "required": ["location"],
            "additionalProperties": false
          }
        },
        "required": ["id", "time", "type", "location"],
        "additionalProperties": false
      },
      "Prompt.Base64": {
        "type": "string",
        "allOf": [
          {
            "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
          }
        ]
      },
      "Prompt.FileSource": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["inline"]
              }
            },
            "required": ["type"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["uri"]
              },
              "uri": {
                "type": "string"
              }
            },
            "required": ["type", "uri"],
            "additionalProperties": false
          }
        ]
      },
      "Prompt.Mention": {
        "type": "object",
        "properties": {
          "start": {
            "type": "number"
          },
          "end": {
            "type": "number"
          },
          "text": {
            "type": "string"
          }
        },
        "required": ["start", "end", "text"],
        "additionalProperties": false
      },
      "Prompt.FileAttachment": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Prompt.Base64"
          },
          "mime": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/Prompt.FileSource"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "mention": {
            "$ref": "#/components/schemas/Prompt.Mention"
          }
        },
        "required": ["data", "mime", "source"],
        "additionalProperties": false
      },
      "Prompt.AgentAttachment": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "mention": {
            "$ref": "#/components/schemas/Prompt.Mention"
          }
        },
        "required": ["name"],
        "additionalProperties": false
      },
      "Prompt.SkillAttachment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "mention": {
            "$ref": "#/components/schemas/Prompt.Mention"
          }
        },
        "required": ["id", "name", "text"],
        "additionalProperties": false
      },
      "Session.Message.User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "text": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Prompt.FileAttachment"
            }
          },
          "agents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Prompt.AgentAttachment"
            }
          },
          "skills": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Prompt.SkillAttachment"
            }
          },
          "type": {
            "type": "string",
            "enum": ["user"]
          }
        },
        "required": ["id", "time", "text", "type"],
        "additionalProperties": false
      },
      "Session.Message.Synthetic": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "text": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": ["synthetic"]
          }
        },
        "required": ["id", "time", "text", "type"],
        "additionalProperties": false
      },
      "Session.Message.System": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "type": {
            "type": "string",
            "enum": ["system"]
          },
          "text": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        },
        "required": ["id", "time", "type", "text"],
        "additionalProperties": false
      },
      "Session.Message.Skill": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "type": {
            "type": "string",
            "enum": ["skill"]
          },
          "skill": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "required": ["id", "time", "type", "skill", "name", "text"],
        "additionalProperties": false
      },
      "Session.Message.Shell": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "completed": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "type": {
            "type": "string",
            "enum": ["shell"]
          },
          "shellID": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^sh_"
              }
            ]
          },
          "command": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["running", "exited", "timeout", "killed"]
          },
          "exit": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "enum": ["NaN"]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity"]
                  },
                  {
                    "type": "string",
                    "enum": ["-Infinity"]
                  }
                ]
              },
              {
                "type": "string",
                "enum": ["Infinity", "-Infinity", "NaN"]
              }
            ]
          },
          "output": {
            "type": "object",
            "properties": {
              "output": {
                "type": "string"
              },
              "cursor": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "size": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "truncated": {
                "type": "boolean"
              }
            },
            "required": ["output", "cursor", "size", "truncated"],
            "additionalProperties": false
          }
        },
        "required": ["id", "time", "type", "shellID", "command", "status"],
        "additionalProperties": false
      },
      "Session.Message.ProviderState": {
        "type": "object"
      },
      "Session.Message.Assistant.Text": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["text"]
          },
          "text": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/Session.Message.ProviderState"
          }
        },
        "required": ["type", "text"],
        "additionalProperties": false
      },
      "Session.Message.Assistant.Reasoning": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["reasoning"]
          },
          "text": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/Session.Message.ProviderState"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "completed": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          }
        },
        "required": ["type", "text"],
        "additionalProperties": false
      },
      "Session.Message.ToolState.Streaming": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["streaming"]
          },
          "input": {
            "type": "string"
          }
        },
        "required": ["status", "input"],
        "additionalProperties": false
      },
      "Session.Message.ToolState.Running": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["running"]
          },
          "input": {
            "type": "object"
          },
          "metadata": {
            "type": "object"
          }
        },
        "required": ["status", "input", "metadata"],
        "additionalProperties": false
      },
      "Tool.TextContent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["text"]
          },
          "text": {
            "type": "string"
          }
        },
        "required": ["type", "text"],
        "additionalProperties": false
      },
      "Tool.FileContent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["file"]
          },
          "uri": {
            "type": "string"
          },
          "mime": {
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["type", "uri", "mime"],
        "additionalProperties": false
      },
      "Tool.Content": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Tool.TextContent"
          },
          {
            "$ref": "#/components/schemas/Tool.FileContent"
          }
        ]
      },
      "Session.Message.ToolState.Completed": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["completed"]
          },
          "input": {
            "type": "object"
          },
          "content": {
            "type": "array",
            "prefixItems": [
              {
                "$ref": "#/components/schemas/Tool.Content"
              }
            ],
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/Tool.Content"
            }
          },
          "metadata": {
            "type": "object"
          }
        },
        "required": ["status", "input", "content"],
        "additionalProperties": false
      },
      "Session.StructuredError": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 100,
                "maximum": 599
              }
            ]
          }
        },
        "required": ["type", "message"],
        "additionalProperties": false
      },
      "Session.Message.ToolState.Error": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["error"]
          },
          "input": {
            "type": "object"
          },
          "error": {
            "$ref": "#/components/schemas/Session.StructuredError"
          },
          "content": {
            "type": "array",
            "prefixItems": [
              {
                "$ref": "#/components/schemas/Tool.Content"
              }
            ],
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/Tool.Content"
            }
          },
          "metadata": {
            "type": "object"
          }
        },
        "required": ["status", "input", "error"],
        "additionalProperties": false
      },
      "Session.Message.Assistant.Tool": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["tool"]
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "executed": {
            "type": "boolean"
          },
          "providerState": {
            "$ref": "#/components/schemas/Session.Message.ProviderState"
          },
          "providerResultState": {
            "$ref": "#/components/schemas/Session.Message.ProviderState"
          },
          "state": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Session.Message.ToolState.Streaming"
              },
              {
                "$ref": "#/components/schemas/Session.Message.ToolState.Running"
              },
              {
                "$ref": "#/components/schemas/Session.Message.ToolState.Completed"
              },
              {
                "$ref": "#/components/schemas/Session.Message.ToolState.Error"
              }
            ]
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "ran": {
                "type": "number"
              },
              "completed": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          }
        },
        "required": ["type", "id", "name", "state", "time"],
        "additionalProperties": false
      },
      "Session.Message.Assistant.Retry": {
        "type": "object",
        "properties": {
          "attempt": {
            "type": "integer",
            "allOf": [
              {
                "exclusiveMinimum": 0
              }
            ]
          },
          "at": {
            "type": "number"
          },
          "error": {
            "$ref": "#/components/schemas/Session.StructuredError"
          }
        },
        "required": ["attempt", "at", "error"],
        "additionalProperties": false
      },
      "Session.Message.Assistant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "completed": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "type": {
            "type": "string",
            "enum": ["assistant"]
          },
          "agent": {
            "type": "string"
          },
          "model": {
            "$ref": "#/components/schemas/Model.Ref"
          },
          "content": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Session.Message.Assistant.Text"
                },
                {
                  "$ref": "#/components/schemas/Session.Message.Assistant.Reasoning"
                },
                {
                  "$ref": "#/components/schemas/Session.Message.Assistant.Tool"
                }
              ]
            }
          },
          "snapshot": {
            "type": "object",
            "properties": {
              "start": {
                "type": "string"
              },
              "end": {
                "type": "string"
              },
              "files": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          },
          "finish": {
            "type": "string",
            "enum": ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]
          },
          "cost": {
            "$ref": "#/components/schemas/Money.USD"
          },
          "tokens": {
            "$ref": "#/components/schemas/TokenUsage.Info"
          },
          "error": {
            "$ref": "#/components/schemas/Session.StructuredError"
          },
          "retry": {
            "$ref": "#/components/schemas/Session.Message.Assistant.Retry"
          }
        },
        "required": ["id", "time", "type", "agent", "model", "content"],
        "additionalProperties": false
      },
      "Session.Message.Compaction.Running": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["compaction"]
          },
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": ["running"]
          },
          "reason": {
            "type": "string",
            "enum": ["auto", "manual"]
          },
          "summary": {
            "type": "string"
          },
          "recent": {
            "type": "string"
          }
        },
        "required": ["type", "id", "time", "status", "reason", "summary", "recent"],
        "additionalProperties": false
      },
      "Session.Message.Compaction.Completed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["compaction"]
          },
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": ["completed"]
          },
          "reason": {
            "type": "string",
            "enum": ["auto", "manual"]
          },
          "summary": {
            "type": "string"
          },
          "recent": {
            "type": "string"
          }
        },
        "required": ["type", "id", "time", "status", "reason", "summary", "recent"],
        "additionalProperties": false
      },
      "Session.Message.Compaction.Failed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["compaction"]
          },
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": ["created"],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": ["failed"]
          },
          "reason": {
            "type": "string",
            "enum": ["auto", "manual"]
          },
          "error": {
            "$ref": "#/components/schemas/Session.StructuredError"
          }
        },
        "required": ["type", "id", "time", "status", "reason", "error"],
        "additionalProperties": false
      },
      "Session.Message.Compaction": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Session.Message.Compaction.Running"
          },
          {
            "$ref": "#/components/schemas/Session.Message.Compaction.Completed"
          },
          {
            "$ref": "#/components/schemas/Session.Message.Compaction.Failed"
          }
        ]
      },
      "Session.Message.Info": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Session.Message.AgentSelected"
          },
          {
            "$ref": "#/components/schemas/Session.Message.ModelSelected"
          },
          {
            "$ref": "#/components/schemas/Session.Message.LocationSwitched"
          },
          {
            "$ref": "#/components/schemas/Session.Message.User"
          },
          {
            "$ref": "#/components/schemas/Session.Message.Synthetic"
          },
          {
            "$ref": "#/components/schemas/Session.Message.System"
          },
          {
            "$ref": "#/components/schemas/Session.Message.Skill"
          },
          {
            "$ref": "#/components/schemas/Session.Message.Shell"
          },
          {
            "$ref": "#/components/schemas/Session.Message.Assistant"
          },
          {
            "$ref": "#/components/schemas/Session.Message.Compaction"
          }
        ]
      },
      "ConflictError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["ConflictError"]
          },
          "message": {
            "type": "string"
          },
          "resource": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["_tag", "message"],
        "additionalProperties": false
      },
      "SessionTransfer.Data": {
        "type": "object",
        "properties": {
          "info": {
            "$ref": "#/components/schemas/Session.Info"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Session.Message.Info"
            }
          }
        },
        "required": ["info", "messages"],
        "additionalProperties": false
      },
      "SessionNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["SessionNotFoundError"]
          },
          "sessionID": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "sessionID", "message"],
        "additionalProperties": false
      },
      "UnknownError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["UnknownError"]
          },
          "message": {
            "type": "string"
          },
          "ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["_tag", "message"],
        "additionalProperties": false
      },
      "SessionActive": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["running"]
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      "Session.ForkRequestBoundary": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["before"]
              },
              "messageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              }
            },
            "required": ["type", "messageID"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["through"]
              }
            },
            "required": ["type"],
            "additionalProperties": false
          }
        ]
      },
      "MessageNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["MessageNotFoundError"]
          },
          "sessionID": {
            "type": "string"
          },
          "messageID": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "sessionID", "messageID", "message"],
        "additionalProperties": false
      },
      "Session.Inbox.Delivery": {
        "type": "string",
        "enum": ["steer", "queue"]
      },
      "PromptInput.FileAttachment": {
        "type": "object",
        "properties": {
          "uri": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "mention": {
            "$ref": "#/components/schemas/Prompt.Mention"
          }
        },
        "required": ["uri"],
        "additionalProperties": false
      },
      "PromptInput.SkillAttachment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "mention": {
            "$ref": "#/components/schemas/Prompt.Mention"
          }
        },
        "required": ["id"],
        "additionalProperties": false
      },
      "Session.Inbox.UserPayload": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Prompt.FileAttachment"
            }
          },
          "agents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Prompt.AgentAttachment"
            }
          },
          "skills": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Prompt.SkillAttachment"
            }
          },
          "metadata": {
            "type": "object"
          }
        },
        "required": ["text"],
        "additionalProperties": false
      },
      "Session.Inbox.User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "sessionID": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^ses"
              }
            ]
          },
          "timeCreated": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "enum": ["user"]
          },
          "payload": {
            "$ref": "#/components/schemas/Session.Inbox.UserPayload"
          },
          "delivery": {
            "$ref": "#/components/schemas/Session.Inbox.Delivery"
          }
        },
        "required": ["id", "sessionID", "timeCreated", "type", "payload", "delivery"],
        "additionalProperties": false
      },
      "CommandNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["CommandNotFoundError"]
          },
          "command": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "command", "message"],
        "additionalProperties": false
      },
      "CommandEvaluationError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["CommandEvaluationError"]
          },
          "command": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "command", "message"],
        "additionalProperties": false
      },
      "SkillNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["SkillNotFoundError"]
          },
          "skill": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "skill", "message"],
        "additionalProperties": false
      },
      "Session.Inbox.SyntheticPayload": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "metadata": {
            "type": "object"
          }
        },
        "required": ["text"],
        "additionalProperties": false
      },
      "Session.Inbox.Synthetic": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "sessionID": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^ses"
              }
            ]
          },
          "timeCreated": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "enum": ["synthetic"]
          },
          "payload": {
            "$ref": "#/components/schemas/Session.Inbox.SyntheticPayload"
          },
          "delivery": {
            "$ref": "#/components/schemas/Session.Inbox.Delivery"
          }
        },
        "required": ["id", "sessionID", "timeCreated", "type", "payload", "delivery"],
        "additionalProperties": false
      },
      "Session.Inbox.CompactionPayload": {
        "anyOf": [
          {
            "type": "object"
          },
          {
            "type": "array"
          }
        ]
      },
      "Session.Inbox.Compaction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "sessionID": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^ses"
              }
            ]
          },
          "timeCreated": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "enum": ["compaction"]
          },
          "payload": {
            "$ref": "#/components/schemas/Session.Inbox.CompactionPayload"
          },
          "delivery": {
            "$ref": "#/components/schemas/Session.Inbox.Delivery"
          }
        },
        "required": ["id", "sessionID", "timeCreated", "type", "payload", "delivery"],
        "additionalProperties": false
      },
      "ServiceUnavailableError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["ServiceUnavailableError"]
          },
          "message": {
            "type": "string"
          },
          "service": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["_tag", "message"],
        "additionalProperties": false
      },
      "SessionBusyError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["SessionBusyError"]
          },
          "sessionID": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "sessionID", "message"],
        "additionalProperties": false
      },
      "Session.Inbox.MovePayload": {
        "type": "object",
        "properties": {
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "projectID": {
            "type": "string"
          },
          "subpath": {
            "type": "string"
          }
        },
        "required": ["location", "projectID"],
        "additionalProperties": false
      },
      "Session.Inbox.Move": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^msg_"
              }
            ]
          },
          "sessionID": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^ses"
              }
            ]
          },
          "timeCreated": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "enum": ["move"]
          },
          "payload": {
            "$ref": "#/components/schemas/Session.Inbox.MovePayload"
          },
          "delivery": {
            "$ref": "#/components/schemas/Session.Inbox.Delivery"
          }
        },
        "required": ["id", "sessionID", "timeCreated", "type", "payload", "delivery"],
        "additionalProperties": false
      },
      "Session.Inbox.Info": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Session.Inbox.User"
          },
          {
            "$ref": "#/components/schemas/Session.Inbox.Synthetic"
          },
          {
            "$ref": "#/components/schemas/Session.Inbox.Compaction"
          },
          {
            "$ref": "#/components/schemas/Session.Inbox.Move"
          }
        ]
      },
      "InstructionEntry.Key": {
        "type": "string",
        "allOf": [
          {
            "pattern": "^[a-z0-9][a-z0-9._-]*$",
            "description": "Instruction entry key (lowercase alphanumerics plus . _ -)"
          }
        ]
      },
      "InstructionEntry.Info": {
        "type": "object",
        "properties": {
          "key": {
            "$ref": "#/components/schemas/InstructionEntry.Key"
          },
          "value": {}
        },
        "required": ["key", "value"],
        "additionalProperties": false
      },
      "InstructionEntryValueTooLargeError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["InstructionEntryValueTooLargeError"]
          },
          "actualBytes": {
            "type": "integer"
          },
          "maxBytes": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "actualBytes", "maxBytes", "message"],
        "additionalProperties": false
      },
      "SessionGenerateResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string"
              }
            },
            "required": ["text"],
            "additionalProperties": false
          }
        },
        "required": ["data"],
        "additionalProperties": false
      },
      "session.created": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.created"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "projectID": {
                "type": "string"
              },
              "location": {
                "$ref": "#/components/schemas/Location.Ref"
              },
              "subpath": {
                "type": "string"
              },
              "parentID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "slug": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "agent": {
                "type": "string"
              },
              "model": {
                "$ref": "#/components/schemas/Model.Ref"
              },
              "version": {
                "type": "string"
              }
            },
            "required": ["sessionID", "projectID", "location", "slug", "version"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.agent.selected": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.agent.selected"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "agent": {
                "type": "string"
              },
              "previous": {
                "type": "string"
              }
            },
            "required": ["sessionID", "agent"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.model.selected": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.model.selected"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "model": {
                "$ref": "#/components/schemas/Model.Ref"
              },
              "previous": {
                "$ref": "#/components/schemas/Model.Ref"
              }
            },
            "required": ["sessionID", "model"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.moved": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.moved"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "location": {
                "$ref": "#/components/schemas/Location.Ref"
              },
              "projectID": {
                "type": "string"
              },
              "subpath": {
                "type": "string"
              }
            },
            "required": ["sessionID", "location", "projectID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.renamed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.renamed"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "title": {
                "type": "string"
              }
            },
            "required": ["sessionID", "title"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.deleted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.deleted"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [2]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              }
            },
            "required": ["sessionID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.forked": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.forked"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [2]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "parentID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "boundary": {
                "$ref": "#/components/schemas/Session.ForkBoundary"
              },
              "instructions": {
                "type": "object",
                "patternProperties": {
                  "^[a-z0-9][a-z0-9._-]*\\/[a-z0-9][a-z0-9._/-]*$": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^[a-f0-9]{64}$"
                      }
                    ]
                  }
                }
              }
            },
            "required": ["sessionID", "parentID", "boundary"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.inbox.delivered": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.inbox.delivered"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "inboxID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              }
            },
            "required": ["sessionID", "inboxID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "Session.Inbox.UserPayload1": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Prompt.FileAttachment"
            }
          },
          "agents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Prompt.AgentAttachment"
            }
          },
          "skills": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Prompt.SkillAttachment"
            }
          },
          "metadata": {
            "type": "object"
          }
        },
        "required": ["text"],
        "additionalProperties": false
      },
      "Session.Inbox.SyntheticPayload1": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "metadata": {
            "type": "object"
          }
        },
        "required": ["text"],
        "additionalProperties": false
      },
      "Session.Inbox.Item": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["user"]
              },
              "payload": {
                "$ref": "#/components/schemas/Session.Inbox.UserPayload1"
              },
              "delivery": {
                "$ref": "#/components/schemas/Session.Inbox.Delivery"
              }
            },
            "required": ["type", "payload", "delivery"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["synthetic"]
              },
              "payload": {
                "$ref": "#/components/schemas/Session.Inbox.SyntheticPayload1"
              },
              "delivery": {
                "$ref": "#/components/schemas/Session.Inbox.Delivery"
              }
            },
            "required": ["type", "payload", "delivery"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["compaction"]
              },
              "payload": {
                "$ref": "#/components/schemas/Session.Inbox.CompactionPayload"
              },
              "delivery": {
                "$ref": "#/components/schemas/Session.Inbox.Delivery"
              }
            },
            "required": ["type", "payload", "delivery"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["move"]
              },
              "payload": {
                "$ref": "#/components/schemas/Session.Inbox.MovePayload"
              },
              "delivery": {
                "$ref": "#/components/schemas/Session.Inbox.Delivery"
              }
            },
            "required": ["type", "payload", "delivery"],
            "additionalProperties": false
          }
        ]
      },
      "session.inbox.enqueued": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.inbox.enqueued"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "inboxID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "item": {
                "$ref": "#/components/schemas/Session.Inbox.Item"
              }
            },
            "required": ["sessionID", "inboxID", "item"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.inbox.cancelled": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.inbox.cancelled"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "inboxID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              }
            },
            "required": ["sessionID", "inboxID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.inbox.delivery.changed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.inbox.delivery.changed"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "inboxID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "delivery": {
                "$ref": "#/components/schemas/Session.Inbox.Delivery"
              }
            },
            "required": ["sessionID", "inboxID", "delivery"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.execution.started": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.execution.started"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              }
            },
            "required": ["sessionID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.execution.succeeded": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.execution.succeeded"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              }
            },
            "required": ["sessionID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.execution.failed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.execution.failed"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "error": {
                "$ref": "#/components/schemas/Session.StructuredError"
              }
            },
            "required": ["sessionID", "error"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.execution.interrupted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.execution.interrupted"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "reason": {
                "type": "string",
                "enum": ["user", "shutdown", "superseded"]
              }
            },
            "required": ["sessionID", "reason"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.instructions.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.instructions.updated"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [2]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "delta": {
                "type": "object",
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^[a-f0-9]{64}$"
                        }
                      ]
                    },
                    {
                      "type": "string",
                      "enum": ["removed"]
                    }
                  ]
                }
              },
              "text": {
                "type": "string"
              }
            },
            "required": ["sessionID", "delta"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.synthetic": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.synthetic"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "text": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "metadata": {
                "type": "object"
              }
            },
            "required": ["sessionID", "text"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.skill.activated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.skill.activated"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            },
            "required": ["sessionID", "id", "name", "text"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "Shell.Info": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^sh_"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": ["running", "exited", "timeout", "killed"]
          },
          "command": {
            "type": "string"
          },
          "cwd": {
            "type": "string"
          },
          "shell": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "pid": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "exit": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "started": {
                "type": "number"
              },
              "completed": {
                "type": "number"
              }
            },
            "required": ["started"],
            "additionalProperties": false
          }
        },
        "required": ["id", "status", "command", "cwd", "shell", "file", "metadata", "time"],
        "additionalProperties": false
      },
      "session.shell.started": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.shell.started"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "shell": {
                "$ref": "#/components/schemas/Shell.Info"
              }
            },
            "required": ["sessionID", "shell"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.shell.ended": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.shell.ended"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "shell": {
                "$ref": "#/components/schemas/Shell.Info"
              },
              "output": {
                "type": "object",
                "properties": {
                  "output": {
                    "type": "string"
                  },
                  "cursor": {
                    "type": "integer",
                    "allOf": [
                      {
                        "minimum": 0
                      }
                    ]
                  },
                  "size": {
                    "type": "integer",
                    "allOf": [
                      {
                        "minimum": 0
                      }
                    ]
                  },
                  "truncated": {
                    "type": "boolean"
                  }
                },
                "required": ["output", "cursor", "size", "truncated"],
                "additionalProperties": false
              }
            },
            "required": ["sessionID", "shell", "output"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.step.started": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.step.started"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "agent": {
                "type": "string"
              },
              "model": {
                "$ref": "#/components/schemas/Model.Ref"
              },
              "snapshot": {
                "type": "string"
              }
            },
            "required": ["sessionID", "assistantMessageID", "agent", "model"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.step.ended": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.step.ended"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "finish": {
                "type": "string",
                "enum": ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]
              },
              "cost": {
                "$ref": "#/components/schemas/Money.USD"
              },
              "tokens": {
                "$ref": "#/components/schemas/TokenUsage.Info"
              },
              "snapshot": {
                "type": "string"
              },
              "files": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": ["sessionID", "assistantMessageID", "finish", "cost", "tokens"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.step.failed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.step.failed"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "error": {
                "$ref": "#/components/schemas/Session.StructuredError"
              },
              "cost": {
                "$ref": "#/components/schemas/Money.USD"
              },
              "tokens": {
                "$ref": "#/components/schemas/TokenUsage.Info"
              },
              "snapshot": {
                "type": "string"
              },
              "files": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": ["sessionID", "assistantMessageID", "error"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.text.started": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.text.started"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "ordinal": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              }
            },
            "required": ["sessionID", "assistantMessageID", "ordinal"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "Session.Message.ProviderState4": {
        "type": "object"
      },
      "session.text.ended": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.text.ended"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "ordinal": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "text": {
                "type": "string"
              },
              "state": {
                "$ref": "#/components/schemas/Session.Message.ProviderState4"
              }
            },
            "required": ["sessionID", "assistantMessageID", "ordinal", "text"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "Session.Message.ProviderState5": {
        "type": "object"
      },
      "session.reasoning.started": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.reasoning.started"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "ordinal": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "state": {
                "$ref": "#/components/schemas/Session.Message.ProviderState5"
              }
            },
            "required": ["sessionID", "assistantMessageID", "ordinal"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "Session.Message.ProviderState6": {
        "type": "object"
      },
      "session.reasoning.ended": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.reasoning.ended"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "ordinal": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "text": {
                "type": "string"
              },
              "state": {
                "$ref": "#/components/schemas/Session.Message.ProviderState6"
              }
            },
            "required": ["sessionID", "assistantMessageID", "ordinal", "text"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.tool.input.started": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.tool.input.started"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": ["sessionID", "assistantMessageID", "id", "name"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.tool.input.ended": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.tool.input.ended"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            },
            "required": ["sessionID", "assistantMessageID", "id", "text"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "Session.Message.ProviderState7": {
        "type": "object"
      },
      "session.tool.called": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.tool.called"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "input": {
                "type": "object"
              },
              "executed": {
                "type": "boolean"
              },
              "state": {
                "$ref": "#/components/schemas/Session.Message.ProviderState7"
              }
            },
            "required": ["sessionID", "assistantMessageID", "id", "input", "executed"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "Tool.FileContent1": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["file"]
          },
          "uri": {
            "type": "string"
          },
          "mime": {
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["type", "uri", "mime"],
        "additionalProperties": false
      },
      "Tool.Content1": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Tool.TextContent"
          },
          {
            "$ref": "#/components/schemas/Tool.FileContent1"
          }
        ]
      },
      "Session.Message.ProviderState8": {
        "type": "object"
      },
      "session.tool.success": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.tool.success"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [2]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "content": {
                "type": "array",
                "prefixItems": [
                  {
                    "$ref": "#/components/schemas/Tool.Content1"
                  }
                ],
                "minItems": 1,
                "items": {
                  "$ref": "#/components/schemas/Tool.Content1"
                }
              },
              "metadata": {
                "type": "object"
              },
              "executed": {
                "type": "boolean"
              },
              "resultState": {
                "$ref": "#/components/schemas/Session.Message.ProviderState8"
              }
            },
            "required": ["sessionID", "assistantMessageID", "id", "content", "executed"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "Session.Message.ProviderState9": {
        "type": "object"
      },
      "session.tool.failed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.tool.failed"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [2]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "error": {
                "$ref": "#/components/schemas/Session.StructuredError"
              },
              "content": {
                "type": "array",
                "prefixItems": [
                  {
                    "$ref": "#/components/schemas/Tool.Content1"
                  }
                ],
                "minItems": 1,
                "items": {
                  "$ref": "#/components/schemas/Tool.Content1"
                }
              },
              "metadata": {
                "type": "object"
              },
              "executed": {
                "type": "boolean"
              },
              "resultState": {
                "$ref": "#/components/schemas/Session.Message.ProviderState9"
              }
            },
            "required": ["sessionID", "assistantMessageID", "id", "error", "executed"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.retry.scheduled": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.retry.scheduled"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "attempt": {
                "type": "integer",
                "allOf": [
                  {
                    "exclusiveMinimum": 0
                  }
                ]
              },
              "at": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "error": {
                "$ref": "#/components/schemas/Session.StructuredError"
              }
            },
            "required": ["sessionID", "assistantMessageID", "attempt", "at", "error"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.compaction.started": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.compaction.started"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "reason": {
                "type": "string",
                "enum": ["auto", "manual"]
              },
              "recent": {
                "type": "string"
              },
              "inputID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              }
            },
            "required": ["sessionID", "reason", "recent"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.compaction.ended": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.compaction.ended"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "reason": {
                "type": "string",
                "enum": ["auto", "manual"]
              },
              "text": {
                "type": "string"
              },
              "recent": {
                "type": "string"
              }
            },
            "required": ["sessionID", "reason", "text", "recent"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.compaction.failed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.compaction.failed"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "reason": {
                "type": "string",
                "enum": ["auto", "manual"]
              },
              "error": {
                "$ref": "#/components/schemas/Session.StructuredError"
              },
              "inputID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              }
            },
            "required": ["sessionID", "reason", "error"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.revert.staged": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.revert.staged"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "revert": {
                "$ref": "#/components/schemas/Session.Revert"
              }
            },
            "required": ["sessionID", "revert"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.revert.cleared": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.revert.cleared"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              }
            },
            "required": ["sessionID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.revert.committed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.revert.committed"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "to": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              }
            },
            "required": ["sessionID", "to"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "session.usage.recorded": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.usage.recorded"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "source": {
                "type": "string",
                "enum": ["title", "compaction"]
              },
              "cost": {
                "$ref": "#/components/schemas/Money.USD"
              },
              "tokens": {
                "$ref": "#/components/schemas/TokenUsage.Info"
              }
            },
            "required": ["sessionID", "source", "cost", "tokens"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "Session.Event.Durable": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/session.created"
          },
          {
            "$ref": "#/components/schemas/session.agent.selected"
          },
          {
            "$ref": "#/components/schemas/session.model.selected"
          },
          {
            "$ref": "#/components/schemas/session.moved"
          },
          {
            "$ref": "#/components/schemas/session.renamed"
          },
          {
            "$ref": "#/components/schemas/session.deleted"
          },
          {
            "$ref": "#/components/schemas/session.forked"
          },
          {
            "$ref": "#/components/schemas/session.inbox.delivered"
          },
          {
            "$ref": "#/components/schemas/session.inbox.enqueued"
          },
          {
            "$ref": "#/components/schemas/session.inbox.cancelled"
          },
          {
            "$ref": "#/components/schemas/session.inbox.delivery.changed"
          },
          {
            "$ref": "#/components/schemas/session.execution.started"
          },
          {
            "$ref": "#/components/schemas/session.execution.succeeded"
          },
          {
            "$ref": "#/components/schemas/session.execution.failed"
          },
          {
            "$ref": "#/components/schemas/session.execution.interrupted"
          },
          {
            "$ref": "#/components/schemas/session.instructions.updated"
          },
          {
            "$ref": "#/components/schemas/session.synthetic"
          },
          {
            "$ref": "#/components/schemas/session.skill.activated"
          },
          {
            "$ref": "#/components/schemas/session.shell.started"
          },
          {
            "$ref": "#/components/schemas/session.shell.ended"
          },
          {
            "$ref": "#/components/schemas/session.step.started"
          },
          {
            "$ref": "#/components/schemas/session.step.ended"
          },
          {
            "$ref": "#/components/schemas/session.step.failed"
          },
          {
            "$ref": "#/components/schemas/session.text.started"
          },
          {
            "$ref": "#/components/schemas/session.text.ended"
          },
          {
            "$ref": "#/components/schemas/session.reasoning.started"
          },
          {
            "$ref": "#/components/schemas/session.reasoning.ended"
          },
          {
            "$ref": "#/components/schemas/session.tool.input.started"
          },
          {
            "$ref": "#/components/schemas/session.tool.input.ended"
          },
          {
            "$ref": "#/components/schemas/session.tool.called"
          },
          {
            "$ref": "#/components/schemas/session.tool.success"
          },
          {
            "$ref": "#/components/schemas/session.tool.failed"
          },
          {
            "$ref": "#/components/schemas/session.retry.scheduled"
          },
          {
            "$ref": "#/components/schemas/session.compaction.started"
          },
          {
            "$ref": "#/components/schemas/session.compaction.ended"
          },
          {
            "$ref": "#/components/schemas/session.compaction.failed"
          },
          {
            "$ref": "#/components/schemas/session.revert.staged"
          },
          {
            "$ref": "#/components/schemas/session.revert.cleared"
          },
          {
            "$ref": "#/components/schemas/session.revert.committed"
          },
          {
            "$ref": "#/components/schemas/session.usage.recorded"
          }
        ]
      },
      "EventLog.Synced": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["log.synced"]
          },
          "aggregateID": {
            "type": "string"
          },
          "seq": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          }
        },
        "required": ["type", "aggregateID"],
        "additionalProperties": false,
        "description": "Marker emitted once when a log read reaches its captured watermark. The reader holds every event committed at or below seq."
      },
      "SessionLogItem": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Session.Event.Durable"
          },
          {
            "$ref": "#/components/schemas/EventLog.Synced"
          }
        ]
      },
      "SessionLogItemJsonString": {
        "type": "string",
        "contentSchema": {
          "$ref": "#/components/schemas/SessionLogItem"
        },
        "contentMediaType": "application/json"
      },
      "SessionMessagesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Session.Message.Info"
            }
          },
          "cursor": {
            "type": "object",
            "properties": {
              "previous": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "next": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["data", "cursor"],
        "additionalProperties": false
      },
      "Model.ReasoningField": {
        "anyOf": [
          {
            "type": "string",
            "enum": ["reasoning", "reasoning_content", "reasoning_text"]
          },
          {
            "type": "string"
          }
        ]
      },
      "Model.MaxTokensField": {
        "type": "string",
        "enum": ["max_completion_tokens", "max_tokens"]
      },
      "Model.Compatibility": {
        "type": "object",
        "properties": {
          "reasoningField": {
            "$ref": "#/components/schemas/Model.ReasoningField"
          },
          "maxTokensField": {
            "$ref": "#/components/schemas/Model.MaxTokensField"
          },
          "requireFinishReason": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "Model.Capabilities": {
        "type": "object",
        "properties": {
          "tools": {
            "type": "boolean"
          },
          "input": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "output": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": ["tools", "input", "output"],
        "additionalProperties": false
      },
      "Model.Variant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "settings": {
            "type": "object"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "type": "object"
          }
        },
        "required": ["id"],
        "additionalProperties": false
      },
      "Money.USDPerMillionTokens": {
        "type": "number"
      },
      "Model.Cost": {
        "type": "object",
        "properties": {
          "tier": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["context"]
              },
              "size": {
                "type": "integer"
              }
            },
            "required": ["type", "size"],
            "additionalProperties": false
          },
          "input": {
            "$ref": "#/components/schemas/Money.USDPerMillionTokens"
          },
          "output": {
            "$ref": "#/components/schemas/Money.USDPerMillionTokens"
          },
          "cache": {
            "type": "object",
            "properties": {
              "read": {
                "$ref": "#/components/schemas/Money.USDPerMillionTokens"
              },
              "write": {
                "$ref": "#/components/schemas/Money.USDPerMillionTokens"
              }
            },
            "required": ["read", "write"],
            "additionalProperties": false
          }
        },
        "required": ["input", "output", "cache"],
        "additionalProperties": false
      },
      "Model.Info": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "modelID": {
            "type": "string"
          },
          "providerID": {
            "type": "string"
          },
          "family": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "compatibility": {
            "$ref": "#/components/schemas/Model.Compatibility"
          },
          "package": {
            "type": "string"
          },
          "settings": {
            "type": "object"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "type": "object"
          },
          "capabilities": {
            "$ref": "#/components/schemas/Model.Capabilities"
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model.Variant"
            }
          },
          "time": {
            "type": "object",
            "properties": {
              "released": {
                "type": "number"
              }
            },
            "required": ["released"],
            "additionalProperties": false
          },
          "cost": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model.Cost"
            }
          },
          "status": {
            "type": "string",
            "enum": ["alpha", "beta", "deprecated", "active"]
          },
          "enabled": {
            "type": "boolean"
          },
          "limit": {
            "type": "object",
            "properties": {
              "context": {
                "type": "integer"
              },
              "input": {
                "type": "integer"
              },
              "output": {
                "type": "integer"
              }
            },
            "required": ["context", "output"],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "modelID",
          "providerID",
          "name",
          "capabilities",
          "variants",
          "time",
          "cost",
          "status",
          "enabled",
          "limit"
        ],
        "additionalProperties": false
      },
      "GenerateTextResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string"
              }
            },
            "required": ["text"],
            "additionalProperties": false
          }
        },
        "required": ["data"],
        "additionalProperties": false
      },
      "Provider.Info": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "integrationID": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "activation": {
            "type": "string",
            "enum": ["auto", "enabled", "disabled"]
          },
          "package": {
            "type": "string"
          },
          "settings": {
            "type": "object"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "type": "object"
          }
        },
        "required": ["id", "name", "activation", "package"],
        "additionalProperties": false
      },
      "ProviderNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["ProviderNotFoundError"]
          },
          "providerID": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "providerID", "message"],
        "additionalProperties": false
      },
      "Form.When": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "op": {
            "type": "string",
            "enum": ["eq", "neq"]
          },
          "value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "anyOf": [
                  {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "string",
                        "enum": ["NaN"]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity"]
                      },
                      {
                        "type": "string",
                        "enum": ["-Infinity"]
                      }
                    ]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity", "-Infinity", "NaN"]
                  }
                ]
              },
              {
                "type": "boolean"
              }
            ]
          }
        },
        "required": ["key", "op", "value"],
        "additionalProperties": false
      },
      "Form.Option": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        },
        "required": ["value", "label"],
        "additionalProperties": false
      },
      "Form.StringField": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "when": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.When"
            }
          },
          "type": {
            "type": "string",
            "enum": ["string"]
          },
          "format": {
            "type": "string",
            "enum": ["email", "uri", "date", "date-time"]
          },
          "minLength": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "maxLength": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "pattern": {
            "type": "string"
          },
          "placeholder": {
            "type": "string"
          },
          "default": {
            "type": "string"
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.Option"
            }
          },
          "custom": {
            "type": "boolean"
          }
        },
        "required": ["key", "type"],
        "additionalProperties": false
      },
      "Form.NumberField": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "when": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.When"
            }
          },
          "type": {
            "type": "string",
            "enum": ["number"]
          },
          "minimum": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "enum": ["NaN"]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity"]
                  },
                  {
                    "type": "string",
                    "enum": ["-Infinity"]
                  }
                ]
              },
              {
                "type": "string",
                "enum": ["Infinity", "-Infinity", "NaN"]
              }
            ]
          },
          "maximum": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "enum": ["NaN"]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity"]
                  },
                  {
                    "type": "string",
                    "enum": ["-Infinity"]
                  }
                ]
              },
              {
                "type": "string",
                "enum": ["Infinity", "-Infinity", "NaN"]
              }
            ]
          },
          "default": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "enum": ["NaN"]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity"]
                  },
                  {
                    "type": "string",
                    "enum": ["-Infinity"]
                  }
                ]
              },
              {
                "type": "string",
                "enum": ["Infinity", "-Infinity", "NaN"]
              }
            ]
          }
        },
        "required": ["key", "type"],
        "additionalProperties": false
      },
      "Form.IntegerField": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "when": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.When"
            }
          },
          "type": {
            "type": "string",
            "enum": ["integer"]
          },
          "minimum": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "enum": ["NaN"]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity"]
                  },
                  {
                    "type": "string",
                    "enum": ["-Infinity"]
                  }
                ]
              },
              {
                "type": "string",
                "enum": ["Infinity", "-Infinity", "NaN"]
              }
            ]
          },
          "maximum": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "enum": ["NaN"]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity"]
                  },
                  {
                    "type": "string",
                    "enum": ["-Infinity"]
                  }
                ]
              },
              {
                "type": "string",
                "enum": ["Infinity", "-Infinity", "NaN"]
              }
            ]
          },
          "default": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "enum": ["NaN"]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity"]
                  },
                  {
                    "type": "string",
                    "enum": ["-Infinity"]
                  }
                ]
              },
              {
                "type": "string",
                "enum": ["Infinity", "-Infinity", "NaN"]
              }
            ]
          }
        },
        "required": ["key", "type"],
        "additionalProperties": false
      },
      "Form.BooleanField": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "when": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.When"
            }
          },
          "type": {
            "type": "string",
            "enum": ["boolean"]
          },
          "default": {
            "type": "boolean"
          }
        },
        "required": ["key", "type"],
        "additionalProperties": false
      },
      "Form.MultiselectField": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "when": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.When"
            }
          },
          "type": {
            "type": "string",
            "enum": ["multiselect"]
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.Option"
            }
          },
          "minItems": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "maxItems": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "custom": {
            "type": "boolean"
          },
          "default": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": ["key", "type", "options"],
        "additionalProperties": false
      },
      "Form.ExternalField": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": ["external"]
          },
          "url": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        },
        "required": ["key", "type", "url"],
        "additionalProperties": false
      },
      "Form.Field": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Form.StringField"
          },
          {
            "$ref": "#/components/schemas/Form.NumberField"
          },
          {
            "$ref": "#/components/schemas/Form.IntegerField"
          },
          {
            "$ref": "#/components/schemas/Form.BooleanField"
          },
          {
            "$ref": "#/components/schemas/Form.MultiselectField"
          },
          {
            "$ref": "#/components/schemas/Form.ExternalField"
          }
        ]
      },
      "Form.Fields": {
        "type": "array",
        "prefixItems": [
          {
            "$ref": "#/components/schemas/Form.Field"
          }
        ],
        "minItems": 1,
        "items": {
          "$ref": "#/components/schemas/Form.Field"
        }
      },
      "Integration.OAuthMethod": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": ["oauth"]
          },
          "label": {
            "type": "string"
          },
          "form": {
            "$ref": "#/components/schemas/Form.Fields"
          }
        },
        "required": ["id", "type", "label"],
        "additionalProperties": false
      },
      "Integration.CommandMethod": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": ["command"]
          },
          "label": {
            "type": "string"
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": ["id", "type", "label", "command"],
        "additionalProperties": false
      },
      "Integration.KeyMethod": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["key"]
          },
          "label": {
            "type": "string"
          },
          "form": {
            "$ref": "#/components/schemas/Form.Fields"
          }
        },
        "required": ["type"],
        "additionalProperties": false
      },
      "Integration.EnvMethod": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["env"]
          },
          "names": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": ["type", "names"],
        "additionalProperties": false
      },
      "Integration.Method": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Integration.OAuthMethod"
          },
          {
            "$ref": "#/components/schemas/Integration.CommandMethod"
          },
          {
            "$ref": "#/components/schemas/Integration.KeyMethod"
          },
          {
            "$ref": "#/components/schemas/Integration.EnvMethod"
          }
        ]
      },
      "Connection.CredentialInfo": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["credential"]
          },
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": ["type", "id", "label"],
        "additionalProperties": false
      },
      "Connection.EnvInfo": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["env"]
          },
          "name": {
            "type": "string"
          }
        },
        "required": ["type", "name"],
        "additionalProperties": false
      },
      "Connection.Info": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Connection.CredentialInfo"
          },
          {
            "$ref": "#/components/schemas/Connection.EnvInfo"
          }
        ]
      },
      "Integration.Info": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "methods": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Integration.Method"
            }
          },
          "connections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Connection.Info"
            }
          }
        },
        "required": ["id", "name", "methods", "connections"],
        "additionalProperties": false
      },
      "Form.Value": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "enum": ["NaN"]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity"]
                  },
                  {
                    "type": "string",
                    "enum": ["-Infinity"]
                  }
                ]
              },
              {
                "type": "string",
                "enum": ["Infinity", "-Infinity", "NaN"]
              }
            ]
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ]
      },
      "Form.Answer": {
        "type": "object",
        "additionalProperties": {
          "$ref": "#/components/schemas/Form.Value"
        }
      },
      "Integration.Attempt": {
        "type": "object",
        "properties": {
          "attemptID": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "instructions": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": ["auto", "code"]
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "anyOf": [
                  {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "string",
                        "enum": ["NaN"]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity"]
                      },
                      {
                        "type": "string",
                        "enum": ["-Infinity"]
                      }
                    ]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity", "-Infinity", "NaN"]
                  }
                ]
              },
              "expires": {
                "anyOf": [
                  {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "string",
                        "enum": ["NaN"]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity"]
                      },
                      {
                        "type": "string",
                        "enum": ["-Infinity"]
                      }
                    ]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity", "-Infinity", "NaN"]
                  }
                ]
              }
            },
            "required": ["created", "expires"],
            "additionalProperties": false
          }
        },
        "required": ["attemptID", "url", "instructions", "mode", "time"],
        "additionalProperties": false
      },
      "Integration.AttemptStatus": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["pending"]
              },
              "time": {
                "type": "object",
                "properties": {
                  "created": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  },
                  "expires": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  }
                },
                "required": ["created", "expires"],
                "additionalProperties": false
              }
            },
            "required": ["status", "time"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["complete"]
              },
              "time": {
                "type": "object",
                "properties": {
                  "created": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  },
                  "expires": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  }
                },
                "required": ["created", "expires"],
                "additionalProperties": false
              }
            },
            "required": ["status", "time"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["failed"]
              },
              "message": {
                "type": "string"
              },
              "time": {
                "type": "object",
                "properties": {
                  "created": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  },
                  "expires": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  }
                },
                "required": ["created", "expires"],
                "additionalProperties": false
              }
            },
            "required": ["status", "message", "time"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["expired"]
              },
              "time": {
                "type": "object",
                "properties": {
                  "created": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  },
                  "expires": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  }
                },
                "required": ["created", "expires"],
                "additionalProperties": false
              }
            },
            "required": ["status", "time"],
            "additionalProperties": false
          }
        ]
      },
      "Integration.CommandAttempt": {
        "type": "object",
        "properties": {
          "attemptID": {
            "type": "string"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "anyOf": [
                  {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "string",
                        "enum": ["NaN"]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity"]
                      },
                      {
                        "type": "string",
                        "enum": ["-Infinity"]
                      }
                    ]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity", "-Infinity", "NaN"]
                  }
                ]
              },
              "expires": {
                "anyOf": [
                  {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "string",
                        "enum": ["NaN"]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity"]
                      },
                      {
                        "type": "string",
                        "enum": ["-Infinity"]
                      }
                    ]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity", "-Infinity", "NaN"]
                  }
                ]
              }
            },
            "required": ["created", "expires"],
            "additionalProperties": false
          }
        },
        "required": ["attemptID", "time"],
        "additionalProperties": false
      },
      "Integration.CommandAttemptStatus": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["pending"]
              },
              "message": {
                "type": "string"
              },
              "time": {
                "type": "object",
                "properties": {
                  "created": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  },
                  "expires": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  }
                },
                "required": ["created", "expires"],
                "additionalProperties": false
              }
            },
            "required": ["status", "time"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["complete"]
              },
              "time": {
                "type": "object",
                "properties": {
                  "created": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  },
                  "expires": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  }
                },
                "required": ["created", "expires"],
                "additionalProperties": false
              }
            },
            "required": ["status", "time"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["failed"]
              },
              "message": {
                "type": "string"
              },
              "time": {
                "type": "object",
                "properties": {
                  "created": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  },
                  "expires": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  }
                },
                "required": ["created", "expires"],
                "additionalProperties": false
              }
            },
            "required": ["status", "message", "time"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["expired"]
              },
              "time": {
                "type": "object",
                "properties": {
                  "created": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  },
                  "expires": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "enum": ["NaN"]
                          },
                          {
                            "type": "string",
                            "enum": ["Infinity"]
                          },
                          {
                            "type": "string",
                            "enum": ["-Infinity"]
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "enum": ["Infinity", "-Infinity", "NaN"]
                      }
                    ]
                  }
                },
                "required": ["created", "expires"],
                "additionalProperties": false
              }
            },
            "required": ["status", "time"],
            "additionalProperties": false
          }
        ]
      },
      "Mcp.Status.Connected": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["connected"]
          }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "Mcp.Status.Pending": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["pending"]
          }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "Mcp.Status.Disabled": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["disabled"]
          }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "Mcp.Status.Failed": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["failed"]
          },
          "error": {
            "type": "string"
          }
        },
        "required": ["status", "error"],
        "additionalProperties": false
      },
      "Mcp.Status.NeedsAuth": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["needs_auth"]
          }
        },
        "required": ["status"],
        "additionalProperties": false
      },
      "Mcp.Server": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Mcp.Status.Connected"
              },
              {
                "$ref": "#/components/schemas/Mcp.Status.Pending"
              },
              {
                "$ref": "#/components/schemas/Mcp.Status.Disabled"
              },
              {
                "$ref": "#/components/schemas/Mcp.Status.Failed"
              },
              {
                "$ref": "#/components/schemas/Mcp.Status.NeedsAuth"
              }
            ]
          },
          "integrationID": {
            "type": "string"
          }
        },
        "required": ["name", "status"],
        "additionalProperties": false
      },
      "Mcp.LocalConfig": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["local"]
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cwd": {
            "type": "string"
          },
          "environment": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "disabled": {
            "type": "boolean"
          },
          "codemode": {
            "type": "boolean"
          },
          "timeout": {
            "type": "object",
            "properties": {
              "startup": {
                "type": "integer",
                "allOf": [
                  {
                    "exclusiveMinimum": 0
                  }
                ]
              },
              "catalog": {
                "type": "integer",
                "allOf": [
                  {
                    "exclusiveMinimum": 0
                  }
                ]
              },
              "execution": {
                "type": "integer",
                "allOf": [
                  {
                    "exclusiveMinimum": 0
                  }
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["type", "command"],
        "additionalProperties": false
      },
      "Mcp.OAuthConfig": {
        "type": "object",
        "properties": {
          "client_id": {
            "type": "string"
          },
          "client_secret": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "callback_port": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 1,
                "maximum": 65535
              }
            ]
          },
          "redirect_uri": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Mcp.RemoteConfig": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["remote"]
          },
          "url": {
            "type": "string"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "oauth": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Mcp.OAuthConfig"
              },
              {
                "type": "boolean",
                "enum": [false]
              }
            ]
          },
          "disabled": {
            "type": "boolean"
          },
          "codemode": {
            "type": "boolean"
          },
          "timeout": {
            "type": "object",
            "properties": {
              "startup": {
                "type": "integer",
                "allOf": [
                  {
                    "exclusiveMinimum": 0
                  }
                ]
              },
              "catalog": {
                "type": "integer",
                "allOf": [
                  {
                    "exclusiveMinimum": 0
                  }
                ]
              },
              "execution": {
                "type": "integer",
                "allOf": [
                  {
                    "exclusiveMinimum": 0
                  }
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["type", "url"],
        "additionalProperties": false
      },
      "McpServerNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["McpServerNotFoundError"]
          },
          "server": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "server", "message"],
        "additionalProperties": false
      },
      "Mcp.Resource": {
        "type": "object",
        "properties": {
          "server": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "uri": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "mimeType": {
            "type": "string"
          }
        },
        "required": ["server", "name", "uri"],
        "additionalProperties": false
      },
      "Mcp.ResourceTemplate": {
        "type": "object",
        "properties": {
          "server": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "uriTemplate": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "mimeType": {
            "type": "string"
          }
        },
        "required": ["server", "name", "uriTemplate"],
        "additionalProperties": false
      },
      "Mcp.ResourceCatalog": {
        "type": "object",
        "properties": {
          "resources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Mcp.Resource"
            }
          },
          "templates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Mcp.ResourceTemplate"
            }
          }
        },
        "required": ["resources", "templates"],
        "additionalProperties": false
      },
      "Project.Vcs": {
        "type": "string",
        "enum": ["git", "hg"]
      },
      "Project.Icon": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "override": {
            "type": "string"
          },
          "color": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Project.Commands": {
        "type": "object",
        "properties": {
          "start": {
            "type": "string",
            "description": "Startup script to run when creating a new workspace (worktree)"
          }
        },
        "additionalProperties": false
      },
      "Project.Time": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "updated": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "initialized": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          }
        },
        "required": ["created", "updated"],
        "additionalProperties": false
      },
      "Project": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "canonical": {
            "type": "string"
          },
          "vcs": {
            "$ref": "#/components/schemas/Project.Vcs"
          },
          "name": {
            "type": "string"
          },
          "icon": {
            "$ref": "#/components/schemas/Project.Icon"
          },
          "commands": {
            "$ref": "#/components/schemas/Project.Commands"
          },
          "time": {
            "$ref": "#/components/schemas/Project.Time"
          },
          "sandboxes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": ["id", "canonical", "time", "sandboxes"],
        "additionalProperties": false
      },
      "Project.Current": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "directory": {
            "type": "string"
          },
          "canonical": {
            "type": "string"
          }
        },
        "required": ["id", "directory", "canonical"],
        "additionalProperties": false
      },
      "Form.Metadata": {
        "type": "object"
      },
      "Form.Info": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^frm_"
              }
            ]
          },
          "sessionID": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/Form.Metadata"
          },
          "fields": {
            "$ref": "#/components/schemas/Form.Fields"
          }
        },
        "required": ["id", "sessionID", "title", "fields"],
        "additionalProperties": false
      },
      "Form.CreatePayload": {
        "type": "object",
        "properties": {
          "id": {
            "anyOf": [
              {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^frm_"
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/Form.Metadata"
          },
          "fields": {
            "$ref": "#/components/schemas/Form.Fields"
          }
        },
        "required": ["title", "fields"],
        "additionalProperties": false
      },
      "FormNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["FormNotFoundError"]
          },
          "id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "id", "message"],
        "additionalProperties": false
      },
      "Form.State": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["pending"]
              }
            },
            "required": ["status"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["answered"]
              },
              "answer": {
                "$ref": "#/components/schemas/Form.Answer"
              }
            },
            "required": ["status", "answer"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["cancelled"]
              }
            },
            "required": ["status"],
            "additionalProperties": false
          }
        ]
      },
      "Form.Reply": {
        "type": "object",
        "properties": {
          "answer": {
            "$ref": "#/components/schemas/Form.Answer"
          }
        },
        "required": ["answer"],
        "additionalProperties": false
      },
      "FormAlreadySettledError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["FormAlreadySettledError"]
          },
          "id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "id", "message"],
        "additionalProperties": false
      },
      "FormInvalidAnswerError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["FormInvalidAnswerError"]
          },
          "id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "id", "message"],
        "additionalProperties": false
      },
      "Permission.Source": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["tool"]
              },
              "messageID": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            },
            "required": ["type", "messageID", "id"],
            "additionalProperties": false
          }
        ]
      },
      "Permission.Request": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^per"
              }
            ]
          },
          "sessionID": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^ses"
              }
            ]
          },
          "action": {
            "type": "string"
          },
          "resources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "save": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "metadata": {
            "type": "object"
          },
          "source": {
            "$ref": "#/components/schemas/Permission.Source"
          }
        },
        "required": ["id", "sessionID", "action", "resources"],
        "additionalProperties": false
      },
      "PermissionSaved.Info": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "projectID": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "resource": {
            "type": "string"
          }
        },
        "required": ["id", "projectID", "action", "resource"],
        "additionalProperties": false
      },
      "PermissionNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["PermissionNotFoundError"]
          },
          "requestID": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "requestID", "message"],
        "additionalProperties": false
      },
      "Permission.Reply": {
        "type": "string",
        "enum": ["once", "always", "reject"]
      },
      "FileSystem.Entry": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": ["file", "directory"]
          }
        },
        "required": ["path", "type"],
        "additionalProperties": false
      },
      "Command.Info": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "template": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "model": {
            "$ref": "#/components/schemas/Model.Ref"
          },
          "subtask": {
            "type": "boolean"
          }
        },
        "required": ["name", "template"],
        "additionalProperties": false
      },
      "Skill.Info": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "slash": {
            "type": "boolean"
          },
          "autoinvoke": {
            "type": "boolean"
          },
          "location": {
            "type": "string"
          },
          "content": {
            "type": "string"
          }
        },
        "required": ["id", "name", "location", "content"],
        "additionalProperties": false
      },
      "models-dev.refreshed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["models-dev.refreshed"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "integration.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["integration.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "integration.connection.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["integration.connection.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "integrationID": {
                "type": "string"
              }
            },
            "required": ["integrationID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "catalog.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["catalog.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "agent.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["agent.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "session.usage.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.usage.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "cost": {
                "$ref": "#/components/schemas/Money.USD"
              },
              "tokens": {
                "$ref": "#/components/schemas/TokenUsage.Info"
              }
            },
            "required": ["sessionID", "cost", "tokens"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "session.text.delta": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.text.delta"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "ordinal": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "delta": {
                "type": "string"
              }
            },
            "required": ["sessionID", "assistantMessageID", "ordinal", "delta"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "session.reasoning.delta": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.reasoning.delta"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "ordinal": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "delta": {
                "type": "string"
              }
            },
            "required": ["sessionID", "assistantMessageID", "ordinal", "delta"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "session.tool.input.delta": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.tool.input.delta"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "delta": {
                "type": "string"
              }
            },
            "required": ["sessionID", "assistantMessageID", "id", "delta"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "session.tool.progress": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.tool.progress"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "assistantMessageID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^msg_"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "metadata": {
                "type": "object"
              }
            },
            "required": ["sessionID", "assistantMessageID", "id", "metadata"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "session.compaction.delta": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.compaction.delta"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "text": {
                "type": "string"
              }
            },
            "required": ["sessionID", "text"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "filesystem.changed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["filesystem.changed"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "file": {
                "type": "string"
              },
              "event": {
                "type": "string",
                "enum": ["add", "change", "unlink"]
              }
            },
            "required": ["file", "event"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "reference.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["reference.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "permission.asked": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["permission.asked"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^per"
                  }
                ]
              },
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "action": {
                "type": "string"
              },
              "resources": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "save": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "metadata": {
                "type": "object"
              },
              "source": {
                "$ref": "#/components/schemas/Permission.Source"
              }
            },
            "required": ["id", "sessionID", "action", "resources"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "permission.replied": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["permission.replied"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "requestID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^per"
                  }
                ]
              },
              "reply": {
                "$ref": "#/components/schemas/Permission.Reply"
              }
            },
            "required": ["sessionID", "requestID", "reply"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "plugin.added": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["plugin.added"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              }
            },
            "required": ["id"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "plugin.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["plugin.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "worktree.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["worktree.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "projectID": {
                "type": "string"
              }
            },
            "required": ["projectID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "worktree.resolved": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["worktree.resolved"]
          },
          "durable": {
            "type": "object",
            "properties": {
              "aggregateID": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "version": {
                "type": "number",
                "enum": [1]
              }
            },
            "required": ["aggregateID", "seq", "version"],
            "additionalProperties": false
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "projectID": {
                "type": "string"
              },
              "directory": {
                "type": "string"
              },
              "previous": {
                "type": "string"
              }
            },
            "required": ["projectID", "directory", "previous"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "durable", "data"],
        "additionalProperties": false
      },
      "command.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["command.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "config.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["config.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "skill.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["skill.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "Pty": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^pty"
              }
            ]
          },
          "title": {
            "type": "string"
          },
          "command": {
            "type": "string"
          },
          "args": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cwd": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["running", "exited"]
          },
          "pid": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "exitCode": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          }
        },
        "required": ["id", "title", "command", "args", "cwd", "status", "pid"],
        "additionalProperties": false
      },
      "pty.created": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["pty.created"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "info": {
                "$ref": "#/components/schemas/Pty"
              }
            },
            "required": ["info"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "pty.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["pty.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "info": {
                "$ref": "#/components/schemas/Pty"
              }
            },
            "required": ["info"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "pty.exited": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["pty.exited"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^pty"
                  }
                ]
              },
              "exitCode": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              }
            },
            "required": ["id", "exitCode"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "pty.deleted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["pty.deleted"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^pty"
                  }
                ]
              }
            },
            "required": ["id"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "shell.created": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["shell.created"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "info": {
                "$ref": "#/components/schemas/Shell.Info"
              }
            },
            "required": ["info"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "shell.exited": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["shell.exited"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^sh_"
                  }
                ]
              },
              "exit": {
                "type": "number"
              },
              "status": {
                "type": "string",
                "enum": ["running", "exited", "timeout", "killed"]
              }
            },
            "required": ["id", "status"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "shell.deleted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["shell.deleted"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^sh_"
                  }
                ]
              }
            },
            "required": ["id"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "Form.Metadata1": {
        "type": "object"
      },
      "Form.When1": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "op": {
            "type": "string",
            "enum": ["eq", "neq"]
          },
          "value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "enum": ["NaN"]
                  },
                  {
                    "type": "string",
                    "enum": ["Infinity"]
                  },
                  {
                    "type": "string",
                    "enum": ["-Infinity"]
                  }
                ]
              },
              {
                "type": "boolean"
              }
            ]
          }
        },
        "required": ["key", "op", "value"],
        "additionalProperties": false
      },
      "Form.StringField1": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "when": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.When1"
            }
          },
          "type": {
            "type": "string",
            "enum": ["string"]
          },
          "format": {
            "type": "string",
            "enum": ["email", "uri", "date", "date-time"]
          },
          "minLength": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "maxLength": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "pattern": {
            "type": "string"
          },
          "placeholder": {
            "type": "string"
          },
          "default": {
            "type": "string"
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.Option"
            }
          },
          "custom": {
            "type": "boolean"
          }
        },
        "required": ["key", "type"],
        "additionalProperties": false
      },
      "Form.NumberField1": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "when": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.When1"
            }
          },
          "type": {
            "type": "string",
            "enum": ["number"]
          },
          "minimum": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string",
                "enum": ["NaN"]
              },
              {
                "type": "string",
                "enum": ["Infinity"]
              },
              {
                "type": "string",
                "enum": ["-Infinity"]
              }
            ]
          },
          "maximum": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string",
                "enum": ["NaN"]
              },
              {
                "type": "string",
                "enum": ["Infinity"]
              },
              {
                "type": "string",
                "enum": ["-Infinity"]
              }
            ]
          },
          "default": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string",
                "enum": ["NaN"]
              },
              {
                "type": "string",
                "enum": ["Infinity"]
              },
              {
                "type": "string",
                "enum": ["-Infinity"]
              }
            ]
          }
        },
        "required": ["key", "type"],
        "additionalProperties": false
      },
      "Form.IntegerField1": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "when": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.When1"
            }
          },
          "type": {
            "type": "string",
            "enum": ["integer"]
          },
          "minimum": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string",
                "enum": ["NaN"]
              },
              {
                "type": "string",
                "enum": ["Infinity"]
              },
              {
                "type": "string",
                "enum": ["-Infinity"]
              }
            ]
          },
          "maximum": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string",
                "enum": ["NaN"]
              },
              {
                "type": "string",
                "enum": ["Infinity"]
              },
              {
                "type": "string",
                "enum": ["-Infinity"]
              }
            ]
          },
          "default": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string",
                "enum": ["NaN"]
              },
              {
                "type": "string",
                "enum": ["Infinity"]
              },
              {
                "type": "string",
                "enum": ["-Infinity"]
              }
            ]
          }
        },
        "required": ["key", "type"],
        "additionalProperties": false
      },
      "Form.BooleanField1": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "when": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.When1"
            }
          },
          "type": {
            "type": "string",
            "enum": ["boolean"]
          },
          "default": {
            "type": "boolean"
          }
        },
        "required": ["key", "type"],
        "additionalProperties": false
      },
      "Form.MultiselectField1": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "when": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.When1"
            }
          },
          "type": {
            "type": "string",
            "enum": ["multiselect"]
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Form.Option"
            }
          },
          "minItems": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "maxItems": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "custom": {
            "type": "boolean"
          },
          "default": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": ["key", "type", "options"],
        "additionalProperties": false
      },
      "Form.Field1": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Form.StringField1"
          },
          {
            "$ref": "#/components/schemas/Form.NumberField1"
          },
          {
            "$ref": "#/components/schemas/Form.IntegerField1"
          },
          {
            "$ref": "#/components/schemas/Form.BooleanField1"
          },
          {
            "$ref": "#/components/schemas/Form.MultiselectField1"
          },
          {
            "$ref": "#/components/schemas/Form.ExternalField"
          }
        ]
      },
      "Form.Fields3": {
        "type": "array",
        "prefixItems": [
          {
            "$ref": "#/components/schemas/Form.Field1"
          }
        ],
        "minItems": 1,
        "items": {
          "$ref": "#/components/schemas/Form.Field1"
        }
      },
      "Form.Info1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^frm_"
              }
            ]
          },
          "sessionID": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/Form.Metadata1"
          },
          "fields": {
            "$ref": "#/components/schemas/Form.Fields3"
          }
        },
        "required": ["id", "sessionID", "title", "fields"],
        "additionalProperties": false
      },
      "form.created": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["form.created"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "form": {
                "$ref": "#/components/schemas/Form.Info1"
              }
            },
            "required": ["form"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "Form.Value1": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string",
                "enum": ["NaN"]
              },
              {
                "type": "string",
                "enum": ["Infinity"]
              },
              {
                "type": "string",
                "enum": ["-Infinity"]
              }
            ]
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ]
      },
      "Form.Answer1": {
        "type": "object",
        "additionalProperties": {
          "$ref": "#/components/schemas/Form.Value1"
        }
      },
      "form.replied": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["form.replied"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^frm_"
                  }
                ]
              },
              "sessionID": {
                "type": "string"
              },
              "answer": {
                "$ref": "#/components/schemas/Form.Answer1"
              }
            },
            "required": ["id", "sessionID", "answer"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "form.cancelled": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["form.cancelled"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^frm_"
                  }
                ]
              },
              "sessionID": {
                "type": "string"
              }
            },
            "required": ["id", "sessionID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "websearch.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["websearch.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "SessionStatus": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["idle"]
              }
            },
            "required": ["type"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["retry"]
              },
              "attempt": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "message": {
                "type": "string"
              },
              "action": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "link": {
                    "type": "string"
                  }
                },
                "required": ["reason", "provider", "title", "message", "label"],
                "additionalProperties": false
              },
              "next": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              }
            },
            "required": ["type", "attempt", "message", "next"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["busy"]
              }
            },
            "required": ["type"],
            "additionalProperties": false
          }
        ]
      },
      "session.status": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.status"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              },
              "status": {
                "$ref": "#/components/schemas/SessionStatus"
              }
            },
            "required": ["sessionID", "status"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "session.idle": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["session.idle"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses"
                  }
                ]
              }
            },
            "required": ["sessionID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "tui.prompt.append": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["tui.prompt.append"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string"
              }
            },
            "required": ["text"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "tui.command.execute": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["tui.command.execute"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "command": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "session.list",
                      "session.new",
                      "session.share",
                      "session.interrupt",
                      "session.background",
                      "session.compact",
                      "session.page.up",
                      "session.page.down",
                      "session.line.up",
                      "session.line.down",
                      "session.half.page.up",
                      "session.half.page.down",
                      "session.first",
                      "session.last",
                      "prompt.clear",
                      "prompt.submit",
                      "agent.cycle"
                    ]
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": ["command"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "tui.toast.show": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["tui.toast.show"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "variant": {
                "type": "string",
                "enum": ["info", "success", "warning", "error"]
              },
              "duration": {
                "anyOf": [
                  {
                    "type": "integer",
                    "allOf": [
                      {
                        "exclusiveMinimum": 0
                      }
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": ["message", "variant"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "tui.session.select": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["tui.session.select"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^ses",
                    "description": "Session ID to navigate to"
                  }
                ]
              }
            },
            "required": ["sessionID"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "installation.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["installation.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string"
              }
            },
            "required": ["version"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "installation.update-available": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["installation.update-available"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string"
              }
            },
            "required": ["version"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "vcs.branch.updated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["vcs.branch.updated"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "branch": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "mcp.status.changed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["mcp.status.changed"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "server": {
                "type": "string"
              }
            },
            "required": ["server"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "mcp.resources.changed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "created": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "type": {
            "type": "string",
            "enum": ["mcp.resources.changed"]
          },
          "location": {
            "$ref": "#/components/schemas/Location.Ref"
          },
          "data": {
            "type": "object",
            "properties": {
              "server": {
                "type": "string"
              }
            },
            "required": ["server"],
            "additionalProperties": false
          }
        },
        "required": ["id", "created", "type", "data"],
        "additionalProperties": false
      },
      "V2Event.server.connected": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^evt_"
              }
            ]
          },
          "metadata": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "location": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Location.Ref"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": ["server.connected"]
          },
          "data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "required": ["id", "type", "data"],
        "additionalProperties": false
      },
      "V2Event": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/models-dev.refreshed"
          },
          {
            "$ref": "#/components/schemas/integration.updated"
          },
          {
            "$ref": "#/components/schemas/integration.connection.updated"
          },
          {
            "$ref": "#/components/schemas/catalog.updated"
          },
          {
            "$ref": "#/components/schemas/agent.updated"
          },
          {
            "$ref": "#/components/schemas/session.created"
          },
          {
            "$ref": "#/components/schemas/session.agent.selected"
          },
          {
            "$ref": "#/components/schemas/session.model.selected"
          },
          {
            "$ref": "#/components/schemas/session.moved"
          },
          {
            "$ref": "#/components/schemas/session.renamed"
          },
          {
            "$ref": "#/components/schemas/session.usage.updated"
          },
          {
            "$ref": "#/components/schemas/session.deleted"
          },
          {
            "$ref": "#/components/schemas/session.forked"
          },
          {
            "$ref": "#/components/schemas/session.inbox.delivered"
          },
          {
            "$ref": "#/components/schemas/session.inbox.enqueued"
          },
          {
            "$ref": "#/components/schemas/session.inbox.cancelled"
          },
          {
            "$ref": "#/components/schemas/session.inbox.delivery.changed"
          },
          {
            "$ref": "#/components/schemas/session.execution.started"
          },
          {
            "$ref": "#/components/schemas/session.execution.succeeded"
          },
          {
            "$ref": "#/components/schemas/session.execution.failed"
          },
          {
            "$ref": "#/components/schemas/session.execution.interrupted"
          },
          {
            "$ref": "#/components/schemas/session.instructions.updated"
          },
          {
            "$ref": "#/components/schemas/session.synthetic"
          },
          {
            "$ref": "#/components/schemas/session.skill.activated"
          },
          {
            "$ref": "#/components/schemas/session.shell.started"
          },
          {
            "$ref": "#/components/schemas/session.shell.ended"
          },
          {
            "$ref": "#/components/schemas/session.step.started"
          },
          {
            "$ref": "#/components/schemas/session.step.ended"
          },
          {
            "$ref": "#/components/schemas/session.step.failed"
          },
          {
            "$ref": "#/components/schemas/session.text.started"
          },
          {
            "$ref": "#/components/schemas/session.text.delta"
          },
          {
            "$ref": "#/components/schemas/session.text.ended"
          },
          {
            "$ref": "#/components/schemas/session.reasoning.started"
          },
          {
            "$ref": "#/components/schemas/session.reasoning.delta"
          },
          {
            "$ref": "#/components/schemas/session.reasoning.ended"
          },
          {
            "$ref": "#/components/schemas/session.tool.input.started"
          },
          {
            "$ref": "#/components/schemas/session.tool.input.delta"
          },
          {
            "$ref": "#/components/schemas/session.tool.input.ended"
          },
          {
            "$ref": "#/components/schemas/session.tool.called"
          },
          {
            "$ref": "#/components/schemas/session.tool.progress"
          },
          {
            "$ref": "#/components/schemas/session.tool.success"
          },
          {
            "$ref": "#/components/schemas/session.tool.failed"
          },
          {
            "$ref": "#/components/schemas/session.retry.scheduled"
          },
          {
            "$ref": "#/components/schemas/session.compaction.started"
          },
          {
            "$ref": "#/components/schemas/session.compaction.delta"
          },
          {
            "$ref": "#/components/schemas/session.compaction.ended"
          },
          {
            "$ref": "#/components/schemas/session.compaction.failed"
          },
          {
            "$ref": "#/components/schemas/session.revert.staged"
          },
          {
            "$ref": "#/components/schemas/session.revert.cleared"
          },
          {
            "$ref": "#/components/schemas/session.revert.committed"
          },
          {
            "$ref": "#/components/schemas/filesystem.changed"
          },
          {
            "$ref": "#/components/schemas/reference.updated"
          },
          {
            "$ref": "#/components/schemas/permission.asked"
          },
          {
            "$ref": "#/components/schemas/permission.replied"
          },
          {
            "$ref": "#/components/schemas/plugin.added"
          },
          {
            "$ref": "#/components/schemas/plugin.updated"
          },
          {
            "$ref": "#/components/schemas/worktree.updated"
          },
          {
            "$ref": "#/components/schemas/worktree.resolved"
          },
          {
            "$ref": "#/components/schemas/command.updated"
          },
          {
            "$ref": "#/components/schemas/config.updated"
          },
          {
            "$ref": "#/components/schemas/skill.updated"
          },
          {
            "$ref": "#/components/schemas/pty.created"
          },
          {
            "$ref": "#/components/schemas/pty.updated"
          },
          {
            "$ref": "#/components/schemas/pty.exited"
          },
          {
            "$ref": "#/components/schemas/pty.deleted"
          },
          {
            "$ref": "#/components/schemas/shell.created"
          },
          {
            "$ref": "#/components/schemas/shell.exited"
          },
          {
            "$ref": "#/components/schemas/shell.deleted"
          },
          {
            "$ref": "#/components/schemas/form.created"
          },
          {
            "$ref": "#/components/schemas/form.replied"
          },
          {
            "$ref": "#/components/schemas/form.cancelled"
          },
          {
            "$ref": "#/components/schemas/websearch.updated"
          },
          {
            "$ref": "#/components/schemas/session.status"
          },
          {
            "$ref": "#/components/schemas/session.idle"
          },
          {
            "$ref": "#/components/schemas/tui.prompt.append"
          },
          {
            "$ref": "#/components/schemas/tui.command.execute"
          },
          {
            "$ref": "#/components/schemas/tui.toast.show"
          },
          {
            "$ref": "#/components/schemas/tui.session.select"
          },
          {
            "$ref": "#/components/schemas/installation.updated"
          },
          {
            "$ref": "#/components/schemas/installation.update-available"
          },
          {
            "$ref": "#/components/schemas/vcs.branch.updated"
          },
          {
            "$ref": "#/components/schemas/mcp.status.changed"
          },
          {
            "$ref": "#/components/schemas/mcp.resources.changed"
          },
          {
            "$ref": "#/components/schemas/V2Event.server.connected"
          }
        ]
      },
      "V2EventJsonString": {
        "type": "string",
        "contentSchema": {
          "$ref": "#/components/schemas/V2Event"
        },
        "contentMediaType": "application/json"
      },
      "PtyNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["PtyNotFoundError"]
          },
          "ptyID": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "ptyID", "message"],
        "additionalProperties": false
      },
      "PtyTicket.ConnectToken": {
        "type": "object",
        "properties": {
          "ticket": {
            "type": "string"
          },
          "expires_in": {
            "type": "integer",
            "allOf": [
              {
                "exclusiveMinimum": 0
              }
            ]
          }
        },
        "required": ["ticket", "expires_in"],
        "additionalProperties": false
      },
      "ForbiddenError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["ForbiddenError"]
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "message"],
        "additionalProperties": false
      },
      "Shell.Info1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^sh_"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": ["running", "exited", "timeout", "killed"]
          },
          "command": {
            "type": "string"
          },
          "cwd": {
            "type": "string"
          },
          "shell": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "pid": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "exit": {
            "type": "number"
          },
          "metadata": {
            "type": "object"
          },
          "time": {
            "type": "object",
            "properties": {
              "started": {
                "type": "number"
              },
              "completed": {
                "type": "number"
              }
            },
            "required": ["started"],
            "additionalProperties": false
          }
        },
        "required": ["id", "status", "command", "cwd", "shell", "file", "metadata", "time"],
        "additionalProperties": false
      },
      "ShellNotFoundError": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": ["ShellNotFoundError"]
          },
          "id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": ["_tag", "id", "message"],
        "additionalProperties": false
      },
      "Reference.LocalSource": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["local"]
          },
          "path": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "hidden": {
            "type": "boolean"
          }
        },
        "required": ["type", "path"],
        "additionalProperties": false
      },
      "Reference.GitSource": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["git"]
          },
          "repository": {
            "type": "string"
          },
          "branch": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "hidden": {
            "type": "boolean"
          }
        },
        "required": ["type", "repository"],
        "additionalProperties": false
      },
      "Reference.Source": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Reference.LocalSource"
          },
          {
            "$ref": "#/components/schemas/Reference.GitSource"
          }
        ]
      },
      "Reference.Info": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "hidden": {
            "type": "boolean"
          },
          "source": {
            "$ref": "#/components/schemas/Reference.Source"
          }
        },
        "required": ["name", "path", "source"],
        "additionalProperties": false
      },
      "Worktree.Directory": {
        "type": "object",
        "properties": {
          "directory": {
            "type": "string"
          },
          "strategy": {
            "type": "string"
          }
        },
        "required": ["directory"],
        "additionalProperties": false
      },
      "Worktree.List": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Worktree.Directory"
        }
      },
      "Worktree.Info": {
        "type": "object",
        "properties": {
          "directory": {
            "type": "string"
          }
        },
        "required": ["directory"],
        "additionalProperties": false
      },
      "WorktreeError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "enum": ["WorktreeError"]
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "forceRequired": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": ["message"],
            "additionalProperties": false
          }
        },
        "required": ["name", "data"],
        "additionalProperties": false
      },
      "Vcs.Branch": {
        "type": "object",
        "properties": {
          "current": {
            "type": "string"
          },
          "default": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Vcs.Info": {
        "type": "object",
        "properties": {
          "branch": {
            "$ref": "#/components/schemas/Vcs.Branch"
          }
        },
        "required": ["branch"],
        "additionalProperties": false
      },
      "Vcs.FileStatus": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string"
          },
          "additions": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "deletions": {
            "type": "integer",
            "allOf": [
              {
                "minimum": 0
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": ["added", "deleted", "modified"]
          }
        },
        "required": ["file", "additions", "deletions", "status"],
        "additionalProperties": false
      },
      "Vcs.Mode": {
        "type": "string",
        "enum": ["working", "branch"]
      },
      "WebSearch.Provider": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": ["id", "name"],
        "additionalProperties": false
      },
      "WebSearch.Result": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "time": {
            "type": "object",
            "properties": {
              "published": {
                "type": "number"
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["url", "time"],
        "additionalProperties": false
      },
      "WebSearch.Response": {
        "type": "object",
        "properties": {
          "providerID": {
            "type": "string"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebSearch.Result"
            }
          }
        },
        "required": ["providerID", "results"],
        "additionalProperties": false
      },
      "Config.Agent": {
        "type": "object",
        "properties": {
          "model": {
            "anyOf": [
              {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^[^/#]+\\/[^#]+(?:#[^#]+)?$"
                  }
                ]
              },
              {
                "type": "object",
                "properties": {
                  "providerID": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^[^/#]+$"
                      }
                    ]
                  },
                  "model": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^[^#]+$"
                      }
                    ]
                  },
                  "variant": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^[^#]+$"
                      }
                    ]
                  }
                },
                "required": ["providerID", "model"],
                "additionalProperties": false
              }
            ]
          },
          "request": {
            "type": "object",
            "properties": {
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "body": {
                "type": "object"
              }
            },
            "additionalProperties": false
          },
          "system": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": ["subagent", "primary", "all"]
          },
          "hidden": {
            "type": "boolean"
          },
          "color": {
            "type": "string",
            "allOf": [
              {
                "pattern": "^#[0-9a-fA-F]{6}$"
              }
            ]
          },
          "steps": {
            "type": "integer",
            "allOf": [
              {
                "exclusiveMinimum": 0
              }
            ]
          },
          "disabled": {
            "type": "boolean"
          },
          "permissions": {
            "$ref": "#/components/schemas/Permission.Ruleset"
          }
        },
        "additionalProperties": false
      },
      "Config.Formatter.Entry": {
        "type": "object",
        "properties": {
          "disabled": {
            "type": "boolean"
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "environment": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "extensions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      },
      "Config.LSP.Server": {
        "type": "object",
        "properties": {
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "extensions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "disabled": {
            "type": "boolean"
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "initialization": {
            "type": "object"
          }
        },
        "required": ["command"],
        "additionalProperties": false
      },
      "Config.Command": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "model": {
            "anyOf": [
              {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^[^/#]+\\/[^#]+(?:#[^#]+)?$"
                  }
                ]
              },
              {
                "type": "object",
                "properties": {
                  "providerID": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^[^/#]+$"
                      }
                    ]
                  },
                  "model": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^[^#]+$"
                      }
                    ]
                  },
                  "variant": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^[^#]+$"
                      }
                    ]
                  }
                },
                "required": ["providerID", "model"],
                "additionalProperties": false
              }
            ]
          },
          "subtask": {
            "type": "boolean"
          }
        },
        "required": ["template"],
        "additionalProperties": false
      },
      "Config.Reference.Git": {
        "type": "object",
        "properties": {
          "repository": {
            "type": "string"
          },
          "branch": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "hidden": {
            "type": "boolean"
          }
        },
        "required": ["repository"],
        "additionalProperties": false
      },
      "Config.Reference.Local": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "hidden": {
            "type": "boolean"
          }
        },
        "required": ["path"],
        "additionalProperties": false
      },
      "ConfigWebSearch.Info": {
        "type": "object",
        "properties": {
          "provider": {
            "anyOf": [
              {
                "type": "string",
                "enum": ["random"]
              },
              {
                "type": "string"
              }
            ]
          }
        },
        "required": ["provider"],
        "additionalProperties": false
      },
      "Config.Plugin.Entry": {
        "type": "object",
        "properties": {
          "package": {
            "type": "string"
          },
          "options": {
            "type": "object"
          }
        },
        "required": ["package"],
        "additionalProperties": false
      },
      "Config.Warming": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string"
          },
          "interval": {
            "type": "string"
          },
          "duration": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Config.Model.Cost": {
        "type": "object",
        "properties": {
          "tier": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["context"]
              },
              "size": {
                "type": "integer"
              }
            },
            "required": ["type", "size"],
            "additionalProperties": false
          },
          "input": {
            "$ref": "#/components/schemas/Money.USDPerMillionTokens"
          },
          "output": {
            "$ref": "#/components/schemas/Money.USDPerMillionTokens"
          },
          "cache": {
            "type": "object",
            "properties": {
              "read": {
                "$ref": "#/components/schemas/Money.USDPerMillionTokens"
              },
              "write": {
                "$ref": "#/components/schemas/Money.USDPerMillionTokens"
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["input", "output"],
        "additionalProperties": false
      },
      "Config.Model": {
        "type": "object",
        "properties": {
          "modelID": {
            "type": "string"
          },
          "family": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "compatibility": {
            "$ref": "#/components/schemas/Model.Compatibility"
          },
          "package": {
            "type": "string"
          },
          "settings": {
            "type": "object"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "type": "object"
          },
          "capabilities": {
            "$ref": "#/components/schemas/Model.Capabilities"
          },
          "variants": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "settings": {
                  "type": "object"
                },
                "headers": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "body": {
                  "type": "object"
                }
              },
              "required": ["id"],
              "additionalProperties": false
            }
          },
          "cost": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Config.Model.Cost"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Config.Model.Cost"
                }
              }
            ]
          },
          "disabled": {
            "type": "boolean"
          },
          "limit": {
            "type": "object",
            "properties": {
              "context": {
                "type": "integer"
              },
              "input": {
                "type": "integer"
              },
              "output": {
                "type": "integer"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "Config.Provider": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "env": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "package": {
            "type": "string"
          },
          "settings": {
            "type": "object"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "type": "object"
          },
          "models": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/Config.Model"
            }
          }
        },
        "additionalProperties": false
      },
      "Config.Info": {
        "type": "object",
        "properties": {
          "$schema": {
            "type": "string"
          },
          "shell": {
            "type": "string"
          },
          "model": {
            "anyOf": [
              {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^[^/#]+\\/[^#]+(?:#[^#]+)?$"
                  }
                ]
              },
              {
                "type": "object",
                "properties": {
                  "providerID": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^[^/#]+$"
                      }
                    ]
                  },
                  "model": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^[^#]+$"
                      }
                    ]
                  },
                  "variant": {
                    "type": "string",
                    "allOf": [
                      {
                        "pattern": "^[^#]+$"
                      }
                    ]
                  }
                },
                "required": ["providerID", "model"],
                "additionalProperties": false
              }
            ]
          },
          "default_agent": {
            "type": "string"
          },
          "autoupdate": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "string",
                "enum": ["notify"]
              }
            ]
          },
          "share": {
            "type": "string",
            "enum": ["manual", "auto", "disabled"]
          },
          "enterprise": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          "username": {
            "type": "string"
          },
          "permissions": {
            "$ref": "#/components/schemas/Permission.Ruleset"
          },
          "agents": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/Config.Agent"
            }
          },
          "snapshots": {
            "type": "boolean"
          },
          "watcher": {
            "type": "object",
            "properties": {
              "ignore": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          },
          "formatter": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/components/schemas/Config.Formatter.Entry"
                }
              }
            ]
          },
          "lsp": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "object",
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "disabled": {
                          "type": "boolean",
                          "enum": [true]
                        }
                      },
                      "required": ["disabled"],
                      "additionalProperties": false
                    },
                    {
                      "$ref": "#/components/schemas/Config.LSP.Server"
                    }
                  ]
                }
              }
            ]
          },
          "media": {
            "type": "object",
            "properties": {
              "image": {
                "type": "object",
                "properties": {
                  "auto_resize": {
                    "type": "boolean"
                  },
                  "max_width": {
                    "type": "integer",
                    "allOf": [
                      {
                        "exclusiveMinimum": 0
                      }
                    ]
                  },
                  "max_height": {
                    "type": "integer",
                    "allOf": [
                      {
                        "exclusiveMinimum": 0
                      }
                    ]
                  },
                  "max_base64_bytes": {
                    "type": "integer",
                    "allOf": [
                      {
                        "exclusiveMinimum": 0
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "tool_output": {
            "type": "object",
            "properties": {
              "max_lines": {
                "type": "integer",
                "allOf": [
                  {
                    "exclusiveMinimum": 0
                  }
                ]
              },
              "max_bytes": {
                "type": "integer",
                "allOf": [
                  {
                    "exclusiveMinimum": 0
                  }
                ]
              }
            },
            "additionalProperties": false
          },
          "mcp": {
            "type": "object",
            "properties": {
              "timeout": {
                "type": "object",
                "properties": {
                  "startup": {
                    "type": "integer",
                    "allOf": [
                      {
                        "exclusiveMinimum": 0
                      }
                    ]
                  },
                  "catalog": {
                    "type": "integer",
                    "allOf": [
                      {
                        "exclusiveMinimum": 0
                      }
                    ]
                  },
                  "execution": {
                    "type": "integer",
                    "allOf": [
                      {
                        "exclusiveMinimum": 0
                      }
                    ]
                  }
                },
                "additionalProperties": false
              },
              "servers": {
                "type": "object",
                "additionalProperties": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Mcp.LocalConfig"
                    },
                    {
                      "$ref": "#/components/schemas/Mcp.RemoteConfig"
                    }
                  ]
                }
              }
            },
            "additionalProperties": false
          },
          "compaction": {
            "type": "object",
            "properties": {
              "auto": {
                "type": "boolean"
              },
              "keep": {
                "type": "object",
                "properties": {
                  "tokens": {
                    "type": "integer",
                    "allOf": [
                      {
                        "minimum": 0
                      }
                    ]
                  }
                },
                "additionalProperties": false
              },
              "buffer": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              }
            },
            "additionalProperties": false
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "commands": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/Config.Command"
            }
          },
          "instructions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "references": {
            "type": "object",
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/Config.Reference.Git"
                },
                {
                  "$ref": "#/components/schemas/Config.Reference.Local"
                }
              ]
            }
          },
          "websearch": {
            "anyOf": [
              {
                "type": "boolean",
                "enum": [false]
              },
              {
                "$ref": "#/components/schemas/ConfigWebSearch.Info"
              }
            ]
          },
          "plugins": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/Config.Plugin.Entry"
                }
              ]
            }
          },
          "warming": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "$ref": "#/components/schemas/Config.Warming"
              }
            ]
          },
          "providers": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/Config.Provider"
            }
          },
          "experimental": {
            "type": "object",
            "properties": {
              "portable_shell_scanner": {
                "type": "boolean"
              },
              "subagent_depth": {
                "type": "integer",
                "allOf": [
                  {
                    "minimum": 0
                  }
                ]
              },
              "policies": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "action": {
                      "type": "string",
                      "enum": ["provider.use"]
                    },
                    "resource": {
                      "type": "string"
                    },
                    "effect": {
                      "type": "string",
                      "enum": ["allow", "deny"]
                    }
                  },
                  "required": ["action", "resource", "effect"],
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "Config.Document": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["document"]
          },
          "path": {
            "type": "string"
          },
          "info": {
            "$ref": "#/components/schemas/Config.Info"
          }
        },
        "required": ["type", "info"],
        "additionalProperties": false
      },
      "Config.Directory": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["directory"]
          },
          "path": {
            "type": "string"
          }
        },
        "required": ["type", "path"],
        "additionalProperties": false
      },
      "Config.AgentsDirectory": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["agents"]
          },
          "path": {
            "type": "string"
          }
        },
        "required": ["type", "path"],
        "additionalProperties": false
      },
      "Config.ClaudeDirectory": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["claude"]
          },
          "path": {
            "type": "string"
          }
        },
        "required": ["type", "path"],
        "additionalProperties": false
      },
      "Config.Entry": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Config.Document"
          },
          {
            "$ref": "#/components/schemas/Config.Directory"
          },
          {
            "$ref": "#/components/schemas/Config.AgentsDirectory"
          },
          {
            "$ref": "#/components/schemas/Config.ClaudeDirectory"
          }
        ]
      }
    },
    "securitySchemes": {}
  },
  "security": [],
  "tags": [
    {
      "name": "health"
    },
    {
      "name": "server"
    },
    {
      "name": "location"
    },
    {
      "name": "agent"
    },
    {
      "name": "plugin",
      "description": "Experimental plugin routes."
    },
    {
      "name": "session",
      "description": "Experimental session routes."
    },
    {
      "name": "session",
      "description": "Experimental message routes."
    },
    {
      "name": "model",
      "description": "Experimental model routes."
    },
    {
      "name": "generate",
      "description": "Experimental one-shot generation routes."
    },
    {
      "name": "provider",
      "description": "Experimental provider routes."
    },
    {
      "name": "integration",
      "description": "Integration discovery and authentication routes."
    },
    {
      "name": "mcp",
      "description": "MCP server and resource routes."
    },
    {
      "name": "credential"
    },
    {
      "name": "project",
      "description": "Project routes."
    },
    {
      "name": "form",
      "description": "Session form routes."
    },
    {
      "name": "permission",
      "description": "Experimental permission routes."
    },
    {
      "name": "filesystem",
      "description": "Experimental location-scoped filesystem routes."
    },
    {
      "name": "command",
      "description": "Experimental command routes."
    },
    {
      "name": "skill",
      "description": "Experimental skill routes."
    },
    {
      "name": "event",
      "description": "Experimental event stream routes."
    },
    {
      "name": "pty",
      "description": "Experimental location-scoped PTY routes."
    },
    {
      "name": "shell",
      "description": "Experimental location-scoped shell command routes."
    },
    {
      "name": "reference",
      "description": "Location-scoped project references."
    },
    {
      "name": "worktree",
      "description": "Project worktree management routes."
    },
    {
      "name": "vcs",
      "description": "Location-scoped version control routes."
    },
    {
      "name": "debug"
    },
    {
      "name": "migration"
    },
    {
      "name": "websearch",
      "description": "Location-scoped web search routes."
    },
    {
      "name": "config",
      "description": "Location-scoped configuration routes."
    }
  ]
}
