{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Cortex Artifact Bus State",
  "type": "object",
  "required": ["task_id", "updated_at", "latest_seq", "artifacts"],
  "properties": {
    "task_id": { "type": "string", "minLength": 1 },
    "mission_id": { "type": ["string", "null"] },
    "updated_at": { "type": "string", "format": "date-time" },
    "latest_seq": { "type": "integer", "minimum": 0 },
    "latest_artifact": { "type": ["string", "null"] },
    "status": {
      "type": "string",
      "enum": ["active", "paused", "completed", "failed", "handed_off"]
    },
    "next_action": { "type": "string" },
    "artifacts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["seq", "kind", "path"],
        "properties": {
          "seq": { "type": "integer", "minimum": 1 },
          "kind": { "type": "string" },
          "path": { "type": "string" },
          "summary": { "type": "string" },
          "produced_at": { "type": "string" }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
