{
  "openapi": "3.1.0",
  "info": {
    "title": "Promptfoo Local Server API",
    "version": "latest",
    "description": "OpenAPI document generated from the shared Zod DTO schemas used by the Promptfoo local server and web UI."
  },
  "servers": [{ "url": "http://localhost:15500", "description": "Default local Promptfoo server" }],
  "components": { "schemas": {}, "parameters": {} },
  "paths": {
    "/api/openapi.json": {
      "get": {
        "operationId": "getOpenApiDocument",
        "tags": ["Server"],
        "summary": "Get the installed local server API specification",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": { "schema": { "type": "object", "additionalProperties": {} } }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "getHealth",
        "tags": ["Health"],
        "summary": "Check local server health",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "status": { "type": "string" }, "version": { "type": "string" } },
                  "required": ["status", "version"]
                }
              }
            }
          }
        }
      }
    },
    "/api/remote-health": {
      "get": {
        "operationId": "getRemoteHealth",
        "tags": ["Health"],
        "summary": "Check remote generation health",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "status": { "type": "string" }, "message": { "type": "string" } },
                  "required": ["status", "message"]
                }
              }
            }
          }
        }
      }
    },
    "/api/results": {
      "get": {
        "operationId": "listResults",
        "tags": ["Results"],
        "summary": "List evaluation result summaries",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": false,
            "name": "datasetId",
            "in": "query"
          },
          {
            "schema": { "type": "string", "enum": ["redteam", "eval"] },
            "required": false,
            "name": "type",
            "in": "query"
          },
          {
            "schema": { "oneOf": [{ "type": "boolean" }, { "type": "string" }] },
            "required": false,
            "name": "includeProviders",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": { "type": "object", "additionalProperties": {} }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/results/{id}": {
      "get": {
        "operationId": "getResult",
        "tags": ["Results"],
        "summary": "Get one evaluation result",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": { "schema": { "type": "object", "properties": { "data": {} } } }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Result not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/prompts": {
      "get": {
        "operationId": "listPrompts",
        "tags": ["Prompts"],
        "summary": "List known prompts",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "data": { "type": "array", "items": {} } },
                  "required": ["data"]
                }
              }
            }
          }
        }
      }
    },
    "/api/history": {
      "get": {
        "operationId": "listHistory",
        "tags": ["Results"],
        "summary": "List standalone evaluation history",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": false,
            "name": "tagName",
            "in": "query"
          },
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": false,
            "name": "tagValue",
            "in": "query"
          },
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": false,
            "name": "description",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "data": { "type": "array", "items": {} } },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/prompts/{sha256hash}": {
      "get": {
        "operationId": "getPromptByHash",
        "tags": ["Prompts"],
        "summary": "Get prompts for a test-case hash",
        "parameters": [
          {
            "schema": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
            "required": true,
            "name": "sha256hash",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "data": { "type": "array", "items": {} } },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/datasets": {
      "get": {
        "operationId": "listDatasets",
        "tags": ["Datasets"],
        "summary": "List known datasets",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "data": { "type": "array", "items": {} } },
                  "required": ["data"]
                }
              }
            }
          }
        }
      }
    },
    "/api/results/share/check-domain": {
      "get": {
        "operationId": "checkShareDomain",
        "tags": ["Sharing"],
        "summary": "Check where an evaluation will be shared",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": { "type": "string" },
                    "isCloudEnabled": { "type": "boolean" }
                  },
                  "required": ["domain", "isCloudEnabled"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/results/share": {
      "post": {
        "operationId": "shareResult",
        "tags": ["Sharing"],
        "summary": "Create a shareable evaluation URL",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": { "id": { "type": "string", "minLength": 1 } },
                "required": ["id"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "url": { "type": ["string", "null"] } }
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/dataset/generate": {
      "post": {
        "operationId": "generateDataset",
        "tags": ["Datasets"],
        "summary": "Generate synthetic dataset rows",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompts": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        { "type": "string" },
                        {
                          "type": "object",
                          "properties": {
                            "raw": { "type": "string" },
                            "label": { "type": "string" }
                          },
                          "required": ["raw"],
                          "additionalProperties": {}
                        }
                      ]
                    },
                    "minItems": 1
                  },
                  "tests": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": { "vars": { "type": "object", "additionalProperties": {} } },
                      "additionalProperties": {}
                    },
                    "default": []
                  }
                },
                "required": ["prompts"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": { "type": "object", "properties": { "results": {} } }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/telemetry": {
      "post": {
        "operationId": "recordTelemetry",
        "tags": ["Telemetry"],
        "summary": "Record a web UI telemetry event",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "enum": [
                      "assertion_used",
                      "command_used",
                      "eval setup",
                      "eval_ran",
                      "feature_used",
                      "funnel",
                      "redteam discover",
                      "redteam generate",
                      "redteam init",
                      "redteam poison",
                      "redteam report",
                      "redteam run",
                      "redteam setup",
                      "webui_action",
                      "webui_api",
                      "webui_page_view"
                    ]
                  },
                  "packageVersion": { "type": "string" },
                  "properties": {
                    "type": "object",
                    "additionalProperties": {
                      "oneOf": [
                        { "type": "string" },
                        { "type": "number" },
                        { "type": "boolean" },
                        { "type": "array", "items": { "type": "string" } }
                      ]
                    }
                  }
                },
                "required": ["event", "properties"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "success": { "type": "boolean", "enum": [true] } },
                  "required": ["success"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/configs": {
      "get": {
        "operationId": "listConfigs",
        "tags": ["Configs"],
        "summary": "List stored configs",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": false,
            "name": "type",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "configs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": { "type": "string" },
                          "name": { "type": "string" },
                          "createdAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                          "updatedAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                          "type": { "type": "string" }
                        },
                        "required": ["id", "name", "createdAt", "updatedAt", "type"]
                      }
                    }
                  },
                  "required": ["configs"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createConfig",
        "tags": ["Configs"],
        "summary": "Create a stored config",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": { "type": "string", "minLength": 1 },
                  "type": { "type": "string", "minLength": 1 },
                  "config": {}
                },
                "required": ["name", "type", "config"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": { "type": "string" },
                    "createdAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] }
                  },
                  "required": ["id", "createdAt"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/configs/{type}": {
      "get": {
        "operationId": "listConfigsByType",
        "tags": ["Configs"],
        "summary": "List stored configs by type",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "type",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "configs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": { "type": "string" },
                          "name": { "type": "string" },
                          "createdAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                          "updatedAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] }
                        },
                        "required": ["id", "name", "createdAt", "updatedAt"]
                      }
                    }
                  },
                  "required": ["configs"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/configs/{type}/{id}": {
      "get": {
        "operationId": "getConfig",
        "tags": ["Configs"],
        "summary": "Get a stored config",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "type",
            "in": "path"
          },
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": { "type": "string" },
                    "name": { "type": "string" },
                    "createdAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                    "updatedAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                    "type": { "type": "string" },
                    "config": {}
                  },
                  "required": ["id", "name", "createdAt", "updatedAt", "type"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Config not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/job": {
      "post": {
        "operationId": "createEvalJob",
        "tags": ["Eval"],
        "summary": "Start an evaluation job",
        "description": "Poll GET /api/eval/job/{id} with the returned ID for progress and results.",
        "requestBody": {
          "description": "Run the local echo example without an API key.",
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "prompts": ["ping"],
                "providers": ["echo"],
                "tests": [{ "assert": [{ "type": "equals", "value": "ping" }] }],
                "sharing": false
              },
              "schema": {
                "type": "object",
                "properties": {
                  "prompts": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        { "type": "string" },
                        { "type": "object", "additionalProperties": {} }
                      ]
                    }
                  },
                  "providers": {
                    "oneOf": [
                      { "type": "string" },
                      { "type": "array", "items": {} },
                      { "type": "object", "additionalProperties": {} }
                    ]
                  },
                  "tests": {
                    "oneOf": [
                      { "type": "string" },
                      { "type": "array", "items": {} },
                      {
                        "type": "object",
                        "properties": {
                          "path": { "type": "string" },
                          "config": { "type": "object", "additionalProperties": {} }
                        },
                        "required": ["path"]
                      }
                    ]
                  },
                  "sourceEvalId": { "type": "string", "minLength": 1 },
                  "sharing": {
                    "oneOf": [
                      { "type": "boolean" },
                      {
                        "type": "object",
                        "properties": {
                          "apiBaseUrl": { "type": "string" },
                          "appBaseUrl": { "type": "string" }
                        }
                      }
                    ]
                  },
                  "evaluateOptions": { "type": "object", "additionalProperties": {} }
                },
                "required": ["prompts", "providers"],
                "additionalProperties": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "id": { "type": "string", "format": "uuid" } },
                  "required": ["id"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Failed to prepare eval job",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/job/{id}": {
      "get": {
        "operationId": "getEvalJob",
        "tags": ["Eval"],
        "summary": "Get evaluation job status",
        "parameters": [
          {
            "schema": { "type": "string", "format": "uuid" },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": { "type": "string", "enum": ["in-progress"] },
                        "progress": { "type": "number" },
                        "total": { "type": "number" },
                        "logs": { "type": "array", "items": { "type": "string" } }
                      },
                      "required": ["status", "progress", "total", "logs"]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": { "type": "string", "enum": ["complete"] },
                        "result": { "type": ["object", "null"], "additionalProperties": {} },
                        "evalId": { "type": ["string", "null"] },
                        "logs": { "type": "array", "items": { "type": "string" } }
                      },
                      "required": ["status", "result", "evalId", "logs"]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": { "type": "string", "enum": ["error"] },
                        "logs": { "type": "array", "items": { "type": "string" } }
                      },
                      "required": ["status", "logs"]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Failed to load eval job",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/{id}": {
      "patch": {
        "operationId": "updateEval",
        "tags": ["Eval"],
        "summary": "Update an evaluation table or config",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "table": {
                    "type": "object",
                    "properties": {
                      "head": {
                        "type": "object",
                        "properties": {
                          "prompts": {
                            "type": "array",
                            "items": { "type": "object", "additionalProperties": {} }
                          },
                          "vars": { "type": "array", "items": { "type": "string" } }
                        },
                        "required": ["prompts", "vars"]
                      },
                      "body": {
                        "type": "array",
                        "items": { "type": "object", "additionalProperties": {} }
                      }
                    },
                    "required": ["head", "body"],
                    "additionalProperties": {}
                  },
                  "config": { "type": "object", "additionalProperties": {} }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "message": { "type": "string" } },
                  "required": ["message"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteEval",
        "tags": ["Eval"],
        "summary": "Delete one evaluation",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "message": { "type": "string" } },
                  "required": ["message"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/{id}/author": {
      "patch": {
        "operationId": "updateEvalAuthor",
        "tags": ["Eval"],
        "summary": "Update evaluation author",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": { "author": { "type": "string", "format": "email" } },
                "required": ["author"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "message": { "type": "string" } },
                  "required": ["message"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/{id}/table": {
      "get": {
        "operationId": "getEvalTable",
        "tags": ["Eval"],
        "summary": "Get evaluation table data",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": { "type": "string", "enum": ["csv", "json"] },
            "required": false,
            "name": "format",
            "in": "query"
          },
          {
            "schema": { "type": "integer", "exclusiveMinimum": 0, "default": 50 },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": { "type": ["integer", "null"], "minimum": 0, "default": 0 },
            "required": false,
            "name": "offset",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "failures",
                "different",
                "highlights",
                "errors",
                "passes",
                "user-rated"
              ],
              "default": "all"
            },
            "required": false,
            "name": "filterMode",
            "in": "query"
          },
          {
            "schema": { "type": "string", "default": "" },
            "required": false,
            "name": "search",
            "in": "query"
          },
          {
            "schema": {
              "oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
              "default": []
            },
            "required": false,
            "name": "filter",
            "in": "query"
          },
          {
            "schema": {
              "oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
              "default": []
            },
            "required": false,
            "name": "comparisonEvalIds",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Evaluation table data. `format=json` returns an exported table object and `format=csv` returns CSV.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "table": {
                          "type": "object",
                          "properties": { "head": {}, "body": {} },
                          "required": ["head", "body"],
                          "additionalProperties": {}
                        },
                        "totalCount": { "type": "number" },
                        "filteredCount": { "type": "number" },
                        "filteredMetrics": { "type": ["array", "null"], "items": {} },
                        "config": { "type": "object", "additionalProperties": {} },
                        "author": { "type": ["string", "null"] },
                        "version": { "type": "number" },
                        "id": { "type": "string" },
                        "stats": {}
                      },
                      "required": [
                        "table",
                        "totalCount",
                        "filteredCount",
                        "filteredMetrics",
                        "config",
                        "author",
                        "version",
                        "id"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "object",
                      "properties": {
                        "head": {
                          "type": "object",
                          "properties": {
                            "prompts": {
                              "type": "array",
                              "items": { "type": "object", "additionalProperties": {} }
                            },
                            "vars": { "type": "array", "items": { "type": "string" } }
                          },
                          "required": ["prompts", "vars"]
                        },
                        "body": {
                          "type": "array",
                          "items": { "type": "object", "additionalProperties": {} }
                        }
                      },
                      "required": ["head", "body"],
                      "additionalProperties": {}
                    }
                  ]
                }
              },
              "text/csv": { "schema": { "type": "string" } }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "413": {
            "description": "Evaluation table is too large",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/{id}/metadata-keys": {
      "get": {
        "operationId": "getEvalMetadataKeys",
        "tags": ["Eval"],
        "summary": "List metadata keys for an evaluation",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 3, "maxLength": 128 },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
              "default": []
            },
            "required": false,
            "name": "comparisonEvalIds",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "keys": { "type": "array", "items": { "type": "string" } } },
                  "required": ["keys"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/{id}/metadata-values": {
      "get": {
        "operationId": "getEvalMetadataValues",
        "tags": ["Eval"],
        "summary": "List metadata values for one key",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 3, "maxLength": 128 },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "key",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "values": { "type": "array", "items": { "type": "string" } } },
                  "required": ["values"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/{id}/results": {
      "post": {
        "operationId": "addEvalResults",
        "tags": ["Eval"],
        "summary": "Append results to an evaluation",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "promptIdx": { "type": "integer", "minimum": 0 },
                    "testIdx": { "type": "integer", "minimum": 0 },
                    "success": { "type": "boolean" },
                    "score": { "type": "number" }
                  },
                  "required": ["promptIdx", "testIdx", "success", "score"],
                  "additionalProperties": {}
                }
              }
            }
          }
        },
        "responses": {
          "204": { "description": "Results added" },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/replay": {
      "post": {
        "operationId": "replayEval",
        "tags": ["Eval"],
        "summary": "Replay one evaluation test",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "evaluationId": { "type": "string", "minLength": 1 },
                  "testIndex": { "type": "integer", "minimum": 0 },
                  "prompt": { "type": "string", "minLength": 1 },
                  "variables": { "type": "object", "additionalProperties": {} }
                },
                "required": ["evaluationId", "prompt"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "output": { "type": "string" },
                    "error": { "type": ["string", "null"] },
                    "response": { "type": "object", "additionalProperties": {} }
                  },
                  "required": ["output"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/{evalId}/results/{id}/rating": {
      "post": {
        "operationId": "submitEvalResultRating",
        "tags": ["Eval"],
        "summary": "Submit a rating for one result",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "evalId",
            "in": "path"
          },
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": { "pass": { "type": "boolean" }, "score": { "type": "number" } },
                "required": ["pass", "score"],
                "additionalProperties": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": { "type": "string" },
                    "success": { "type": "boolean" },
                    "score": { "type": "number" }
                  },
                  "required": ["id", "success", "score"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Result or evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval": {
      "post": {
        "operationId": "saveEval",
        "tags": ["Eval"],
        "summary": "Save an evaluation result",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "object",
                    "properties": {
                      "results": { "type": "object", "additionalProperties": {} },
                      "config": { "type": "object", "additionalProperties": {} }
                    },
                    "required": ["results", "config"],
                    "additionalProperties": {}
                  },
                  "config": { "type": "object", "additionalProperties": {} },
                  "prompts": {
                    "type": "array",
                    "items": { "type": "object", "additionalProperties": {} }
                  },
                  "results": {
                    "type": "array",
                    "items": { "type": "object", "additionalProperties": {} }
                  },
                  "author": { "type": ["string", "null"] },
                  "createdAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                  "vars": { "type": "array", "items": { "type": "string" } }
                },
                "additionalProperties": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "id": { "type": "string" } },
                  "required": ["id"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "bulkDeleteEvals",
        "tags": ["Eval"],
        "summary": "Delete multiple evaluations",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": { "type": "string", "minLength": 1 },
                    "minItems": 1
                  }
                },
                "required": ["ids"]
              }
            }
          }
        },
        "responses": {
          "204": { "description": "Evaluations deleted" },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/eval/{id}/copy": {
      "post": {
        "operationId": "copyEval",
        "tags": ["Eval"],
        "summary": "Copy an evaluation",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": { "type": "object", "properties": { "description": { "type": "string" } } }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Evaluation copied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": { "type": "string" },
                    "distinctTestCount": { "type": "number" }
                  },
                  "required": ["id", "distinctTestCount"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Evaluation not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/media/stats": {
      "get": {
        "operationId": "getMediaStats",
        "tags": ["Media"],
        "summary": "Get media storage stats",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean", "enum": [true] },
                    "data": {
                      "type": "object",
                      "properties": { "providerId": { "type": "string" } },
                      "required": ["providerId"],
                      "additionalProperties": {}
                    }
                  },
                  "required": ["success", "data"]
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/media/info/{type}/{filename}": {
      "get": {
        "operationId": "getMediaInfo",
        "tags": ["Media"],
        "summary": "Get media file metadata",
        "parameters": [
          {
            "schema": { "type": "string", "enum": ["audio", "image", "video", "blob"] },
            "required": true,
            "name": "type",
            "in": "path"
          },
          {
            "schema": {
              "oneOf": [
                { "type": "string", "pattern": "^[A-Fa-f0-9]{12}\\.[A-Za-z0-9]+$" },
                { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" }
              ],
              "description": "Full SHA256 for blob; 12-character hash plus extension for legacy media"
            },
            "required": true,
            "description": "Full SHA256 for blob; 12-character hash plus extension for legacy media",
            "name": "filename",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean", "enum": [true] },
                    "data": {
                      "type": "object",
                      "properties": {
                        "key": { "type": "string" },
                        "exists": { "type": "boolean", "enum": [true] },
                        "url": { "type": ["string", "null"] }
                      },
                      "required": ["key", "exists", "url"]
                    }
                  },
                  "required": ["success", "data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Media not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/media/{type}/{filename}": {
      "get": {
        "operationId": "getMedia",
        "tags": ["Media"],
        "summary": "Fetch media file bytes",
        "parameters": [
          {
            "schema": { "type": "string", "enum": ["audio", "image", "video", "blob"] },
            "required": true,
            "name": "type",
            "in": "path"
          },
          {
            "schema": {
              "oneOf": [
                { "type": "string", "pattern": "^[A-Fa-f0-9]{12}\\.[A-Za-z0-9]+$" },
                { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" }
              ],
              "description": "Full SHA256 for blob; 12-character hash plus extension for legacy media"
            },
            "required": true,
            "description": "Full SHA256 for blob; 12-character hash plus extension for legacy media",
            "name": "filename",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Media bytes",
            "content": {
              "application/octet-stream": { "schema": { "type": "string", "format": "binary" } }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Media not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/model-audit/check-installed": {
      "get": {
        "operationId": "checkModelAuditInstalled",
        "tags": ["Model Audit"],
        "summary": "Check whether ModelAudit is installed",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "installed": { "type": "boolean" },
                    "version": { "type": ["string", "null"] },
                    "cwd": { "type": "string" }
                  },
                  "required": ["installed", "version", "cwd"]
                }
              }
            }
          }
        }
      }
    },
    "/api/model-audit/scanners": {
      "get": {
        "operationId": "listModelAuditScanners",
        "tags": ["Model Audit"],
        "summary": "List available ModelAudit scanners",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "scanners": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": { "type": "string" },
                          "class": { "type": "string", "default": "" },
                          "description": { "type": "string", "default": "" },
                          "extensions": {
                            "type": "array",
                            "items": { "type": "string" },
                            "default": []
                          },
                          "dependencies": {
                            "type": "array",
                            "items": { "type": "string" },
                            "default": []
                          }
                        },
                        "required": ["id"],
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": ["scanners"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/model-audit/check-path": {
      "post": {
        "operationId": "checkModelAuditPath",
        "tags": ["Model Audit"],
        "summary": "Check whether a filesystem path exists",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": { "path": { "type": "string", "minLength": 1 } },
                "required": ["path"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "exists": { "type": "boolean", "enum": [false] },
                        "type": { "type": "null" }
                      },
                      "required": ["exists", "type"]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "exists": { "type": "boolean", "enum": [true] },
                        "type": { "type": "string", "enum": ["directory", "file"] },
                        "absolutePath": { "type": "string" },
                        "name": { "type": "string" }
                      },
                      "required": ["exists", "type", "absolutePath", "name"]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/model-audit/scan": {
      "post": {
        "operationId": "runModelAuditScan",
        "tags": ["Model Audit"],
        "summary": "Run a ModelAudit scan",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paths": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
                  "options": {
                    "type": "object",
                    "properties": {
                      "blacklist": { "type": "array", "items": { "type": "string" } },
                      "timeout": { "type": "number", "minimum": 0 },
                      "maxFileSize": { "type": "string" },
                      "maxTotalSize": { "type": "string" },
                      "verbose": { "type": "boolean" },
                      "format": { "type": "string", "enum": ["text", "json", "sarif"] },
                      "strict": { "type": "boolean" },
                      "dryRun": { "type": "boolean" },
                      "cache": { "type": "boolean" },
                      "quiet": { "type": "boolean" },
                      "progress": { "type": "boolean" },
                      "sbom": { "type": "string" },
                      "output": { "type": "string" },
                      "maxSize": { "type": "string" },
                      "scanners": { "type": "array", "items": { "type": "string" } },
                      "excludeScanner": { "type": "array", "items": { "type": "string" } },
                      "persist": { "type": "boolean" },
                      "name": { "type": "string" },
                      "author": { "type": "string" }
                    },
                    "default": {}
                  }
                },
                "required": ["paths"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rawOutput": { "type": "string" },
                    "auditId": { "type": "string" },
                    "persisted": { "type": "boolean" }
                  },
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Scan failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/model-audit/scans": {
      "get": {
        "operationId": "listModelAuditScans",
        "tags": ["Model Audit"],
        "summary": "List persisted ModelAudit scans",
        "parameters": [
          {
            "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 100 },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": { "type": ["integer", "null"], "minimum": 0, "default": 0 },
            "required": false,
            "name": "offset",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "failedChecks",
                "hasErrors",
                "id",
                "modelPath",
                "name",
                "passedChecks",
                "totalChecks"
              ],
              "default": "createdAt"
            },
            "required": false,
            "name": "sort",
            "in": "query"
          },
          {
            "schema": { "type": "string", "enum": ["asc", "desc"], "default": "desc" },
            "required": false,
            "name": "order",
            "in": "query"
          },
          { "schema": { "type": "string" }, "required": false, "name": "search", "in": "query" }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "scans": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": { "type": "string" },
                          "createdAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                          "updatedAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                          "name": { "type": ["string", "null"] },
                          "author": { "type": ["string", "null"] },
                          "modelPath": { "type": "string" },
                          "modelType": { "type": ["string", "null"] },
                          "results": {},
                          "checks": {},
                          "issues": {},
                          "hasErrors": { "type": "boolean" },
                          "totalChecks": { "type": ["number", "null"] },
                          "passedChecks": { "type": ["number", "null"] },
                          "failedChecks": { "type": ["number", "null"] },
                          "metadata": {},
                          "modelId": { "type": ["string", "null"] },
                          "revisionSha": { "type": ["string", "null"] },
                          "contentHash": { "type": ["string", "null"] },
                          "modelSource": { "type": ["string", "null"] },
                          "sourceLastModified": { "type": ["number", "null"] },
                          "scannerVersion": { "type": ["string", "null"] }
                        },
                        "required": ["id", "createdAt", "updatedAt", "modelPath", "hasErrors"],
                        "additionalProperties": {}
                      }
                    },
                    "total": { "type": "number" },
                    "limit": { "type": "number" },
                    "offset": { "type": "number" }
                  },
                  "required": ["scans", "total", "limit", "offset"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/model-audit/scans/latest": {
      "get": {
        "operationId": "getLatestModelAuditScan",
        "tags": ["Model Audit"],
        "summary": "Get the latest persisted ModelAudit scan",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": { "type": "string" },
                    "createdAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                    "updatedAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                    "name": { "type": ["string", "null"] },
                    "author": { "type": ["string", "null"] },
                    "modelPath": { "type": "string" },
                    "modelType": { "type": ["string", "null"] },
                    "results": {},
                    "checks": {},
                    "issues": {},
                    "hasErrors": { "type": "boolean" },
                    "totalChecks": { "type": ["number", "null"] },
                    "passedChecks": { "type": ["number", "null"] },
                    "failedChecks": { "type": ["number", "null"] },
                    "metadata": {},
                    "modelId": { "type": ["string", "null"] },
                    "revisionSha": { "type": ["string", "null"] },
                    "contentHash": { "type": ["string", "null"] },
                    "modelSource": { "type": ["string", "null"] },
                    "sourceLastModified": { "type": ["number", "null"] },
                    "scannerVersion": { "type": ["string", "null"] }
                  },
                  "required": ["id", "createdAt", "updatedAt", "modelPath", "hasErrors"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "No scans found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/model-audit/scans/{id}": {
      "get": {
        "operationId": "getModelAuditScan",
        "tags": ["Model Audit"],
        "summary": "Get one persisted ModelAudit scan",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": { "type": "string" },
                    "createdAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                    "updatedAt": { "oneOf": [{ "type": "string" }, { "type": "number" }] },
                    "name": { "type": ["string", "null"] },
                    "author": { "type": ["string", "null"] },
                    "modelPath": { "type": "string" },
                    "modelType": { "type": ["string", "null"] },
                    "results": {},
                    "checks": {},
                    "issues": {},
                    "hasErrors": { "type": "boolean" },
                    "totalChecks": { "type": ["number", "null"] },
                    "passedChecks": { "type": ["number", "null"] },
                    "failedChecks": { "type": ["number", "null"] },
                    "metadata": {},
                    "modelId": { "type": ["string", "null"] },
                    "revisionSha": { "type": ["string", "null"] },
                    "contentHash": { "type": ["string", "null"] },
                    "modelSource": { "type": ["string", "null"] },
                    "sourceLastModified": { "type": ["number", "null"] },
                    "scannerVersion": { "type": ["string", "null"] }
                  },
                  "required": ["id", "createdAt", "updatedAt", "modelPath", "hasErrors"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Model scan not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteModelAuditScan",
        "tags": ["Model Audit"],
        "summary": "Delete one persisted ModelAudit scan",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean", "enum": [true] },
                    "message": { "type": "string" }
                  },
                  "required": ["success", "message"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Model scan not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/providers/config-status": {
      "get": {
        "operationId": "getProviderConfigStatus",
        "tags": ["Providers"],
        "summary": "Get provider config status",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": { "type": "boolean", "enum": [true] },
                        "data": {
                          "type": "object",
                          "properties": { "hasCustomConfig": { "type": "boolean" } },
                          "required": ["hasCustomConfig"]
                        }
                      },
                      "required": ["success", "data"]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": { "type": "string" },
                        "details": {},
                        "suggestion": { "type": "string" },
                        "success": { "type": "boolean", "enum": [false] }
                      },
                      "required": ["error"],
                      "additionalProperties": {}
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/providers/test": {
      "post": {
        "operationId": "testProvider",
        "tags": ["Providers"],
        "summary": "Test a provider configuration",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": { "type": "string" },
                  "providerOptions": {
                    "type": "object",
                    "properties": { "id": { "type": "string", "minLength": 1 } },
                    "required": ["id"],
                    "additionalProperties": {}
                  }
                },
                "required": ["providerOptions"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "testResult": {
                      "type": "object",
                      "properties": {
                        "success": { "type": "boolean" },
                        "message": { "type": "string" },
                        "error": { "type": "string" },
                        "changes_needed": { "type": "boolean" },
                        "changes_needed_reason": { "type": "string" },
                        "changes_needed_suggestions": {
                          "type": "array",
                          "items": { "type": "string" }
                        }
                      },
                      "required": ["success", "message"],
                      "additionalProperties": {}
                    },
                    "providerResponse": {},
                    "transformedRequest": {}
                  },
                  "required": ["testResult"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/providers/discover": {
      "post": {
        "operationId": "discoverProviderTarget",
        "tags": ["Providers"],
        "summary": "Discover target purpose from a provider",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": { "id": { "type": "string", "minLength": 1 } },
                "required": ["id"],
                "additionalProperties": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "purpose": { "type": ["string", "null"] },
                    "limitations": { "type": ["string", "null"] },
                    "user": { "type": ["string", "null"] },
                    "tools": {
                      "type": "array",
                      "items": {
                        "type": ["object", "null"],
                        "properties": {
                          "name": { "type": "string" },
                          "description": { "type": "string" },
                          "arguments": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": { "type": "string" },
                                "description": { "type": "string" },
                                "type": { "type": "string" }
                              },
                              "required": ["name", "description", "type"]
                            }
                          }
                        },
                        "required": ["name", "description", "arguments"]
                      }
                    },
                    "tokenUsage": {
                      "type": "object",
                      "properties": {
                        "prompt": { "type": "number" },
                        "completion": { "type": "number" },
                        "cached": { "type": "number" },
                        "total": { "type": "number" },
                        "numRequests": { "type": "number" },
                        "completionDetails": {
                          "type": "object",
                          "properties": {
                            "reasoning": { "type": "number" },
                            "acceptedPrediction": { "type": "number" },
                            "rejectedPrediction": { "type": "number" },
                            "cacheReadInputTokens": { "type": "number" },
                            "cacheCreationInputTokens": { "type": "number" }
                          }
                        },
                        "attacker": {
                          "type": "object",
                          "properties": {
                            "prompt": { "type": "number" },
                            "completion": { "type": "number" },
                            "cached": { "type": "number" },
                            "total": { "type": "number" },
                            "numRequests": { "type": "number" },
                            "completionDetails": {
                              "type": "object",
                              "properties": {
                                "reasoning": { "type": "number" },
                                "acceptedPrediction": { "type": "number" },
                                "rejectedPrediction": { "type": "number" },
                                "cacheReadInputTokens": { "type": "number" },
                                "cacheCreationInputTokens": { "type": "number" }
                              }
                            }
                          }
                        },
                        "assertions": {
                          "type": "object",
                          "properties": {
                            "prompt": { "type": "number" },
                            "completion": { "type": "number" },
                            "cached": { "type": "number" },
                            "total": { "type": "number" },
                            "numRequests": { "type": "number" },
                            "completionDetails": {
                              "type": "object",
                              "properties": {
                                "reasoning": { "type": "number" },
                                "acceptedPrediction": { "type": "number" },
                                "rejectedPrediction": { "type": "number" },
                                "cacheReadInputTokens": { "type": "number" },
                                "cacheCreationInputTokens": { "type": "number" }
                              }
                            }
                          }
                        },
                        "generation": {
                          "type": "object",
                          "properties": {
                            "prompt": { "type": "number" },
                            "completion": { "type": "number" },
                            "cached": { "type": "number" },
                            "total": { "type": "number" },
                            "numRequests": { "type": "number" },
                            "completionDetails": {
                              "type": "object",
                              "properties": {
                                "reasoning": { "type": "number" },
                                "acceptedPrediction": { "type": "number" },
                                "rejectedPrediction": { "type": "number" },
                                "cacheReadInputTokens": { "type": "number" },
                                "cacheCreationInputTokens": { "type": "number" }
                              }
                            }
                          }
                        },
                        "incurredTokenUsage": {
                          "type": "object",
                          "properties": {
                            "prompt": { "type": "number" },
                            "completion": { "type": "number" },
                            "cached": { "type": "number" },
                            "total": { "type": "number" },
                            "numRequests": { "type": "number" },
                            "completionDetails": {
                              "type": "object",
                              "properties": {
                                "reasoning": { "type": "number" },
                                "acceptedPrediction": { "type": "number" },
                                "rejectedPrediction": { "type": "number" },
                                "cacheReadInputTokens": { "type": "number" },
                                "cacheCreationInputTokens": { "type": "number" }
                              }
                            },
                            "attacker": {
                              "type": "object",
                              "properties": {
                                "prompt": { "type": "number" },
                                "completion": { "type": "number" },
                                "cached": { "type": "number" },
                                "total": { "type": "number" },
                                "numRequests": { "type": "number" },
                                "completionDetails": {
                                  "type": "object",
                                  "properties": {
                                    "reasoning": { "type": "number" },
                                    "acceptedPrediction": { "type": "number" },
                                    "rejectedPrediction": { "type": "number" },
                                    "cacheReadInputTokens": { "type": "number" },
                                    "cacheCreationInputTokens": { "type": "number" }
                                  }
                                }
                              }
                            },
                            "assertions": {
                              "type": "object",
                              "properties": {
                                "prompt": { "type": "number" },
                                "completion": { "type": "number" },
                                "cached": { "type": "number" },
                                "total": { "type": "number" },
                                "numRequests": { "type": "number" },
                                "completionDetails": {
                                  "type": "object",
                                  "properties": {
                                    "reasoning": { "type": "number" },
                                    "acceptedPrediction": { "type": "number" },
                                    "rejectedPrediction": { "type": "number" },
                                    "cacheReadInputTokens": { "type": "number" },
                                    "cacheCreationInputTokens": { "type": "number" }
                                  }
                                }
                              }
                            },
                            "generation": {
                              "type": "object",
                              "properties": {
                                "prompt": { "type": "number" },
                                "completion": { "type": "number" },
                                "cached": { "type": "number" },
                                "total": { "type": "number" },
                                "numRequests": { "type": "number" },
                                "completionDetails": {
                                  "type": "object",
                                  "properties": {
                                    "reasoning": { "type": "number" },
                                    "acceptedPrediction": { "type": "number" },
                                    "rejectedPrediction": { "type": "number" },
                                    "cacheReadInputTokens": { "type": "number" },
                                    "cacheCreationInputTokens": { "type": "number" }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": ["purpose", "limitations", "user", "tools"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/providers/http-generator": {
      "post": {
        "operationId": "generateHttpProvider",
        "tags": ["Providers"],
        "summary": "Generate HTTP provider config from examples",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "requestExample": { "type": "string", "minLength": 1 },
                  "responseExample": { "type": "string" }
                },
                "required": ["requestExample"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated HTTP provider config",
            "content": { "application/json": { "schema": {} } }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/providers/test-request-transform": {
      "post": {
        "operationId": "testProviderRequestTransform",
        "tags": ["Providers"],
        "summary": "Test an HTTP provider request transform",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "transformCode": { "type": "string" },
                  "prompt": { "type": "string" }
                },
                "required": ["prompt"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": { "type": "boolean", "enum": [true] },
                        "result": {}
                      },
                      "required": ["success"]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": { "type": "boolean", "enum": [false] },
                        "error": { "type": "string" },
                        "result": {}
                      },
                      "required": ["success", "error"]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/providers/test-response-transform": {
      "post": {
        "operationId": "testProviderResponseTransform",
        "tags": ["Providers"],
        "summary": "Test an HTTP provider response transform",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "transformCode": { "type": "string" },
                  "response": { "type": "string" }
                },
                "required": ["response"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "success": { "type": "boolean", "enum": [true] },
                        "result": {}
                      },
                      "required": ["success"]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "success": { "type": "boolean", "enum": [false] },
                        "error": { "type": "string" },
                        "result": {}
                      },
                      "required": ["success", "error"]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/providers/test-session": {
      "post": {
        "operationId": "testProviderSession",
        "tags": ["Providers"],
        "summary": "Test multi-turn provider session behavior",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "object",
                    "properties": { "id": { "type": "string", "minLength": 1 } },
                    "required": ["id"],
                    "additionalProperties": {}
                  },
                  "sessionConfig": {
                    "type": "object",
                    "properties": {
                      "sessionSource": { "type": "string" },
                      "sessionParser": { "type": "string" }
                    }
                  },
                  "mainInputVariable": { "type": "string" }
                },
                "required": ["provider"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "message": { "type": "string" },
                    "error": { "type": "string" }
                  },
                  "required": ["success"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/redteam/generate-test": {
      "post": {
        "operationId": "generateRedteamTest",
        "tags": ["Redteam"],
        "summary": "Generate one or more redteam test cases",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plugin": {
                    "type": "object",
                    "properties": {
                      "id": { "type": "string" },
                      "config": {
                        "type": "object",
                        "properties": {
                          "examples": { "type": "array", "items": { "type": "string" } },
                          "graderExamples": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "output": { "type": "string" },
                                "pass": { "type": "boolean" },
                                "score": { "type": "number" },
                                "reason": { "type": "string" }
                              },
                              "required": ["output", "pass", "score", "reason"]
                            }
                          },
                          "graderGuidance": { "type": "string" },
                          "severity": {
                            "type": "string",
                            "enum": ["critical", "high", "medium", "low", "informational"]
                          },
                          "language": {
                            "oneOf": [
                              { "type": "string" },
                              { "type": "array", "items": { "type": "string" } }
                            ]
                          },
                          "prompt": { "type": "string" },
                          "purpose": { "type": "string" },
                          "modifiers": { "type": "object", "additionalProperties": {} },
                          "targetIdentifiers": { "type": "array", "items": { "type": "string" } },
                          "targetSystems": { "type": "array", "items": { "type": "string" } },
                          "mentions": { "type": "boolean" },
                          "targetUrls": { "type": "array", "items": { "type": "string" } },
                          "ssrfFailThreshold": {
                            "type": "string",
                            "enum": ["low", "medium", "high", "critical"]
                          },
                          "name": { "type": "string" },
                          "multilingual": { "type": "boolean" },
                          "indirectInjectionVar": { "type": "string" },
                          "intendedResults": { "type": "array", "items": { "type": "string" } },
                          "intent": {
                            "oneOf": [
                              { "type": "string" },
                              {
                                "type": "array",
                                "items": {
                                  "oneOf": [
                                    { "type": "string" },
                                    { "type": "array", "items": { "type": "string" } }
                                  ]
                                }
                              }
                            ]
                          },
                          "policy": {
                            "oneOf": [
                              { "type": "string" },
                              {
                                "type": "object",
                                "properties": {
                                  "id": { "type": "string" },
                                  "text": { "type": "string" },
                                  "name": { "type": "string" }
                                },
                                "required": ["id"]
                              }
                            ]
                          },
                          "systemPrompt": { "type": "string" },
                          "excludeStrategies": { "type": "array", "items": { "type": "string" } },
                          "protectedFilePath": { "type": "string" },
                          "protectedFilePaths": { "type": "array", "items": { "type": "string" } },
                          "secretFilePath": { "type": "string" },
                          "secretFilePaths": { "type": "array", "items": { "type": "string" } },
                          "secretLocalFilePath": { "type": "string" },
                          "secretLocalFilePaths": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "secretFileValue": { "type": "string" },
                          "secretFileValues": { "type": "array", "items": { "type": "string" } },
                          "outsideWritePath": { "type": "string" },
                          "outsideWritePaths": { "type": "array", "items": { "type": "string" } },
                          "outsideWriteHostPath": { "type": "string" },
                          "outsideWriteHostPaths": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "outsideWriteProbeDir": { "type": "string" },
                          "outsideWriteProbeDirs": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "outsideWriteAllowedPath": { "type": "string" },
                          "outsideWriteAllowedPaths": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "outsideWriteExpectedSha256": { "type": "string" },
                          "outsideWritePathSha256": { "type": "string" },
                          "outsideWriteSha256": { "type": "string" },
                          "outsideWriteMustNotExistPath": { "type": "string" },
                          "outsideWriteMustNotExistPaths": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "mustNotExistPath": { "type": "string" },
                          "mustNotExistPaths": { "type": "array", "items": { "type": "string" } },
                          "protectedWritePath": { "type": "string" },
                          "protectedWritePaths": { "type": "array", "items": { "type": "string" } },
                          "sandboxWritePath": { "type": "string" },
                          "sandboxWritePaths": { "type": "array", "items": { "type": "string" } },
                          "verifierArtifactRoot": { "type": "string" },
                          "verifierArtifactRoots": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "verifierProbeDir": { "type": "string" },
                          "verifierProbeDirs": { "type": "array", "items": { "type": "string" } },
                          "workspacePath": { "type": "string" },
                          "workspacePaths": { "type": "array", "items": { "type": "string" } },
                          "workspaceRoot": { "type": "string" },
                          "workspaceRoots": { "type": "array", "items": { "type": "string" } },
                          "workingDirectory": { "type": "string" },
                          "workingDirectoryPath": { "type": "string" },
                          "workingDir": { "type": "string" },
                          "networkEgressUrl": { "type": "string" },
                          "networkEgressUrls": { "type": "array", "items": { "type": "string" } },
                          "networkTrapUrl": { "type": "string" },
                          "networkTrapUrls": { "type": "array", "items": { "type": "string" } },
                          "networkEgressHost": { "type": "string" },
                          "networkEgressHosts": { "type": "array", "items": { "type": "string" } },
                          "networkTrapHost": { "type": "string" },
                          "networkTrapHosts": { "type": "array", "items": { "type": "string" } },
                          "networkAllowedHost": { "type": "string" },
                          "networkAllowedHosts": { "type": "array", "items": { "type": "string" } },
                          "networkAllowedUrl": { "type": "string" },
                          "networkAllowedUrls": { "type": "array", "items": { "type": "string" } },
                          "networkTrapLogPath": { "type": "string" },
                          "networkTrapLogPaths": { "type": "array", "items": { "type": "string" } },
                          "networkScanPath": { "type": "string" },
                          "networkScanPaths": { "type": "array", "items": { "type": "string" } },
                          "networkWorkspacePath": { "type": "string" },
                          "networkWorkspacePaths": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "networkEgressReceipt": { "type": "string" },
                          "networkEgressReceipts": {
                            "type": "array",
                            "items": { "type": "string" }
                          },
                          "inputs": {
                            "type": "object",
                            "additionalProperties": {
                              "oneOf": [
                                { "type": "string", "minLength": 1 },
                                {
                                  "type": "object",
                                  "properties": {
                                    "config": {
                                      "type": "object",
                                      "properties": {
                                        "benign": { "type": "boolean" },
                                        "inputPurpose": { "type": "string", "minLength": 1 },
                                        "injectionPlacements": {
                                          "type": "array",
                                          "items": { "type": "string", "minLength": 1 },
                                          "minItems": 1
                                        }
                                      }
                                    },
                                    "description": { "type": "string", "minLength": 1 },
                                    "type": {
                                      "type": "string",
                                      "enum": ["text", "pdf", "docx", "image"]
                                    }
                                  },
                                  "required": ["description"]
                                }
                              ]
                            }
                          },
                          "maxCharsPerMessage": { "type": "integer", "exclusiveMinimum": 0 },
                          "__nonce": { "type": "number" }
                        },
                        "default": {},
                        "additionalProperties": {}
                      }
                    },
                    "required": ["id"]
                  },
                  "strategy": {
                    "type": "object",
                    "properties": {
                      "id": { "type": "string" },
                      "config": {
                        "type": "object",
                        "properties": {
                          "enabled": { "type": "boolean" },
                          "plugins": { "type": "array", "items": { "type": "string" } },
                          "numTests": { "type": "integer", "minimum": 0 }
                        },
                        "default": {},
                        "additionalProperties": {}
                      }
                    },
                    "required": ["id"]
                  },
                  "config": {
                    "type": "object",
                    "properties": {
                      "applicationDefinition": {
                        "type": "object",
                        "properties": { "purpose": { "type": ["string", "null"] } }
                      }
                    },
                    "required": ["applicationDefinition"]
                  },
                  "provider": {
                    "oneOf": [
                      { "type": "string", "minLength": 1 },
                      {
                        "type": "object",
                        "properties": {
                          "id": { "type": "string", "minLength": 1 },
                          "label": { "type": "string" },
                          "config": {},
                          "prompts": { "type": "array", "items": { "type": "string" } },
                          "transform": { "type": "string" },
                          "delay": { "type": "number" },
                          "env": { "type": "object", "additionalProperties": { "type": "string" } },
                          "inputs": {
                            "type": "object",
                            "additionalProperties": {
                              "oneOf": [
                                { "type": "string", "minLength": 1 },
                                {
                                  "type": "object",
                                  "properties": {
                                    "config": {
                                      "type": "object",
                                      "properties": {
                                        "benign": { "type": "boolean" },
                                        "inputPurpose": { "type": "string", "minLength": 1 },
                                        "injectionPlacements": {
                                          "type": "array",
                                          "items": { "type": "string", "minLength": 1 },
                                          "minItems": 1
                                        }
                                      }
                                    },
                                    "description": { "type": "string", "minLength": 1 },
                                    "type": { "type": "string", "enum": ["text"] }
                                  },
                                  "required": ["description"]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "config": {
                                      "type": "object",
                                      "properties": {
                                        "benign": { "type": "boolean" },
                                        "inputPurpose": { "type": "string", "minLength": 1 },
                                        "injectionPlacements": {
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "enum": ["body", "header", "footer"]
                                          },
                                          "minItems": 1
                                        }
                                      }
                                    },
                                    "description": { "type": "string", "minLength": 1 },
                                    "type": { "type": "string", "enum": ["pdf"] }
                                  },
                                  "required": ["description", "type"]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "config": {
                                      "type": "object",
                                      "properties": {
                                        "benign": { "type": "boolean" },
                                        "inputPurpose": { "type": "string", "minLength": 1 },
                                        "injectionPlacements": {
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "enum": [
                                              "body",
                                              "comment",
                                              "footnote",
                                              "header",
                                              "footer"
                                            ]
                                          },
                                          "minItems": 1
                                        }
                                      }
                                    },
                                    "description": { "type": "string", "minLength": 1 },
                                    "type": { "type": "string", "enum": ["docx"] }
                                  },
                                  "required": ["description", "type"]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "config": {
                                      "type": "object",
                                      "properties": {
                                        "benign": { "type": "boolean" },
                                        "inputPurpose": { "type": "string", "minLength": 1 },
                                        "injectionPlacements": {
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "enum": ["body", "header", "footer"]
                                          },
                                          "minItems": 1
                                        }
                                      }
                                    },
                                    "description": { "type": "string", "minLength": 1 },
                                    "type": { "type": "string", "enum": ["image"] }
                                  },
                                  "required": ["description", "type"]
                                }
                              ]
                            }
                          }
                        },
                        "required": ["id"],
                        "additionalProperties": {}
                      }
                    ]
                  },
                  "turn": { "type": "integer", "minimum": 0, "default": 0 },
                  "maxTurns": { "type": "integer", "minimum": 1 },
                  "history": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": { "type": "string", "enum": ["assistant", "user"] },
                        "content": { "type": "string" }
                      },
                      "required": ["role", "content"]
                    },
                    "default": []
                  },
                  "goal": { "type": "string" },
                  "stateful": { "type": "boolean" },
                  "count": { "type": "integer", "minimum": 1, "maximum": 10, "default": 1 }
                },
                "required": ["plugin", "strategy", "config"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "prompt": { "type": "string" },
                        "context": { "type": "string" },
                        "metadata": { "type": "object", "additionalProperties": {} }
                      },
                      "required": ["prompt", "context"]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "testCases": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "prompt": { "type": "string" },
                              "context": { "type": "string" },
                              "metadata": { "type": "object", "additionalProperties": {} }
                            },
                            "required": ["prompt", "context"]
                          }
                        },
                        "count": { "type": "integer", "minimum": 0 },
                        "tokenUsage": {
                          "type": "object",
                          "properties": {
                            "prompt": { "type": "number" },
                            "completion": { "type": "number" },
                            "cached": { "type": "number" },
                            "total": { "type": "number" },
                            "numRequests": { "type": "number" },
                            "completionDetails": {
                              "type": "object",
                              "properties": {
                                "reasoning": { "type": "number" },
                                "acceptedPrediction": { "type": "number" },
                                "rejectedPrediction": { "type": "number" },
                                "cacheReadInputTokens": { "type": "number" },
                                "cacheCreationInputTokens": { "type": "number" }
                              }
                            },
                            "attacker": {
                              "type": "object",
                              "properties": {
                                "prompt": { "type": "number" },
                                "completion": { "type": "number" },
                                "cached": { "type": "number" },
                                "total": { "type": "number" },
                                "numRequests": { "type": "number" },
                                "completionDetails": {
                                  "type": "object",
                                  "properties": {
                                    "reasoning": { "type": "number" },
                                    "acceptedPrediction": { "type": "number" },
                                    "rejectedPrediction": { "type": "number" },
                                    "cacheReadInputTokens": { "type": "number" },
                                    "cacheCreationInputTokens": { "type": "number" }
                                  }
                                }
                              }
                            },
                            "assertions": {
                              "type": "object",
                              "properties": {
                                "prompt": { "type": "number" },
                                "completion": { "type": "number" },
                                "cached": { "type": "number" },
                                "total": { "type": "number" },
                                "numRequests": { "type": "number" },
                                "completionDetails": {
                                  "type": "object",
                                  "properties": {
                                    "reasoning": { "type": "number" },
                                    "acceptedPrediction": { "type": "number" },
                                    "rejectedPrediction": { "type": "number" },
                                    "cacheReadInputTokens": { "type": "number" },
                                    "cacheCreationInputTokens": { "type": "number" }
                                  }
                                }
                              }
                            },
                            "generation": {
                              "type": "object",
                              "properties": {
                                "prompt": { "type": "number" },
                                "completion": { "type": "number" },
                                "cached": { "type": "number" },
                                "total": { "type": "number" },
                                "numRequests": { "type": "number" },
                                "completionDetails": {
                                  "type": "object",
                                  "properties": {
                                    "reasoning": { "type": "number" },
                                    "acceptedPrediction": { "type": "number" },
                                    "rejectedPrediction": { "type": "number" },
                                    "cacheReadInputTokens": { "type": "number" },
                                    "cacheCreationInputTokens": { "type": "number" }
                                  }
                                }
                              }
                            },
                            "incurredTokenUsage": {
                              "type": "object",
                              "properties": {
                                "prompt": { "type": "number" },
                                "completion": { "type": "number" },
                                "cached": { "type": "number" },
                                "total": { "type": "number" },
                                "numRequests": { "type": "number" },
                                "completionDetails": {
                                  "type": "object",
                                  "properties": {
                                    "reasoning": { "type": "number" },
                                    "acceptedPrediction": { "type": "number" },
                                    "rejectedPrediction": { "type": "number" },
                                    "cacheReadInputTokens": { "type": "number" },
                                    "cacheCreationInputTokens": { "type": "number" }
                                  }
                                },
                                "attacker": {
                                  "type": "object",
                                  "properties": {
                                    "prompt": { "type": "number" },
                                    "completion": { "type": "number" },
                                    "cached": { "type": "number" },
                                    "total": { "type": "number" },
                                    "numRequests": { "type": "number" },
                                    "completionDetails": {
                                      "type": "object",
                                      "properties": {
                                        "reasoning": { "type": "number" },
                                        "acceptedPrediction": { "type": "number" },
                                        "rejectedPrediction": { "type": "number" },
                                        "cacheReadInputTokens": { "type": "number" },
                                        "cacheCreationInputTokens": { "type": "number" }
                                      }
                                    }
                                  }
                                },
                                "assertions": {
                                  "type": "object",
                                  "properties": {
                                    "prompt": { "type": "number" },
                                    "completion": { "type": "number" },
                                    "cached": { "type": "number" },
                                    "total": { "type": "number" },
                                    "numRequests": { "type": "number" },
                                    "completionDetails": {
                                      "type": "object",
                                      "properties": {
                                        "reasoning": { "type": "number" },
                                        "acceptedPrediction": { "type": "number" },
                                        "rejectedPrediction": { "type": "number" },
                                        "cacheReadInputTokens": { "type": "number" },
                                        "cacheCreationInputTokens": { "type": "number" }
                                      }
                                    }
                                  }
                                },
                                "generation": {
                                  "type": "object",
                                  "properties": {
                                    "prompt": { "type": "number" },
                                    "completion": { "type": "number" },
                                    "cached": { "type": "number" },
                                    "total": { "type": "number" },
                                    "numRequests": { "type": "number" },
                                    "completionDetails": {
                                      "type": "object",
                                      "properties": {
                                        "reasoning": { "type": "number" },
                                        "acceptedPrediction": { "type": "number" },
                                        "rejectedPrediction": { "type": "number" },
                                        "cacheReadInputTokens": { "type": "number" },
                                        "cacheCreationInputTokens": { "type": "number" }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      },
                      "required": ["testCases", "count"]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/redteam/run": {
      "post": {
        "operationId": "runRedteam",
        "tags": ["Redteam"],
        "summary": "Start a redteam run",
        "description": "Starting a run cancels the previous active red team on this server. Poll GET /api/eval/job/{id} with the returned ID for progress and results.",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "config": { "type": "object", "additionalProperties": {} },
                  "force": { "type": "boolean" },
                  "verbose": { "type": "boolean" },
                  "delay": { "type": ["number", "null"], "minimum": 0 },
                  "maxConcurrency": { "type": "integer", "minimum": 1 }
                },
                "required": ["config"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "id": { "type": "string", "format": "uuid" } },
                  "required": ["id"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/redteam/cancel": {
      "post": {
        "operationId": "cancelRedteam",
        "tags": ["Redteam"],
        "summary": "Cancel the running redteam job",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "message": { "type": "string" } },
                  "required": ["message"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/redteam/{taskId}": {
      "post": {
        "operationId": "runRedteamTask",
        "tags": ["Redteam"],
        "summary": "Run a redteam setup task",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1, "maxLength": 128 },
            "required": true,
            "name": "taskId",
            "in": "path"
          }
        ],
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": { "schema": { "type": "object", "additionalProperties": {} } }
          }
        },
        "responses": {
          "200": {
            "description": "Task-specific JSON response",
            "content": { "application/json": { "schema": {} } }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/redteam/status": {
      "get": {
        "operationId": "getRedteamStatus",
        "tags": ["Redteam"],
        "summary": "Get redteam job status",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "hasRunningJob": { "type": "boolean" },
                    "jobId": { "type": ["string", "null"] }
                  },
                  "required": ["hasRunningJob", "jobId"]
                }
              }
            }
          }
        }
      }
    },
    "/api/traces/evaluation/{evaluationId}": {
      "get": {
        "operationId": "getTracesByEvaluation",
        "tags": ["Traces"],
        "summary": "List traces for an evaluation",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "evaluationId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "traces": { "type": "array", "items": {} } },
                  "required": ["traces"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/traces/{traceId}": {
      "get": {
        "operationId": "getTrace",
        "tags": ["Traces"],
        "summary": "Get one trace",
        "parameters": [
          {
            "schema": { "type": "string", "minLength": 1 },
            "required": true,
            "name": "traceId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": { "schema": { "type": "object", "properties": { "trace": {} } } }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Trace not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/user/email": {
      "get": {
        "operationId": "getUserEmail",
        "tags": ["User"],
        "summary": "Get configured user email",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "email": { "type": ["string", "null"], "format": "email" } },
                  "required": ["email"]
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "updateUserEmail",
        "tags": ["User"],
        "summary": "Update configured user email",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": { "email": { "type": "string", "format": "email" } },
                "required": ["email"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "message": { "type": "string" }
                  },
                  "required": ["success", "message"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/user/id": {
      "get": {
        "operationId": "getUserId",
        "tags": ["User"],
        "summary": "Get local user ID",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "id": { "type": "string" } },
                  "required": ["id"]
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/user/email/clear": {
      "put": {
        "operationId": "clearUserEmail",
        "tags": ["User"],
        "summary": "Clear configured user email",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "message": { "type": "string" }
                  },
                  "required": ["success", "message"]
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/user/email/status": {
      "get": {
        "operationId": "getUserEmailStatus",
        "tags": ["User"],
        "summary": "Get configured user email status",
        "parameters": [{ "schema": {}, "required": false, "name": "validate", "in": "query" }],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "hasEmail": { "type": "boolean" },
                    "email": { "type": "string", "format": "email" },
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "exceeded_limit",
                        "show_usage_warning",
                        "email_verification_required",
                        "no_email",
                        "risky_email",
                        "disposable_email"
                      ]
                    },
                    "message": { "type": "string" }
                  },
                  "required": ["hasEmail", "status"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/user/login": {
      "post": {
        "operationId": "loginUser",
        "tags": ["User"],
        "summary": "Authenticate with Promptfoo Cloud",
        "requestBody": {
          "description": "JSON request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "apiKey": { "type": "string", "minLength": 1, "maxLength": 512 },
                  "apiHost": { "type": "string", "format": "uri" }
                },
                "required": ["apiKey"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean", "enum": [true] },
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": { "type": "string" },
                        "name": { "type": "string" },
                        "email": { "type": "string", "format": "email" }
                      },
                      "required": ["id", "name", "email"]
                    },
                    "organization": {
                      "type": "object",
                      "properties": { "id": { "type": "string" }, "name": { "type": "string" } },
                      "required": ["id", "name"]
                    },
                    "app": {
                      "type": "object",
                      "properties": { "url": { "type": "string" } },
                      "required": ["url"]
                    }
                  },
                  "required": ["success", "user", "organization", "app"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/user/logout": {
      "post": {
        "operationId": "logoutUser",
        "tags": ["User"],
        "summary": "Clear Promptfoo Cloud authentication",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean", "enum": [true] },
                    "message": { "type": "string" }
                  },
                  "required": ["success", "message"]
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/user/cloud-config": {
      "get": {
        "operationId": "getUserCloudConfig",
        "tags": ["User"],
        "summary": "Get Promptfoo Cloud app config",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "appUrl": { "type": "string" },
                    "isEnabled": { "type": "boolean" }
                  },
                  "required": ["appUrl", "isEnabled"]
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/version": {
      "get": {
        "operationId": "getVersion",
        "tags": ["Version"],
        "summary": "Check Promptfoo version and update commands",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "currentVersion": { "type": "string" },
                    "latestVersion": { "type": "string" },
                    "updateAvailable": { "type": "boolean" },
                    "selfHosted": { "type": "boolean" },
                    "isNpx": { "type": "boolean" },
                    "updateCommands": {
                      "type": "object",
                      "properties": {
                        "primary": { "type": "string" },
                        "alternative": { "type": ["string", "null"] },
                        "commandType": { "type": "string", "enum": ["docker", "npx", "npm"] },
                        "isCustomContainer": { "type": "boolean" }
                      },
                      "required": ["primary", "alternative", "commandType"]
                    },
                    "commandType": { "type": "string", "enum": ["docker", "npx", "npm"] }
                  },
                  "required": [
                    "currentVersion",
                    "latestVersion",
                    "updateAvailable",
                    "selfHosted",
                    "isNpx",
                    "updateCommands",
                    "commandType"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/blobs/library": {
      "get": {
        "operationId": "listMediaLibrary",
        "tags": ["Blobs"],
        "summary": "List media items from blob storage",
        "parameters": [
          {
            "schema": { "type": "string", "enum": ["image", "video", "audio", "other"] },
            "required": false,
            "name": "type",
            "in": "query"
          },
          {
            "schema": { "type": "string", "minLength": 1, "maxLength": 128 },
            "required": false,
            "name": "evalId",
            "in": "query"
          },
          {
            "schema": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
            "required": false,
            "name": "hash",
            "in": "query"
          },
          {
            "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 30 },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": { "type": ["integer", "null"], "minimum": 0, "default": 0 },
            "required": false,
            "name": "offset",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": ["createdAt", "sizeBytes"],
              "default": "createdAt"
            },
            "required": false,
            "name": "sortField",
            "in": "query"
          },
          {
            "schema": { "type": "string", "enum": ["asc", "desc"], "default": "desc" },
            "required": false,
            "name": "sortOrder",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean", "enum": [true] },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "hash": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
                              "mimeType": { "type": "string" },
                              "sizeBytes": { "type": "number" },
                              "kind": {
                                "type": "string",
                                "enum": ["image", "video", "audio", "other"]
                              },
                              "createdAt": { "type": "string" },
                              "url": { "type": "string" },
                              "context": {
                                "type": "object",
                                "properties": {
                                  "evalId": { "type": "string" },
                                  "evalDescription": { "type": "string" },
                                  "testIdx": { "type": "number" },
                                  "promptIdx": { "type": "number" },
                                  "location": { "type": "string" },
                                  "provider": { "type": "string" },
                                  "prompt": { "type": "string" },
                                  "pass": { "type": "boolean" },
                                  "score": { "type": "number" },
                                  "variables": {
                                    "type": "object",
                                    "additionalProperties": { "type": "string" }
                                  },
                                  "graderResults": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "name": { "type": "string" },
                                        "pass": { "type": "boolean" },
                                        "score": { "type": "number" },
                                        "reason": { "type": "string" }
                                      },
                                      "required": ["name", "pass", "score"]
                                    }
                                  },
                                  "latencyMs": { "type": "number" },
                                  "cost": { "type": "number" }
                                },
                                "required": ["evalId"]
                              }
                            },
                            "required": [
                              "hash",
                              "mimeType",
                              "sizeBytes",
                              "kind",
                              "createdAt",
                              "url",
                              "context"
                            ]
                          }
                        },
                        "total": { "type": "number" },
                        "hasMore": { "type": "boolean" },
                        "blobStorageEnabled": { "type": "boolean" }
                      },
                      "required": ["items", "total", "hasMore"]
                    }
                  },
                  "required": ["success", "data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/blobs/library/evals": {
      "get": {
        "operationId": "listMediaLibraryEvals",
        "tags": ["Blobs"],
        "summary": "List evaluations that have blob-backed media",
        "parameters": [
          {
            "schema": { "type": "integer", "minimum": 1, "maximum": 501, "default": 500 },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": { "type": "string", "maxLength": 200 },
            "required": false,
            "name": "search",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean", "enum": [true] },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "evalId": { "type": "string" },
                          "description": { "type": "string" },
                          "createdAt": { "type": "string" }
                        },
                        "required": ["evalId", "description"]
                      }
                    }
                  },
                  "required": ["success", "data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/blobs/{hash}": {
      "get": {
        "operationId": "getBlob",
        "tags": ["Blobs"],
        "summary": "Fetch blob bytes or redirect to blob storage",
        "parameters": [
          {
            "schema": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
            "required": true,
            "name": "hash",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Blob bytes",
            "content": {
              "application/octet-stream": { "schema": { "type": "string", "format": "binary" } }
            }
          },
          "302": {
            "description": "Presigned blob URL redirect",
            "headers": {
              "Location": {
                "description": "Redirect target URL",
                "schema": { "type": "string", "format": "uri" }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "403": {
            "description": "Not authorized to access this blob",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "404": {
            "description": "Blob not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "details": {},
                    "suggestion": { "type": "string" },
                    "success": { "type": "boolean", "enum": [false] }
                  },
                  "required": ["error"],
                  "additionalProperties": {}
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {}
}
