{
  "openapi": "3.1.0",
  "info": {
    "title": "Flashduty 开放 API",
    "description": "Flashduty AI SRE 平台的公开 HTTP API —— 技能、MCP 服务器（连接器）、A2A 智能体与会话。所有接口均使用 Flashduty 控制台签发的 `app_key` 查询参数进行认证。",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.flashcat.cloud",
      "description": "Flashduty Open API"
    }
  ],
  "security": [
    {
      "AppKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "AI SRE/技能"
    },
    {
      "name": "AI SRE/MCP 服务器"
    },
    {
      "name": "AI SRE/A2A 智能体"
    },
    {
      "name": "AI SRE/会话"
    },
    {
      "name": "AI SRE/自动化"
    }
  ],
  "paths": {
    "/safari/a2a-agent/create": {
      "post": {
        "operationId": "remote-agent-write-create",
        "summary": "创建 A2A 智能体",
        "description": "通过智能体卡片 URL 注册新的 A2A 远程智能体。",
        "tags": [
          "zh"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **300 次/分钟**；**20 次/秒** |\n| 权限要求 | **Agent 管理**（`ai-sre`） |\n\n## 使用说明\n\n- `instructions` 为必填项；已弃用的 `description` 字段仍保留以兼容旧客户端，若两者同时传入则必须与 `instructions` 完全一致。\n- `card_url` 必须是 host 非空的绝对 `http`/`https` URL（可达性由执行环境验证，此处不检查）；`auth_type` 仅接受 `none`、`api_key` 或 `bearer`。\n- `environment_kind` 仅接受空字符串（自动）或 `byoc`；`cloud` 将被拒绝。`byoc` 需要 `environment_id`，且该 Runner 对调用者可见。\n- 创建到某个团队（`team_id > 0`）需要调用者真实属于该团队；只有账户 owner/admin 可以在账户级（`team_id=0`）创建。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/a2a-agents/remote-agent-write-create",
          "metadata": {
            "sidebarTitle": "创建 A2A 智能体"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/A2AAgentCreateResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "agent_id": "a2a_6mWqZ2pK9nLcR3tY8uVb4D"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/A2AAgentCreateRequest"
              },
              "example": {
                "agent_name": "deploy-bot",
                "instructions": "Inspect deployment pipelines and propose rollbacks when a canary fails health checks.",
                "card_url": "https://agents.example.com/deploy-bot/card",
                "auth_type": "bearer",
                "streaming": true,
                "team_id": 0,
                "environment_kind": "byoc",
                "environment_id": "env_8s7Hn2kLpQ3xYbVc4Wd2m"
              }
            }
          }
        }
      }
    },
    "/safari/a2a-agent/delete": {
      "post": {
        "operationId": "remote-agent-write-delete",
        "summary": "删除 A2A 智能体",
        "description": "按 ID 软删除 A2A 智能体。",
        "tags": [
          "zh"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **300 次/分钟**；**20 次/秒** |\n| 权限要求 | **Agent 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 删除为软删除；删除后该智能体不再出现在列表/详情中，也无法再被调度。\n- 需要对智能体所属团队具备编辑权限（`access.CanEdit`）。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/a2a-agents/remote-agent-write-delete",
          "metadata": {
            "sidebarTitle": "删除 A2A 智能体"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "Always null on success."
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/A2AAgentIDRequest"
              },
              "example": {
                "agent_id": "a2a_6mWqZ2pK9nLcR3tY8uVb4D"
              }
            }
          }
        }
      }
    },
    "/safari/a2a-agent/disable": {
      "post": {
        "operationId": "remote-agent-write-disable",
        "summary": "禁用 A2A 智能体",
        "description": "禁用已启用的 A2A 智能体。",
        "tags": [
          "zh"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **300 次/分钟**；**20 次/秒** |\n| 权限要求 | **Agent 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 需要对智能体所属团队具备编辑权限（`access.CanEdit`）。\n- 若智能体已处于禁用状态，返回 `InvalidParameter`。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/a2a-agents/remote-agent-write-disable",
          "metadata": {
            "sidebarTitle": "禁用 A2A 智能体"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "Always null on success."
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/A2AAgentIDRequest"
              },
              "example": {
                "agent_id": "a2a_6mWqZ2pK9nLcR3tY8uVb4D"
              }
            }
          }
        }
      }
    },
    "/safari/a2a-agent/enable": {
      "post": {
        "operationId": "remote-agent-write-enable",
        "summary": "启用 A2A 智能体",
        "description": "启用已禁用的 A2A 智能体。",
        "tags": [
          "zh"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **300 次/分钟**；**20 次/秒** |\n| 权限要求 | **Agent 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 需要对智能体所属团队具备编辑权限（`access.CanEdit`），仅可见不足以调用。\n- 若智能体已处于启用状态，返回 `InvalidParameter`。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/a2a-agents/remote-agent-write-enable",
          "metadata": {
            "sidebarTitle": "启用 A2A 智能体"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "Always null on success."
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/A2AAgentIDRequest"
              },
              "example": {
                "agent_id": "a2a_6mWqZ2pK9nLcR3tY8uVb4D"
              }
            }
          }
        }
      }
    },
    "/safari/a2a-agent/get": {
      "post": {
        "operationId": "remote-agent-read-get",
        "summary": "查看 A2A 智能体详情",
        "description": "按 ID 查看单个 A2A 智能体。",
        "tags": [
          "zh"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- `card_resolve_timeout` 与 `task_timeout` 目前恒为 `0` —— API 尚未提供设置方式。\n",
          "href": "/zh/api-reference/ai-sre/a2a-agents/remote-agent-read-get",
          "metadata": {
            "sidebarTitle": "查看 A2A 智能体详情"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/A2AAgentItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "agent_id": "a2a_6mWqZ2pK9nLcR3tY8uVb4D",
                    "account_id": 10023,
                    "team_id": 0,
                    "can_edit": true,
                    "environment_kind": "",
                    "environment_id": "",
                    "agent_name": "deploy-bot",
                    "instructions": "Inspect deployment pipelines and propose rollbacks when a canary fails health checks.",
                    "card_url": "https://agents.example.com/deploy-bot/card",
                    "auth_type": "bearer",
                    "streaming": true,
                    "status": "enabled",
                    "agent_card_name": "Deploy Bot",
                    "agent_card_skills": [
                      "rollback",
                      "diff"
                    ],
                    "card_resolve_timeout": 0,
                    "task_timeout": 0,
                    "auth_mode": "shared",
                    "created_by": 80011,
                    "created_at": 1716960000000,
                    "updated_at": 1717046400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/A2AAgentIDRequest"
              },
              "example": {
                "agent_id": "a2a_6mWqZ2pK9nLcR3tY8uVb4D"
              }
            }
          }
        }
      }
    },
    "/safari/a2a-agent/list": {
      "post": {
        "operationId": "remote-agent-read-list",
        "summary": "查询 A2A 智能体列表",
        "description": "分页查询调用者在账户与团队范围内可见的 A2A 智能体。",
        "tags": [
          "zh"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 分页使用 `offset`/`limit`（而非 `p`/`limit`）。\n- `scope=account` 仅返回账户级智能体；`scope=team` 仅返回调用者可见团队中的智能体；默认 `all` 两者兼含，受 `include_account` 影响。\n- `query` 会在智能体名称、指令、卡片 URL、智能体 ID 以及解析得到的卡片名称中执行不区分大小写的子串搜索。\n- `card_resolve_timeout` 与 `task_timeout` 目前恒为 `0` —— API 尚未提供设置方式。\n",
          "href": "/zh/api-reference/ai-sre/a2a-agents/remote-agent-read-list",
          "metadata": {
            "sidebarTitle": "查询 A2A 智能体列表"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/A2AAgentListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "items": [
                      {
                        "agent_id": "a2a_6mWqZ2pK9nLcR3tY8uVb4D",
                        "account_id": 10023,
                        "team_id": 0,
                        "can_edit": true,
                        "environment_kind": "",
                        "environment_id": "",
                        "agent_name": "deploy-bot",
                        "instructions": "Inspect deployment pipelines and propose rollbacks when a canary fails health checks.",
                        "card_url": "https://agents.example.com/deploy-bot/card",
                        "auth_type": "bearer",
                        "streaming": true,
                        "status": "enabled",
                        "agent_card_name": "Deploy Bot",
                        "agent_card_skills": [
                          "rollback",
                          "diff"
                        ],
                        "card_resolve_timeout": 0,
                        "task_timeout": 0,
                        "auth_mode": "shared",
                        "created_by": 80011,
                        "created_at": 1716960000000,
                        "updated_at": 1717046400000
                      }
                    ],
                    "total": 1
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/A2AAgentListRequest"
              },
              "example": {
                "offset": 0,
                "limit": 20,
                "include_account": true
              }
            }
          }
        }
      }
    },
    "/safari/a2a-agent/update": {
      "post": {
        "operationId": "remote-agent-write-update",
        "summary": "更新 A2A 智能体",
        "description": "对 A2A 智能体执行部分更新；省略字段表示不变。",
        "tags": [
          "zh"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **300 次/分钟**；**20 次/秒** |\n| 权限要求 | **Agent 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 任何字段变更前都需要对智能体*当前*所属团队具备编辑权限（`access.CanEdit`）。\n- 重新分配 `team_id` 需要对目标团队的权限；若团队变更且未同时传入新的环境绑定，则现有 Runner 绑定必须对调用者仍可选，否则更新将被拒绝。\n- 变更 `auth_mode` 时会始终一并重写 `secret_schema`；若变更 `auth_mode` 时未传入 `oauth_metadata`，则将其清空。\n- 对敏感的 `auth_config` 键（`api_key`、`token`、`client_secret`）回传挖码值或空字符串将保留已存储的密钥，而不会覆盖。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/a2a-agents/remote-agent-write-update",
          "metadata": {
            "sidebarTitle": "更新 A2A 智能体"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "Always null on success."
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/A2AAgentUpdateRequest"
              },
              "example": {
                "agent_id": "a2a_6mWqZ2pK9nLcR3tY8uVb4D",
                "instructions": "Inspect deployment pipelines and propose rollbacks."
              }
            }
          }
        }
      }
    },
    "/safari/automation/rule/create": {
      "post": {
        "operationId": "automation-rule-write-create",
        "summary": "创建自动化规则",
        "description": "创建自动化规则，支持 schedule、HTTP POST 和 On-call 故障触发器。",
        "tags": [
          "AI SRE/自动化"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **300 次/分钟**；**20 次/秒** |\n| 权限要求 | 有效 `app_key`；管理操作要求调用者可管理目标规则 |\n\n## 使用说明\n\n- 可以创建个人规则，也可以创建当前账户下任意团队的规则；`team_id` 创建后不可修改。\n- `cron_expr` 按 `timezone`（如提供）计算；未提供时依次回退到调用者的成员时区、账户时区，最后是 UTC。\n- `http_post_trigger_enabled=true` 会创建并启用 HTTP POST 触发器；响应中的 `http_post_token` 是仅在创建时返回的一次性值，请立即保存。\n- `oncall_incident_trigger_enabled=true` 时，`oncall_incident_channel_ids` 和 `oncall_incident_severities` 至少各需一项；匹配的故障会以 `trigger_kind=oncall_incident` 运行。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/automations/automation-rule-write-create",
          "metadata": {
            "sidebarTitle": "创建自动化规则"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AutomationRuleItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
                    "account_id": 10023,
                    "team_id": 123,
                    "owner_id": 80011,
                    "name": "Weekly on-call review",
                    "enabled": true,
                    "run_scope": "team",
                    "cron_expr": "0 9 * * 1",
                    "timezone": "Asia/Shanghai",
                    "prompt": "Summarize last week's alert noise and escalation load.",
                    "environment_kind": "",
                    "environment_id": "",
                    "schedule_trigger_id": "atrig_6aKp3wT9mQ2xVc8bR1nY7z",
                    "schedule_trigger_enabled": true,
                    "http_post_trigger_id": "atrig_2bLq4xT8mP1sWd9cN3rF6y",
                    "http_post_trigger_url": "/safari/automation/triggers/atrig_2bLq4xT8mP1sWd9cN3rF6y/fire",
                    "http_post_trigger_enabled": true,
                    "can_edit": true,
                    "created_at": 1780367971228,
                    "updated_at": 1780367971228,
                    "http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U",
                    "schedule_next_fire_at_ms": 1780630800000,
                    "oncall_incident_trigger_id": "atrig_9cVb2mN7qKs4dEa8T1rY5p",
                    "oncall_incident_trigger_enabled": true,
                    "oncall_incident_channel_ids": [
                      456
                    ],
                    "oncall_incident_severities": [
                      "Critical",
                      "Warning"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationRuleCreateRequest"
              },
              "example": {
                "name": "Weekly on-call review",
                "team_id": 123,
                "enabled": true,
                "cron_expr": "0 9 * * 1",
                "timezone": "Asia/Shanghai",
                "schedule_trigger_enabled": true,
                "prompt": "Summarize last week's alert noise and escalation load.",
                "http_post_trigger_enabled": true,
                "oncall_incident_trigger_enabled": true,
                "oncall_incident_channel_ids": [
                  456
                ],
                "oncall_incident_severities": [
                  "Critical",
                  "Warning"
                ]
              }
            }
          }
        }
      }
    },
    "/safari/automation/rule/delete": {
      "post": {
        "operationId": "automation-rule-write-delete",
        "summary": "删除自动化规则",
        "description": "删除一条自动化规则。",
        "tags": [
          "AI SRE/自动化"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **300 次/分钟**；**20 次/秒** |\n| 权限要求 | 有效 `app_key`；管理操作要求调用者可管理目标规则 |\n\n## 使用说明\n\n- 删除规则会同时移除其 schedule、HTTP POST 和 On-call 故障触发器；被删除的 HTTP POST 触发器 token 会立即失效。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/automations/automation-rule-write-delete",
          "metadata": {
            "sidebarTitle": "删除自动化规则"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "成功时固定为 null。"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationRuleIDRequest"
              },
              "example": {
                "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b"
              }
            }
          }
        }
      }
    },
    "/safari/automation/rule/get": {
      "post": {
        "operationId": "automation-rule-read-get",
        "summary": "查看自动化规则",
        "description": "按 ID 查看一条自动化规则。",
        "tags": [
          "AI SRE/自动化"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 有效 `app_key`；调用者必须可管理目标规则 |\n\n## 使用说明\n\n- 管理权限指：个人规则仅限创建者；团队规则限账户管理员或规则所属团队成员。\n",
          "href": "/zh/api-reference/ai-sre/automations/automation-rule-read-get",
          "metadata": {
            "sidebarTitle": "查看自动化规则"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AutomationRuleItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
                    "account_id": 10023,
                    "team_id": 123,
                    "owner_id": 80011,
                    "name": "Weekly on-call review",
                    "enabled": true,
                    "run_scope": "team",
                    "cron_expr": "0 9 * * 1",
                    "timezone": "Asia/Shanghai",
                    "prompt": "Summarize last week's alert noise and escalation load.",
                    "environment_kind": "",
                    "environment_id": "",
                    "schedule_trigger_id": "atrig_6aKp3wT9mQ2xVc8bR1nY7z",
                    "schedule_trigger_enabled": true,
                    "http_post_trigger_id": "atrig_2bLq4xT8mP1sWd9cN3rF6y",
                    "http_post_trigger_url": "/safari/automation/triggers/atrig_2bLq4xT8mP1sWd9cN3rF6y/fire",
                    "http_post_trigger_enabled": true,
                    "can_edit": true,
                    "created_at": 1780367971228,
                    "updated_at": 1780367971228,
                    "http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U",
                    "schedule_next_fire_at_ms": 1780630800000,
                    "oncall_incident_trigger_id": "atrig_9cVb2mN7qKs4dEa8T1rY5p",
                    "oncall_incident_trigger_enabled": true,
                    "oncall_incident_channel_ids": [
                      456
                    ],
                    "oncall_incident_severities": [
                      "Critical",
                      "Warning"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationRuleIDRequest"
              },
              "example": {
                "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b"
              }
            }
          }
        }
      }
    },
    "/safari/automation/rule/list": {
      "post": {
        "operationId": "automation-rule-read-list",
        "summary": "列出自动化规则",
        "description": "列出当前调用者可见的自动化规则。",
        "tags": [
          "AI SRE/自动化"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 有效 `app_key`；结果按调用者可见范围过滤 |\n\n## 使用说明\n\n- `all` 返回调用者自己的个人规则，以及调用者可访问团队的团队规则。\n- 账户管理员在列表中可见所有团队规则，但不可见他人的个人规则。\n- `team_ids` 只会收窄可见集合，不会扩大访问范围。\n",
          "href": "/zh/api-reference/ai-sre/automations/automation-rule-read-list",
          "metadata": {
            "sidebarTitle": "列出自动化规则"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AutomationRuleListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "total": 1,
                    "rules": [
                      {
                        "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
                        "account_id": 10023,
                        "team_id": 123,
                        "owner_id": 80011,
                        "name": "Weekly on-call review",
                        "enabled": true,
                        "run_scope": "team",
                        "cron_expr": "0 9 * * 1",
                        "timezone": "Asia/Shanghai",
                        "prompt": "Summarize last week's alert noise and escalation load.",
                        "environment_kind": "",
                        "environment_id": "",
                        "schedule_trigger_id": "atrig_6aKp3wT9mQ2xVc8bR1nY7z",
                        "schedule_trigger_enabled": true,
                        "http_post_trigger_id": "atrig_2bLq4xT8mP1sWd9cN3rF6y",
                        "http_post_trigger_url": "/safari/automation/triggers/atrig_2bLq4xT8mP1sWd9cN3rF6y/fire",
                        "http_post_trigger_enabled": true,
                        "can_edit": true,
                        "created_at": 1780367971228,
                        "updated_at": 1780367971228,
                        "http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U",
                        "schedule_next_fire_at_ms": 1780630800000,
                        "oncall_incident_trigger_id": "atrig_9cVb2mN7qKs4dEa8T1rY5p",
                        "oncall_incident_trigger_enabled": true,
                        "oncall_incident_channel_ids": [
                          456
                        ],
                        "oncall_incident_severities": [
                          "Critical",
                          "Warning"
                        ]
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationRuleListRequest"
              },
              "example": {
                "scope": "all",
                "limit": 20
              }
            }
          }
        }
      }
    },
    "/safari/automation/rule/run": {
      "post": {
        "operationId": "automation-rule-write-run",
        "summary": "运行自动化规则",
        "description": "立即手动运行一次自动化规则，不受其计划触发时间限制。",
        "tags": [
          "AI SRE/自动化"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **100 次/分钟**；**5 次/秒** |\n| 权限要求 | 有效 `app_key`；调用者必须可管理目标规则 |\n\n## 使用说明\n\n- 同一规则的手动运行限速为每分钟最多一次；在此窗口内的第二次调用会返回 `429`，`code` 为 `\"RequestTooFrequently\"`。\n- 只有已启用的规则才能手动运行；已禁用或配置无效的规则会在创建运行前以 `400` 错误未通过预检。\n- 调用在底层 Agent 会话启动后即返回，而非等待运行结束；运行会继续异步执行——可使用列出自动化运行历史查询完成状态。\n- 以此方式发起的运行，`trigger_kind` 固定为 `manual`，在运行历史中与 `schedule`、`http_post`、`oncall_incident` 区分开来。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/automations/automation-rule-write-run",
          "metadata": {
            "sidebarTitle": "运行自动化规则"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/ManualRunRuleResult"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
                    "trigger_kind": "manual",
                    "preflight": {
                      "ok": true,
                      "checks": [
                        "rule_loaded",
                        "actor_authorized",
                        "app_allowed",
                        "runtime_scope_resolved",
                        "rule_config_valid"
                      ],
                      "scope": "team",
                      "owner_id": 80011,
                      "team_id": 123,
                      "app_name": "ai-sre"
                    },
                    "run": {
                      "run_id": "trun_5oDvqiG64uur6sBNsTc4u",
                      "session_id": "sess_f8oDvqiG64uur6sBNsTc4u"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationRuleIDRequest"
              },
              "example": {
                "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b"
              }
            }
          }
        }
      }
    },
    "/safari/automation/rule/update": {
      "post": {
        "operationId": "automation-rule-write-update",
        "summary": "更新自动化规则",
        "description": "更新自动化规则的可变字段，包括 HTTP POST 与 On-call 故障触发器配置。",
        "tags": [
          "AI SRE/自动化"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **300 次/分钟**；**20 次/秒** |\n| 权限要求 | 有效 `app_key`；管理操作要求调用者可管理目标规则 |\n\n## 使用说明\n\n- 省略或传 `null` 的字段保持不变；`team_id` 不能修改为与当前值不同的值。\n- `cron_expr` 与 `timezone` 可以分别更新——只传其中一个时，另一个保持当前已存储的值。\n- `rotate_http_post_trigger_token=true` 会签发新的 webhook token，且仅在本次响应中返回。\n- 如需由 On-call 故障触发，传入 `oncall_incident_trigger_enabled`、`oncall_incident_channel_ids` 与 `oncall_incident_severities`；匹配事件会以 `trigger_kind=oncall_incident` 运行。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/automations/automation-rule-write-update",
          "metadata": {
            "sidebarTitle": "更新自动化规则"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AutomationRuleItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
                    "account_id": 10023,
                    "team_id": 123,
                    "owner_id": 80011,
                    "name": "Weekly on-call review",
                    "enabled": true,
                    "run_scope": "team",
                    "cron_expr": "0 9 * * 1",
                    "timezone": "Asia/Shanghai",
                    "prompt": "Summarize last week's alert noise and escalation load.",
                    "environment_kind": "",
                    "environment_id": "",
                    "schedule_trigger_id": "atrig_6aKp3wT9mQ2xVc8bR1nY7z",
                    "schedule_trigger_enabled": true,
                    "http_post_trigger_id": "atrig_2bLq4xT8mP1sWd9cN3rF6y",
                    "http_post_trigger_url": "/safari/automation/triggers/atrig_2bLq4xT8mP1sWd9cN3rF6y/fire",
                    "http_post_trigger_enabled": true,
                    "can_edit": true,
                    "created_at": 1780367971228,
                    "updated_at": 1780367971228,
                    "http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U",
                    "schedule_next_fire_at_ms": 1780630800000,
                    "oncall_incident_trigger_id": "atrig_9cVb2mN7qKs4dEa8T1rY5p",
                    "oncall_incident_trigger_enabled": true,
                    "oncall_incident_channel_ids": [
                      456
                    ],
                    "oncall_incident_severities": [
                      "Critical",
                      "Warning"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationRuleUpdateRequest"
              },
              "example": {
                "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
                "enabled": true,
                "cron_expr": "15 9 * * 1",
                "rotate_http_post_trigger_token": true,
                "oncall_incident_trigger_enabled": true,
                "oncall_incident_severities": [
                  "Critical",
                  "Warning"
                ],
                "oncall_incident_channel_ids": [
                  456
                ]
              }
            }
          }
        }
      }
    },
    "/safari/automation/run/list": {
      "post": {
        "operationId": "automation-run-read-list",
        "summary": "列出自动化运行历史",
        "description": "列出调用者可管理规则的运行历史。",
        "tags": [
          "AI SRE/自动化"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 有效 `app_key`；调用者必须可管理目标规则 |\n\n## 使用说明\n\n- 仅当调用者可管理规则时才可查看运行历史：个人规则仅限创建者；团队规则限账户管理员或规则所属团队成员。\n",
          "href": "/zh/api-reference/ai-sre/automations/automation-run-read-list",
          "metadata": {
            "sidebarTitle": "列出自动化运行历史"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AutomationRunListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "total": 1,
                    "runs": [
                      {
                        "run_id": "trun_5oDvqiG64uur6sBNsTc4u",
                        "kind": "automation_rule",
                        "account_id": 10023,
                        "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
                        "trigger_kind": "schedule",
                        "occurrence_key": "atrig_6aKp3wT9mQ2xVc8bR1nY7z:1780630800000",
                        "status": "succeeded",
                        "attempts": 1,
                        "started_at": 1780630800000,
                        "completed_at": 1780630923456,
                        "duration_ms": 123456,
                        "error_code": "",
                        "error_message": "",
                        "stats_json": {},
                        "result_json": {
                          "session_id": "sess_f8oDvqiG64uur6sBNsTc4u"
                        },
                        "created_at": 1780630800000,
                        "updated_at": 1780630923456
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationRunListRequest"
              },
              "example": {
                "rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
                "limit": 20,
                "trigger_kind": "schedule"
              }
            }
          }
        }
      }
    },
    "/safari/automation/template/list": {
      "post": {
        "operationId": "automation-template-read-list",
        "summary": "列出自动化模板",
        "description": "按语言列出自动化预设模板。",
        "tags": [
          "AI SRE/自动化"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 有效 `app_key`；结果按调用者可见范围过滤 |\n",
          "href": "/zh/api-reference/ai-sre/automations/automation-template-read-list",
          "metadata": {
            "sidebarTitle": "列出自动化模板"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AutomationTemplateListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "templates": [
                      {
                        "name": "Weekly Insights",
                        "description": "Analyze incidents, alerts, response activity, notification load, and related changes from the past week.",
                        "icon": "chart-no-axes-combined",
                        "enabled": false,
                        "prompt": "Generate a weekly insights report. Analyze incidents, alerts, response activity, notification load, and related changes from the past week. Focus on what happened this week, which signals deserve attention, and which improvement actions are most valuable. Do not modify any Flashduty business state.\n"
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationTemplateListRequest"
              },
              "example": {
                "locale": "en-US"
              }
            }
          }
        }
      }
    },
    "/safari/mcp/server/create": {
      "post": {
        "operationId": "mcp-write-server-create",
        "summary": "创建 MCP 服务器",
        "description": "在账户下注册新的 MCP 服务器（连接器）。",
        "tags": [
          "AI SRE/MCP 服务器"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **MCP 管理**（`ai-sre`） |\n\n## 使用说明\n\n- `command`/`args`/`env` 用于 `stdio`；`url`/`headers` 用于 `sse`/`streamable-http`。\n- 服务器名称必须以字母开头，且只能包含字母、数字、`-` 或 `_`，在账户内不区分大小写唯一；不满足则返回 InvalidParameter。\n- `environment_kind` 仅支持 `byoc`（需同时提供 `environment_id`）或留空表示自动选择——MCP 服务器不支持直接绑定 `cloud`。\n- `per_user_secret` 认证模式要求 `secret_schema` 为合法 JSON 且包含非空的 `header_name`。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/mcp-servers/mcp-write-server-create",
          "metadata": {
            "sidebarTitle": "创建 MCP 服务器"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/MCPServerItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1",
                    "account_id": 10023,
                    "team_id": 0,
                    "can_edit": true,
                    "environment_kind": "",
                    "environment_id": "",
                    "server_name": "prometheus",
                    "description": "Query Prometheus metrics and alerts.",
                    "transport": "streamable-http",
                    "url": "https://mcp.example.com/prometheus",
                    "status": "enabled",
                    "connect_timeout": 10,
                    "call_timeout": 60,
                    "tool_count": 2,
                    "tools": [
                      {
                        "name": "query",
                        "description": "Run a PromQL instant query."
                      },
                      {
                        "name": "query_range",
                        "description": "Run a PromQL range query."
                      }
                    ],
                    "auth_mode": "shared",
                    "created_by": 80011,
                    "created_at": 1716960000000,
                    "updated_at": 1717046400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPServerCreateRequest"
              },
              "example": {
                "server_name": "prometheus",
                "description": "Query Prometheus metrics and alerts.",
                "transport": "streamable-http",
                "url": "https://mcp.example.com/prometheus",
                "status": "enabled"
              }
            }
          }
        }
      }
    },
    "/safari/mcp/server/delete": {
      "post": {
        "operationId": "mcp-write-server-delete",
        "summary": "删除 MCP 服务器",
        "description": "按 ID 删除 MCP 服务器。",
        "tags": [
          "AI SRE/MCP 服务器"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **MCP 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/mcp-servers/mcp-write-server-delete",
          "metadata": {
            "sidebarTitle": "删除 MCP 服务器"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "成功时恒为 null。"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPServerDeleteRequest"
              },
              "example": {
                "server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1"
              }
            }
          }
        }
      }
    },
    "/safari/mcp/server/disable": {
      "post": {
        "operationId": "mcp-write-server-disable",
        "summary": "禁用 MCP 服务器",
        "description": "禁用已启用的 MCP 服务器。",
        "tags": [
          "AI SRE/MCP 服务器"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **MCP 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 对已禁用的服务器再次禁用会返回 InvalidParameter，而不是静默忽略。\n- 需要对服务器当前所属团队具有编辑权限：账户级服务器仅限所有者/管理员；团队级服务器要求调用者属于该团队（或为所有者/管理员）。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/mcp-servers/mcp-write-server-disable",
          "metadata": {
            "sidebarTitle": "禁用 MCP 服务器"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "成功时恒为 null。"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPServerStatusRequest"
              },
              "example": {
                "server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1"
              }
            }
          }
        }
      }
    },
    "/safari/mcp/server/enable": {
      "post": {
        "operationId": "mcp-write-server-enable",
        "summary": "启用 MCP 服务器",
        "description": "启用已禁用的 MCP 服务器。",
        "tags": [
          "AI SRE/MCP 服务器"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **MCP 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 对已启用的服务器再次启用会返回 InvalidParameter，而不是静默忽略。\n- 需要对服务器当前所属团队具有编辑权限：账户级服务器仅限所有者/管理员；团队级服务器要求调用者属于该团队（或为所有者/管理员）。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/mcp-servers/mcp-write-server-enable",
          "metadata": {
            "sidebarTitle": "启用 MCP 服务器"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "成功时恒为 null。"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPServerStatusRequest"
              },
              "example": {
                "server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1"
              }
            }
          }
        }
      }
    },
    "/safari/mcp/server/get": {
      "post": {
        "operationId": "mcp-read-server-get",
        "summary": "查看 MCP 服务器详情",
        "description": "查看单个 MCP 服务器并实时探测其工具列表。",
        "tags": [
          "AI SRE/MCP 服务器"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 详情接口会实时探测工具；探测失败时设置 `list_error`，请求本身仍成功。\n",
          "href": "/zh/api-reference/ai-sre/mcp-servers/mcp-read-server-get",
          "metadata": {
            "sidebarTitle": "查看 MCP 服务器详情"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/MCPServerItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1",
                    "account_id": 10023,
                    "team_id": 0,
                    "can_edit": true,
                    "environment_kind": "",
                    "environment_id": "",
                    "server_name": "prometheus",
                    "description": "Query Prometheus metrics and alerts.",
                    "transport": "streamable-http",
                    "url": "https://mcp.example.com/prometheus",
                    "status": "enabled",
                    "connect_timeout": 10,
                    "call_timeout": 60,
                    "tool_count": 2,
                    "tools": [
                      {
                        "name": "query",
                        "description": "Run a PromQL instant query."
                      },
                      {
                        "name": "query_range",
                        "description": "Run a PromQL range query."
                      }
                    ],
                    "auth_mode": "shared",
                    "created_by": 80011,
                    "created_at": 1716960000000,
                    "updated_at": 1717046400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPServerGetRequest"
              },
              "example": {
                "server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1"
              }
            }
          }
        }
      }
    },
    "/safari/mcp/server/list": {
      "post": {
        "operationId": "mcp-read-server-list",
        "summary": "查询 MCP 服务器列表",
        "description": "分页查询调用者在账户与团队范围内可见的 MCP 服务器。",
        "tags": [
          "AI SRE/MCP 服务器"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 列表不含实时工具列表；如需探测工具请单独查询某个服务器。\n- `query` 会对名称、描述、AI 生成描述、服务器 ID、传输协议、URL、命令及市场模板名称进行不区分大小写的子串匹配。\n",
          "href": "/zh/api-reference/ai-sre/mcp-servers/mcp-read-server-list",
          "metadata": {
            "sidebarTitle": "查询 MCP 服务器列表"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/MCPServerListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "total": 1,
                    "servers": [
                      {
                        "server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1",
                        "account_id": 10023,
                        "team_id": 0,
                        "can_edit": true,
                        "environment_kind": "",
                        "environment_id": "",
                        "server_name": "prometheus",
                        "description": "Query Prometheus metrics and alerts.",
                        "transport": "streamable-http",
                        "url": "https://mcp.example.com/prometheus",
                        "status": "enabled",
                        "connect_timeout": 10,
                        "call_timeout": 60,
                        "tool_count": 2,
                        "tools": [
                          {
                            "name": "query",
                            "description": "Run a PromQL instant query."
                          },
                          {
                            "name": "query_range",
                            "description": "Run a PromQL range query."
                          }
                        ],
                        "auth_mode": "shared",
                        "created_by": 80011,
                        "created_at": 1716960000000,
                        "updated_at": 1717046400000
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPServerListRequest"
              },
              "example": {
                "p": 1,
                "limit": 20,
                "include_account": true
              }
            }
          }
        }
      }
    },
    "/safari/mcp/server/update": {
      "post": {
        "operationId": "mcp-write-server-update",
        "summary": "更新 MCP 服务器",
        "description": "更新 MCP 服务器配置；省略字段表示不变。",
        "tags": [
          "AI SRE/MCP 服务器"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **MCP 管理**（`ai-sre`） |\n\n## 使用说明\n\n- `env`/`headers` 中的脱敏密钥会被保留——回传脱敏值不会覆盖已存储的真实密钥。\n- `environment_kind`/`environment_id` 是相互独立的部分更新字段：两者都省略表示运行器绑定不变；设置任一字段即可修改绑定，约束与创建时相同（byoc 或留空）。\n- 变更 `team_id` 需要对目标团队具有重新分配权限；若运行器绑定未随之修改，则该绑定在新团队下仍须对调用者可选，否则更新会被拒绝。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/mcp-servers/mcp-write-server-update",
          "metadata": {
            "sidebarTitle": "更新 MCP 服务器"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/MCPServerItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1",
                    "account_id": 10023,
                    "team_id": 0,
                    "can_edit": true,
                    "environment_kind": "",
                    "environment_id": "",
                    "server_name": "prometheus",
                    "description": "Query Prometheus metrics, alerts, and rules.",
                    "transport": "streamable-http",
                    "url": "https://mcp.example.com/prometheus",
                    "status": "enabled",
                    "connect_timeout": 10,
                    "call_timeout": 60,
                    "tool_count": 2,
                    "tools": [
                      {
                        "name": "query",
                        "description": "Run a PromQL instant query."
                      },
                      {
                        "name": "query_range",
                        "description": "Run a PromQL range query."
                      }
                    ],
                    "auth_mode": "shared",
                    "created_by": 80011,
                    "created_at": 1716960000000,
                    "updated_at": 1717046400000
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPServerUpdateRequest"
              },
              "example": {
                "server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1",
                "description": "Query Prometheus metrics, alerts, and rules."
              }
            }
          }
        }
      }
    },
    "/safari/session/delete": {
      "post": {
        "operationId": "session-write-delete",
        "summary": "删除会话",
        "description": "按 ID 删除会话。",
        "tags": [
          "AI SRE/会话"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **300 次/分钟**；**20 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 个人会话仅创建者可删除；团队会话可由创建者、账户管理员或所属团队成员删除。\n- 这是软删除：会级联删除子智能体会话及其已展示的文件；底层 S3/MinIO 对象在事务提交后尽力清理，部分失败时可能残留孤立对象。\n",
          "href": "/zh/api-reference/ai-sre/sessions/session-write-delete",
          "metadata": {
            "sidebarTitle": "删除会话"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "成功时恒为 null。"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionDeleteRequest"
              },
              "example": {
                "session_id": "sess_f8oDvqiG64uur6sBNsTc4u"
              }
            }
          }
        }
      }
    },
    "/safari/session/export": {
      "post": {
        "operationId": "session-read-export",
        "summary": "导出会话记录",
        "description": "以换行分隔的 JSON（NDJSON）流式导出会话的完整事件记录。",
        "tags": [
          "AI SRE/会话"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **20 次/分钟**；**1 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 个人会话仅创建者可导出；团队会话允许同一账户内持有 `session_id` 的调用者导出。\n- 响应为 `application/x-ndjson`——请逐行解析并写入文件，切勿将整段记录读入内存。\n- 第一行始终为 `session_meta` 信封；`include_subagents=true` 会在派发行后内联各子会话的事件流。\n- 请求存在 60 秒的执行超时上限；非常大的会话可能无法在该时间内导出完成。\n- 若流在中途失败，响应会以一行 JSON 错误行结束，而非规范的错误信封（响应头已发出）——可通过检测该结尾行判断记录是否被截断。\n",
          "href": "/zh/api-reference/ai-sre/sessions/session-read-export",
          "metadata": {
            "sidebarTitle": "导出会话记录"
          }
        },
        "responses": {
          "200": {
            "description": "流式 NDJSON（application/x-ndjson）。每行一个 JSON 对象，以换行结束。第一行始终为 `session_meta` 信封，其后为会话事件。",
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "type": "string",
                  "description": "换行分隔的 JSON 流。请逐行解析，切勿缓冲整个响应体。"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionExportRequest"
              },
              "example": {
                "session_id": "sess_f8oDvqiG64uur6sBNsTc4u",
                "include_subagents": false
              }
            }
          }
        }
      }
    },
    "/safari/session/get": {
      "post": {
        "operationId": "session-read-info",
        "summary": "查看会话详情",
        "description": "查看单个会话，并返回其最近事件的一页（向更早方向分页）。",
        "tags": [
          "AI SRE/会话"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 个人会话仅创建者可读；团队会话允许同一账户内持有 `session_id` 的调用者读取。\n- 使用上一次响应的 `search_after_ctx` 翻阅更早的历史。\n- `limit`（或旧版 `num_recent_events`）限制事件页大小；默认 100，最大 1000。\n- 格式错误的 `search_after_ctx` 会在触发任何数据库查询前立即返回 400。\n- `current_turn_*` 字段仅在会话 `is_running` 时才会填充；`suggest_init` 与 `session/list` 使用同一个账户级引导提示。\n",
          "href": "/zh/api-reference/ai-sre/sessions/session-read-info",
          "metadata": {
            "sidebarTitle": "查看会话详情"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/SessionGetResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "session": {
                      "session_id": "sess_f8oDvqiG64uur6sBNsTc4u",
                      "session_name": "Investigate cloud-assistant first heartbeat",
                      "app_name": "ai-sre",
                      "entry_kind": "web",
                      "person_id": "3790925372131",
                      "team_id": 0,
                      "is_mine": false,
                      "can_manage": true,
                      "status": "enabled",
                      "incognito": false,
                      "created_at": 1780367971228,
                      "updated_at": 1780367993457,
                      "token_usage": {
                        "input_tokens": 14948,
                        "cached_tokens": 11520,
                        "output_tokens": 888,
                        "reasoning_tokens": 351
                      },
                      "current_context_tokens": 14948,
                      "context_window": 0,
                      "archived_at": 0,
                      "pinned_at": 0,
                      "last_event_at": 1780367992649,
                      "is_running": false,
                      "has_unread": true,
                      "current_turn_started_at": 0,
                      "current_turn_active_ms": 0,
                      "current_turn_wait_ms": 0,
                      "current_turn_tokens": 0
                    },
                    "events": [
                      {
                        "event_id": "evt_3aZQ9p",
                        "session_id": "sess_f8oDvqiG64uur6sBNsTc4u",
                        "author": "user",
                        "partial": false,
                        "turn_complete": false,
                        "status": "normal",
                        "created_at": 1780367971241
                      },
                      {
                        "event_id": "evt_7bWk2r",
                        "session_id": "sess_f8oDvqiG64uur6sBNsTc4u",
                        "author": "ai-sre",
                        "content": {
                          "role": "model",
                          "parts": [
                            {
                              "text": "..."
                            }
                          ]
                        },
                        "partial": false,
                        "turn_complete": true,
                        "status": "normal",
                        "created_at": 1780367992649
                      }
                    ],
                    "has_more_older": false,
                    "suggest_init": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionGetRequest"
              },
              "example": {
                "session_id": "sess_f8oDvqiG64uur6sBNsTc4u",
                "num_recent_events": 50
              }
            }
          }
        }
      }
    },
    "/safari/session/list": {
      "post": {
        "operationId": "session-read-list",
        "summary": "查询会话列表",
        "description": "分页查询调用者可见的智能体会话，可按应用、入口、归档状态与团队过滤。",
        "tags": [
          "AI SRE/会话"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 分页使用 `p`/`limit`（最大 100）；`scope` 默认 `all`。\n- `all` 返回调用者自己的个人会话，以及调用者可访问团队的团队会话；账户管理员可见所有团队会话，但不可见他人的个人会话。\n- `team_ids` 只会收窄可见集合，不会扩大访问范围。\n- `is_running` 反映实时运行集合；`has_unread` 按调用者各自计算；`current_turn_*` 字段在此接口恒为 0 —— 仅 `session/get` 会在会话运行时计算它们。\n- `suggest_init` 是账户级的引导提示（仅当账户在任何范围内都没有知识包时为 true），与列表过滤条件无关。\n",
          "href": "/zh/api-reference/ai-sre/sessions/session-read-list",
          "metadata": {
            "sidebarTitle": "查询会话列表"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/SessionListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "total": 988,
                    "sessions": [
                      {
                        "session_id": "sess_f8oDvqiG64uur6sBNsTc4u",
                        "session_name": "Investigate cloud-assistant first heartbeat",
                        "app_name": "ai-sre",
                        "entry_kind": "web",
                        "person_id": "3790925372131",
                        "team_id": 0,
                        "is_mine": false,
                        "can_manage": true,
                        "status": "enabled",
                        "incognito": false,
                        "created_at": 1780367971228,
                        "updated_at": 1780367993457,
                        "token_usage": {
                          "input_tokens": 14948,
                          "cached_tokens": 11520,
                          "output_tokens": 888,
                          "reasoning_tokens": 351
                        },
                        "current_context_tokens": 14948,
                        "context_window": 0,
                        "archived_at": 0,
                        "pinned_at": 0,
                        "last_event_at": 1780367992649,
                        "is_running": false,
                        "has_unread": true,
                        "current_turn_started_at": 0,
                        "current_turn_active_ms": 0,
                        "current_turn_wait_ms": 0,
                        "current_turn_tokens": 0
                      }
                    ],
                    "suggest_init": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionListRequest"
              },
              "example": {
                "app_name": "ai-sre",
                "limit": 2,
                "orderby": "updated_at",
                "scope": "all"
              }
            }
          }
        }
      }
    },
    "/safari/skill/delete": {
      "post": {
        "operationId": "skill-write-delete",
        "summary": "删除技能",
        "description": "按 ID 删除技能。",
        "tags": [
          "AI SRE/技能"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **300 次/分钟**；**20 次/秒** |\n| 权限要求 | **Skill 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 仅为软删除：将 `status` 置为 `deleted` 并重命名该行以释放原名称供复用；技能的压缩包不会从对象存储中删除。\n- 对已删除或不存在的 `skill_id` 再次删除会返回 `ResourceNotFound`，因为查找逻辑在执行删除前就已排除已删除的行。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/skills/skill-write-delete",
          "metadata": {
            "sidebarTitle": "删除技能"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "成功时恒为 null。"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillDeleteRequest"
              },
              "example": {
                "skill_id": "skill_8s7Hn2kLpQ3xYbVc4Wd2m"
              }
            }
          }
        }
      }
    },
    "/safari/skill/disable": {
      "post": {
        "operationId": "skill-write-disable",
        "summary": "禁用技能",
        "description": "禁用已启用的技能，使智能体不再加载。",
        "tags": [
          "AI SRE/技能"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **300 次/分钟**；**20 次/秒** |\n| 权限要求 | **Skill 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 仅可禁用 `enabled` 状态的技能；已禁用的技能会返回 `InvalidParameter`。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/skills/skill-write-disable",
          "metadata": {
            "sidebarTitle": "禁用技能"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "成功时恒为 null。"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillStatusRequest"
              },
              "example": {
                "skill_id": "skill_8s7Hn2kLpQ3xYbVc4Wd2m"
              }
            }
          }
        }
      }
    },
    "/safari/skill/enable": {
      "post": {
        "operationId": "skill-read-enable",
        "summary": "启用技能",
        "description": "启用已禁用的技能，使智能体可加载。",
        "tags": [
          "AI SRE/技能"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **300 次/分钟**；**20 次/秒** |\n| 权限要求 | **Skill 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 仅可启用 `disabled` 状态的技能；已启用的技能会返回 `InvalidParameter`。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/skills/skill-read-enable",
          "metadata": {
            "sidebarTitle": "启用技能"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "null",
                          "description": "成功时恒为 null。"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillStatusRequest"
              },
              "example": {
                "skill_id": "skill_8s7Hn2kLpQ3xYbVc4Wd2m"
              }
            }
          }
        }
      }
    },
    "/safari/skill/get": {
      "post": {
        "operationId": "skill-read-get",
        "summary": "查看技能详情",
        "description": "查看单个技能，包含完整的 SKILL.md 内容。",
        "tags": [
          "AI SRE/技能"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 若技能不存在或已被删除，返回 `ResourceNotFound`。\n- `can_edit` 反映团队成员关系，但读取本身不受团队限制，任意调用者均可访问。\n",
          "href": "/zh/api-reference/ai-sre/skills/skill-read-get",
          "metadata": {
            "sidebarTitle": "查看技能详情"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/SkillItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "skill_id": "skill_8s7Hn2kLpQ3xYbVc4Wd2m",
                    "account_id": 10023,
                    "team_id": 0,
                    "skill_name": "k8s-triage",
                    "description": "Diagnose unhealthy Kubernetes workloads from cluster events and pod logs.",
                    "version": "1.2.0",
                    "tags": [
                      "kubernetes",
                      "triage"
                    ],
                    "author": "sre-team",
                    "tools": [
                      "bash",
                      "mcp:prometheus/query"
                    ],
                    "status": "enabled",
                    "created_by": 80011,
                    "created_at": 1716960000000,
                    "updated_at": 1717046400000,
                    "can_edit": true,
                    "update_available": false,
                    "is_modified": false,
                    "description_en": "Diagnose unhealthy Kubernetes workloads from cluster events and pod logs.",
                    "content": "---\nname: k8s-triage\ndescription: ...\n---\n# Triage steps"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillGetRequest"
              },
              "example": {
                "skill_id": "skill_8s7Hn2kLpQ3xYbVc4Wd2m"
              }
            }
          }
        }
      }
    },
    "/safari/skill/list": {
      "post": {
        "operationId": "skill-read-list",
        "summary": "查询技能列表",
        "description": "分页查询调用者在账户与团队范围内可见的 AI SRE 技能。",
        "tags": [
          "AI SRE/技能"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 列表行中省略 `content` 字段；如需正文请单独查询某个技能。\n- `scope` 用于选择 `all`（默认）、仅 `account`、或仅 `team`，会覆盖 `include_account`；非管理员请求特定 `team_ids` 时会被静默过滤为其所属的团队。\n- `update_available` 每次调用会与市场目录比对一次；若目录加载失败，仅会隐藏该徽标，不会导致请求失败。\n",
          "href": "/zh/api-reference/ai-sre/skills/skill-read-list",
          "metadata": {
            "sidebarTitle": "查询技能列表"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/SkillListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "total": 1,
                    "skills": [
                      {
                        "skill_id": "skill_8s7Hn2kLpQ3xYbVc4Wd2m",
                        "account_id": 10023,
                        "team_id": 0,
                        "skill_name": "k8s-triage",
                        "description": "Diagnose unhealthy Kubernetes workloads from cluster events and pod logs.",
                        "version": "1.2.0",
                        "tags": [
                          "kubernetes",
                          "triage"
                        ],
                        "author": "sre-team",
                        "tools": [
                          "bash",
                          "mcp:prometheus/query"
                        ],
                        "status": "enabled",
                        "created_by": 80011,
                        "created_at": 1716960000000,
                        "updated_at": 1717046400000,
                        "can_edit": true,
                        "update_available": false,
                        "is_modified": false
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillListRequest"
              },
              "example": {
                "p": 1,
                "limit": 20,
                "include_account": true
              }
            }
          }
        }
      }
    },
    "/safari/skill/update": {
      "post": {
        "operationId": "skill-write-update",
        "summary": "更新技能",
        "description": "更新技能的描述信息或重新分配团队范围。",
        "tags": [
          "AI SRE/技能"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **300 次/分钟**；**20 次/秒** |\n| 权限要求 | **Skill 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 仅 `description`、`description_en` 与 `team_id` 可编辑；技能正文需通过重新上传修改。\n- `description` 仅在非空时更新 —— 无法通过该字段清空；`description_en` 可为 null，传入空字符串即可显式清空。\n- 将 `team_id` 重新分配到不同团队时，除编辑权限外还会触发第二重授权检查，验证调用者是否可将资源指派到目标团队。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/skills/skill-write-update",
          "metadata": {
            "sidebarTitle": "更新技能"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/SkillItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "skill_id": "skill_8s7Hn2kLpQ3xYbVc4Wd2m",
                    "account_id": 10023,
                    "team_id": 0,
                    "skill_name": "k8s-triage",
                    "description": "Updated triage runbook.",
                    "version": "1.2.0",
                    "tags": [
                      "kubernetes",
                      "triage"
                    ],
                    "author": "sre-team",
                    "tools": [
                      "bash",
                      "mcp:prometheus/query"
                    ],
                    "status": "enabled",
                    "created_by": 80011,
                    "created_at": 1716960000000,
                    "updated_at": 1717046400000,
                    "can_edit": true,
                    "update_available": false,
                    "is_modified": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillUpdateRequest"
              },
              "example": {
                "skill_id": "skill_8s7Hn2kLpQ3xYbVc4Wd2m",
                "description": "Updated triage runbook."
              }
            }
          }
        }
      }
    },
    "/safari/skill/upload": {
      "post": {
        "operationId": "skill-write-upload",
        "summary": "上传技能",
        "description": "上传技能压缩包（.skill/.zip/.tar.gz/.tgz）以创建或覆盖技能。",
        "tags": [
          "AI SRE/技能"
        ],
        "security": [
          {
            "AppKeyAuth": []
          }
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **30 次/分钟**；**3 次/秒** |\n| 权限要求 | **Skill 管理**（`ai-sre`） |\n\n## 使用说明\n\n- 以 `multipart/form-data` 提交，包含 `file` 部分；支持的压缩包类型为 `.skill`、`.zip`、`.tar.gz`、`.tgz`，最大 100MB（超限文件会在读取正文前即被拒绝）。\n- `skill_id` + `replace=true` 会定向覆盖该指定技能，且跳过团队归属校验，因为调用者本就拥有该行。\n- 仅 `replace=true`（不带 `skill_id`）会按技能名称做 upsert；不设置 `replace` 则始终创建新技能 —— 这两条路径都要求调用者被允许向目标 `team_id` 创建资源。\n- 响应始终将 `can_edit` 标记为 `true`。\n- 每次调用都会记录到账户审计日志。\n",
          "href": "/zh/api-reference/ai-sre/skills/skill-write-upload",
          "metadata": {
            "sidebarTitle": "上传技能"
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResponseEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/SkillItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "skill_id": "skill_8s7Hn2kLpQ3xYbVc4Wd2m",
                    "account_id": 10023,
                    "team_id": 0,
                    "skill_name": "k8s-triage",
                    "description": "Diagnose unhealthy Kubernetes workloads from cluster events and pod logs.",
                    "version": "1.2.0",
                    "tags": [
                      "kubernetes",
                      "triage"
                    ],
                    "author": "sre-team",
                    "tools": [
                      "bash",
                      "mcp:prometheus/query"
                    ],
                    "status": "enabled",
                    "created_by": 80011,
                    "created_at": 1716960000000,
                    "updated_at": 1717046400000,
                    "can_edit": true,
                    "update_available": false,
                    "is_modified": false,
                    "created": true
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SkillUploadRequest"
              },
              "example": {
                "team_id": 0,
                "replace": false
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "AppKeyAuth": {
        "type": "apiKey",
        "in": "query",
        "name": "app_key",
        "description": "App key issued from the Flashduty console. Required on every public API call. Keep it secret — it grants the same access as the owning account."
      },
      "AutomationTriggerBearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "自动化 HTTP POST 触发器生成的一次性 Bearer Token。不要把它当作 app_key 使用。"
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid request — usually a missing or malformed parameter.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "missingParameter": {
                "summary": "Missing required parameter",
                "value": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "error": {
                    "code": "InvalidParameter",
                    "message": "The specified parameter skill_id is not valid."
                  }
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid app_key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "missingAppKey": {
                "value": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "error": {
                    "code": "Unauthorized",
                    "message": "You are unauthorized."
                  }
                }
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "The app_key is valid but lacks permission for this operation.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "accessDenied": {
                "value": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "error": {
                    "code": "AccessDenied",
                    "message": "Access Denied."
                  }
                }
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Rate limit hit. Either the global API limit or a per-account limit.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "rateLimited": {
                "value": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "error": {
                    "code": "RequestTooFrequently",
                    "message": "Request too frequently."
                  }
                }
              }
            }
          }
        }
      },
      "ServerError": {
        "description": "Unexpected server-side error. Include the request_id when reporting.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "internal": {
                "value": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "error": {
                    "code": "InternalError",
                    "message": "We encountered an internal error, and it has been reported. Please try again later."
                  }
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "A2AAgentCreateRequest": {
        "type": "object",
        "description": "新建 A2A 智能体的注册参数。",
        "properties": {
          "agent_name": {
            "type": "string",
            "description": "智能体显示名称。",
            "maxLength": 128
          },
          "instructions": {
            "type": "string",
            "description": "远程智能体的自然语言指令。必填 —— 已弃用的 `description` 字段仍保留以兼容旧客户端，若两者同时传入则必须与 `instructions` 完全一致。",
            "maxLength": 2000
          },
          "card_url": {
            "type": "string",
            "description": "远程智能体卡片的 URL。必须是 host 非空的绝对 `http` 或 `https` URL；可达性由执行环境在运行时验证，创建时不检查。"
          },
          "auth_type": {
            "type": "string",
            "description": "访问远程智能体的认证类型：`none`、`api_key` 或 `bearer`。"
          },
          "auth_config": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "认证配置键值对，如 API Key 或 Bearer Token。敏感键（`api_key`、`token`、`client_secret`）的值在返回时会被挖码。"
          },
          "streaming": {
            "type": "boolean",
            "description": "远程智能体是否支持流式响应。"
          },
          "team_id": {
            "type": "integer",
            "description": "团队范围：0 = 账户级；>0 = 团队。在账户级创建需要 owner/admin 角色；创建到某个团队需要真实属于该团队。",
            "format": "int64"
          },
          "environment_kind": {
            "type": "string",
            "enum": [
              "",
              "byoc"
            ],
            "description": "执行环境绑定。省略或传空字符串表示自动路由；`byoc` 将智能体固定到 `environment_id` 指定的 Runner。不接受 `cloud` —— 已配置的 A2A 智能体需要持久 Runner，而非一次性云沙箱。"
          },
          "environment_id": {
            "type": "string",
            "description": "BYOC Runner ID。当 `environment_kind=byoc` 时必填；该 Runner 必须属于账户或调用者所属的团队。"
          },
          "auth_mode": {
            "type": "string",
            "description": "认证模式：`shared`（默认）所有用户共享一份凭证；`per_user_secret` 需要 `secret_schema.header_name`；`per_user_oauth` 为每个用户单独进行 OAuth。"
          },
          "secret_schema": {
            "type": "string",
            "description": "JSON 编码的密钥 schema，例如 `{\"header_name\":\"X-Api-Key\"}`；`auth_mode=per_user_secret` 时必填。"
          },
          "oauth_metadata": {
            "type": "string",
            "description": "JSON 编码的 OAuth 元数据；由 `per_user_oauth` 模式的 OAuth 发现流程填充。"
          },
          "allow_insecure_oauth_http": {
            "type": "boolean",
            "description": "允许该智能体使用非回环的 HTTP OAuth 发现/元数据端点，而非强制 HTTPS。默认为 false。"
          },
          "allow_insecure_tls_skip_verify": {
            "type": "boolean",
            "description": "连接到该智能体端点时跳过 TLS 证书验证（自签/私有证书）。默认为 false。"
          }
        },
        "required": [
          "agent_name",
          "instructions",
          "card_url"
        ]
      },
      "A2AAgentCreateResponse": {
        "type": "object",
        "description": "注册 A2A 智能体的结果。",
        "properties": {
          "agent_id": {
            "type": "string",
            "description": "新建智能体的 ID。"
          }
        },
        "required": [
          "agent_id"
        ]
      },
      "A2AAgentIDRequest": {
        "type": "object",
        "description": "按 ID 查找 A2A 智能体。",
        "properties": {
          "agent_id": {
            "type": "string",
            "description": "目标智能体 ID。"
          }
        },
        "required": [
          "agent_id"
        ]
      },
      "A2AAgentItem": {
        "type": "object",
        "description": "一个已注册的 A2A（智能体间通信）远程智能体。",
        "properties": {
          "agent_id": {
            "type": "string",
            "description": "唯一的 A2A 智能体 ID（前缀 `a2a_`）。"
          },
          "account_id": {
            "type": "integer",
            "description": "所属账户 ID。",
            "format": "int64"
          },
          "team_id": {
            "type": "integer",
            "description": "团队范围：0 = 账户级；>0 = 所属团队。",
            "format": "int64"
          },
          "can_edit": {
            "type": "boolean",
            "description": "调用者是否可以编辑该智能体。"
          },
          "environment_kind": {
            "type": "string",
            "enum": [
              "",
              "byoc"
            ],
            "description": "执行环境绑定。空字符串表示自动路由；`byoc` 表示固定到 `environment_id` 指定的 Runner。"
          },
          "environment_id": {
            "type": "string",
            "description": "BYOC Runner ID。仅在 `environment_kind=byoc` 时设置，否则为空。"
          },
          "agent_name": {
            "type": "string",
            "description": "智能体显示名称。"
          },
          "instructions": {
            "type": "string",
            "description": "远程智能体的自然语言指令（旧名 `description`）。",
            "maxLength": 2000
          },
          "card_url": {
            "type": "string",
            "description": "远程智能体卡片的 URL。"
          },
          "auth_type": {
            "type": "string",
            "description": "访问远程智能体的认证类型：`none`、`api_key` 或 `bearer`。"
          },
          "auth_config": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "认证配置；敏感值（`api_key`、`token`、`client_secret`）会被挖码。"
          },
          "streaming": {
            "type": "boolean",
            "description": "远程智能体是否支持流式响应。"
          },
          "status": {
            "type": "string",
            "description": "智能体状态。",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "agent_card_name": {
            "type": "string",
            "description": "从远程卡片解析得到的智能体名称。"
          },
          "agent_card_skills": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "远程卡片宣告的技能。"
          },
          "card_resolve_timeout": {
            "type": "integer",
            "description": "卡片解析超时时间（秒）。目前恒为 0 —— API 尚未提供设置方式。"
          },
          "task_timeout": {
            "type": "integer",
            "description": "单个任务执行超时时间（秒）。目前恒为 0 —— API 尚未提供设置方式。"
          },
          "auth_mode": {
            "type": "string",
            "description": "认证模式。",
            "enum": [
              "shared",
              "per_user_secret",
              "per_user_oauth"
            ]
          },
          "secret_schema": {
            "type": "string",
            "description": "JSON 编码的密钥 schema（per_user_secret 模式）。"
          },
          "oauth_metadata": {
            "type": "string",
            "description": "JSON 编码的 OAuth 元数据（per_user_oauth 模式）。"
          },
          "allow_insecure_oauth_http": {
            "type": "boolean",
            "description": "允许该智能体使用非回环的 HTTP OAuth 发现/元数据端点，而非强制 HTTPS。"
          },
          "allow_insecure_tls_skip_verify": {
            "type": "boolean",
            "description": "连接到该智能体端点时跳过 TLS 证书验证。"
          },
          "created_by": {
            "type": "integer",
            "description": "创建该智能体的成员 ID。",
            "format": "int64"
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "创建时间。Unix 时间戳（毫秒）。"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "description": "最后更新时间。Unix 时间戳（毫秒）。"
          }
        },
        "required": [
          "agent_id",
          "account_id",
          "team_id",
          "can_edit",
          "environment_kind",
          "environment_id",
          "agent_name",
          "instructions",
          "card_url",
          "auth_type",
          "streaming",
          "status",
          "card_resolve_timeout",
          "task_timeout",
          "created_by",
          "created_at",
          "updated_at"
        ]
      },
      "A2AAgentListRequest": {
        "type": "object",
        "description": "查询 A2A 智能体列表的分页、范围与搜索过滤参数。",
        "properties": {
          "offset": {
            "type": "integer",
            "description": "分页偏移量。",
            "default": 0
          },
          "limit": {
            "type": "integer",
            "description": "页面大小。",
            "default": 20
          },
          "scope": {
            "type": "string",
            "enum": [
              "all",
              "account",
              "team"
            ],
            "default": "all",
            "description": "可见范围：`all`（账户级加上调用者可见的团队）、`account`（仅账户级）或 `team`（调用者可见团队中的团队级记录）。"
          },
          "query": {
            "type": "string",
            "description": "在智能体名称、指令、卡片 URL、智能体 ID 以及解析得到的卡片名称中进行不区分大小写的子串搜索。",
            "maxLength": 128
          },
          "team_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            },
            "description": "限定在这些团队 ID 内；留空表示使用调用者可见的团队集合。"
          },
          "include_account": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "是否包含账户级（team_id=0）记录。默认为 true。"
          }
        }
      },
      "A2AAgentListResponse": {
        "type": "object",
        "description": "分页的 A2A 智能体列表。",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/A2AAgentItem"
            },
            "description": "本页的 A2A 智能体。"
          },
          "total": {
            "type": "integer",
            "description": "符合条件的智能体总数。",
            "format": "int64"
          }
        },
        "required": [
          "items",
          "total"
        ]
      },
      "A2AAgentUpdateRequest": {
        "type": "object",
        "description": "对 A2A 智能体执行部分更新。字段为 null 或省略时保持不变。",
        "properties": {
          "agent_id": {
            "type": "string",
            "description": "目标智能体 ID。"
          },
          "agent_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的显示名称。省略则保持不变。",
            "maxLength": 128
          },
          "instructions": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的指令。省略则保持不变。已弃用的 `description` 字段仍可传入，若两者同时传入则必须一致。",
            "maxLength": 2000
          },
          "card_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的卡片 URL。省略则保持不变。"
          },
          "auth_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的认证类型。省略则保持不变。"
          },
          "auth_config": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "替换认证配置。省略则保持不变。对敏感键回传挖码值（或空字符串）将保留已存储的密钥而非覆盖。"
          },
          "streaming": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "切换流式支持。省略则保持不变。"
          },
          "team_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "重新分配团队范围。省略则保持不变。重新分配需要对目标团队的权限；若团队变更且未同时传入新的环境绑定，则现有 Runner 绑定必须对调用者仍可选，否则更新将被拒绝。",
            "format": "int64"
          },
          "environment_kind": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的执行环境绑定：空字符串表示自动，`byoc` 表示指定 Runner。不接受 `cloud`。省略则保持不变。"
          },
          "environment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的 BYOC Runner ID。与 `environment_kind=byoc` 一同传入。省略则保持不变。"
          },
          "auth_mode": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的认证模式：shared、per_user_secret 或 per_user_oauth。变更时会一并重写 secret_schema。"
          },
          "secret_schema": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的 JSON 密钥 schema。"
          },
          "oauth_metadata": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的 JSON OAuth 元数据。若 auth_mode 变更但未传入此字段，将被清空。"
          },
          "allow_insecure_oauth_http": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "切换该智能体的非回环 HTTP OAuth 发现开关。省略则保持不变。"
          },
          "allow_insecure_tls_skip_verify": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "切换该智能体的 TLS 证书验证跳过开关。省略则保持不变。"
          }
        },
        "required": [
          "agent_id"
        ]
      },
      "AutomationRuleCreateRequest": {
        "type": "object",
        "description": "创建自动化规则。",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "规则名称。"
          },
          "team_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "作用域团队 ID。0 或省略表示个人规则；>0 表示账户下某团队。创建后不可修改。"
          },
          "enabled": {
            "type": "boolean",
            "description": "规则创建后是否启用。API 省略时为 false；Chat/CLI 入口会默认发送 true，除非用户要求禁用。"
          },
          "cron_expr": {
            "type": "string",
            "description": "运行周期。支持 4 段 `hour day month weekday`，会补 `minute=0`；也支持 5 段 `minute hour day month weekday`。分钟必须是固定整数，秒级 6 段不支持。同时设置日期和星期几的 cron 会被拒绝。创建 API 当前要求该字段，即使只启用 HTTP POST trigger，也要提供一个有效 cron 并把 `schedule_trigger_enabled` 设为 false。",
            "example": "15 9 * * *"
          },
          "timezone": {
            "type": "string",
            "description": "`cron_expr` 计算所用的 IANA 时区，例如 `Asia/Shanghai`。必须是服务端可加载的合法时区名，非法值会被拒绝。省略时依次回退到调用者的成员时区、账户时区，最后是 UTC。"
          },
          "schedule_trigger_enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "是否启用 schedule trigger。省略时为 true；HTTP-POST-only 规则应传 false。"
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "每次运行发给 AI SRE Agent 的任务提示词。"
          },
          "environment_kind": {
            "type": "string",
            "description": "运行环境类型。省略或空字符串表示自动选择。",
            "enum": [
              "",
              "cloud",
              "byoc"
            ]
          },
          "environment_id": {
            "type": "string",
            "description": "BYOC Runner ID。仅 `environment_kind=byoc` 时使用。"
          },
          "http_post_trigger_enabled": {
            "type": "boolean",
            "description": "是否创建并启用 HTTP POST trigger。启用时响应里会返回一次性 token。"
          },
          "oncall_incident_trigger_enabled": {
            "type": "boolean",
            "description": "是否启用 On-call 故障触发器。"
          },
          "oncall_incident_channel_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "description": "监听的 On-call 集成 ID 列表；创建或启用该触发器时至少需要一个有效 ID。"
          },
          "oncall_incident_severities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "Critical",
                "Warning",
                "Info"
              ]
            },
            "description": "监听的故障严重程度，支持 Critical、Warning 和 Info；创建或启用该触发器时至少需要一个值。"
          }
        },
        "required": [
          "name",
          "cron_expr",
          "prompt"
        ]
      },
      "AutomationRuleIDRequest": {
        "type": "object",
        "properties": {
          "rule_id": {
            "type": "string",
            "description": "规则 ID。"
          }
        },
        "required": [
          "rule_id"
        ]
      },
      "AutomationRuleItem": {
        "type": "object",
        "description": "自动化规则。",
        "properties": {
          "rule_id": {
            "type": "string",
            "description": "规则 ID。"
          },
          "account_id": {
            "type": "integer",
            "format": "int64",
            "description": "账户 ID。"
          },
          "team_id": {
            "type": "integer",
            "format": "int64",
            "description": "作用域团队 ID；0 表示个人规则。"
          },
          "owner_id": {
            "type": "integer",
            "format": "int64",
            "description": "创建者 person ID。"
          },
          "name": {
            "type": "string",
            "description": "规则名称。"
          },
          "enabled": {
            "type": "boolean",
            "description": "规则是否启用。"
          },
          "run_scope": {
            "type": "string",
            "enum": [
              "person",
              "team"
            ],
            "description": "运行会话作用域。"
          },
          "cron_expr": {
            "type": "string",
            "description": "规范化后的 5 段 cron 表达式。"
          },
          "timezone": {
            "type": "string",
            "description": "`cron_expr` 计算所用的 IANA 时区。该字段上线后创建的规则始终会有值；上线前创建的旧数据可能为空，此时调度仍按 UTC 解析。"
          },
          "prompt": {
            "type": "string",
            "description": "任务提示词。"
          },
          "environment_kind": {
            "type": "string",
            "description": "运行环境类型。省略或空字符串表示自动选择。",
            "enum": [
              "",
              "cloud",
              "byoc"
            ]
          },
          "environment_id": {
            "type": "string",
            "description": "BYOC Runner ID。"
          },
          "schedule_trigger_id": {
            "type": "string",
            "description": "Schedule trigger ID。"
          },
          "schedule_trigger_enabled": {
            "type": "boolean",
            "description": "Schedule trigger 是否启用。"
          },
          "http_post_trigger_id": {
            "type": "string",
            "description": "HTTP POST trigger ID。"
          },
          "http_post_trigger_url": {
            "type": "string",
            "description": "HTTP POST 触发路径。"
          },
          "http_post_trigger_enabled": {
            "type": "boolean",
            "description": "HTTP POST trigger 是否启用。"
          },
          "oncall_incident_trigger_id": {
            "type": "string",
            "description": "On-call 故障触发器 ID。"
          },
          "oncall_incident_trigger_enabled": {
            "type": "boolean",
            "description": "是否启用 On-call 故障触发器。"
          },
          "oncall_incident_channel_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "description": "监听的 On-call 集成 ID 列表；创建或启用该触发器时至少需要一个有效 ID。"
          },
          "oncall_incident_severities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "Critical",
                "Warning",
                "Info"
              ]
            },
            "description": "监听的故障严重程度，支持 Critical、Warning 和 Info；创建或启用该触发器时至少需要一个值。"
          },
          "http_post_token": {
            "type": "string",
            "description": "HTTP POST trigger token。只在创建或轮换 token 的响应中返回；请立即保存。"
          },
          "can_edit": {
            "type": "boolean",
            "description": "当调用者可管理该规则时为 true：个人规则仅限创建者；团队规则限账户管理员或规则所属团队成员。"
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "创建时间，Unix 毫秒。"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "description": "更新时间，Unix 毫秒。"
          },
          "schedule_next_fire_at_ms": {
            "type": "integer",
            "format": "int64",
            "description": "下一次计划触发时间，Unix 毫秒；0 表示暂无可用的下一次计划触发。"
          }
        },
        "required": [
          "rule_id",
          "account_id",
          "team_id",
          "owner_id",
          "name",
          "enabled",
          "run_scope",
          "cron_expr",
          "timezone",
          "prompt",
          "environment_kind",
          "environment_id",
          "schedule_trigger_enabled",
          "http_post_trigger_enabled",
          "can_edit",
          "created_at",
          "updated_at",
          "schedule_next_fire_at_ms",
          "oncall_incident_trigger_enabled"
        ]
      },
      "AutomationRuleListRequest": {
        "type": "object",
        "description": "列出当前调用者可见的自动化规则。`all` 包含调用者自己的个人规则和可访问团队的团队规则；账户管理员在列表中不可见他人的个人规则。",
        "properties": {
          "p": {
            "type": "integer",
            "default": 1,
            "description": "页码，从 1 开始。"
          },
          "limit": {
            "type": "integer",
            "default": 20,
            "maximum": 100,
            "description": "每页数量。"
          },
          "scope": {
            "type": "string",
            "enum": [
              "all",
              "personal",
              "team"
            ],
            "description": "作用域过滤：`all`（自己的个人规则 + 可访问团队规则）、`personal` 或 `team`；默认 `all`。"
          },
          "team_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            },
            "description": "过滤到这些团队 ID；该字段只会收窄结果，不会扩大访问范围。"
          },
          "include_person": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "兼容字段；scope 为空且为 false 时等同于 team。"
          },
          "enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "按启用状态过滤。"
          },
          "keyword": {
            "type": "string",
            "maxLength": 64,
            "description": "按名称关键字过滤。"
          }
        }
      },
      "AutomationRuleListResponse": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "总数。"
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationRuleItem"
            }
          }
        },
        "required": [
          "total",
          "rules"
        ]
      },
      "AutomationRuleUpdateRequest": {
        "type": "object",
        "description": "更新自动化规则。字段省略或传 null 表示不修改。",
        "properties": {
          "rule_id": {
            "type": "string",
            "description": "目标规则 ID。"
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "新规则名称。"
          },
          "team_id": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0,
            "description": "只允许传当前值；创建后 personal / team scope 不可修改。"
          },
          "enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "是否启用规则。"
          },
          "cron_expr": {
            "type": [
              "string",
              "null"
            ],
            "description": "运行周期。支持 4 段 `hour day month weekday`，会补 `minute=0`；也支持 5 段 `minute hour day month weekday`。分钟必须是固定整数，秒级 6 段不支持。",
            "example": "15 9 * * *"
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ],
            "description": "更新 `cron_expr` 所用的 IANA 时区。省略或传 null 表示保持当前时区不变。"
          },
          "schedule_trigger_enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "是否启用 schedule trigger。"
          },
          "prompt": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的任务提示词。"
          },
          "environment_kind": {
            "type": [
              "string",
              "null"
            ],
            "description": "运行环境类型。省略或空字符串表示自动选择。",
            "enum": [
              "",
              "cloud",
              "byoc"
            ]
          },
          "environment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "BYOC Runner ID。"
          },
          "http_post_trigger_enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "是否启用 HTTP POST trigger。不存在时设为 true 会创建。"
          },
          "oncall_incident_trigger_enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "是否启用 On-call 故障触发器。"
          },
          "oncall_incident_channel_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "description": "监听的 On-call 集成 ID 列表；创建或启用该触发器时至少需要一个有效 ID。"
          },
          "oncall_incident_severities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "Critical",
                "Warning",
                "Info"
              ]
            },
            "description": "监听的故障严重程度，支持 Critical、Warning 和 Info；创建或启用该触发器时至少需要一个值。"
          },
          "rotate_http_post_trigger_token": {
            "type": "boolean",
            "description": "是否轮换 HTTP POST trigger token。新 token 只会在本次响应中返回。"
          }
        },
        "required": [
          "rule_id"
        ]
      },
      "AutomationRunItem": {
        "type": "object",
        "properties": {
          "run_id": {
            "type": "string",
            "description": "运行 ID。"
          },
          "kind": {
            "type": "string",
            "description": "运行类型。"
          },
          "account_id": {
            "type": "integer",
            "format": "int64",
            "description": "账户 ID。"
          },
          "rule_id": {
            "type": "string",
            "description": "规则 ID。"
          },
          "trigger_kind": {
            "type": "string",
            "enum": [
              "schedule",
              "debug",
              "manual",
              "http_post",
              "oncall_incident"
            ],
            "description": "触发来源。"
          },
          "occurrence_key": {
            "type": "string",
            "description": "幂等键。"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "retrying",
              "succeeded",
              "partial",
              "failed",
              "skipped",
              "abandoned"
            ],
            "description": "运行状态。"
          },
          "attempts": {
            "type": "integer",
            "description": "尝试次数。"
          },
          "started_at": {
            "type": "integer",
            "format": "int64",
            "description": "开始时间，Unix 毫秒。"
          },
          "completed_at": {
            "type": "integer",
            "format": "int64",
            "description": "完成时间，Unix 毫秒。0 表示尚未完成。"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "description": "运行耗时，毫秒。"
          },
          "error_code": {
            "type": "string",
            "description": "错误码。"
          },
          "error_message": {
            "type": "string",
            "description": "错误消息。"
          },
          "stats_json": {
            "description": "统计 JSON。"
          },
          "result_json": {
            "description": "结果 JSON。"
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "创建时间，Unix 毫秒。"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "description": "更新时间，Unix 毫秒。"
          }
        },
        "required": [
          "run_id",
          "kind",
          "account_id",
          "rule_id",
          "trigger_kind",
          "occurrence_key",
          "status",
          "attempts",
          "started_at",
          "completed_at",
          "duration_ms",
          "created_at",
          "updated_at"
        ]
      },
      "AutomationRunListRequest": {
        "type": "object",
        "properties": {
          "rule_id": {
            "type": "string",
            "description": "目标规则 ID。"
          },
          "p": {
            "type": "integer",
            "default": 1,
            "description": "页码，从 1 开始。"
          },
          "limit": {
            "type": "integer",
            "default": 20,
            "maximum": 100,
            "description": "每页数量。"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "retrying",
              "succeeded",
              "partial",
              "failed",
              "skipped",
              "abandoned"
            ],
            "description": "运行状态过滤。"
          },
          "trigger_kind": {
            "type": "string",
            "enum": [
              "schedule",
              "debug",
              "manual",
              "http_post",
              "oncall_incident"
            ],
            "description": "触发来源过滤条件。"
          },
          "started_after_ms": {
            "type": "integer",
            "format": "int64",
            "description": "开始时间下界，Unix 毫秒。"
          },
          "started_before_ms": {
            "type": "integer",
            "format": "int64",
            "description": "开始时间上界，Unix 毫秒。"
          }
        },
        "required": [
          "rule_id"
        ]
      },
      "AutomationRunListResponse": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "总数。"
          },
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationRunItem"
            }
          }
        },
        "required": [
          "total",
          "runs"
        ]
      },
      "AutomationRunView": {
        "type": "object",
        "description": "手动触发所创建运行的引用。",
        "properties": {
          "run_id": {
            "type": "string",
            "description": "运行 ID，运行创建后始终会有值。"
          },
          "session_id": {
            "type": "string",
            "description": "本次运行对应的 AI SRE 会话 ID。由于调用只会在会话启动后才返回，因此在 200 响应中始终会有值。"
          }
        },
        "required": [
          "run_id"
        ]
      },
      "AutomationTemplateItem": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "模板名称。"
          },
          "description": {
            "type": "string",
            "description": "模板说明。"
          },
          "icon": {
            "type": "string",
            "description": "图标标识。"
          },
          "enabled": {
            "type": "boolean",
            "description": "模板是否可用。"
          },
          "prompt": {
            "type": "string",
            "description": "模板提示词。"
          }
        },
        "required": [
          "name",
          "description",
          "icon",
          "enabled",
          "prompt"
        ]
      },
      "AutomationTemplateListRequest": {
        "type": "object",
        "properties": {
          "locale": {
            "type": "string",
            "maxLength": 16,
            "description": "模板语言，例如 zh-CN 或 en-US。省略时按请求语言自动选择。"
          }
        }
      },
      "AutomationTemplateListResponse": {
        "type": "object",
        "properties": {
          "templates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationTemplateItem"
            }
          }
        },
        "required": [
          "templates"
        ]
      },
      "ContextResolvedItem": {
        "type": "object",
        "description": "该会话三层知识包解析结果的快照。",
        "properties": {
          "account_pack_id": {
            "type": "string",
            "description": "解析出的账户级知识包 ID。"
          },
          "team_pack_id": {
            "type": "string",
            "description": "解析出的团队级知识包 ID。"
          },
          "incident_id": {
            "type": "string",
            "description": "作战室来源时绑定的故障 ID。"
          },
          "resolved_at_ms": {
            "type": "integer",
            "format": "int64",
            "description": "知识包解析时间，Unix 毫秒时间戳。"
          },
          "versions": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "各知识包解析版本映射。"
          }
        },
        "required": [
          "resolved_at_ms"
        ]
      },
      "DutyError": {
        "type": "object",
        "description": "Error payload inside the response envelope. Present only on non-2xx responses.",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "message": {
            "type": "string",
            "description": "Human-readable error message, localized by the caller's Accept-Language. May contain field names, IDs, or other context from the failing request."
          }
        },
        "required": [
          "code",
          "message"
        ]
      },
      "EnvironmentBinding": {
        "type": "object",
        "description": "会话绑定的 runner 或云沙箱。首条消息前为 null。",
        "properties": {
          "kind": {
            "type": "string",
            "description": "会话当前绑定的环境类型：`cloud`（托管沙箱）或 `byoc`（自建 runner）。",
            "enum": [
              "cloud",
              "byoc"
            ]
          },
          "id": {
            "type": "string",
            "description": "环境标识：`cloud` 绑定为云沙箱 ID，`byoc` 绑定为 runner/环境 ID。"
          },
          "name": {
            "type": "string",
            "description": "可读的环境名称；cloud 绑定使用默认允许列表时为空。"
          },
          "status": {
            "type": "string",
            "description": "绑定的实时健康状态，按类型分命名空间：BYOC 使用 online/pending/offline/deleted；cloud 使用 available/rebuilding/expired。",
            "enum": [
              "online",
              "pending",
              "offline",
              "deleted",
              "available",
              "rebuilding",
              "expired"
            ]
          }
        },
        "required": [
          "kind",
          "id"
        ]
      },
      "ErrorCode": {
        "type": "string",
        "description": "Flashduty error code enum. Every failed API response sets `error.code` to one of these values. The value is a stable wire string — not a localized message and not a numeric status. HTTP status is informational.",
        "enum": [
          "OK",
          "InvalidParameter",
          "BadRequest",
          "InvalidContentType",
          "ResourceNotFound",
          "NoLicense",
          "ReferenceExist",
          "Unauthorized",
          "BalanceNotEnough",
          "AccessDenied",
          "RouteNotFound",
          "MethodNotAllowed",
          "UndonedOrderExist",
          "RequestLocked",
          "EntityTooLarge",
          "RequestTooFrequently",
          "RequestVerifyRequired",
          "DangerousOperation",
          "InternalError",
          "ServiceUnavailable"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "description": "Response envelope for errors. `error` is required; `data` is absent.",
        "properties": {
          "request_id": {
            "type": "string",
            "example": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
          },
          "error": {
            "$ref": "#/components/schemas/DutyError"
          }
        },
        "required": [
          "request_id",
          "error"
        ]
      },
      "EventItem": {
        "type": "object",
        "description": "单条已持久化的会话事件。content/actions/usage_metadata 携带原始 ADK 信封，请将其视为不透明的结构化负载。",
        "properties": {
          "event_id": {
            "type": "string",
            "description": "事件标识。"
          },
          "session_id": {
            "type": "string",
            "description": "所属会话 ID。"
          },
          "invocation_id": {
            "type": "string",
            "description": "标识一轮的 ADK 调用 ID。"
          },
          "author": {
            "type": "string",
            "description": "事件作者（如 user 或智能体名称）。"
          },
          "branch": {
            "type": "string",
            "description": "嵌套智能体的 ADK 分支路径。"
          },
          "content": {
            "type": "object",
            "additionalProperties": true,
            "description": "ADK content 信封 {role, parts:[...]}。"
          },
          "actions": {
            "type": "object",
            "additionalProperties": true,
            "description": "ADK actions 信封（状态增量、转移、升级）。"
          },
          "usage_metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "单轮 token 用量元数据。"
          },
          "partial": {
            "type": "boolean",
            "description": "流式部分分片时为 true。"
          },
          "turn_complete": {
            "type": "boolean",
            "description": "一轮的终止事件上为 true。"
          },
          "error_code": {
            "type": "string",
            "description": "当该事件表示失败时的错误码。"
          },
          "error_message": {
            "type": "string",
            "description": "可读的错误信息（如有）。"
          },
          "status": {
            "type": "string",
            "description": "事件状态。",
            "enum": [
              "normal",
              "compressed"
            ]
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "事件写入时间，Unix 毫秒时间戳。"
          }
        },
        "required": [
          "event_id",
          "session_id",
          "partial",
          "turn_complete",
          "created_at"
        ]
      },
      "MCPServerCreateRequest": {
        "type": "object",
        "description": "新建 MCP 服务器的配置。",
        "properties": {
          "server_name": {
            "type": "string",
            "description": "MCP 服务器名称，在账户内唯一。",
            "minLength": 1,
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "description": "服务器描述。",
            "minLength": 1,
            "maxLength": 1024
          },
          "transport": {
            "type": "string",
            "description": "传输协议。",
            "enum": [
              "stdio",
              "sse",
              "streamable-http"
            ]
          },
          "command": {
            "type": "string",
            "description": "可执行命令（stdio 传输）。"
          },
          "args": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "命令参数（stdio 传输）。"
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "环境变量（stdio 传输）。"
          },
          "url": {
            "type": "string",
            "description": "服务器 URL（sse / streamable-http 传输）。"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "HTTP 头（sse / streamable-http）。"
          },
          "connect_timeout": {
            "type": "integer",
            "description": "连接超时，单位秒。0 表示默认（10 秒）。"
          },
          "call_timeout": {
            "type": "integer",
            "description": "工具调用超时，单位秒。0 表示默认（60 秒）。"
          },
          "auth_mode": {
            "type": "string",
            "description": "认证模式：shared（默认）、per_user_secret 或 per_user_oauth。"
          },
          "secret_schema": {
            "type": "string",
            "description": "JSON 密钥 schema；auth_mode=per_user_secret 时必填。"
          },
          "oauth_metadata": {
            "type": "string",
            "description": "JSON OAuth 元数据；为 per_user_oauth 预留。"
          },
          "status": {
            "type": "string",
            "description": "初始状态。",
            "enum": [
              "enabled",
              "disabled"
            ],
            "default": "enabled"
          },
          "team_id": {
            "type": "integer",
            "description": "团队范围：0 表示账户级；>0 表示团队。",
            "format": "int64"
          },
          "environment_kind": {
            "type": "string",
            "description": "绑定到指定 BYOC 运行器（需同时提供 environment_id）。省略或留空表示自动选择；MCP 服务器不支持 cloud。",
            "enum": [
              "byoc"
            ]
          },
          "environment_id": {
            "type": "string",
            "description": "运行器 ID；environment_kind 为 byoc 时必填。"
          },
          "allow_insecure_oauth_http": {
            "type": "boolean",
            "description": "允许该服务器的 OAuth 令牌交换使用明文 HTTP，仅用于测试，默认 false。"
          },
          "allow_insecure_tls_skip_verify": {
            "type": "boolean",
            "description": "连接该服务器时跳过 TLS 证书校验，仅用于测试，默认 false。"
          },
          "source_template_name": {
            "type": "string",
            "description": "从连接器模板创建时的市场模板名称。"
          }
        },
        "required": [
          "server_name",
          "description",
          "transport"
        ]
      },
      "MCPServerDeleteRequest": {
        "type": "object",
        "description": "按 ID 删除 MCP 服务器。",
        "properties": {
          "server_id": {
            "type": "string",
            "description": "目标 MCP 服务器 ID。"
          }
        },
        "required": [
          "server_id"
        ]
      },
      "MCPServerGetRequest": {
        "type": "object",
        "description": "按 ID 查询 MCP 服务器。",
        "properties": {
          "server_id": {
            "type": "string",
            "description": "目标 MCP 服务器 ID。"
          }
        },
        "required": [
          "server_id"
        ]
      },
      "MCPServerItem": {
        "type": "object",
        "description": "账户下注册的 MCP 服务器（连接器）。",
        "properties": {
          "server_id": {
            "type": "string",
            "description": "MCP 服务器唯一 ID（前缀 `mcp_`）。"
          },
          "account_id": {
            "type": "integer",
            "description": "所属账户 ID。",
            "format": "int64"
          },
          "team_id": {
            "type": "integer",
            "description": "团队范围：0 表示账户级；>0 表示所属团队。",
            "format": "int64"
          },
          "can_edit": {
            "type": "boolean",
            "description": "调用者是否可编辑该服务器。"
          },
          "environment_kind": {
            "type": "string",
            "description": "运行环境类型：留空表示自动选择，`byoc` 表示绑定到指定运行器；MCP 服务器不支持绑定 `cloud`。",
            "enum": [
              "",
              "byoc"
            ]
          },
          "environment_id": {
            "type": "string",
            "description": "environment_kind 为 byoc 时对应的运行器 ID；否则为空。"
          },
          "server_name": {
            "type": "string",
            "description": "MCP 服务器名称，在账户内唯一。"
          },
          "description": {
            "type": "string",
            "description": "服务器描述。"
          },
          "ai_description": {
            "type": "string",
            "description": "LLM 生成的描述，存在时优先于 `description`。"
          },
          "transport": {
            "type": "string",
            "description": "传输协议。",
            "enum": [
              "stdio",
              "sse",
              "streamable-http"
            ]
          },
          "command": {
            "type": "string",
            "description": "可执行命令（仅 stdio 传输）。"
          },
          "args": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "命令参数（stdio 传输）。"
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "环境变量（stdio 传输）；密钥值已脱敏。"
          },
          "url": {
            "type": "string",
            "description": "服务器 URL（sse / streamable-http 传输）。"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "HTTP 头（sse / streamable-http）；密钥值已脱敏。"
          },
          "proxy_url": {
            "type": "string",
            "description": "访问服务器使用的出站代理 URL。"
          },
          "status": {
            "type": "string",
            "description": "服务器状态。",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "connect_timeout": {
            "type": "integer",
            "description": "连接超时，单位秒（0 表示默认 10 秒）。"
          },
          "call_timeout": {
            "type": "integer",
            "description": "工具调用超时，单位秒（0 表示默认 60 秒）。"
          },
          "allow_insecure_oauth_http": {
            "type": "boolean",
            "description": "允许该服务器的 OAuth 令牌交换使用明文 HTTP；仅用于测试。"
          },
          "allow_insecure_tls_skip_verify": {
            "type": "boolean",
            "description": "连接该服务器时跳过 TLS 证书校验；仅用于测试。"
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MCPToolInfo"
            },
            "description": "实时工具列表；由 get/test 接口填充。"
          },
          "tool_count": {
            "type": "integer",
            "description": "实时工具列表的数量。"
          },
          "list_error": {
            "type": "string",
            "description": "实时获取工具列表失败时的错误信息。"
          },
          "auth_mode": {
            "type": "string",
            "description": "认证模式。",
            "enum": [
              "shared",
              "per_user_secret",
              "per_user_oauth"
            ]
          },
          "secret_schema": {
            "type": "string",
            "description": "JSON 编码的密钥 schema（per_user_secret 模式）。"
          },
          "oauth_metadata": {
            "type": "string",
            "description": "JSON 编码的 OAuth 元数据（per_user_oauth 模式）。"
          },
          "source_template_name": {
            "type": "string",
            "description": "该连接器安装来源的市场模板名称；自建为空。"
          },
          "created_by": {
            "type": "integer",
            "description": "创建该服务器的成员 ID。",
            "format": "int64"
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "创建时间，Unix 毫秒时间戳。"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "description": "最近更新时间，Unix 毫秒时间戳。"
          }
        },
        "required": [
          "server_id",
          "account_id",
          "team_id",
          "can_edit",
          "environment_kind",
          "environment_id",
          "server_name",
          "description",
          "transport",
          "status",
          "connect_timeout",
          "call_timeout",
          "created_by",
          "created_at",
          "updated_at"
        ]
      },
      "MCPServerListRequest": {
        "type": "object",
        "description": "MCP 服务器列表的分页、范围与搜索过滤条件。",
        "properties": {
          "p": {
            "type": "integer",
            "description": "页码，从 1 开始。",
            "default": 1
          },
          "limit": {
            "type": "integer",
            "description": "每页数量。",
            "default": 20
          },
          "scope": {
            "type": "string",
            "description": "结果范围：account 仅返回账户级记录，team 仅返回调用者可见的团队级记录，省略则默认为 all（返回两者，仍受 team_ids/include_account 约束）。",
            "enum": [
              "all",
              "account",
              "team"
            ]
          },
          "query": {
            "type": "string",
            "maxLength": 128,
            "description": "对名称、描述、AI 生成描述、服务器 ID、传输协议、URL、命令、市场模板名称进行不区分大小写的子串搜索。"
          },
          "team_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            },
            "description": "按团队 ID 过滤；为空则使用调用者可见范围。"
          },
          "include_account": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "是否包含账户级（team_id=0）记录，默认 true。"
          }
        }
      },
      "MCPServerListResponse": {
        "type": "object",
        "description": "分页的 MCP 服务器列表。",
        "properties": {
          "total": {
            "type": "integer",
            "description": "匹配的服务器总数。",
            "format": "int64"
          },
          "servers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MCPServerItem"
            },
            "description": "当前页的 MCP 服务器。"
          }
        },
        "required": [
          "total",
          "servers"
        ]
      },
      "MCPServerStatusRequest": {
        "type": "object",
        "description": "按 ID 启用/禁用 MCP 服务器。",
        "properties": {
          "server_id": {
            "type": "string",
            "description": "目标 MCP 服务器 ID。"
          }
        },
        "required": [
          "server_id"
        ]
      },
      "MCPServerUpdateRequest": {
        "type": "object",
        "description": "MCP 服务器的部分更新；省略字段表示不变。",
        "properties": {
          "server_id": {
            "type": "string",
            "description": "目标 MCP 服务器 ID。"
          },
          "server_name": {
            "type": "string",
            "description": "新名称。",
            "minLength": 1,
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "description": "新描述。",
            "minLength": 1,
            "maxLength": 1024
          },
          "transport": {
            "type": "string",
            "description": "传输协议。",
            "enum": [
              "stdio",
              "sse",
              "streamable-http"
            ]
          },
          "command": {
            "type": "string",
            "description": "可执行命令（stdio 传输）。"
          },
          "args": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "命令参数（stdio 传输）。"
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "环境变量（stdio 传输）。"
          },
          "url": {
            "type": "string",
            "description": "服务器 URL（sse / streamable-http 传输）。"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "HTTP 头（sse / streamable-http）。"
          },
          "connect_timeout": {
            "type": "integer",
            "description": "连接超时，单位秒。0 表示默认（10 秒）。"
          },
          "call_timeout": {
            "type": "integer",
            "description": "工具调用超时，单位秒。0 表示默认（60 秒）。"
          },
          "auth_mode": {
            "type": "string",
            "description": "认证模式：shared（默认）、per_user_secret 或 per_user_oauth。"
          },
          "secret_schema": {
            "type": "string",
            "description": "JSON 密钥 schema；auth_mode=per_user_secret 时必填。"
          },
          "oauth_metadata": {
            "type": "string",
            "description": "JSON OAuth 元数据；为 per_user_oauth 预留。"
          },
          "team_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "重新分配团队范围：0 表示账户级；>0 表示团队。省略则不变。",
            "format": "int64"
          },
          "environment_kind": {
            "type": [
              "string",
              "null"
            ],
            "description": "重新指定运行器绑定：byoc（需同时提供 environment_id）或空字符串表示重置为自动选择。省略（null）表示保持当前绑定不变。"
          },
          "environment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "与 environment_kind=byoc 配对的运行器 ID。省略（null）表示保持当前绑定不变。"
          },
          "allow_insecure_oauth_http": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "是否允许 OAuth 令牌交换使用明文 HTTP。省略表示不变。"
          },
          "allow_insecure_tls_skip_verify": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "是否跳过 TLS 证书校验。省略表示不变。"
          }
        },
        "required": [
          "server_id"
        ]
      },
      "MCPToolInfo": {
        "type": "object",
        "description": "MCP 服务器暴露的单个工具的元数据。",
        "properties": {
          "name": {
            "type": "string",
            "description": "工具名称。"
          },
          "description": {
            "type": "string",
            "description": "工具描述。"
          },
          "input_schema": {
            "type": "object",
            "additionalProperties": true,
            "description": "描述工具输入参数的 JSON Schema。"
          }
        },
        "required": [
          "name",
          "description"
        ]
      },
      "ManualRunRuleResult": {
        "type": "object",
        "description": "手动运行一次自动化规则（跳过其计划触发时间）的结果。",
        "properties": {
          "rule_id": {
            "type": "string",
            "description": "被运行的规则 ID。"
          },
          "trigger_kind": {
            "type": "string",
            "enum": [
              "manual"
            ],
            "description": "该操作固定为 manual。"
          },
          "preflight": {
            "$ref": "#/components/schemas/PreflightResult"
          },
          "run": {
            "$ref": "#/components/schemas/AutomationRunView"
          }
        },
        "required": [
          "rule_id",
          "trigger_kind",
          "preflight"
        ]
      },
      "PreflightResult": {
        "type": "object",
        "description": "在允许发起手动运行前计算出的就绪检查结果。",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "全部就绪检查是否通过。凡是能返回给调用者的响应中该值恒为 true——预检失败会直接返回 400/403 错误，而不是 ok=false 的响应体。"
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "按执行顺序列出的就绪检查项名称。当前固定为：rule_loaded、actor_authorized、app_allowed、runtime_scope_resolved、rule_config_valid。"
          },
          "scope": {
            "type": "string",
            "enum": [
              "person",
              "team"
            ],
            "description": "本次运行解析出的作用域，与规则的 run_scope 一致。"
          },
          "owner_id": {
            "type": "integer",
            "format": "int64",
            "description": "规则所有者 person ID。"
          },
          "team_id": {
            "type": "integer",
            "format": "int64",
            "description": "规则的作用域团队 ID；0 表示个人规则。"
          },
          "app_name": {
            "type": "string",
            "description": "规则所属的 App。当前始终为 ai-sre；手动运行目前仅支持该 App。"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "预检过程中给出的非致命警告。没有警告时省略或为空数组。"
          }
        },
        "required": [
          "ok",
          "checks",
          "scope",
          "owner_id",
          "team_id",
          "app_name"
        ]
      },
      "ResponseEnvelope": {
        "type": "object",
        "description": "Standard response envelope used by every Flashduty public API. On success `data` contains the endpoint-specific payload and `error` is absent. On failure `error` is present and `data` is absent. `request_id` is always present and is also mirrored in the `Flashcat-Request-Id` response header.",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "Unique ID for this request. Mirrored in the Flashcat-Request-Id header. Include it when reporting issues.",
            "example": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
          },
          "error": {
            "$ref": "#/components/schemas/DutyError"
          },
          "data": {
            "description": "Endpoint-specific payload. See each operation's 200 response schema."
          }
        },
        "required": [
          "request_id"
        ]
      },
      "SessionDeleteRequest": {
        "type": "object",
        "description": "按 ID 删除会话。",
        "properties": {
          "session_id": {
            "type": "string",
            "description": "目标会话 ID。",
            "minLength": 1
          }
        },
        "required": [
          "session_id"
        ]
      },
      "SessionExportRequest": {
        "type": "object",
        "description": "以流式 NDJSON 导出单个会话的完整事件记录。",
        "properties": {
          "session_id": {
            "type": "string",
            "description": "目标会话 ID。"
          },
          "include_subagents": {
            "type": "boolean",
            "description": "为 true 时，每条 subagent_dispatch 行后会跟随子会话的完整事件流，并以其自身的 session_meta 包裹。默认 false。"
          }
        },
        "required": [
          "session_id"
        ]
      },
      "SessionGetRequest": {
        "type": "object",
        "description": "查询单个会话，并返回其最近事件的一页（向更早方向分页）。",
        "properties": {
          "session_id": {
            "type": "string",
            "description": "目标会话 ID。",
            "minLength": 1
          },
          "num_recent_events": {
            "type": "integer",
            "description": "旧版每页数量：返回的最近事件数。与 `limit` 同时设置时以 `limit` 为准；0 使用服务端默认值（100）。",
            "minimum": 0,
            "maximum": 1000
          },
          "limit": {
            "type": "integer",
            "description": "事件每页数量；优先于 `num_recent_events`。0 使用服务端默认值（100）。",
            "minimum": 0,
            "maximum": 1000
          },
          "search_after_ctx": {
            "type": "string",
            "description": "上一次响应返回的不透明游标；回传以获取更早的一页。",
            "maxLength": 4096
          }
        },
        "required": [
          "session_id"
        ]
      },
      "SessionGetResponse": {
        "type": "object",
        "description": "一个会话及其事件的一页（向更早方向分页）。",
        "properties": {
          "session": {
            "$ref": "#/components/schemas/SessionItem"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventItem"
            },
            "description": "最近事件，按 (created_at, event_id) 升序排列。"
          },
          "has_more_older": {
            "type": "boolean",
            "description": "当本页之外仍有更早的事件时为 true。"
          },
          "search_after_ctx": {
            "type": "string",
            "description": "不透明游标；作为 search_after_ctx 回传以获取更早的一页。has_more_older 为 false 时省略。"
          },
          "suggest_init": {
            "type": "boolean",
            "description": "账户级引导标志：当账户在任何范围内都没有知识包时为 true；并非该会话独有的属性。"
          }
        },
        "required": [
          "session",
          "events",
          "has_more_older",
          "suggest_init"
        ]
      },
      "SessionItem": {
        "type": "object",
        "description": "单条智能体会话记录。",
        "properties": {
          "session_id": {
            "type": "string",
            "description": "会话标识。"
          },
          "parent_session_id": {
            "type": "string",
            "description": "子智能体（子）会话的父会话 ID；否则为空。"
          },
          "session_name": {
            "type": "string",
            "description": "会话标题；未命名会话可能为空。"
          },
          "app_name": {
            "type": "string",
            "description": "拥有该会话的智能体应用。"
          },
          "entry_kind": {
            "type": "string",
            "description": "创建该会话的入口来源。",
            "enum": [
              "web",
              "im",
              "api",
              "automation",
              "subagent"
            ]
          },
          "person_id": {
            "type": "string",
            "description": "创建者人员 ID。"
          },
          "team_id": {
            "type": "integer",
            "format": "int64",
            "description": "所属团队 ID；0 表示未绑定团队。创建后不可变更。"
          },
          "team_name": {
            "type": "string",
            "description": "解析出的团队名称；未绑定或团队已删除时为空。"
          },
          "is_mine": {
            "type": "boolean",
            "description": "当该会话由调用者创建时为 true。"
          },
          "can_manage": {
            "type": "boolean",
            "description": "当调用者可重命名/归档/删除该会话时为 true；个人会话仅创建者可管理，团队会话允许创建者、账户管理员或团队成员管理。"
          },
          "status": {
            "type": "string",
            "description": "生命周期状态。",
            "enum": [
              "enabled",
              "deleted"
            ]
          },
          "incognito": {
            "type": "boolean",
            "description": "无痕（不持久化记忆）会话时为 true。"
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "会话创建时间，Unix 毫秒时间戳。"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "description": "会话最近更新时间，Unix 毫秒时间戳。"
          },
          "template_staging_round_id": {
            "type": "string",
            "description": "当前 save→validate 轮次 ID（仅 template-assistant）；否则为空。"
          },
          "state": {
            "type": "object",
            "additionalProperties": true,
            "description": "原始会话状态包（会话级键）。为空时省略。"
          },
          "bound_environment": {
            "$ref": "#/components/schemas/EnvironmentBinding"
          },
          "context_resolved": {
            "$ref": "#/components/schemas/ContextResolvedItem"
          },
          "token_usage": {
            "$ref": "#/components/schemas/SessionTokenUsage"
          },
          "current_context_tokens": {
            "type": "integer",
            "format": "int64",
            "description": "截至最近一轮的 LLM 上下文窗口的 token 数。0 表示尚无已完成的轮次。"
          },
          "context_window": {
            "type": "integer",
            "format": "int64",
            "description": "所绑定模型的最大上下文 token 数。0 表示未知。"
          },
          "archived_at": {
            "type": "integer",
            "format": "int64",
            "description": "归档时间，Unix 毫秒时间戳；0 表示未归档。"
          },
          "pinned_at": {
            "type": "integer",
            "format": "int64",
            "description": "调用者的个人置顶时间，Unix 毫秒时间戳；0 表示未置顶。"
          },
          "last_event_at": {
            "type": "integer",
            "format": "int64",
            "description": "最近一条助手侧事件的时间，Unix 毫秒时间戳。"
          },
          "is_running": {
            "type": "boolean",
            "description": "当该会话当前有正在进行的智能体轮次时为 true。"
          },
          "has_unread": {
            "type": "boolean",
            "description": "当存在调用者尚未查看的助手输出时为 true。"
          },
          "current_turn_started_at": {
            "type": "integer",
            "format": "int64",
            "description": "本轮（当前或最近一轮）开始时间，Unix 毫秒时间戳；尚未开始任何轮次时为 0。"
          },
          "current_turn_active_ms": {
            "type": "integer",
            "format": "int64",
            "description": "本轮（当前或最近一轮）的实际工作时长（毫秒），不含等待 ask_user 的时间；每次新轮次开始时重置为 0。"
          },
          "current_turn_wait_ms": {
            "type": "integer",
            "format": "int64",
            "description": "当前轮次累计的 ask_user 人工等待时长（毫秒）；每次新轮次开始时重置为 0。"
          },
          "current_turn_tokens": {
            "type": "integer",
            "format": "int64",
            "description": "当前进行中轮次的 token 总数（输入+输出+推理），涵盖父会话及其所有子智能体；仅由 session/get 在会话运行时计算，session/list 响应及空闲时恒为 0。"
          }
        },
        "required": [
          "session_id",
          "session_name",
          "app_name",
          "person_id",
          "team_id",
          "is_mine",
          "can_manage",
          "status",
          "incognito",
          "created_at",
          "updated_at",
          "current_context_tokens",
          "context_window",
          "archived_at",
          "pinned_at",
          "is_running",
          "has_unread",
          "current_turn_started_at",
          "current_turn_active_ms",
          "current_turn_wait_ms",
          "current_turn_tokens"
        ]
      },
      "SessionListRequest": {
        "type": "object",
        "description": "查询智能体会话列表的过滤条件。`all` 表示调用者自己的个人会话和可访问团队的团队会话；账户管理员不可见他人的个人会话。",
        "properties": {
          "app_name": {
            "type": "string",
            "description": "要查询其会话的智能体应用。",
            "enum": [
              "ask-ai",
              "support",
              "support-website",
              "support-flashcat",
              "ai-sre",
              "template-assistant",
              "swe"
            ]
          },
          "p": {
            "type": "integer",
            "description": "页码，从 1 开始。",
            "default": 1,
            "minimum": 1
          },
          "limit": {
            "type": "integer",
            "description": "每页数量，1–100。",
            "minimum": 1,
            "maximum": 100,
            "default": 20
          },
          "orderby": {
            "type": "string",
            "description": "排序字段。",
            "enum": [
              "created_at",
              "updated_at"
            ]
          },
          "asc": {
            "type": "boolean",
            "description": "为 true 时升序；仅在设置 `orderby` 时生效。"
          },
          "include_subagent_sessions": {
            "type": "boolean",
            "description": "是否在列表中包含子智能体派生的会话。"
          },
          "keyword": {
            "type": "string",
            "description": "按会话名称关键字过滤。",
            "maxLength": 64
          },
          "scope": {
            "type": "string",
            "description": "可见范围：`all`（自己的个人会话 + 可访问团队会话）、`personal` 或 `team`；默认 `all`。",
            "enum": [
              "all",
              "personal",
              "team"
            ]
          },
          "team_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            },
            "description": "可选的团队过滤；与 `scope` 取交集，且不会扩大访问范围。"
          },
          "entry_kinds": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "web",
                "im",
                "api",
                "automation"
              ]
            },
            "description": "仅返回由这些入口产生的会话；为空则返回所有类型。"
          },
          "status": {
            "type": "string",
            "description": "归档分桶：active（默认）返回未归档，archived 返回已归档，all 返回全部。",
            "enum": [
              "active",
              "archived",
              "all"
            ]
          }
        },
        "required": [
          "app_name"
        ]
      },
      "SessionListResponse": {
        "type": "object",
        "description": "一页智能体会话。",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "匹配过滤条件的会话总数（忽略分页）。"
          },
          "sessions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionItem"
            },
            "description": "当前页的会话。"
          },
          "suggest_init": {
            "type": "boolean",
            "description": "账户级引导标志：当账户在任何范围内都没有知识包时为 true；与本次调用的过滤条件无关。"
          }
        },
        "required": [
          "total",
          "sessions",
          "suggest_init"
        ]
      },
      "SessionTokenUsage": {
        "type": "object",
        "description": "跨所有轮次的会话级 token 累计汇总。账户计费的权威来源。",
        "properties": {
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "description": "提示（输入）token 总数，含缓存部分。"
          },
          "cached_tokens": {
            "type": "integer",
            "format": "int64",
            "description": "input_tokens 中由提示缓存命中的部分。"
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "description": "生成（输出）token 总数。"
          },
          "reasoning_tokens": {
            "type": "integer",
            "format": "int64",
            "description": "推理/思考 token 总数。"
          }
        },
        "required": [
          "input_tokens",
          "cached_tokens",
          "output_tokens",
          "reasoning_tokens"
        ]
      },
      "SkillDeleteRequest": {
        "type": "object",
        "description": "按 ID 删除技能。",
        "properties": {
          "skill_id": {
            "type": "string",
            "description": "目标技能 ID。"
          }
        },
        "required": [
          "skill_id"
        ]
      },
      "SkillGetRequest": {
        "type": "object",
        "description": "按 ID 查询技能。",
        "properties": {
          "skill_id": {
            "type": "string",
            "description": "目标技能 ID。"
          }
        },
        "required": [
          "skill_id"
        ]
      },
      "SkillItem": {
        "type": "object",
        "description": "AI SRE 技能 —— 智能体可加载的 SKILL.md 打包资源。",
        "properties": {
          "skill_id": {
            "type": "string",
            "description": "技能唯一 ID（前缀 `skill_`）。"
          },
          "account_id": {
            "type": "integer",
            "description": "所属账户 ID。",
            "format": "int64"
          },
          "team_id": {
            "type": "integer",
            "description": "团队范围：0 表示账户级；>0 表示所属团队。",
            "format": "int64"
          },
          "skill_name": {
            "type": "string",
            "description": "技能名称，在账户内唯一。"
          },
          "description": {
            "type": "string",
            "description": "来自 SKILL.md frontmatter 的可读描述。"
          },
          "description_en": {
            "type": "string",
            "description": "可选的英文描述。英文语言环境下的界面响应优先使用该字段而非 `description`；当 `description` 被本地化展示时，技能目录也会用它作为稳定的选型信号。"
          },
          "content": {
            "type": "string",
            "description": "完整的 SKILL.md 内容；列表响应中省略。"
          },
          "version": {
            "type": "string",
            "description": "frontmatter 中的技能版本。"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "从 frontmatter 解析的标签。"
          },
          "author": {
            "type": "string",
            "description": "技能作者。"
          },
          "license": {
            "type": "string",
            "description": "技能许可证。"
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "所需工具（内置或 `mcp:server/tool`）。"
          },
          "s3_key": {
            "type": "string",
            "description": "技能压缩包在对象存储中的 key。"
          },
          "checksum": {
            "type": "string",
            "description": "技能压缩包的 SHA-256 校验和。"
          },
          "status": {
            "type": "string",
            "description": "技能状态。已删除的技能不会出现在任何 API 响应中，因此只会返回这两种状态。",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "created_by": {
            "type": "integer",
            "description": "创建该技能的成员 ID。",
            "format": "int64"
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "创建时间，Unix 毫秒时间戳。"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "description": "最近更新时间，Unix 毫秒时间戳。"
          },
          "can_edit": {
            "type": "boolean",
            "description": "调用者是否可编辑该技能。"
          },
          "source_template_name": {
            "type": "string",
            "description": "该技能安装来源的市场模板名称；自建技能为空。"
          },
          "source_template_version": {
            "type": "string",
            "description": "安装时的模板版本。"
          },
          "update_available": {
            "type": "boolean",
            "description": "当市场存在更新版本时为 true。"
          },
          "is_modified": {
            "type": "boolean",
            "description": "当市场来源技能被本地修改时为 true（自动更新将跳过）。"
          },
          "created": {
            "type": "boolean",
            "description": "仅在“从会话安装”响应中出现：true 表示新建，false 表示原地更新。"
          }
        },
        "required": [
          "skill_id",
          "account_id",
          "team_id",
          "skill_name",
          "description",
          "status",
          "created_by",
          "created_at",
          "updated_at",
          "can_edit",
          "update_available",
          "is_modified"
        ]
      },
      "SkillListRequest": {
        "type": "object",
        "description": "技能列表的分页、搜索与团队过滤条件。",
        "properties": {
          "p": {
            "type": "integer",
            "description": "页码，从 1 开始。",
            "default": 1
          },
          "limit": {
            "type": "integer",
            "description": "每页数量。",
            "default": 20
          },
          "scope": {
            "type": "string",
            "description": "将结果限制为 `all`（默认）、仅 `account`（team_id=0）、或仅 `team`（排除账户级记录）；设置后会覆盖 `include_account`。",
            "enum": [
              "all",
              "account",
              "team"
            ]
          },
          "query": {
            "type": "string",
            "description": "跨技能名称、描述、英文描述、技能 ID、市场来源模板名称与作者的全文搜索。",
            "maxLength": 128
          },
          "team_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            },
            "description": "按团队 ID 过滤；为空则使用调用者可见范围。"
          },
          "include_account": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "是否包含账户级（team_id=0）记录，默认 true。当 `scope` 为 `account` 或 `team` 时该字段会被忽略。"
          }
        }
      },
      "SkillListResponse": {
        "type": "object",
        "description": "分页的技能列表。",
        "properties": {
          "total": {
            "type": "integer",
            "description": "匹配的技能总数。",
            "format": "int64"
          },
          "skills": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SkillItem"
            },
            "description": "当前页的技能。"
          }
        },
        "required": [
          "total",
          "skills"
        ]
      },
      "SkillStatusRequest": {
        "type": "object",
        "description": "按 ID 启用/禁用技能。",
        "properties": {
          "skill_id": {
            "type": "string",
            "description": "目标技能 ID。"
          }
        },
        "required": [
          "skill_id"
        ]
      },
      "SkillUpdateRequest": {
        "type": "object",
        "description": "可编辑的技能元数据。",
        "properties": {
          "skill_id": {
            "type": "string",
            "description": "目标技能 ID。"
          },
          "description": {
            "type": "string",
            "description": "新的描述，不能包含 `<` 或 `>`。传入空字符串不会清空当前值 —— 该字段无法用于清空描述。",
            "maxLength": 1024
          },
          "description_en": {
            "type": [
              "string",
              "null"
            ],
            "description": "新的英文描述，不能包含 `<` 或 `>`。省略表示不变；传入空字符串可显式清空。",
            "maxLength": 1024
          },
          "team_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "重新分配团队范围：0 表示账户级；>0 表示团队。省略则不变。",
            "format": "int64"
          }
        },
        "required": [
          "skill_id"
        ]
      },
      "SkillUploadRequest": {
        "type": "object",
        "description": "上传技能压缩包的 multipart 表单。",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "技能压缩包（.skill / .zip / .tar.gz / .tgz），最大 100MB；超限文件会在读取正文前即被拒绝。"
          },
          "team_id": {
            "type": "integer",
            "description": "新建/upsert 技能的团队范围：0 表示账户级。通过 `skill_id` 定向替换时会忽略该字段。",
            "format": "int64"
          },
          "replace": {
            "type": "boolean",
            "description": "为 true 时覆盖已有技能而非在名称冲突时报错 —— 若提供 `skill_id` 则按其匹配，否则按技能名称匹配。"
          },
          "skill_id": {
            "type": "string",
            "description": "定向替换指定技能时的技能 ID（需配合 `replace=true`）。"
          }
        },
        "required": [
          "file"
        ]
      }
    }
  }
}