{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:ai-agent-receipt-readback-owner-review-v1",
  "title": "AWOOOI AI Agent receipt readback owner review v1",
  "description": "P2-406B 將日報 / 週報 / 月報、Telegram receipt owner review、P2-004 供應鏈漂移與 P2-403J 報表真相收斂成只讀 owner review。此 schema 不授權排程、Gateway queue 寫入、Telegram 實發、Bot API、receipt production write、AI runtime、production write、secret 讀取、付費 API、host write、kubectl 或不可逆操作。",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "source_refs",
    "source_readbacks",
    "rollups",
    "report_owner_review",
    "receipt_readback_plan",
    "owner_review_gates",
    "drift_monitor_owner_review",
    "report_truth_owner_review",
    "activation_boundaries",
    "telegram_policy",
    "agent_roles",
    "operator_decision",
    "next_actions"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "ai_agent_receipt_readback_owner_review_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", "minimum": 0, "maximum": 100 },
        "current_priority": { "type": "string", "enum": ["P0", "P1", "P2", "P3"] },
        "current_task_id": { "type": "string", "const": "P2-406B" },
        "next_task_id": { "type": "string", "const": "P2-407" },
        "read_only_mode": { "type": "boolean", "const": true },
        "runtime_authority": {
          "type": "string",
          "const": "receipt_readback_owner_review_only_no_send_or_write"
        },
        "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" }
    },
    "rollups": {
      "type": "object",
      "required": [
        "source_readback_count",
        "report_cadence_count",
        "owner_review_gate_count",
        "receipt_readback_check_count",
        "drift_candidate_count",
        "report_truth_blocker_count",
        "approval_required_count",
        "blocked_runtime_action_count",
        "live_write_count",
        "telegram_send_count",
        "gateway_queue_write_count",
        "bot_api_call_count",
        "production_write_count",
        "secret_read_count",
        "paid_api_call_count",
        "host_write_count",
        "kubectl_action_count"
      ],
      "properties": {
        "source_readback_count": { "type": "integer", "minimum": 0 },
        "report_cadence_count": { "type": "integer", "minimum": 0 },
        "owner_review_gate_count": { "type": "integer", "minimum": 0 },
        "receipt_readback_check_count": { "type": "integer", "minimum": 0 },
        "drift_candidate_count": { "type": "integer", "minimum": 0 },
        "report_truth_blocker_count": { "type": "integer", "minimum": 0 },
        "approval_required_count": { "type": "integer", "minimum": 0 },
        "blocked_runtime_action_count": { "type": "integer", "minimum": 0 },
        "live_write_count": { "type": "integer", "const": 0 },
        "telegram_send_count": { "type": "integer", "const": 0 },
        "gateway_queue_write_count": { "type": "integer", "const": 0 },
        "bot_api_call_count": { "type": "integer", "const": 0 },
        "production_write_count": { "type": "integer", "const": 0 },
        "secret_read_count": { "type": "integer", "const": 0 },
        "paid_api_call_count": { "type": "integer", "const": 0 },
        "host_write_count": { "type": "integer", "const": 0 },
        "kubectl_action_count": { "type": "integer", "const": 0 }
      },
      "additionalProperties": false
    },
    "report_owner_review": {
      "type": "object",
      "required": ["cadences"],
      "properties": {
        "cadences": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/report_cadence" }
        }
      },
      "additionalProperties": false
    },
    "receipt_readback_plan": {
      "type": "object",
      "required": [
        "canonical_room",
        "canonical_room_env",
        "gateway_owner",
        "arbiter",
        "receipt_owner",
        "replay_owner",
        "dry_run_receipt_only",
        "owner_review_required_before_canary",
        "canary_send_approved",
        "receipt_production_write_enabled",
        "readback_checks"
      ],
      "properties": {
        "canonical_room": { "type": "string", "const": "AwoooI SRE 戰情室" },
        "canonical_room_env": { "type": "string", "const": "SRE_GROUP_CHAT_ID" },
        "gateway_owner": { "type": "string", "const": "telegram_ops" },
        "arbiter": { "type": "string", "const": "openclaw" },
        "receipt_owner": { "type": "string", "const": "hermes" },
        "replay_owner": { "type": "string", "const": "nemotron" },
        "dry_run_receipt_only": { "type": "boolean", "const": true },
        "owner_review_required_before_canary": { "type": "boolean", "const": true },
        "canary_send_approved": { "type": "boolean", "const": false },
        "receipt_production_write_enabled": { "type": "boolean", "const": false },
        "readback_checks": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/readback_check" }
        }
      },
      "additionalProperties": false
    },
    "owner_review_gates": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/owner_review_gate" }
    },
    "drift_monitor_owner_review": { "$ref": "#/$defs/drift_monitor_review" },
    "report_truth_owner_review": { "$ref": "#/$defs/report_truth_review" },
    "activation_boundaries": {
      "type": "object",
      "additionalProperties": { "type": "boolean" }
    },
    "telegram_policy": {
      "type": "object",
      "required": [
        "status",
        "canonical_room",
        "canonical_room_env",
        "gateway_queue_write_allowed",
        "direct_bot_api_allowed",
        "telegram_send_allowed",
        "receipt_write_allowed"
      ],
      "properties": {
        "status": { "type": "string", "minLength": 1 },
        "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 }
      },
      "additionalProperties": true
    },
    "agent_roles": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/agent_role" }
    },
    "operator_decision": {
      "type": "object",
      "required": [
        "status",
        "approval_packet_required",
        "rollback_plan_required",
        "mute_plan_required",
        "required_fields",
        "stop_conditions",
        "next_decision_point"
      ],
      "properties": {
        "status": { "type": "string", "const": "owner_review_required_before_canary" },
        "approval_packet_required": { "type": "boolean", "const": true },
        "rollback_plan_required": { "type": "boolean", "const": true },
        "mute_plan_required": { "type": "boolean", "const": true },
        "required_fields": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "stop_conditions": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "next_decision_point": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "next_actions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["task_id", "priority", "summary", "gate"],
        "properties": {
          "task_id": { "type": "string", "minLength": 1 },
          "priority": { "type": "string", "enum": ["P0", "P1", "P2", "P3"] },
          "summary": { "type": "string", "minLength": 1 },
          "gate": { "type": "string", "minLength": 1 }
        },
        "additionalProperties": false
      }
    }
  },
  "$defs": {
    "source_readback": {
      "type": "object",
      "required": [
        "readback_id",
        "source_schema_version",
        "source_ref",
        "endpoint",
        "owner_agent",
        "status",
        "evidence_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": { "type": "string", "enum": ["openclaw", "hermes", "nemotron"] },
        "status": { "type": "string", "minLength": 1 },
        "evidence_status": { "type": "string", "minLength": 1 },
        "key_readback": { "type": "string", "minLength": 1 },
        "next_action": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "report_cadence": {
      "type": "object",
      "required": [
        "cadence_id",
        "display_name",
        "owner_agent",
        "completion_percent",
        "delivery_state",
        "source_confidence",
        "live_delivery_count",
        "review_status",
        "next_gate"
      ],
      "properties": {
        "cadence_id": { "type": "string", "enum": ["daily", "weekly", "monthly"] },
        "display_name": { "type": "string", "minLength": 1 },
        "owner_agent": { "type": "string", "enum": ["openclaw", "hermes", "nemotron"] },
        "completion_percent": { "type": "integer", "minimum": 0, "maximum": 100 },
        "delivery_state": { "type": "string", "minLength": 1 },
        "source_confidence": { "type": "string", "minLength": 1 },
        "live_delivery_count": { "type": "integer", "const": 0 },
        "review_status": { "type": "string", "minLength": 1 },
        "next_gate": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "readback_check": {
      "type": "object",
      "required": [
        "check_id",
        "owner_agent",
        "status",
        "evidence_refs",
        "blocked_runtime_action"
      ],
      "properties": {
        "check_id": { "type": "string", "minLength": 1 },
        "owner_agent": { "type": "string", "enum": ["openclaw", "hermes", "nemotron"] },
        "status": { "type": "string", "minLength": 1 },
        "evidence_refs": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "blocked_runtime_action": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "owner_review_gate": {
      "type": "object",
      "required": [
        "gate_id",
        "title",
        "owner_agent",
        "risk_tier",
        "status",
        "approval_required",
        "required_owner_fields",
        "acceptance_checks",
        "rejection_reasons",
        "blocked_runtime_actions",
        "evidence_refs",
        "next_action"
      ],
      "properties": {
        "gate_id": { "type": "string", "minLength": 1 },
        "title": { "type": "string", "minLength": 1 },
        "owner_agent": { "type": "string", "enum": ["openclaw", "hermes", "nemotron"] },
        "risk_tier": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
        "status": { "type": "string", "minLength": 1 },
        "approval_required": { "type": "boolean", "const": true },
        "required_owner_fields": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "acceptance_checks": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "rejection_reasons": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "blocked_runtime_actions": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "evidence_refs": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "next_action": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "drift_monitor_review": {
      "type": "object",
      "required": [
        "source_task_id",
        "drift_candidate_count",
        "action_required_candidate_count",
        "stale_source_snapshot_count",
        "external_lookup_allowed",
        "package_upgrade_allowed",
        "owner_actions"
      ],
      "properties": {
        "source_task_id": { "type": "string", "const": "P2-004" },
        "drift_candidate_count": { "type": "integer", "minimum": 0 },
        "action_required_candidate_count": { "type": "integer", "minimum": 0 },
        "stale_source_snapshot_count": { "type": "integer", "minimum": 0 },
        "external_lookup_allowed": { "type": "boolean", "const": false },
        "package_upgrade_allowed": { "type": "boolean", "const": false },
        "owner_actions": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        }
      },
      "additionalProperties": false
    },
    "report_truth_review": {
      "type": "object",
      "required": [
        "source_task_id",
        "all_zero_weekly_report_is_actionable_anomaly",
        "all_zero_weekly_report_confidence",
        "zero_signal_finding_count",
        "critical_finding_count",
        "high_finding_count",
        "telegram_report_send_allowed",
        "cronjob_change_allowed",
        "freshness_gate_implemented",
        "source_confidence_gate_implemented",
        "actionability_score_implemented",
        "owner_actions"
      ],
      "properties": {
        "source_task_id": { "type": "string", "const": "P2-403J" },
        "all_zero_weekly_report_is_actionable_anomaly": { "type": "boolean", "const": true },
        "all_zero_weekly_report_confidence": { "type": "string", "const": "low_trust_actionable_anomaly" },
        "zero_signal_finding_count": { "type": "integer", "minimum": 0 },
        "critical_finding_count": { "type": "integer", "minimum": 0 },
        "high_finding_count": { "type": "integer", "minimum": 0 },
        "telegram_report_send_allowed": { "type": "boolean", "const": false },
        "cronjob_change_allowed": { "type": "boolean", "const": false },
        "freshness_gate_implemented": { "type": "boolean", "const": false },
        "source_confidence_gate_implemented": { "type": "boolean", "const": false },
        "actionability_score_implemented": { "type": "boolean", "const": false },
        "owner_actions": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        }
      },
      "additionalProperties": false
    },
    "agent_role": {
      "type": "object",
      "required": [
        "agent_id",
        "role",
        "specialty",
        "autonomy_level",
        "approval_gate",
        "runtime_write_allowed",
        "outputs"
      ],
      "properties": {
        "agent_id": { "type": "string", "enum": ["openclaw", "hermes", "nemotron"] },
        "role": { "type": "string", "minLength": 1 },
        "specialty": { "type": "string", "minLength": 1 },
        "autonomy_level": { "type": "string", "minLength": 1 },
        "approval_gate": { "type": "string", "minLength": 1 },
        "runtime_write_allowed": { "type": "boolean", "const": false },
        "outputs": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
