{
  "openapi": "3.1.0",
  "info": {
    "title": "SparkTide Platform V1",
    "version": "1.0.0",
    "description": "应用隔离、Registry、运行、管理控制台、托管知识、身份与归档。默认单活，可选 PostgreSQL 多实例协调；契约边界见中文产品文档。"
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/v1/apps": {
      "post": {
        "operationId": "operation1",
        "summary": "Create application (platform admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Application"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApplication"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "operation2",
        "summary": "List visible applications",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Application"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}": {
      "get": {
        "operationId": "operation3",
        "summary": "Read application",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Application"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateApplication",
        "summary": "更新应用名称和运行状态",
        "tags": [
          "Applications"
        ],
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "ACTIVE",
                      "SUSPENDED",
                      "ARCHIVED"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 512
                  },
                  "permissionProvider": {
                    "$ref": "#/components/schemas/BusinessProvider"
                  },
                  "contextProvider": {
                    "$ref": "#/components/schemas/ContextProvider"
                  },
                  "evaluationGate": {
                    "$ref": "#/components/schemas/EvaluationGate"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "更新后的应用，归档不物理删除数据",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Application"
                }
              }
            }
          },
          "400": {
            "description": "无效状态或默认入口",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "需要应用管理权限",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/tokens": {
      "post": {
        "operationId": "operation4",
        "summary": "Issue credential (platform admin)",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Token"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateToken"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "operation5",
        "summary": "List credential metadata (platform admin)",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Token"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/tokens/{tokenId}": {
      "delete": {
        "operationId": "operation6",
        "summary": "Revoke credential",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tokenId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Token"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/default-agent": {
      "put": {
        "operationId": "operation7",
        "summary": "Activate immutable default version",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Application"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DefaultAgent"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/{kind}": {
      "get": {
        "operationId": "operation8",
        "summary": "List registry versions (application admin)",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Registry"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "operation9",
        "summary": "Save registry draft (application admin)",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Registration"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/{kind}/{resourceId}/versions/{version}": {
      "get": {
        "operationId": "operation10",
        "summary": "Read version",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "operation11",
        "summary": "Update draft definition",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Definition"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/{kind}/{resourceId}/versions/{version}/publish": {
      "post": {
        "operationId": "operation12",
        "summary": "publish version",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/{kind}/{resourceId}/versions/{version}/revoke": {
      "post": {
        "operationId": "operation13",
        "summary": "revoke version",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/model-providers": {
      "get": {
        "operationId": "operation14",
        "summary": "List global registry (platform admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Registry"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "operation15",
        "summary": "Save global draft (platform admin)",
        "parameters": [
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Registration"
              }
            }
          }
        }
      }
    },
    "/v1/model-providers/{resourceId}/versions/{version}/publish": {
      "post": {
        "operationId": "operation16",
        "summary": "publish global version",
        "parameters": [
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/model-providers/{resourceId}/versions/{version}/revoke": {
      "post": {
        "operationId": "operation17",
        "summary": "revoke global version",
        "parameters": [
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "operation18",
        "summary": "List global registry (platform admin)",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Registry"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "operation19",
        "summary": "Save global draft (platform admin)",
        "parameters": [
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Registration"
              }
            }
          }
        }
      }
    },
    "/v1/models/{resourceId}/versions/{version}/publish": {
      "post": {
        "operationId": "operation20",
        "summary": "publish global version",
        "parameters": [
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/models/{resourceId}/versions/{version}/revoke": {
      "post": {
        "operationId": "operation21",
        "summary": "revoke global version",
        "parameters": [
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registry"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/chat": {
      "post": {
        "operationId": "operation22",
        "summary": "Create run; JSON 202 or SSE 200 selected by Accept",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE frames, id=runId:sequence. Disconnect does not cancel.",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/runs/{runId}": {
      "get": {
        "operationId": "operation23",
        "summary": "Read own run",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/runs/{runId}/events": {
      "get": {
        "operationId": "operation24",
        "summary": "Replay after cursor (same owner)",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Last-Event-ID",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgentEvent"
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/runs/{runId}/cancel": {
      "post": {
        "operationId": "operation25",
        "summary": "Idempotently cancel run",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/runs/{runId}/confirm": {
      "post": {
        "operationId": "operation26",
        "summary": "Approve or reject stored operation",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Confirmation"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Confirmation"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/conversations/{conversationId}": {
      "get": {
        "operationId": "operation27",
        "summary": "Read own conversation",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "conversationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "renameConversation",
        "summary": "重命名自己的会话（会话所有者）",
        "description": "仅接受 title；重命名不改消息、权限来源与运行历史。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "conversationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConversationRename"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationRename"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteConversation",
        "summary": "删除自己的会话（会话所有者）",
        "description": "存在活动 Run 时拒绝；仅删除会话正文，Run、事件、审计与幂等证据保留，历史 Run 仍可按所有者读取。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "conversationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationDeletion"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/audit": {
      "get": {
        "operationId": "operation28",
        "summary": "Last 200 control actions (application admin)",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/metrics": {
      "get": {
        "operationId": "operation29",
        "summary": "Run status counters (application admin)",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "runCount",
                    "byStatus",
                    "configuredCost",
                    "unknownCostRuns"
                  ],
                  "properties": {
                    "runCount": {
                      "type": "integer"
                    },
                    "byStatus": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "integer"
                      }
                    },
                    "configuredCost": {
                      "type": "object",
                      "description": "按币种累计的配置价目金额，不代表厂商结算",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "unknownCostRuns": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/openapi": {
      "get": {
        "operationId": "operation30",
        "summary": "Machine-readable API contract",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/schemas/agent-event": {
      "get": {
        "operationId": "operation31",
        "summary": "AgentEvent JSON Schema",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "currentIdentity",
        "summary": "currentIdentity",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "appId": {
                      "type": "string"
                    },
                    "subjectId": {
                      "type": "string"
                    },
                    "tenantId": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "appId",
                    "subjectId",
                    "tenantId",
                    "role"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/runs": {
      "get": {
        "operationId": "listOwnedRuns",
        "summary": "listOwnedRuns",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Run"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/activity/runs": {
      "get": {
        "operationId": "listApplicationActivity",
        "summary": "listApplicationActivity",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Run"
                      }
                    },
                    "nextOffset": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "nextOffset"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{resourceId}/versions/{version}/documents": {
      "post": {
        "operationId": "ingestManagedDocument",
        "summary": "ingestManagedDocument",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedDocumentResult"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedDocumentImport"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listManagedDocuments",
        "summary": "listManagedDocuments",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ManagedDocumentSummary"
                  },
                  "maxItems": 1000
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{resourceId}/versions/{version}/documents/{documentId}": {
      "delete": {
        "operationId": "deleteDraftDocument",
        "summary": "deleteDraftDocument",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/maintenance/archive": {
      "post": {
        "operationId": "archiveExpiredRuns",
        "summary": "archiveExpiredRuns (platform admin)",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dryRun": {
                    "type": "boolean",
                    "default": true
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 100
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/maintenance/archive/{runId}": {
      "get": {
        "operationId": "exportArchivedRun",
        "summary": "exportArchivedRun (platform admin)",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "encoding": {
                      "const": "gzip-base64"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "redacted": {
                      "type": "boolean"
                    },
                    "redactionRevision": {
                      "type": "integer"
                    },
                    "originalSha256": {
                      "type": "string"
                    },
                    "exportedSha256": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/leases": {
      "post": {
        "operationId": "renewCapabilityLease",
        "summary": "应用管理员续租远程能力实例",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "enum": [
                      "tools",
                      "knowledge",
                      "model-providers"
                    ]
                  },
                  "id": {
                    "type": "string"
                  },
                  "version": {
                    "type": "string"
                  },
                  "instanceId": {
                    "type": "string"
                  },
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 10,
                    "maximum": 300
                  }
                },
                "required": [
                  "kind",
                  "id",
                  "version",
                  "instanceId",
                  "ttlSeconds"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Renewed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "instanceId": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "integer",
                      "format": "int64"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leases": {
      "post": {
        "operationId": "globalCapabilityHeartbeat",
        "summary": "续租公共模型供应商能力（平台管理员）",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "const": "model-providers"
                  },
                  "id": {
                    "type": "string"
                  },
                  "version": {
                    "type": "string"
                  },
                  "instanceId": {
                    "type": "string"
                  },
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 10,
                    "maximum": 300
                  }
                },
                "required": [
                  "kind",
                  "id",
                  "version",
                  "instanceId",
                  "ttlSeconds"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Renewed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "instanceId": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "integer",
                      "format": "int64"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/runs/{runId}/tool-executions": {
      "get": {
        "operationId": "runToolExecutions",
        "summary": "查询工具执行账本",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "任务所有者或本应用管理员可查询；不会重新执行业务操作",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ToolExecution"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/tool-executions/{executionId}/reconcile": {
      "post": {
        "operationId": "reconcileToolExecution",
        "summary": "核对未知工具结果",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "executionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "enum": [
                      "SUCCEEDED",
                      "FAILED"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "evidence": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  }
                },
                "required": [
                  "status",
                  "reason",
                  "evidence"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "管理员核对记录；不重新发送回调，不修改 Run 终态",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolExecution"
                }
              }
            }
          },
          "403": {
            "description": "需要应用管理权限",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "任务未结束或结果不是 UNKNOWN",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/documents/{documentId}/access": {
      "get": {
        "operationId": "readDocumentAccess",
        "summary": "Read document access policy (application manager)",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document access policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentAccess"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateDocumentAccess",
        "summary": "Update cross-version document access and invalidate previous conversations",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "subjects": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "maxItems": 256,
                    "uniqueItems": true
                  },
                  "tenants": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "maxItems": 256,
                    "uniqueItems": true
                  },
                  "roles": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "USER",
                        "APP_ADMIN"
                      ]
                    },
                    "maxItems": 256,
                    "uniqueItems": true
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  }
                },
                "required": [
                  "enabled",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document access policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentAccess"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/agent-entries/{agentId}": {
      "get": {
        "operationId": "resolveAgentEntry",
        "summary": "解析用户可见聊天入口的精确版本；默认入口保持绑定版本，其他入口取最新已发布版本",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "可用入口",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ref"
                }
              }
            }
          },
          "400": {
            "description": "结构化错误",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "结构化错误",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "结构化错误",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "结构化错误",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "结构化错误",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/release-plans": {
      "post": {
        "operationId": "previewRelease",
        "summary": "previewRelease",
        "description": "应用管理身份；跨应用访问拒绝。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleasePlan"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReleaseRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/releases": {
      "post": {
        "operationId": "publishRelease",
        "summary": "publishRelease",
        "description": "应用管理身份；跨应用访问拒绝。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "预检返回的应用修订，带双引号。"
            }
          },
          {
            "name": "X-Release-Plan",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.:-]{1,128}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseRecord"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReleaseRequest"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listReleases",
        "summary": "listReleases",
        "description": "应用管理身份；跨应用访问拒绝。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleasePage"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/releases/{releaseId}": {
      "get": {
        "operationId": "getRelease",
        "summary": "getRelease",
        "description": "应用管理身份；跨应用访问拒绝。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "releaseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseRecord"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/model-compatibility": {
      "post": {
        "operationId": "checkModelCompatibility",
        "summary": "检查精确 Agent 版本的模型兼容性（管理身份、只读）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Ref"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "兼容性报告，valid=false 仍返回 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelCompatibilityReport"
                }
              }
            }
          },
          "default": {
            "description": "鉴权、缺失依赖或无效请求错误",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/runs/{runId}/model-invocations": {
      "get": {
        "operationId": "listModelInvocations",
        "tags": [
          "模型调用账本"
        ],
        "summary": "分页查询模型调用账本和独立计量汇总",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelInvocationPage"
                }
              }
            }
          },
          "400": {
            "description": "字段或分页非法",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "无管理权限或历史权限失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在或不属于当前身份",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "任务尚未终结或调用未发送",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/model-invocations/{invocationId}": {
      "get": {
        "operationId": "getModelInvocation",
        "tags": [
          "模型调用账本"
        ],
        "summary": "查询模型调用明细与核对历史",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invocationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelInvocation"
                }
              }
            }
          },
          "400": {
            "description": "字段或分页非法",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "无管理权限或历史权限失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在或不属于当前身份",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "任务尚未终结或调用未发送",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/model-invocations/{invocationId}/reconcile": {
      "post": {
        "operationId": "reconcileModelInvocation",
        "tags": [
          "模型调用账本"
        ],
        "summary": "登记供应商用量和账单证据，不重放调用",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invocationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "当前修订，允许双引号包裹；PUT /quotas 为配额配置修订，reconcile 为预留修订。"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelInvocation"
                }
              }
            }
          },
          "400": {
            "description": "字段或分页非法",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "无管理权限或历史权限失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在或不属于当前身份",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "任务尚未终结或调用未发送",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelReconciliationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/model-bindings/{resourceId}/versions/{version}/health": {
      "get": {
        "operationId": "getModelHealth",
        "tags": [
          "模型健康"
        ],
        "summary": "读取模型连接健康、熔断与探测依据",
        "description": "仅管理身份，应用和固定绑定作用域；探测可能计费，受预算、间隔、租约和并发限制。健康和探测证据不改变已发布能力声明。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelHealthState"
                }
              }
            }
          },
          "400": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/model-bindings/{resourceId}/versions/{version}/probes": {
      "get": {
        "operationId": "listModelProbes",
        "tags": [
          "模型健康"
        ],
        "summary": "分页查询固定版本模型探测记录",
        "description": "仅管理身份，应用和固定绑定作用域；探测可能计费，受预算、间隔、租约和并发限制。健康和探测证据不改变已发布能力声明。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelProbePage"
                }
              }
            }
          },
          "400": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "probeModelHealth",
        "tags": [
          "模型健康"
        ],
        "summary": "进行受限合成模型能力探测",
        "description": "仅管理身份，应用和固定绑定作用域；探测可能计费，受预算、间隔、租约和并发限制。健康和探测证据不改变已发布能力声明。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelProbeResult"
                }
              }
            }
          },
          "400": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelProbeRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/model-bindings/{resourceId}/versions/{version}/health/reset": {
      "post": {
        "operationId": "resetModelHealth",
        "tags": [
          "模型健康"
        ],
        "summary": "请求恢复探测，不强制标为健康",
        "description": "仅管理身份，应用和固定绑定作用域；探测可能计费，受预算、间隔、租约和并发限制。健康和探测证据不改变已发布能力声明。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "当前健康 revision，不是 Registry revision。"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelHealthState"
                }
              }
            }
          },
          "400": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "权限、状态、修订、探测并发或预算冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelHealthResetRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/quotas": {
      "get": {
        "operationId": "getQuotaPolicies",
        "summary": "应用配额管理（管理身份）",
        "description": "需要应用管理员或平台管理员；写操作须 If-Match 当前 revision，记录原因与审计。预留在模型发送前与 SENT 原子登记。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuotaConfiguration"
                }
              }
            }
          },
          "400": {
            "description": "字段或分页非法",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "无管理权限或历史权限失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在或不属于当前身份",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "任务尚未终结或调用未发送",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "configureQuotaPolicies",
        "summary": "应用配额管理（管理身份）",
        "description": "需要应用管理员或平台管理员；写操作须 If-Match 当前 revision，记录原因与审计。预留在模型发送前与 SENT 原子登记。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "当前修订，允许双引号包裹；PUT /quotas 为配额配置修订，reconcile 为预留修订。"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuotaConfiguration"
                }
              }
            }
          },
          "400": {
            "description": "字段或分页非法",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "无管理权限或历史权限失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在或不属于当前身份",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "任务尚未终结或调用未发送",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuotaConfigurationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/quotas/usage": {
      "get": {
        "operationId": "listQuotaUsage",
        "summary": "应用配额管理（管理身份）",
        "description": "需要应用管理员或平台管理员；写操作须 If-Match 当前 revision，记录原因与审计。预留在模型发送前与 SENT 原子登记。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuotaUsagePage"
                }
              }
            }
          },
          "400": {
            "description": "字段或分页非法",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "无管理权限或历史权限失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在或不属于当前身份",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "任务尚未终结或调用未发送",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/quota-reservations": {
      "get": {
        "operationId": "listQuotaReservations",
        "summary": "应用配额管理（管理身份）",
        "description": "需要应用管理员或平台管理员；写操作须 If-Match 当前 revision，记录原因与审计。预留在模型发送前与 SENT 原子登记。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuotaReservationPage"
                }
              }
            }
          },
          "400": {
            "description": "字段或分页非法",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "无管理权限或历史权限失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在或不属于当前身份",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "任务尚未终结或调用未发送",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/quota-reservations/{reservationId}/reconcile": {
      "post": {
        "operationId": "reconcileSyntheticProbeQuota",
        "summary": "应用配额管理（管理身份）",
        "description": "需要应用管理员或平台管理员；写操作须 If-Match 当前 revision，记录原因与审计。预留在模型发送前与 SENT 原子登记。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reservationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "当前修订，允许双引号包裹；PUT /quotas 为配额配置修订，reconcile 为预留修订。"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuotaReservation"
                }
              }
            }
          },
          "400": {
            "description": "字段或分页非法",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "无管理权限或历史权限失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在或不属于当前身份",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "任务尚未终结或调用未发送",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelReconciliationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{resourceId}/versions/{version}/documents/preview": {
      "post": {
        "operationId": "previewManagedDocument",
        "summary": "预览调用者提供的文本分块（不写入、不读取私有原文）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedDocumentPreview"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedDocumentContent"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{resourceId}/versions/{version}/documents/batch": {
      "post": {
        "operationId": "importManagedDocuments",
        "summary": "批量导入托管文档并返回逐项结果",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedDocumentBatchResult"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedDocumentBatchRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{resourceId}/versions/{version}/documents/rebuild": {
      "post": {
        "operationId": "rebuildManagedDocuments",
        "summary": "向新草稿版本重建授权原文索引",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedDocumentBatchResult"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedDocumentRebuildRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/runs/{runId}/citations/{citationId}/preview": {
      "get": {
        "operationId": "previewRunCitation",
        "tags": [
          "知识与引用"
        ],
        "summary": "当前任务所有者鉴权预览引用片段",
        "description": "留存及凭据、所有权、历史权限、精确知识发布状态/租约与当前文档 ACL 共同约束。远程重新检索原参数并验证编号、版本和片段摘要。最多 15 秒，失败不重试；旧任务缺少私有引用摘要返回 404。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "citationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^cite_[a-zA-Z0-9_-]{1,123}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "重新授权的检索片段；不缓存，不访问原始来源 URI",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CitationPreview"
                }
              }
            }
          },
          "400": {
            "description": "字段或分页非法",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "无管理权限或历史权限失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "资源不存在或不属于当前身份",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "任务尚未终结或调用未发送",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "修订冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/ingestions": {
      "post": {
        "operationId": "uploadManagedFile",
        "summary": "uploadManagedFile",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Management credential required; original/parsed reads instead use current tenant, document ACL and business READ_HISTORY permissions. No automatic retry.",
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestionJob"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "1..4 MiB original. Allowed extension TXT/MD/PDF/DOCX/XLSX/PPTX/PNG/JPEG; parser validates contents."
                  },
                  "metadata": {
                    "$ref": "#/components/schemas/DocumentUploadMetadata"
                  }
                },
                "required": [
                  "file",
                  "metadata"
                ],
                "additionalProperties": false
              },
              "encoding": {
                "metadata": {
                  "contentType": "application/json"
                },
                "file": {
                  "contentType": "application/octet-stream"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listIngestionJobs",
        "summary": "listIngestionJobs",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "description": "Management credential required; original/parsed reads instead use current tenant, document ACL and business READ_HISTORY permissions. No automatic retry.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestionPage"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/ingestions/{jobId}": {
      "get": {
        "operationId": "getIngestionJob",
        "summary": "getIngestionJob",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Management credential required; original/parsed reads instead use current tenant, document ACL and business READ_HISTORY permissions. No automatic retry.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestionJob"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteIngestionJob",
        "summary": "deleteIngestionJob",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Current ingestion revision; stale returns 412"
          }
        ],
        "description": "Management credential required; original/parsed reads instead use current tenant, document ACL and business READ_HISTORY permissions. No automatic retry.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "maxLength": 128
                    },
                    "deleted": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "id",
                    "deleted"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/ingestions/{jobId}/cancel": {
      "post": {
        "operationId": "cancelIngestionJob",
        "summary": "cancelIngestionJob",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Current ingestion revision; stale returns 412"
          }
        ],
        "description": "Management credential required; original/parsed reads instead use current tenant, document ACL and business READ_HISTORY permissions. No automatic retry.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestionJob"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/ingestions/{jobId}/retry": {
      "post": {
        "operationId": "retryIngestionJob",
        "summary": "retryIngestionJob",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Current ingestion revision; stale returns 412"
          }
        ],
        "description": "Management credential required; original/parsed reads instead use current tenant, document ACL and business READ_HISTORY permissions. No automatic retry.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestionJob"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/ingestions/{jobId}/original": {
      "get": {
        "operationId": "downloadOriginalDocument",
        "summary": "downloadOriginalDocument",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Management credential required; original/parsed reads instead use current tenant, document ACL and business READ_HISTORY permissions. No automatic retry.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/ingestions/{jobId}/parsed": {
      "get": {
        "operationId": "readParsedDocument",
        "summary": "readParsedDocument",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Management credential required; original/parsed reads instead use current tenant, document ACL and business READ_HISTORY permissions. No automatic retry.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "maxLength": 65536
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/retrieval-debug": {
      "post": {
        "operationId": "debugManagedKnowledge",
        "summary": "调试当前身份的托管知识检索",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Current trusted identity only. Draft content requires management role; current tenant, document ACL and business permissions always apply. Evaluation history is owner-only and never stores source text. No automatic retries; response is no-store. Metrics are document-level versioned retrieval metrics, not answer correctness.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDebugResult"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeDebugRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/evaluations": {
      "post": {
        "operationId": "evaluateManagedKnowledge",
        "summary": "执行并保存固定版本知识评测",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Current trusted identity only. Draft content requires management role; current tenant, document ACL and business permissions always apply. Evaluation history is owner-only and never stores source text. No automatic retries; response is no-store. Metrics are document-level versioned retrieval metrics, not answer correctness.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeEvaluation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeEvaluationRequest"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listKnowledgeEvaluations",
        "summary": "分页查询自己的知识评测摘要",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 10
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          }
        ],
        "description": "Current trusted identity only. Draft content requires management role; current tenant, document ACL and business permissions always apply. Evaluation history is owner-only and never stores source text. No automatic retries; response is no-store. Metrics are document-level versioned retrieval metrics, not answer correctness.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeEvaluationPage"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/evaluations/{evaluationId}": {
      "get": {
        "operationId": "getKnowledgeEvaluation",
        "summary": "鉴权回读自己的知识评测",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "evaluationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Current trusted identity only. Draft content requires management role; current tenant, document ACL and business permissions always apply. Evaluation history is owner-only and never stores source text. No automatic retries; response is no-store. Metrics are document-level versioned retrieval metrics, not answer correctness.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeEvaluation"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteKnowledgeEvaluation",
        "summary": "按修订号删除自己的知识评测",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "evaluationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Current immutable evaluation revision"
          }
        ],
        "description": "Current trusted identity only. Draft content requires management role; current tenant, document ACL and business permissions always apply. Evaluation history is owner-only and never stores source text. No automatic retries; response is no-store. Metrics are document-level versioned retrieval metrics, not answer correctness.",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "deleted"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/vectors": {
      "get": {
        "operationId": "vectorIndexHealth",
        "summary": "查看当前可读向量索引健康",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Current identity and live tenant/document/business permissions. Builds are draft-only and never partially activate vectors. Retry creates a new job from current inputs; no automatic provider retry. No source text or private principal returned in jobs. Exact relational cosine search has explicit storage and build limits.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VectorIndexHealth"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/vectors/jobs": {
      "post": {
        "operationId": "buildKnowledgeVectors",
        "summary": "创建当前身份的向量构建任务",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Current identity and live tenant/document/business permissions. Builds are draft-only and never partially activate vectors. Retry creates a new job from current inputs; no automatic provider retry. No source text or private principal returned in jobs. Exact relational cosine search has explicit storage and build limits.",
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VectorBuildJob"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VectorBuildRequest"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listVectorJobs",
        "summary": "分页读取向量构建任务",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 10
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          }
        ],
        "description": "Current identity and live tenant/document/business permissions. Builds are draft-only and never partially activate vectors. Retry creates a new job from current inputs; no automatic provider retry. No source text or private principal returned in jobs. Exact relational cosine search has explicit storage and build limits.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VectorBuildPage"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/vectors/jobs/{jobId}": {
      "get": {
        "operationId": "getVectorJob",
        "summary": "读取向量构建任务状态",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Current identity and live tenant/document/business permissions. Builds are draft-only and never partially activate vectors. Retry creates a new job from current inputs; no automatic provider retry. No source text or private principal returned in jobs. Exact relational cosine search has explicit storage and build limits.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VectorBuildJob"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteVectorJob",
        "summary": "删除终态构建及撤销版本的关联向量",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Current vector job revision"
          }
        ],
        "description": "Current identity and live tenant/document/business permissions. Builds are draft-only and never partially activate vectors. Retry creates a new job from current inputs; no automatic provider retry. No source text or private principal returned in jobs. Exact relational cosine search has explicit storage and build limits.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "deleted"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/vectors/jobs/{jobId}/cancel": {
      "post": {
        "operationId": "cancelVectorJob",
        "summary": "取消向量构建任务",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Current vector job revision"
          }
        ],
        "description": "Current identity and live tenant/document/business permissions. Builds are draft-only and never partially activate vectors. Retry creates a new job from current inputs; no automatic provider retry. No source text or private principal returned in jobs. Exact relational cosine search has explicit storage and build limits.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VectorBuildJob"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/knowledge/{knowledgeId}/versions/{version}/vectors/jobs/{jobId}/retry": {
      "post": {
        "operationId": "retryVectorJob",
        "summary": "按当前授权与配置重新创建构建任务",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "knowledgeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Current vector job revision"
          }
        ],
        "description": "Current identity and live tenant/document/business permissions. Builds are draft-only and never partially activate vectors. Retry creates a new job from current inputs; no automatic provider retry. No source text or private principal returned in jobs. Exact relational cosine search has explicit storage and build limits.",
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VectorBuildJob"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/audit/records": {
      "get": {
        "operationId": "auditRecords",
        "summary": "Filter and traverse a fixed audit snapshot",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256,
              "minLength": 1
            }
          },
          {
            "name": "subjectId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256,
              "minLength": 1
            }
          },
          {
            "name": "tenantId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "runId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256,
              "minLength": 1
            }
          },
          {
            "name": "executionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256,
              "minLength": 1
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditPage"
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "no-store"
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/audit/export": {
      "post": {
        "operationId": "exportAudit",
        "summary": "Export one bounded snapshot page with digest and continuation",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditExport"
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "no-store"
              },
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                },
                "description": "attachment; filename=sparktide-{app}-audit.json"
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuditQuery"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/audit/retention/preview": {
      "post": {
        "operationId": "previewAuditRetention",
        "summary": "Preview explicit platform-admin retention cleanup",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditRetentionPreview"
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "no-store"
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuditRetentionPreviewRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/audit/retention/apply": {
      "post": {
        "operationId": "applyAuditRetention",
        "summary": "Apply exactly the previewed expired audit cleanup",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditRetentionReceipt"
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "no-store"
              }
            }
          },
          "409": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuditRetentionApply"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/observability": {
      "get": {
        "operationId": "observationSummary",
        "summary": "应用观测摘要（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "hours",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 24,
              "minimum": 1,
              "maximum": 168
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObservationSummary"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/runs/{runId}/trace": {
      "get": {
        "operationId": "runTrace",
        "summary": "抽样调用链（应用管理员或仍授权的所有者）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunTrace"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/operations/observability": {
      "get": {
        "operationId": "observationStatus",
        "summary": "观测队列、留存与出口状态（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObservationStatus"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/operations/metrics": {
      "get": {
        "operationId": "prometheusMetrics",
        "summary": "Prometheus 进程指标（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "description": "text/plain;version=0.0.4;charset=utf-8"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/alert-rules": {
      "get": {
        "operationId": "alertRules",
        "summary": "告警规则列表（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRuleList"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "saveAlertRule",
        "summary": "保存告警规则（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRule"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Revision mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertRuleInput"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/alert-rules/{ruleId}": {
      "delete": {
        "operationId": "deleteAlertRule",
        "summary": "删除告警规则（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRuleDeletion"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Revision mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/alerts": {
      "get": {
        "operationId": "alerts",
        "summary": "告警实例分页（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "FIRING",
                "ACKNOWLEDGED",
                "RESOLVED"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertPage"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/alerts/{alertId}": {
      "get": {
        "operationId": "alertDetail",
        "summary": "告警实例详情（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "alertId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertInstance"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/alerts/{alertId}/acknowledge": {
      "post": {
        "operationId": "acknowledgeAlert",
        "summary": "确认告警（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "alertId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertInstance"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Revision mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertTransitionReason"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/alerts/{alertId}/resolve": {
      "post": {
        "operationId": "resolveAlert",
        "summary": "手动恢复告警（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "alertId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertInstance"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Revision mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertTransitionReason"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/alerts/evaluate": {
      "post": {
        "operationId": "evaluateAlerts",
        "summary": "立即评估本应用告警规则（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertEvaluation"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/operations/alerts": {
      "get": {
        "operationId": "platformAlerts",
        "summary": "跨应用告警聚合（平台管理员）",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformAlertPage"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/operations/alerts/evaluate": {
      "post": {
        "operationId": "platformEvaluateAlerts",
        "summary": "立即评估全部告警规则（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertEvaluation"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/operations/alerts/{alertId}/acknowledge": {
      "post": {
        "operationId": "platformAcknowledgeAlert",
        "summary": "确认任意应用告警（平台管理员）",
        "parameters": [
          {
            "name": "alertId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertInstance"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Revision mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertTransitionReason"
              }
            }
          }
        }
      }
    },
    "/v1/operations/alerts/{alertId}/resolve": {
      "post": {
        "operationId": "platformResolveAlert",
        "summary": "恢复任意应用告警（平台管理员）",
        "parameters": [
          {
            "name": "alertId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertInstance"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "State conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Revision mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertTransitionReason"
              }
            }
          }
        }
      }
    },
    "/v1/operations/status": {
      "get": {
        "operationId": "operationsStatus",
        "summary": "存活、就绪与外部能力链状态（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpsStatus"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/eval-datasets": {
      "get": {
        "operationId": "evalDatasets",
        "summary": "评测数据集列表（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvalDatasetList"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "saveEvalDataset",
        "summary": "保存评测数据集（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvalDataset"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvalDatasetInput"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/eval-runs": {
      "get": {
        "operationId": "evalRuns",
        "summary": "评测运行分页（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvalRunPage"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "startEvalRun",
        "summary": "按数据集评测已发布智能体版本（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvalRun"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Evaluation queue is full",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvalRunStart"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/eval-runs/{evalId}": {
      "get": {
        "operationId": "evalRun",
        "summary": "评测运行详情（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "evalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvalRun"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/eval-runs/{evalId}/cases/{caseId}/score": {
      "post": {
        "operationId": "scoreEvalCase",
        "summary": "记录人工评分（应用管理员）",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "evalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "caseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvalRun"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvalManualScore"
              }
            }
          }
        }
      }
    },
    "/v1/operations/evaluations": {
      "get": {
        "operationId": "evaluationEngineStatus",
        "summary": "评测引擎队列与计数（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvaluationEngineStatus"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/operations/retention": {
      "get": {
        "operationId": "retentionPreview",
        "summary": "留存策略与到期清理预览（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetentionPreview"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateRetentionPolicy",
        "summary": "更新留存策略（平台管理员）",
        "parameters": [
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetentionPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetentionPolicyInput"
              }
            }
          }
        }
      }
    },
    "/v1/operations/retention/status": {
      "get": {
        "operationId": "retentionStatus",
        "summary": "留存引擎状态与计数（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetentionStatus"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/operations/retention/sweep": {
      "post": {
        "operationId": "sweepRetention",
        "summary": "执行到期清理（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/RetentionSweepResult"
                    },
                    {
                      "$ref": "#/components/schemas/RetentionSweepPreview"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetentionSweepRequest"
              }
            }
          }
        }
      }
    },
    "/v1/operations/redaction": {
      "get": {
        "operationId": "redactionPolicy",
        "summary": "读取脱敏策略（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedactionPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateRedactionPolicy",
        "summary": "更新脱敏策略（平台管理员）",
        "parameters": [
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedactionPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedactionPolicyInput"
              }
            }
          }
        }
      }
    },
    "/v1/operations/redaction/status": {
      "get": {
        "operationId": "redactionStatus",
        "summary": "脱敏策略状态（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedactionStatus"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/operations/redaction/preview": {
      "post": {
        "operationId": "previewRedaction",
        "summary": "对样例试跑脱敏规则（平台管理员）",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedactionPreview"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Request rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedactionPreviewRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{app}/conversations": {
      "get": {
        "operationId": "listConversations",
        "summary": "分页列出当前身份的会话（会话所有者）",
        "description": "按更新时间倒序返回当前主体的会话摘要；不返回消息正文。分页与 listApplicationActivity 相同。",
        "parameters": [
          {
            "name": "app",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationPage"
                }
              }
            }
          },
          "400": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Structured error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Ref": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "version": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
          }
        },
        "required": [
          "id",
          "version"
        ],
        "additionalProperties": false
      },
      "Application": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "revision": {
            "type": "integer"
          },
          "status": {
            "enum": [
              "DRAFT",
              "ACTIVE",
              "SUSPENDED",
              "ARCHIVED"
            ]
          },
          "defaultAgent": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Ref"
              },
              {
                "type": "null"
              }
            ]
          },
          "statusReason": {
            "type": "string",
            "maxLength": 512
          },
          "permissionProvider": {
            "$ref": "#/components/schemas/BusinessProvider"
          },
          "contextProvider": {
            "$ref": "#/components/schemas/ContextProvider"
          },
          "securityEpoch": {
            "type": "integer",
            "minimum": 0
          },
          "evaluationGate": {
            "$ref": "#/components/schemas/EvaluationGate"
          }
        },
        "required": [
          "id",
          "name",
          "revision",
          "status",
          "defaultAgent"
        ],
        "additionalProperties": false
      },
      "CreateApplication": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false
      },
      "CreateToken": {
        "type": "object",
        "properties": {
          "subjectId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "tenantId": {
            "type": "string",
            "maxLength": 128
          },
          "role": {
            "enum": [
              "USER",
              "APP_ADMIN"
            ],
            "default": "USER"
          },
          "ttlSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 2592000,
            "default": 86400
          }
        },
        "required": [
          "subjectId"
        ],
        "additionalProperties": false
      },
      "DefaultAgent": {
        "type": "object",
        "properties": {
          "agentId": {
            "type": "string"
          },
          "version": {
            "type": "string"
          }
        },
        "required": [
          "agentId",
          "version"
        ],
        "additionalProperties": false
      },
      "Token": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "subjectId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "expiresAt": {
            "type": "integer",
            "format": "int64"
          },
          "revoked": {
            "type": "boolean"
          },
          "token": {
            "type": "string",
            "description": "Only returned once by POST tokens"
          }
        },
        "required": [
          "id",
          "appId",
          "subjectId",
          "tenantId",
          "role",
          "expiresAt",
          "revoked"
        ],
        "additionalProperties": false
      },
      "Definition": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AgentDefinition"
          },
          {
            "$ref": "#/components/schemas/ToolDefinition"
          },
          {
            "$ref": "#/components/schemas/KnowledgeDefinition"
          },
          {
            "$ref": "#/components/schemas/UiDefinition"
          },
          {
            "$ref": "#/components/schemas/ProviderDefinition"
          },
          {
            "$ref": "#/components/schemas/ModelDefinition"
          },
          {
            "$ref": "#/components/schemas/BindingDefinition"
          },
          {
            "$ref": "#/components/schemas/ProfileDefinition"
          }
        ]
      },
      "Registration": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "definition": {
            "$ref": "#/components/schemas/Definition"
          }
        },
        "required": [
          "id",
          "version",
          "definition"
        ],
        "additionalProperties": false
      },
      "Registry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "revision": {
            "type": "integer"
          },
          "status": {
            "enum": [
              "DRAFT",
              "PUBLISHED",
              "REVOKED"
            ]
          },
          "definition": {
            "$ref": "#/components/schemas/Definition"
          }
        },
        "required": [
          "id",
          "version",
          "kind",
          "appId",
          "revision",
          "status",
          "definition"
        ],
        "additionalProperties": false
      },
      "AgentDefinition": {
        "type": "object",
        "properties": {
          "systemPrompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32768
          },
          "modelProfile": {
            "$ref": "#/components/schemas/Ref"
          },
          "allowedTools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Ref"
            },
            "default": []
          },
          "allowedKnowledge": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Ref"
            },
            "default": []
          },
          "allowedAgents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Ref"
            },
            "default": []
          },
          "allowedUi": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Ref"
            },
            "default": []
          },
          "delegatedCapabilities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "kind/id@version for all delegated capabilities, including descendant ceilings"
          },
          "limits": {
            "type": "object",
            "properties": {
              "maxSteps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 32,
                "default": 8
              },
              "maxToolCalls": {
                "type": "integer",
                "minimum": 0,
                "maximum": 64,
                "default": 16
              },
              "maxDepth": {
                "type": "integer",
                "minimum": 0,
                "maximum": 8,
                "default": 3
              },
              "timeoutSeconds": {
                "type": "integer",
                "minimum": 1,
                "maximum": 600,
                "default": 120
              },
              "maxTokens": {
                "type": "integer",
                "minimum": 256,
                "maximum": 1000000,
                "default": 32000,
                "deprecated": true,
                "description": "字符预算的旧字段；与 maxBudgetUnits 不能同时设置。"
              },
              "maxAgentCalls": {
                "type": "integer",
                "minimum": 0,
                "maximum": 64,
                "default": 8
              },
              "maxBudgetUnits": {
                "type": "integer",
                "minimum": 256,
                "maximum": 1000000,
                "default": 32000
              },
              "maxProviderTokens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000000
              },
              "maxCost": {
                "type": "object",
                "properties": {
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "amount": {
                    "type": "string",
                    "pattern": "^[0-9]{1,13}(\\.[0-9]{1,12})?$"
                  }
                },
                "required": [
                  "currency",
                  "amount"
                ],
                "additionalProperties": false
              }
            },
            "required": [],
            "additionalProperties": false,
            "not": {
              "required": [
                "maxTokens",
                "maxBudgetUnits"
              ]
            },
            "description": "根调用汇总全树；子调用按自己的定义预留父级剩余额度，结束归还未用容量。供应商 Token 与费用在网络发送前原子预留。"
          },
          "entryPolicy": {
            "type": "object",
            "description": "Direct chat entry authorization. Omitted means APPLICATION. Delegation is separately authorized by allowedAgents. RESTRICTED filters are combined with AND; values inside each filter use OR.",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "APPLICATION",
                  "RESTRICTED",
                  "INTERNAL_ONLY"
                ],
                "default": "APPLICATION"
              },
              "roles": {
                "type": "array",
                "maxItems": 256,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "subjects": {
                "type": "array",
                "maxItems": 256,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "tenants": {
                "type": "array",
                "maxItems": 256,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              }
            },
            "additionalProperties": false
          },
          "permissions": {
            "type": "array",
            "maxItems": 64,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z][a-zA-Z0-9_.:-]{0,127}$"
            },
            "description": "业务权限名称；需认证权限 Provider，未配置则拒绝受保护能力。"
          },
          "requiredCapabilities": {
            "type": "array",
            "maxItems": 5,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "toolCalling",
                "structuredOutput",
                "vision",
                "audio",
                "streaming"
              ]
            }
          },
          "allowedModelRegions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          "knowledgeRouting": {
            "$ref": "#/components/schemas/KnowledgeRoutingPolicy"
          }
        },
        "required": [
          "systemPrompt",
          "modelProfile"
        ],
        "additionalProperties": false
      },
      "ToolDefinition": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "secretRef": {
            "type": "string"
          },
          "effect": {
            "enum": [
              "READ",
              "COMPUTE",
              "WRITE",
              "DANGEROUS"
            ]
          },
          "roles": {
            "type": "array",
            "minItems": 1,
            "items": {
              "enum": [
                "USER",
                "APP_ADMIN"
              ]
            }
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true
          },
          "outputSchema": {
            "type": "object",
            "additionalProperties": true
          },
          "leaseRequired": {
            "type": "boolean",
            "default": false
          },
          "permissions": {
            "type": "array",
            "maxItems": 64,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z][a-zA-Z0-9_.:-]{0,127}$"
            },
            "description": "业务权限名称；需认证权限 Provider，未配置则拒绝受保护能力。"
          }
        },
        "required": [
          "endpoint",
          "effect",
          "roles",
          "inputSchema",
          "outputSchema"
        ],
        "additionalProperties": false
      },
      "KnowledgeDefinition": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "mode": {
            "enum": [
              "INLINE",
              "REMOTE",
              "MANAGED"
            ]
          },
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "secretRef": {
            "type": "string"
          },
          "topK": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 3
          },
          "documents": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "source": {
                  "type": "string"
                },
                "tenantId": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "text"
              ],
              "additionalProperties": false
            }
          },
          "leaseRequired": {
            "type": "boolean",
            "default": false
          },
          "permissions": {
            "type": "array",
            "maxItems": 64,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z][a-zA-Z0-9_.:-]{0,127}$"
            },
            "description": "业务权限名称；需认证权限 Provider，未配置则拒绝受保护能力。"
          },
          "callbackProtocolVersion": {
            "const": "1.0",
            "description": "仅 REMOTE；缺省沿用旧 documents 合同。"
          },
          "mandatoryFilters": {
            "type": "array",
            "items": {
              "enum": [
                "TENANT",
                "SUBJECT"
              ]
            },
            "uniqueItems": true,
            "maxItems": 2
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "maxItems": 16,
            "uniqueItems": true
          },
          "chunking": {
            "$ref": "#/components/schemas/DocumentChunkingPolicy"
          },
          "retrieval": {
            "$ref": "#/components/schemas/KnowledgeRetrieval"
          }
        },
        "required": [
          "mode"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "required": [
                "callbackProtocolVersion"
              ]
            },
            "then": {
              "properties": {
                "mode": {
                  "const": "REMOTE"
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "mandatoryFilters"
              ]
            },
            "then": {
              "required": [
                "callbackProtocolVersion"
              ],
              "properties": {
                "callbackProtocolVersion": {
                  "const": "1.0"
                },
                "mode": {
                  "const": "REMOTE"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "callbackProtocolVersion": {
                  "const": "1.0"
                },
                "permissions": {
                  "minItems": 1
                }
              },
              "required": [
                "callbackProtocolVersion",
                "permissions"
              ]
            },
            "then": {
              "required": [
                "mandatoryFilters"
              ],
              "properties": {
                "mandatoryFilters": {
                  "contains": {
                    "const": "SUBJECT"
                  }
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "chunking"
              ]
            },
            "then": {
              "properties": {
                "mode": {
                  "const": "MANAGED"
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "retrieval"
              ]
            },
            "then": {
              "properties": {
                "mode": {
                  "const": "MANAGED"
                }
              }
            }
          }
        ]
      },
      "UiDefinition": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "propsSchema": {
            "type": "object",
            "additionalProperties": true
          },
          "fallback": {
            "type": "string",
            "minLength": 1
          },
          "permissions": {
            "type": "array",
            "maxItems": 64,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z][a-zA-Z0-9_.:-]{0,127}$"
            },
            "description": "业务权限名称；需认证权限 Provider，未配置则拒绝受保护能力。"
          }
        },
        "required": [
          "propsSchema",
          "fallback"
        ],
        "additionalProperties": false
      },
      "ProviderDefinition": {
        "type": "object",
        "properties": {
          "mode": {
            "enum": [
              "OPENAI_CHAT",
              "REMOTE"
            ]
          },
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "secretRef": {
            "type": "string"
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "OPENAI_CHAT 为原生 SSE；REMOTE 为版本 1.0 的统一模型 SSE。stream 默认 false，模型必须显式声明 streaming=true。"
          },
          "leaseRequired": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "mode",
          "endpoint"
        ],
        "additionalProperties": false
      },
      "ModelDefinition": {
        "type": "object",
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/Ref"
          },
          "modelId": {
            "type": "string"
          },
          "pricing": {
            "type": "object",
            "properties": {
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "inputPerMillion": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000
              },
              "outputPerMillion": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000
              }
            },
            "required": [
              "currency",
              "inputPerMillion",
              "outputPerMillion"
            ],
            "additionalProperties": false
          },
          "capabilities": {
            "$ref": "#/components/schemas/ModelCapabilities"
          }
        },
        "required": [
          "provider",
          "modelId"
        ],
        "additionalProperties": false
      },
      "BindingDefinition": {
        "type": "object",
        "properties": {
          "model": {
            "$ref": "#/components/schemas/Ref"
          },
          "scope": {
            "type": "string"
          }
        },
        "required": [
          "model"
        ],
        "additionalProperties": false
      },
      "ProfileDefinition": {
        "type": "object",
        "properties": {
          "binding": {
            "$ref": "#/components/schemas/Ref"
          },
          "maxOutputTokens": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32768,
            "default": 1024
          },
          "outputSchema": {
            "type": "object",
            "description": "平台闭合 Schema 方言；根为 object，嵌套对象全部属性 required，完整输出验证后才发送文字。",
            "additionalProperties": true
          },
          "fallbackBindings": {
            "type": "array",
            "maxItems": 7,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/Ref"
            },
            "description": "固定候选绑定版本；与主绑定不能重复，全部候选必须符合智能体兼容性。"
          },
          "routing": {
            "$ref": "#/components/schemas/ModelRoutingPolicy"
          },
          "parameters": {
            "$ref": "#/components/schemas/ModelGenerationParameters"
          }
        },
        "required": [
          "binding"
        ],
        "additionalProperties": false
      },
      "ChatRequest": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "const": "1.0"
          },
          "appId": {
            "type": "string"
          },
          "agentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "agentVersion": {
            "type": "string"
          },
          "conversationId": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "object",
            "properties": {
              "role": {
                "const": "user"
              },
              "content": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16384
              }
            },
            "required": [
              "role",
              "content"
            ],
            "additionalProperties": false
          },
          "context": {
            "type": "object",
            "additionalProperties": true
          },
          "client": {
            "type": "object",
            "properties": {
              "platform": {
                "type": "string"
              },
              "uiCapabilities": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [],
            "additionalProperties": false
          }
        },
        "required": [
          "protocolVersion",
          "message"
        ],
        "additionalProperties": false
      },
      "Confirmation": {
        "type": "object",
        "properties": {
          "confirmationId": {
            "type": "string"
          },
          "decision": {
            "enum": [
              "approve",
              "reject"
            ]
          }
        },
        "required": [
          "confirmationId",
          "decision"
        ],
        "additionalProperties": false
      },
      "Run": {
        "type": "object",
        "required": [
          "id",
          "appId",
          "status",
          "lastSequence",
          "traceId",
          "conversationId",
          "messageId"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "subjectId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "status": {
            "enum": [
              "QUEUED",
              "RUNNING",
              "WAITING_CONFIRMATION",
              "SUCCEEDED",
              "FAILED",
              "CANCELLED",
              "TIMED_OUT"
            ]
          },
          "lastSequence": {
            "type": "integer"
          },
          "traceId": {
            "type": "string"
          },
          "conversationId": {
            "type": "string"
          },
          "messageId": {
            "type": "string"
          },
          "createdAt": {
            "type": "integer"
          },
          "deadline": {
            "type": "integer"
          },
          "finishedAt": {
            "type": "integer"
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "agent": {
            "$ref": "#/components/schemas/Ref"
          },
          "ownerId": {
            "type": "string"
          },
          "archived": {
            "type": "boolean"
          },
          "usage": {
            "type": "object"
          },
          "knowledgeAccessEpoch": {
            "type": "integer",
            "minimum": 0,
            "description": "Application knowledge permission generation; previous runs/conversations become unavailable after a policy change"
          },
          "securityEpoch": {
            "type": "integer",
            "minimum": 0
          },
          "modelLedger": {
            "type": "boolean"
          },
          "modelAccounting": {
            "$ref": "#/components/schemas/ModelAccountingSummary"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "traceId": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "details": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "required": [
              "code",
              "message",
              "traceId",
              "retryable",
              "details"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "AgentEvent": {
        "title": "SparkTide AgentEvent 1.0",
        "type": "object",
        "properties": {
          "protocolVersion": {
            "const": "1.0"
          },
          "event": {
            "enum": [
              "message.started",
              "status.changed",
              "text.delta",
              "agent.started",
              "agent.completed",
              "tool.started",
              "tool.completed",
              "knowledge.retrieved",
              "citation.created",
              "ui.created",
              "confirmation.required",
              "usage.updated",
              "error",
              "message.completed",
              "model.started",
              "model.completed",
              "knowledge.planned",
              "knowledge.fused",
              "citation.verified"
            ]
          },
          "runId": {
            "type": "string"
          },
          "traceId": {
            "type": "string"
          },
          "conversationId": {
            "type": "string"
          },
          "messageId": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "minimum": 1
          },
          "data": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "protocolVersion",
          "event",
          "runId",
          "traceId",
          "conversationId",
          "messageId",
          "sequence",
          "data"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "event": {
                  "const": "message.started"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "status.changed"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "text.delta"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "text"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "agent.started"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "agent.completed"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    },
                    "result": {
                      "$ref": "#/components/schemas/AgentResult"
                    },
                    "usage": {
                      "$ref": "#/components/schemas/AgentBudgetUsage"
                    },
                    "errorCode": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "status"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "tool.started"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "callId": {
                      "type": "string"
                    },
                    "toolId": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "effect": {
                      "enum": [
                        "READ",
                        "COMPUTE",
                        "WRITE",
                        "DANGEROUS"
                      ]
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "callId",
                    "toolId",
                    "version",
                    "effect"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "tool.completed"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "callId": {
                      "type": "string"
                    },
                    "toolId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "callId",
                    "toolId",
                    "status"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "knowledge.retrieved"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "knowledgeId": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    },
                    "knowledgeVersion": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "status": {
                      "enum": [
                        "SUCCEEDED",
                        "EMPTY",
                        "FAILED"
                      ]
                    },
                    "errorCode": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "retrievalId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "selectionReason": {
                      "enum": [
                        "MODEL_REQUEST",
                        "EAGER",
                        "RULE_ALWAYS",
                        "TRUSTED_CONTEXT",
                        "QUERY_MATCH",
                        "TAG_MATCH",
                        "DESCRIPTION_TAG_MATCH"
                      ]
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "knowledgeId",
                    "count"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "citation.created"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "documentId": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "knowledgeId": {
                      "type": "string"
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    },
                    "sourceRef": {
                      "$ref": "#/components/schemas/KnowledgeSource"
                    },
                    "score": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "metadata": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "最多 4096 UTF-8 字节、嵌套深度 8；有限 JSON 值。"
                    },
                    "itemId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "retrievalId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "knowledgeVersion": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "fusionScore": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "chunkId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 160
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "id",
                    "documentId",
                    "title",
                    "source",
                    "knowledgeId"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "ui.created"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "component": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "props": {
                      "type": "object"
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "component",
                    "version",
                    "props"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "confirmation.required"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "confirmationId": {
                      "type": "string"
                    },
                    "toolId": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "arguments": {
                      "type": "object"
                    },
                    "argumentsHash": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "confirmationId",
                    "toolId",
                    "version",
                    "arguments",
                    "argumentsHash",
                    "expiresAt"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "usage.updated"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "budgetUnits": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000
                    },
                    "steps": {
                      "type": "integer"
                    },
                    "toolCalls": {
                      "type": "integer"
                    },
                    "providerUsage": {
                      "type": "object"
                    },
                    "cost": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "source": {
                          "const": "configured-pricing"
                        },
                        "amounts": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "source",
                        "amounts"
                      ]
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    },
                    "agentCalls": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 64
                    },
                    "scopeUsage": {
                      "$ref": "#/components/schemas/AgentBudgetUsage"
                    },
                    "modelInvocationIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "uniqueItems": true,
                      "maxItems": 256
                    },
                    "citationIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "uniqueItems": true,
                      "maxItems": 256
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "budgetUnits",
                    "steps",
                    "toolCalls",
                    "providerUsage",
                    "cost"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "error"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "retryable"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "message.completed"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "model.started"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "invocationId": {
                      "type": "string"
                    },
                    "stepId": {
                      "type": "string"
                    },
                    "attempt": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 8
                    },
                    "binding": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9-]{0,63}$"
                        },
                        "version": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                        }
                      },
                      "required": [
                        "id",
                        "version"
                      ],
                      "additionalProperties": false
                    },
                    "model": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9-]{0,63}$"
                        },
                        "version": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                        },
                        "scope": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "version",
                        "scope"
                      ],
                      "additionalProperties": false
                    },
                    "selectionReason": {
                      "type": "string"
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "invocationId",
                    "stepId",
                    "attempt",
                    "binding",
                    "model",
                    "selectionReason"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "model.completed"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "invocationId": {
                      "type": "string"
                    },
                    "stepId": {
                      "type": "string"
                    },
                    "attempt": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 8
                    },
                    "binding": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9-]{0,63}$"
                        },
                        "version": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                        }
                      },
                      "required": [
                        "id",
                        "version"
                      ],
                      "additionalProperties": false
                    },
                    "model": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9-]{0,63}$"
                        },
                        "version": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                        },
                        "scope": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "version",
                        "scope"
                      ],
                      "additionalProperties": false
                    },
                    "selectionReason": {
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "RESPONDED",
                        "FAILED",
                        "SKIPPED"
                      ]
                    },
                    "errorCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "outputStarted": {
                      "type": "boolean"
                    },
                    "usage": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true
                    },
                    "cost": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "invocationId",
                    "stepId",
                    "attempt",
                    "binding",
                    "model",
                    "selectionReason",
                    "status",
                    "errorCode",
                    "outputStarted",
                    "usage",
                    "cost"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "knowledge.planned"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    },
                    "retrievalId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "mode": {
                      "enum": [
                        "EAGER",
                        "AUTO",
                        "ON_DEMAND"
                      ]
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/KnowledgeSelectedSource"
                      },
                      "maxItems": 16
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "agentVersion",
                    "retrievalId",
                    "mode",
                    "sources"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "knowledge.fused"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string"
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "agentVersion": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                    },
                    "retrievalId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 50
                    },
                    "rerank": {
                      "enum": [
                        "NONE",
                        "LEXICAL"
                      ]
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "retrievals": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 64
                        },
                        "contextChars": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 65536
                        }
                      },
                      "required": [
                        "retrievals",
                        "contextChars"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "agentCallId",
                    "parentAgentCallId",
                    "depth",
                    "agentId",
                    "agentVersion",
                    "retrievalId",
                    "count",
                    "rerank",
                    "usage"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "event": {
                  "const": "citation.verified"
                }
              }
            },
            "then": {
              "properties": {
                "data": {
                  "type": "object",
                  "properties": {
                    "agentCallId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "agentId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "agentVersion": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "parentAgentCallId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "depth": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "references": {
                      "type": "array",
                      "maxItems": 256,
                      "items": {
                        "$ref": "#/components/schemas/CitationVerification"
                      }
                    }
                  },
                  "required": [
                    "agentCallId",
                    "agentId",
                    "agentVersion",
                    "parentAgentCallId",
                    "depth",
                    "references"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        ]
      },
      "ToolExecution": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "subjectId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "toolId": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "effect": {
            "type": "string"
          },
          "inputHash": {
            "type": "string"
          },
          "idempotencyKey": {
            "type": "string"
          },
          "errorCode": {
            "type": "string"
          },
          "resultHash": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "evidence": {
            "type": "string"
          },
          "reconciledBy": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "RUNNING",
              "SUCCEEDED",
              "FAILED",
              "UNKNOWN"
            ]
          },
          "revision": {
            "type": "integer"
          },
          "createdAt": {
            "type": "integer"
          },
          "finishedAt": {
            "type": "integer"
          },
          "reconciledAt": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "appId",
          "runId",
          "status",
          "revision",
          "inputHash"
        ],
        "additionalProperties": false
      },
      "DocumentAccess": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "subjects": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "maxItems": 256,
            "uniqueItems": true
          },
          "tenants": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "maxItems": 256,
            "uniqueItems": true
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "USER",
                "APP_ADMIN"
              ]
            },
            "maxItems": 256,
            "uniqueItems": true
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "updatedAt": {
            "type": "integer"
          },
          "updatedBy": {
            "type": "string"
          }
        },
        "required": [
          "enabled",
          "subjects",
          "tenants",
          "roles",
          "revision"
        ],
        "additionalProperties": false
      },
      "BusinessContextSchema": {
        "type": "object",
        "description": "平台有限 JSON Schema 方言，根必须为 object，所有对象 additionalProperties=false；不能包含身份字段。"
      },
      "BusinessProvider": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "secretRef": {
            "type": "string",
            "minLength": 1
          },
          "timeoutMs": {
            "type": "integer",
            "minimum": 100,
            "maximum": 10000,
            "default": 2000
          }
        },
        "description": "空对象停用；非空对象必须有 endpoint 与 secretRef。配置变更需 reason，递增 securityEpoch。",
        "dependentRequired": {
          "endpoint": [
            "secretRef"
          ],
          "secretRef": [
            "endpoint"
          ],
          "timeoutMs": [
            "endpoint",
            "secretRef"
          ]
        }
      },
      "ContextProvider": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "secretRef": {
            "type": "string",
            "minLength": 1
          },
          "timeoutMs": {
            "type": "integer",
            "minimum": 100,
            "maximum": 10000,
            "default": 2000
          },
          "schema": {
            "$ref": "#/components/schemas/BusinessContextSchema"
          }
        },
        "description": "空对象停用；非空对象必须有 endpoint 与 secretRef。配置变更需 reason，递增 securityEpoch。",
        "dependentRequired": {
          "endpoint": [
            "secretRef",
            "schema"
          ],
          "secretRef": [
            "endpoint",
            "schema"
          ],
          "schema": [
            "endpoint",
            "secretRef"
          ],
          "timeoutMs": [
            "endpoint",
            "secretRef",
            "schema"
          ]
        }
      },
      "BusinessIdentity": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "protocolVersion": {
            "type": "string",
            "const": "1.0"
          },
          "appId": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "subjectId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "tenantId": {
            "type": "string",
            "maxLength": 128
          },
          "role": {
            "type": "string",
            "enum": [
              "USER",
              "APP_ADMIN"
            ]
          },
          "runId": {
            "type": "string",
            "maxLength": 128
          },
          "traceId": {
            "type": "string",
            "maxLength": 128
          },
          "deadline": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "protocolVersion",
          "appId",
          "subjectId",
          "tenantId",
          "role",
          "runId",
          "traceId",
          "deadline"
        ],
        "description": "认证回调主体；deadline 为 UTC 毫秒，失效请求拒绝。入口解析或历史读取的 runId/traceId 可能为空。"
      },
      "PermissionCallback": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "protocolVersion": {
            "type": "string",
            "const": "1.0"
          },
          "appId": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "subjectId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "tenantId": {
            "type": "string",
            "maxLength": 128
          },
          "role": {
            "type": "string",
            "description": "调用方角色；平台管理员经平台令牌访问应用资源时为 PLATFORM_ADMIN",
            "enum": [
              "USER",
              "APP_ADMIN",
              "PLATFORM_ADMIN"
            ]
          },
          "runId": {
            "type": "string",
            "maxLength": 128
          },
          "traceId": {
            "type": "string",
            "maxLength": 128
          },
          "deadline": {
            "type": "integer",
            "minimum": 1
          },
          "resource": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]{0,63}$"
              },
              "version": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "agents",
                  "tools",
                  "knowledge",
                  "ui-capabilities"
                ]
              }
            },
            "required": [
              "kind",
              "id",
              "version"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "DISCOVER",
              "EXECUTE",
              "READ_HISTORY"
            ]
          },
          "requiredPermissions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z][a-zA-Z0-9_.:-]{0,127}$"
            }
          },
          "arguments": {
            "type": "object",
            "description": "调用参数；历史检查保留原执行参数，不可用来覆盖身份。"
          },
          "untrustedContext": {
            "type": "object",
            "description": "客户端上下文，不能提供授权。"
          }
        },
        "required": [
          "protocolVersion",
          "appId",
          "subjectId",
          "tenantId",
          "role",
          "runId",
          "traceId",
          "deadline",
          "resource",
          "action",
          "requiredPermissions",
          "arguments",
          "untrustedContext"
        ]
      },
      "PermissionDecision": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "decisionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "reason": {
            "type": "string",
            "maxLength": 1024
          }
        },
        "required": [
          "allowed",
          "decisionId"
        ]
      },
      "TrustedContextResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "context": {
            "type": "object",
            "description": "遵守应用配置 Schema，最大 16 KiB。"
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "revision": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "required": [
          "context",
          "source",
          "revision"
        ]
      },
      "ReleaseResource": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "agents",
              "tools",
              "knowledge",
              "ui-capabilities",
              "model-providers",
              "models",
              "model-bindings",
              "model-profiles"
            ]
          },
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "version": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "kind",
          "id",
          "version",
          "revision"
        ],
        "additionalProperties": false
      },
      "ReleaseRequest": {
        "type": "object",
        "properties": {
          "resources": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/ReleaseResource"
            },
            "description": "同一 kind/id/version 不能重复；可以包含已发布依赖。"
          },
          "defaultAgent": {
            "$ref": "#/components/schemas/Ref"
          },
          "reason": {
            "type": "string",
            "maxLength": 512,
            "description": "发布时必须为非空文本；预检可为空。"
          }
        },
        "required": [
          "resources"
        ],
        "additionalProperties": false
      },
      "ReleasePlan": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "planHash": {
            "type": [
              "string",
              "null"
            ]
          },
          "applicationRevision": {
            "type": "integer"
          },
          "resources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseResource"
            }
          },
          "defaultAgent": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Ref"
              },
              {
                "type": "null"
              }
            ]
          },
          "dependencyCount": {
            "type": "integer"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "resource": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "resource",
                "code",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "evaluationGate": {
            "$ref": "#/components/schemas/EvaluationGateReport"
          }
        },
        "required": [
          "valid",
          "planHash",
          "applicationRevision",
          "resources",
          "defaultAgent",
          "dependencyCount",
          "errors"
        ],
        "additionalProperties": false
      },
      "ReleaseRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "subjectId": {
            "type": "string"
          },
          "createdAt": {
            "type": "integer"
          },
          "reason": {
            "type": "string"
          },
          "planHash": {
            "type": "string"
          },
          "resources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "agents",
                    "tools",
                    "knowledge",
                    "ui-capabilities",
                    "model-providers",
                    "models",
                    "model-bindings",
                    "model-profiles"
                  ]
                },
                "id": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9-]{0,63}$"
                },
                "version": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
                },
                "revision": {
                  "type": "integer",
                  "minimum": 1
                },
                "status": {
                  "const": "PUBLISHED"
                }
              },
              "required": [
                "kind",
                "id",
                "version",
                "revision",
                "status"
              ],
              "additionalProperties": false
            }
          },
          "previousDefaultAgent": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Ref"
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultAgent": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Ref"
              },
              {
                "type": "null"
              }
            ]
          },
          "applicationRevision": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "appId",
          "subjectId",
          "createdAt",
          "reason",
          "planHash",
          "resources",
          "previousDefaultAgent",
          "defaultAgent",
          "applicationRevision"
        ],
        "additionalProperties": false
      },
      "ReleasePage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseRecord"
            }
          },
          "nextOffset": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "nextOffset"
        ],
        "additionalProperties": false
      },
      "ModelCapabilities": {
        "type": "object",
        "additionalProperties": false,
        "description": "维护者声明；省略为未知，true 非供应商探测证明。",
        "properties": {
          "toolCalling": {
            "type": "boolean"
          },
          "structuredOutput": {
            "type": "boolean"
          },
          "vision": {
            "type": "boolean"
          },
          "audio": {
            "type": "boolean"
          },
          "streaming": {
            "type": "boolean"
          },
          "contextWindow": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000000
          },
          "maxOutputTokens": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000000
          },
          "regions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        }
      },
      "ModelCompatibilityReport": {
        "type": "object",
        "required": [
          "valid",
          "evidence",
          "contextEstimator",
          "checks",
          "errors",
          "warnings"
        ],
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "evidence": {
            "const": "DECLARED"
          },
          "contextEstimator": {
            "const": "UTF8_BYTES_ESTIMATE"
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "resource",
                "model",
                "capabilityStates",
                "evidence",
                "outputTokens",
                "modelLimits",
                "regions"
              ],
              "properties": {
                "resource": {
                  "type": "string"
                },
                "model": {
                  "type": "object",
                  "properties": {
                    "scope": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "scope",
                    "id",
                    "version"
                  ]
                },
                "capabilityStates": {
                  "type": "object",
                  "additionalProperties": {
                    "enum": [
                      "DECLARED_SUPPORTED",
                      "UNKNOWN",
                      "UNSUPPORTED"
                    ]
                  }
                },
                "evidence": {
                  "const": "DECLARED"
                },
                "outputTokens": {
                  "type": "integer"
                },
                "modelLimits": {
                  "type": "object",
                  "properties": {
                    "contextWindow": {
                      "type": "integer"
                    },
                    "maxOutputTokens": {
                      "type": "integer"
                    }
                  }
                },
                "regions": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "binding": {
                  "$ref": "#/components/schemas/Ref"
                }
              }
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "resource",
                "code",
                "message"
              ],
              "properties": {
                "resource": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "resource",
                "code",
                "message"
              ],
              "properties": {
                "resource": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ModelRoutingPolicy": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "strategy": {
            "enum": [
              "ORDERED",
              "LOWEST_COST"
            ],
            "default": "ORDERED"
          },
          "fallbackOn": {
            "type": "array",
            "items": {
              "enum": [
                "MODEL_UNAVAILABLE",
                "MODEL_TIMED_OUT",
                "MODEL_RATE_LIMITED",
                "MODEL_CIRCUIT_OPEN"
              ]
            },
            "uniqueItems": true,
            "description": "省略允许四种瞬时错误（含 MODEL_CIRCUIT_OPEN），空数组关闭故障切换。已开始文字或工具参数输出时始终禁止切换。"
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8,
            "description": "默认候选数，不能超过实际候选数。"
          },
          "attemptTimeoutSeconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60,
            "default": 60
          }
        }
      },
      "ModelGenerationParameters": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
          },
          "topP": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          }
        }
      },
      "ModelProviderUsage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "prompt_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 1000000000
          },
          "completion_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 1000000000
          },
          "total_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 1000000000
          }
        },
        "required": [
          "prompt_tokens",
          "completion_tokens",
          "total_tokens"
        ],
        "description": "null 表示没有可信回执，不是零。"
      },
      "ModelBilledCost": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "amount": {
            "type": "string",
            "pattern": "^[0-9]{1,13}(\\.[0-9]{1,12})?$"
          }
        },
        "required": [
          "currency",
          "amount"
        ],
        "description": "供应商实际账单金额；与配置价目费用独立保存。"
      },
      "ModelReconciliationRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "providerUsage": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "prompt_tokens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "completion_tokens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "total_tokens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              }
            },
            "required": [
              "prompt_tokens",
              "completion_tokens",
              "total_tokens"
            ],
            "description": "完整整数用量；total_tokens 不得低于输入加输出。"
          },
          "billedCost": {
            "$ref": "#/components/schemas/ModelBilledCost"
          },
          "providerRequestId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "evidence": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          }
        },
        "required": [
          "providerUsage",
          "reason",
          "evidence"
        ]
      },
      "ModelReconciliation": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "providerUsage": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "prompt_tokens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "completion_tokens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              },
              "total_tokens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000
              }
            },
            "required": [
              "prompt_tokens",
              "completion_tokens",
              "total_tokens"
            ],
            "description": "完整整数用量；total_tokens 不得低于输入加输出。"
          },
          "billedCost": {
            "$ref": "#/components/schemas/ModelBilledCost"
          },
          "providerRequestId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "evidence": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "recordedAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "recordedBy": {
            "type": "string"
          },
          "usageSource": {
            "const": "PROVIDER_RECONCILIATION"
          }
        },
        "required": [
          "providerUsage",
          "reason",
          "evidence",
          "recordedAt",
          "recordedBy",
          "usageSource"
        ]
      },
      "ModelAccountingSummary": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "coverage": {
            "enum": [
              "COMPLETE",
              "LEGACY"
            ],
            "description": "COMPLETE 表示该 Run 启用账本；LEGACY 不补造历史调用。"
          },
          "invocations": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "sent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "notSent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "unknownCostInvocations": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "providerUsage": {
            "$ref": "#/components/schemas/ModelProviderUsage"
          },
          "cost": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "source": {
                "const": "configured-pricing"
              },
              "amounts": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "source",
              "amounts"
            ],
            "additionalProperties": false
          },
          "knownConfiguredAmounts": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "按币种累计十进制金额，不自动换算。"
          },
          "providerBilledAmounts": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "按币种累计十进制金额，不自动换算。"
          },
          "billedComplete": {
            "type": "boolean"
          }
        },
        "required": [
          "coverage",
          "invocations",
          "sent",
          "notSent",
          "unknownCostInvocations",
          "providerUsage",
          "cost",
          "knownConfiguredAmounts",
          "providerBilledAmounts",
          "billedComplete"
        ]
      },
      "ModelInvocation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "invocationId": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "subjectId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "stepId": {
            "type": "string"
          },
          "agentCallId": {
            "type": "string"
          },
          "parentAgentCallId": {
            "type": [
              "string",
              "null"
            ]
          },
          "agentId": {
            "type": "string"
          },
          "depth": {
            "type": "integer",
            "minimum": 0,
            "maximum": 8
          },
          "attempt": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "binding": {
            "$ref": "#/components/schemas/Ref"
          },
          "model": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "scope": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "version",
              "scope"
            ],
            "additionalProperties": false
          },
          "provider": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "scope": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "version",
              "scope"
            ],
            "additionalProperties": false
          },
          "selectionReason": {
            "type": "string"
          },
          "status": {
            "enum": [
              "RUNNING",
              "RESPONDED",
              "FAILED",
              "SKIPPED",
              "UNKNOWN"
            ]
          },
          "sendState": {
            "enum": [
              "NOT_SENT",
              "SENT"
            ],
            "description": "SENT 表示进入发送边界，可能被接收；不证明供应商收到。"
          },
          "outputStarted": {
            "type": "boolean"
          },
          "pricing": {
            "type": "object",
            "description": "当次固定模型价目，未配置时为空对象。",
            "additionalProperties": true
          },
          "pricingVersion": {
            "type": "string"
          },
          "pricingHash": {
            "type": "string"
          },
          "inputHash": {
            "type": "string"
          },
          "usage": {
            "$ref": "#/components/schemas/ModelProviderUsage"
          },
          "usageSource": {
            "enum": [
              "UNKNOWN",
              "PROVIDER"
            ]
          },
          "cost": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "source": {
                "const": "configured-pricing"
              },
              "amounts": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "source",
              "amounts"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "sentAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "receiptAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "finishedAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "effectiveUsage": {
            "$ref": "#/components/schemas/ModelProviderUsage"
          },
          "effectiveCost": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "source": {
                "const": "configured-pricing"
              },
              "amounts": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "source",
              "amounts"
            ],
            "additionalProperties": false
          },
          "costDifference": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "currency": {
                "type": "string"
              },
              "amount": {
                "type": "string"
              }
            },
            "description": "仅可比币种有完整配置金额时返回账单减配置费用。"
          },
          "reconciliation": {
            "$ref": "#/components/schemas/ModelReconciliation"
          },
          "reconciliationHistory": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ModelReconciliation"
            },
            "description": "明细接口返回；列表不返回历史数组。"
          },
          "effectiveUsageSource": {
            "enum": [
              "NOT_SENT",
              "UNKNOWN",
              "PROVIDER",
              "PROVIDER_RECONCILIATION"
            ]
          },
          "agentVersion": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
          }
        },
        "required": [
          "id",
          "invocationId",
          "runId",
          "appId",
          "subjectId",
          "tenantId",
          "stepId",
          "agentCallId",
          "parentAgentCallId",
          "agentId",
          "depth",
          "attempt",
          "binding",
          "model",
          "provider",
          "selectionReason",
          "status",
          "sendState",
          "outputStarted",
          "pricing",
          "pricingVersion",
          "pricingHash",
          "usage",
          "usageSource",
          "cost",
          "createdAt",
          "revision",
          "effectiveUsage",
          "effectiveCost",
          "costDifference",
          "effectiveUsageSource"
        ],
        "additionalProperties": false
      },
      "ModelInvocationPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelInvocation"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/ModelAccountingSummary"
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          }
        },
        "required": [
          "items",
          "summary",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      },
      "ModelHealthPolicy": {
        "type": "object",
        "properties": {
          "failureThreshold": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "failureWindowSeconds": {
            "type": "integer",
            "minimum": 10,
            "maximum": 3600
          },
          "openSeconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          },
          "probeIntervalSeconds": {
            "type": "integer",
            "minimum": 10,
            "maximum": 3600
          },
          "probeTimeoutSeconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "probesPerMinute": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60
          },
          "autoProbe": {
            "type": "boolean"
          }
        },
        "required": [
          "failureThreshold",
          "failureWindowSeconds",
          "openSeconds",
          "probeIntervalSeconds",
          "probeTimeoutSeconds",
          "probesPerMinute",
          "autoProbe"
        ],
        "additionalProperties": false
      },
      "ModelHealthState": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "model": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "scope": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "version",
              "scope"
            ],
            "additionalProperties": false
          },
          "provider": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "scope": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "version",
              "scope"
            ],
            "additionalProperties": false
          },
          "binding": {
            "$ref": "#/components/schemas/Ref"
          },
          "state": {
            "enum": [
              "CLOSED",
              "OPEN",
              "HALF_OPEN",
              "BLOCKED"
            ]
          },
          "generation": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "readyAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "lastProbeAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "activeProbe": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "expiresAt": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9223372036854776000
              }
            },
            "required": [
              "id",
              "expiresAt"
            ],
            "additionalProperties": false
          },
          "policy": {
            "$ref": "#/components/schemas/ModelHealthPolicy"
          },
          "recentFailures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20
          },
          "updatedAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "lastSuccessAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "lastFailureAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "lastErrorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastResetReason": {
            "type": "string"
          },
          "lastProbeId": {
            "type": "string"
          },
          "lastProbeFinishedAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "verifiedChecks": {
            "type": "array",
            "maxItems": 4,
            "items": {
              "type": "object",
              "properties": {
                "check": {
                  "enum": [
                    "TEXT",
                    "TOOL_CALLING",
                    "STREAMING",
                    "STRUCTURED_OUTPUT"
                  ]
                },
                "status": {
                  "enum": [
                    "PASSED",
                    "FAILED",
                    "UNSUPPORTED",
                    "UNKNOWN",
                    "SKIPPED",
                    "PENDING"
                  ]
                },
                "checkedAt": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9223372036854776000
                },
                "evidence": {
                  "const": "SYNTHETIC_PROBE"
                }
              },
              "required": [
                "check",
                "status",
                "checkedAt",
                "evidence"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "appId",
          "model",
          "provider",
          "binding",
          "state",
          "generation",
          "revision",
          "readyAt",
          "lastProbeAt",
          "activeProbe",
          "policy",
          "recentFailures"
        ],
        "additionalProperties": false
      },
      "ModelProbeCheck": {
        "type": "object",
        "properties": {
          "check": {
            "enum": [
              "TEXT",
              "TOOL_CALLING",
              "STREAMING",
              "STRUCTURED_OUTPUT"
            ]
          },
          "status": {
            "enum": [
              "PENDING",
              "PASSED",
              "FAILED",
              "UNSUPPORTED",
              "UNKNOWN",
              "SKIPPED"
            ]
          },
          "sendState": {
            "enum": [
              "NOT_SENT",
              "SENT"
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/ModelProviderUsage"
          },
          "cost": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "source": {
                "const": "configured-pricing"
              },
              "amounts": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "source",
              "amounts"
            ],
            "additionalProperties": false
          },
          "sentAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "receiptAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "errorCode": {
            "type": "string"
          },
          "latencyMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "responseCompleted": {
            "type": "boolean",
            "description": "供应商响应已按协议完整终结；仅完整回执允许自动释放费用预留"
          }
        },
        "required": [
          "check",
          "status",
          "sendState",
          "usage",
          "cost"
        ],
        "additionalProperties": false
      },
      "ModelProbe": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "healthId": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "binding": {
            "$ref": "#/components/schemas/Ref"
          },
          "model": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "scope": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "version",
              "scope"
            ],
            "additionalProperties": false
          },
          "provider": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "scope": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "version",
              "scope"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "status": {
            "enum": [
              "RUNNING",
              "COMPLETED",
              "UNKNOWN",
              "SUPERSEDED"
            ]
          },
          "generation": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "checks": {
            "type": "array",
            "minItems": 1,
            "maxItems": 4,
            "items": {
              "$ref": "#/components/schemas/ModelProbeCheck"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "requestedBy": {
            "type": "string"
          },
          "maxOutputTokensPerCheck": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "pricing": {
            "type": "object",
            "additionalProperties": true
          },
          "pricingVersion": {
            "type": "string"
          },
          "evidence": {
            "const": "SYNTHETIC_PROBE"
          },
          "finishedAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "errorCode": {
            "type": "string"
          },
          "priorHealthState": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "healthId",
          "appId",
          "binding",
          "model",
          "provider",
          "createdAt",
          "status",
          "generation",
          "checks",
          "reason",
          "requestedBy",
          "maxOutputTokensPerCheck",
          "pricing",
          "pricingVersion",
          "evidence"
        ],
        "additionalProperties": false
      },
      "ModelProbeRequest": {
        "type": "object",
        "properties": {
          "checks": {
            "type": "array",
            "minItems": 1,
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "enum": [
                "TEXT",
                "TOOL_CALLING",
                "STREAMING",
                "STRUCTURED_OUTPUT"
              ]
            },
            "description": "必须包含 TEXT；固定合成提示词，不执行业务工具。"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "required": [
          "checks",
          "reason"
        ],
        "additionalProperties": false
      },
      "ModelHealthResetRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "required": [
          "reason"
        ],
        "additionalProperties": false
      },
      "ModelProbeResult": {
        "type": "object",
        "properties": {
          "probe": {
            "$ref": "#/components/schemas/ModelProbe"
          },
          "health": {
            "$ref": "#/components/schemas/ModelHealthState"
          }
        },
        "required": [
          "probe",
          "health"
        ],
        "additionalProperties": false
      },
      "ModelProbePage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelProbe"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      },
      "RemoteModelUsage": {
        "type": "object",
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000
          },
          "completion_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000
          },
          "total_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "RemoteModelToolCall": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "\\S"
          },
          "type": {
            "const": "function"
          },
          "function": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "\\S"
              },
              "arguments": {
                "type": "string",
                "description": "完整闭合 JSON 对象，拒绝重复属性、尾随 JSON 与 null"
              }
            },
            "required": [
              "name",
              "arguments"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "type",
          "function"
        ],
        "additionalProperties": false
      },
      "RemoteModelMessage": {
        "type": "object",
        "properties": {
          "role": {
            "enum": [
              "system",
              "user",
              "assistant",
              "tool"
            ]
          },
          "content": {
            "type": [
              "string",
              "null"
            ]
          },
          "tool_calls": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/RemoteModelToolCall"
            }
          },
          "tool_call_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "\\S"
          }
        },
        "required": [
          "role"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "role": {
                  "const": "tool"
                }
              }
            },
            "then": {
              "required": [
                "tool_call_id"
              ]
            },
            "else": {
              "not": {
                "required": [
                  "tool_call_id"
                ]
              }
            }
          },
          {
            "if": {
              "properties": {
                "role": {
                  "const": "assistant"
                }
              }
            },
            "then": {
              "anyOf": [
                {
                  "required": [
                    "content"
                  ],
                  "properties": {
                    "content": {
                      "type": "string"
                    }
                  }
                },
                {
                  "required": [
                    "tool_calls"
                  ],
                  "properties": {
                    "tool_calls": {
                      "minItems": 1
                    }
                  }
                }
              ]
            },
            "else": {
              "required": [
                "content"
              ],
              "properties": {
                "content": {
                  "type": "string"
                }
              },
              "not": {
                "required": [
                  "tool_calls"
                ]
              }
            }
          }
        ]
      },
      "RemoteModelRequest": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "const": "1.0"
          },
          "invocationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "\\S"
          },
          "deadline": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9223372036854776000,
            "description": "绝对 UTC 毫秒；回调最多等待 60 秒"
          },
          "purpose": {
            "enum": [
              "BUSINESS",
              "SYNTHETIC_PROBE"
            ]
          },
          "appId": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "subjectId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "\\S"
          },
          "tenantId": {
            "type": "string"
          },
          "runId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "\\S"
          },
          "traceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "\\S"
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "\\S"
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/RemoteModelMessage"
            }
          },
          "tools": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "type": "object"
            }
          },
          "max_completion_tokens": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000000
          },
          "stream": {
            "type": "boolean"
          },
          "response_format": {
            "type": "object"
          },
          "tool_choice": {
            "description": "合成探测或受控模型请求中的工具选择"
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
          },
          "top_p": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9223372036854776000
          }
        },
        "required": [
          "protocolVersion",
          "invocationId",
          "deadline",
          "purpose",
          "appId",
          "model",
          "messages",
          "max_completion_tokens",
          "stream"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "purpose": {
                  "const": "BUSINESS"
                }
              }
            },
            "then": {
              "required": [
                "subjectId",
                "tenantId",
                "runId",
                "traceId"
              ]
            },
            "else": {
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "subjectId"
                    ]
                  },
                  {
                    "required": [
                      "tenantId"
                    ]
                  },
                  {
                    "required": [
                      "runId"
                    ]
                  },
                  {
                    "required": [
                      "traceId"
                    ]
                  }
                ]
              }
            }
          }
        ],
        "description": "REMOTE 1.0 回调；平台出站认证，SDK 独立凭据与消费应用白名单验证。JSON 正文最大 1 MiB；身份来自平台授权。"
      },
      "RemoteModelResponse": {
        "type": "object",
        "properties": {
          "message": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RemoteModelMessage"
              },
              {
                "properties": {
                  "role": {
                    "const": "assistant"
                  }
                }
              }
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/RemoteModelUsage"
          }
        },
        "required": [
          "message",
          "usage"
        ],
        "additionalProperties": false
      },
      "RemoteModelTextDelta": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "const": "1.0"
          },
          "type": {
            "const": "text.delta"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "protocolVersion",
          "type",
          "text"
        ],
        "additionalProperties": false
      },
      "RemoteModelToolDelta": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "const": "1.0"
          },
          "type": {
            "const": "tool.delta"
          },
          "index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "\\S"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "\\S"
          },
          "arguments": {
            "type": "string"
          }
        },
        "required": [
          "protocolVersion",
          "type",
          "index"
        ],
        "additionalProperties": false,
        "anyOf": [
          {
            "required": [
              "id"
            ]
          },
          {
            "required": [
              "name"
            ]
          },
          {
            "required": [
              "arguments"
            ]
          }
        ]
      },
      "RemoteModelUsageDelta": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "const": "1.0"
          },
          "type": {
            "const": "usage"
          },
          "usage": {
            "$ref": "#/components/schemas/RemoteModelUsage"
          }
        },
        "required": [
          "protocolVersion",
          "type",
          "usage"
        ],
        "additionalProperties": false
      },
      "RemoteModelCompleted": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "const": "1.0"
          },
          "type": {
            "const": "model.completed"
          },
          "finishReason": {
            "enum": [
              "STOP",
              "TOOL_CALLS",
              "LENGTH"
            ]
          }
        },
        "required": [
          "protocolVersion",
          "type",
          "finishReason"
        ],
        "additionalProperties": false
      },
      "RemoteModelError": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "const": "1.0"
          },
          "type": {
            "const": "model.error"
          },
          "code": {
            "enum": [
              "MODEL_UNAVAILABLE",
              "MODEL_TIMED_OUT",
              "MODEL_RATE_LIMITED",
              "MODEL_AUTH_FAILED",
              "MODEL_REQUEST_REJECTED",
              "MODEL_FEATURE_UNSUPPORTED",
              "MODEL_PROTOCOL_ERROR"
            ]
          }
        },
        "required": [
          "protocolVersion",
          "type",
          "code"
        ],
        "additionalProperties": false
      },
      "RemoteModelStreamFrame": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/RemoteModelTextDelta"
          },
          {
            "$ref": "#/components/schemas/RemoteModelToolDelta"
          },
          {
            "$ref": "#/components/schemas/RemoteModelUsageDelta"
          },
          {
            "$ref": "#/components/schemas/RemoteModelCompleted"
          },
          {
            "$ref": "#/components/schemas/RemoteModelError"
          }
        ],
        "description": "每个 JSON 对象为一条 data: SSE 帧；必须明确终结，拒绝 [DONE]、未知帧/字段、重复终结和截断。最大 4 MiB；工具参数拼接后必须是闭合 JSON 对象。"
      },
      "RemoteModelFailure": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "enum": [
                  "MODEL_UNAVAILABLE",
                  "MODEL_TIMED_OUT",
                  "MODEL_RATE_LIMITED",
                  "MODEL_AUTH_FAILED",
                  "MODEL_REQUEST_REJECTED",
                  "MODEL_FEATURE_UNSUPPORTED",
                  "MODEL_PROTOCOL_ERROR"
                ]
              }
            },
            "required": [
              "code"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "description": "REMOTE 非 2xx 的受控错误合同；平台优先读取代码，错误正文不进入用户事件。协议/认证错误不因 HTTP 5xx 变成可重试故障。"
      },
      "QuotaPolicy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "scope": {
            "type": "string",
            "enum": [
              "APP",
              "TENANT",
              "USER",
              "MODEL"
            ]
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "default": "*",
            "description": "USER 通配按可信 tenantId/subjectId 分桶；MODEL 为 scope/models/id@version 或 *"
          },
          "period": {
            "type": "string",
            "enum": [
              "MINUTE",
              "HOUR",
              "DAY",
              "MONTH"
            ],
            "description": "UTC 固定窗口，多条规则同时生效"
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "maxAmount": {
            "type": "string",
            "pattern": "^[0-9]{1,13}(\\.[0-9]{1,12})?$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "unknownPriceMode": {
            "type": "string",
            "enum": [
              "REJECT",
              "SEPARATE"
            ],
            "description": "金额规则必须 REJECT；SEPARATE 必须另设未知价请求额度，不能带 maxAmount"
          },
          "maxConcurrentRuns": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000000
          },
          "maxRunRequests": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000000
          },
          "maxConcurrentModels": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000000
          },
          "maxModelRequests": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000000
          },
          "maxTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000000
          },
          "maxUnpricedRequests": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000000
          }
        },
        "required": [
          "id",
          "scope",
          "period"
        ],
        "additionalProperties": false,
        "description": "至少一个上限；零代表禁止。MODEL 不接受 Run 上限，币种须与模型价目一致。已有策略范围/周期/币种不可修改。token/金额预留要求 capabilities.contextWindow，计量以完整终结回执或对账为准。"
      },
      "QuotaConfigurationRequest": {
        "type": "object",
        "properties": {
          "policies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuotaPolicy"
            },
            "maxItems": 64
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          }
        },
        "required": [
          "policies",
          "reason"
        ],
        "additionalProperties": false
      },
      "QuotaConfiguration": {
        "type": "object",
        "properties": {
          "appId": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "policies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuotaPolicy"
            }
          },
          "reason": {
            "type": "string"
          },
          "updatedAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "updatedBy": {
            "type": "string"
          }
        },
        "required": [
          "appId",
          "revision",
          "policies"
        ],
        "additionalProperties": false
      },
      "QuotaBucket": {
        "type": "object",
        "properties": {
          "periodStart": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "periodEnd": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "runRequests": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "modelRequests": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "unpricedRequests": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "heldTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "chargedTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "policyId": {
            "type": "string"
          },
          "scopeKey": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "period": {
            "type": "string",
            "enum": [
              "MINUTE",
              "HOUR",
              "DAY",
              "MONTH",
              "RUN"
            ]
          },
          "subjectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "tenantId": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "heldAmount": {
            "type": "string",
            "pattern": "^[0-9]{1,13}(\\.[0-9]{1,12})?$"
          },
          "chargedAmount": {
            "type": "string",
            "pattern": "^[0-9]{1,13}(\\.[0-9]{1,12})?$"
          },
          "runId": {
            "type": "string"
          },
          "agentCallId": {
            "type": "string"
          }
        },
        "required": [
          "periodStart",
          "periodEnd",
          "runRequests",
          "modelRequests",
          "unpricedRequests",
          "heldTokens",
          "chargedTokens",
          "id",
          "appId",
          "policyId",
          "scopeKey",
          "scope",
          "period",
          "subjectId",
          "tenantId",
          "model",
          "currency",
          "heldAmount",
          "chargedAmount"
        ],
        "additionalProperties": false,
        "description": "RUN 桶是内部根与子智能体调用额度，固定使用原始任务周期；公开策略仍只允许 UTC 分钟、小时、日、月。调用预留与应用预留原子登记，未知用量保留额度。"
      },
      "QuotaReservationPart": {
        "type": "object",
        "properties": {
          "bucketId": {
            "type": "string"
          },
          "scopeKey": {
            "type": "string"
          },
          "policyId": {
            "type": "string"
          },
          "tokenBudget": {
            "type": "boolean"
          },
          "moneyBudget": {
            "type": "boolean"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "heldTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "chargedTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "heldAmount": {
            "type": "string",
            "pattern": "^[0-9]{1,13}(\\.[0-9]{1,12})?$"
          },
          "chargedAmount": {
            "type": "string",
            "pattern": "^[0-9]{1,13}(\\.[0-9]{1,12})?$"
          }
        },
        "required": [
          "bucketId",
          "scopeKey",
          "policyId",
          "tokenBudget",
          "moneyBudget",
          "currency",
          "heldTokens",
          "chargedTokens",
          "heldAmount",
          "chargedAmount"
        ],
        "additionalProperties": false
      },
      "QuotaReservation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "probeId": {
            "type": "string"
          },
          "probeCheck": {
            "type": "string"
          },
          "purpose": {
            "type": "string",
            "enum": [
              "BUSINESS",
              "SYNTHETIC_PROBE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "HELD",
              "UNKNOWN",
              "SETTLED"
            ]
          },
          "subjectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "tenantId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "deadline": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "finishedAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "configRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "pricing": {
            "type": "object",
            "description": "固定发布模型价目；未知价为空对象"
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuotaReservationPart"
            }
          },
          "providerUsage": {
            "$ref": "#/components/schemas/ModelProviderUsage"
          },
          "billedCost": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "currency": {
                "type": "string"
              },
              "amount": {
                "type": "string",
                "pattern": "^[0-9]{1,13}(\\.[0-9]{1,12})?$"
              }
            },
            "additionalProperties": false
          },
          "usageSource": {
            "type": "string"
          },
          "reconciliationHistory": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "maxItems": 100
          }
        },
        "required": [
          "id",
          "appId",
          "runId",
          "model",
          "purpose",
          "status",
          "createdAt",
          "deadline",
          "configRevision",
          "revision",
          "pricing",
          "parts",
          "probeId",
          "probeCheck",
          "subjectId",
          "tenantId"
        ],
        "additionalProperties": false,
        "description": "BUSINESS 在模型调用账本对账；合成探测通过预留对账，仅修正预算事实，不修改探测原回执或健康结论。"
      },
      "QuotaUsagePage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuotaBucket"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "now": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "accounting": {
            "type": "string",
            "const": "CONFIGURED_PRICING_WITH_PROVIDER_RECONCILIATION"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "now",
          "accounting"
        ],
        "additionalProperties": false
      },
      "QuotaReservationPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuotaReservation"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "now": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9000000000000000
          },
          "accounting": {
            "type": "string",
            "const": "CONFIGURED_PRICING_WITH_PROVIDER_RECONCILIATION"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "now",
          "accounting"
        ],
        "additionalProperties": false
      },
      "AgentBudgetUsage": {
        "type": "object",
        "properties": {
          "steps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "toolCalls": {
            "type": "integer",
            "minimum": 0,
            "maximum": 64
          },
          "agentCalls": {
            "type": "integer",
            "minimum": 0,
            "maximum": 64
          },
          "budgetUnits": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "modelInvocationIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "uniqueItems": true,
            "maxItems": 256
          },
          "citationIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "uniqueItems": true,
            "maxItems": 256
          }
        },
        "additionalProperties": false,
        "required": [
          "steps",
          "toolCalls",
          "agentCalls",
          "budgetUnits",
          "modelInvocationIds",
          "citationIds"
        ]
      },
      "AgentResult": {
        "type": "object",
        "properties": {
          "agentCallId": {
            "type": "string",
            "minLength": 1
          },
          "parentAgentCallId": {
            "type": [
              "string",
              "null"
            ]
          },
          "depth": {
            "type": "integer",
            "minimum": 0,
            "maximum": 8
          },
          "agentId": {
            "type": "string",
            "minLength": 1
          },
          "agentVersion": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
          },
          "status": {
            "const": "SUCCEEDED"
          },
          "text": {
            "type": "string"
          },
          "output": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "const": "TEXT"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "value"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "const": "JSON"
                  },
                  "value": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "required": [
                  "type",
                  "value"
                ],
                "additionalProperties": false
              }
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/AgentBudgetUsage"
          }
        },
        "additionalProperties": false,
        "required": [
          "agentCallId",
          "parentAgentCallId",
          "depth",
          "agentId",
          "agentVersion",
          "status",
          "text",
          "output",
          "usage"
        ]
      },
      "KnowledgeFilter": {
        "type": "object",
        "properties": {
          "appId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "subjectId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "tenantId": {
            "type": "string",
            "minLength": 0,
            "maxLength": 128
          },
          "required": {
            "type": "array",
            "items": {
              "enum": [
                "TENANT",
                "SUBJECT"
              ]
            },
            "uniqueItems": true,
            "maxItems": 2
          }
        },
        "required": [
          "appId",
          "subjectId",
          "tenantId",
          "required"
        ],
        "additionalProperties": false
      },
      "KnowledgeSource": {
        "type": "object",
        "properties": {
          "type": {
            "enum": [
              "DOCUMENT",
              "URL",
              "INLINE"
            ]
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "uri": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "pattern": "^https?://"
          },
          "version": {
            "type": "string",
            "minLength": 0,
            "maxLength": 128
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "locator": {
            "type": "string",
            "minLength": 0,
            "maxLength": 512
          }
        },
        "required": [
          "type",
          "id"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "type": {
                  "const": "URL"
                }
              },
              "required": [
                "type"
              ]
            },
            "then": {
              "required": [
                "uri"
              ]
            }
          }
        ]
      },
      "KnowledgeItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9_.:-]{1,128}$"
          },
          "documentId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9_.:-]{1,128}$"
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16384
          },
          "title": {
            "type": "string",
            "minLength": 0,
            "maxLength": 512
          },
          "source": {
            "$ref": "#/components/schemas/KnowledgeSource"
          },
          "score": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "最多 4096 UTF-8 字节、嵌套深度 8；有限 JSON 值。"
          },
          "tenantId": {
            "type": "string",
            "minLength": 0,
            "maxLength": 128
          }
        },
        "required": [
          "id",
          "content",
          "source"
        ],
        "additionalProperties": false
      },
      "KnowledgeCallbackRequest": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "const": "1.0"
          },
          "appId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "subjectId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "tenantId": {
            "type": "string",
            "minLength": 0,
            "maxLength": 128
          },
          "knowledgeId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16384
          },
          "topK": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "filters": {
            "$ref": "#/components/schemas/KnowledgeFilter"
          },
          "runId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "traceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "executionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "deadline": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9223372036854776000
          },
          "trustedContext": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "protocolVersion",
          "appId",
          "subjectId",
          "tenantId",
          "knowledgeId",
          "version",
          "query",
          "topK",
          "filters",
          "runId",
          "traceId",
          "executionId",
          "deadline",
          "trustedContext"
        ],
        "additionalProperties": false
      },
      "KnowledgeCallbackResult": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "const": "1.0"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeItem"
            },
            "maxItems": 100
          },
          "appliedFilters": {
            "type": "array",
            "items": {
              "enum": [
                "TENANT",
                "SUBJECT"
              ]
            },
            "uniqueItems": true,
            "maxItems": 2
          }
        },
        "required": [
          "protocolVersion",
          "items",
          "appliedFilters"
        ],
        "additionalProperties": false,
        "description": "完整结果上限 1 MiB；id 不重复。空结果正常无匹配；必须确认定义要求的全部过滤。"
      },
      "KnowledgeCallbackError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "enum": [
                  "KNOWLEDGE_ACCESS_DENIED",
                  "KNOWLEDGE_TIMED_OUT",
                  "KNOWLEDGE_UNAVAILABLE",
                  "KNOWLEDGE_RATE_LIMITED",
                  "KNOWLEDGE_REQUEST_REJECTED",
                  "KNOWLEDGE_PROTOCOL_ERROR"
                ]
              }
            },
            "required": [
              "code"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "KnowledgeRouteRule": {
        "type": "object",
        "properties": {
          "knowledge": {
            "$ref": "#/components/schemas/Ref"
          },
          "queryTerms": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "maxItems": 16,
            "uniqueItems": true
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "maxItems": 16,
            "uniqueItems": true
          },
          "contextEquals": {
            "type": "object",
            "maxProperties": 16,
            "propertyNames": {
              "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
            },
            "additionalProperties": {
              "type": "string",
              "minLength": 0,
              "maxLength": 128
            }
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "always": {
            "type": "boolean"
          }
        },
        "required": [
          "knowledge"
        ],
        "additionalProperties": false,
        "description": "仅引用当前 Agent.allowedKnowledge 精确版本；条件需要 always=true、词项/标签或可信上下文。上下文与词项条件同时配置时共同匹配。规则来源不能重复。"
      },
      "KnowledgeRoutingPolicy": {
        "type": "object",
        "properties": {
          "mode": {
            "enum": [
              "EAGER",
              "AUTO",
              "ON_DEMAND"
            ],
            "default": "AUTO"
          },
          "failurePolicy": {
            "enum": [
              "FAIL_FAST",
              "SKIP_TRANSIENT"
            ],
            "default": "FAIL_FAST"
          },
          "rerank": {
            "enum": [
              "NONE",
              "LEXICAL"
            ],
            "default": "NONE"
          },
          "maxSources": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16
          },
          "topK": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "maxRetrievals": {
            "type": "integer",
            "minimum": 1,
            "maximum": 64
          },
          "maxQueriesPerSource": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16
          },
          "sourceTimeoutSeconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60
          },
          "sourceMaxChars": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65536
          },
          "maxContextChars": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65536
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeRouteRule"
            },
            "maxItems": 64
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "KnowledgeSelectedSource": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "reason": {
            "enum": [
              "MODEL_REQUEST",
              "EAGER",
              "RULE_ALWAYS",
              "TRUSTED_CONTEXT",
              "QUERY_MATCH",
              "TAG_MATCH",
              "DESCRIPTION_TAG_MATCH"
            ]
          }
        },
        "required": [
          "id",
          "version",
          "reason"
        ],
        "additionalProperties": false
      },
      "DocumentChunkingPolicy": {
        "type": "object",
        "properties": {
          "strategy": {
            "enum": [
              "CHARACTER",
              "PARAGRAPH",
              "MARKDOWN"
            ],
            "default": "CHARACTER"
          },
          "maxChars": {
            "type": "integer",
            "minimum": 128,
            "maximum": 8192,
            "default": 2000
          },
          "overlapChars": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096,
            "default": 0
          },
          "preserveParagraphs": {
            "type": "boolean"
          },
          "preserveCodeBlocks": {
            "type": "boolean"
          }
        },
        "required": [],
        "additionalProperties": false,
        "description": "仅 MANAGED；overlapChars <= maxChars/2，非 CHARACTER 必须为 0。段落保护默认非 CHARACTER 启用；代码保护默认仅 MARKDOWN 启用。CHARACTER 不允许段落保护，非 MARKDOWN 不允许代码保护。缺省 chunking 保留旧 2000 字符策略。"
      },
      "ManagedDocumentContent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
            "not": {
              "enum": [
                ".",
                ".."
              ]
            }
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 65536
          },
          "title": {
            "type": "string",
            "minLength": 0,
            "maxLength": 512
          },
          "source": {
            "type": "string",
            "minLength": 0,
            "maxLength": 2048
          },
          "tenantId": {
            "type": "string",
            "minLength": 0,
            "maxLength": 128
          }
        },
        "required": [
          "id",
          "text"
        ],
        "additionalProperties": false
      },
      "ManagedDocumentImport": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
            "not": {
              "enum": [
                ".",
                ".."
              ]
            }
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 65536
          },
          "title": {
            "type": "string",
            "minLength": 0,
            "maxLength": 512
          },
          "source": {
            "type": "string",
            "minLength": 0,
            "maxLength": 2048
          },
          "tenantId": {
            "type": "string",
            "minLength": 0,
            "maxLength": 128
          },
          "duplicatePolicy": {
            "enum": [
              "UPSERT",
              "SKIP",
              "REJECT"
            ],
            "default": "UPSERT"
          },
          "expectedDocumentVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "id",
          "text"
        ],
        "additionalProperties": false
      },
      "ManagedDocumentResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
            "not": {
              "enum": [
                ".",
                ".."
              ]
            }
          },
          "status": {
            "enum": [
              "INDEXED",
              "UNCHANGED",
              "SKIPPED"
            ]
          },
          "chunkCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 512
          },
          "documentVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "contentHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "chunkingHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "id",
          "status",
          "chunkCount",
          "documentVersion",
          "contentHash",
          "chunkingHash"
        ],
        "additionalProperties": false
      },
      "ManagedDocumentBatchItem": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ManagedDocumentResult"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 0,
                "maxLength": 128
              },
              "status": {
                "const": "FAILED"
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "status",
              "error"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
                "not": {
                  "enum": [
                    ".",
                    ".."
                  ]
                }
              },
              "status": {
                "const": "NOT_IMPORTED"
              },
              "chunkCount": {
                "type": "integer"
              },
              "documentVersion": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "contentHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "chunkingHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "id",
              "status",
              "chunkCount",
              "documentVersion",
              "contentHash",
              "chunkingHash"
            ],
            "additionalProperties": false
          }
        ]
      },
      "ManagedDocumentBatchResult": {
        "type": "object",
        "properties": {
          "atomic": {
            "type": "boolean"
          },
          "status": {
            "enum": [
              "SUCCEEDED",
              "PARTIAL",
              "REJECTED"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedDocumentBatchItem"
            },
            "minItems": 1,
            "maxItems": 25
          },
          "indexed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25
          },
          "unchanged": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25
          },
          "skipped": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25
          },
          "failed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25
          }
        },
        "required": [
          "atomic",
          "status",
          "items",
          "indexed",
          "unchanged",
          "skipped",
          "failed"
        ],
        "additionalProperties": false
      },
      "ManagedDocumentBatchRequest": {
        "type": "object",
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedDocumentImport"
            },
            "minItems": 1,
            "maxItems": 25
          },
          "atomic": {
            "type": "boolean",
            "default": true
          },
          "duplicatePolicy": {
            "enum": [
              "UPSERT",
              "SKIP",
              "REJECT"
            ],
            "default": "UPSERT"
          }
        },
        "required": [
          "documents"
        ],
        "additionalProperties": false,
        "description": "唯一文档 ID，正文总计 <= 1048576 UTF-16 字符；atomic 默认 true，失败有明细且零写入；false 每条独立事务。document 中 duplicatePolicy 可覆盖批次策略。"
      },
      "ManagedDocumentRebuildRequest": {
        "type": "object",
        "properties": {
          "sourceVersion": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$",
            "maxLength": 64
          },
          "documentIds": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
              "not": {
                "enum": [
                  ".",
                  ".."
                ]
              }
            },
            "minItems": 1,
            "maxItems": 25,
            "uniqueItems": true
          },
          "atomic": {
            "type": "boolean",
            "default": true
          },
          "duplicatePolicy": {
            "enum": [
              "UPSERT",
              "SKIP",
              "REJECT"
            ],
            "default": "UPSERT"
          }
        },
        "required": [
          "sourceVersion",
          "documentIds"
        ],
        "additionalProperties": false,
        "description": "源必须同一资源不同的 PUBLISHED MANAGED 版本，目标 DRAFT；逐个文档检查租户与 ACL；不返回正文，不自动发布。"
      },
      "ManagedDocumentChunkPreview": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8192
          },
          "startOffset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65536
          },
          "endOffset": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65536
          }
        },
        "required": [
          "text",
          "startOffset",
          "endOffset"
        ],
        "additionalProperties": false
      },
      "ManagedDocumentPreview": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
            "not": {
              "enum": [
                ".",
                ".."
              ]
            }
          },
          "documentVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "chunkingHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "chunking": {
            "$ref": "#/components/schemas/DocumentChunkingPolicy",
            "description": "空对象表示未声明分块配置的旧策略。显式配置的预览返回完整有效参数。"
          },
          "chunkCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 512
          },
          "chunks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedDocumentChunkPreview"
            },
            "minItems": 1,
            "maxItems": 2048
          }
        },
        "required": [
          "id",
          "documentVersion",
          "chunkingHash",
          "chunking",
          "chunkCount",
          "chunks"
        ],
        "additionalProperties": false
      },
      "ManagedDocumentSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
            "not": {
              "enum": [
                ".",
                ".."
              ]
            }
          },
          "status": {
            "enum": [
              "INDEXED",
              "UNCHANGED",
              "SKIPPED"
            ]
          },
          "chunkCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 512
          },
          "documentVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "contentHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "chunkingHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "title": {
            "type": "string",
            "minLength": 0,
            "maxLength": 512
          },
          "source": {
            "type": "string",
            "minLength": 0,
            "maxLength": 2048
          },
          "tenantId": {
            "type": "string",
            "minLength": 0,
            "maxLength": 128
          },
          "chunking": {
            "type": "object"
          },
          "rebuildSource": {
            "$ref": "#/components/schemas/Ref"
          },
          "ingestion": {
            "$ref": "#/components/schemas/IngestionFile"
          }
        },
        "required": [
          "id",
          "status",
          "chunkCount",
          "documentVersion",
          "contentHash",
          "chunkingHash"
        ],
        "additionalProperties": false
      },
      "CitationVerification": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 128
          },
          "status": {
            "enum": [
              "VERIFIED",
              "UNVERIFIED"
            ]
          }
        },
        "required": [
          "id",
          "status"
        ],
        "additionalProperties": false,
        "description": "仅核验当前检索来源编号，不证明回答事实正确；空编号为 UNVERIFIED。"
      },
      "CitationPreview": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "knowledgeId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "knowledgeVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "documentId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "chunkId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "title": {
            "type": "string",
            "maxLength": 512
          },
          "sourceRef": {
            "$ref": "#/components/schemas/KnowledgeSource"
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16384
          },
          "scope": {
            "const": "RETRIEVED_EXCERPT"
          }
        },
        "required": [
          "id",
          "knowledgeId",
          "knowledgeVersion",
          "documentId",
          "chunkId",
          "title",
          "sourceRef",
          "content",
          "scope"
        ],
        "additionalProperties": false,
        "description": "当前身份从精确发布版本重读并验证的历史检索片段；URI 不会被自动访问；远程业务源变更或拒绝不回退旧正文。"
      },
      "DocumentUploadMetadata": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9_.-]{1,128}$"
          },
          "title": {
            "type": "string",
            "maxLength": 512
          },
          "source": {
            "type": "string",
            "maxLength": 2048
          },
          "tenantId": {
            "type": "string",
            "maxLength": 128,
            "description": "Default trusted credential tenant; application administrators cannot select another tenant"
          },
          "duplicatePolicy": {
            "type": "string",
            "enum": [
              "UPSERT",
              "SKIP",
              "REJECT"
            ],
            "default": "UPSERT"
          },
          "expectedDocumentVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "documentId"
        ],
        "additionalProperties": false
      },
      "IngestionFile": {
        "type": "object",
        "properties": {
          "jobId": {
            "type": "string",
            "maxLength": 128
          },
          "originalHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "knowledgeVersion": {
            "type": "string",
            "maxLength": 64
          },
          "filename": {
            "type": "string",
            "maxLength": 255
          },
          "format": {
            "type": "string",
            "enum": [
              "txt",
              "md",
              "pdf",
              "docx",
              "xlsx",
              "pptx",
              "png",
              "jpg",
              "jpeg"
            ]
          },
          "pageCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          }
        },
        "required": [
          "jobId",
          "originalHash",
          "knowledgeVersion",
          "filename",
          "format",
          "pageCount"
        ],
        "additionalProperties": false
      },
      "IngestionJob": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 128
          },
          "appId": {
            "type": "string",
            "maxLength": 64
          },
          "knowledgeId": {
            "type": "string",
            "maxLength": 64
          },
          "knowledgeVersion": {
            "type": "string",
            "maxLength": 64
          },
          "documentId": {
            "type": "string",
            "maxLength": 128
          },
          "filename": {
            "type": "string",
            "maxLength": 255
          },
          "format": {
            "type": "string",
            "maxLength": 8
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4194304
          },
          "originalHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "title": {
            "type": "string",
            "maxLength": 512
          },
          "source": {
            "type": "string",
            "maxLength": 2048
          },
          "tenantId": {
            "type": "string",
            "maxLength": 128
          },
          "duplicatePolicy": {
            "type": "string",
            "enum": [
              "UPSERT",
              "SKIP",
              "REJECT"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "QUEUED",
              "PARSING",
              "INDEXING",
              "SUCCEEDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "createdAt": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "integer"
          },
          "result": {
            "$ref": "#/components/schemas/ManagedDocumentResult"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "maxLength": 128
              },
              "message": {
                "type": "string",
                "maxLength": 256
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          },
          "parsedDocumentVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Canonical parsed candidate version; SKIPPED result may retain a different indexed version"
          },
          "parsedContentHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "pageCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          }
        },
        "required": [
          "id",
          "appId",
          "knowledgeId",
          "knowledgeVersion",
          "documentId",
          "filename",
          "format",
          "sizeBytes",
          "originalHash",
          "title",
          "source",
          "tenantId",
          "duplicatePolicy",
          "status",
          "revision",
          "attempt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "IngestionPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IngestionJob"
            },
            "maxItems": 100
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      },
      "KnowledgeDebugRequest": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "maxLength": 512,
            "minLength": 1
          },
          "topK": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20,
            "default": 5
          }
        },
        "required": [
          "query"
        ],
        "additionalProperties": false
      },
      "KnowledgeIndexSnapshot": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "maxLength": 64
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "PUBLISHED"
            ]
          },
          "definitionHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "indexVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "visibleDocumentCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "visibleChunkCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "visibleIndexConsistent": {
            "type": "boolean"
          },
          "knowledgeAccessEpoch": {
            "type": "integer",
            "minimum": 0
          },
          "securityEpoch": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "algorithm": {
            "type": "string",
            "enum": [
              "LEXICAL_TERMS_V1",
              "COSINE_V1",
              "RRF_LEXICAL_COSINE_V1"
            ]
          },
          "vectorReady": {
            "type": "boolean"
          },
          "vectorIndexHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "indexedChunkCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "spaceHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "dimensions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2048
          }
        },
        "required": [
          "version",
          "status",
          "definitionHash",
          "indexVersion",
          "visibleDocumentCount",
          "visibleChunkCount",
          "visibleIndexConsistent",
          "knowledgeAccessEpoch",
          "securityEpoch"
        ],
        "additionalProperties": false
      },
      "KnowledgeDebugHit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 160
          },
          "documentId": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
            "not": {
              "enum": [
                ".",
                ".."
              ]
            }
          },
          "title": {
            "type": "string",
            "maxLength": 512
          },
          "source": {
            "type": "string",
            "maxLength": 2048
          },
          "tenantId": {
            "type": "string",
            "maxLength": 128
          },
          "text": {
            "type": "string",
            "maxLength": 8192,
            "minLength": 1
          },
          "startOffset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65536
          },
          "endOffset": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65536
          },
          "documentVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "sourceRef": {
            "$ref": "#/components/schemas/KnowledgeSource"
          },
          "rank": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "score": {
            "type": "number",
            "minimum": -1
          }
        },
        "required": [
          "id",
          "documentId",
          "text",
          "rank",
          "score"
        ],
        "additionalProperties": false,
        "description": "Old stored chunks may omit source metadata and UTF-16 offsets; the platform supplies parent document identity but does not invent provenance."
      },
      "KnowledgeDebugResult": {
        "type": "object",
        "properties": {
          "algorithm": {
            "type": "string",
            "enum": [
              "LEXICAL_TERMS_V1",
              "COSINE_V1",
              "RRF_LEXICAL_COSINE_V1"
            ]
          },
          "query": {
            "type": "string",
            "maxLength": 512
          },
          "topK": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "knowledgeId": {
            "type": "string",
            "maxLength": 64
          },
          "index": {
            "$ref": "#/components/schemas/KnowledgeIndexSnapshot"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeDebugHit"
            },
            "minItems": 0,
            "maxItems": 20
          },
          "elapsedMs": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "algorithm",
          "query",
          "topK",
          "knowledgeId",
          "index",
          "items",
          "elapsedMs"
        ],
        "additionalProperties": false
      },
      "KnowledgeEvaluationInputCase": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "maxLength": 512,
            "minLength": 1
          },
          "expectedDocumentIds": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
              "not": {
                "enum": [
                  ".",
                  ".."
                ]
              }
            },
            "minItems": 1,
            "maxItems": 20,
            "uniqueItems": true
          }
        },
        "required": [
          "query",
          "expectedDocumentIds"
        ],
        "additionalProperties": false
      },
      "KnowledgeEvaluationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1
          },
          "versions": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
            },
            "minItems": 1,
            "maxItems": 2,
            "uniqueItems": true
          },
          "topK": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20,
            "default": 5
          },
          "cases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeEvaluationInputCase"
            },
            "minItems": 1,
            "maxItems": 10
          }
        },
        "required": [
          "name",
          "versions",
          "cases"
        ],
        "additionalProperties": false
      },
      "KnowledgeEvaluationHit": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
            "not": {
              "enum": [
                ".",
                ".."
              ]
            }
          },
          "chunkId": {
            "type": "string",
            "maxLength": 160
          },
          "rank": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "score": {
            "type": "number",
            "minimum": -1
          }
        },
        "required": [
          "documentId",
          "chunkId",
          "rank",
          "score"
        ],
        "additionalProperties": false
      },
      "KnowledgeEvaluationCaseResult": {
        "type": "object",
        "properties": {
          "caseIndex": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9
          },
          "hits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeEvaluationHit"
            },
            "minItems": 0,
            "maxItems": 20
          },
          "recallAtK": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "reciprocalRank": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "hit": {
            "type": "boolean"
          }
        },
        "required": [
          "caseIndex",
          "hits",
          "recallAtK",
          "reciprocalRank",
          "hit"
        ],
        "additionalProperties": false
      },
      "KnowledgeEvaluationVersionResult": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "maxLength": 64
          },
          "indexVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "cases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeEvaluationCaseResult"
            },
            "minItems": 1,
            "maxItems": 10
          },
          "recallAtK": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "mrrAtK": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "hitRateAtK": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "algorithm": {
            "type": "string",
            "enum": [
              "LEXICAL_TERMS_V1",
              "COSINE_V1",
              "RRF_LEXICAL_COSINE_V1"
            ]
          },
          "vectorIndexHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "version",
          "indexVersion",
          "cases",
          "recallAtK",
          "mrrAtK",
          "hitRateAtK"
        ],
        "additionalProperties": false
      },
      "KnowledgeEvaluationSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^evaluation_[a-f0-9-]{36}$"
          },
          "name": {
            "type": "string",
            "maxLength": 128
          },
          "algorithm": {
            "type": "string",
            "enum": [
              "LEXICAL_TERMS_V1",
              "VERSIONED_RETRIEVAL_V1"
            ]
          },
          "topK": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "versions": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "minItems": 1,
            "maxItems": 2
          },
          "createdAt": {
            "type": "integer",
            "minimum": 0
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "elapsedMs": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "name",
          "algorithm",
          "topK",
          "versions",
          "createdAt",
          "revision",
          "elapsedMs"
        ],
        "additionalProperties": false
      },
      "KnowledgeEvaluation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^evaluation_[a-f0-9-]{36}$"
          },
          "name": {
            "type": "string",
            "maxLength": 128
          },
          "algorithm": {
            "type": "string",
            "enum": [
              "LEXICAL_TERMS_V1",
              "VERSIONED_RETRIEVAL_V1"
            ]
          },
          "topK": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "versions": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "minItems": 1,
            "maxItems": 2
          },
          "createdAt": {
            "type": "integer",
            "minimum": 0
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "elapsedMs": {
            "type": "integer",
            "minimum": 0
          },
          "appId": {
            "type": "string",
            "maxLength": 64
          },
          "knowledgeId": {
            "type": "string",
            "maxLength": 64
          },
          "subjectId": {
            "type": "string",
            "maxLength": 128
          },
          "tenantId": {
            "type": "string",
            "maxLength": 128
          },
          "inputCases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeEvaluationInputCase"
            },
            "minItems": 1,
            "maxItems": 10
          },
          "indexes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeIndexSnapshot"
            },
            "minItems": 1,
            "maxItems": 2
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeEvaluationVersionResult"
            },
            "minItems": 1,
            "maxItems": 2
          },
          "status": {
            "type": "string",
            "enum": [
              "CURRENT",
              "STALE"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "algorithm",
          "topK",
          "versions",
          "createdAt",
          "revision",
          "elapsedMs",
          "appId",
          "knowledgeId",
          "subjectId",
          "tenantId",
          "inputCases",
          "indexes",
          "results",
          "status"
        ],
        "additionalProperties": false
      },
      "KnowledgeEvaluationPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeEvaluationSummary"
            },
            "minItems": 0,
            "maxItems": 20
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      },
      "EmbeddingConfiguration": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "model": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1
          },
          "spaceVersion": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_.-]{1,128}$"
          },
          "dimensions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2048
          },
          "secretRef": {
            "type": "string",
            "maxLength": 128
          },
          "sendDimensions": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "endpoint",
          "model",
          "spaceVersion",
          "dimensions"
        ],
        "additionalProperties": false
      },
      "KnowledgeRetrieval": {
        "type": "object",
        "properties": {
          "strategy": {
            "enum": [
              "LEXICAL",
              "VECTOR",
              "HYBRID"
            ]
          },
          "embedding": {
            "$ref": "#/components/schemas/EmbeddingConfiguration"
          },
          "minScore": {
            "type": "number",
            "minimum": -1,
            "maximum": 1,
            "default": 0
          }
        },
        "required": [
          "strategy"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "strategy": {
                  "const": "LEXICAL"
                }
              },
              "required": [
                "strategy"
              ]
            },
            "then": {
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "embedding"
                    ]
                  },
                  {
                    "required": [
                      "minScore"
                    ]
                  }
                ]
              }
            },
            "else": {
              "required": [
                "embedding"
              ]
            }
          }
        ]
      },
      "VectorIndexHealth": {
        "type": "object",
        "properties": {
          "algorithm": {
            "type": "string",
            "enum": [
              "LEXICAL_TERMS_V1",
              "COSINE_V1",
              "RRF_LEXICAL_COSINE_V1"
            ]
          },
          "vectorReady": {
            "type": "boolean"
          },
          "vectorIndexHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "indexedChunkCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "spaceHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "dimensions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2048
          },
          "visibleDocumentCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "visibleChunkCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          }
        },
        "required": [
          "algorithm",
          "vectorReady",
          "vectorIndexHash",
          "indexedChunkCount"
        ],
        "additionalProperties": false
      },
      "VectorBuildRequest": {
        "type": "object",
        "properties": {
          "documentIds": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.-]{1,128}$",
              "not": {
                "enum": [
                  ".",
                  ".."
                ]
              }
            },
            "minItems": 1,
            "maxItems": 512,
            "uniqueItems": true
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "VectorBuildJob": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^vector_[a-f0-9-]{36}$"
          },
          "appId": {
            "type": "string",
            "maxLength": 64
          },
          "knowledgeId": {
            "type": "string",
            "maxLength": 64
          },
          "knowledgeVersion": {
            "type": "string",
            "maxLength": 64
          },
          "status": {
            "enum": [
              "QUEUED",
              "BUILDING",
              "SUCCEEDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "createdAt": {
            "type": "integer",
            "minimum": 0
          },
          "updatedAt": {
            "type": "integer",
            "minimum": 0
          },
          "attempt": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "spaceHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "documentCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 512
          },
          "chunkCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 512
          },
          "completedChunks": {
            "type": "integer",
            "minimum": 0,
            "maximum": 512
          },
          "deadline": {
            "type": "integer",
            "minimum": 0
          },
          "result": {
            "$ref": "#/components/schemas/VectorIndexHealth"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "maxLength": 128
              },
              "message": {
                "type": "string",
                "maxLength": 512
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "appId",
          "knowledgeId",
          "knowledgeVersion",
          "status",
          "revision",
          "createdAt",
          "updatedAt",
          "attempt",
          "spaceHash",
          "documentCount",
          "chunkCount",
          "completedChunks"
        ],
        "additionalProperties": false
      },
      "VectorBuildPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VectorBuildJob"
            },
            "minItems": 0,
            "maxItems": 20
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      },
      "AuditQuery": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "maxLength": 256,
            "minLength": 1
          },
          "subjectId": {
            "type": "string",
            "maxLength": 256,
            "minLength": 1
          },
          "tenantId": {
            "type": "string",
            "maxLength": 256
          },
          "runId": {
            "type": "string",
            "maxLength": 256,
            "minLength": 1
          },
          "executionId": {
            "type": "string",
            "maxLength": 256,
            "minLength": 1
          },
          "from": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "to": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "default": 50
          },
          "cursor": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "pattern": "^[A-Za-z0-9_-]+$"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "AuditRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "subjectId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "target": {
            "type": "string"
          },
          "outcome": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "traceId": {
            "type": "string"
          },
          "executionId": {
            "type": "string"
          },
          "policyBasis": {
            "type": "string"
          },
          "createdAt": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "formatVersion": {
            "type": "string",
            "enum": [
              "1.0"
            ]
          },
          "beforeHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "afterHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "inputHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "resultHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "reasonHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "evidenceHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "previousRevision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recordCount": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cutoff": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "snapshotPosition": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "policyDecision": {
            "type": "object",
            "properties": {
              "decisionId": {
                "type": "string"
              },
              "providerDecisionId": {
                "type": "string"
              },
              "resource": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "requiredPermissionsHash": {
                "type": "string"
              },
              "argumentsHash": {
                "type": "string"
              }
            },
            "required": [],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "createdAt",
          "appId",
          "subjectId",
          "action",
          "target"
        ],
        "additionalProperties": true,
        "description": "Legacy fields remain absent when never recorded; no identity inference. Added details contain identifiers and digests, never source arguments or prompts."
      },
      "AuditSnapshot": {
        "type": "object",
        "properties": {
          "position": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "filterHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "position",
          "epoch",
          "filterHash"
        ],
        "additionalProperties": false
      },
      "AuditPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/AuditRecord"
            }
          },
          "nextCursor": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 2048,
                "pattern": "^[A-Za-z0-9_-]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "snapshot": {
            "$ref": "#/components/schemas/AuditSnapshot"
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "redacted": {
            "type": "boolean"
          },
          "redactionRevision": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "nextCursor",
          "snapshot",
          "total",
          "limit"
        ],
        "additionalProperties": false
      },
      "AuditExport": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/AuditRecord"
            }
          },
          "nextCursor": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 2048,
                "pattern": "^[A-Za-z0-9_-]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "snapshot": {
            "$ref": "#/components/schemas/AuditSnapshot"
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "formatVersion": {
            "type": "string",
            "enum": [
              "1.0"
            ]
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "exportedAt": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "redacted": {
            "type": "boolean"
          },
          "redactionRevision": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "nextCursor",
          "snapshot",
          "total",
          "limit",
          "formatVersion",
          "sha256",
          "exportedAt"
        ],
        "additionalProperties": false,
        "description": "At most 1000 records and 2 MiB of record bodies per file. sha256 is canonical JSON record digest, not a tamper-proof signature. nextCursor traverses the fixed snapshot."
      },
      "AuditRetentionPlan": {
        "type": "object",
        "properties": {
          "before": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "default": 100
          },
          "snapshotPosition": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "required": [
          "before",
          "limit",
          "snapshotPosition",
          "epoch"
        ],
        "additionalProperties": false
      },
      "AuditRetentionPreviewRequest": {
        "type": "object",
        "properties": {
          "before": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "default": 100
          }
        },
        "required": [
          "before"
        ],
        "additionalProperties": false,
        "description": "Platform administrator only; cutoff at least seven days before now. Retention is disabled by default and never automatic."
      },
      "AuditRetentionPreview": {
        "type": "object",
        "properties": {
          "before": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "default": 100
          },
          "snapshotPosition": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "selected": {
            "type": "integer",
            "minimum": 0,
            "maximum": 500
          },
          "recordsHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "planHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "before",
          "limit",
          "snapshotPosition",
          "epoch",
          "selected",
          "recordsHash",
          "planHash"
        ],
        "additionalProperties": false
      },
      "AuditRetentionApply": {
        "type": "object",
        "properties": {
          "plan": {
            "$ref": "#/components/schemas/AuditRetentionPlan"
          },
          "planHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "confirmation": {
            "type": "string",
            "enum": [
              "DELETE_EXPIRED_AUDIT"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          }
        },
        "required": [
          "plan",
          "planHash",
          "confirmation",
          "reason"
        ],
        "additionalProperties": false
      },
      "AuditRetentionReceipt": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "integer",
            "minimum": 0,
            "maximum": 500
          },
          "planHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "epoch": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "required": [
          "deleted",
          "planHash",
          "epoch"
        ],
        "additionalProperties": false
      },
      "ObservationSpan": {
        "type": "object",
        "description": "抽样元数据，无用户、租户、业务正文、参数及凭据；非完整审计。",
        "properties": {
          "traceId": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "spanId": {
            "type": "string",
            "pattern": "^[0-9a-f]{16}$"
          },
          "parentSpanId": {
            "type": "string",
            "description": "根 HTTP 上游可为空；对应节点可能只在外部 Collector 中。"
          },
          "operation": {
            "type": "string",
            "enum": [
              "run",
              "resolve",
              "context",
              "authorization",
              "agent",
              "subagent",
              "model",
              "tool",
              "knowledge",
              "confirmation"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "OK",
              "ERROR"
            ]
          },
          "startedAt": {
            "type": "integer"
          },
          "finishedAt": {
            "type": "integer"
          },
          "durationMs": {
            "type": "number",
            "minimum": 0
          },
          "attributes": {
            "type": "object",
            "properties": {
              "runId": {
                "type": "string"
              },
              "resourceKind": {
                "type": "string"
              },
              "resourceId": {
                "type": "string"
              },
              "resourceVersion": {
                "type": "string"
              }
            },
            "required": [
              "runId"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "traceId",
          "spanId",
          "parentSpanId",
          "operation",
          "outcome",
          "startedAt",
          "finishedAt",
          "durationMs",
          "attributes"
        ],
        "additionalProperties": false
      },
      "RunTrace": {
        "type": "object",
        "description": "异步保存；rootRecorded 仅表示终态 Span 已采集，不保证没有丢弃子节点。旧 Run、未抽样、到期或容量丢弃可能为空。",
        "properties": {
          "runId": {
            "type": "string"
          },
          "traceId": {
            "type": "string"
          },
          "recorded": {
            "type": "boolean"
          },
          "sampled": {
            "type": "boolean"
          },
          "rootRecorded": {
            "type": "boolean"
          },
          "retentionHours": {
            "type": "integer"
          },
          "maxSpans": {
            "type": "integer",
            "const": 512
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObservationSpan"
            }
          }
        },
        "required": [
          "runId",
          "traceId",
          "recorded",
          "sampled",
          "rootRecorded",
          "retentionHours",
          "maxSpans",
          "items"
        ],
        "additionalProperties": false
      },
      "ObservationOperation": {
        "type": "object",
        "description": "",
        "properties": {
          "operation": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "OK",
              "ERROR"
            ]
          },
          "count": {
            "type": "integer",
            "minimum": 1
          },
          "averageMs": {
            "type": "number",
            "minimum": 0
          },
          "maximumMs": {
            "type": "number",
            "minimum": 0
          },
          "p95UpperBoundMs": {
            "type": [
              "number",
              "null"
            ],
            "description": "固定桶估算的 P95 上界；超过 600000ms 返回 null。"
          }
        },
        "required": [
          "operation",
          "outcome",
          "count",
          "averageMs",
          "maximumMs",
          "p95UpperBoundMs"
        ],
        "additionalProperties": false
      },
      "ObservationSummary": {
        "type": "object",
        "description": "窗口基于保留的抽样 Span；不是完整业务请求总数。",
        "properties": {
          "windowHours": {
            "type": "integer",
            "minimum": 1,
            "maximum": 168
          },
          "from": {
            "type": "integer"
          },
          "samplePercent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "retentionHours": {
            "type": "integer"
          },
          "basis": {
            "type": "string",
            "const": "RETAINED_SAMPLED_SPANS"
          },
          "operations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObservationOperation"
            }
          },
          "activeRuns": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          }
        },
        "required": [
          "windowHours",
          "from",
          "samplePercent",
          "retentionHours",
          "basis",
          "operations",
          "activeRuns"
        ],
        "additionalProperties": false
      },
      "ObservationStatus": {
        "type": "object",
        "description": "仅平台管理员。进程内计数重启归零；不返回 Collector 地址和凭据。",
        "properties": {
          "exportConfigured": {
            "type": "boolean"
          },
          "queueSize": {
            "type": "integer"
          },
          "queueCapacity": {
            "type": "integer",
            "const": 256
          },
          "storageQueueSize": {
            "type": "integer"
          },
          "storageQueueCapacity": {
            "type": "integer",
            "const": 1024
          },
          "samplePercent": {
            "type": "integer"
          },
          "retentionHours": {
            "type": "integer"
          },
          "spanCapacity": {
            "type": "integer"
          },
          "processStartedAt": {
            "type": "integer"
          },
          "counters": {
            "type": "object",
            "description": "",
            "properties": {
              "span_dropped": {
                "type": "integer",
                "minimum": 0
              },
              "export_dropped": {
                "type": "integer",
                "minimum": 0
              },
              "export_failed": {
                "type": "integer",
                "minimum": 0
              },
              "export_rejected": {
                "type": "integer",
                "minimum": 0
              },
              "exported": {
                "type": "integer",
                "minimum": 0
              },
              "http_rejected": {
                "type": "integer",
                "minimum": 0
              },
              "quota_rejected": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "span_dropped",
              "export_dropped",
              "export_failed",
              "export_rejected",
              "exported",
              "http_rejected",
              "quota_rejected"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "exportConfigured",
          "queueSize",
          "queueCapacity",
          "storageQueueSize",
          "storageQueueCapacity",
          "samplePercent",
          "retentionHours",
          "spanCapacity",
          "processStartedAt",
          "counters"
        ],
        "additionalProperties": false
      },
      "AlertTransition": {
        "type": "object",
        "required": [
          "state",
          "at"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "FIRING",
              "ACKNOWLEDGED",
              "RESOLVED"
            ]
          },
          "at": {
            "type": "integer"
          },
          "value": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "AlertRuleInput": {
        "type": "object",
        "required": [
          "id",
          "source",
          "severity",
          "threshold",
          "windowSeconds",
          "staleSeconds",
          "description",
          "enabled",
          "inhibitedBy"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "source": {
            "type": "string",
            "enum": [
              "PROVIDER_CIRCUIT",
              "RUN_FAILURE",
              "CONFIRMATION_STUCK",
              "RUN_NO_TERMINAL",
              "UNKNOWN_WRITE",
              "QUOTA_UNKNOWN",
              "HTTP_REJECTION",
              "BUDGET_EXHAUSTED"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "INFO",
              "WARNING",
              "CRITICAL"
            ]
          },
          "threshold": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "windowSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400
          },
          "staleSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400
          },
          "description": {
            "type": "string",
            "pattern": "\\S",
            "minLength": 1,
            "maxLength": 256
          },
          "enabled": {
            "type": "boolean"
          },
          "inhibitedBy": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "AlertRule": {
        "type": "object",
        "required": [
          "id",
          "appId",
          "source",
          "severity",
          "threshold",
          "windowSeconds",
          "staleSeconds",
          "description",
          "enabled",
          "inhibitedBy",
          "revision",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "appId": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "PROVIDER_CIRCUIT",
              "RUN_FAILURE",
              "CONFIRMATION_STUCK",
              "RUN_NO_TERMINAL",
              "UNKNOWN_WRITE",
              "QUOTA_UNKNOWN",
              "HTTP_REJECTION",
              "BUDGET_EXHAUSTED"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "INFO",
              "WARNING",
              "CRITICAL"
            ]
          },
          "threshold": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "windowSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400
          },
          "staleSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400
          },
          "description": {
            "type": "string",
            "maxLength": 256
          },
          "enabled": {
            "type": "boolean"
          },
          "inhibitedBy": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "createdAt": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "AlertRuleList": {
        "type": "object",
        "required": [
          "appId",
          "items"
        ],
        "properties": {
          "appId": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AlertRule"
            }
          }
        },
        "additionalProperties": false
      },
      "AlertRuleDeletion": {
        "type": "object",
        "required": [
          "id",
          "deleted"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "AlertInstance": {
        "type": "object",
        "required": [
          "id",
          "dedupKey",
          "ruleId",
          "appId",
          "source",
          "severity",
          "state",
          "target",
          "value",
          "threshold",
          "firstFiredAt",
          "lastFiredAt",
          "fireCount",
          "revision",
          "updatedAt",
          "transitions"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "dedupKey": {
            "type": "string"
          },
          "ruleId": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "PROVIDER_CIRCUIT",
              "RUN_FAILURE",
              "CONFIRMATION_STUCK",
              "RUN_NO_TERMINAL",
              "UNKNOWN_WRITE",
              "QUOTA_UNKNOWN",
              "HTTP_REJECTION",
              "BUDGET_EXHAUSTED"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "INFO",
              "WARNING",
              "CRITICAL"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "FIRING",
              "ACKNOWLEDGED",
              "RESOLVED"
            ]
          },
          "target": {
            "type": "string"
          },
          "value": {
            "type": "integer"
          },
          "threshold": {
            "type": "integer"
          },
          "firstFiredAt": {
            "type": "integer"
          },
          "lastFiredAt": {
            "type": "integer"
          },
          "fireCount": {
            "type": "integer",
            "minimum": 1
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "resolvedAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "acknowledgedAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "acknowledgedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "ackReason": {
            "type": "string"
          },
          "resolvedBy": {
            "type": "string"
          },
          "resolveReason": {
            "type": "string"
          },
          "manualResolved": {
            "type": "boolean"
          },
          "inhibitedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastNotifiedAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "updatedAt": {
            "type": "integer"
          },
          "transitions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AlertTransition"
            }
          }
        },
        "additionalProperties": false
      },
      "AlertPage": {
        "type": "object",
        "required": [
          "appId",
          "items",
          "total",
          "limit",
          "offset"
        ],
        "properties": {
          "appId": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AlertInstance"
            }
          },
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "PlatformAlertPage": {
        "type": "object",
        "required": [
          "items",
          "total",
          "byState",
          "limit",
          "offset"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AlertInstance"
            }
          },
          "total": {
            "type": "integer"
          },
          "byState": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "AlertEvaluation": {
        "type": "object",
        "required": [
          "evaluatedAt",
          "rules",
          "results"
        ],
        "properties": {
          "evaluatedAt": {
            "type": "integer"
          },
          "rules": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "ruleId",
                "outcome",
                "value"
              ],
              "properties": {
                "ruleId": {
                  "type": "string"
                },
                "outcome": {
                  "type": "string",
                  "enum": [
                    "FIRED",
                    "REFIRED",
                    "INHIBITED",
                    "DEDUPLICATED",
                    "RESOLVED",
                    "NO_CHANGE",
                    "DROPPED_CAPACITY",
                    "INHIBITION_CLEARED"
                  ]
                },
                "value": {
                  "type": "integer"
                },
                "alertId": {
                  "type": "string"
                },
                "state": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      },
      "AlertTransitionReason": {
        "type": "object",
        "required": [
          "reason"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "pattern": "\\S",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "additionalProperties": false
      },
      "OpsCheck": {
        "type": "object",
        "required": [
          "id",
          "category",
          "critical",
          "ready",
          "detail"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "DEPENDENCY",
              "EXTERNAL",
              "RUNTIME"
            ]
          },
          "critical": {
            "type": "boolean"
          },
          "ready": {
            "type": "boolean"
          },
          "detail": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "OpsStatus": {
        "type": "object",
        "required": [
          "liveness",
          "readiness",
          "degraded",
          "generatedAt",
          "checks",
          "alerts",
          "alertEngine",
          "alertSignals",
          "basis"
        ],
        "properties": {
          "liveness": {
            "type": "string",
            "enum": [
              "UP"
            ]
          },
          "readiness": {
            "type": "string",
            "enum": [
              "READY",
              "NOT_READY"
            ]
          },
          "degraded": {
            "type": "boolean"
          },
          "generatedAt": {
            "type": "integer"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OpsCheck"
            }
          },
          "alerts": {
            "type": "object",
            "required": [
              "firing",
              "acknowledged"
            ],
            "properties": {
              "firing": {
                "type": "integer"
              },
              "acknowledged": {
                "type": "integer"
              }
            },
            "additionalProperties": false
          },
          "alertEngine": {
            "type": "object",
            "required": [
              "webhookConfigured",
              "pendingDeliveries",
              "failedDeliveries",
              "deliveredDeliveries",
              "deliveryAttemptsMax",
              "capacity",
              "autoEvaluate",
              "evaluationIntervalSeconds",
              "evaluations",
              "lastEvaluationAt",
              "counters"
            ],
            "properties": {
              "webhookConfigured": {
                "type": "boolean"
              },
              "pendingDeliveries": {
                "type": "integer"
              },
              "failedDeliveries": {
                "type": "integer"
              },
              "deliveredDeliveries": {
                "type": "integer"
              },
              "deliveryAttemptsMax": {
                "type": "integer",
                "minimum": 1,
                "maximum": 20
              },
              "deliveryLeaseSeconds": {
                "type": "integer",
                "minimum": 5,
                "maximum": 600
              },
              "capacity": {
                "type": "integer"
              },
              "autoEvaluate": {
                "type": "boolean"
              },
              "evaluationIntervalSeconds": {
                "type": "integer"
              },
              "evaluations": {
                "type": "integer"
              },
              "lastEvaluationAt": {
                "type": "integer"
              },
              "counters": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer"
                }
              }
            },
            "additionalProperties": false
          },
          "alertSignals": {
            "$ref": "#/components/schemas/AlertSignalStatus"
          },
          "basis": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "EvalAssertions": {
        "type": "object",
        "properties": {
          "expectedTools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "forbiddenTools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "mustContain": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "mustNotContain": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expectRefusal": {
            "type": "boolean"
          },
          "minCitations": {
            "type": "integer",
            "minimum": 0,
            "maximum": 64
          },
          "maxCost": {
            "type": "number",
            "minimum": 0
          },
          "maxLatencyMs": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600000
          }
        },
        "additionalProperties": false
      },
      "EvalCase": {
        "type": "object",
        "required": [
          "id",
          "message",
          "assertions"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16384
          },
          "assertions": {
            "$ref": "#/components/schemas/EvalAssertions"
          }
        },
        "additionalProperties": false
      },
      "EvalDatasetInput": {
        "type": "object",
        "required": [
          "id",
          "agentId",
          "description",
          "subjectId",
          "tenantId",
          "cases"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "agentId": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "subjectId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "tenantId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/EvalCase"
            }
          }
        },
        "additionalProperties": false
      },
      "EvalDataset": {
        "type": "object",
        "required": [
          "id",
          "appId",
          "agentId",
          "description",
          "subjectId",
          "tenantId",
          "cases",
          "revision",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "subjectId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "cases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvalCase"
            }
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "createdAt": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "EvalDatasetList": {
        "type": "object",
        "required": [
          "appId",
          "items"
        ],
        "properties": {
          "appId": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvalDataset"
            }
          }
        },
        "additionalProperties": false
      },
      "EvalAssertionResult": {
        "type": "object",
        "required": [
          "kind",
          "ok",
          "detail"
        ],
        "properties": {
          "kind": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "detail": {
            "type": "string"
          },
          "expected": {
            "type": [
              "string",
              "integer",
              "number",
              "boolean",
              "null"
            ]
          },
          "actual": {
            "type": [
              "string",
              "integer",
              "number",
              "boolean",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "EvalCaseResult": {
        "type": "object",
        "required": [
          "caseId",
          "outcome",
          "assertions",
          "ruleScore"
        ],
        "properties": {
          "caseId": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "PASSED",
              "FAILED",
              "ERROR"
            ]
          },
          "status": {
            "type": "string"
          },
          "assertions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvalAssertionResult"
            }
          },
          "ruleScore": {
            "type": "number"
          },
          "cost": {
            "type": [
              "number",
              "null"
            ]
          },
          "latencyMs": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "manualScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "manualNote": {
            "type": "string"
          },
          "manualBy": {
            "type": "string"
          },
          "manualAt": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "EvalSummary": {
        "type": "object",
        "required": [
          "total",
          "passed",
          "failed",
          "errors",
          "ruleScore",
          "manualScored",
          "manualAverage"
        ],
        "properties": {
          "total": {
            "type": "integer"
          },
          "passed": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "errors": {
            "type": "integer"
          },
          "ruleScore": {
            "type": "number"
          },
          "manualScored": {
            "type": "integer"
          },
          "manualAverage": {
            "type": [
              "number",
              "null"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "EvalRunStart": {
        "type": "object",
        "required": [
          "datasetId",
          "agentVersion"
        ],
        "properties": {
          "datasetId": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "agentVersion": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
          }
        },
        "additionalProperties": false
      },
      "EvalManualScore": {
        "type": "object",
        "required": [
          "score",
          "note"
        ],
        "properties": {
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "additionalProperties": false
      },
      "EvalRun": {
        "type": "object",
        "required": [
          "id",
          "appId",
          "datasetId",
          "agentId",
          "agentVersion",
          "state",
          "createdAt",
          "cases",
          "summary"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "datasetId": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "agentVersion": {
            "type": "string"
          },
          "subjectId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "QUEUED",
              "RUNNING",
              "SUCCEEDED",
              "FAILED"
            ]
          },
          "createdAt": {
            "type": "integer"
          },
          "finishedAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "cases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvalCaseResult"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/EvalSummary"
          },
          "revision": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "EvalRunPage": {
        "type": "object",
        "required": [
          "appId",
          "items",
          "total",
          "limit",
          "offset"
        ],
        "properties": {
          "appId": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvalRun"
            }
          },
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "EvaluationEngineStatus": {
        "type": "object",
        "required": [
          "queueSize",
          "queueCapacity",
          "caseTimeoutSeconds",
          "counters"
        ],
        "properties": {
          "queueSize": {
            "type": "integer"
          },
          "queueCapacity": {
            "type": "integer"
          },
          "caseTimeoutSeconds": {
            "type": "integer"
          },
          "counters": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          }
        },
        "additionalProperties": false
      },
      "EvaluationGate": {
        "type": "object",
        "required": [
          "enabled",
          "datasetId"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "datasetId": {
            "type": "string",
            "maxLength": 64
          }
        },
        "additionalProperties": false
      },
      "AlertSignalStatus": {
        "type": "object",
        "required": [
          "pendingKeys",
          "maxKeys",
          "flushSeconds",
          "retentionHours",
          "flushed",
          "dropped",
          "lastFlushAt"
        ],
        "properties": {
          "pendingKeys": {
            "type": "integer"
          },
          "maxKeys": {
            "type": "integer"
          },
          "flushSeconds": {
            "type": "integer"
          },
          "retentionHours": {
            "type": "integer"
          },
          "flushed": {
            "type": "integer"
          },
          "dropped": {
            "type": "integer"
          },
          "lastFlushAt": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "RetentionPolicyCategory": {
        "type": "object",
        "required": [
          "enabled",
          "days",
          "requireArchived"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3650
          },
          "requireArchived": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "RetentionCategoryView": {
        "type": "object",
        "required": [
          "label",
          "enabled",
          "days",
          "requireArchived",
          "eligible",
          "note"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "days": {
            "type": "integer"
          },
          "requireArchived": {
            "type": "boolean"
          },
          "eligible": {
            "type": "integer"
          },
          "note": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "RetentionAutoSweep": {
        "type": "object",
        "required": [
          "enabled",
          "intervalMinutes"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "intervalMinutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1440
          }
        },
        "additionalProperties": false
      },
      "RetentionCategories": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "RUN_EVENTS",
          "RUN_CONFIRMATIONS",
          "ALERT_DELIVERIES",
          "ALERTS_RESOLVED",
          "AUDIT",
          "ARCHIVES"
        ],
        "properties": {
          "RUN_EVENTS": {
            "$ref": "#/components/schemas/RetentionPolicyCategory"
          },
          "RUN_CONFIRMATIONS": {
            "$ref": "#/components/schemas/RetentionPolicyCategory"
          },
          "ALERT_DELIVERIES": {
            "$ref": "#/components/schemas/RetentionPolicyCategory"
          },
          "ALERTS_RESOLVED": {
            "$ref": "#/components/schemas/RetentionPolicyCategory"
          },
          "AUDIT": {
            "$ref": "#/components/schemas/RetentionPolicyCategory"
          },
          "ARCHIVES": {
            "$ref": "#/components/schemas/RetentionPolicyCategory"
          }
        }
      },
      "RetentionPreviewCategories": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "RUN_EVENTS",
          "RUN_CONFIRMATIONS",
          "ALERT_DELIVERIES",
          "ALERTS_RESOLVED",
          "AUDIT",
          "ARCHIVES"
        ],
        "properties": {
          "RUN_EVENTS": {
            "$ref": "#/components/schemas/RetentionCategoryView"
          },
          "RUN_CONFIRMATIONS": {
            "$ref": "#/components/schemas/RetentionCategoryView"
          },
          "ALERT_DELIVERIES": {
            "$ref": "#/components/schemas/RetentionCategoryView"
          },
          "ALERTS_RESOLVED": {
            "$ref": "#/components/schemas/RetentionCategoryView"
          },
          "AUDIT": {
            "$ref": "#/components/schemas/RetentionCategoryView"
          },
          "ARCHIVES": {
            "$ref": "#/components/schemas/RetentionCategoryView"
          }
        }
      },
      "RetentionPolicyInput": {
        "type": "object",
        "required": [
          "autoSweep",
          "categories",
          "reason"
        ],
        "properties": {
          "autoSweep": {
            "$ref": "#/components/schemas/RetentionAutoSweep"
          },
          "categories": {
            "$ref": "#/components/schemas/RetentionCategories"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "additionalProperties": false
      },
      "RetentionPolicy": {
        "type": "object",
        "required": [
          "id",
          "revision",
          "autoSweep",
          "categories"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "revision": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "integer"
          },
          "updatedBy": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "autoSweep": {
            "$ref": "#/components/schemas/RetentionAutoSweep"
          },
          "categories": {
            "$ref": "#/components/schemas/RetentionCategories"
          }
        },
        "additionalProperties": false
      },
      "RetentionSweepRequest": {
        "type": "object",
        "properties": {
          "dryRun": {
            "type": "boolean"
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          }
        },
        "additionalProperties": false
      },
      "RetentionSweepResult": {
        "type": "object",
        "required": [
          "sweptAt",
          "trigger",
          "limit",
          "deleted"
        ],
        "properties": {
          "sweptAt": {
            "type": "integer"
          },
          "trigger": {
            "type": "string",
            "enum": [
              "自动清理",
              "管理员手动清理"
            ]
          },
          "limit": {
            "type": "integer"
          },
          "deleted": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "dryRun": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "RetentionPreview": {
        "type": "object",
        "required": [
          "revision",
          "autoSweep",
          "categories",
          "lastSweepAt",
          "lastSweep",
          "counters"
        ],
        "properties": {
          "revision": {
            "type": "integer"
          },
          "autoSweep": {
            "$ref": "#/components/schemas/RetentionAutoSweep"
          },
          "categories": {
            "$ref": "#/components/schemas/RetentionPreviewCategories"
          },
          "lastSweepAt": {
            "type": "integer"
          },
          "lastSweep": {
            "type": "object",
            "additionalProperties": true
          },
          "counters": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          }
        },
        "additionalProperties": false
      },
      "RetentionStatus": {
        "type": "object",
        "required": [
          "revision",
          "autoSweep",
          "lastSweepAt",
          "lastSweep",
          "configuredCategories",
          "counters"
        ],
        "properties": {
          "revision": {
            "type": "integer"
          },
          "autoSweep": {
            "$ref": "#/components/schemas/RetentionAutoSweep"
          },
          "lastSweepAt": {
            "type": "integer"
          },
          "lastSweep": {
            "type": "object",
            "additionalProperties": true
          },
          "configuredCategories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "counters": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          }
        },
        "additionalProperties": false
      },
      "RedactionPattern": {
        "type": "object",
        "required": [
          "id",
          "regex",
          "replacement"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,63}$"
          },
          "regex": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "replacement": {
            "type": "string",
            "maxLength": 128
          }
        },
        "additionalProperties": false
      },
      "RedactionPolicyInput": {
        "type": "object",
        "required": [
          "enabled",
          "mode",
          "token",
          "appliesTo",
          "fields",
          "patterns",
          "reason"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "mode": {
            "type": "string",
            "enum": [
              "TOKEN",
              "HASH"
            ]
          },
          "token": {
            "type": "string",
            "maxLength": 32
          },
          "appliesTo": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "AUDIT",
                "ARCHIVES"
              ]
            }
          },
          "fields": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,63}$"
            }
          },
          "patterns": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/RedactionPattern"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "additionalProperties": false
      },
      "RedactionPolicy": {
        "type": "object",
        "required": [
          "id",
          "revision",
          "enabled",
          "mode",
          "token",
          "appliesTo",
          "fields",
          "patterns"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "revision": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "integer"
          },
          "updatedBy": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "mode": {
            "type": "string",
            "enum": [
              "TOKEN",
              "HASH"
            ]
          },
          "token": {
            "type": "string"
          },
          "appliesTo": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "patterns": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RedactionPattern"
            }
          }
        },
        "additionalProperties": false
      },
      "RedactionStatus": {
        "type": "object",
        "required": [
          "revision",
          "enabled",
          "mode",
          "appliesTo",
          "fieldCount",
          "patternCount"
        ],
        "properties": {
          "revision": {
            "type": "integer"
          },
          "enabled": {
            "type": "boolean"
          },
          "mode": {
            "type": "string"
          },
          "appliesTo": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fieldCount": {
            "type": "integer"
          },
          "patternCount": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "RedactionPreviewRequest": {
        "type": "object",
        "required": [
          "sample"
        ],
        "properties": {
          "sample": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "RedactionPreview": {
        "type": "object",
        "required": [
          "applied",
          "sample"
        ],
        "properties": {
          "applied": {
            "type": "boolean"
          },
          "mode": {
            "type": "string"
          },
          "revision": {
            "type": "integer"
          },
          "changed": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "sample": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "RetentionSweepPreview": {
        "type": "object",
        "required": [
          "dryRun",
          "preview"
        ],
        "properties": {
          "dryRun": {
            "const": true
          },
          "preview": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "EvaluationGateReport": {
        "type": "object",
        "required": [
          "enabled",
          "datasetId",
          "applies",
          "checked"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "datasetId": {
            "type": "string"
          },
          "applies": {
            "type": "boolean"
          },
          "checked": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "passed": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ConversationSummary": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "maxLength": 128,
            "description": "空字符串表示未命名会话。"
          },
          "createdAt": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "integer"
          },
          "messageCount": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "title",
          "createdAt",
          "updatedAt",
          "messageCount"
        ]
      },
      "ConversationPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConversationSummary"
            }
          },
          "nextOffset": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "nextOffset"
        ]
      },
      "ConversationRename": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "required": [
          "title"
        ]
      },
      "ConversationDeletion": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "deleted"
        ]
      }
    }
  },
  "x-sparktide-knowledge-callback": {
    "protocolVersion": "1.0",
    "request": {
      "$ref": "#/components/schemas/KnowledgeCallbackRequest"
    },
    "response": {
      "$ref": "#/components/schemas/KnowledgeCallbackResult"
    },
    "error": {
      "$ref": "#/components/schemas/KnowledgeCallbackError"
    },
    "legacy": "No callbackProtocolVersion uses documents/text/source strings."
  }
}
