{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:ai-agent-deployment-layout-v1",
  "title": "AWOOOI AI Agent 佈建布局快照 v1",
  "description": "OpenClaw、Hermes、NemoTron 在主機、套件、工具、服務、專案與網站前後台的只讀佈建布局合約。此 schema 不授權任何生產寫入、Telegram 發送、SDK 安裝、付費 API、shadow/canary 或生產路由切換。",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "agent_contracts",
    "domains",
    "deployment_targets",
    "collaboration_contract",
    "learning_contract",
    "telegram_contract",
    "rollups",
    "approval_boundaries"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "ai_agent_deployment_layout_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",
        "deployment_authority"
      ],
      "properties": {
        "overall_completion_percent": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "current_priority": {
          "type": "string",
          "enum": ["P0", "P1", "P2", "P3"]
        },
        "current_task_id": {
          "type": "string",
          "minLength": 1
        },
        "next_task_id": {
          "type": "string",
          "minLength": 1
        },
        "read_only_mode": {
          "type": "boolean",
          "const": true
        },
        "deployment_authority": {
          "type": "string",
          "const": "layout_only_no_runtime_deploy"
        }
      },
      "additionalProperties": false
    },
    "agent_contracts": {
      "type": "array",
      "minItems": 3,
      "items": {
        "type": "object",
        "required": [
          "agent_id",
          "display_name",
          "primary_specialty",
          "deployment_lane",
          "allowed_autonomy",
          "must_delegate_to",
          "blocked_actions",
          "learning_scope"
        ],
        "properties": {
          "agent_id": {"type": "string", "minLength": 1},
          "display_name": {"type": "string", "minLength": 1},
          "primary_specialty": {"type": "string", "minLength": 1},
          "deployment_lane": {"type": "string", "minLength": 1},
          "allowed_autonomy": {
            "type": "array",
            "items": {"type": "string", "minLength": 1}
          },
          "must_delegate_to": {
            "type": "array",
            "items": {"type": "string", "minLength": 1}
          },
          "blocked_actions": {
            "type": "array",
            "minItems": 1,
            "items": {"type": "string", "minLength": 1}
          },
          "learning_scope": {
            "type": "array",
            "items": {"type": "string", "minLength": 1}
          }
        },
        "additionalProperties": false
      }
    },
    "domains": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["domain_id", "display_name", "description"],
        "properties": {
          "domain_id": {"type": "string", "minLength": 1},
          "display_name": {"type": "string", "minLength": 1},
          "description": {"type": "string", "minLength": 1}
        },
        "additionalProperties": false
      }
    },
    "deployment_targets": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "target_id",
          "domain_id",
          "display_name",
          "target_type",
          "primary_agent",
          "supporting_agents",
          "deployment_state",
          "automation_level",
          "capabilities",
          "telegram_policy",
          "learning_inputs",
          "communication_channels",
          "approval_gate",
          "evidence_refs",
          "next_action"
        ],
        "properties": {
          "target_id": {"type": "string", "minLength": 1},
          "domain_id": {"type": "string", "minLength": 1},
          "display_name": {"type": "string", "minLength": 1},
          "target_type": {"type": "string", "minLength": 1},
          "primary_agent": {"type": "string", "minLength": 1},
          "supporting_agents": {
            "type": "array",
            "items": {"type": "string", "minLength": 1}
          },
          "deployment_state": {
            "type": "string",
            "enum": [
              "active_governed",
              "read_only_layout",
              "blocked_by_gate",
              "planned",
              "candidate_only"
            ]
          },
          "automation_level": {
            "type": "string",
            "enum": [
              "observe_only",
              "prepare_only",
              "dry_run_only",
              "hitl_execute_after_approval",
              "blocked"
            ]
          },
          "capabilities": {
            "type": "array",
            "items": {"type": "string", "minLength": 1}
          },
          "telegram_policy": {
            "type": "string",
            "enum": [
              "failure_only",
              "action_required",
              "approval_required",
              "daily_summary_only",
              "no_direct_notify"
            ]
          },
          "learning_inputs": {
            "type": "array",
            "items": {"type": "string", "minLength": 1}
          },
          "communication_channels": {
            "type": "array",
            "items": {"type": "string", "minLength": 1}
          },
          "approval_gate": {"type": "string", "minLength": 1},
          "evidence_refs": {
            "type": "array",
            "items": {"type": "string", "minLength": 1}
          },
          "next_action": {"type": "string", "minLength": 1}
        },
        "additionalProperties": false
      }
    },
    "collaboration_contract": {
      "type": "object",
      "required": [
        "message_bus",
        "audit_trail",
        "handoff_rules",
        "frontend_redaction"
      ],
      "properties": {
        "message_bus": {"type": "string", "minLength": 1},
        "audit_trail": {"type": "string", "minLength": 1},
        "handoff_rules": {
          "type": "array",
          "minItems": 1,
          "items": {"type": "string", "minLength": 1}
        },
        "frontend_redaction": {
          "type": "object",
          "required": [
            "operator_conversation_display_allowed",
            "agent_private_reasoning_display_allowed",
            "display_policy"
          ],
          "properties": {
            "operator_conversation_display_allowed": {"type": "boolean", "const": false},
            "agent_private_reasoning_display_allowed": {"type": "boolean", "const": false},
            "display_policy": {"type": "string", "minLength": 1}
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "learning_contract": {
      "type": "object",
      "required": [
        "event_sources",
        "feedback_loops",
        "growth_metrics",
        "retention_policy"
      ],
      "properties": {
        "event_sources": {
          "type": "array",
          "items": {"type": "string", "minLength": 1}
        },
        "feedback_loops": {
          "type": "array",
          "items": {"type": "string", "minLength": 1}
        },
        "growth_metrics": {
          "type": "array",
          "items": {"type": "string", "minLength": 1}
        },
        "retention_policy": {"type": "string", "minLength": 1}
      },
      "additionalProperties": false
    },
    "telegram_contract": {
      "type": "object",
      "required": [
        "primary_gateway",
        "bot_roles",
        "notification_classes",
        "redaction_policy",
        "e2e_validation"
      ],
      "properties": {
        "primary_gateway": {"type": "string", "minLength": 1},
        "bot_roles": {
          "type": "array",
          "items": {"type": "string", "minLength": 1}
        },
        "notification_classes": {
          "type": "array",
          "items": {"type": "string", "minLength": 1}
        },
        "redaction_policy": {"type": "string", "minLength": 1},
        "e2e_validation": {"type": "string", "minLength": 1}
      },
      "additionalProperties": false
    },
    "rollups": {
      "type": "object",
      "required": [
        "total_targets",
        "by_domain",
        "by_primary_agent",
        "by_deployment_state",
        "by_telegram_policy",
        "blocked_target_ids",
        "approval_required_target_ids"
      ],
      "properties": {
        "total_targets": {"type": "integer", "minimum": 1},
        "by_domain": {"type": "object", "additionalProperties": {"type": "integer"}},
        "by_primary_agent": {"type": "object", "additionalProperties": {"type": "integer"}},
        "by_deployment_state": {"type": "object", "additionalProperties": {"type": "integer"}},
        "by_telegram_policy": {"type": "object", "additionalProperties": {"type": "integer"}},
        "blocked_target_ids": {
          "type": "array",
          "items": {"type": "string", "minLength": 1}
        },
        "approval_required_target_ids": {
          "type": "array",
          "items": {"type": "string", "minLength": 1}
        }
      },
      "additionalProperties": false
    },
    "approval_boundaries": {
      "type": "object",
      "required": [
        "sdk_installation_allowed",
        "paid_api_call_allowed",
        "shadow_or_canary_allowed",
        "production_routing_allowed",
        "destructive_operation_allowed",
        "secret_plaintext_allowed",
        "autonomous_host_mutation_allowed",
        "telegram_direct_send_allowed"
      ],
      "properties": {
        "sdk_installation_allowed": {"type": "boolean", "const": false},
        "paid_api_call_allowed": {"type": "boolean", "const": false},
        "shadow_or_canary_allowed": {"type": "boolean", "const": false},
        "production_routing_allowed": {"type": "boolean", "const": false},
        "destructive_operation_allowed": {"type": "boolean", "const": false},
        "secret_plaintext_allowed": {"type": "boolean", "const": false},
        "autonomous_host_mutation_allowed": {"type": "boolean", "const": false},
        "telegram_direct_send_allowed": {"type": "boolean", "const": false}
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
