{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://github.com/hegemonart/get-design-done/reference/schemas/live-session.schema.json",
  "title": "Live Session",
  "description": "A single `/gdd:live` session record persisted at .design/live-sessions/<session-id>.json. Captures the pick -> generate -> accept/discard loop as an append-only event log so a session survives a crash or --resume. Written atomically by scripts/lib/live/session-store.cjs.",
  "type": "object",
  "required": ["schema_version", "session_id", "status", "started_at", "ended_at", "events"],
  "properties": {
    "schema_version": {
      "type": "string",
      "description": "Schema version of this session record (e.g. \"47.0\")."
    },
    "session_id": {
      "type": "string",
      "minLength": 1,
      "description": "Stable id; also the basename of the on-disk file (no path separators)."
    },
    "status": {
      "type": "string",
      "enum": ["in_progress", "completed", "abandoned"],
      "description": "Lifecycle status. Only in_progress sessions are resumable."
    },
    "started_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601 timestamp the session was created."
    },
    "ended_at": {
      "type": ["string", "null"],
      "format": "date-time",
      "description": "ISO-8601 timestamp the session was closed; null while in_progress."
    },
    "url": {
      "type": "string",
      "description": "The page the element was picked from (optional)."
    },
    "dev_server": {
      "description": "Dev-server descriptor (url/port/command, or a plain string). Free-form by design.",
      "type": ["string", "object", "null"]
    },
    "events": {
      "type": "array",
      "description": "Append-only log of session events, oldest first.",
      "items": {
        "type": "object",
        "required": ["kind", "at"],
        "properties": {
          "kind": {
            "type": "string",
            "enum": ["pick", "generate", "accept", "discard"],
            "description": "Event kind."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "ISO-8601 timestamp the event was recorded."
          }
        },
        "additionalProperties": true
      }
    }
  },
  "additionalProperties": false
}
