{
  "openapi": "3.1.0",
  "info": { "title": "AgenticDriver SDK protocol", "version": "1.0.0" },
  "servers": [
    { "url": "https://driver.example.com" },
    { "url": "http://127.0.0.1:7433", "description": "Loopback development" }
  ],
  "security": [{ "bearerAuth": [] }],
  "paths": {
    "/v1/jobs/submit": {
      "post": {
        "operationId": "submitJob",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Opt-in detached jobs with tenant isolation and separate submit/read/cancel grants. HTTP disconnect leaves execution running. Worker recovery resumes queued jobs and marks started jobs interrupted without replaying effects. Job payload retention is explicit; accepted key tombstones remain. No job duration deadline.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/JobSubmit" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized job metadata or committed event page",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/JobInfo" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/jobs/read": {
      "post": {
        "operationId": "readJob",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Opt-in detached jobs with tenant isolation and separate submit/read/cancel grants. HTTP disconnect leaves execution running. Worker recovery resumes queued jobs and marks started jobs interrupted without replaying effects. Job payload retention is explicit; accepted key tombstones remain. No job duration deadline.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/JobIdentity" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized job metadata or committed event page",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/JobInfo" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/jobs/cancel": {
      "post": {
        "operationId": "cancelJob",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Opt-in detached jobs with tenant isolation and separate submit/read/cancel grants. HTTP disconnect leaves execution running. Worker recovery resumes queued jobs and marks started jobs interrupted without replaying effects. Job payload retention is explicit; accepted key tombstones remain. No job duration deadline.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/JobIdentity" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized job metadata or committed event page",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/JobInfo" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/jobs/events": {
      "post": {
        "operationId": "jobEvents",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Opt-in detached jobs with tenant isolation and separate submit/read/cancel grants. HTTP disconnect leaves execution running. Worker recovery resumes queued jobs and marks started jobs interrupted without replaying effects. Job payload retention is explicit; accepted key tombstones remain. No job duration deadline.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/JobEventsRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized job metadata or committed event page",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/JobEventPage" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/sessions/create": {
      "post": {
        "operationId": "createSession",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Explicit process-local conversation storage. Requires the originating subject, provider and separate session operation grant. Visible history can be exported; opaque provider state stays inside the host. Deletion cancels an active turn. No automatic retries or run deadline.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/SessionCreate" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized conversation snapshot or deletion receipt",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SessionSnapshot" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/sessions/read": {
      "post": {
        "operationId": "readSession",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Explicit process-local conversation storage. Requires the originating subject, provider and separate session operation grant. Visible history can be exported; opaque provider state stays inside the host. Deletion cancels an active turn. No automatic retries or run deadline.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/SessionIdentity" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized conversation snapshot or deletion receipt",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SessionSnapshot" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/sessions/delete": {
      "post": {
        "operationId": "deleteSession",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Explicit process-local conversation storage. Requires the originating subject, provider and separate session operation grant. Visible history can be exported; opaque provider state stays inside the host. Deletion cancels an active turn. No automatic retries or run deadline.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/SessionIdentity" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized conversation snapshot or deletion receipt",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SessionDeleteResult" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/tool-executions/progress": {
      "post": {
        "operationId": "reportToolProgress",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Requires the originating subject, provider and applicationTools grant. Progress reports real work; a result consumes one pending execution. No automatic retries. Disconnect, cancellation or a lost result receipt requires reconciliation with the originating run before replacing an operation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ToolExecutionIdentity" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The matching progress or result was accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolExecutionReceipt"
                }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/tool-executions/results": {
      "post": {
        "operationId": "completeTool",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Requires the originating subject, provider and applicationTools grant. Progress reports real work; a result consumes one pending execution. No automatic retries. Disconnect, cancellation or a lost result receipt requires reconciliation with the originating run before replacing an operation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ToolExecutionResult" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The matching progress or result was accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolExecutionReceipt"
                }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/retrieval/search": {
      "post": {
        "operationId": "searchContext",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Requires an explicit token corpus/operation grant and application authorization. No automatic retries or execution deadline. Disconnect cancels pending work; reconcile an unacknowledged mutation before replacing it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/RetrievalSearch" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scoped retrieval result or source mutation receipt",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/RetrievalResult" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/retrieval/index": {
      "post": {
        "operationId": "indexContext",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Requires an explicit token corpus/operation grant and application authorization. No automatic retries or execution deadline. Disconnect cancels pending work; reconcile an unacknowledged mutation before replacing it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/RetrievalIndexRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scoped retrieval result or source mutation receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetrievalIndexResult"
                }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/retrieval/ingest": {
      "post": {
        "operationId": "ingestContext",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Requires an explicit token corpus/operation grant and application authorization. No automatic retries or execution deadline. Disconnect cancels pending work; reconcile an unacknowledged mutation before replacing it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/IngestRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scoped retrieval result or source mutation receipt",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/IngestResult" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/retrieval/delete": {
      "post": {
        "operationId": "deleteContext",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Requires an explicit token corpus/operation grant and application authorization. No automatic retries or execution deadline. Disconnect cancels pending work; reconcile an unacknowledged mutation before replacing it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/RetrievalDelete" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scoped retrieval result or source mutation receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetrievalDeleteResult"
                }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "security": [],
        "responses": {
          "200": {
            "description": "Host health and protocol version",
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/providers": {
      "get": {
        "operationId": "listProviders",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" },
          {
            "name": "refresh",
            "in": "query",
            "schema": { "const": "true" },
            "description": "Refresh account health and model inventory, subject to the host's minimum refresh interval. Omit to use the normal cache."
          }
        ],
        "responses": {
          "200": {
            "description": "Only provider instances allowed by this token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["providers"],
                  "properties": {
                    "providers": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Provider" }
                    }
                  }
                }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/management/invitations": {
      "post": {
        "summary": "Create a one-use scoped connection invitation (operator grant required)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateInvitation" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Secret invitation code; display only once",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionInvitation"
                }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/connections/exchange": {
      "post": {
        "summary": "Exchange the one-use invitation bearer for a scoped connection credential",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "type": "object", "additionalProperties": false }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Private connection credential; never put in browser storage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionCredentials"
                }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "401": {
            "description": "Invitation expired, consumed, revoked or invalid"
          }
        }
      }
    },
    "/v1/management/connections": {
      "get": {
        "summary": "List active connection grants without credentials",
        "responses": {
          "200": {
            "description": "Active grants and invitations",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ConnectionList" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/management/connections/revoke": {
      "post": {
        "summary": "Revoke an explicit connection or invitation ID",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/RevokeConnection" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Revocation receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["revoked"],
                  "properties": { "revoked": { "type": "boolean" } }
                }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/management/setup": {
      "post": {
        "summary": "Start, inspect, accept or cancel an owned native provider sign-in",
        "description": "Requires provider-setup and manageProviders. Attempts are bound to the initiating credential, provider/account and configuration revision. Accept only after native account verification. No model requests or execution grants.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ProviderSetupRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Caller-owned setup state; provider credentials omitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderSetupSnapshot"
                }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "403": { "description": "Management grant required" },
          "404": { "description": "Attempt unavailable to this credential" },
          "409": {
            "description": "Stale, finished or not-yet-verified attempt"
          },
          "503": { "description": "Owned sign-in unavailable on this host" }
        }
      }
    },
    "/v1/management": {
      "get": {
        "summary": "Read host provider settings (manageProviders grant required)",
        "responses": {
          "200": {
            "description": "Versioned provider settings",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ManagementSnapshot" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/management/providers": {
      "post": {
        "summary": "Add or replace provider settings with an optimistic revision check",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ConfigureProvider" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed settings; secrets omitted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ManagementSnapshot" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "409": { "description": "Settings changed; refresh before retrying" }
        }
      }
    },
    "/v1/protocol": {
      "get": {
        "operationId": "getProtocol",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Authenticated wire-version and host-feature discovery. An omitted version header selects the original 1.0 contract.",
        "responses": {
          "200": {
            "description": "Supported protocol versions and host features",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ProtocolInfo" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/approvals/decisions": {
      "post": {
        "operationId": "decideApproval",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Consume one pending interactive approval. Bound to the authenticated subject, provider and separate approveTools grant, run and exact call. No automatic retries; the receipt acknowledges a decision, not tool execution. Observe the originating stream to reconcile a lost receipt.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ApprovalDecision" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The decision was accepted once",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ApprovalResolution" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    },
    "/v1/runs": {
      "post": {
        "operationId": "run",
        "parameters": [
          { "$ref": "#/components/parameters/ProtocolVersion" },
          { "$ref": "#/components/parameters/OptionalEvents" }
        ],
        "description": "Accept: application/json for one result; text/event-stream for ordered events. Disconnect cancels an unfinished run. No retries, reconnection, or resumable server state.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/RunRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completed JSON result or an SSE stream with one terminal event",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/RunResult" }
              },
              "text/event-stream": {
                "schema": { "type": "string" },
                "description": "SSE data is a JSON RunEvent; id is its sequence; event is its type."
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          },
          "default": {
            "description": "Authentication, validation, capacity, or execution failure",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "AgenticDriver-Version": {
                "schema": { "const": "1.0" },
                "description": "The host's selected wire version."
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "ProtocolVersion": {
        "name": "AgenticDriver-Version",
        "in": "header",
        "required": false,
        "schema": { "type": "string", "default": "1.0" },
        "description": "Exact wire version to select. Unsupported values fail before provider/tool execution. Independent of package versions."
      },
      "OptionalEvents": {
        "name": "AgenticDriver-Accept-Optional-Events",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "enum": ["true", "false"],
          "default": "false"
        },
        "description": "Opt in to unknown advisory event types marked optional:true. Older clients omit this header and receive only the original event types."
      }
    },
    "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer" } },
    "schemas": {
      "CreateInvitation": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "grant": {
            "type": "object",
            "properties": {
              "manageProviders": { "type": "boolean" },
              "subject": { "type": "string", "minLength": 1, "maxLength": 128 },
              "providers": {
                "maxItems": 256,
                "type": "array",
                "items": { "type": "string", "minLength": 1, "maxLength": 256 }
              },
              "tools": {
                "default": [],
                "maxItems": 256,
                "type": "array",
                "items": { "type": "string", "minLength": 1, "maxLength": 256 }
              },
              "approveTools": {
                "default": [],
                "maxItems": 256,
                "type": "array",
                "items": { "type": "string", "minLength": 1, "maxLength": 256 }
              },
              "applicationTools": {
                "default": [],
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
                    },
                    "requiresApproval": { "type": "boolean" }
                  },
                  "required": ["name"],
                  "additionalProperties": false
                }
              },
              "jobs": {
                "default": [],
                "maxItems": 3,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": ["submit", "read", "cancel"]
                }
              },
              "sessions": {
                "default": [],
                "maxItems": 4,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": ["create", "read", "continue", "delete"]
                }
              },
              "retrieval": {
                "default": { "search": [], "index": [], "delete": [] },
                "type": "object",
                "properties": {
                  "search": {
                    "default": [],
                    "maxItems": 256,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  },
                  "index": {
                    "default": [],
                    "maxItems": 256,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  },
                  "delete": {
                    "default": [],
                    "maxItems": 256,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  }
                }
              }
            },
            "required": ["subject", "providers"]
          },
          "expiresInSeconds": {
            "default": 600,
            "type": "integer",
            "minimum": 30,
            "maximum": 3600
          },
          "connectionLifetimeSeconds": {
            "default": 2592000,
            "type": "integer",
            "minimum": 60,
            "maximum": 7776000
          }
        },
        "required": ["grant"],
        "additionalProperties": false
      },
      "ConnectionInvitation": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "grant": {
            "type": "object",
            "properties": {
              "manageProviders": { "type": "boolean" },
              "subject": { "type": "string", "minLength": 1, "maxLength": 128 },
              "providers": {
                "maxItems": 256,
                "type": "array",
                "items": { "type": "string", "minLength": 1, "maxLength": 256 }
              },
              "tools": {
                "default": [],
                "maxItems": 256,
                "type": "array",
                "items": { "type": "string", "minLength": 1, "maxLength": 256 }
              },
              "approveTools": {
                "default": [],
                "maxItems": 256,
                "type": "array",
                "items": { "type": "string", "minLength": 1, "maxLength": 256 }
              },
              "applicationTools": {
                "default": [],
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
                    },
                    "requiresApproval": { "type": "boolean" }
                  },
                  "required": ["name"],
                  "additionalProperties": false
                }
              },
              "jobs": {
                "default": [],
                "maxItems": 3,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": ["submit", "read", "cancel"]
                }
              },
              "sessions": {
                "default": [],
                "maxItems": 4,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": ["create", "read", "continue", "delete"]
                }
              },
              "retrieval": {
                "default": { "search": [], "index": [], "delete": [] },
                "type": "object",
                "properties": {
                  "search": {
                    "default": [],
                    "maxItems": 256,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  },
                  "index": {
                    "default": [],
                    "maxItems": 256,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  },
                  "delete": {
                    "default": [],
                    "maxItems": 256,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  }
                }
              }
            },
            "required": ["subject", "providers"]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "lastSeenAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "activeRequests": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "code": { "type": "string", "pattern": "^[A-Za-z0-9_-]{43}$" }
        },
        "required": ["id", "grant", "createdAt", "expiresAt", "code"]
      },
      "ConnectionCredentials": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "grant": {
            "type": "object",
            "properties": {
              "manageProviders": { "type": "boolean" },
              "subject": { "type": "string", "minLength": 1, "maxLength": 128 },
              "providers": {
                "maxItems": 256,
                "type": "array",
                "items": { "type": "string", "minLength": 1, "maxLength": 256 }
              },
              "tools": {
                "default": [],
                "maxItems": 256,
                "type": "array",
                "items": { "type": "string", "minLength": 1, "maxLength": 256 }
              },
              "approveTools": {
                "default": [],
                "maxItems": 256,
                "type": "array",
                "items": { "type": "string", "minLength": 1, "maxLength": 256 }
              },
              "applicationTools": {
                "default": [],
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
                    },
                    "requiresApproval": { "type": "boolean" }
                  },
                  "required": ["name"],
                  "additionalProperties": false
                }
              },
              "jobs": {
                "default": [],
                "maxItems": 3,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": ["submit", "read", "cancel"]
                }
              },
              "sessions": {
                "default": [],
                "maxItems": 4,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": ["create", "read", "continue", "delete"]
                }
              },
              "retrieval": {
                "default": { "search": [], "index": [], "delete": [] },
                "type": "object",
                "properties": {
                  "search": {
                    "default": [],
                    "maxItems": 256,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  },
                  "index": {
                    "default": [],
                    "maxItems": 256,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  },
                  "delete": {
                    "default": [],
                    "maxItems": 256,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  }
                }
              }
            },
            "required": ["subject", "providers"]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "lastSeenAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "activeRequests": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "token": { "type": "string", "pattern": "^[A-Za-z0-9_-]{43}$" }
        },
        "required": ["id", "grant", "createdAt", "expiresAt", "token"]
      },
      "ConnectionList": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "invitations": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "grant": {
                  "type": "object",
                  "properties": {
                    "manageProviders": { "type": "boolean" },
                    "subject": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "providers": {
                      "maxItems": 256,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "tools": {
                      "default": [],
                      "maxItems": 256,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "approveTools": {
                      "default": [],
                      "maxItems": 256,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "applicationTools": {
                      "default": [],
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
                          },
                          "requiresApproval": { "type": "boolean" }
                        },
                        "required": ["name"],
                        "additionalProperties": false
                      }
                    },
                    "jobs": {
                      "default": [],
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": ["submit", "read", "cancel"]
                      }
                    },
                    "sessions": {
                      "default": [],
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": ["create", "read", "continue", "delete"]
                      }
                    },
                    "retrieval": {
                      "default": { "search": [], "index": [], "delete": [] },
                      "type": "object",
                      "properties": {
                        "search": {
                          "default": [],
                          "maxItems": 256,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          }
                        },
                        "index": {
                          "default": [],
                          "maxItems": 256,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          }
                        },
                        "delete": {
                          "default": [],
                          "maxItems": 256,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          }
                        }
                      }
                    }
                  },
                  "required": ["subject", "providers"]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "expiresAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "lastSeenAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "activeRequests": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": ["id", "grant", "createdAt", "expiresAt"]
            }
          },
          "connections": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "grant": {
                  "type": "object",
                  "properties": {
                    "manageProviders": { "type": "boolean" },
                    "subject": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "providers": {
                      "maxItems": 256,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "tools": {
                      "default": [],
                      "maxItems": 256,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "approveTools": {
                      "default": [],
                      "maxItems": 256,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "applicationTools": {
                      "default": [],
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
                          },
                          "requiresApproval": { "type": "boolean" }
                        },
                        "required": ["name"],
                        "additionalProperties": false
                      }
                    },
                    "jobs": {
                      "default": [],
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": ["submit", "read", "cancel"]
                      }
                    },
                    "sessions": {
                      "default": [],
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": ["create", "read", "continue", "delete"]
                      }
                    },
                    "retrieval": {
                      "default": { "search": [], "index": [], "delete": [] },
                      "type": "object",
                      "properties": {
                        "search": {
                          "default": [],
                          "maxItems": 256,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          }
                        },
                        "index": {
                          "default": [],
                          "maxItems": 256,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          }
                        },
                        "delete": {
                          "default": [],
                          "maxItems": 256,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          }
                        }
                      }
                    }
                  },
                  "required": ["subject", "providers"]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "expiresAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "lastSeenAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "activeRequests": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": ["id", "grant", "createdAt", "expiresAt"]
            }
          }
        },
        "required": ["invitations", "connections"]
      },
      "RevokeConnection": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": ["id"],
        "additionalProperties": false
      },
      "ConfigureProvider": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "revision": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "provider": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "enabled": { "type": "boolean" },
                  "accountId": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "models": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                    }
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "openai",
                      "anthropic",
                      "gemini",
                      "xai",
                      "xai-responses",
                      "openai-compatible"
                    ]
                  },
                  "apiKeyRef": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "env": {
                            "type": "string",
                            "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$"
                          }
                        },
                        "required": ["env"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "file": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 4096
                          }
                        },
                        "required": ["file"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "keychain": {
                            "type": "object",
                            "properties": {
                              "service": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              },
                              "account": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "required": ["service", "account"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["keychain"],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "inputMediaTypes": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                    },
                    "additionalProperties": {
                      "maxItems": 6,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "text/plain",
                          "text/markdown",
                          "image/png",
                          "image/jpeg",
                          "image/webp",
                          "application/pdf"
                        ]
                      }
                    }
                  },
                  "baseUrl": { "type": "string", "format": "uri" }
                },
                "required": ["id", "kind", "apiKeyRef"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "enabled": { "type": "boolean" },
                  "accountId": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "models": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                    }
                  },
                  "kind": {
                    "type": "string",
                    "enum": ["claude-code", "gemini-cli"]
                  },
                  "accountDirectory": { "type": "string", "minLength": 1 },
                  "binary": { "type": "string", "minLength": 1 }
                },
                "required": ["id", "kind"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "enabled": { "type": "boolean" },
                  "accountId": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "models": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                    }
                  },
                  "kind": { "type": "string", "const": "codex" },
                  "accountDirectory": { "type": "string", "minLength": 1 },
                  "binary": { "type": "string", "minLength": 1 },
                  "reasoningEffort": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_-]{0,63}$"
                  },
                  "applicationTools": { "type": "string", "const": "mcp" }
                },
                "required": ["id", "kind"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "enabled": { "type": "boolean" },
                  "accountId": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "models": {
                    "minItems": 1,
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                    }
                  },
                  "kind": { "type": "string", "const": "extension" },
                  "extensionId": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "extensionVersion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "settings": {
                    "default": {},
                    "type": "object",
                    "propertyNames": { "type": "string" },
                    "additionalProperties": {
                      "$ref": "#/components/schemas/ConfigureProvider/$defs/__schema0"
                    }
                  },
                  "secretRefs": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "env": {
                              "type": "string",
                              "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$"
                            }
                          },
                          "required": ["env"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "file": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 4096
                            }
                          },
                          "required": ["file"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "keychain": {
                              "type": "object",
                              "properties": {
                                "service": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "account": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                }
                              },
                              "required": ["service", "account"],
                              "additionalProperties": false
                            }
                          },
                          "required": ["keychain"],
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "id",
                  "models",
                  "kind",
                  "extensionId",
                  "extensionVersion"
                ],
                "additionalProperties": false
              }
            ]
          },
          "remove": { "type": "boolean" },
          "apiKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096,
            "pattern": "^[^\\s\\0]+$"
          }
        },
        "required": ["revision", "provider"],
        "additionalProperties": false,
        "$defs": {
          "__schema0": {
            "anyOf": [
              { "type": "string" },
              { "type": "number" },
              { "type": "boolean" },
              { "type": "null" },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ConfigureProvider/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": { "type": "string" },
                "additionalProperties": {
                  "$ref": "#/components/schemas/ConfigureProvider/$defs/__schema0"
                }
              }
            ]
          }
        }
      },
      "ManagementSnapshot": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "version": { "type": "number", "const": 1 },
          "revision": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "providers": {
            "maxItems": 32,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                    },
                    "enabled": { "type": "boolean" },
                    "accountId": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "models": {
                      "maxItems": 1000,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                      }
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "openai",
                        "anthropic",
                        "gemini",
                        "xai",
                        "xai-responses",
                        "openai-compatible"
                      ]
                    },
                    "apiKeyRef": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "env": {
                              "type": "string",
                              "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$"
                            }
                          },
                          "required": ["env"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "file": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 4096
                            }
                          },
                          "required": ["file"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "keychain": {
                              "type": "object",
                              "properties": {
                                "service": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "account": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                }
                              },
                              "required": ["service", "account"],
                              "additionalProperties": false
                            }
                          },
                          "required": ["keychain"],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "inputMediaTypes": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                      },
                      "additionalProperties": {
                        "maxItems": 6,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "text/plain",
                            "text/markdown",
                            "image/png",
                            "image/jpeg",
                            "image/webp",
                            "application/pdf"
                          ]
                        }
                      }
                    },
                    "baseUrl": { "type": "string", "format": "uri" }
                  },
                  "required": ["id", "kind", "apiKeyRef"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                    },
                    "enabled": { "type": "boolean" },
                    "accountId": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "models": {
                      "maxItems": 1000,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                      }
                    },
                    "kind": {
                      "type": "string",
                      "enum": ["claude-code", "gemini-cli"]
                    },
                    "accountDirectory": { "type": "string", "minLength": 1 },
                    "binary": { "type": "string", "minLength": 1 }
                  },
                  "required": ["id", "kind"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                    },
                    "enabled": { "type": "boolean" },
                    "accountId": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "models": {
                      "maxItems": 1000,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                      }
                    },
                    "kind": { "type": "string", "const": "codex" },
                    "accountDirectory": { "type": "string", "minLength": 1 },
                    "binary": { "type": "string", "minLength": 1 },
                    "reasoningEffort": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_-]{0,63}$"
                    },
                    "applicationTools": { "type": "string", "const": "mcp" }
                  },
                  "required": ["id", "kind"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                    },
                    "enabled": { "type": "boolean" },
                    "accountId": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "models": {
                      "minItems": 1,
                      "maxItems": 1000,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                      }
                    },
                    "kind": { "type": "string", "const": "extension" },
                    "extensionId": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                    },
                    "extensionVersion": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "settings": {
                      "default": {},
                      "type": "object",
                      "propertyNames": { "type": "string" },
                      "additionalProperties": {
                        "$ref": "#/components/schemas/ManagementSnapshot/$defs/__schema0"
                      }
                    },
                    "secretRefs": {
                      "default": {},
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                      },
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "env": {
                                "type": "string",
                                "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$"
                              }
                            },
                            "required": ["env"],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "file": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 4096
                              }
                            },
                            "required": ["file"],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "keychain": {
                                "type": "object",
                                "properties": {
                                  "service": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  },
                                  "account": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  }
                                },
                                "required": ["service", "account"],
                                "additionalProperties": false
                              }
                            },
                            "required": ["keychain"],
                            "additionalProperties": false
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "id",
                    "models",
                    "kind",
                    "extensionId",
                    "extensionVersion"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "supportedKinds": {
            "maxItems": 32,
            "type": "array",
            "items": { "type": "string", "minLength": 1, "maxLength": 80 }
          },
          "providerDefinitions": {
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": { "type": "string", "minLength": 1, "maxLength": 80 },
                "name": { "type": "string", "minLength": 1, "maxLength": 100 },
                "description": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "category": {
                  "type": "string",
                  "enum": ["native", "api", "compatible"]
                },
                "protocol": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "methods": {
                  "minItems": 1,
                  "maxItems": 8,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9-]{0,79}$"
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "description": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      },
                      "interaction": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9-]{0,79}$"
                      },
                      "credentialOwner": {
                        "type": "string",
                        "enum": ["native-runtime", "host", "none"]
                      }
                    },
                    "required": [
                      "id",
                      "label",
                      "description",
                      "interaction",
                      "credentialOwner"
                    ]
                  }
                },
                "requirements": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 2000
                },
                "docsUrl": {
                  "type": "string",
                  "maxLength": 2000,
                  "pattern": "^https:\\/\\/"
                }
              },
              "required": [
                "kind",
                "name",
                "description",
                "category",
                "protocol",
                "methods"
              ]
            }
          },
          "executionProviders": {
            "maxItems": 256,
            "type": "array",
            "items": { "type": "string", "minLength": 1, "maxLength": 256 }
          },
          "removalSupported": { "type": "boolean" }
        },
        "required": ["version", "revision", "providers", "supportedKinds"],
        "$defs": {
          "__schema0": {
            "anyOf": [
              { "type": "string" },
              { "type": "number" },
              { "type": "boolean" },
              { "type": "null" },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ManagementSnapshot/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": { "type": "string" },
                "additionalProperties": {
                  "$ref": "#/components/schemas/ManagementSnapshot/$defs/__schema0"
                }
              }
            ]
          }
        }
      },
      "ProviderSetupRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "action": { "type": "string", "const": "start" },
              "revision": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
              "method": { "type": "string", "const": "codex-device" },
              "provider": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "enabled": { "type": "boolean" },
                  "accountId": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "models": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
                    }
                  },
                  "kind": { "type": "string", "const": "codex" },
                  "binary": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096
                  },
                  "reasoningEffort": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_-]{0,63}$"
                  },
                  "applicationTools": { "type": "string", "const": "mcp" }
                },
                "required": ["id", "accountId", "kind"],
                "additionalProperties": false
              }
            },
            "required": ["action", "revision", "method", "provider"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": { "action": { "type": "string", "const": "list" } },
            "required": ["action"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "action": { "type": "string", "const": "status" },
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              }
            },
            "required": ["action", "id"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "action": { "type": "string", "const": "accept" },
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              }
            },
            "required": ["action", "id"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "action": { "type": "string", "const": "cancel" },
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              }
            },
            "required": ["action", "id"],
            "additionalProperties": false
          }
        ]
      },
      "ProviderSetupSnapshot": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "version": { "type": "number", "const": 1 },
          "attempts": {
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "providerId": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                },
                "accountId": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
                },
                "name": { "type": "string", "minLength": 1, "maxLength": 100 },
                "revision": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
                "method": { "type": "string", "const": "codex-device" },
                "phase": {
                  "type": "string",
                  "enum": [
                    "starting",
                    "waiting",
                    "verifying",
                    "ready",
                    "succeeded",
                    "failed",
                    "cancelled",
                    "expired"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "expiresAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "interaction": {
                  "type": "object",
                  "properties": {
                    "type": { "type": "string", "const": "device-code" },
                    "verificationUrl": {
                      "type": "string",
                      "const": "https://auth.openai.com/codex/device"
                    },
                    "userCode": {
                      "type": "string",
                      "pattern": "^[A-Z0-9-]{4,40}$"
                    }
                  },
                  "required": ["type", "verificationUrl", "userCode"]
                },
                "account": {
                  "type": "object",
                  "properties": {
                    "email": {
                      "anyOf": [
                        { "type": "string", "maxLength": 320 },
                        { "type": "null" }
                      ]
                    },
                    "plan": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "providerAccountId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 256
                    }
                  },
                  "required": ["email", "plan"]
                },
                "error": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "message": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    }
                  },
                  "required": ["code", "message"]
                }
              },
              "required": [
                "id",
                "providerId",
                "accountId",
                "name",
                "revision",
                "method",
                "phase",
                "createdAt",
                "updatedAt",
                "expiresAt"
              ]
            }
          }
        },
        "required": ["version", "attempts"]
      },
      "JobSubmit": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "request": {
            "type": "object",
            "properties": {
              "provider": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
              },
              "model": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
              },
              "input": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100000
              },
              "attachments": {
                "maxItems": 16,
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": { "type": "string", "const": "text" },
                            "source": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "revision": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "title": { "type": "string", "maxLength": 256 },
                                "uri": {
                                  "type": "string",
                                  "maxLength": 2048,
                                  "pattern": "^(https|app):\\/\\/[^\\s]+$"
                                },
                                "location": {
                                  "type": "object",
                                  "properties": {
                                    "documentId": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                    },
                                    "page": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "pageEnd": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "startLine": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "endLine": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "section": {
                                      "type": "string",
                                      "maxLength": 256
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                    },
                                    "messageId": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              },
                              "required": ["id", "revision"],
                              "additionalProperties": false
                            },
                            "mediaType": {
                              "type": "string",
                              "enum": ["text/plain", "text/markdown"]
                            },
                            "text": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 1000000
                            }
                          },
                          "required": ["type", "source", "mediaType", "text"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": { "type": "string", "const": "image" },
                            "source": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "revision": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "title": { "type": "string", "maxLength": 256 },
                                "uri": {
                                  "type": "string",
                                  "maxLength": 2048,
                                  "pattern": "^(https|app):\\/\\/[^\\s]+$"
                                },
                                "location": {
                                  "type": "object",
                                  "properties": {
                                    "documentId": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                    },
                                    "page": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "pageEnd": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "startLine": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "endLine": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "section": {
                                      "type": "string",
                                      "maxLength": 256
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                    },
                                    "messageId": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              },
                              "required": ["id", "revision"],
                              "additionalProperties": false
                            },
                            "mediaType": {
                              "type": "string",
                              "enum": ["image/png", "image/jpeg", "image/webp"]
                            },
                            "data": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 44739244
                            }
                          },
                          "required": ["type", "source", "mediaType", "data"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": { "type": "string", "const": "pdf" },
                            "source": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "revision": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "title": { "type": "string", "maxLength": 256 },
                                "uri": {
                                  "type": "string",
                                  "maxLength": 2048,
                                  "pattern": "^(https|app):\\/\\/[^\\s]+$"
                                },
                                "location": {
                                  "type": "object",
                                  "properties": {
                                    "documentId": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                    },
                                    "page": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "pageEnd": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "startLine": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "endLine": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 1000000
                                    },
                                    "section": {
                                      "type": "string",
                                      "maxLength": 256
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                    },
                                    "messageId": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              },
                              "required": ["id", "revision"],
                              "additionalProperties": false
                            },
                            "mediaType": {
                              "type": "string",
                              "const": "application/pdf"
                            },
                            "data": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 44739244
                            }
                          },
                          "required": ["type", "source", "mediaType", "data"],
                          "additionalProperties": false
                        }
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": { "type": "string", "const": "reference" },
                        "id": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                        },
                        "revision": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                        },
                        "mediaType": {
                          "type": "string",
                          "enum": [
                            "text/plain",
                            "text/markdown",
                            "image/png",
                            "image/jpeg",
                            "image/webp",
                            "application/pdf"
                          ]
                        }
                      },
                      "required": ["type", "id", "revision", "mediaType"],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "retrieval": {
                "type": "object",
                "properties": {
                  "corpus": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "sourceIds": {
                    "minItems": 1,
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  },
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16384
                  },
                  "limit": { "type": "integer", "minimum": 1, "maximum": 16 },
                  "maxContextBytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 262144
                  },
                  "minScore": { "type": "number", "minimum": -1, "maximum": 1 }
                },
                "required": ["corpus"],
                "additionalProperties": false
              },
              "outputArtifact": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^/\\\\\\u0000-\\u001f]+$"
                  },
                  "mediaType": {
                    "type": "string",
                    "enum": ["text/plain", "text/markdown", "application/json"]
                  }
                },
                "required": ["name", "mediaType"],
                "additionalProperties": false
              },
              "idempotencyKey": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "retry": {
                "type": "object",
                "properties": {
                  "maxAttempts": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "baseDelayMs": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 60000
                  },
                  "maxDelayMs": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 60000
                  }
                },
                "required": ["maxAttempts"],
                "additionalProperties": false
              },
              "instructions": { "type": "string", "maxLength": 100000 },
              "history": {
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "role": { "type": "string", "enum": ["user", "assistant"] },
                    "content": { "type": "string", "maxLength": 100000 }
                  },
                  "required": ["role", "content"],
                  "additionalProperties": false
                }
              },
              "session": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["id", "revision"],
                "additionalProperties": false
              },
              "approvals": {
                "type": "object",
                "properties": {
                  "mode": { "type": "string", "const": "interactive" },
                  "idlePolicy": {
                    "type": "string",
                    "enum": ["pause", "continue"]
                  },
                  "expiresAfterMs": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2147483647
                  }
                },
                "required": ["mode", "idlePolicy"],
                "additionalProperties": false
              },
              "applicationTools": {
                "minItems": 1,
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
                    },
                    "description": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 10000
                    },
                    "inputSchema": {
                      "type": "object",
                      "propertyNames": { "type": "string" },
                      "additionalProperties": {}
                    },
                    "outputSchema": {
                      "type": "object",
                      "propertyNames": { "type": "string" },
                      "additionalProperties": {}
                    },
                    "requiresApproval": { "type": "boolean" }
                  },
                  "required": ["name", "description", "inputSchema"],
                  "additionalProperties": false
                }
              },
              "tools": {
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
                }
              },
              "requiredCapabilities": {
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z][a-zA-Z0-9._-]{0,79}$"
                }
              },
              "maxSteps": { "type": "integer", "minimum": 1, "maximum": 64 },
              "maxOutputTokens": {
                "type": "integer",
                "minimum": 1,
                "maximum": 65536
              },
              "idleTimeoutMs": {
                "type": "integer",
                "minimum": 0,
                "maximum": 2147483647
              },
              "outputSchema": {
                "type": "object",
                "propertyNames": { "type": "string" },
                "additionalProperties": {}
              },
              "metadata": {
                "type": "object",
                "propertyNames": { "type": "string", "maxLength": 80 },
                "additionalProperties": { "type": "string", "maxLength": 500 }
              }
            },
            "required": ["provider", "model", "input"],
            "additionalProperties": false
          }
        },
        "required": ["key", "request"],
        "additionalProperties": false
      },
      "JobIdentity": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$"
          }
        },
        "required": ["id"],
        "additionalProperties": false
      },
      "JobInfo": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$"
          },
          "runId": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$"
          },
          "provider": { "type": "string", "minLength": 1 },
          "model": { "type": "string", "minLength": 1 },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "completed",
              "failed",
              "cancelled",
              "interrupted"
            ]
          },
          "cursor": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "cancelRequested": { "type": "boolean" },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
          }
        },
        "required": [
          "id",
          "runId",
          "provider",
          "model",
          "state",
          "cursor",
          "cancelRequested",
          "createdAt",
          "updatedAt"
        ]
      },
      "JobEventsRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$"
          },
          "after": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "limit": { "type": "integer", "minimum": 1, "maximum": 100 }
        },
        "required": ["id", "after"],
        "additionalProperties": false
      },
      "SessionCreate": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
          },
          "model": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
          },
          "mode": { "type": "string", "enum": ["history", "native"] },
          "history": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": { "type": "string", "enum": ["user", "assistant"] },
                "content": { "type": "string", "maxLength": 100000 }
              },
              "required": ["role", "content"],
              "additionalProperties": false
            }
          },
          "instructions": { "type": "string", "maxLength": 100000 }
        },
        "required": ["provider", "model", "mode"],
        "additionalProperties": false
      },
      "SessionIdentity": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
          }
        },
        "required": ["id"],
        "additionalProperties": false
      },
      "SessionHandle": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": ["id", "revision"],
        "additionalProperties": false
      },
      "SessionInfo": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "provider": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
          },
          "model": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
          },
          "mode": { "type": "string", "enum": ["history", "native"] },
          "state": {
            "type": "string",
            "enum": ["ready", "running", "interrupted"]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
          }
        },
        "required": [
          "id",
          "revision",
          "provider",
          "model",
          "mode",
          "state",
          "createdAt",
          "updatedAt"
        ]
      },
      "SessionSnapshot": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "session": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
              },
              "revision": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "provider": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
              },
              "model": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
              },
              "mode": { "type": "string", "enum": ["history", "native"] },
              "state": {
                "type": "string",
                "enum": ["ready", "running", "interrupted"]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}(?:Z))$"
              }
            },
            "required": [
              "id",
              "revision",
              "provider",
              "model",
              "mode",
              "state",
              "createdAt",
              "updatedAt"
            ]
          },
          "history": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": { "type": "string", "enum": ["user", "assistant"] },
                "content": { "type": "string", "maxLength": 100000 }
              },
              "required": ["role", "content"],
              "additionalProperties": false
            }
          },
          "instructions": { "type": "string", "maxLength": 100000 }
        },
        "required": ["session", "history"]
      },
      "SessionDeleteResult": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
          },
          "deleted": { "type": "boolean", "const": true }
        },
        "required": ["id", "deleted"]
      },
      "ApplicationToolDefinition": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "inputSchema": {
            "type": "object",
            "propertyNames": { "type": "string" },
            "additionalProperties": {}
          },
          "outputSchema": {
            "type": "object",
            "propertyNames": { "type": "string" },
            "additionalProperties": {}
          },
          "requiresApproval": { "type": "boolean" }
        },
        "required": ["name", "description", "inputSchema"],
        "additionalProperties": false
      },
      "ApplicationToolGrant": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
          },
          "requiresApproval": { "type": "boolean" }
        },
        "required": ["name"],
        "additionalProperties": false
      },
      "ToolExecutionIdentity": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "executionId": { "type": "string", "minLength": 1, "maxLength": 256 },
          "runId": { "type": "string", "minLength": 1, "maxLength": 256 },
          "callId": { "type": "string", "minLength": 1, "maxLength": 256 }
        },
        "required": ["executionId", "runId", "callId"],
        "additionalProperties": false
      },
      "ToolExecutionRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "executionId": { "type": "string", "minLength": 1, "maxLength": 256 },
          "runId": { "type": "string", "minLength": 1, "maxLength": 256 },
          "call": {
            "type": "object",
            "properties": {
              "id": { "type": "string", "minLength": 1, "maxLength": 256 },
              "name": {
                "type": "string",
                "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
              },
              "arguments": {
                "type": "object",
                "propertyNames": { "type": "string" },
                "additionalProperties": {
                  "$ref": "#/components/schemas/ToolExecutionRequest/$defs/__schema0"
                }
              }
            },
            "required": ["id", "name", "arguments"]
          }
        },
        "required": ["executionId", "runId", "call"],
        "$defs": {
          "__schema0": {
            "anyOf": [
              { "type": "string" },
              { "type": "number" },
              { "type": "boolean" },
              { "type": "null" },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ToolExecutionRequest/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": { "type": "string" },
                "additionalProperties": {
                  "$ref": "#/components/schemas/ToolExecutionRequest/$defs/__schema0"
                }
              }
            ]
          }
        }
      },
      "ToolExecutionResult": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "executionId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "runId": { "type": "string", "minLength": 1, "maxLength": 256 },
              "callId": { "type": "string", "minLength": 1, "maxLength": 256 },
              "output": {
                "$ref": "#/components/schemas/ToolExecutionResult/$defs/__schema0"
              }
            },
            "required": ["executionId", "runId", "callId", "output"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "executionId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "runId": { "type": "string", "minLength": 1, "maxLength": 256 },
              "callId": { "type": "string", "minLength": 1, "maxLength": 256 },
              "error": { "type": "string", "const": "APPLICATION_TOOL_FAILED" }
            },
            "required": ["executionId", "runId", "callId", "error"],
            "additionalProperties": false
          }
        ],
        "$defs": {
          "__schema0": {
            "anyOf": [
              { "type": "string" },
              { "type": "number" },
              { "type": "boolean" },
              { "type": "null" },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ToolExecutionResult/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": { "type": "string" },
                "additionalProperties": {
                  "$ref": "#/components/schemas/ToolExecutionResult/$defs/__schema0"
                }
              }
            ]
          }
        }
      },
      "ToolExecutionReceipt": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "executionId": { "type": "string", "minLength": 1, "maxLength": 256 },
          "runId": { "type": "string", "minLength": 1, "maxLength": 256 },
          "callId": { "type": "string", "minLength": 1, "maxLength": 256 },
          "status": { "type": "string", "enum": ["progress", "accepted"] }
        },
        "required": ["executionId", "runId", "callId", "status"]
      },
      "JobEventPage": {
        "type": "object",
        "required": ["job", "events", "nextCursor", "hasMore"],
        "properties": {
          "job": { "$ref": "#/components/schemas/JobInfo" },
          "events": {
            "type": "array",
            "maxItems": 100,
            "items": { "$ref": "#/components/schemas/RunEvent" }
          },
          "nextCursor": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "hasMore": { "type": "boolean" }
        },
        "description": "Contiguous committed events after the requested cursor, bounded to 100 events and approximately 1.5 MB per page. No automatic tool dispatch or retry."
      },
      "ApprovalPolicy": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "mode": { "type": "string", "const": "interactive" },
          "idlePolicy": { "type": "string", "enum": ["pause", "continue"] },
          "expiresAfterMs": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          }
        },
        "required": ["mode", "idlePolicy"],
        "additionalProperties": false
      },
      "ApprovalRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "approvalId": { "type": "string", "minLength": 1 },
          "runId": { "type": "string", "minLength": 1 },
          "call": {
            "type": "object",
            "properties": {
              "id": { "type": "string", "minLength": 1, "maxLength": 256 },
              "name": {
                "type": "string",
                "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
              },
              "arguments": {
                "type": "object",
                "propertyNames": { "type": "string" },
                "additionalProperties": {
                  "$ref": "#/components/schemas/ApprovalRequest/$defs/__schema0"
                }
              }
            },
            "required": ["id", "name", "arguments"]
          },
          "requestedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "idlePolicy": { "type": "string", "enum": ["pause", "continue"] }
        },
        "required": [
          "approvalId",
          "runId",
          "call",
          "requestedAt",
          "idlePolicy"
        ],
        "$defs": {
          "__schema0": {
            "anyOf": [
              { "type": "string" },
              { "type": "number" },
              { "type": "boolean" },
              { "type": "null" },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ApprovalRequest/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": { "type": "string" },
                "additionalProperties": {
                  "$ref": "#/components/schemas/ApprovalRequest/$defs/__schema0"
                }
              }
            ]
          }
        }
      },
      "ApprovalDecision": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "approvalId": { "type": "string", "minLength": 1, "maxLength": 256 },
          "runId": { "type": "string", "minLength": 1, "maxLength": 256 },
          "call": {
            "type": "object",
            "properties": {
              "id": { "type": "string", "minLength": 1, "maxLength": 256 },
              "name": {
                "type": "string",
                "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
              },
              "arguments": {
                "type": "object",
                "propertyNames": { "type": "string" },
                "additionalProperties": {
                  "$ref": "#/components/schemas/ApprovalDecision/$defs/__schema0"
                }
              }
            },
            "required": ["id", "name", "arguments"],
            "additionalProperties": false
          },
          "decision": {
            "type": "string",
            "enum": ["approve", "deny", "cancel"]
          }
        },
        "required": ["approvalId", "runId", "call", "decision"],
        "additionalProperties": false,
        "$defs": {
          "__schema0": {
            "anyOf": [
              { "type": "string" },
              { "type": "number" },
              { "type": "boolean" },
              { "type": "null" },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ApprovalDecision/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": { "type": "string" },
                "additionalProperties": {
                  "$ref": "#/components/schemas/ApprovalDecision/$defs/__schema0"
                }
              }
            ]
          }
        }
      },
      "ApprovalResolution": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "approvalId": { "type": "string", "minLength": 1 },
          "runId": { "type": "string", "minLength": 1 },
          "callId": { "type": "string", "minLength": 1 },
          "outcome": {
            "type": "string",
            "enum": ["approved", "denied", "cancelled", "expired"]
          },
          "decidedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": ["approvalId", "runId", "callId", "outcome", "decidedAt"]
      },
      "IngestRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "corpus": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "document": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "text" },
                  "source": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                      },
                      "revision": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                      },
                      "title": { "type": "string", "maxLength": 256 },
                      "uri": {
                        "type": "string",
                        "maxLength": 2048,
                        "pattern": "^(https|app):\\/\\/[^\\s]+$"
                      },
                      "location": {
                        "type": "object",
                        "properties": {
                          "documentId": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          },
                          "page": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "pageEnd": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "startLine": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "endLine": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "section": { "type": "string", "maxLength": 256 },
                          "threadId": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          },
                          "messageId": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": ["id", "revision"],
                    "additionalProperties": false
                  },
                  "mediaType": {
                    "type": "string",
                    "enum": ["text/plain", "text/markdown"]
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000000
                  }
                },
                "required": ["type", "source", "mediaType", "text"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "pdf" },
                  "source": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                      },
                      "revision": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                      },
                      "title": { "type": "string", "maxLength": 256 },
                      "uri": {
                        "type": "string",
                        "maxLength": 2048,
                        "pattern": "^(https|app):\\/\\/[^\\s]+$"
                      },
                      "location": {
                        "type": "object",
                        "properties": {
                          "documentId": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          },
                          "page": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "pageEnd": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "startLine": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "endLine": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "section": { "type": "string", "maxLength": 256 },
                          "threadId": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          },
                          "messageId": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": ["id", "revision"],
                    "additionalProperties": false
                  },
                  "mediaType": { "type": "string", "const": "application/pdf" },
                  "data": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 44739244
                  }
                },
                "required": ["type", "source", "mediaType", "data"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "reference" },
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "revision": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "mediaType": {
                    "type": "string",
                    "enum": ["text/plain", "text/markdown", "application/pdf"]
                  }
                },
                "required": ["type", "id", "revision", "mediaType"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "const": "email" },
                  "source": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                      },
                      "revision": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                      },
                      "title": { "type": "string", "maxLength": 256 },
                      "uri": {
                        "type": "string",
                        "maxLength": 2048,
                        "pattern": "^(https|app):\\/\\/[^\\s]+$"
                      },
                      "location": {
                        "type": "object",
                        "properties": {
                          "documentId": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          },
                          "page": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "pageEnd": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "startLine": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "endLine": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000
                          },
                          "section": { "type": "string", "maxLength": 256 },
                          "threadId": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          },
                          "messageId": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": ["id", "revision"],
                    "additionalProperties": false
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "messages": {
                    "minItems": 1,
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                        },
                        "text": { "type": "string", "maxLength": 1048576 }
                      },
                      "required": ["id", "text"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["type", "source", "threadId", "messages"],
                "additionalProperties": false
              }
            ]
          },
          "chunking": {
            "type": "object",
            "properties": {
              "maxBytes": {
                "type": "integer",
                "minimum": 128,
                "maximum": 16384
              }
            },
            "required": ["maxBytes"],
            "additionalProperties": false
          },
          "idleTimeoutMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          }
        },
        "required": ["corpus", "document"],
        "additionalProperties": false
      },
      "IngestResult": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "corpus": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "ingestion": {
            "type": "object",
            "properties": {
              "format": {
                "type": "string",
                "enum": ["text", "markdown", "pdf", "email"]
              },
              "inputSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
              "inputBytes": {
                "type": "integer",
                "minimum": 1,
                "maximum": 33554432
              },
              "extractor": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": ["id", "version"],
                "additionalProperties": false
              },
              "ocrExtractor": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": ["id", "version"],
                "additionalProperties": false
              },
              "chunker": {
                "type": "object",
                "properties": {
                  "id": { "type": "string", "const": "source-lines-v1" },
                  "maxBytes": {
                    "type": "integer",
                    "minimum": 128,
                    "maximum": 16384
                  }
                },
                "required": ["id", "maxBytes"],
                "additionalProperties": false
              },
              "extractedTextBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1048576
              },
              "indexedTextBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1048576
              },
              "chunks": { "type": "integer", "minimum": 1, "maximum": 256 },
              "pages": {
                "type": "object",
                "properties": {
                  "total": { "type": "integer", "minimum": 1, "maximum": 1000 },
                  "ocr": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000
                    }
                  },
                  "empty": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000
                    }
                  }
                },
                "required": ["total", "ocr", "empty"],
                "additionalProperties": false
              },
              "messages": {
                "type": "object",
                "properties": {
                  "total": { "type": "integer", "minimum": 1, "maximum": 1000 },
                  "empty": { "type": "integer", "minimum": 0, "maximum": 1000 }
                },
                "required": ["total", "empty"],
                "additionalProperties": false
              }
            },
            "required": [
              "format",
              "inputSha256",
              "inputBytes",
              "extractor",
              "chunker",
              "extractedTextBytes",
              "indexedTextBytes",
              "chunks"
            ],
            "additionalProperties": false
          },
          "sourceId": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "revision": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "documentSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "chunks": { "type": "integer", "minimum": 1, "maximum": 256 },
          "status": { "type": "string", "enum": ["indexed", "unchanged"] }
        },
        "required": [
          "corpus",
          "ingestion",
          "sourceId",
          "revision",
          "documentSha256",
          "chunks",
          "status"
        ],
        "additionalProperties": false
      },
      "IngestionManifest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "format": {
            "type": "string",
            "enum": ["text", "markdown", "pdf", "email"]
          },
          "inputSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "inputBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 33554432
          },
          "extractor": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "version": { "type": "string", "minLength": 1, "maxLength": 128 }
            },
            "required": ["id", "version"],
            "additionalProperties": false
          },
          "ocrExtractor": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "version": { "type": "string", "minLength": 1, "maxLength": 128 }
            },
            "required": ["id", "version"],
            "additionalProperties": false
          },
          "chunker": {
            "type": "object",
            "properties": {
              "id": { "type": "string", "const": "source-lines-v1" },
              "maxBytes": {
                "type": "integer",
                "minimum": 128,
                "maximum": 16384
              }
            },
            "required": ["id", "maxBytes"],
            "additionalProperties": false
          },
          "extractedTextBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1048576
          },
          "indexedTextBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1048576
          },
          "chunks": { "type": "integer", "minimum": 1, "maximum": 256 },
          "pages": {
            "type": "object",
            "properties": {
              "total": { "type": "integer", "minimum": 1, "maximum": 1000 },
              "ocr": {
                "maxItems": 1000,
                "type": "array",
                "items": { "type": "integer", "minimum": 1, "maximum": 1000 }
              },
              "empty": {
                "maxItems": 1000,
                "type": "array",
                "items": { "type": "integer", "minimum": 1, "maximum": 1000 }
              }
            },
            "required": ["total", "ocr", "empty"],
            "additionalProperties": false
          },
          "messages": {
            "type": "object",
            "properties": {
              "total": { "type": "integer", "minimum": 1, "maximum": 1000 },
              "empty": { "type": "integer", "minimum": 0, "maximum": 1000 }
            },
            "required": ["total", "empty"],
            "additionalProperties": false
          }
        },
        "required": [
          "format",
          "inputSha256",
          "inputBytes",
          "extractor",
          "chunker",
          "extractedTextBytes",
          "indexedTextBytes",
          "chunks"
        ],
        "additionalProperties": false
      },
      "RetrievalSearch": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "corpus": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "sourceIds": {
            "minItems": 1,
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
            }
          },
          "query": { "type": "string", "minLength": 1, "maxLength": 16384 },
          "limit": { "type": "integer", "minimum": 1, "maximum": 16 },
          "maxContextBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 262144
          },
          "minScore": { "type": "number", "minimum": -1, "maximum": 1 }
        },
        "required": ["corpus", "query"],
        "additionalProperties": false
      },
      "RetrievalIndexRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "corpus": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "ingestion": {
            "type": "object",
            "properties": {
              "format": {
                "type": "string",
                "enum": ["text", "markdown", "pdf", "email"]
              },
              "inputSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
              "inputBytes": {
                "type": "integer",
                "minimum": 1,
                "maximum": 33554432
              },
              "extractor": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": ["id", "version"],
                "additionalProperties": false
              },
              "ocrExtractor": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": ["id", "version"],
                "additionalProperties": false
              },
              "chunker": {
                "type": "object",
                "properties": {
                  "id": { "type": "string", "const": "source-lines-v1" },
                  "maxBytes": {
                    "type": "integer",
                    "minimum": 128,
                    "maximum": 16384
                  }
                },
                "required": ["id", "maxBytes"],
                "additionalProperties": false
              },
              "extractedTextBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1048576
              },
              "indexedTextBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1048576
              },
              "chunks": { "type": "integer", "minimum": 1, "maximum": 256 },
              "pages": {
                "type": "object",
                "properties": {
                  "total": { "type": "integer", "minimum": 1, "maximum": 1000 },
                  "ocr": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000
                    }
                  },
                  "empty": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000
                    }
                  }
                },
                "required": ["total", "ocr", "empty"],
                "additionalProperties": false
              },
              "messages": {
                "type": "object",
                "properties": {
                  "total": { "type": "integer", "minimum": 1, "maximum": 1000 },
                  "empty": { "type": "integer", "minimum": 0, "maximum": 1000 }
                },
                "required": ["total", "empty"],
                "additionalProperties": false
              }
            },
            "required": [
              "format",
              "inputSha256",
              "inputBytes",
              "extractor",
              "chunker",
              "extractedTextBytes",
              "indexedTextBytes",
              "chunks"
            ],
            "additionalProperties": false
          },
          "source": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "revision": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "title": { "type": "string", "maxLength": 256 },
              "uri": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https|app):\\/\\/[^\\s]+$"
              },
              "location": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "page": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "pageEnd": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "startLine": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "endLine": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "section": { "type": "string", "maxLength": 256 },
                  "threadId": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "messageId": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  }
                },
                "additionalProperties": false
              }
            },
            "required": ["id", "revision"],
            "additionalProperties": false
          },
          "chunks": {
            "minItems": 1,
            "maxItems": 256,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                },
                "text": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 16384
                },
                "location": {
                  "type": "object",
                  "properties": {
                    "documentId": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    },
                    "page": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000000
                    },
                    "pageEnd": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000000
                    },
                    "startLine": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000000
                    },
                    "endLine": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000000
                    },
                    "section": { "type": "string", "maxLength": 256 },
                    "threadId": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    },
                    "messageId": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "required": ["id", "text"],
              "additionalProperties": false
            }
          }
        },
        "required": ["corpus", "source", "chunks"],
        "additionalProperties": false
      },
      "RetrievalDelete": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "corpus": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "sourceId": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "revision": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          }
        },
        "required": ["corpus", "sourceId", "revision"],
        "additionalProperties": false
      },
      "RetrievalResult": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "corpus": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "index": {
            "type": "object",
            "properties": {
              "providerId": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "vendor": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "accountId": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "authMode": { "type": "string", "enum": ["api-key", "none"] },
              "model": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
              },
              "dimensions": {
                "type": "integer",
                "minimum": 1,
                "maximum": 4096
              },
              "metric": { "type": "string", "const": "cosine" },
              "version": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              }
            },
            "required": [
              "providerId",
              "vendor",
              "accountId",
              "authMode",
              "model",
              "dimensions",
              "metric",
              "version"
            ],
            "additionalProperties": false
          },
          "hits": {
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "chunkId": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                },
                "ingestion": {
                  "type": "object",
                  "properties": {
                    "format": {
                      "type": "string",
                      "enum": ["text", "markdown", "pdf", "email"]
                    },
                    "inputSha256": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "inputBytes": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 33554432
                    },
                    "extractor": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                        },
                        "version": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      },
                      "required": ["id", "version"],
                      "additionalProperties": false
                    },
                    "ocrExtractor": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                        },
                        "version": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      },
                      "required": ["id", "version"],
                      "additionalProperties": false
                    },
                    "chunker": {
                      "type": "object",
                      "properties": {
                        "id": { "type": "string", "const": "source-lines-v1" },
                        "maxBytes": {
                          "type": "integer",
                          "minimum": 128,
                          "maximum": 16384
                        }
                      },
                      "required": ["id", "maxBytes"],
                      "additionalProperties": false
                    },
                    "extractedTextBytes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1048576
                    },
                    "indexedTextBytes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1048576
                    },
                    "chunks": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 256
                    },
                    "pages": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        },
                        "ocr": {
                          "maxItems": 1000,
                          "type": "array",
                          "items": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000
                          }
                        },
                        "empty": {
                          "maxItems": 1000,
                          "type": "array",
                          "items": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000
                          }
                        }
                      },
                      "required": ["total", "ocr", "empty"],
                      "additionalProperties": false
                    },
                    "messages": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        },
                        "empty": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000
                        }
                      },
                      "required": ["total", "empty"],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "format",
                    "inputSha256",
                    "inputBytes",
                    "extractor",
                    "chunker",
                    "extractedTextBytes",
                    "indexedTextBytes",
                    "chunks"
                  ],
                  "additionalProperties": false
                },
                "source": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    },
                    "revision": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    },
                    "title": { "type": "string", "maxLength": 256 },
                    "uri": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https|app):\\/\\/[^\\s]+$"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "documentId": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "pageEnd": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "startLine": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "endLine": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "section": { "type": "string", "maxLength": 256 },
                        "threadId": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                        },
                        "messageId": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "required": ["id", "revision"],
                  "additionalProperties": false
                },
                "text": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 16384
                },
                "score": { "type": "number", "minimum": -1, "maximum": 1 },
                "documentSha256": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                }
              },
              "required": [
                "chunkId",
                "source",
                "text",
                "score",
                "documentSha256"
              ],
              "additionalProperties": false
            }
          },
          "truncated": { "type": "boolean" }
        },
        "required": ["corpus", "index", "hits", "truncated"],
        "additionalProperties": false
      },
      "RetrievalIndexResult": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "corpus": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "ingestion": {
            "type": "object",
            "properties": {
              "format": {
                "type": "string",
                "enum": ["text", "markdown", "pdf", "email"]
              },
              "inputSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
              "inputBytes": {
                "type": "integer",
                "minimum": 1,
                "maximum": 33554432
              },
              "extractor": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": ["id", "version"],
                "additionalProperties": false
              },
              "ocrExtractor": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                  },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": ["id", "version"],
                "additionalProperties": false
              },
              "chunker": {
                "type": "object",
                "properties": {
                  "id": { "type": "string", "const": "source-lines-v1" },
                  "maxBytes": {
                    "type": "integer",
                    "minimum": 128,
                    "maximum": 16384
                  }
                },
                "required": ["id", "maxBytes"],
                "additionalProperties": false
              },
              "extractedTextBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1048576
              },
              "indexedTextBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1048576
              },
              "chunks": { "type": "integer", "minimum": 1, "maximum": 256 },
              "pages": {
                "type": "object",
                "properties": {
                  "total": { "type": "integer", "minimum": 1, "maximum": 1000 },
                  "ocr": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000
                    }
                  },
                  "empty": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000
                    }
                  }
                },
                "required": ["total", "ocr", "empty"],
                "additionalProperties": false
              },
              "messages": {
                "type": "object",
                "properties": {
                  "total": { "type": "integer", "minimum": 1, "maximum": 1000 },
                  "empty": { "type": "integer", "minimum": 0, "maximum": 1000 }
                },
                "required": ["total", "empty"],
                "additionalProperties": false
              }
            },
            "required": [
              "format",
              "inputSha256",
              "inputBytes",
              "extractor",
              "chunker",
              "extractedTextBytes",
              "indexedTextBytes",
              "chunks"
            ],
            "additionalProperties": false
          },
          "sourceId": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "revision": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "documentSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "chunks": { "type": "integer", "minimum": 1, "maximum": 256 },
          "status": { "type": "string", "enum": ["indexed", "unchanged"] }
        },
        "required": [
          "corpus",
          "sourceId",
          "revision",
          "documentSha256",
          "chunks",
          "status"
        ],
        "additionalProperties": false
      },
      "RetrievalDeleteResult": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "corpus": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "sourceId": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "revision": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "deleted": { "type": "boolean" }
        },
        "required": ["corpus", "sourceId", "revision", "deleted"],
        "additionalProperties": false
      },
      "ProviderConnectionDetails": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "enum": ["native-runtime", "provider-api"]
          },
          "runtime": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100,
                "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
              }
            },
            "required": ["name", "version"]
          },
          "account": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["signed-in", "signed-out", "unknown"]
              },
              "method": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
              },
              "email": {
                "type": "string",
                "minLength": 1,
                "maxLength": 320,
                "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
              },
              "subscription": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120,
                "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
              }
            },
            "required": ["status"]
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": ["source", "checkedAt"]
      },
      "ProviderHealth": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "unauthenticated",
              "unavailable",
              "unsupported",
              "unknown"
            ]
          },
          "code": { "type": "string", "minLength": 1 },
          "message": { "type": "string" },
          "checkedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": ["status", "code", "message", "checkedAt"]
      },
      "ModelCatalog": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "enum": ["provider", "configured", "unavailable"]
          },
          "models": {
            "maxItems": 1000,
            "type": "array",
            "items": { "type": "string" }
          },
          "complete": { "type": "boolean" }
        },
        "required": ["source", "models", "complete"]
      },
      "RunRequest": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"
          },
          "model": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/\\[\\]-]{0,199}$"
          },
          "input": { "type": "string", "minLength": 1, "maxLength": 100000 },
          "attachments": {
            "maxItems": 16,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": { "type": "string", "const": "text" },
                        "source": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                            },
                            "revision": {
                              "type": "string",
                              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                            },
                            "title": { "type": "string", "maxLength": 256 },
                            "uri": {
                              "type": "string",
                              "maxLength": 2048,
                              "pattern": "^(https|app):\\/\\/[^\\s]+$"
                            },
                            "location": {
                              "type": "object",
                              "properties": {
                                "documentId": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "page": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "pageEnd": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "startLine": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "endLine": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "section": {
                                  "type": "string",
                                  "maxLength": 256
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "messageId": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "required": ["id", "revision"],
                          "additionalProperties": false
                        },
                        "mediaType": {
                          "type": "string",
                          "enum": ["text/plain", "text/markdown"]
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000000
                        }
                      },
                      "required": ["type", "source", "mediaType", "text"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": { "type": "string", "const": "image" },
                        "source": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                            },
                            "revision": {
                              "type": "string",
                              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                            },
                            "title": { "type": "string", "maxLength": 256 },
                            "uri": {
                              "type": "string",
                              "maxLength": 2048,
                              "pattern": "^(https|app):\\/\\/[^\\s]+$"
                            },
                            "location": {
                              "type": "object",
                              "properties": {
                                "documentId": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "page": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "pageEnd": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "startLine": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "endLine": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "section": {
                                  "type": "string",
                                  "maxLength": 256
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "messageId": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "required": ["id", "revision"],
                          "additionalProperties": false
                        },
                        "mediaType": {
                          "type": "string",
                          "enum": ["image/png", "image/jpeg", "image/webp"]
                        },
                        "data": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 44739244
                        }
                      },
                      "required": ["type", "source", "mediaType", "data"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": { "type": "string", "const": "pdf" },
                        "source": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                            },
                            "revision": {
                              "type": "string",
                              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                            },
                            "title": { "type": "string", "maxLength": 256 },
                            "uri": {
                              "type": "string",
                              "maxLength": 2048,
                              "pattern": "^(https|app):\\/\\/[^\\s]+$"
                            },
                            "location": {
                              "type": "object",
                              "properties": {
                                "documentId": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "page": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "pageEnd": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "startLine": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "endLine": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "section": {
                                  "type": "string",
                                  "maxLength": 256
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                },
                                "messageId": {
                                  "type": "string",
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "required": ["id", "revision"],
                          "additionalProperties": false
                        },
                        "mediaType": {
                          "type": "string",
                          "const": "application/pdf"
                        },
                        "data": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 44739244
                        }
                      },
                      "required": ["type", "source", "mediaType", "data"],
                      "additionalProperties": false
                    }
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": { "type": "string", "const": "reference" },
                    "id": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    },
                    "revision": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                    },
                    "mediaType": {
                      "type": "string",
                      "enum": [
                        "text/plain",
                        "text/markdown",
                        "image/png",
                        "image/jpeg",
                        "image/webp",
                        "application/pdf"
                      ]
                    }
                  },
                  "required": ["type", "id", "revision", "mediaType"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "retrieval": {
            "type": "object",
            "properties": {
              "corpus": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "sourceIds": {
                "minItems": 1,
                "maxItems": 1000,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
                }
              },
              "query": { "type": "string", "minLength": 1, "maxLength": 16384 },
              "limit": { "type": "integer", "minimum": 1, "maximum": 16 },
              "maxContextBytes": {
                "type": "integer",
                "minimum": 1,
                "maximum": 262144
              },
              "minScore": { "type": "number", "minimum": -1, "maximum": 1 }
            },
            "required": ["corpus"],
            "additionalProperties": false
          },
          "outputArtifact": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[^/\\\\\\u0000-\\u001f]+$"
              },
              "mediaType": {
                "type": "string",
                "enum": ["text/plain", "text/markdown", "application/json"]
              }
            },
            "required": ["name", "mediaType"],
            "additionalProperties": false
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "retry": {
            "type": "object",
            "properties": {
              "maxAttempts": { "type": "integer", "minimum": 1, "maximum": 5 },
              "baseDelayMs": {
                "type": "integer",
                "minimum": 0,
                "maximum": 60000
              },
              "maxDelayMs": {
                "type": "integer",
                "minimum": 0,
                "maximum": 60000
              }
            },
            "required": ["maxAttempts"],
            "additionalProperties": false
          },
          "instructions": { "type": "string", "maxLength": 100000 },
          "history": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": { "type": "string", "enum": ["user", "assistant"] },
                "content": { "type": "string", "maxLength": 100000 }
              },
              "required": ["role", "content"],
              "additionalProperties": false
            }
          },
          "session": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
              },
              "revision": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": ["id", "revision"],
            "additionalProperties": false
          },
          "approvals": {
            "type": "object",
            "properties": {
              "mode": { "type": "string", "const": "interactive" },
              "idlePolicy": { "type": "string", "enum": ["pause", "continue"] },
              "expiresAfterMs": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2147483647
              }
            },
            "required": ["mode", "idlePolicy"],
            "additionalProperties": false
          },
          "applicationTools": {
            "minItems": 1,
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
                },
                "description": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 10000
                },
                "inputSchema": {
                  "type": "object",
                  "propertyNames": { "type": "string" },
                  "additionalProperties": {}
                },
                "outputSchema": {
                  "type": "object",
                  "propertyNames": { "type": "string" },
                  "additionalProperties": {}
                },
                "requiresApproval": { "type": "boolean" }
              },
              "required": ["name", "description", "inputSchema"],
              "additionalProperties": false
            }
          },
          "tools": {
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$"
            }
          },
          "requiredCapabilities": {
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z][a-zA-Z0-9._-]{0,79}$"
            }
          },
          "maxSteps": { "type": "integer", "minimum": 1, "maximum": 64 },
          "maxOutputTokens": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65536
          },
          "idleTimeoutMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "outputSchema": {
            "type": "object",
            "propertyNames": { "type": "string" },
            "additionalProperties": {}
          },
          "metadata": {
            "type": "object",
            "propertyNames": { "type": "string", "maxLength": 80 },
            "additionalProperties": { "type": "string", "maxLength": 500 }
          }
        },
        "required": ["provider", "model", "input"],
        "additionalProperties": false
      },
      "ContextManifest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "revision": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
          },
          "title": { "type": "string", "maxLength": 256 },
          "uri": {
            "type": "string",
            "maxLength": 2048,
            "pattern": "^(https|app):\\/\\/[^\\s]+$"
          },
          "location": {
            "type": "object",
            "properties": {
              "documentId": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "page": { "type": "integer", "minimum": 1, "maximum": 1000000 },
              "pageEnd": {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000000
              },
              "startLine": {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000000
              },
              "endLine": {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000000
              },
              "section": { "type": "string", "maxLength": 256 },
              "threadId": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              },
              "messageId": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
              }
            },
            "additionalProperties": false
          },
          "mediaType": {
            "type": "string",
            "enum": [
              "text/plain",
              "text/markdown",
              "image/png",
              "image/jpeg",
              "image/webp",
              "application/pdf"
            ]
          },
          "bytes": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 33554432
          },
          "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "origin": {
            "type": "string",
            "enum": ["inline", "reference", "retrieval"]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "id",
          "revision",
          "mediaType",
          "bytes",
          "sha256",
          "origin"
        ],
        "additionalProperties": false
      },
      "DraftArtifact": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[^/\\\\\\u0000-\\u001f]+$"
          },
          "mediaType": {
            "type": "string",
            "enum": ["text/plain", "text/markdown", "application/json"]
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "status": { "type": "string", "const": "draft" },
          "content": { "type": "string", "maxLength": 262144 },
          "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "sourceIds": {
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
            }
          }
        },
        "required": [
          "name",
          "mediaType",
          "id",
          "status",
          "content",
          "sha256",
          "sourceIds"
        ],
        "additionalProperties": false
      },
      "ProtocolInfo": {
        "type": "object",
        "required": ["protocol", "version", "supportedVersions", "features"],
        "properties": {
          "protocol": { "const": "agenticdriver" },
          "version": { "type": "string" },
          "supportedVersions": {
            "type": "array",
            "items": { "type": "string" }
          },
          "features": { "type": "array", "items": { "type": "string" } }
        }
      },
      "Usage": {
        "type": "object",
        "properties": {
          "inputTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "outputTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "cachedInputTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reasoningTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "costUsd": { "type": "number", "minimum": 0 },
          "apiEquivalentCostUsd": {
            "type": "number",
            "minimum": 0,
            "description": "Reported API-equivalent estimate; never subscription spend or an invoice charge."
          }
        },
        "description": "Measurements are omitted when unknown. Cached input is a subset of input tokens. Totals are omitted if any model step lacks that measurement."
      },
      "RunResult": {
        "type": "object",
        "required": [
          "runId",
          "provider",
          "model",
          "text",
          "usage",
          "steps",
          "finishReason"
        ],
        "properties": {
          "session": { "$ref": "#/components/schemas/SessionInfo" },
          "runId": { "type": "string" },
          "provider": { "type": "string" },
          "model": { "type": "string" },
          "text": { "type": "string" },
          "output": {},
          "sources": {
            "type": "array",
            "maxItems": 16,
            "items": { "$ref": "#/components/schemas/ContextManifest" }
          },
          "artifacts": {
            "type": "array",
            "maxItems": 1,
            "items": { "$ref": "#/components/schemas/DraftArtifact" }
          },
          "retrieval": { "$ref": "#/components/schemas/RetrievalResult" },
          "usage": { "$ref": "#/components/schemas/Usage" },
          "steps": { "type": "integer", "minimum": 1 },
          "finishReason": { "enum": ["stop", "length"] }
        }
      },
      "Error": {
        "type": "object",
        "required": ["error"],
        "properties": { "error": { "$ref": "#/components/schemas/ErrorInfo" } }
      },
      "ErrorInfo": {
        "type": "object",
        "required": ["code", "message", "retryable"],
        "properties": {
          "code": { "type": "string", "minLength": 1 },
          "message": { "type": "string" },
          "retryable": { "type": "boolean" },
          "outcome": {
            "const": "uncertain",
            "description": "Effects may have occurred; reconcile them before any replacement operation."
          }
        },
        "description": "Stable code, displayable message and retryability hint. Clients preserve unknown codes; retryable never authorizes automatic replay of tool effects."
      },
      "Provider": {
        "type": "object",
        "required": ["id", "name", "vendor", "authMode", "capabilities"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "vendor": { "type": "string" },
          "authMode": { "enum": ["api-key", "cli-session", "none"] },
          "models": { "type": "array", "items": { "type": "string" } },
          "usageStatId": { "type": "string" },
          "inputMediaTypes": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "maxItems": 6,
              "items": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "string",
                "enum": [
                  "text/plain",
                  "text/markdown",
                  "image/png",
                  "image/jpeg",
                  "image/webp",
                  "application/pdf"
                ]
              }
            }
          },
          "health": { "$ref": "#/components/schemas/ProviderHealth" },
          "connection": {
            "$ref": "#/components/schemas/ProviderConnectionDetails"
          },
          "modelCatalog": { "$ref": "#/components/schemas/ModelCatalog" },
          "capabilities": {
            "type": "object",
            "required": ["tools", "textStreaming"],
            "properties": {
              "tools": { "type": "boolean" },
              "textStreaming": { "type": "boolean" }
            },
            "additionalProperties": { "type": "boolean" }
          }
        }
      },
      "RunEvent": {
        "type": "object",
        "required": ["type", "runId", "sequence", "timestamp"],
        "properties": {
          "type": { "type": "string" },
          "runId": { "type": "string" },
          "sequence": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "timestamp": { "type": "string", "format": "date-time" },
          "optional": {
            "type": "boolean",
            "description": "An unknown type may be skipped only when optional is explicitly true; its envelope and sequence must still be validated."
          }
        },
        "oneOf": [
          {
            "properties": {
              "type": { "const": "tool.execution.requested" },
              "execution": {
                "$ref": "#/components/schemas/ToolExecutionRequest"
              }
            },
            "required": ["execution"]
          },
          {
            "properties": {
              "type": { "const": "approval.requested" },
              "approval": { "$ref": "#/components/schemas/ApprovalRequest" }
            },
            "required": ["approval"]
          },
          {
            "properties": {
              "type": { "const": "approval.resolved" },
              "resolution": {
                "$ref": "#/components/schemas/ApprovalResolution"
              }
            },
            "required": ["resolution"]
          },
          {
            "properties": {
              "type": { "const": "run.started" },
              "provider": { "type": "string" },
              "model": { "type": "string" }
            },
            "required": ["provider", "model"]
          },
          {
            "properties": {
              "type": { "const": "step.started" },
              "step": { "type": "integer", "minimum": 1 }
            },
            "required": ["step"]
          },
          {
            "properties": {
              "type": { "const": "text.delta" },
              "text": { "type": "string" }
            },
            "required": ["text"]
          },
          {
            "properties": {
              "type": { "const": "run.progress" },
              "phase": { "enum": ["model", "tool", "context"] }
            },
            "required": ["phase"]
          },
          {
            "properties": {
              "type": { "const": "tool.called" },
              "call": {
                "type": "object",
                "required": ["id", "name", "arguments"],
                "properties": {
                  "id": { "type": "string" },
                  "name": { "type": "string" },
                  "arguments": { "type": "object" }
                }
              }
            },
            "required": ["call"]
          },
          {
            "properties": {
              "type": { "const": "tool.completed" },
              "callId": { "type": "string" },
              "output": {}
            },
            "required": ["callId", "output"]
          },
          {
            "properties": {
              "type": { "const": "usage.reported" },
              "step": { "type": "integer", "minimum": 1 },
              "usage": { "$ref": "#/components/schemas/Usage" }
            },
            "required": ["step", "usage"]
          },
          {
            "properties": {
              "type": { "const": "run.completed" },
              "result": { "$ref": "#/components/schemas/RunResult" }
            },
            "required": ["result"]
          },
          {
            "properties": {
              "type": { "enum": ["run.failed", "run.cancelled"] },
              "error": { "$ref": "#/components/schemas/ErrorInfo" }
            },
            "required": ["error"]
          },
          {
            "properties": {
              "type": {
                "type": "string",
                "minLength": 1,
                "not": {
                  "enum": [
                    "run.started",
                    "step.started",
                    "text.delta",
                    "run.progress",
                    "approval.requested",
                    "approval.resolved",
                    "tool.execution.requested",
                    "tool.called",
                    "tool.completed",
                    "usage.reported",
                    "run.completed",
                    "run.failed",
                    "run.cancelled"
                  ]
                }
              },
              "optional": { "const": true }
            },
            "required": ["optional"],
            "description": "Advisory extension. Hosts send new event types only to clients that explicitly accept optional events. They cannot carry required state transitions or actions."
          }
        ]
      }
    }
  }
}
