{
  "openapi": "3.1.0",
  "info": {
    "title": "AttentionHub Public API",
    "version": "1.4.0",
    "summary": "全球新闻事件热度榜、双语事件库、持续概率预测与科技财经每日精选 API",
    "description": "AttentionHub 面向业务应用与 AI Agent 提供结构化的全球事件热度、双语新闻事件库、持续概率预测与科技财经每日精选接口。\n\n### 核心约定\n- **三层开放访问**：\n  1. **公开开放层（默认免 Key）**：公开数据、网页搜索与抓取，以及公开预测提交（`visibility=\"public\"`）无需鉴权头。公开预测提交另有日配额。\n  2. **私有预测自关联（`X-Private-Token`，免申请）**：提交或查询 `visibility=\"private\"` 私有预测时，由调用方本地生成高熵随机串（32–128 位 `[A-Za-z0-9_-]`，至少 10 种不同字符）传入 `X-Private-Token` 即可隔离；不放宽匿名 IP 限流。\n  3. **高配额/合作方层（可选 `X-API-Key`）**：不限制能否使用，仅用于大流量高并发与独立日预算（前往 `https://docs.attentionhub.cn/apply` 申请）。传入无效或重复 `X-API-Key` 返回 `401`；严禁与 `X-Private-Token` 同时发送（返回 `400 AMBIGUOUS_CREDENTIALS`）。\n- **全局 `?cn_safe=false`**：默认返回安全视图（`cn_safe=true`）；仅精确小写 `?cn_safe=false` 切换全量视图，无需额外密钥。分页游标与当前 `cn_safe` 状态、身份作用域及筛选条件绑定。\n- **缓存策略**：全部 `/v1/*` 响应返回 `Cache-Control: private, no-store`。\n- **事件封面图**：返回 `https://img.attentionhub.cn` 域名下的 WebP 绝对地址（支持长期缓存）。\n- **速率限制**：免 Key 按 IP（通用读 `10 req/s burst 20`，预测提交 `6 req/min burst 2` 且每 IP `20` 次/日、全站匿名 `200` 次/日，预测检索 `3 req/s burst 5`，每日精选 `3 req/s burst 8`）；高配额 `X-API-Key` 按 Key（读 `30 req/s`，提交 `30 req/min` + 独立日预算，检索/精选 `10 req/s`）。"
  },
  "servers": [
    {
      "url": "https://api.attentionhub.cn",
      "description": "AttentionHub 生产 API（HTTPS / TLS 1.2+）"
    }
  ],
  "security": [
    {},
    {
      "ApiKeyAuth": []
    },
    {
      "PrivateTokenAuth": []
    }
  ],
  "tags": [
    {
      "name": "Heat Ranking",
      "description": "实时突发（breaking）与 24 小时事件热度榜"
    },
    {
      "name": "Events",
      "description": "双语事件详情、批量查询、事件合并跳转与封面图"
    },
    {
      "name": "Predictions",
      "description": "公开/私有持续概率预测、关键词/语义检索与概率演化轨迹"
    },
    {
      "name": "Briefings",
      "description": "科技财经双语每日精选与历史版本回溯"
    },
    {
      "name": "Web",
      "description": "实时联网搜索聚合与网页正文提取 / Live web search and page extraction"
    },
    {
      "name": "Applications",
      "description": "高配额 X-API-Key 申请提交"
    }
  ],
  "paths": {
    "/v1/web/search": {
      "get": {
        "tags": [
          "Web"
        ],
        "operationId": "getWebSearch",
        "summary": "联网搜索 / Search the web",
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "auto",
                "fast",
                "aggregate"
              ],
              "default": "auto"
            }
          },
          {
            "name": "topic",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "general",
                "news"
              ],
              "default": "general"
            }
          },
          {
            "name": "time_range",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month",
                "year"
              ]
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "auto",
                "zh",
                "en"
              ],
              "default": "auto"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30,
              "default": 10
            }
          },
          {
            "name": "include_content",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "description": "Search public sources with a 7-second deadline. Results may contain partial provider coverage. Shared search/fetch rate limit: anonymous 10/min burst 5; API key 60/min burst 20.",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebSearchResults"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST or INVALID_URL",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "WEB_SEARCH_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Web"
        ],
        "operationId": "postWebSearch",
        "summary": "提交联网搜索 / Search the web with JSON",
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "description": "Same ranking and limits as GET /v1/web/search. Send cn_safe only in the URL.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "q"
                ],
                "properties": {
                  "q": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "fast",
                      "aggregate"
                    ],
                    "default": "auto"
                  },
                  "topic": {
                    "type": "string",
                    "enum": [
                      "general",
                      "news"
                    ],
                    "default": "general"
                  },
                  "time_range": {
                    "type": "string",
                    "enum": [
                      "day",
                      "week",
                      "month",
                      "year"
                    ]
                  },
                  "lang": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "zh",
                      "en"
                    ],
                    "default": "auto"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 30,
                    "default": 10
                  },
                  "include_content": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebSearchResults"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST or INVALID_URL",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "413": {
            "description": "PAYLOAD_TOO_LARGE (8 KiB)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "WEB_SEARCH_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/web/fetch": {
      "post": {
        "tags": [
          "Web"
        ],
        "operationId": "fetchWeb",
        "summary": "提取网页正文 / Extract a public web page",
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "description": "Extract title and text from a publicly reachable HTTPS URL. Filtered pages return 404 in the safe view.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "pattern": "^https://"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebFetchResult"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST or INVALID_URL",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "WEB_CONTENT_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "413": {
            "description": "PAYLOAD_TOO_LARGE (8 KiB)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "WEB_FETCH_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/rankings/heat": {
      "get": {
        "tags": [
          "Heat Ranking"
        ],
        "operationId": "getHeatRanking",
        "summary": "获取事件热度榜（breaking / 24h）",
        "description": "返回每 5 分钟更新一次的全球事件热度快照，支持按 `window`、`category` 与 `cn_safe` 筛选。分页游标绑定 `cn_safe`、`snapshot_id`、`window` 与 `category`；游标过期或切换筛选条件时返回 `400`。",
        "parameters": [
          {
            "name": "window",
            "in": "query",
            "required": true,
            "description": "榜单时间窗：breaking（实时突发升温）或 24h（24 小时综合热度）。",
            "schema": {
              "type": "string",
              "enum": [
                "breaking",
                "24h"
              ]
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "分类过滤，默认 all（小写字母/数字/下划线/短横线，最长 128 字符）。",
            "schema": {
              "type": "string",
              "default": "all",
              "maxLength": 128
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "每页返回条数，范围 1–100，默认 20。",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "上一页返回的不透明分页游标（绑定 cn_safe、window、category 与 snapshot_id）。",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "responses": {
          "200": {
            "description": "热度榜快照页",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HeatRankingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/events/{id}": {
      "get": {
        "tags": [
          "Events"
        ],
        "operationId": "getEventById",
        "summary": "获取单条事件详情",
        "description": "返回双语标题、摘要、严重度、归并后的成员报道（含已合并别名事件的报道）及 CDN WebP 封面。默认安全模式下敏感事件返回 200 最小壳 `{id, cn_filtered: true}`；若该 ID 已被合并至主事件，返回 200 `{id, merged_into}`。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "事件 ID（支持当前 UUID 或兼容历史 ID，最长 128 字符）。",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "responses": {
          "200": {
            "description": "事件详情、最小安全壳或合并指针",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/EventDetail"
                    },
                    {
                      "$ref": "#/components/schemas/CnFilteredShell"
                    },
                    {
                      "$ref": "#/components/schemas/MergedEventPointer"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "tags": [
          "Events"
        ],
        "operationId": "batchGetEvents",
        "summary": "批量获取事件详情（1–50 个）",
        "description": "按请求顺序返回 1–50 个事件。不存在的 ID 在数组中以 `{id, not_found: true}` 占位，敏感 ID 在安全模式下以 `{id, cn_filtered: true}` 返回，已合并 ID 返回 `{id, merged_into}`。",
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "required": true,
            "description": "逗号分隔的事件 ID 列表，1–50 个有效 ID。",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "responses": {
          "200": {
            "description": "按入参顺序返回的批量结果",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "$ref": "#/components/schemas/EventDetail"
                          },
                          {
                            "$ref": "#/components/schemas/CnFilteredShell"
                          },
                          {
                            "$ref": "#/components/schemas/MergedEventPointer"
                          },
                          {
                            "$ref": "#/components/schemas/NotFoundShell"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/predictions": {
      "post": {
        "tags": [
          "Predictions"
        ],
        "operationId": "submitPrediction",
        "summary": "提交预测问题（异步受理）",
        "description": "创建公开（默认）或账号私有预测问题。请求体上限 16 KiB，速率限制 6 req/min（burst 2）。接口返回 `202 Accepted` 后即可立即通过 `GET /v1/predictions/{id}` 查询，建议按 `poll_after_ms: 1000` 轮询直至状态脱离 `pending_initial`。请求查询串支持全局 `?cn_safe=false`（仅影响当次响应中的关联结果过滤），请求正文中的 `cn_safe` 字段将被忽略，安全属性由系统自动判定。",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "可选幂等键（1–128 位可打印 ASCII）。同账号同键同内容重放原 202 结果，同键改内容返回 409。",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PredictionSubmitRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "已受理并进入首轮研判队列",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PredictionAcceptedResponse"
                }
              }
            }
          },
          "400": {
            "description": "请求参数非法、JSON 格式错误或 Idempotency-Key 格式非法",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ApiError"
                    },
                    {
                      "$ref": "#/components/schemas/PredictionWriteError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "description": "幂等键冲突（相同 Idempotency-Key 提交了不同正文）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PredictionWriteError"
                }
              }
            }
          },
          "422": {
            "description": "问题不可判定、缺少明确截止日或包含相对时间（如 relative_time_not_allowed）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PredictionWriteError"
                }
              }
            }
          },
          "429": {
            "description": "触发每分钟速率限制（RATE_LIMITED，带 Retry-After）或达到账号每日预测提交上限（PREDICTION_BUDGET_EXHAUSTED，切勿重试）",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ApiError"
                    },
                    {
                      "$ref": "#/components/schemas/PredictionWriteError"
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "Predictions"
        ],
        "operationId": "listPredictions",
        "summary": "分页获取预测列表（公开预测 + 当前账号私有预测）",
        "description": "分页返回公开预测与当前 API Key 所属账号的私有预测。游标绑定账号、`cn_safe` 与当前筛选条件。",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending_initial",
                "active",
                "resolved",
                "cancelled",
                "invalid"
              ]
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "小写分类标识（最长 40 字符）。",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "updated_since",
            "in": "query",
            "required": false,
            "description": "ISO-8601 UTC 时间戳，仅返回此后更新过的预测。",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "recent",
                "updated"
              ],
              "default": "recent"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "responses": {
          "200": {
            "description": "预测列表页",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PredictionListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/predictions/search": {
      "get": {
        "tags": [
          "Predictions"
        ],
        "operationId": "searchPredictions",
        "summary": "检索相似或相关预测（关键词 / 语义双模）",
        "description": "速率限制 3 req/s（burst 5）。`mode=keyword` 执行快速关键词匹配；`mode=semantic` 执行自然语言语义检索，异常超时时自动降级为关键词检索并在响应中返回 `degraded: true`。",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "搜索文本（1–240 字符）。",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 240
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "keyword",
                "semantic"
              ],
              "default": "keyword"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending_initial",
                "active",
                "resolved",
                "cancelled",
                "invalid"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "responses": {
          "200": {
            "description": "检索结果（含实际执行模式与降级标记）",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PredictionSearchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/predictions/{id}": {
      "get": {
        "tags": [
          "Predictions"
        ],
        "operationId": "getPredictionById",
        "summary": "获取单条预测详情（含结构化判定条件与关联参考市场）",
        "description": "返回预测最新概率（0.0–1.0 小数，例如 0.64 表示 64%）、结构化判定条件 `contract`、`related_markets`（关联预测市场参考报价，独立展示对照，不覆盖主预测）以及 `stale` 标记。跨账号访问他人的私有预测一律返回 `404`；默认安全模式下敏感公开题返回 `200 {id, cn_filtered: true}`。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "responses": {
          "200": {
            "description": "预测详情或安全最小壳",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PredictionDetail"
                    },
                    {
                      "$ref": "#/components/schemas/CnFilteredShell"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/predictions/{id}/history": {
      "get": {
        "tags": [
          "Predictions"
        ],
        "operationId": "getPredictionHistory",
        "summary": "获取预测概率演化轨迹",
        "description": "按时间倒序返回预测的历史概率演化记录与关联依据。安全模式下，引用已失效或非安全报道的历史节点将自动过滤；若主预测受安全过滤则返回 `200 {id, cn_filtered: true}`。使用 `before_id` 向上翻页。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "before_id",
            "in": "query",
            "required": false,
            "description": "上一页返回的 `next_before_id` 快照整数 ID。",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "responses": {
          "200": {
            "description": "概率演化轨迹页或安全最小壳",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PredictionHistoryResponse"
                    },
                    {
                      "$ref": "#/components/schemas/CnFilteredShell"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/briefings/latest": {
      "get": {
        "tags": [
          "Briefings"
        ],
        "operationId": "getLatestBriefing",
        "summary": "获取最新一期科技财经每日精选",
        "description": "速率限制 3 req/s（burst 8），每日 08:00 UTC+8（Asia/Shanghai）更新当期精选。默认返回最新日期的 `safe` 有效版本；传入 `?cn_safe=false` 返回 `full` 版本。切勿向 `/latest` 传入 `version` 参数（否则返回 `400`），历史修订请改用 `/v1/briefings/{date}?version=N`。亦可通过别名 `/v1/briefings/daily/latest` 访问。",
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "输出语言：both（默认，双语对象 {zh, en}）、zh 或 en。",
            "schema": {
              "type": "string",
              "enum": [
                "both",
                "zh",
                "en"
              ],
              "default": "both"
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "responses": {
          "200": {
            "description": "最新每日精选完整内容",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BriefingDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/briefings/{date}": {
      "get": {
        "tags": [
          "Briefings"
        ],
        "operationId": "getBriefingByDate",
        "summary": "按日期获取每日精选（支持指定历史不可变版本）",
        "description": "查询指定 `YYYY-MM-DD` 的精选内容，可选 `version >= 1` 回溯不可变修订版本（不传则返回最新有效版本）。支持别名 `/v1/briefings/daily/{date}`。",
        "parameters": [
          {
            "name": "date",
            "in": "path",
            "required": true,
            "description": "刊期日期（格式 YYYY-MM-DD）。",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-25"
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "description": "指定不可变版本号（正整数，如 1 或 2）。",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "both",
                "zh",
                "en"
              ],
              "default": "both"
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "responses": {
          "200": {
            "description": "指定刊期的每日精选",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BriefingDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/briefings": {
      "get": {
        "tags": [
          "Briefings"
        ],
        "operationId": "listBriefings",
        "summary": "分页获取每日精选历史期数列表",
        "description": "按刊期倒序返回精选元数据与摘要列表，游标绑定 `cn_safe` 与 `lang`。支持别名 `/v1/briefings/daily`。",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "both",
                "zh",
                "en"
              ],
              "default": "both"
            }
          },
          {
            "$ref": "#/components/parameters/CnSafe"
          }
        ],
        "responses": {
          "200": {
            "description": "历史期数分页列表",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BriefingListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/key-applications": {
      "post": {
        "tags": [
          "Applications"
        ],
        "operationId": "submitKeyApplication",
        "summary": "提交高配额 X-API-Key 申请",
        "description": "公开申请入口（无需鉴权，Web 独立页面托管于 `https://docs.attentionhub.cn/apply`）。按 IP 限流 `3 req/hour (burst 2)`，最大请求体 `4 KiB`。同一邮箱 24 小时内存在待审核申请时返回 `409 APPLICATION_ALREADY_PENDING`。",
        "security": [
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyApplicationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "申请已受理并进入审核队列",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyApplicationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "409": {
            "description": "同一邮箱 24 小时内已有待审核申请（APPLICATION_ALREADY_PENDING）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "可选高配额密钥（32–128 位 `[A-Za-z0-9_-]`），用于大流量并发与合作方专属配额；不传即可使用开放免费档，传入无效或重复 Key 返回 401。不可与 X-Private-Token 同时发送。"
      },
      "PrivateTokenAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Private-Token",
        "description": "可选自造私有预测关联凭证（免申请，客户端本地生成 32–128 位高熵 `[A-Za-z0-9_-]` 且至少 10 种不同字符）。仅用于隔离 `visibility=\"private\"` 私有预测，不放宽匿名 IP 限流；不可与 X-API-Key 同时发送。"
      }
    },
    "parameters": {
      "CnSafe": {
        "name": "cn_safe",
        "in": "query",
        "required": false,
        "description": "默认不传（安全视图，cn_safe=true）；仅精确小写 cn_safe=false 切换全量视图。其他值（如 true/False/0）返回 400。",
        "schema": {
          "type": "string",
          "enum": [
            "false"
          ]
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "请求参数非法、游标跨模式或快照已过期",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "缺少 X-API-Key、密钥重复或校验失败",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "NotFound": {
        "description": "资源不存在或无权访问他人私有预测",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "RateLimited": {
        "description": "超出该接口族每 Key 限流配额（按 Retry-After 响应头退避）",
        "headers": {
          "Retry-After": {
            "description": "建议重试等待秒数或 HTTP 日期",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "服务短暂过载或依赖暂不可用（error.retryable 为 true 时执行有上限指数退避）",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      }
    },
    "schemas": {
      "WebSearchItem": {
        "type": "object",
        "required": [
          "url",
          "title",
          "summary",
          "source",
          "published_at",
          "engines",
          "score"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "engines": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "doubao",
                "tavily",
                "iqs"
              ]
            }
          },
          "score": {
            "type": "number"
          }
        }
      },
      "WebSearchResults": {
        "type": "object",
        "required": [
          "query",
          "mode",
          "lang",
          "cn_safe",
          "items",
          "providers"
        ],
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "mode": {
            "type": "string",
            "enum": [
              "auto",
              "fast",
              "aggregate"
            ],
            "default": "auto"
          },
          "lang": {
            "type": "string",
            "enum": [
              "zh",
              "en"
            ]
          },
          "cn_safe": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebSearchItem"
            }
          },
          "providers": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "ok",
                "idle",
                "unconfigured",
                "unavailable",
                "timeout"
              ]
            }
          }
        }
      },
      "WebFetchResult": {
        "type": "object",
        "required": [
          "url",
          "title",
          "content",
          "source",
          "published_at",
          "provider",
          "cn_safe"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "provider": {
            "type": "string",
            "enum": [
              "static",
              "doubao",
              "iqs"
            ]
          },
          "cn_safe": {
            "type": "boolean"
          }
        }
      },
      "LocalizedText": {
        "type": "object",
        "properties": {
          "zh": {
            "type": [
              "string",
              "null"
            ]
          },
          "en": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CnFilteredShell": {
        "type": "object",
        "required": [
          "id",
          "cn_filtered"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "cn_filtered": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "MergedEventPointer": {
        "type": "object",
        "required": [
          "id",
          "merged_into"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "merged_into": {
            "type": "string",
            "description": "合并后的主事件 ID"
          }
        }
      },
      "NotFoundShell": {
        "type": "object",
        "required": [
          "id",
          "not_found"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "not_found": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "HeatItem": {
        "type": "object",
        "required": [
          "id",
          "category",
          "cn_safe",
          "title",
          "summary",
          "rank",
          "score"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "cn_safe": {
            "type": "boolean"
          },
          "title": {
            "$ref": "#/components/schemas/LocalizedText"
          },
          "summary": {
            "$ref": "#/components/schemas/LocalizedText"
          },
          "rank": {
            "type": "integer",
            "minimum": 1
          },
          "score": {
            "type": "number",
            "description": "事件综合热度评分（用于同时间窗内排序）"
          },
          "rank_delta": {
            "type": [
              "integer",
              "null"
            ],
            "description": "较上一快照位次变化（正数上升）"
          },
          "cover_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "representative_sources": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "string"
            }
          },
          "source_count": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "当前展示模式下覆盖该事件的独立信源总数（v1.2 新增，旧快照可能为 null）。"
          },
          "article_count": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "当前展示模式下关联该事件的有效报道总条数（v1.2 新增，旧快照可能为 null）。"
          },
          "latest_report_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "当前展示模式下最新报道发布时间（UTC，v1.2 新增，旧快照可能为 null）。"
          }
        }
      },
      "HeatRankingResponse": {
        "type": "object",
        "required": [
          "window",
          "snapshot_id",
          "cn_safe",
          "items",
          "next_cursor"
        ],
        "properties": {
          "window": {
            "type": "string",
            "enum": [
              "breaking",
              "24h"
            ]
          },
          "snapshot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cn_safe": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HeatItem"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "EventMember": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "$ref": "#/components/schemas/LocalizedText"
          },
          "summary": {
            "$ref": "#/components/schemas/LocalizedText"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "perspective": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "EventDetail": {
        "type": "object",
        "required": [
          "id",
          "category",
          "title",
          "summary",
          "cn_safe",
          "members"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "severity": {
            "type": [
              "number",
              "string",
              "null"
            ]
          },
          "title": {
            "$ref": "#/components/schemas/LocalizedText"
          },
          "summary": {
            "$ref": "#/components/schemas/LocalizedText"
          },
          "body": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LocalizedText"
              },
              {
                "type": "null"
              }
            ],
            "description": "双语完整综合报道正文（v1.3 新增）；仅当 body_status=\"current\" 时返回，待更新或缺失时为 null。"
          },
          "body_status": {
            "type": "string",
            "enum": [
              "current",
              "stale",
              "missing"
            ],
            "description": "正文新鲜度状态（v1.3 新增）：current（与最新证据同步）、stale（新报道待重编，body 为 null）、missing（暂无正文）。"
          },
          "first_published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "latest_report_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cn_safe": {
            "type": "boolean"
          },
          "cover_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventMember"
            }
          }
        }
      },
      "PredictionSubmitRequest": {
        "type": "object",
        "anyOf": [
          {
            "required": [
              "question"
            ]
          },
          {
            "required": [
              "text"
            ]
          }
        ],
        "properties": {
          "question": {
            "type": "string",
            "description": "预测问题正文（推荐字段），须包含明确可判定条件与绝对截止日期。"
          },
          "text": {
            "type": "string",
            "description": "question 的兼容别名字段；两者至少提供一个。"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "private"
            ],
            "default": "public",
            "description": "默认 public 进入公有预测池；private 仅对当前 API Key 所属账号可见。"
          }
        }
      },
      "SimilarQuestion": {
        "type": "object",
        "required": [
          "id",
          "question",
          "similarity"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "question": {
            "type": "string"
          },
          "similarity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        }
      },
      "PredictionAcceptedResponse": {
        "type": "object",
        "required": [
          "prediction_id",
          "status",
          "similar_questions",
          "poll_after_ms"
        ],
        "properties": {
          "prediction_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_initial",
              "active"
            ]
          },
          "similar_questions": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/SimilarQuestion"
            }
          },
          "poll_after_ms": {
            "type": "integer",
            "const": 1000
          }
        }
      },
      "PredictionSummary": {
        "type": "object",
        "required": [
          "id",
          "question",
          "status",
          "visibility",
          "cn_safe",
          "stale"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "question": {
            "type": "string"
          },
          "title": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LocalizedText"
              },
              {
                "type": "null"
              }
            ],
            "description": "异步首判生成的双语短标题（v1.2 新增，历史旧题或未完成首判时可为 null）。"
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_initial",
              "active",
              "resolved",
              "cancelled",
              "invalid"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "private"
            ]
          },
          "cn_safe": {
            "type": "boolean"
          },
          "deadline_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "deadline_granularity": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "date",
              "timestamp",
              "period",
              null
            ]
          },
          "probability": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 1,
            "description": "事件发生概率（0.0–1.0 小数，如 0.55 表示 55%）。"
          },
          "probabilities": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            }
          },
          "latest_delta": {
            "type": [
              "number",
              "null"
            ],
            "minimum": -1,
            "maximum": 1,
            "description": "最近一次有效研判的概率变化量（-1.0 至 1.0 小数，v1.2 新增）。"
          },
          "latest_reason": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LocalizedText"
              },
              {
                "type": "null"
              }
            ],
            "description": "最近一次有效研判的双语摘要（v1.2 新增；安全模式下按所引报道实时校验可见性，不可见时为 null）。"
          },
          "as_of": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolution_outcome": {
            "type": [
              "string",
              "null"
            ]
          },
          "stale": {
            "type": "boolean"
          }
        }
      },
      "EvidenceItem": {
        "type": "object",
        "required": [
          "id"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "description": "原始报道唯一 ID。"
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "description": "信源媒体名称。"
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "原始报道链接。"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "报道发布时间（UTC）。"
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "报道标题（英文/原文）。"
          },
          "title_zh": {
            "type": [
              "string",
              "null"
            ],
            "description": "中文报道标题（v1.3 新增，无中文翻译时为 null）。"
          },
          "summary": {
            "type": [
              "string",
              "null"
            ],
            "description": "报道摘要（英文/原文，v1.3 固化结构）。"
          },
          "summary_zh": {
            "type": [
              "string",
              "null"
            ],
            "description": "中文报道摘要（v1.3 新增，无中文翻译时为 null）。"
          }
        }
      },
      "RecapSource": {
        "type": "object",
        "required": [
          "id"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "description": "原始报道唯一 ID。"
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "description": "信源媒体名称。"
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "原始报道链接。"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "报道发布时间（UTC）。"
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "报道标题（英文/原文）。"
          },
          "title_zh": {
            "type": [
              "string",
              "null"
            ],
            "description": "中文报道标题（v1.3 新增，无中文翻译时为 null）。"
          },
          "summary": {
            "type": [
              "string",
              "null"
            ],
            "description": "报道摘要（英文/原文，v1.3 新增）。"
          },
          "summary_zh": {
            "type": [
              "string",
              "null"
            ],
            "description": "中文报道摘要（v1.3 新增，无中文翻译时为 null）。"
          }
        }
      },
      "ResolutionRecap": {
        "type": "object",
        "required": [
          "judgment_count",
          "sources"
        ],
        "properties": {
          "summary": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LocalizedText"
              },
              {
                "type": "null"
              }
            ],
            "description": "双语结案复盘摘要（安全模式下若任一引用来源不可见则实时置为 null）。"
          },
          "judgment_count": {
            "type": "integer",
            "minimum": 0,
            "description": "该预测累计已发布的有效研判次数。"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecapSource"
            },
            "description": "经当前展示模式实时过滤的结案依据报道列表。"
          }
        }
      },
      "PredictionDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PredictionSummary"
          },
          {
            "type": "object",
            "properties": {
              "contract": {
                "type": "object",
                "additionalProperties": true
              },
              "related_markets": {
                "type": "array",
                "description": "关联预测市场参考报价列表（独立展示对照，不覆盖主预测概率）",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "resolution_recap": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ResolutionRecap"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "已结案预测的复盘摘要与依据来源（v1.2 新增，未结案为 null）。"
              }
            }
          }
        ]
      },
      "PredictionListResponse": {
        "type": "object",
        "required": [
          "snapshot_at",
          "items",
          "next_cursor"
        ],
        "properties": {
          "snapshot_at": {
            "type": "string",
            "format": "date-time"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PredictionSummary"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PredictionSearchResponse": {
        "type": "object",
        "required": [
          "items",
          "mode",
          "degraded"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PredictionSummary"
            }
          },
          "mode": {
            "type": "string",
            "enum": [
              "keyword",
              "semantic"
            ]
          },
          "degraded": {
            "type": "boolean",
            "description": "当请求 mode=semantic 但语义检索超时时自动降级为 keyword 且 degraded=true。"
          }
        }
      },
      "PredictionSnapshotPoint": {
        "type": "object",
        "required": [
          "id",
          "as_of",
          "probability"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "probability": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "该时点概率（0.0–1.0 小数）。"
          },
          "probabilities": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            }
          },
          "delta": {
            "type": [
              "number",
              "null"
            ],
            "minimum": -1,
            "maximum": 1,
            "description": "较上一节点的概率变化量（小数，如 -0.07 表示下降 7 个百分点）。"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason_zh": {
            "type": [
              "string",
              "null"
            ],
            "description": "中文变动原因说明（v1.2 新增，历史旧节点可能为 null）。"
          },
          "evidence": {
            "type": "array",
            "description": "引用的结构化双语新闻证据列表（v1.3 固化 8 字段结构）。",
            "items": {
              "$ref": "#/components/schemas/EvidenceItem"
            }
          }
        }
      },
      "PredictionHistoryResponse": {
        "type": "object",
        "required": [
          "id",
          "items",
          "next_before_id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PredictionSnapshotPoint"
            }
          },
          "next_before_id": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "BriefingItem": {
        "type": "object",
        "required": [
          "event_id",
          "section",
          "headline",
          "what_happened",
          "why_it_matters",
          "evidence_ids"
        ],
        "properties": {
          "event_id": {
            "type": "string"
          },
          "section": {
            "type": "string",
            "enum": [
              "tech",
              "business"
            ]
          },
          "headline": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LocalizedText"
              },
              {
                "type": "string"
              }
            ]
          },
          "what_happened": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LocalizedText"
              },
              {
                "type": "string"
              }
            ]
          },
          "why_it_matters": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LocalizedText"
              },
              {
                "type": "string"
              }
            ]
          },
          "evidence_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 3,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "BriefingSummary": {
        "type": "object",
        "required": [
          "briefing_date",
          "edition",
          "version",
          "status",
          "headline",
          "summary_md",
          "generated_at"
        ],
        "properties": {
          "briefing_date": {
            "type": "string",
            "format": "date"
          },
          "edition": {
            "type": "string",
            "enum": [
              "safe",
              "full"
            ]
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "source_snapshot_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string"
          },
          "headline": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LocalizedText"
              },
              {
                "type": "string"
              }
            ]
          },
          "summary_md": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LocalizedText"
              },
              {
                "type": "string"
              }
            ]
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "superseded_by_version": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "BriefingDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BriefingSummary"
          },
          {
            "type": "object",
            "required": [
              "briefing"
            ],
            "properties": {
              "briefing": {
                "type": "object",
                "required": [
                  "items"
                ],
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/BriefingItem"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "BriefingListResponse": {
        "type": "object",
        "required": [
          "edition",
          "cn_safe",
          "snapshot_at",
          "items",
          "next_cursor"
        ],
        "properties": {
          "edition": {
            "type": "string",
            "enum": [
              "safe",
              "full"
            ]
          },
          "cn_safe": {
            "type": "boolean"
          },
          "snapshot_at": {
            "type": "string",
            "format": "date-time"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BriefingSummary"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "KeyApplicationRequest": {
        "type": "object",
        "required": [
          "email",
          "discovery_channel",
          "use_case"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "minLength": 3,
            "maxLength": 254,
            "description": "申请者联系邮箱，审核通过后用于下发专属 X-API-Key。"
          },
          "discovery_channel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "了解 AttentionHub 的渠道来源。"
          },
          "use_case": {
            "type": "string",
            "minLength": 5,
            "maxLength": 2000,
            "description": "申请原因、使用场景与预计调用量。"
          },
          "website": {
            "type": "string",
            "maxLength": 0,
            "description": "可选防机器人保留字段，正常客户端请省略或传空字符串。"
          }
        }
      },
      "KeyApplicationResponse": {
        "type": "object",
        "required": [
          "application_id",
          "status",
          "created_at"
        ],
        "properties": {
          "application_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApiError": {
        "type": "object",
        "required": [
          "request_id",
          "error"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "retryable",
              "details"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "details": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        }
      },
      "PredictionWriteError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "INVALID_PREDICTION",
                  "INVALID_IDEMPOTENCY_KEY",
                  "IDEMPOTENCY_CONFLICT",
                  "PREDICTION_BUDGET_EXHAUSTED"
                ]
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      }
    }
  }
}
