{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/huggingbay-xyz/json-schema/huggingbay-xyz-bakeoff-tool-response-schema.json",
  "title": "BakeoffToolResponse",
  "description": "Explicit MCP output contract for the one-call bake-off.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/huggingbay-xyz-run-openapi.json#/components/schemas/BakeoffToolResponse",
  "properties": {
    "winner": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Winner"
    },
    "scorecard": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Scorecard"
    },
    "candidate_summary": {
      "additionalProperties": true,
      "type": "object",
      "title": "Candidate Summary"
    },
    "partial": {
      "type": "boolean",
      "title": "Partial"
    },
    "weak": {
      "type": "boolean",
      "title": "Weak"
    },
    "field_strength": {
      "additionalProperties": true,
      "type": "object",
      "title": "Field Strength"
    },
    "receipt": {
      "additionalProperties": true,
      "type": "object",
      "title": "Receipt"
    },
    "receipt_hash": {
      "type": "string",
      "title": "Receipt Hash"
    },
    "request_hash": {
      "type": "string",
      "title": "Request Hash"
    },
    "bakeoff_id": {
      "type": "string",
      "title": "Bakeoff Id"
    },
    "public": {
      "type": "boolean",
      "title": "Public"
    },
    "public_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Public Url"
    },
    "public_status": {
      "type": "string",
      "enum": [
        "published_strong",
        "private_incomplete_proof"
      ],
      "title": "Public Status",
      "default": "private_incomplete_proof"
    },
    "watermark": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Watermark"
    },
    "task_kind": {
      "type": "string",
      "title": "Task Kind"
    },
    "task_family": {
      "type": "string",
      "title": "Task Family"
    },
    "candidate_models": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Candidate Models"
    },
    "candidate_roles": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object",
      "title": "Candidate Roles"
    },
    "challenger_model": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Challenger Model"
    },
    "winner_role": {
      "type": "string",
      "title": "Winner Role"
    },
    "challenger_gate": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Challenger Gate"
    },
    "created_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Created At"
    },
    "next_call": {
      "additionalProperties": true,
      "type": "object",
      "title": "Next Call"
    },
    "next_call_grant": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Call Grant"
    },
    "bakeoff_quota": {
      "additionalProperties": true,
      "type": "object",
      "title": "Bakeoff Quota"
    },
    "challenger_bakeoff_quota": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Challenger Bakeoff Quota"
    },
    "author_claim": {
      "additionalProperties": true,
      "type": "object",
      "title": "Author Claim"
    },
    "durable_free_key": {
      "additionalProperties": true,
      "type": "object",
      "title": "Durable Free Key"
    },
    "task_fingerprint": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Task Fingerprint"
    },
    "dataset_fingerprint": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Dataset Fingerprint"
    },
    "dataset_source": {
      "additionalProperties": true,
      "type": "object",
      "title": "Dataset Source"
    },
    "pareto_frontier": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Pareto Frontier"
    },
    "confidence_intervals": {
      "additionalProperties": true,
      "type": "object",
      "title": "Confidence Intervals"
    },
    "quality_policy": {
      "type": "string",
      "title": "Quality Policy",
      "default": "pareto_quality_latency_cost"
    },
    "route_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Route Id"
    },
    "escalate_to_frontier": {
      "anyOf": [
        {
          "$ref": "#/$defs/EscalateToFrontierResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "comparison_card": {
      "anyOf": [
        {
          "$ref": "#/$defs/ComparisonCardResponse"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "scorecard",
    "candidate_summary",
    "partial",
    "weak",
    "field_strength",
    "receipt",
    "receipt_hash",
    "request_hash",
    "bakeoff_id",
    "public",
    "public_url",
    "task_kind",
    "task_family",
    "candidate_models",
    "candidate_roles",
    "winner_role",
    "created_at",
    "next_call",
    "bakeoff_quota",
    "author_claim",
    "durable_free_key"
  ],
  "$defs": {
    "ComparisonCardResponse": {
      "properties": {
        "schema": {
          "type": "string",
          "title": "Schema",
          "default": "bay-run.comparison-card.v1"
        },
        "available": {
          "type": "boolean",
          "title": "Available"
        },
        "p50_ms": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "P50 Ms"
        },
        "est_usd": {
          "type": "string",
          "title": "Est Usd"
        },
        "f1": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "F1"
        },
        "f1_ci": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "F1 Ci"
        },
        "n_labels": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "N Labels"
        },
        "frontier_comparison": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Frontier Comparison"
        },
        "comparison_basis": {
          "type": "string",
          "const": "measured_route_only",
          "title": "Comparison Basis",
          "default": "measured_route_only"
        },
        "reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reason"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Text"
        },
        "html": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Html"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "available",
        "est_usd"
      ],
      "title": "ComparisonCardResponse",
      "description": "Measured route-only comparison; frontier claims stay explicitly absent."
    },
    "EscalateToFrontierResponse": {
      "properties": {
        "schema": {
          "type": "string",
          "title": "Schema",
          "default": "bay-run.escalate-to-frontier.v1"
        },
        "reason": {
          "type": "string",
          "enum": [
            "no_specialists",
            "weak_field"
          ],
          "title": "Reason"
        },
        "suggested_action": {
          "type": "string",
          "const": "fallback_to_frontier",
          "title": "Suggested Action",
          "default": "fallback_to_frontier"
        },
        "family": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "title": "Family"
        },
        "alternatives": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array",
          "maxItems": 32,
          "title": "Alternatives"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "reason",
        "family"
      ],
      "title": "EscalateToFrontierResponse",
      "description": "Typed fail-closed handoff when Bay Run cannot prove a specialist route."
    }
  }
}