{
  "openapi": "3.1.0",
  "info": {
    "title": "Flashduty 开放 API",
    "description": "Flashduty 事件管理平台的公开 HTTP API —— 覆盖故障、通知模板、协作空间、值班排班、监控、RUM、以及平台管理。每次调用都需在 query 中携带 `app_key`，该 key 在 Flashduty 控制台 账户 → APP Key 中签发。所有响应使用统一结构：成功时为 `{ request_id, data }`，失败时为 `{ request_id, error }`。",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.flashcat.cloud",
      "description": "Flashduty Open API"
    }
  ],
  "security": [
    {
      "AppKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "Monitors/告警规则",
      "description": "创建、管理和导出监控告警规则，查询规则统计和审计历史。"
    },
    {
      "name": "Monitors/告警数据源",
      "description": "管理监控告警规则用于查询指标的数据源。"
    },
    {
      "name": "Monitors/规则集",
      "description": "管理 Monitors 规则仓库中的共享规则集，规则集可在账户内或公开共享。"
    },
    {
      "name": "Monitors/诊断分析",
      "description": "Flashduty AI SRE 使用的诊断与查询接口——数据源即席查询、日志/指标诊断,以及监控对象侧的工具调用。"
    },
    {
      "name": "Monitors/通用工具",
      "description": "监控服务开通及数据预览工具。"
    }
  ],
  "paths": {
    "/monit/store/ruleset/update": {
      "post": {
        "operationId": "monit-store-ruleset-update",
        "summary": "更新规则集",
        "description": "更新已有规则集的备注、共享标志及 payload。",
        "tags": [
          "Monitors/规则集"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **规则仓库管理**（`monit`） |\n\n## 使用说明\n\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/rule-sets/monit-store-ruleset-update",
          "metadata": {
            "sidebarTitle": "更新规则集"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/StoreRulesetItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "id": 1,
                    "note": "更新后的 CPU 告警",
                    "open_flag": 2,
                    "updated_at": 1712100000
                  }
                }
              }
            }
          },
          "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/StoreRulesetUpdateRequest"
              },
              "example": {
                "id": 1,
                "note": "更新后的 CPU 告警",
                "open_flag": 2,
                "payload": "[{\"prom_ql\":\"rate(cpu_usage[5m]) > 0.9\"}]"
              }
            }
          }
        }
      }
    },
    "/monit/rule/counter/total": {
      "post": {
        "operationId": "monit-rule-read-counter-total",
        "summary": "查看规则数量时序",
        "description": "返回当前账户下规则总数的历史时序数据，每个 `clock` 时间戳对应一个采样。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则查看**（`monit`） |\n\n## 使用说明\n\n- 每一项为一次历史快照：`num` 为 `clock`（Unix 时间戳，秒）时刻的规则总数。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-read-counter-total",
          "metadata": {
            "sidebarTitle": "查看规则数量时序"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleCounterTotalResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "id": 1,
                      "account_id": 10023,
                      "num": 50,
                      "clock": 1712000000
                    }
                  ]
                }
              }
            }
          },
          "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/RuleEmptyRequest"
              },
              "example": {}
            }
          }
        }
      }
    },
    "/monit/datasource/create": {
      "post": {
        "operationId": "monit-datasource-write-create",
        "summary": "创建数据源",
        "description": "创建新的监控数据源，`payload` 中须包含对应类型的配置块。",
        "tags": [
          "Monitors/告警数据源"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **数据源管理**（`monit`） |\n\n## 使用说明\n\n- `type_ident` 必须为以下之一：`prometheus`、`loki`、`mysql`、`oracle`、`postgres`、`clickhouse`、`elasticsearch`、`sls`、`victorialogs`。\n- `edge_cluster_name` 指定使用该数据源进行规则评估的 Monitors Edge 集群。\n- 对于 `elasticsearch`，`payload.elasticsearch.deployment` 须设为 `cloud` 或 `self-managed`。\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/data-sources/monit-datasource-write-create",
          "metadata": {
            "sidebarTitle": "创建数据源"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/DataSourceItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "id": 10,
                    "type_ident": "prometheus",
                    "name": "生产 Prometheus",
                    "enabled": true,
                    "edge_cluster_name": "default",
                    "updated_at": 1712000000
                  }
                }
              }
            }
          },
          "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/DataSourceUpsertRequest"
              },
              "example": {
                "type_ident": "prometheus",
                "name": "生产 Prometheus",
                "note": "生产环境 Prometheus",
                "address": "http://prometheus.example.com:9090",
                "edge_cluster_name": "default",
                "payload": {
                  "prometheus": {
                    "basic_auth_enabled": false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/monit/datasource/update": {
      "post": {
        "operationId": "monit-datasource-write-update",
        "summary": "更新数据源",
        "description": "更新已有数据源，需提供 `id` 及待修改的字段。",
        "tags": [
          "Monitors/告警数据源"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **数据源管理**（`monit`） |\n\n## 使用说明\n\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/data-sources/monit-datasource-write-update",
          "metadata": {
            "sidebarTitle": "更新数据源"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/DataSourceItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "id": 10,
                    "type_ident": "prometheus",
                    "name": "生产 Prometheus v2",
                    "enabled": true,
                    "edge_cluster_name": "default",
                    "updated_at": 1712100000
                  }
                }
              }
            }
          },
          "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/DataSourceUpsertRequest"
              },
              "example": {
                "id": 10,
                "type_ident": "prometheus",
                "name": "生产 Prometheus v2",
                "note": "已更新",
                "address": "http://prometheus-v2.example.com:9090",
                "edge_cluster_name": "default",
                "payload": {
                  "prometheus": {
                    "basic_auth_enabled": false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/monit/rule/move": {
      "post": {
        "operationId": "monit-rule-write-move",
        "summary": "移动告警规则到文件夹",
        "description": "将一条或多条告警规则移动到其他文件夹。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则管理**（`monit`） |\n\n## 使用说明\n\n- 如果目标文件夹中已存在同名规则，该规则会被跳过；请检查每条结果的 `message` 以识别冲突。\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-write-move",
          "metadata": {
            "sidebarTitle": "移动告警规则到文件夹"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleNameMessageListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "name": "CPU 过高",
                      "message": ""
                    }
                  ]
                }
              }
            }
          },
          "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/RuleMoveRequest"
              },
              "example": {
                "ids": [
                  50001,
                  50002
                ],
                "dest_folder_id": 200
              }
            }
          }
        }
      }
    },
    "/monit/rule/counter/node": {
      "post": {
        "operationId": "monit-rule-read-counter-node",
        "summary": "按文件夹节点查询规则统计",
        "description": "返回一个对象，key 为顶层文件夹名称，value 为该文件夹及其子孙下的规则总数。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则查看**（`monit`） |",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-read-counter-node",
          "metadata": {
            "sidebarTitle": "按文件夹节点查询规则统计"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleCounterNodeResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "生产环境": 10,
                    "预发环境": 3
                  }
                }
              }
            }
          },
          "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/RuleEmptyRequest"
              },
              "example": {}
            }
          }
        }
      }
    },
    "/monit/rule/audit/detail": {
      "post": {
        "operationId": "monit-rule-read-audit-detail",
        "summary": "查看规则审计快照",
        "description": "返回审计记录（包含 `content` 字段，即该时间点规则配置的 JSON 字符串快照）。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则查看**（`monit`） |\n\n## 使用说明\n\n- 传入来自 `POST /monit/rule/audits` 的审计记录 `id`（非规则 `id`）。\n- `content` 为 JSON 字符串，解析后可获得完整的规则快照。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-read-audit-detail",
          "metadata": {
            "sidebarTitle": "查看规则审计快照"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AlertRuleAudit"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "id": 9001,
                    "account_id": 10023,
                    "alert_rule_id": 50001,
                    "action": "update",
                    "content": "{\"id\":50001,\"name\":\"CPU 过高\"}",
                    "creator_id": 80011,
                    "creator_name": "Alice",
                    "created_at": 1712000000
                  }
                }
              }
            }
          },
          "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/AuditRecordIDRequest"
              },
              "example": {
                "id": 9001
              }
            }
          }
        }
      }
    },
    "/monit/datasource/delete": {
      "post": {
        "operationId": "monit-datasource-write-delete",
        "summary": "删除数据源",
        "description": "通过 ID 删除数据源。引用该数据源的告警规则需提前更新或删除。",
        "tags": [
          "Monitors/告警数据源"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **数据源管理**（`monit`） |\n\n## 使用说明\n\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/data-sources/monit-datasource-write-delete",
          "metadata": {
            "sidebarTitle": "删除数据源"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/EmptyResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {}
                }
              }
            }
          },
          "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/IDRequest"
              },
              "example": {
                "id": 10
              }
            }
          }
        }
      }
    },
    "/monit/rule/delete/batch": {
      "post": {
        "operationId": "monit-rule-write-delete-batch",
        "summary": "批量删除告警规则",
        "description": "在单次请求中删除多条告警规则。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **30 次/分钟**；**5 次/秒** |\n| 权限要求 | **告警规则管理**（`monit`） |\n\n## 使用说明\n\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-write-delete-batch",
          "metadata": {
            "sidebarTitle": "批量删除告警规则"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleEmptyResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {}
                }
              }
            }
          },
          "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/RuleIDsRequest"
              },
              "example": {
                "ids": [
                  50001,
                  50002
                ]
              }
            }
          }
        }
      }
    },
    "/monit/datasource/sls/projects": {
      "post": {
        "operationId": "monit-datasource-read-sls-projects",
        "summary": "查询 SLS 项目列表",
        "description": "列出指定 SLS 数据源中可用的阿里云日志服务（SLS）项目。",
        "tags": [
          "Monitors/告警数据源"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **数据源查看**（`monit`） |\n\n## 使用说明\n\n- `id` 指定的数据源类型必须为 `sls`。\n- 使用 `query` 按名称前缀过滤项目，使用 `offset` 和 `size` 分页。",
          "href": "/zh/api-reference/monitors/data-sources/monit-datasource-read-sls-projects",
          "metadata": {
            "sidebarTitle": "查询 SLS 项目列表"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/SLSProjectsResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    "project-a",
                    "project-b"
                  ]
                }
              }
            }
          },
          "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/SLSProjectsRequest"
              },
              "example": {
                "id": 10,
                "query": "",
                "offset": 0,
                "size": 50
              }
            }
          }
        }
      }
    },
    "/monit/rule/status": {
      "post": {
        "operationId": "monit-rule-write-status",
        "summary": "查看文件夹下规则触发状态",
        "description": "返回指定文件夹节点及其子孙节点下所有规则的触发情况汇总。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则管理**（`monit`） |\n\n## 使用说明\n\n- 将 `folder_id` 设为 `0` 可获取所有文件夹的汇总。\n- 若文件夹包含规则数量过多，为保护系统会跳过计算。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-write-status",
          "metadata": {
            "sidebarTitle": "查看文件夹下规则触发状态"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleStatusResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "folder_id": 100,
                      "folder_name": "生产环境",
                      "rule_total": 10,
                      "triggered_rule_count": 2
                    }
                  ]
                }
              }
            }
          },
          "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/RuleFolderIDRequest"
              },
              "example": {
                "folder_id": 100
              }
            }
          }
        }
      }
    },
    "/monit/rule/export": {
      "post": {
        "operationId": "monit-rule-read-export",
        "summary": "导出告警规则",
        "description": "将选定告警规则的配置导出为可移植的 JSON 数组，与 `POST /monit/rule/import` 兼容。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **10 次/分钟**；**1 次/秒** |\n| 权限要求 | **告警规则查看**（`monit`） |",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-read-export",
          "metadata": {
            "sidebarTitle": "导出告警规则"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AlertRuleExportListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "name": "CPU 过高",
                      "ds_type": "prometheus",
                      "ds_list": [
                        "prometheus*"
                      ],
                      "enabled": true,
                      "cron_pattern": "* * * * *"
                    }
                  ]
                }
              }
            }
          },
          "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/RuleIDsRequest"
              },
              "example": {
                "ids": [
                  50001
                ]
              }
            }
          }
        }
      }
    },
    "/monit/datasource/sls/logstores": {
      "post": {
        "operationId": "monit-datasource-read-sls-logstores",
        "summary": "查询 SLS 日志库列表",
        "description": "列出指定 SLS 数据源中某个项目下的日志库。",
        "tags": [
          "Monitors/告警数据源"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **数据源查看**（`monit`） |\n\n## 使用说明\n\n- `id` 指定的数据源类型必须为 `sls`。\n- 通过 `project` 指定要列出日志库的 SLS 项目。",
          "href": "/zh/api-reference/monitors/data-sources/monit-datasource-read-sls-logstores",
          "metadata": {
            "sidebarTitle": "查询 SLS 日志库列表"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/SLSLogstoresResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    "logstore-1",
                    "logstore-2"
                  ]
                }
              }
            }
          },
          "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/SLSLogstoresRequest"
              },
              "example": {
                "id": 10,
                "project": "project-a",
                "offset": 0,
                "size": 50
              }
            }
          }
        }
      }
    },
    "/monit/datasource/info": {
      "post": {
        "operationId": "monit-datasource-read-info",
        "summary": "查看数据源详情",
        "description": "通过 ID 获取单个数据源的完整信息，包括 `payload` 配置。",
        "tags": [
          "Monitors/告警数据源"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **数据源查看**（`monit`） |",
          "href": "/zh/api-reference/monitors/data-sources/monit-datasource-read-info",
          "metadata": {
            "sidebarTitle": "查看数据源详情"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/DataSourceItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "id": 10,
                    "account_id": 10023,
                    "type_ident": "prometheus",
                    "name": "生产 Prometheus",
                    "enabled": true,
                    "note": "生产环境 Prometheus",
                    "address": "http://prometheus.example.com:9090",
                    "payload": {
                      "prometheus": {
                        "basic_auth_enabled": false,
                        "basic_auth_username": "",
                        "basic_auth_password": "",
                        "tls_skip_verify": false
                      }
                    },
                    "edge_cluster_name": "default",
                    "updated_at": 1712000000
                  }
                }
              }
            }
          },
          "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/IDRequest"
              },
              "example": {
                "id": 10
              }
            }
          }
        }
      }
    },
    "/monit/rule/audits": {
      "post": {
        "operationId": "monit-rule-read-audits",
        "summary": "查询规则变更历史",
        "description": "返回告警规则的变更历史（审计记录）。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则查看**（`monit`） |",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-read-audits",
          "metadata": {
            "sidebarTitle": "查询规则变更历史"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleAuditListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "id": 9001,
                      "account_id": 10023,
                      "alert_rule_id": 50001,
                      "action": "update",
                      "creator_id": 80011,
                      "creator_name": "Alice",
                      "created_at": 1712000000
                    }
                  ]
                }
              }
            }
          },
          "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/RuleIDRequest"
              },
              "example": {
                "id": 50001
              }
            }
          }
        }
      }
    },
    "/monit/rule/info": {
      "post": {
        "operationId": "monit-rule-read-info",
        "summary": "查看告警规则详情",
        "description": "通过 ID 返回告警规则的完整配置，包括规则查询、阈值和通知设置。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则查看**（`monit`） |",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-read-info",
          "metadata": {
            "sidebarTitle": "查看告警规则详情"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AlertRuleInfoResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "id": 50001,
                    "folder_id": 100,
                    "name": "CPU 过高",
                    "ds_type": "prometheus",
                    "ds_list": [
                      "prometheus*"
                    ],
                    "enabled": true,
                    "cron_pattern": "* * * * *",
                    "channel_ids": [
                      20001
                    ]
                  }
                }
              }
            }
          },
          "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/RuleIDRequest"
              },
              "example": {
                "id": 50001
              }
            }
          }
        }
      }
    },
    "/monit/rule/delete": {
      "post": {
        "operationId": "monit-rule-write-delete",
        "summary": "删除告警规则",
        "description": "通过 ID 删除单条告警规则。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则管理**（`monit`） |\n\n## 使用说明\n\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-write-delete",
          "metadata": {
            "sidebarTitle": "删除告警规则"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleEmptyResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {}
                }
              }
            }
          },
          "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/RuleIDRequest"
              },
              "example": {
                "id": 50001
              }
            }
          }
        }
      }
    },
    "/monit/rule/dstypes": {
      "post": {
        "operationId": "monit-rule-read-dstypes",
        "summary": "查询可用的数据源类型",
        "description": "返回当前账户在创建告警规则时可使用的数据源类型（`DSType` 记录）列表，包括全局类型和账户自定义类型。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则查看**（`monit`） |",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-read-dstypes",
          "metadata": {
            "sidebarTitle": "查询可用的数据源类型"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleDsTypesResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "id": 1,
                      "name": "Prometheus",
                      "ident": "prometheus",
                      "account_id": 0,
                      "weight": 100
                    }
                  ]
                }
              }
            }
          },
          "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/RuleEmptyRequest"
              },
              "example": {}
            }
          }
        }
      }
    },
    "/monit/rule/update": {
      "post": {
        "operationId": "monit-rule-write-update",
        "summary": "更新告警规则",
        "description": "替换已有告警规则的完整配置，所有字段将被覆盖。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则管理**（`monit`） |\n\n## 使用说明\n\n- `id` 为必填项。其他字段与 `POST /monit/rule/create` 的规则相同。\n- 名称在所在文件夹内必须保持唯一；重名会返回 `InvalidParameter`。\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-write-update",
          "metadata": {
            "sidebarTitle": "更新告警规则"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AlertRule"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "id": 50001,
                    "updated_at": 1712100000
                  }
                }
              }
            }
          },
          "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/AlertRule"
              },
              "example": {
                "id": 50001,
                "folder_id": 100,
                "name": "CPU 过高 v2",
                "ds_type": "prometheus",
                "ds_list": [
                  "prometheus*"
                ],
                "enabled": true,
                "cron_pattern": "* * * * *",
                "rule_configs": {
                  "queries": [
                    {
                      "name": "A",
                      "expr": "avg(cpu_usage_idle) < 5"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/monit/rule/import": {
      "post": {
        "operationId": "monit-rule-write-import",
        "summary": "导入告警规则",
        "description": "从 JSON 数组导入一条或多条告警规则，返回每条规则的导入结果（成功或失败）。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **20 次/分钟**；**2 次/秒** |\n| 权限要求 | **告警规则管理**（`monit`） |\n\n## 使用说明\n\n- 请求体为规则导出对象的 JSON 数组（与 `POST /monit/rule/export` 输出兼容）。\n- 每个对象必须包含 `folder_id`、`ds_type` 以及 `ds_list` 或 `ds_ids` 之一。\n- 部分规则可能失败（如名称重复），请检查每条结果的状态。\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-write-import",
          "metadata": {
            "sidebarTitle": "导入告警规则"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleImportResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "name": "CPU 过高",
                      "message": ""
                    }
                  ]
                }
              }
            }
          },
          "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/RuleImportRequest"
              },
              "example": [
                {
                  "folder_id": 100,
                  "name": "CPU 过高",
                  "ds_type": "prometheus",
                  "ds_list": [
                    "prometheus*"
                  ],
                  "enabled": true,
                  "cron_pattern": "* * * * *",
                  "rule_configs": {
                    "queries": [
                      {
                        "name": "A",
                        "expr": "avg(cpu_usage_idle) < 10"
                      }
                    ]
                  }
                }
              ]
            }
          }
        }
      }
    },
    "/monit/rule/create": {
      "post": {
        "operationId": "monit-rule-write-create",
        "summary": "创建告警规则",
        "description": "创建新的告警规则，返回带有分配 ID 的已创建规则。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则管理**（`monit`） |\n\n## 使用说明\n\n- `name`、`ds_type`、`cron_pattern` 和 `rule_configs.queries` 为必填项。\n- `ds_list`（支持通配符）或 `ds_ids` 必须有一个非空。\n- `cron_pattern` 使用标准 5 字段 cron 语法。\n- `channel_ids` 可为空，告警将通过全局集成路由。\n- `name` 在 `folder_id` 内必须唯一；重名会返回 `InvalidParameter`。\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-write-create",
          "metadata": {
            "sidebarTitle": "创建告警规则"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/AlertRule"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "id": 50001,
                    "folder_id": 100,
                    "name": "CPU 过高",
                    "ds_type": "prometheus",
                    "created_at": 1712000000
                  }
                }
              }
            }
          },
          "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/AlertRule"
              },
              "example": {
                "folder_id": 100,
                "name": "CPU 过高",
                "ds_type": "prometheus",
                "ds_list": [
                  "prometheus*"
                ],
                "enabled": true,
                "cron_pattern": "* * * * *",
                "channel_ids": [
                  20001
                ],
                "rule_configs": {
                  "queries": [
                    {
                      "name": "A",
                      "expr": "avg(cpu_usage_idle) < 10"
                    }
                  ],
                  "check_threshold": {
                    "enabled": true,
                    "critical": "A",
                    "alerting_check_times": 1,
                    "recovery_check_times": 1,
                    "push_recovery_event": true,
                    "recovery": {
                      "mode": "invert"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/monit/store/ruleset/list": {
      "post": {
        "operationId": "monit-store-ruleset-list",
        "summary": "查询规则集列表",
        "description": "返回指定数据源类型下当前用户有权访问的所有规则集。",
        "tags": [
          "Monitors/规则集"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **规则仓库查看**（`monit`） |\n\n## 使用说明\n\n- 当 `open_flag` 为 `2`（公开）、当前用户为创建者（`open_flag=0`）或与账户共享（`open_flag=1`）时，规则集对当前用户可见。\n- 列表不包含 `payload` 字段，完整内容请调用 `/monit/store/ruleset/info`。",
          "href": "/zh/api-reference/monitors/rule-sets/monit-store-ruleset-list",
          "metadata": {
            "sidebarTitle": "查询规则集列表"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/StoreRulesetListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "id": 1,
                      "type_ident": "prometheus",
                      "note": "CPU 用量告警",
                      "open_flag": 2,
                      "creator_account_id": 10023,
                      "creator_id": 80011,
                      "creator_name": "Alice",
                      "created_at": 1710000000,
                      "updated_at": 1712000000
                    }
                  ]
                }
              }
            }
          },
          "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/StoreRulesetListRequest"
              },
              "example": {
                "type_ident": "prometheus"
              }
            }
          }
        }
      }
    },
    "/monit/store/ruleset/delete": {
      "post": {
        "operationId": "monit-store-ruleset-delete",
        "summary": "删除规则集",
        "description": "通过 ID 从规则仓库中删除规则集。",
        "tags": [
          "Monitors/规则集"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **规则仓库管理**（`monit`） |\n\n## 使用说明\n\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/rule-sets/monit-store-ruleset-delete",
          "metadata": {
            "sidebarTitle": "删除规则集"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/EmptyResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {}
                }
              }
            }
          },
          "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/IDRequest"
              },
              "example": {
                "id": 1
              }
            }
          }
        }
      }
    },
    "/monit/rule/counter/status": {
      "post": {
        "operationId": "monit-rule-read-counter-status",
        "summary": "查看顶层文件夹规则状态统计",
        "description": "返回所有顶层文件夹节点的规则触发状态汇总，用于概览看板。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则查看**（`monit`） |",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-read-counter-status",
          "metadata": {
            "sidebarTitle": "查看顶层文件夹规则状态统计"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleStatusResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "folder_id": 100,
                      "folder_name": "生产环境",
                      "rule_total": 10,
                      "triggered_rule_count": 2
                    }
                  ]
                }
              }
            }
          },
          "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/RuleEmptyRequest"
              },
              "example": {}
            }
          }
        }
      }
    },
    "/monit/rule/list/basic": {
      "post": {
        "operationId": "monit-rule-read-list",
        "summary": "查询告警规则列表",
        "description": "返回指定文件夹下所有告警规则的基础信息。如需完整规则详情，请调用 `POST /monit/rule/info`。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则查看**（`monit`） |\n\n## 使用说明\n\n- 将 `folder_id` 设为 `0` 可列出当前用户有权查看的所有文件夹下的规则。\n- `triggered` 字段表示该规则当前是否有活跃告警。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-read-list",
          "metadata": {
            "sidebarTitle": "查询告警规则列表"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleBasicListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "id": 50001,
                      "folder_id": 100,
                      "name": "CPU 过高",
                      "ds_type": "prometheus",
                      "enabled": true,
                      "triggered": true,
                      "created_at": 1710000000
                    }
                  ]
                }
              }
            }
          },
          "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/RuleListRequest"
              },
              "example": {
                "folder_id": 100
              }
            }
          }
        }
      }
    },
    "/monit/store/ruleset/info": {
      "post": {
        "operationId": "monit-store-ruleset-info",
        "summary": "查看规则集详情",
        "description": "获取规则集的完整信息，包括 `payload`（JSON 字符串形式的告警规则定义）。",
        "tags": [
          "Monitors/规则集"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **规则仓库查看**（`monit`） |",
          "href": "/zh/api-reference/monitors/rule-sets/monit-store-ruleset-info",
          "metadata": {
            "sidebarTitle": "查看规则集详情"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/StoreRulesetItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "id": 1,
                    "type_ident": "prometheus",
                    "note": "CPU 用量告警",
                    "open_flag": 2,
                    "payload": "[{\"prom_ql\":\"...\"}]",
                    "creator_account_id": 10023,
                    "creator_id": 80011,
                    "creator_name": "Alice",
                    "created_at": 1710000000,
                    "updated_at": 1712000000
                  }
                }
              }
            }
          },
          "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/IDRequest"
              },
              "example": {
                "id": 1
              }
            }
          }
        }
      }
    },
    "/monit/store/ruleset/create": {
      "post": {
        "operationId": "monit-store-ruleset-create",
        "summary": "创建规则集",
        "description": "在规则仓库中创建新的规则集。",
        "tags": [
          "Monitors/规则集"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **规则仓库管理**（`monit`） |\n\n## 使用说明\n\n- `open_flag`：`0` 仅创建者可见，`1` 账户内共享，`2` 公开。\n- `payload` 为必填 JSON 字符串，包含告警规则定义。\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/rule-sets/monit-store-ruleset-create",
          "metadata": {
            "sidebarTitle": "创建规则集"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/StoreRulesetItem"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "id": 1,
                    "type_ident": "prometheus",
                    "note": "CPU 用量告警",
                    "open_flag": 1,
                    "created_at": 1712000000,
                    "updated_at": 1712000000
                  }
                }
              }
            }
          },
          "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/StoreRulesetUpsertRequest"
              },
              "example": {
                "type_ident": "prometheus",
                "note": "CPU 用量告警",
                "open_flag": 1,
                "payload": "[{\"prom_ql\":\"rate(cpu_usage[5m]) > 0.8\"}]"
              }
            }
          }
        }
      }
    },
    "/monit/datasource/list": {
      "post": {
        "operationId": "monit-datasource-read-list",
        "summary": "查询数据源列表",
        "description": "返回当前账户下的所有数据源，可通过 `type_ident` 过滤类型。",
        "tags": [
          "Monitors/告警数据源"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **数据源查看**（`monit`） |\n\n## 使用说明\n\n- 省略 `type_ident` 可返回所有类型的数据源。\n- 列表响应中不返回敏感凭证字段（密码、密钥）。",
          "href": "/zh/api-reference/monitors/data-sources/monit-datasource-read-list",
          "metadata": {
            "sidebarTitle": "查询数据源列表"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/DataSourceListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "id": 10,
                      "account_id": 10023,
                      "type_ident": "prometheus",
                      "name": "生产 Prometheus",
                      "enabled": true,
                      "note": "生产环境 Prometheus",
                      "address": "http://prometheus.example.com:9090",
                      "edge_cluster_name": "default",
                      "updated_at": 1712000000
                    }
                  ]
                }
              }
            }
          },
          "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/DataSourceListRequest"
              },
              "example": {
                "type": "prometheus"
              }
            }
          }
        }
      }
    },
    "/monit/rule/update/fields": {
      "post": {
        "operationId": "monit-rule-write-fields-update",
        "summary": "批量更新规则字段",
        "description": "一次性更新多条告警规则的特定字段，仅应用 `fields` 列表中指定的字段。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则管理**（`monit`） |\n\n## 使用说明\n\n- 在 `fields` 数组中指定要更新的字段名，如 `[\"enabled\", \"channel_ids\"]`。\n- 仅更新指定字段，其他字段保持不变。\n- 每次调用都会记录到账户审计日志，请不要把敏感信息放在请求字段中。",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-write-fields-update",
          "metadata": {
            "sidebarTitle": "批量更新规则字段"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleNameMessageListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "name": "CPU 过高",
                      "message": ""
                    },
                    {
                      "name": "磁盘告警",
                      "message": ""
                    }
                  ]
                }
              }
            }
          },
          "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/RuleFieldsUpdateRequest"
              },
              "example": {
                "ids": [
                  50001,
                  50002
                ],
                "fields": [
                  "enabled"
                ],
                "enabled": false
              }
            }
          }
        }
      }
    },
    "/monit/rule/counter/channel": {
      "post": {
        "operationId": "monit-rule-read-counter-channel",
        "summary": "按协作空间查询规则统计",
        "description": "返回一个对象，key 为协作空间名称，value 为将告警路由到该协作空间的规则数量。若协作空间名称无法解析，则以协作空间 ID（字符串形式）作为 key。",
        "tags": [
          "Monitors/告警规则"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |\n| 权限要求 | **告警规则查看**（`monit`） |",
          "href": "/zh/api-reference/monitors/alert-rules/monit-rule-read-counter-channel",
          "metadata": {
            "sidebarTitle": "按协作空间查询规则统计"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/RuleCounterChannelResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "生产": 8
                  }
                }
              }
            }
          },
          "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/RuleEmptyRequest"
              },
              "example": {}
            }
          }
        }
      }
    },
    "/monit/query/rows": {
      "post": {
        "operationId": "monit-read-query-rows",
        "summary": "查询数据源原始行",
        "description": "对已配置的数据源执行同步即席查询并返回原始行。供 Flashduty AI SRE 及 UI 预览使用。请求通过 WebSocket 转发至 monit-edge,由其对底层数据源(Prometheus / Loki / VictoriaLogs / SLS / MySQL / Postgres / Oracle / ClickHouse / Elasticsearch)执行查询。",
        "tags": [
          "Monitors/诊断分析"
        ],
        "x-mint": {
          "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 请求通过 WebSocket 转发至 `monit-edge`;`ds_type` + `ds_name` 指定的数据源必须已在调用方账户下存在。\n- 请求体中的 `account_id` 为可选;若提供,必须与已认证账户一致,否则拒绝。\n- 存在两层错误:webapi 层失败使用标准错误信封返回,而 `monit-edge` 执行查询时抛出的错误以 HTTP 200 返回,并在响应体中携带 `error` 对象。除 HTTP 状态外,务必同时检查响应体中的 `error`。\n- monit-edge 强制行数上限;过大结果集会返回 `error.message = \"too many rows\"`。请收窄时间范围或在数据源端聚合。\n- `args` 是一个多态 `string→string` 映射,原样转发。语义取决于 `ds_type`(SLS 需要 `sls.project` + `sls.logstore`;Loki / VictoriaLogs 原始模式需要通过 `*.start`/`*.end` 或 `*.timespan.value`/`*.timespan.unit` 指定时间范围;Prometheus 与 SQL 类数据源忽略该字段)。各数据源的键列表见 monit-webapi query-api 文档。",
          "href": "/zh/api-reference/monitors/diagnostics/monit-read-query-rows",
          "metadata": {
            "sidebarTitle": "查询数据源原始行"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryRowsRequest"
              },
              "example": {
                "account_id": 10001,
                "ds_type": "prometheus",
                "ds_name": "prod-prom",
                "expr": "up",
                "delay_seconds": 30
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/QueryRowsResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": [
                    {
                      "fields": {
                        "__name__": "up",
                        "instance": "10.0.0.1:9100",
                        "job": "node"
                      },
                      "values": {
                        "__value__": 1
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/monit/query/diagnose": {
      "post": {
        "operationId": "monit-read-query-diagnose",
        "summary": "数据源诊断",
        "description": "执行同步诊断查询(Loki/VictoriaLogs 使用 `log_patterns`,Prometheus 使用 `metric_trends`)。Flashduty AI SRE 用于日志模式聚类与时间序列趋势分析。长耗时——最长可达 35 秒。",
        "tags": [
          "Monitors/诊断分析"
        ],
        "x-mint": {
          "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 这是诊断 / RCA 接口,而非原始数据查询接口——如需查看明细行,请配合 `/monit/query/rows` 使用。\n- `operation` 由 `ds_type` 推导:`loki` / `victorialogs` → `log_patterns`,`prometheus` → `metric_trends`。其他数据源必须显式传入 `operation`。\n- `methods` 选择要执行的分析方法;省略时,`log_patterns` 默认为 `pattern_snapshot + pattern_compare(previous_window)`,`metric_trends` 默认为 `single_window_shape + window_compare(previous_window)`。\n- `time_range` 单位为 Unix 秒;缺失或无效时默认最近 15 分钟;窗口宽度超过 6 小时将被拒绝。\n- 请求通过 WebSocket 转发至 `monit-edge`。长耗时:边缘侧执行可能耗时约 30 秒,叠加 webapi 开销。客户端超时应至少设置为 **35 秒**。\n- `options.*` 由边缘侧设置上限(`max_logs_scanned` ≤ 50 000,`max_patterns` ≤ 50,`examples_per_pattern` ≤ 3,`step_seconds` ∈ [15, 300],`max_series` ≤ 200,`topk` ≤ 50,`timeout_seconds` ≤ 30)。\n- 与 `/monit/query/rows` 一样存在两层错误:边缘侧执行错误以 HTTP 200 返回,响应体中带 `error` 对象——务必同时检查两层。\n- 日志样例在返回前会经过基础脱敏处理,响应中会带 `warnings: [\"examples redacted\"]`。不可作为原始日志使用。",
          "href": "/zh/api-reference/monitors/diagnostics/monit-read-query-diagnose",
          "metadata": {
            "sidebarTitle": "数据源诊断"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiagnoseRequest"
              },
              "example": {
                "account_id": 10001,
                "ds_type": "victorialogs",
                "ds_name": "vmlogs-read",
                "operation": "log_patterns",
                "time_range": {
                  "start": 1776847544,
                  "end": 1776849344
                },
                "methods": [
                  {
                    "name": "pattern_snapshot"
                  },
                  {
                    "name": "pattern_compare",
                    "baseline": "same_window_yesterday"
                  }
                ],
                "input": {
                  "query": "_stream:{status='500'}"
                },
                "options": {
                  "max_logs_scanned": 10000,
                  "max_patterns": 20,
                  "examples_per_pattern": 2,
                  "timeout_seconds": 25
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/DiagnoseResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "operation": "log_patterns",
                    "ds_type": "victorialogs",
                    "ds_name": "vmlogs-read",
                    "query": "_stream:{status='500'}",
                    "window": {
                      "start": 1776847544,
                      "end": 1776849344
                    },
                    "results": [
                      {
                        "method": "pattern_snapshot",
                        "window": {
                          "start": 1776847544,
                          "end": 1776849344
                        },
                        "summary": {
                          "logs_scanned": 405,
                          "baseline_logs_scanned": 0,
                          "current_truncated": false,
                          "baseline_truncated": false,
                          "patterns_total": 2,
                          "returned_patterns": 2,
                          "new_patterns": 0,
                          "surging_patterns": 0,
                          "surging_threshold": {
                            "change_ratio_min": 3,
                            "count_min": 5
                          }
                        },
                        "patterns": [
                          {
                            "pattern_hash": "239fa5da",
                            "template": "POST /api/v<number>/orders/<number> HTTP/<number>",
                            "count": 213,
                            "first_seen": 1776847562,
                            "last_seen": 1776849336,
                            "severity": "unknown",
                            "approximate": false,
                            "sources": [
                              {
                                "field": "pod",
                                "value": "order-api-7f69d8d9b6-m4x9n",
                                "count": 130
                              }
                            ],
                            "examples": [
                              "POST /api/v<number>/orders/<number> HTTP/<number>"
                            ]
                          }
                        ],
                        "warnings": [
                          "examples redacted"
                        ]
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/monit/tools/catalog": {
      "post": {
        "operationId": "monit-read-tools-catalog",
        "summary": "查询监控对象工具能力清单",
        "description": "根据 `target_locator`(host、mysql 等)查询该监控对象上 monit-agent 当前暴露的工具能力。返回每个工具的名称、描述以及 JSON-Schema `input_schema`。配合 `/monit/tools/invoke` 驱动 AI-SRE 的工具调用。",
        "tags": [
          "Monitors/诊断分析"
        ],
        "x-mint": {
          "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 使用 `target_locator` 标识监控对象;`target_kind` 可选,省略时自动推断。内置的 target kind 包括 `host` 与 `mysql`。\n- 若同一 locator 匹配多个 kind,响应为 HTTP 200,`data.error.code = \"ambiguous_target_kind\"`,并附带 `target_kinds` 列表——请带上显式的 `target_kind` 重试。\n- 工具能力清单是*候选能力*视图,并非执行保证。目标 Agent 可能在拿到清单与发起调用之间下线,本地 Agent 策略也可能在调用时拦截某些工具。\n- 设置 `include_output_shape: true` 可额外返回每个工具的 `output_shape`。默认为 `false`,以便为 LLM 消费保持响应精简。\n- 业务错误(`target_unavailable`、`unknown_toolset_hash`、`ambiguous_target_kind`)以 HTTP 200 返回,`data.error` 非空。只有协议 / 鉴权 / 内部错误才使用标准错误信封。",
          "href": "/zh/api-reference/monitors/diagnostics/monit-read-tools-catalog",
          "metadata": {
            "sidebarTitle": "查询监控对象工具能力清单"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToolCatalogRequest"
              },
              "example": {
                "account_id": 10001,
                "target_locator": "web-01",
                "include_output_shape": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/ToolCatalogResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "target": {
                      "kind": "host",
                      "locator": "web-01"
                    },
                    "tools": [
                      {
                        "name": "os.overview",
                        "target_kind": "host",
                        "description": "Returns a bounded overview of host health (CPU, memory, disk, network, top processes).",
                        "input_schema": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {}
                        },
                        "output_shape": {
                          "type": "object",
                          "required": [
                            "data",
                            "summary",
                            "truncated"
                          ],
                          "properties": {
                            "data": {
                              "type": "object"
                            },
                            "summary": {
                              "type": "string"
                            },
                            "truncated": {
                              "type": "object"
                            }
                          }
                        }
                      }
                    ],
                    "error": null
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/monit/tools/invoke": {
      "post": {
        "operationId": "monit-read-tools-invoke",
        "summary": "调用监控对象工具",
        "description": "在单个监控对象上并发调用至多 8 个 monit-agent 工具。结果按入参 `tools` 数组顺序返回。长耗时——单个工具在 Agent 上有自己的超时,整体请求可能耗时数十秒。",
        "tags": [
          "Monitors/诊断分析"
        ],
        "x-mint": {
          "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 单次调用至多 **8** 个工具(`MaxToolsPerInvoke`);超出需在客户端拆分。8 个工具的上限与单监控对象 Agent 的并发能力对齐。\n- 工具在 Agent 上并行执行;webapi 返回的 `results[]` 与请求中的 `tools[]` 顺序对齐。\n- 长耗时:客户端超时至少设置 **35 秒**。该接口面向 AI-SRE / 人工排障流程,不适用于交互式 UI。\n- 请求级错误(`target_unavailable`、`ambiguous_target_kind`、`unknown_toolset_hash`、`forward_failed`)以 HTTP 200 返回,`data.error` 不为空,`data.results = []`。\n- 单工具失败以 HTTP 200 返回,`data.error = null`,`results[i].error` 被填充——务必同时检查**三层**(外层信封 `error`、`data.error`、再到每个 `results[i].error`)。\n- 每条结果带两个耗时字段:`agent_elapsed_ms`(Agent 自报,不含网络)与 `e2e_elapsed_ms`(webapi 观测的端到端)。两者差距较大表示网络 / 边缘侧慢,而非工具执行慢。\n- 按 `/monit/tools/catalog` 返回的 `input_schema` 构造 `tools[].params`。对于无参工具,务必显式传 `params: {}`。",
          "href": "/zh/api-reference/monitors/diagnostics/monit-read-tools-invoke",
          "metadata": {
            "sidebarTitle": "调用监控对象工具"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToolInvokeRequest"
              },
              "example": {
                "account_id": 10001,
                "target_locator": "web-01",
                "tools": [
                  {
                    "tool": "os.overview",
                    "params": {}
                  },
                  {
                    "tool": "net.tcp_ping",
                    "params": {
                      "host": "10.0.0.10",
                      "port": 3306
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/ToolInvokeResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "target": {
                      "kind": "host",
                      "locator": "web-01"
                    },
                    "results": [
                      {
                        "tool": "os.overview",
                        "tool_version": "0.5.0",
                        "data": {
                          "data": {
                            "sample_interval_sec": 3,
                            "degraded": false,
                            "degradation_reasons": []
                          },
                          "summary": "os.overview ...",
                          "truncated": {
                            "truncated": false
                          }
                        },
                        "error": null,
                        "agent_elapsed_ms": 3120,
                        "e2e_elapsed_ms": 3188
                      },
                      {
                        "tool": "net.tcp_ping",
                        "tool_version": "0.5.0",
                        "data": null,
                        "error": {
                          "code": "target_unreachable",
                          "message": "dial tcp 10.0.0.10:3306: i/o timeout"
                        },
                        "agent_elapsed_ms": 0,
                        "e2e_elapsed_ms": 2008
                      }
                    ],
                    "error": null
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/monit/targets": {
      "post": {
        "operationId": "monit-read-targets-list",
        "summary": "监控对象列表",
        "description": "列出当前租户下被 monit-agent 路由投影所观测到的监控对象。支持 `target_locator` 前缀搜索与游标分页。用于为 `/monit/tools/catalog` 与 `/monit/tools/invoke` 选择 `target_locator`。",
        "tags": [
          "Monitors/诊断分析"
        ],
        "x-mint": {
          "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 这是一个 **UI 投影视图**,不是 `/monit/tools/invoke` 所依赖的实时数据源。列表中存在不代表对应监控对象当前可被调用。\n- `keyword` 是对 `target_locator` 的**前缀匹配**(仅 ASCII,不含空白,不含 `|`,最长 256 字节)。v1 不支持子串搜索。\n- `limit` 默认 50,最大 200。分页基于游标:将上次响应中的 `next_cursor` 传入即可拉取下一页;`next_cursor` 为空或缺失表示已到末页。\n- 重置 `keyword`、`limit` 或租户上下文时必须重置 `cursor`;切勿在不同筛选条件之间复用游标。\n- `total` 是当前 `(account_id, keyword)` 组合下未受游标影响的匹配总数,跨页保持稳定。\n- 字段中暴露 `cluster_name` / `edge_ipport` 供排障使用;`updated_at` 表示\"最近一次被观测到\",而非实时在线指标。",
          "href": "/zh/api-reference/monitors/diagnostics/monit-read-targets-list",
          "metadata": {
            "sidebarTitle": "监控对象列表"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TargetsListRequest"
              },
              "example": {
                "keyword": "db-prod",
                "limit": 50
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/TargetsListResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "items": [
                      {
                        "target_kind": "host",
                        "target_locator": "db-prod-01",
                        "agent_version": "2.0.0",
                        "cluster_name": "edge-a",
                        "edge_ipport": "10.0.0.1:19090",
                        "updated_at": 1710000000
                      }
                    ],
                    "total": 120,
                    "next_cursor": "eyJ0YXJnZXRfbG9jYXRvciI6ImRiLXByb2QtMDEiLCJpZCI6MTIzNDV9"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/monit/preview/sync": {
      "post": {
        "operationId": "monit-preview-sync",
        "summary": "同步预览数据源查询",
        "description": "同步执行数据源查询并返回原始结果，用于在保存前预览告警规则表达式的效果。",
        "tags": [
          "Monitors/通用工具"
        ],
        "x-mint": {
          "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **60 次/分钟**；**10 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- `ds_type` 须与数据源类型匹配，如 `prometheus`、`loki`。\n- `ds_name` 为账户中配置的数据源显示名称。\n- `delay_seconds` 将查询窗口向前偏移指定秒数，用于补偿数据摄入延迟。\n- 响应体为数据源返回的原始 JSON，其结构随数据源类型而异。",
          "href": "/zh/api-reference/monitors/monitor-utilities/monit-preview-sync",
          "metadata": {
            "sidebarTitle": "同步预览数据源查询"
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/PreviewSyncResponse"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "data": {
                    "status": "success",
                    "data": {
                      "resultType": "vector",
                      "result": []
                    }
                  }
                }
              }
            }
          },
          "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/PreviewSyncRequest"
              },
              "example": {
                "ds_type": "prometheus",
                "ds_name": "生产 Prometheus",
                "expr": "rate(http_requests_total[5m])",
                "delay_seconds": 0
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "AppKeyAuth": {
        "type": "apiKey",
        "in": "query",
        "name": "app_key",
        "description": "在 Flashduty 控制台 账户 → APP Key 中签发的 app_key。调用任何公开 API 时都必须携带。它等同于所属账户的身份凭证，请妥善保管。"
      }
    },
    "responses": {
      "BadRequest": {
        "description": "请求非法 — 通常是参数缺失或格式不正确。",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "missingParameter": {
                "value": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "error": {
                    "code": "InvalidParameter",
                    "message": "The specified parameter is not valid."
                  }
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "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": "app_key 有效但没有执行该操作的权限。",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "noEditPermission": {
                "value": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "error": {
                    "code": "AccessDenied",
                    "message": "Access Denied."
                  }
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "目标资源不存在或已被删除。注意：Flashduty 对业务实体的缺失通常返回 HTTP 400 + code=`ResourceNotFound`，真正的 404 只用于未知路由。",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "resourceMissing": {
                "value": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "error": {
                    "code": "ResourceNotFound",
                    "message": "The resource you request is not found"
                  }
                }
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "命中限流。可能是全局 API 限流、账户级限流或集成级限流。限流按账户聚合。",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "rateLimited": {
                "value": {
                  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
                  "error": {
                    "code": "RequestTooFrequently",
                    "message": "Request too frequently."
                  }
                }
              }
            }
          }
        }
      },
      "ServerError": {
        "description": "服务端未预期错误。反馈问题时请携带 request_id。",
        "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": {
      "AlertRule": {
        "type": "object",
        "description": "完整的告警规则配置。",
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64"
          },
          "account_id": {
            "type": "integer",
            "format": "uint64"
          },
          "folder_id": {
            "type": "integer",
            "format": "uint64",
            "description": "规则所属文件夹。"
          },
          "name": {
            "type": "string",
            "description": "规则名称。"
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "自定义标签。"
          },
          "ds_type": {
            "type": "string",
            "description": "数据源类型。"
          },
          "ds_list": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "数据源名称模式（支持通配符）。"
          },
          "ds_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "uint64"
            },
            "description": "具体数据源 ID 列表。"
          },
          "enabled": {
            "type": "boolean"
          },
          "debug_log_enabled": {
            "type": "boolean"
          },
          "rule_configs": {
            "$ref": "#/components/schemas/RuleConfigs"
          },
          "cron_pattern": {
            "type": "string",
            "description": "5 字段 cron 调度。不允许以 `CRON_TZ=` 或 `TZ=` 开头，时区请填写到 `timezone` 字段。"
          },
          "timezone": {
            "type": "string",
            "description": "告警规则执行时区，决定 cron 调度与生效时间窗口的解释方式。仅接受 IANA 时区名（如 `Asia/Shanghai`、`UTC`、`Europe/London`）；不接受 `Local`、`UTC+8`、`CST` 等简写或偏移量。留空时按 `Asia/Shanghai` 处理。",
            "default": "Asia/Shanghai"
          },
          "delay_seconds": {
            "type": "integer"
          },
          "enabled_times": {
            "type": "array",
            "description": "规则生效的时间窗口。",
            "items": {
              "type": "object",
              "properties": {
                "days": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  },
                  "description": "星期几（0=周日）。"
                },
                "stime": {
                  "type": "string",
                  "description": "开始时间，如 `09:00`。"
                },
                "etime": {
                  "type": "string",
                  "description": "结束时间，如 `18:00`。"
                }
              }
            }
          },
          "annotations": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "description_type": {
            "type": "string",
            "enum": [
              "text",
              "markdown"
            ]
          },
          "description": {
            "type": "string"
          },
          "channel_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "uint64"
            },
            "description": "告警发送到的协作空间 ID 列表。"
          },
          "repeat_interval": {
            "type": "integer",
            "format": "int64",
            "description": "通知重复间隔（秒）。"
          },
          "repeat_total": {
            "type": "integer",
            "format": "int64",
            "description": "最大重复通知次数。"
          },
          "creator_id": {
            "type": "integer",
            "format": "uint64"
          },
          "creator_name": {
            "type": "string"
          },
          "updater_id": {
            "type": "integer",
            "format": "uint64"
          },
          "updater_name": {
            "type": "string"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "AlertRuleAudit": {
        "type": "object",
        "description": "审计记录，保存某一时刻的规则快照。",
        "required": [
          "id",
          "account_id",
          "alert_rule_id",
          "action",
          "creator_id",
          "creator_name",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "审计记录 ID。"
          },
          "account_id": {
            "type": "integer",
            "format": "uint64"
          },
          "alert_rule_id": {
            "type": "integer",
            "format": "uint64",
            "description": "关联的告警规则 ID。"
          },
          "action": {
            "type": "string",
            "description": "操作类型，如 `create`、`update`。"
          },
          "content": {
            "type": "string",
            "description": "审计时刻规则完整配置的 JSON 字符串，仅在 `/monit/rule/audit/detail` 返回，列表接口中省略。"
          },
          "creator_id": {
            "type": "integer",
            "format": "uint64"
          },
          "creator_name": {
            "type": "string"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "AlertRuleBasic": {
        "type": "object",
        "description": "列表视图用的告警规则基础信息。",
        "required": [
          "id",
          "account_id",
          "folder_id",
          "name",
          "ds_type",
          "enabled",
          "debug_log_enabled",
          "cron_pattern",
          "delay_seconds",
          "creator_id",
          "creator_name",
          "updater_id",
          "updater_name",
          "created_at",
          "updated_at",
          "triggered"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "唯一规则 ID。"
          },
          "account_id": {
            "type": "integer",
            "format": "uint64",
            "description": "账户 ID。"
          },
          "folder_id": {
            "type": "integer",
            "format": "uint64",
            "description": "文件夹 ID。"
          },
          "name": {
            "type": "string",
            "description": "规则名称。"
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "自定义标签。"
          },
          "ds_type": {
            "type": "string",
            "description": "数据源类型，如 `prometheus`。"
          },
          "enabled": {
            "type": "boolean",
            "description": "规则是否启用。"
          },
          "debug_log_enabled": {
            "type": "boolean",
            "description": "是否启用调试日志。"
          },
          "cron_pattern": {
            "type": "string",
            "description": "5 字段 cron 调度，如 `* * * * *`。不允许以 `CRON_TZ=` 或 `TZ=` 开头，时区请填写到 `timezone` 字段。"
          },
          "timezone": {
            "type": "string",
            "description": "告警规则执行时区，决定 cron 调度与生效时间窗口的解释方式。仅接受 IANA 时区名（如 `Asia/Shanghai`、`UTC`、`Europe/London`）；不接受 `Local`、`UTC+8`、`CST` 等简写或偏移量。留空时按 `Asia/Shanghai` 处理。",
            "default": "Asia/Shanghai"
          },
          "delay_seconds": {
            "type": "integer",
            "description": "评估延迟（秒）。"
          },
          "creator_id": {
            "type": "integer",
            "format": "uint64"
          },
          "creator_name": {
            "type": "string"
          },
          "updater_id": {
            "type": "integer",
            "format": "uint64"
          },
          "updater_name": {
            "type": "string"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          },
          "triggered": {
            "type": "boolean",
            "description": "是否有当前活跃告警。"
          }
        }
      },
      "AlertRuleCounter": {
        "type": "object",
        "description": "账户规则总数的一次历史快照。",
        "required": [
          "id",
          "account_id",
          "num",
          "clock"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64"
          },
          "account_id": {
            "type": "integer",
            "format": "uint64"
          },
          "num": {
            "type": "integer",
            "format": "int64",
            "description": "该时间点的规则数量。"
          },
          "clock": {
            "type": "integer",
            "format": "int64",
            "description": "采样时间戳（Unix 秒）。"
          }
        }
      },
      "AlertRuleExport": {
        "type": "object",
        "description": "用于导入/导出的便携告警规则表示，省略 `id`、`account_id` 等标识字段与审计元数据。",
        "required": [
          "name",
          "ds_type",
          "enabled",
          "debug_log_enabled",
          "cron_pattern"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "ds_type": {
            "type": "string"
          },
          "ds_list": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ds_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "uint64"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "debug_log_enabled": {
            "type": "boolean"
          },
          "rule_configs": {
            "$ref": "#/components/schemas/RuleConfigs"
          },
          "cron_pattern": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "description": "告警规则执行时区，IANA 时区名，默认 `Asia/Shanghai`。",
            "default": "Asia/Shanghai"
          },
          "delay_seconds": {
            "type": "integer"
          },
          "enabled_times": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnabledTime"
            }
          },
          "annotations": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "description_type": {
            "type": "string",
            "enum": [
              "text",
              "markdown"
            ]
          },
          "description": {
            "type": "string"
          },
          "repeat_interval": {
            "type": "integer",
            "format": "int64"
          },
          "repeat_total": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "AlertRuleExportListResponse": {
        "type": "array",
        "description": "导出的规则配置列表，兼容 `POST /monit/rule/import`。",
        "items": {
          "$ref": "#/components/schemas/AlertRuleExport"
        }
      },
      "AlertRuleInfoResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AlertRule"
          }
        ],
        "description": "info 接口返回的完整告警规则，服务端赋值字段均保证存在。",
        "required": [
          "id",
          "account_id",
          "folder_id",
          "name",
          "ds_type",
          "enabled",
          "debug_log_enabled",
          "cron_pattern",
          "delay_seconds",
          "creator_id",
          "creator_name",
          "updater_id",
          "updater_name",
          "created_at",
          "updated_at"
        ]
      },
      "AlertRuleStatus": {
        "type": "object",
        "description": "文件夹节点的规则触发状态。",
        "required": [
          "folder_id",
          "rule_total",
          "triggered_rule_count"
        ],
        "properties": {
          "folder_id": {
            "type": "integer",
            "format": "uint64"
          },
          "folder_name": {
            "type": "string"
          },
          "rule_total": {
            "type": "integer",
            "format": "int64",
            "description": "文件夹家族内规则总数。"
          },
          "triggered_rule_count": {
            "type": "integer",
            "format": "int64",
            "description": "有活跃告警的规则数量。"
          }
        }
      },
      "DSClickHouseConfig": {
        "type": "object",
        "description": "ClickHouse 数据源配置，TLS 字段继承自 TLSClientConfig。",
        "properties": {
          "database": {
            "type": "string",
            "description": "认证用默认数据库。"
          },
          "username": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "open_conns": {
            "type": "integer"
          },
          "idle_conns": {
            "type": "integer"
          },
          "lifetime_seconds": {
            "type": "integer",
            "format": "int64"
          },
          "timeout_mills": {
            "type": "integer",
            "format": "int64"
          },
          "max_execution_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "最大查询执行时间（秒）。"
          },
          "dial_timeout_mills": {
            "type": "integer",
            "format": "int64",
            "description": "拨号超时（毫秒）。"
          },
          "tls_enabled": {
            "type": "boolean"
          },
          "tls_ca": {
            "type": "string"
          },
          "tls_cert": {
            "type": "string"
          },
          "tls_key": {
            "type": "string"
          },
          "tls_key_pwd": {
            "type": "string"
          },
          "tls_skip_verify": {
            "type": "boolean"
          },
          "tls_server_name": {
            "type": "string"
          },
          "tls_min_version": {
            "type": "string"
          },
          "tls_max_version": {
            "type": "string"
          }
        }
      },
      "DSElasticSearchConfig": {
        "type": "object",
        "description": "Elasticsearch 数据源配置。",
        "properties": {
          "deployment": {
            "type": "string",
            "enum": [
              "cloud",
              "self-managed"
            ],
            "description": "部署类型。`cloud` 使用 Elastic Cloud；`self-managed` 使用自托管集群。"
          },
          "timeout_mills": {
            "type": "integer",
            "format": "int64"
          },
          "cloud_id": {
            "type": "string",
            "description": "Elastic Cloud 部署 ID，仅用于 `cloud` 部署。"
          },
          "api_key": {
            "type": "string",
            "description": "Elastic Cloud API 密钥，仅用于 `cloud` 部署。"
          },
          "username": {
            "type": "string",
            "description": "`self-managed` 部署的用户名。"
          },
          "password": {
            "type": "string"
          },
          "service_token": {
            "type": "string",
            "description": "服务令牌，若设置则覆盖用户名/密码认证。"
          },
          "tls_ca": {
            "type": "string"
          },
          "certificate_fingerprint": {
            "type": "string"
          },
          "headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "DSLokiConfig": {
        "type": "object",
        "description": "Loki 数据源配置，TLS 字段继承自 TLSClientConfig。",
        "properties": {
          "basic_auth_enabled": {
            "type": "boolean"
          },
          "basic_auth_username": {
            "type": "string"
          },
          "basic_auth_password": {
            "type": "string"
          },
          "headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "params": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tls_ca": {
            "type": "string"
          },
          "tls_cert": {
            "type": "string"
          },
          "tls_key": {
            "type": "string"
          },
          "tls_key_pwd": {
            "type": "string"
          },
          "tls_skip_verify": {
            "type": "boolean"
          },
          "tls_server_name": {
            "type": "string"
          },
          "tls_min_version": {
            "type": "string"
          },
          "tls_max_version": {
            "type": "string"
          }
        }
      },
      "DSMySQLConfig": {
        "type": "object",
        "description": "MySQL 数据源配置，TLS 字段继承自 TLSClientConfig。",
        "properties": {
          "username": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "open_conns": {
            "type": "integer",
            "description": "最大打开连接数。"
          },
          "idle_conns": {
            "type": "integer",
            "description": "最大空闲连接数。"
          },
          "lifetime_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "连接最大生命周期（秒）。"
          },
          "timeout_mills": {
            "type": "integer",
            "format": "int64",
            "description": "查询超时时间（毫秒）。"
          },
          "tls_ca": {
            "type": "string"
          },
          "tls_cert": {
            "type": "string"
          },
          "tls_key": {
            "type": "string"
          },
          "tls_key_pwd": {
            "type": "string"
          },
          "tls_skip_verify": {
            "type": "boolean"
          },
          "tls_server_name": {
            "type": "string"
          },
          "tls_min_version": {
            "type": "string"
          },
          "tls_max_version": {
            "type": "string"
          }
        }
      },
      "DSOracleConfig": {
        "type": "object",
        "description": "Oracle 数据源配置。",
        "properties": {
          "username": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "额外连接参数（键值对）。"
          },
          "open_conns": {
            "type": "integer"
          },
          "idle_conns": {
            "type": "integer"
          },
          "lifetime_seconds": {
            "type": "integer",
            "format": "int64"
          },
          "timeout_mills": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "DSPayload": {
        "type": "object",
        "description": "与类型相关的数据源配置，仅包含与 `type_ident` 匹配的配置块。",
        "properties": {
          "prometheus": {
            "$ref": "#/components/schemas/DSPrometheusConfig"
          },
          "loki": {
            "$ref": "#/components/schemas/DSLokiConfig"
          },
          "mysql": {
            "$ref": "#/components/schemas/DSMySQLConfig"
          },
          "oracle": {
            "$ref": "#/components/schemas/DSOracleConfig"
          },
          "postgres": {
            "$ref": "#/components/schemas/DSPostgresConfig"
          },
          "clickhouse": {
            "$ref": "#/components/schemas/DSClickHouseConfig"
          },
          "elasticsearch": {
            "$ref": "#/components/schemas/DSElasticSearchConfig"
          },
          "sls": {
            "$ref": "#/components/schemas/DSSLSConfig"
          },
          "victorialogs": {
            "$ref": "#/components/schemas/DSVictoriaLogsConfig"
          }
        }
      },
      "DSPostgresConfig": {
        "type": "object",
        "description": "PostgreSQL 数据源配置。",
        "properties": {
          "username": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "open_conns": {
            "type": "integer"
          },
          "idle_conns": {
            "type": "integer"
          },
          "lifetime_seconds": {
            "type": "integer",
            "format": "int64"
          },
          "timeout_mills": {
            "type": "integer",
            "format": "int64"
          },
          "tls_ca": {
            "type": "string"
          },
          "tls_cert": {
            "type": "string"
          },
          "tls_key": {
            "type": "string"
          }
        }
      },
      "DSPrometheusConfig": {
        "type": "object",
        "description": "Prometheus 数据源配置，TLS 字段继承自 TLSClientConfig。",
        "properties": {
          "basic_auth_enabled": {
            "type": "boolean",
            "description": "启用 HTTP Basic 认证。"
          },
          "basic_auth_username": {
            "type": "string",
            "description": "Basic 认证用户名。"
          },
          "basic_auth_password": {
            "type": "string",
            "description": "Basic 认证密码。"
          },
          "headers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "自定义 HTTP 请求头，格式为 `Key: Value`。"
          },
          "params": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "自定义查询参数，格式为 `key=value`。"
          },
          "tls_ca": {
            "type": "string"
          },
          "tls_cert": {
            "type": "string"
          },
          "tls_key": {
            "type": "string"
          },
          "tls_key_pwd": {
            "type": "string"
          },
          "tls_skip_verify": {
            "type": "boolean"
          },
          "tls_server_name": {
            "type": "string"
          },
          "tls_min_version": {
            "type": "string"
          },
          "tls_max_version": {
            "type": "string"
          }
        }
      },
      "DSSLSConfig": {
        "type": "object",
        "description": "阿里云日志服务（SLS）数据源配置。",
        "properties": {
          "access_key_id": {
            "type": "string",
            "description": "阿里云 Access Key ID。"
          },
          "access_key_secret": {
            "type": "string",
            "description": "阿里云 Access Key Secret。"
          },
          "headers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "自定义 HTTP 请求头。"
          }
        }
      },
      "DSType": {
        "type": "object",
        "description": "告警规则可使用的数据源类型定义。",
        "required": [
          "id",
          "name",
          "ident",
          "account_id",
          "weight"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64"
          },
          "name": {
            "type": "string",
            "description": "显示名称，如 `Prometheus`。"
          },
          "ident": {
            "type": "string",
            "description": "作为规则 `ds_type` 的标识符，如 `prometheus`。"
          },
          "account_id": {
            "type": "integer",
            "format": "uint64",
            "description": "所属账户 ID；`0` 表示全局类型。"
          },
          "weight": {
            "type": "integer",
            "description": "排序权重，值越大越靠前。"
          }
        }
      },
      "DSVictoriaLogsConfig": {
        "type": "object",
        "description": "VictoriaLogs 数据源配置，TLS 字段继承自 TLSClientConfig。",
        "properties": {
          "basic_auth_enabled": {
            "type": "boolean"
          },
          "basic_auth_username": {
            "type": "string"
          },
          "basic_auth_password": {
            "type": "string"
          },
          "headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "params": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tls_ca": {
            "type": "string"
          },
          "tls_cert": {
            "type": "string"
          },
          "tls_key": {
            "type": "string"
          },
          "tls_key_pwd": {
            "type": "string"
          },
          "tls_skip_verify": {
            "type": "boolean"
          },
          "tls_server_name": {
            "type": "string"
          },
          "tls_min_version": {
            "type": "string"
          },
          "tls_max_version": {
            "type": "string"
          }
        }
      },
      "DataSourceItem": {
        "type": "object",
        "description": "单个监控数据源。",
        "required": [
          "id",
          "account_id",
          "type_ident",
          "name",
          "enabled",
          "note",
          "address",
          "edge_cluster_name",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "唯一数据源 ID。"
          },
          "account_id": {
            "type": "integer",
            "format": "uint64",
            "description": "账户 ID。"
          },
          "type_ident": {
            "type": "string",
            "description": "数据源类型标识，可选值：`prometheus`、`loki`、`mysql`、`oracle`、`postgres`、`clickhouse`、`elasticsearch`、`sls`、`victorialogs`。"
          },
          "name": {
            "type": "string",
            "description": "数据源显示名称。"
          },
          "enabled": {
            "type": "boolean",
            "description": "数据源是否启用。"
          },
          "note": {
            "type": "string",
            "description": "可选描述。"
          },
          "address": {
            "type": "string",
            "description": "连接地址。Prometheus/Loki/VictoriaLogs 为 HTTP URL；MySQL/Oracle/Postgres/ClickHouse 为 `host:port`；SLS 为不含 http/https 前缀的 endpoint。"
          },
          "payload": {
            "$ref": "#/components/schemas/DSPayload"
          },
          "edge_cluster_name": {
            "type": "string",
            "description": "负责使用该数据源评估规则的 Monitors Edge 集群名称。"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "description": "最后更新时间，Unix 时间戳（秒）。"
          }
        }
      },
      "DataSourceListRequest": {
        "type": "object",
        "description": "查询数据源列表的过滤参数。",
        "properties": {
          "type": {
            "type": "string",
            "description": "按数据源类型过滤，省略则返回所有类型。可选值：`prometheus`、`loki`、`mysql`、`oracle`、`postgres`、`clickhouse`、`elasticsearch`、`sls`、`victorialogs`。"
          }
        }
      },
      "DataSourceListResponse": {
        "type": "array",
        "description": "数据源列表，不含敏感凭证字段。",
        "items": {
          "$ref": "#/components/schemas/DataSourceItem"
        }
      },
      "DataSourceUpsertRequest": {
        "type": "object",
        "description": "创建或更新数据源的请求体。`id` 仅在更新时必填。`address` 除 Elasticsearch `deployment=cloud` 外均为必填。",
        "required": [
          "type_ident",
          "name",
          "edge_cluster_name",
          "payload"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "数据源 ID。更新时必填，创建时省略。"
          },
          "type_ident": {
            "type": "string",
            "description": "数据源类型标识，可选值：`prometheus`、`loki`、`mysql`、`oracle`、`postgres`、`clickhouse`、`elasticsearch`、`sls`、`victorialogs`。"
          },
          "name": {
            "type": "string",
            "description": "数据源显示名称。"
          },
          "note": {
            "type": "string",
            "description": "可选描述。"
          },
          "address": {
            "type": "string",
            "description": "连接地址。Prometheus/Loki/VictoriaLogs 为 HTTP URL；MySQL/Oracle/Postgres/ClickHouse 为 `host:port`；SLS 为不含 http/https 前缀的 endpoint；Elasticsearch cloud 部署无需填写。"
          },
          "payload": {
            "$ref": "#/components/schemas/DSPayload",
            "description": "类型相关配置块，必须包含与 `type_ident` 匹配的键。"
          },
          "edge_cluster_name": {
            "type": "string",
            "description": "负责使用该数据源评估规则的 Monitors Edge 集群名称。"
          }
        }
      },
      "DutyError": {
        "type": "object",
        "description": "响应结构中的错误 payload，仅在非 2xx 响应时出现。",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "message": {
            "type": "string",
            "description": "用户可读的错误描述，语言会跟随调用方的 Accept-Language。可能包含字段名、ID 等请求上下文。",
            "example": "The specified parameter template_id is not valid."
          }
        },
        "required": [
          "code",
          "message"
        ]
      },
      "EmptyObject": {
        "type": "object",
        "description": "空对象。当操作的成功信号就是不报错时，作为 `data` 返回。",
        "additionalProperties": false
      },
      "EmptyRequest": {
        "type": "object",
        "description": "无参数。",
        "additionalProperties": false
      },
      "EmptyResponse": {
        "type": "object",
        "description": "空响应体。成功时服务端返回 `data: null`。",
        "properties": {}
      },
      "EnabledTime": {
        "type": "object",
        "description": "规则激活时间窗口。",
        "properties": {
          "days": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "星期几，0 = 周日。"
          },
          "stime": {
            "type": "string",
            "description": "起始时间，如 `09:00`。"
          },
          "etime": {
            "type": "string",
            "description": "结束时间，如 `18:00`。"
          }
        }
      },
      "ErrorCode": {
        "type": "string",
        "description": "Flashduty 错误码枚举。每个失败响应的 `error.code` 都是下列稳定值之一，HTTP 状态码仅作参考。\n\n| 错误码 | HTTP | 含义 |\n|---|---|---|\n| `OK` | 200 | 保留值，正常错误响应不会返回。 |\n| `InvalidParameter` | 400 | 必填参数缺失或未通过校验。 |\n| `BadRequest` | 400 | 通用的 400 错误，通常是请求本身不合法。 |\n| `InvalidContentType` | 400 | 请求头 `Content-Type` 不是 `application/json`。 |\n| `ResourceNotFound` | 400 | 目标资源不存在。注意 HTTP 状态码是 400 而非 404（历史设计）。 |\n| `NoLicense` | 400 | 功能需要有效授权，但未找到可用的 license。 |\n| `ReferenceExist` | 400 | 该资源仍被其他实体引用，无法删除。 |\n| `Unauthorized` | 401 | `app_key` 缺失、无效或已过期。 |\n| `BalanceNotEnough` | 402 | 账户余额不足，无法执行需要计费的操作。 |\n| `AccessDenied` | 403 | 身份认证通过，但 RBAC 权限不足以执行该操作。 |\n| `RouteNotFound` | 404 | 请求的 URL 路径不是已知路由。 |\n| `MethodNotAllowed` | 405 | 当前路径不接受所使用的 HTTP 方法。 |\n| `UndonedOrderExist` | 409 | 账户存在未完成的订单，请稍后重试。 |\n| `RequestLocked` | 423 | 因连续失败被临时锁定。 |\n| `EntityTooLarge` | 413 | 请求体超过允许的最大长度。 |\n| `RequestTooFrequently` | 429 | 命中限流（全局、账户级或集成级）。 |\n| `RequestVerifyRequired` | 428 | 操作需要二次验证码，但未提供。 |\n| `DangerousOperation` | 428 | 危险操作，需要进行 MFA 验证。 |\n| `InternalError` | 500 | 服务端未预期错误。反馈问题请附上 `request_id`。 |\n| `ServiceUnavailable` | 503 | 后端依赖不可用，请稍后重试。 |",
        "enum": [
          "OK",
          "InvalidParameter",
          "BadRequest",
          "InvalidContentType",
          "ResourceNotFound",
          "NoLicense",
          "ReferenceExist",
          "Unauthorized",
          "BalanceNotEnough",
          "AccessDenied",
          "RouteNotFound",
          "MethodNotAllowed",
          "UndonedOrderExist",
          "RequestLocked",
          "EntityTooLarge",
          "RequestTooFrequently",
          "RequestVerifyRequired",
          "DangerousOperation",
          "InternalError",
          "ServiceUnavailable"
        ],
        "x-enumDescriptions": {
          "OK": "保留值，正常错误响应不会返回。",
          "InvalidParameter": "必填参数缺失或未通过校验。",
          "BadRequest": "通用的 400 错误，通常是请求本身不合法。",
          "InvalidContentType": "请求头 `Content-Type` 不是 `application/json`。",
          "ResourceNotFound": "目标资源不存在。注意 HTTP 状态码是 400 而非 404（历史设计）。",
          "NoLicense": "功能需要有效授权，但未找到可用的 license。",
          "ReferenceExist": "该资源仍被其他实体引用，无法删除。",
          "Unauthorized": "`app_key` 缺失、无效或已过期。",
          "BalanceNotEnough": "账户余额不足，无法执行需要计费的操作。",
          "AccessDenied": "身份认证通过，但 RBAC 权限不足以执行该操作。",
          "RouteNotFound": "请求的 URL 路径不是已知路由。",
          "MethodNotAllowed": "当前路径不接受所使用的 HTTP 方法。",
          "UndonedOrderExist": "账户存在未完成的订单，请稍后重试。",
          "RequestLocked": "因连续失败被临时锁定。",
          "EntityTooLarge": "请求体超过允许的最大长度。",
          "RequestTooFrequently": "命中限流（全局、账户级或集成级）。",
          "RequestVerifyRequired": "操作需要二次验证码，但未提供。",
          "DangerousOperation": "危险操作，需要进行 MFA 验证。",
          "InternalError": "服务端未预期错误。反馈问题请附上 `request_id`。",
          "ServiceUnavailable": "后端依赖不可用，请稍后重试。"
        },
        "example": "InvalidParameter"
      },
      "ErrorResponse": {
        "type": "object",
        "description": "错误响应结构。`error` 必填，`data` 不存在。",
        "properties": {
          "request_id": {
            "type": "string",
            "example": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
          },
          "error": {
            "$ref": "#/components/schemas/DutyError"
          }
        },
        "required": [
          "request_id",
          "error"
        ]
      },
      "IDRequest": {
        "type": "object",
        "required": [
          "id"
        ],
        "description": "包含单个数字 ID 的请求。",
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "资源 ID。"
          }
        }
      },
      "NameMessage": {
        "type": "object",
        "description": "批量规则操作中，单条规则的处理结果。",
        "required": [
          "name",
          "message"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "规则名称。"
          },
          "message": {
            "type": "string",
            "description": "成功时为空，失败时为错误信息。"
          }
        }
      },
      "RuleAuditListResponse": {
        "type": "array",
        "description": "按创建时间倒序排列的规则审计记录列表，不含 `content` 字段。",
        "items": {
          "$ref": "#/components/schemas/AlertRuleAudit"
        }
      },
      "RuleBasicListResponse": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/AlertRuleBasic"
        },
        "description": "告警规则基础信息列表。"
      },
      "RuleConfigs": {
        "type": "object",
        "description": "规则评估配置。",
        "properties": {
          "queries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "查询标识符（字母，如 `A`）。`R` 为保留名称，不可使用。"
                },
                "expr": {
                  "type": "string",
                  "description": "查询表达式。"
                },
                "label_fields": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "value_fields": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "args": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "relate_queries": {
            "type": "array",
            "description": "可选的辅助查询，其结果作为上下文附加到告警事件中。每项须有唯一的 `name`（不与任何 query 名称重复）且 `expr` 非空。",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "辅助查询标识符。"
                },
                "expr": {
                  "type": "string",
                  "description": "查询表达式。"
                },
                "args": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "check_threshold": {
            "type": "object",
            "description": "阈值检查配置。",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "alerting_check_times": {
                "type": "integer"
              },
              "recovery_check_times": {
                "type": "integer"
              },
              "push_recovery_event": {
                "type": "boolean"
              },
              "critical": {
                "type": "string"
              },
              "warning": {
                "type": "string"
              },
              "info": {
                "type": "string"
              },
              "recovery": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "invert",
                      "threshold",
                      "ql"
                    ]
                  },
                  "condition": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "check_anydata": {
            "type": "object",
            "description": "有数据检查配置。查询返回任意数据行时触发告警。",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "alerting_check_times": {
                "type": "integer"
              },
              "recovery_check_times": {
                "type": "integer"
              },
              "push_recovery_event": {
                "type": "boolean"
              },
              "severity": {
                "type": "string",
                "enum": [
                  "Critical",
                  "Warning",
                  "Info"
                ]
              },
              "recovery": {
                "type": "object",
                "description": "有数据检查的恢复条件。省略或 `mode` 为空时按 `nodata` 处理。",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "nodata",
                      "ql"
                    ],
                    "description": "`nodata` = 查询无数据时恢复；`ql` = `condition` 表达式为真时恢复。`mode` 为 `ql` 时，仅允许单个查询（`name=A`）。"
                  },
                  "condition": {
                    "type": "string",
                    "description": "恢复表达式，`mode` 为 `ql` 时必填。"
                  },
                  "args": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "check_nodata": {
            "type": "object",
            "description": "无数据检查配置。",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "alerting_check_times": {
                "type": "integer"
              },
              "recovery_check_times": {
                "type": "integer"
              },
              "push_recovery_event": {
                "type": "boolean"
              },
              "severity": {
                "type": "string",
                "enum": [
                  "Critical",
                  "Warning",
                  "Info"
                ]
              },
              "resolve_timeout": {
                "type": "integer",
                "description": "自动恢复等待时间（秒）。"
              }
            }
          }
        }
      },
      "RuleCounterChannelResponse": {
        "type": "object",
        "description": "协作空间名称到规则数量的映射，无法解析的协作空间以其 ID 的字符串形式作为 key。",
        "additionalProperties": {
          "type": "integer",
          "format": "int64"
        }
      },
      "RuleCounterNodeResponse": {
        "type": "object",
        "description": "顶层文件夹名称到规则数量的映射。",
        "additionalProperties": {
          "type": "integer",
          "format": "int64"
        }
      },
      "RuleCounterTotalResponse": {
        "type": "array",
        "description": "按 `clock` 升序排列的规则数量历史采样。",
        "items": {
          "$ref": "#/components/schemas/AlertRuleCounter"
        }
      },
      "RuleDsTypesResponse": {
        "type": "array",
        "description": "当前账户可使用的数据源类型列表，包括全局类型和账户自定义类型。",
        "items": {
          "$ref": "#/components/schemas/DSType"
        }
      },
      "RuleEmptyRequest": {
        "type": "object",
        "description": "不需要任何参数。",
        "additionalProperties": false
      },
      "RuleEmptyResponse": {
        "type": "object",
        "description": "成功时返回空对象。",
        "additionalProperties": false
      },
      "RuleFieldsUpdateRequest": {
        "type": "object",
        "required": [
          "ids",
          "fields"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "uint64"
            },
            "description": "要更新的规则 ID 列表。"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "要更新的字段名列表。"
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "ds_type": {
            "type": "string"
          },
          "ds_list": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ds_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "uint64"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "debug_log_enabled": {
            "type": "boolean"
          },
          "cron_pattern": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "description": "告警规则执行时区，IANA 时区名，默认 `Asia/Shanghai`。",
            "default": "Asia/Shanghai"
          },
          "delay_seconds": {
            "type": "integer"
          },
          "enabled_times": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnabledTime"
            }
          },
          "annotations": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "description": {
            "type": "string"
          },
          "channel_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "uint64"
            }
          },
          "repeat_interval": {
            "type": "integer",
            "format": "int64"
          },
          "repeat_total": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "RuleFolderIDRequest": {
        "type": "object",
        "properties": {
          "folder_id": {
            "type": "integer",
            "format": "uint64",
            "description": "文件夹 ID，0 表示所有。"
          }
        }
      },
      "RuleIDRequest": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "规则 ID。"
          }
        }
      },
      "AuditRecordIDRequest": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "审计记录 ID——来自 `POST /monit/rule/audits` 返回行的 `id`，不是规则 ID。传规则 ID 会返回 HTTP 400。"
          }
        }
      },
      "RuleIDsRequest": {
        "type": "object",
        "required": [
          "ids"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "uint64"
            },
            "description": "规则 ID 列表。"
          }
        }
      },
      "RuleImportRequest": {
        "type": "array",
        "description": "要导入的告警规则导出对象数组。",
        "items": {
          "$ref": "#/components/schemas/AlertRule"
        }
      },
      "RuleImportResponse": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/NameMessage"
        },
        "description": "每条规则的导入结果。"
      },
      "RuleListRequest": {
        "type": "object",
        "description": "按文件夹查询规则的过滤参数。",
        "properties": {
          "folder_id": {
            "type": "integer",
            "format": "uint64",
            "description": "文件夹 ID，设为 0 可列出所有可访问规则。"
          }
        }
      },
      "RuleMoveRequest": {
        "type": "object",
        "required": [
          "ids",
          "dest_folder_id"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "uint64"
            },
            "description": "要移动的规则 ID 列表。"
          },
          "dest_folder_id": {
            "type": "integer",
            "format": "uint64",
            "description": "目标文件夹 ID。"
          }
        }
      },
      "RuleNameMessageListResponse": {
        "type": "array",
        "description": "批量规则操作中每条规则的处理结果列表。",
        "items": {
          "$ref": "#/components/schemas/NameMessage"
        }
      },
      "RuleStatusResponse": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/AlertRuleStatus"
        }
      },
      "SLSLogstoresRequest": {
        "type": "object",
        "description": "查询 SLS 日志库列表的参数。",
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "SLS 数据源 ID。"
          },
          "project": {
            "type": "string",
            "description": "SLS 项目名称。"
          },
          "offset": {
            "type": "integer",
            "description": "分页偏移量。"
          },
          "size": {
            "type": "integer",
            "description": "每页大小。"
          }
        }
      },
      "SLSLogstoresResponse": {
        "type": "array",
        "description": "SLS 日志库名称列表。",
        "items": {
          "type": "string"
        }
      },
      "SLSProjectsRequest": {
        "type": "object",
        "description": "查询 SLS 项目列表的参数。",
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "SLS 数据源 ID。"
          },
          "query": {
            "type": "string",
            "description": "名称前缀过滤。"
          },
          "offset": {
            "type": "integer",
            "description": "分页偏移量。"
          },
          "size": {
            "type": "integer",
            "description": "每页大小。"
          }
        }
      },
      "SLSProjectsResponse": {
        "type": "array",
        "description": "SLS 项目名称列表。",
        "items": {
          "type": "string"
        }
      },
      "StoreRulesetItem": {
        "type": "object",
        "description": "单个规则仓库规则集。",
        "required": [
          "id",
          "type_ident",
          "note",
          "open_flag",
          "creator_account_id",
          "creator_id",
          "creator_name",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "规则集 ID。"
          },
          "type_ident": {
            "type": "string",
            "description": "该规则集适用的数据源类型标识符。"
          },
          "note": {
            "type": "string",
            "description": "规则集描述或标题。"
          },
          "open_flag": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "共享范围：`0` 仅创建者可见，`1` 账户内共享，`2` 公开。"
          },
          "payload": {
            "type": "string",
            "description": "包含告警规则定义的 JSON 字符串，列表接口中省略。"
          },
          "creator_account_id": {
            "type": "integer",
            "format": "uint64",
            "description": "创建者的账户 ID。"
          },
          "creator_id": {
            "type": "integer",
            "format": "uint64",
            "description": "创建者的成员 ID。"
          },
          "creator_name": {
            "type": "string",
            "description": "创建者显示名称。"
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "创建时间，Unix 时间戳（秒）。"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "description": "最后更新时间，Unix 时间戳（秒）。"
          }
        }
      },
      "StoreRulesetListRequest": {
        "type": "object",
        "required": [
          "type_ident"
        ],
        "description": "按数据源类型过滤规则集。",
        "properties": {
          "type_ident": {
            "type": "string",
            "description": "数据源类型标识符，如 `prometheus`。"
          }
        }
      },
      "StoreRulesetListResponse": {
        "type": "array",
        "description": "当前用户有权访问的规则集列表，不含 `payload` 字段。",
        "items": {
          "$ref": "#/components/schemas/StoreRulesetItem"
        }
      },
      "StoreRulesetUpdateRequest": {
        "type": "object",
        "required": [
          "id",
          "note",
          "payload"
        ],
        "description": "更新规则集的参数。",
        "properties": {
          "id": {
            "type": "integer",
            "format": "uint64",
            "description": "要更新的规则集 ID。"
          },
          "note": {
            "type": "string",
            "description": "新的描述。"
          },
          "open_flag": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "新的共享范围：`0` 仅创建者，`1` 账户共享，`2` 公开。"
          },
          "payload": {
            "type": "string",
            "description": "新的告警规则定义 JSON 字符串。"
          }
        }
      },
      "StoreRulesetUpsertRequest": {
        "type": "object",
        "description": "创建规则集的请求体，所有字段均经服务端 `Validate()` 校验。",
        "required": [
          "type_ident",
          "note",
          "payload"
        ],
        "properties": {
          "type_ident": {
            "type": "string",
            "description": "该规则集适用的数据源类型标识符，如 `prometheus`。"
          },
          "note": {
            "type": "string",
            "description": "规则集描述或标题。"
          },
          "open_flag": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "共享范围：`0` 仅创建者可见，`1` 账户内共享，`2` 公开。省略时默认为 `0`。"
          },
          "payload": {
            "type": "string",
            "description": "包含告警规则定义的 JSON 字符串。"
          }
        }
      },
      "SuccessEnvelope": {
        "type": "object",
        "description": "成功响应结构。2xx 响应中 `request_id` 标识本次调用（同时出现在 `Flashcat-Request-Id` 响应头中），`data` 为接口业务 payload。失败响应使用不同结构，参见 `ErrorResponse`。",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "本次请求的唯一 ID，也会在 Flashcat-Request-Id 响应头中返回。反馈问题时请一并附上。",
            "example": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
          },
          "data": {
            "description": "每个接口自己的业务 payload，详见各接口的 200 响应 schema。"
          }
        },
        "required": [
          "request_id",
          "data"
        ]
      },
      "QueryRowsRequest": {
        "type": "object",
        "required": [
          "ds_type",
          "ds_name",
          "expr"
        ],
        "properties": {
          "account_id": {
            "type": "integer",
            "format": "int64",
            "description": "可选的一致性校验。若提供,必须等于已认证账户;不一致将被拒绝。业务执行始终使用已认证账户。"
          },
          "ds_type": {
            "type": "string",
            "description": "数据源类型;必须匹配租户下已配置的数据源。示例:`prometheus`、`loki`、`victorialogs`、`sls`、`elasticsearch`、`mysql`、`postgres`、`oracle`、`clickhouse`。"
          },
          "ds_name": {
            "type": "string",
            "description": "数据源名称;必须匹配租户下已配置的数据源。"
          },
          "expr": {
            "type": "string",
            "description": "查询表达式。语法取决于 `ds_type`,由对应的 monit-edge 客户端解释(Prometheus 用 PromQL,Loki 用 LogQL,SQL 类数据源用 SQL,等等)。"
          },
          "delay_seconds": {
            "type": "integer",
            "description": "应用于点查询(Prometheus、Loki stats、VictoriaLogs stats)的回看偏移,单位秒。明细 / raw 查询忽略该字段。",
            "default": 0
          },
          "args": {
            "type": "object",
            "description": "多态键值扩展参数,原样转发给 monit-edge。所有值必须为字符串。语义取决于 `ds_type`:SLS 需要 `sls.project` + `sls.logstore`;Loki / VictoriaLogs 原始模式需要通过 `<source>.start`/`<source>.end` 或 `<source>.timespan.value` + `<source>.timespan.unit` 指定时间范围;Prometheus 与 SQL 类数据源忽略该字段。键务必按数据源命名空间区分(如 `sls.project`、`loki.type`)。",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "QueryRowsResponse": {
        "type": "array",
        "description": "结果行。不同数据源对 `fields` 与 `values` 的填充方式不同——指标类数据源(Prometheus、*-stats)将数字放入 `values`;明细类数据源(SQL、SLS、原始日志)将数据放入 `fields`,`values` 可能为 `null`。",
        "items": {
          "$ref": "#/components/schemas/QueryRow"
        }
      },
      "QueryRow": {
        "type": "object",
        "properties": {
          "fields": {
            "type": "object",
            "description": "字符串值字段(标签、日志字段、SQL 列)。",
            "additionalProperties": {
              "type": "string"
            }
          },
          "values": {
            "type": "object",
            "nullable": true,
            "description": "数值字段。对于指标查询,规范键名为 `__value__`。对于明细类数据源可能为 `null`。",
            "additionalProperties": {
              "type": "number"
            }
          }
        }
      },
      "DiagnoseRequest": {
        "type": "object",
        "required": [
          "ds_type",
          "ds_name",
          "input"
        ],
        "properties": {
          "account_id": {
            "type": "integer",
            "format": "int64",
            "description": "可选的一致性校验。若提供,必须等于已认证账户。"
          },
          "ds_type": {
            "type": "string",
            "description": "数据源类型。`log_patterns` 支持 `loki` 与 `victorialogs`;`metric_trends` 支持 `prometheus`。"
          },
          "ds_name": {
            "type": "string",
            "description": "租户下已配置的数据源名称。"
          },
          "operation": {
            "type": "string",
            "enum": [
              "log_patterns",
              "metric_trends"
            ],
            "description": "诊断操作类型。省略时根据 `ds_type` 推断(loki / victorialogs → `log_patterns`,prometheus → `metric_trends`)。其他数据源必须显式指定。"
          },
          "time_range": {
            "type": "object",
            "description": "诊断窗口,Unix 秒。缺失或无效时默认最近 15 分钟;窗口宽度超过 6 小时将被拒绝。",
            "properties": {
              "start": {
                "type": "integer",
                "format": "int64",
                "description": "窗口起点,Unix 秒。"
              },
              "end": {
                "type": "integer",
                "format": "int64",
                "description": "窗口终点,Unix 秒。"
              }
            }
          },
          "methods": {
            "type": "array",
            "description": "要执行的诊断方法。省略时,`log_patterns` 默认为 `pattern_snapshot + pattern_compare(previous_window)`,`metric_trends` 默认为 `single_window_shape + window_compare(previous_window)`。",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "`log_patterns` 支持 `pattern_snapshot`、`pattern_compare`。`metric_trends` 支持 `single_window_shape`、`window_compare`。"
                },
                "baseline": {
                  "type": "string",
                  "enum": [
                    "previous_window",
                    "same_window_yesterday",
                    "same_window_last_week"
                  ],
                  "description": "仅对 compare 类方法有意义。默认 `previous_window`。"
                }
              }
            }
          },
          "input": {
            "type": "object",
            "required": [
              "query"
            ],
            "properties": {
              "query": {
                "type": "string",
                "description": "查询表达式。`log_patterns` 使用 LogQL / VictoriaLogs 查询语法;`metric_trends` 使用 PromQL。"
              }
            }
          },
          "options": {
            "type": "object",
            "description": "执行选项,所有值均受 monit-edge 上限约束。",
            "properties": {
              "max_logs_scanned": {
                "type": "integer",
                "description": "单窗口日志扫描上限。默认 10 000,硬上限 50 000。"
              },
              "max_patterns": {
                "type": "integer",
                "description": "返回的最大模式数。默认 20,硬上限 50。"
              },
              "examples_per_pattern": {
                "type": "integer",
                "description": "每个模式返回的脱敏样例最大条数。默认 2,硬上限 3。"
              },
              "step_seconds": {
                "type": "integer",
                "description": "`metric_trends` 的 query_range 步长。默认 60,取值范围 [15, 300]。"
              },
              "max_series": {
                "type": "integer",
                "description": "`metric_trends` 考察的最大序列数。默认 50,硬上限 200。"
              },
              "topk": {
                "type": "integer",
                "description": "`metric_trends` 返回的显著序列最大数量。默认 10,硬上限 50。"
              },
              "timeout_seconds": {
                "type": "integer",
                "description": "边缘侧诊断超时,单位秒。默认 25,硬上限 30。"
              }
            }
          }
        }
      },
      "DiagnoseResponse": {
        "type": "object",
        "description": "按 operation 区分的诊断结果。请先检查 `operation`,再处理 `results[]`。`results[].patterns`(对应 `log_patterns`)与 `results[].series`(对应 `metric_trends`)的结构因 operation 不同而不同;完整 schema 见 monit-webapi diagnose-api 文档。",
        "properties": {
          "operation": {
            "type": "string",
            "enum": [
              "log_patterns",
              "metric_trends"
            ]
          },
          "ds_type": {
            "type": "string"
          },
          "ds_name": {
            "type": "string"
          },
          "query": {
            "type": "string",
            "description": "从请求中回显的查询字符串。"
          },
          "window": {
            "type": "object",
            "properties": {
              "start": {
                "type": "integer",
                "format": "int64"
              },
              "end": {
                "type": "integer",
                "format": "int64"
              }
            }
          },
          "results": {
            "type": "array",
            "description": "与请求中的 `methods[]` 一一对应,顺序一致。",
            "items": {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "description": "`log_patterns` 对应 `pattern_snapshot` / `pattern_compare`;`metric_trends` 对应 `single_window_shape` / `window_compare`。"
                },
                "baseline": {
                  "type": "string",
                  "description": "仅在 compare 类方法中出现。"
                },
                "window": {
                  "type": "object",
                  "properties": {
                    "start": {
                      "type": "integer",
                      "format": "int64"
                    },
                    "end": {
                      "type": "integer",
                      "format": "int64"
                    }
                  }
                },
                "baseline_window": {
                  "type": "object",
                  "description": "仅在 compare 类方法中出现。",
                  "properties": {
                    "start": {
                      "type": "integer",
                      "format": "int64"
                    },
                    "end": {
                      "type": "integer",
                      "format": "int64"
                    }
                  }
                },
                "summary": {
                  "type": "object",
                  "description": "该方法的聚合摘要。结构因方法而异:`log_patterns` 包含 logs_scanned、patterns_total、surging_threshold 等;`metric_trends` 包含 series_total、data_quality、observations 等。"
                },
                "patterns": {
                  "type": "array",
                  "description": "仅 `log_patterns` 返回。按 RCA 优先级排序;每项包含 pattern_hash、template、count、severity、sources、examples,以及(compare 情形下)baseline_count、change_ratio、is_new、is_gone。",
                  "items": {
                    "type": "object"
                  }
                },
                "series": {
                  "type": "array",
                  "description": "仅 `metric_trends` 返回。显著序列,带 current / baseline / change / notable_period 字段。",
                  "items": {
                    "type": "object"
                  }
                },
                "warnings": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "单方法的提示信息(如 `examples redacted`、采样提示等)。"
                }
              }
            }
          }
        }
      },
      "ToolCatalogRequest": {
        "type": "object",
        "required": [
          "target_locator"
        ],
        "properties": {
          "account_id": {
            "type": "integer",
            "format": "int64",
            "description": "可选的一致性校验。若提供,必须等于已认证账户。"
          },
          "target_locator": {
            "type": "string",
            "description": "监控对象标识(主机名、MySQL 地址等)。最长 256 字节;不允许空白、控制字符或 `|`。"
          },
          "target_kind": {
            "type": "string",
            "description": "可选的 target kind。省略时 webapi 在当前已知的 kind 中自动推断。内置 kind:`host`、`mysql`。上次返回 `ambiguous_target_kind` 时,重试必须传入此字段。"
          },
          "include_output_shape": {
            "type": "boolean",
            "description": "为 true 时,每个工具条目额外返回其 `output_shape` JSON Schema。默认 false,以便为 LLM 消费保持响应精简。",
            "default": false
          }
        }
      },
      "ToolCatalogResponse": {
        "type": "object",
        "properties": {
          "target": {
            "type": "object",
            "nullable": true,
            "description": "解析出的监控对象。若 locator 无法唯一解析,则为 `null`。",
            "properties": {
              "kind": {
                "type": "string"
              },
              "locator": {
                "type": "string"
              }
            }
          },
          "tools": {
            "type": "array",
            "description": "工具能力清单条目。当 `error` 不为空时为空。",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "工具名;作为 `/monit/tools/invoke` 的 `tools[].tool` 传入。"
                },
                "target_kind": {
                  "type": "string",
                  "description": "该工具适用的 target kind。"
                },
                "description": {
                  "type": "string",
                  "description": "工具能力描述,供 UI / AI-SRE 使用。"
                },
                "input_schema": {
                  "type": "object",
                  "description": "用于 `tools[].params` 的 JSON Schema。"
                },
                "output_shape": {
                  "type": "object",
                  "description": "可选的输出 JSON Schema;仅当 `include_output_shape=true` 时返回。"
                }
              }
            }
          },
          "error": {
            "type": "object",
            "nullable": true,
            "description": "业务错误。成功时为 `null`。",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "target_unavailable",
                  "unknown_toolset_hash",
                  "ambiguous_target_kind"
                ]
              },
              "message": {
                "type": "string"
              },
              "target_kinds": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "在 `ambiguous_target_kind` 时返回;列出候选的 kind。"
              }
            }
          }
        }
      },
      "ToolInvokeRequest": {
        "type": "object",
        "required": [
          "target_locator",
          "tools"
        ],
        "properties": {
          "account_id": {
            "type": "integer",
            "format": "int64",
            "description": "可选的一致性校验。若提供,必须等于已认证账户。"
          },
          "target_locator": {
            "type": "string",
            "description": "监控对象标识。校验规则与 `/monit/tools/catalog` 相同。"
          },
          "target_kind": {
            "type": "string",
            "description": "可选的 target kind;省略时自动推断。"
          },
          "tools": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "description": "至多 8 个工具调用;webapi 会并发执行,并按入参顺序返回结果。",
            "items": {
              "type": "object",
              "required": [
                "tool"
              ],
              "properties": {
                "tool": {
                  "type": "string",
                  "description": "工具名,通常来自 `/monit/tools/catalog`。"
                },
                "params": {
                  "type": "object",
                  "description": "符合工具能力清单中 `input_schema` 的参数。无参工具请显式传 `{}`。",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "ToolInvokeResponse": {
        "type": "object",
        "properties": {
          "target": {
            "type": "object",
            "nullable": true,
            "description": "解析出的监控对象。",
            "properties": {
              "kind": {
                "type": "string"
              },
              "locator": {
                "type": "string"
              }
            }
          },
          "results": {
            "type": "array",
            "description": "按入参 `tools[]` 顺序对齐的单工具结果。当 `error` 不为空时为空。",
            "items": {
              "type": "object",
              "properties": {
                "tool": {
                  "type": "string"
                },
                "tool_version": {
                  "type": "string",
                  "description": "Agent 执行的工具版本。若执行在 Agent 选定版本之前就失败了,则为空。"
                },
                "data": {
                  "type": "object",
                  "nullable": true,
                  "description": "工具执行成功时的负载——monit-agent `ToolResultPayload.data` 的透传(通常包含 `data` / `summary` / `truncated`)。当单工具 `error` 被设置时为 `null`。"
                },
                "error": {
                  "type": "object",
                  "nullable": true,
                  "description": "单工具错误。与 `data` 互斥。",
                  "properties": {
                    "code": {
                      "type": "string",
                      "description": "常见取值:`timeout`、`target_unavailable`、`edge_unsupported`、`invalid_tool_result`、`internal`、`invalid_args`、`unknown_tool`、`unknown_tool_version`、`unknown_toolset_hash`、`target_not_owned`、`wrong_agent`、`overloaded`、`denied`、`permission_denied`、`credential_unavailable`、`target_unreachable`。"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "agent_elapsed_ms": {
                  "type": "integer",
                  "format": "int64",
                  "description": "Agent 自报的工具执行耗时,单位毫秒,不含网络。当失败发生在 Agent 开始执行之前时可能为 0。"
                },
                "e2e_elapsed_ms": {
                  "type": "integer",
                  "format": "int64",
                  "description": "webapi 观测的端到端耗时,单位毫秒(webapi → ws → edge → agent → ws → webapi)。与 `agent_elapsed_ms` 差距较大表示网络 / 边缘侧慢。"
                }
              }
            }
          },
          "error": {
            "type": "object",
            "nullable": true,
            "description": "请求级业务错误。成功时为 `null`。",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "target_unavailable",
                  "unknown_toolset_hash",
                  "forward_failed",
                  "invalid_tool_result",
                  "ambiguous_target_kind"
                ]
              },
              "message": {
                "type": "string"
              },
              "target_kinds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "TargetsListRequest": {
        "type": "object",
        "properties": {
          "account_id": {
            "type": "integer",
            "format": "int64",
            "description": "可选的一致性校验。若提供,必须等于已认证账户。"
          },
          "keyword": {
            "type": "string",
            "description": "对 `target_locator` 的前缀匹配。仅 ASCII,不含空白,不含 `|`,最长 256 字节。不支持子串搜索。"
          },
          "limit": {
            "type": "integer",
            "description": "分页大小。默认 50,最大 200。",
            "default": 50,
            "maximum": 200
          },
          "cursor": {
            "type": "string",
            "description": "来自上次响应的 `next_cursor` 的不透明游标。首页请省略或传空串。变更 `keyword`、`limit` 或租户时必须重置。"
          }
        }
      },
      "TargetsListResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "target_kind": {
                  "type": "string",
                  "description": "Target kind,如 `host`、`mysql`。v1 不支持按 kind 过滤。"
                },
                "target_locator": {
                  "type": "string",
                  "description": "监控对象标识;列表按此字段升序排序。"
                },
                "agent_version": {
                  "type": "string",
                  "description": "最近一次观测到的 Agent 版本。"
                },
                "cluster_name": {
                  "type": "string",
                  "description": "边缘集群名。"
                },
                "edge_ipport": {
                  "type": "string",
                  "description": "边缘实例地址(`ip:port`),供排障使用。"
                },
                "updated_at": {
                  "type": "integer",
                  "format": "int64",
                  "description": "最近一次路由投影写入时间,Unix 秒。视为\"最近一次被观测到\",而非实时在线指标。"
                }
              }
            }
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "当前 `(account_id, keyword)` 组合下的匹配总数,与 `cursor` 无关。"
          },
          "next_cursor": {
            "type": "string",
            "description": "下一页的不透明游标。缺失 / 为空表示已到末页。"
          }
        }
      },
      "PreviewSyncRequest": {
        "type": "object",
        "required": [
          "ds_type",
          "ds_name",
          "expr"
        ],
        "description": "同步数据源查询预览的参数。",
        "properties": {
          "ds_type": {
            "type": "string",
            "description": "数据源类型，如 `prometheus`、`loki`、`elasticsearch`。"
          },
          "ds_name": {
            "type": "string",
            "description": "账户中配置的数据源显示名称。"
          },
          "expr": {
            "type": "string",
            "description": "查询表达式，格式因 `ds_type` 而异（Prometheus 为 PromQL，Loki 为 LogQL 等）。"
          },
          "delay_seconds": {
            "type": "integer",
            "description": "将查询窗口向前偏移的秒数，用于补偿数据摄入延迟。"
          },
          "args": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "特定类型的额外查询参数。"
          }
        }
      },
      "PreviewSyncResponse": {
        "type": "object",
        "description": "数据源返回的原始 JSON，结构随数据源类型而异。"
      }
    }
  }
}