{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.connectsoft.ai/reference/schemas/run-submission.schema.json",
  "title": "RunSubmission (run-submission-v1)",
  "description": "Body of POST /factory/runs. Scope comes from the authenticated context, not from this body. Idempotent on the Idempotency-Key header within scope + operation.",
  "type": "object",
  "required": ["workflowId", "modelProfileId", "input"],
  "additionalProperties": false,
  "properties": {
    "workflowId": { "type": "string", "description": "Published workflow definition id (BC-38)." },
    "releaseAlias": { "type": "string", "default": "latest", "description": "Alias resolved to an immutable release at acceptance; the resolved releaseId is pinned." },
    "releaseId": { "type": "string", "description": "Explicit immutable release; mutually exclusive with releaseAlias." },
    "modelProfileId": { "type": "string", "description": "Approved logical model profile; the gateway resolves provider, model and deployment." },
    "input": {
      "type": "object",
      "description": "Workflow input validated against the workflow's input descriptor.",
      "properties": {
        "repository": { "type": "string" },
        "revision": { "type": "string", "description": "Commit SHA or tag; mutable refs are resolved and pinned at acceptance." },
        "task": { "type": "string" }
      },
      "additionalProperties": true
    },
    "limits": {
      "type": "object",
      "properties": {
        "maxCostUsd": { "type": "number", "minimum": 0 },
        "maxMinutes": { "type": "integer", "minimum": 1 },
        "maxTokens": { "type": "integer", "minimum": 1 }
      }
    },
    "labels": { "type": "object", "additionalProperties": { "type": "string" } },
    "clientReference": { "type": "string", "description": "Opaque client correlation value echoed in the run view; never used for authorization." }
  }
}
