{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Grid-DB Outbox Broadcast",
  "description": "铸渊生成，Gemini 读取的广播格式",
  "type": "object",
  "required": ["schema_version", "broadcast_id", "generated_at", "generated_by", "dev_id", "persona_id", "type"],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "1.0"
    },
    "broadcast_id": {
      "type": "string",
      "pattern": "^GRID-BC-[0-9]{8}-DEV-[0-9]{3}-[0-9]{3}$",
      "description": "格式: GRID-BC-[YYYYMMDD]-[DEV-XXX]-[序号]"
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "generated_by": {
      "type": "string",
      "const": "zhuyuan-workflow"
    },
    "dev_id": {
      "type": "string",
      "pattern": "^DEV-[0-9]{3}$"
    },
    "persona_id": {
      "type": "string",
      "pattern": "^PER-[A-Z]{2,4}[0-9]{3}$"
    },
    "type": {
      "type": "string",
      "enum": ["task-directive", "code-review-result", "broadcast-relay", "system-notice"]
    },
    "system_format": {
      "type": "object",
      "properties": {
        "next_task": {
          "type": "object",
          "properties": {
            "broadcast_ref": { "type": "string" },
            "step": { "type": "string" },
            "title": { "type": "string" },
            "files_to_create": {
              "type": "array",
              "items": { "type": "string" }
            },
            "acceptance_criteria": {
              "type": "array",
              "items": { "type": "string" }
            }
          }
        },
        "context_update": {
          "type": "object",
          "properties": {
            "previous_step_verified": { "type": "boolean" },
            "code_quality_score": { "type": "integer", "minimum": 0, "maximum": 100 },
            "accumulated_lines": { "type": "integer" }
          }
        }
      }
    },
    "human_readable": {
      "type": "string",
      "description": "给 Gemini 翻译成人话时用的基础文本"
    }
  }
}
