{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ghassan-alhamoud.com/resources/agent-capability-descriptor.schema.json",
  "title": "Agent Capability Descriptor",
  "type": "object",
  "additionalProperties": false,
  "required": ["descriptorVersion", "id", "version", "publisher", "capabilities", "interfaces", "constraints", "effects", "trustEvidence"],
  "properties": {
    "descriptorVersion": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+$"},
    "id": {"type": "string", "minLength": 1},
    "version": {"type": "string", "minLength": 1},
    "publisher": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "identityProof"],
      "properties": {
        "id": {"type": "string"},
        "identityProof": {"type": "string"}
      }
    },
    "artifactDigest": {"type": "string", "pattern": "^sha256:[a-fA-F0-9]{64}$"},
    "capabilities": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "description", "inputMediaTypes", "outputMediaTypes"],
        "properties": {
          "id": {"type": "string"},
          "description": {"type": "string"},
          "inputMediaTypes": {"type": "array", "items": {"type": "string"}},
          "outputMediaTypes": {"type": "array", "items": {"type": "string"}},
          "inputSchema": {"type": "string", "format": "uri-reference"},
          "outputSchema": {"type": "string", "format": "uri-reference"}
        }
      }
    },
    "interfaces": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["protocol", "revision", "endpoint", "authentication"],
        "properties": {
          "protocol": {"enum": ["mcp", "a2a", "https", "local"]},
          "revision": {"type": "string"},
          "endpoint": {"type": "string"},
          "authentication": {"type": "array", "items": {"type": "string"}},
          "durableTasks": {"type": "boolean"}
        }
      }
    },
    "constraints": {
      "type": "object",
      "additionalProperties": false,
      "required": ["dataClasses", "networkBoundary"],
      "properties": {
        "dataClasses": {"type": "array", "items": {"enum": ["public", "internal", "confidential", "restricted"]}},
        "networkBoundary": {"enum": ["local", "private", "public"]},
        "regions": {"type": "array", "items": {"type": "string"}},
        "maxPayloadBytes": {"type": "integer", "minimum": 0}
      }
    },
    "effects": {
      "type": "object",
      "additionalProperties": false,
      "required": ["class", "idempotent", "approvalSupported"],
      "properties": {
        "class": {"enum": ["read", "preview", "reversible", "irreversible"]},
        "idempotent": {"type": "boolean"},
        "approvalSupported": {"type": "boolean"},
        "cancellationSupported": {"type": "boolean"}
      }
    },
    "trustEvidence": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["type", "uri", "subjectDigest", "issuedAt", "expiresAt"],
        "properties": {
          "type": {"enum": ["signature", "verification", "attestation", "benchmark", "incident_history"]},
          "uri": {"type": "string", "format": "uri-reference"},
          "subjectDigest": {"type": "string"},
          "issuedAt": {"type": "string", "format": "date-time"},
          "expiresAt": {"type": "string", "format": "date-time"}
        }
      }
    }
  }
}
