{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/google/gecx-chat/schemas/walkthrough.schema.json",
  "title": "Walkthrough Artifact",
  "description": "Cross-agent format for proving an agent's work renders, behaves, and meets the assertion checklist for a task.",
  "type": "object",
  "required": ["version", "taskId", "agent", "createdAt", "steps", "summary"],
  "additionalProperties": false,
  "properties": {
    "version": {
      "type": "string",
      "const": "1.0",
      "description": "Schema version. Bump when fields change."
    },
    "taskId": {
      "type": "string",
      "minLength": 1,
      "description": "Eval task id (e.g., '01-branded-react-chat') or arbitrary slug."
    },
    "agent": {
      "type": "string",
      "enum": ["claude-code", "codex", "antigravity", "manual"],
      "description": "Which agent or human captured this walkthrough."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp."
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "URL the capture was driven against (local dev only)."
    },
    "steps": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/step" }
    },
    "summary": {
      "type": "object",
      "required": ["passed", "failed", "duration_ms"],
      "additionalProperties": false,
      "properties": {
        "passed": { "type": "integer", "minimum": 0 },
        "failed": { "type": "integer", "minimum": 0 },
        "duration_ms": { "type": "integer", "minimum": 0 }
      }
    }
  },
  "$defs": {
    "step": {
      "type": "object",
      "required": ["title"],
      "additionalProperties": false,
      "properties": {
        "title": { "type": "string", "minLength": 1 },
        "screenshot": {
          "type": "string",
          "description": "Relative path to a PNG in the walkthrough directory."
        },
        "url": {
          "type": "string",
          "description": "URL or hash navigated to for this step."
        },
        "assertions": {
          "type": "array",
          "items": { "$ref": "#/$defs/assertion" }
        }
      }
    },
    "assertion": {
      "type": "object",
      "required": ["kind"],
      "additionalProperties": false,
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "selector-present",
            "selector-absent",
            "text-contains",
            "aria-label",
            "aria-live",
            "url-matches",
            "lighthouse-a11y-min",
            "color-contrast-min"
          ]
        },
        "selector": { "type": "string" },
        "value": {
          "type": ["string", "number", "boolean"],
          "description": "Expected value, threshold, or pattern."
        },
        "passed": {
          "type": "boolean",
          "description": "Set by `gecx walkthrough verify`."
        },
        "actual": {
          "description": "Recorded actual value from verify, free-form."
        }
      }
    }
  }
}
