{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:ai-agent-action-permission-matrix-v1",
  "title": "AWOOOI AI Agent 操作權限矩陣 v1",
  "description": "描述 AI Agent 對服務、工具、套件、備份與模型治理操作的預設權限。此 schema 只定義權限資料形狀，不授權任何生產寫入、SDK 安裝、付費 API 呼叫、shadow/canary 或生產路由變更。",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "permission_levels",
    "action_classes",
    "agent_permissions",
    "default_boundaries"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "ai_agent_action_permission_matrix_v1"
    },
    "generated_at": {
      "type": "string",
      "minLength": 1
    },
    "permission_levels": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "enum": [
          "allowed_read_only",
          "allowed_prepare_only",
          "requires_openclaw_arbitration",
          "requires_human_approval",
          "requires_cost_approval",
          "requires_dependency_approval",
          "blocked"
        ]
      }
    },
    "action_classes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "enum": [
          "observe",
          "diagnose",
          "recommend",
          "prepare_approval_package",
          "dry_run",
          "execute_read_only",
          "execute_write",
          "rollback",
          "destructive",
          "backup_verify",
          "restore_drill",
          "dependency_scan",
          "dependency_upgrade",
          "sdk_installation",
          "paid_api_call",
          "shadow_canary",
          "production_routing"
        ]
      }
    },
    "agent_permissions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "agent_id",
          "action_class",
          "permission_level",
          "automation_allowed",
          "required_gates",
          "required_evidence",
          "notes"
        ],
        "properties": {
          "agent_id": {
            "type": "string",
            "minLength": 1
          },
          "action_class": {
            "type": "string",
            "minLength": 1
          },
          "permission_level": {
            "type": "string",
            "minLength": 1
          },
          "automation_allowed": {
            "type": "boolean"
          },
          "required_gates": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "required_evidence": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "notes": {
            "type": "string",
            "minLength": 1
          }
        },
        "additionalProperties": false
      }
    },
    "default_boundaries": {
      "type": "object",
      "required": [
        "production_write_auto_allowed",
        "destructive_action_auto_allowed",
        "rollback_auto_allowed",
        "restore_drill_auto_allowed",
        "sdk_install_auto_allowed",
        "paid_api_auto_allowed",
        "shadow_canary_auto_allowed",
        "production_routing_auto_allowed"
      ],
      "properties": {
        "production_write_auto_allowed": {
          "type": "boolean",
          "const": false
        },
        "destructive_action_auto_allowed": {
          "type": "boolean",
          "const": false
        },
        "rollback_auto_allowed": {
          "type": "boolean",
          "const": false
        },
        "restore_drill_auto_allowed": {
          "type": "boolean",
          "const": false
        },
        "sdk_install_auto_allowed": {
          "type": "boolean",
          "const": false
        },
        "paid_api_auto_allowed": {
          "type": "boolean",
          "const": false
        },
        "shadow_canary_auto_allowed": {
          "type": "boolean",
          "const": false
        },
        "production_routing_auto_allowed": {
          "type": "boolean",
          "const": false
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
