{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ingot.tools/schemas/deployment-manifest-v1.json",
  "title": "Ingot canonical deployment manifest (v1)",
  "description": "One versioned envelope consumed by all Ingot deployment release gates. Secrets and endpoint credentials must never appear in this manifest; dynamic runners receive them via local environment-variable references.",
  "type": "object",
  "required": ["schemaVersion", "deployment", "model", "transport"],
  "additionalProperties": true,
  "properties": {
    "schemaVersion": { "const": 1 },
    "deployment": {
      "type": "object",
      "required": ["name", "environment"],
      "properties": {
        "name": { "type": "string", "minLength": 1 },
        "environment": { "type": "string", "minLength": 1 }
      }
    },
    "model": {
      "type": "object",
      "required": ["id"],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "description": "Model identifier, e.g. \"Qwen/Qwen3-4B\"."
        },
        "revision": {
          "type": "string",
          "description": "Immutable revision (e.g. a commit SHA), if pinned."
        },
        "runtime": {
          "type": "object",
          "required": ["name"],
          "description": "Serving runtime. Declaring it lets runtime-specific findings produce fail verdicts; without it they are reported as warnings.",
          "properties": {
            "name": { "type": "string", "minLength": 1 },
            "version": { "type": "string" }
          }
        },
        "parsers": {
          "type": "object",
          "properties": {
            "reasoning": { "type": ["string", "null"] },
            "tools": { "type": ["string", "null"] }
          }
        }
      }
    },
    "generation": {
      "type": "object",
      "properties": {
        "maxTokens": {
          "type": ["number", "null"],
          "exclusiveMinimum": 0,
          "description": "Maximum output tokens; null or omitted means unlimited."
        },
        "reasoningReserve": { "type": "number", "minimum": 0 },
        "contentReserve": { "type": "number", "minimum": 0 },
        "toolCallReserve": { "type": "number", "minimum": 0 },
        "requiredToolCalls": {
          "type": "number",
          "minimum": 0,
          "description": "Tool calls the deployment requires per response. Defaults to 0."
        }
      }
    },
    "transport": {
      "type": "object",
      "required": ["streaming", "nonStreaming"],
      "properties": {
        "streaming": { "type": "boolean" },
        "nonStreaming": { "type": "boolean" },
        "requireParity": {
          "type": "boolean",
          "description": "Whether the deployment requires equivalent error semantics across streaming and non-streaming transports. This is a declared requirement; static checks do not observe actual parity."
        }
      }
    },
    "retry": {
      "type": "object",
      "required": ["maxAttempts", "backoffMs"],
      "description": "Client retry policy. Required when any tool declares effect \"write\"; declare {\"maxAttempts\": 0, \"backoffMs\": 0} if the client never retries.",
      "properties": {
        "maxAttempts": { "type": "integer", "minimum": 0 },
        "backoffMs": { "type": "integer", "minimum": 0 }
      }
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name", "effect"],
        "properties": {
          "name": { "type": "string", "minLength": 1 },
          "effect": { "enum": ["read", "write"] },
          "idempotency": {
            "enum": ["required", "supported", "none"],
            "description": "Whether the tool executor honors idempotency keys. A declaration about the executor — not verified at runtime by static checks. Defaults to \"none\"."
          },
          "parameters": {
            "type": "object",
            "description": "JSON-Schema parameters, checked by the tool-schema-compat gate."
          }
        }
      }
    },
    "policy": {
      "type": "object",
      "properties": {
        "acceptedRisks": {
          "type": "array",
          "items": {
            "enum": [
              "duplicate-effects",
              "reasoning-exposure",
              "tool-loss",
              "transport-divergence"
            ]
          }
        }
      }
    }
  }
}
