- [Align with Claude Code 2.1.301 Protocol Specification, Full-Link Traceability & Claude 5 Models] (PR #3689, Ref #3684, Ref #3686, Thanks to @cubelikeplayDaniel):
- Anti-WAF Identity Sanitization & Agent SDK CLI Preamble Alignment: Addressed third-party preamble changes introduced in
@anthropic-ai/claude-code@2.1.301(You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK.). ExtendedRE_WAF_TRIGGER_HEADERSand prompt normalization inprompt_sanitizer.rsto strip Agent SDK CLI preambles and clean new telemetry headers (cc_workload,cc_is_subagent,cc_prev_req,cc_prompt_id,cc_turn_origin), preventing Google Cloud Code WAF from triggering spurious 429 rate limit errors. (PR #3689, Ref #3684, Thanks to @cubelikeplayDaniel) - Full-Link Downstream Traceability (request-id): Unified injection of
request-id: req_{trace_id}across streaming (SSE), streaming aggregation JSON, and non-streaming JSON responses inhandlers/claude.rs. Correlates with client-sidex-gateway-upstream-request-idheaders, allowing seamless session tracing and error audit during client retries. (PR #3689, Thanks to @cubelikeplayDaniel) - Claude Protocol Schema Alignment & Adaptive Thinking Display: Added
ThinkingConfig.display("omitted"|"summarized"|"highlights") to support display control attributes under adaptive reasoning mode; addedUsage.cache_creationto cleanly receive and relay cache creation token distribution metrics, eliminating deserialization omissions or errors. (PR #3689, Thanks to @cubelikeplayDaniel) - Claude 5 Model Family Registration & CLI Sync: Registered 8 core Claude 5 model definitions (
claude-fable-5,claude-opus-5-5,claude-sonnet-5-5,claude-haiku-5-5and their thinking variants with 256k context) incli_sync.rs(get_core_gateway_models()), enabling full discovery and dynamic synchronization for Antigravity CLI (agy) and JeikCode configuration files. (PR #3689, Ref #3686, Thanks to @cubelikeplayDaniel)
- Anti-WAF Identity Sanitization & Agent SDK CLI Preamble Alignment: Addressed third-party preamble changes introduced in
- [对齐 Claude Code 2.1.301 协议规范、全链路请求追溯与 Claude 5 模型族] (PR #3689, Ref #3684, Ref #3686, Thanks to @cubelikeplayDaniel):
- 防 WAF 身份清洗扩展与 Agent SDK CLI 深度对齐: 针对
@anthropic-ai/claude-code@2.1.301引入的第三种复合身份提示词(Agent SDK CLI 运行时开场白:You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK.),在prompt_sanitizer.rs中全面扩展RE_WAF_TRIGGER_HEADERS与身份归一化清洗规则;全面识别并清洗cc_workload、cc_is_subagent、cc_prev_req、cc_prompt_id、cc_turn_origin等 2.1.301 扩展归属元数据请求头,坚决杜绝因上游 Google Cloud Code WAF 识别非白名单特征触发 429 限流风控。(PR #3689, Ref #3684, Thanks to @cubelikeplayDaniel) - 全链路下行追踪对齐 (request-id): 在 Claude 协议处理器(
handlers/claude.rs)的流式 (SSE)、流聚合 JSON 与非流式 JSON 三大响应分支中,统一对齐注入request-id: req_{trace_id}响应头,与客户端x-gateway-upstream-request-id严格对应,确保客户端在网络重试与会话归档时可无缝回溯全链路会话日志。(PR #3689, Thanks to @cubelikeplayDaniel) - Claude 协议规范补全与自适应思考展示控制: 在 Claude 模型定义中补充
ThinkingConfig.display(支持"omitted"/"summarized"/"highlights")以适配自适应思考模式下的展示控制属性;在Usage中补充cache_creation结构,无缝接收与传递下行缓存创建 Token 分布,杜绝反序列化丢项或报错。(PR #3689, Thanks to @cubelikeplayDaniel) - Claude 5 模型族录入与 CLI 动态同步: 在
cli_sync.rs的网关核心模型列表(get_core_gateway_models())中全面录入 Claude 5 系列 8 个核心模型(claude-fable-5、claude-opus-5-5、claude-sonnet-5-5、claude-haiku-5-5及其思考变体),上调上下文规格至 256k,确保 Antigravity CLI (agy) 与 JeikCode 配置文件能够完整识别并动态同步新模型。(PR #3689, Ref #3686, Thanks to @cubelikeplayDaniel)
- 防 WAF 身份清洗扩展与 Agent SDK CLI 深度对齐: 针对
What's Changed
- feat(claude): 对齐 Claude Code 2.1.301 协议规范、全链路请求追溯与 Claude 5 模型族 (Ref #3684, Ref #3686) by @cubelikeplayDaniel in #3689
Full Changelog: v4.9.8-beta.7...v4.9.8-beta.8