{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:ai-agent-high-risk-owner-review-queue-v1",
  "title": "AWOOOI AI Agent high risk owner review queue v1",
  "description": "P2-409 將 P2-408 high / critical 分流、P2-110D / P2-110E 報表資料源缺口與 Telegram egress owner request 草稿收斂成高風險受控自動執行 / critical break-glass 佇列。此 schema 只允許 committed snapshot、controlled apply packet preview、break-glass packet preview、rejection guard preview 與 governance UI 呈現，不授權此 readback 自行啟動 auto worker、live execution、Gateway queue 寫入、Telegram 實發、Bot API、receipt production write、production write、secret 讀取、付費 API、host write、kubectl、OpenClaw 取代或不可逆操作。",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "source_refs",
    "source_readbacks",
    "queue_truth",
    "owner_review_queue_items",
    "approval_packets",
    "rejection_guards",
    "reviewer_checklists",
    "routing_policy",
    "activation_boundaries",
    "telegram_policy",
    "display_redaction_contract",
    "rollups",
    "next_actions"
  ],
  "properties": {
    "schema_version": { "type": "string", "const": "ai_agent_high_risk_owner_review_queue_v1" },
    "generated_at": { "type": "string", "minLength": 1 },
    "program_status": {
      "type": "object",
      "required": [
        "overall_completion_percent",
        "current_priority",
        "current_task_id",
        "next_task_id",
        "read_only_mode",
        "runtime_authority",
        "status_note"
      ],
      "properties": {
        "overall_completion_percent": { "type": "integer", "const": 100 },
        "current_priority": { "type": "string", "const": "P0" },
        "current_task_id": { "type": "string", "const": "P2-409" },
        "next_task_id": { "type": "string", "const": "P2-410" },
        "read_only_mode": { "type": "boolean", "const": true },
        "runtime_authority": { "type": "string", "const": "controlled_apply_break_glass_queue_readback_no_live_execution" },
        "status_note": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "source_refs": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } },
    "source_readbacks": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/source_readback" } },
    "queue_truth": { "type": "object", "additionalProperties": { "type": ["boolean", "integer", "string"] } },
    "owner_review_queue_items": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/queue_item" } },
    "approval_packets": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/approval_packet" } },
    "rejection_guards": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/rejection_guard" } },
    "reviewer_checklists": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/reviewer_checklist" } },
    "routing_policy": {
      "type": "object",
      "required": [
        "high_risk_default_route",
        "critical_risk_default_route",
        "low_medium_runtime_route",
        "owner_response_required",
        "verbal_approval_accepted",
        "redacted_payload_only"
      ],
      "properties": {
        "high_risk_default_route": { "type": "string", "const": "controlled_apply_queue" },
        "critical_risk_default_route": { "type": "string", "const": "critical_break_glass_queue" },
        "low_medium_runtime_route": { "type": "string", "const": "controlled_apply_queue" },
        "owner_response_required": { "type": "boolean", "const": false },
        "verbal_approval_accepted": { "type": "boolean", "const": false },
        "redacted_payload_only": { "type": "boolean", "const": true }
      },
      "additionalProperties": false
    },
    "activation_boundaries": { "type": "object", "additionalProperties": { "type": "boolean" } },
    "telegram_policy": {
      "type": "object",
      "required": [
        "canonical_room",
        "canonical_room_env",
        "gateway_queue_write_allowed",
        "direct_bot_api_allowed",
        "telegram_send_allowed",
        "receipt_write_allowed"
      ],
      "properties": {
        "canonical_room": { "type": "string", "const": "AwoooI SRE 戰情室" },
        "canonical_room_env": { "type": "string", "const": "SRE_GROUP_CHAT_ID" },
        "gateway_queue_write_allowed": { "type": "boolean", "const": false },
        "direct_bot_api_allowed": { "type": "boolean", "const": false },
        "telegram_send_allowed": { "type": "boolean", "const": false },
        "receipt_write_allowed": { "type": "boolean", "const": false },
        "policy_note": { "type": "string" }
      },
      "additionalProperties": false
    },
    "display_redaction_contract": {
      "type": "object",
      "required": [
        "redaction_required",
        "unsafe_payload_display_allowed",
        "private_reasoning_display_allowed",
        "secret_value_display_allowed",
        "work_window_transcript_display_allowed",
        "allowed_display_fields",
        "blocked_display_fields"
      ],
      "properties": {
        "redaction_required": { "type": "boolean", "const": true },
        "unsafe_payload_display_allowed": { "type": "boolean", "const": false },
        "private_reasoning_display_allowed": { "type": "boolean", "const": false },
        "secret_value_display_allowed": { "type": "boolean", "const": false },
        "work_window_transcript_display_allowed": { "type": "boolean", "const": false },
        "allowed_display_fields": { "type": "array", "items": { "type": "string" } },
        "blocked_display_fields": { "type": "array", "items": { "type": "string" } }
      },
      "additionalProperties": false
    },
    "rollups": { "type": "object", "additionalProperties": { "type": ["integer", "array"] } },
    "next_actions": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/next_action" } }
  },
  "additionalProperties": false,
  "$defs": {
    "source_readback": {
      "type": "object",
      "required": ["readback_id", "source_schema_version", "source_ref", "endpoint", "owner_agent", "status", "key_readback", "next_action"],
      "properties": {
        "readback_id": { "type": "string", "minLength": 1 },
        "source_schema_version": { "type": "string", "minLength": 1 },
        "source_ref": { "type": "string", "minLength": 1 },
        "endpoint": { "type": "string", "minLength": 1 },
        "owner_agent": { "enum": ["openclaw", "hermes", "nemotron", "sre", "security", "devops"] },
        "status": { "type": "string", "minLength": 1 },
        "key_readback": { "type": "string", "minLength": 1 },
        "next_action": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "queue_item": {
      "type": "object",
      "required": [
        "queue_item_id",
        "display_name",
        "risk_tier",
        "owner_agent",
        "queue_status",
        "source_readback_ids",
        "approval_packet_id",
        "rejection_guard_ids",
        "reviewer_checklist_ids",
        "required_owner_fields",
        "blocked_runtime_actions",
        "owner_response_required",
        "rollback_owner_required",
        "postcheck_required",
        "live_execution_allowed",
        "gateway_queue_write_allowed",
        "telegram_send_allowed",
        "production_write_allowed",
        "side_effect_count",
        "next_gate"
      ],
      "properties": {
        "queue_item_id": { "type": "string", "minLength": 1 },
        "display_name": { "type": "string", "minLength": 1 },
        "risk_tier": { "enum": ["high", "critical"] },
        "owner_agent": { "enum": ["openclaw", "hermes", "nemotron", "sre", "security", "devops"] },
        "queue_status": { "enum": ["controlled_apply_packet_ready", "critical_break_glass_required", "blocked_missing_owner_response", "approval_packet_preview_ready"] },
        "source_readback_ids": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "approval_packet_id": { "type": "string", "minLength": 1 },
        "rejection_guard_ids": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "reviewer_checklist_ids": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "required_owner_fields": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "blocked_runtime_actions": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "owner_response_required": { "type": "boolean" },
        "rollback_owner_required": { "type": "boolean", "const": true },
        "postcheck_required": { "type": "boolean", "const": true },
        "live_execution_allowed": { "type": "boolean", "const": false },
        "gateway_queue_write_allowed": { "type": "boolean", "const": false },
        "telegram_send_allowed": { "type": "boolean", "const": false },
        "production_write_allowed": { "type": "boolean", "const": false },
        "side_effect_count": { "type": "integer", "const": 0 },
        "next_gate": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "approval_packet": {
      "type": "object",
      "required": [
        "approval_packet_id",
        "queue_item_id",
        "display_name",
        "packet_status",
        "required_owner_fields",
        "required_evidence_refs",
        "reviewer_checklist_id",
        "rejection_guard_ids",
        "rollback_owner_required",
        "postcheck_required",
        "sensitive_payload_allowed",
        "live_execution_allowed",
        "gateway_queue_write_allowed",
        "telegram_send_allowed",
        "production_write_allowed"
      ],
      "properties": {
        "approval_packet_id": { "type": "string", "minLength": 1 },
        "queue_item_id": { "type": "string", "minLength": 1 },
        "display_name": { "type": "string", "minLength": 1 },
        "packet_status": { "enum": ["controlled_apply_packet_ready", "break_glass_packet_ready", "blocked_missing_owner_response"] },
        "required_owner_fields": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "required_evidence_refs": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "reviewer_checklist_id": { "type": "string", "minLength": 1 },
        "rejection_guard_ids": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "rollback_owner_required": { "type": "boolean", "const": true },
        "postcheck_required": { "type": "boolean", "const": true },
        "sensitive_payload_allowed": { "type": "boolean", "const": false },
        "live_execution_allowed": { "type": "boolean", "const": false },
        "gateway_queue_write_allowed": { "type": "boolean", "const": false },
        "telegram_send_allowed": { "type": "boolean", "const": false },
        "production_write_allowed": { "type": "boolean", "const": false }
      },
      "additionalProperties": false
    },
    "rejection_guard": {
      "type": "object",
      "required": ["guard_id", "display_name", "applies_to_risk_tiers", "rejection_condition", "blocked_runtime_actions", "reviewer_action", "sensitive_payload_quarantine_required"],
      "properties": {
        "guard_id": { "type": "string", "minLength": 1 },
        "display_name": { "type": "string", "minLength": 1 },
        "applies_to_risk_tiers": { "type": "array", "minItems": 1, "items": { "enum": ["high", "critical"] } },
        "rejection_condition": { "type": "string", "minLength": 1 },
        "blocked_runtime_actions": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "reviewer_action": { "type": "string", "minLength": 1 },
        "sensitive_payload_quarantine_required": { "type": "boolean" }
      },
      "additionalProperties": false
    },
    "reviewer_checklist": {
      "type": "object",
      "required": ["checklist_id", "display_name", "owner_agent", "required_checks", "pass_condition", "approval_decision_allowed", "checklist_write_allowed", "side_effect_count"],
      "properties": {
        "checklist_id": { "type": "string", "minLength": 1 },
        "display_name": { "type": "string", "minLength": 1 },
        "owner_agent": { "enum": ["openclaw", "hermes", "nemotron", "sre", "security", "devops"] },
        "required_checks": { "type": "array", "minItems": 1, "items": { "type": "string" } },
        "pass_condition": { "type": "string", "minLength": 1 },
        "approval_decision_allowed": { "type": "boolean", "const": false },
        "checklist_write_allowed": { "type": "boolean", "const": false },
        "side_effect_count": { "type": "integer", "const": 0 }
      },
      "additionalProperties": false
    },
    "next_action": {
      "type": "object",
      "required": ["task_id", "priority", "summary", "gate"],
      "properties": {
        "task_id": { "type": "string", "minLength": 1 },
        "priority": { "enum": ["P0", "P1", "P2", "P3"] },
        "summary": { "type": "string", "minLength": 1 },
        "gate": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    }
  }
}
