{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.anguskit.com/schema/anguscopilot/1.0.0/capabilities.json",
  "title": "Capabilities Section",
  "description": "Agent 可调用的能力清单。v2.0 统一使用 CapabilityRef，取代 v1.0 的 procedures + tools 二分。",
  "type": "array",
  "minItems": 0,
  "maxItems": 200,
  "uniqueItems": true,
  "items": {
    "type": "object",
    "required": ["ref"],
    "properties": {
      "ref": {
        "$ref": "common.json#/$defs/CapabilityRef"
      },
      "alias": {
        "description": "在当前 Agent 上下文内的别名。用于解决多个能力同名的歧义。",
        "$ref": "common.json#/$defs/Identifier"
      },
      "enabled": {
        "description": "是否启用该 Capability。可用于灰度。",
        "type": "boolean",
        "default": true
      },
      "credentialRef": {
        "description": "本 Capability 调用时使用的凭证（覆盖 LLM 全局凭证）。",
        "$ref": "common.json#/$defs/SecretRef"
      },
      "params": {
        "description": "覆盖 Capability 默认参数（如 OpenAPI Operation 的 host、Header）。",
        "type": "object",
        "additionalProperties": true
      },
      "rateLimit": {
        "description": "本 Capability 的限流策略（覆盖全局 quota）。",
        "type": "object",
        "properties": {
          "qps": { "type": "number", "exclusiveMinimum": 0 },
          "burst": { "type": "integer", "minimum": 1 },
          "concurrency": { "type": "integer", "minimum": 1 }
        },
        "unevaluatedProperties": false
      },
      "cache": {
        "description": "本 Capability 调用结果的缓存策略。",
        "type": "object",
        "properties": {
          "enabled": { "type": "boolean", "default": false },
          "ttl": { "$ref": "common.json#/$defs/Duration" },
          "keyTemplate": { "type": "string" }
        },
        "unevaluatedProperties": false
      },
      "approval": {
        "description": "破坏性操作的人工审批策略，覆盖默认 SafetyClass 推导。",
        "type": "object",
        "properties": {
          "required": { "type": "boolean" },
          "channel": {
            "type": "string",
            "enum": ["web", "slack", "lark", "dingtalk", "email"]
          },
          "approvers": {
            "type": "array",
            "items": { "type": "string" }
          },
          "timeout": { "$ref": "common.json#/$defs/Duration" }
        },
        "unevaluatedProperties": false
      },
      "tags": {
        "description": "标签覆盖，用于策略匹配。",
        "type": "array",
        "items": { "type": "string" },
        "uniqueItems": true
      }
    },
    "patternProperties": {
      "^x-": true
    },
    "unevaluatedProperties": false
  }
}
