{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.anguskit.com/schema/anguscopilot/1.0.0/clarification.json",
  "title": "Clarification Configuration",
  "description": "运行时澄清治理（v2.0：最大次数、问题去重、TTL、多人接管、Token 计费）。",
  "type": "object",
  "properties": {
    "enabled": { "type": "boolean", "default": false },
    "uiMode": {
      "description": "澄清 UI 形态。",
      "type": "string",
      "enum": ["text", "generative"],
      "default": "text"
    },
    "maxRounds": {
      "description": "单次会话最大澄清次数（防 LLM 反复询问）。",
      "type": "integer",
      "minimum": 1,
      "maximum": 10,
      "default": 3
    },
    "deduplication": {
      "description": "澄清问题语义去重策略。",
      "type": "object",
      "properties": {
        "enabled": { "type": "boolean", "default": true },
        "similarityThreshold": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "default": 0.9
        }
      },
      "unevaluatedProperties": false
    },
    "checkpoint": {
      "description": "Checkpoint 持久化策略。 [beta]",
      "type": "object",
      "properties": {
        "ttl": { "$ref": "common.json#/$defs/Duration", "default": "24h" },
        "renewable": { "type": "boolean", "default": true },
        "maxRenewals": {
          "description": "Checkpoint 续期最大次数（W10 新增；与 §6.6.2 一致）。 [beta]",
          "type": "integer",
          "minimum": 0,
          "maximum": 10,
          "default": 3
        },
        "compactWhenLarge": {
          "description": "当上下文超过阈值时，自动 LLM 摘要压缩。 [beta]",
          "type": "boolean",
          "default": true
        }
      },
      "patternProperties": { "^x-": true },
      "unevaluatedProperties": false
    },
    "handover": {
      "description": "多人接管策略。 [beta]",
      "type": "object",
      "properties": {
        "allowed": { "type": "boolean", "default": false },
        "rbacRequired": {
          "description": "多人接管必须经 RBAC 校验。allowed=true 时强制为 true（W10 新增 A6 约束）。 [beta]",
          "type": "boolean",
          "default": true
        },
        "auditAsCritical": { "type": "boolean", "default": true }
      },
      "patternProperties": { "^x-": true },
      "$comment": "A6 跨字段约束：handover.allowed=true 时必须 rbacRequired=true。",
      "if": {
        "properties": { "allowed": { "const": true } },
        "required": ["allowed"]
      },
      "then": {
        "properties": {
          "rbacRequired": { "const": true }
        },
        "required": ["rbacRequired"]
      },
      "unevaluatedProperties": false
    },
    "tokenBudget": {
      "description": "Clarification 期间 Token 计费上限（计入 QuotaGuard）。",
      "type": "integer",
      "minimum": 1
    }
  },
  "patternProperties": {
    "^x-": true
  },
  "unevaluatedProperties": false
}
