{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://awoooi.local/schemas/ai_agent_owner_approved_learning_dry_run_v1.schema.json",
  "title": "AI Agent Owner Approved Learning Dry-run",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "source_refs",
    "dry_run_truth",
    "dry_run_preview",
    "operator_actions",
    "dry_run_gates",
    "verification_contract",
    "approval_boundaries",
    "display_redaction_contract",
    "rollups"
  ],
  "properties": {
    "schema_version": { "const": "ai_agent_owner_approved_learning_dry_run_v1" },
    "generated_at": { "type": "string" },
    "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": { "enum": ["P0", "P1", "P2", "P3"] },
        "current_task_id": { "const": "P2-403F" },
        "next_task_id": { "const": "P2-403G" },
        "read_only_mode": { "const": true },
        "runtime_authority": { "const": "owner_approved_dry_run_only_no_learning_write" },
        "status_note": { "type": "string" }
      },
      "additionalProperties": false
    },
    "source_refs": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
    "dry_run_truth": {
      "type": "object",
      "required": [
        "owner_approval_required",
        "owner_approval_received_count",
        "dry_run_preview_allowed",
        "dry_run_preview_generated_count",
        "km_write_allowed",
        "playbook_trust_write_allowed",
        "timeline_learning_write_allowed",
        "agent_replay_score_write_allowed",
        "telegram_send_allowed",
        "runtime_worker_allowed",
        "truth_note"
      ],
      "properties": {
        "owner_approval_required": { "const": true },
        "owner_approval_received_count": { "const": 0 },
        "dry_run_preview_allowed": { "const": true },
        "dry_run_preview_generated_count": { "const": 0 },
        "km_write_allowed": { "const": false },
        "playbook_trust_write_allowed": { "const": false },
        "timeline_learning_write_allowed": { "const": false },
        "agent_replay_score_write_allowed": { "const": false },
        "telegram_send_allowed": { "const": false },
        "runtime_worker_allowed": { "const": false },
        "truth_note": { "type": "string" }
      },
      "additionalProperties": false
    },
    "dry_run_preview": {
      "type": "object",
      "required": ["required_inputs", "forbidden_inputs", "preview_outputs", "operator_meaning"],
      "properties": {
        "required_inputs": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
        "forbidden_inputs": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
        "preview_outputs": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
        "operator_meaning": { "type": "string" }
      },
      "additionalProperties": false
    },
    "operator_actions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["action_id", "display_name", "action_type", "status", "owner_agent", "operator_instruction", "blocked_runtime_action"],
        "properties": {
          "action_id": { "type": "string" },
          "display_name": { "type": "string" },
          "action_type": { "enum": ["review", "collect_evidence", "approve_dry_run", "reject_or_rework"] },
          "status": { "enum": ["ready_for_owner", "approval_required", "blocked_by_runtime_gate"] },
          "owner_agent": { "enum": ["openclaw", "hermes", "nemotron"] },
          "operator_instruction": { "type": "string" },
          "blocked_runtime_action": { "type": "string" }
        },
        "additionalProperties": false
      },
      "minItems": 1
    },
    "dry_run_gates": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["gate_id", "display_name", "status", "required_evidence", "blocked_write_action"],
        "properties": {
          "gate_id": { "type": "string" },
          "display_name": { "type": "string" },
          "status": { "enum": ["contract_ready", "approval_required", "blocked_by_runtime_gate"] },
          "required_evidence": { "type": "string" },
          "blocked_write_action": { "type": "string" }
        },
        "additionalProperties": false
      },
      "minItems": 1
    },
    "verification_contract": {
      "type": "object",
      "required": ["verification_required", "verification_steps", "rollback_required"],
      "properties": {
        "verification_required": { "const": true },
        "verification_steps": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
        "rollback_required": { "const": true }
      },
      "additionalProperties": false
    },
    "approval_boundaries": {
      "type": "object",
      "additionalProperties": { "const": false }
    },
    "display_redaction_contract": {
      "type": "object",
      "required": [
        "redaction_required",
        "raw_payload_display_allowed",
        "private_reasoning_display_allowed",
        "secret_value_display_allowed",
        "allowed_frontend_content",
        "forbidden_frontend_content",
        "frontend_display_policy"
      ],
      "properties": {
        "redaction_required": { "const": true },
        "raw_payload_display_allowed": { "const": false },
        "private_reasoning_display_allowed": { "const": false },
        "secret_value_display_allowed": { "const": false },
        "allowed_frontend_content": { "type": "array", "items": { "type": "string" } },
        "forbidden_frontend_content": { "type": "array", "items": { "type": "string" } },
        "frontend_display_policy": { "type": "string" }
      },
      "additionalProperties": false
    },
    "rollups": {
      "type": "object",
      "required": [
        "operator_action_count",
        "dry_run_gate_count",
        "approval_required_gate_ids",
        "blocked_write_action_count",
        "required_input_count",
        "forbidden_input_count",
        "preview_output_count",
        "live_write_count_total",
        "dry_run_preview_generated_count"
      ],
      "properties": {
        "operator_action_count": { "type": "integer", "minimum": 0 },
        "dry_run_gate_count": { "type": "integer", "minimum": 0 },
        "approval_required_gate_ids": { "type": "array", "items": { "type": "string" } },
        "blocked_write_action_count": { "type": "integer", "minimum": 0 },
        "required_input_count": { "type": "integer", "minimum": 0 },
        "forbidden_input_count": { "type": "integer", "minimum": 0 },
        "preview_output_count": { "type": "integer", "minimum": 0 },
        "live_write_count_total": { "const": 0 },
        "dry_run_preview_generated_count": { "const": 0 }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
