Claude Code 2.1.307 更新:新增 API 版本命令与安全事件遥测
原标题:2.1.307
AI 摘要
Claude Code 发布 2.1.307 版本更新,新增 `/claude-api api-version` 命令以将 Claude API 代码迁移至 2026-10-21 版本,并新增 `claude_code.safety_event` OpenTelemetry 事件用于记录工具调用被权限规则、安全检查、钩子或沙箱拦截的情况。该版本还修复了大量问题,涉及 MCP 服务器认证与超时、HTTP 工具重复调用、自动压缩、云会话恢复、遥测、子代理记录及自托管 runner 等,并改进了工具调用重试、浏览器登录和 Web 搜索错误提示。
正文节选
- Added `/claude-api api-version` to move Claude API code to API version `2026-10-21` - Added the `claude_code.safety_event` OpenTelemetry event for each tool call a permission rule, auto mode, a safety check, a hook or the sandbox stopped, prompted or sent back - Fixed requests failing with a model-not-found error when `CLAUDE_CODE_DISABLE_1M_CONTEXT` is set and the model is an alias with the `[1m]` suffix, such as `opus[1m]` - Fixed the `prompt-caching-scope` beta header being sent behind cust