{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/job-change.schema.json",
  "title": "Office job start",
  "description": "What POST /v1/jobs returns. Without a token: preview (the job, the role that does it, team or solo, the repository by name, the exact prompt the session receives and what it writes outside the machine) with confirmToken and expiresAt. With it: started, the session the server began.",
  "type": "object",
  "additionalProperties": false,
  "required": ["contractVersion"],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "preview": {
      "type": "object",
      "additionalProperties": false,
      "required": ["jobId", "role", "team", "repo", "prompt", "writes"],
      "properties": {
        "jobId": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "team": {
          "type": "boolean"
        },
        "repo": {
          "type": "string"
        },
        "prompt": {
          "type": "string"
        },
        "writes": {
          "enum": ["none", "branch", "branch-pr", "pr-comments", "issue-comment"]
        }
      }
    },
    "confirmToken": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{16,128}$"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "started": {
      "type": "object",
      "additionalProperties": false,
      "required": ["sessionId", "jobId", "role", "team", "repo"],
      "properties": {
        "sessionId": {
          "type": "string",
          "pattern": "^[0-9a-f-]{36}$"
        },
        "jobId": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "team": {
          "type": "boolean"
        },
        "repo": {
          "type": "string"
        }
      }
    }
  }
}
