{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://witnora.com/schemas/agentcert-capability-manifest.schema.json",
  "title": "Witnora Capability Manifest v0.1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "id",
    "version",
    "name",
    "domain",
    "operations",
    "sideEffect",
    "resourceTypes",
    "requiredPermissions",
    "risk",
    "idempotency",
    "reversibility",
    "enforcement",
    "verification"
  ],
  "properties": {
    "schemaVersion": { "const": "agentcert.capability_manifest.v0.1" },
    "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{2,199}$" },
    "version": { "type": "string", "minLength": 1, "maxLength": 100 },
    "name": { "type": "string", "minLength": 1, "maxLength": 200 },
    "description": { "type": "string", "maxLength": 2000 },
    "domain": { "enum": ["browser", "coding", "data", "messaging", "finance", "custom"] },
    "operations": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": { "enum": ["read", "navigate", "execute", "create", "update", "delete", "submit", "send", "pay", "export", "authenticate"] }
    },
    "sideEffect": { "enum": ["none", "read", "write", "external", "destructive"] },
    "resourceTypes": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": { "type": "string", "minLength": 1, "maxLength": 200 }
    },
    "requiredPermissions": {
      "type": "array",
      "uniqueItems": true,
      "items": { "type": "string", "minLength": 1, "maxLength": 200 }
    },
    "risk": { "enum": ["low", "medium", "high", "critical"] },
    "idempotency": { "enum": ["not_applicable", "optional", "required", "unsupported"] },
    "reversibility": { "enum": ["reversible", "compensatable", "irreversible", "unknown"] },
    "enforcement": { "enum": ["observe_only", "gateway", "isolated_adapter"] },
    "verification": { "enum": ["none", "reported", "independent_probe"] },
    "aliases": {
      "type": "array",
      "uniqueItems": true,
      "items": { "type": "string", "minLength": 1, "maxLength": 200 }
    },
    "inputSchema": { "type": "object" },
    "outputSchema": { "type": "object" }
  }
}
