mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-04 00:17:45 +08:00
fix(claude-code): 升级伪装的 Claude Code 版本到 2.1.284
上游按模型校验 Claude Code 最低版本,claude-opus-5-5 要求 >= 2.1.280, 而 profile 里写死的 2.1.161 会被拒绝(claude_code_version_too_old, 400), 且 Aether 会统一改写 UA,真实 Claude Code 客户端也会受影响。 将 cli_version 升级为 2.1.284,并同步 stainless 包版本 (0.112.1) 与 node 运行时版本 (v26.3.0),保持指纹一致;相关测试断言同步更新。
This commit is contained in:
@@ -1585,7 +1585,7 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
|
||||
);
|
||||
assert_eq!(
|
||||
seen_execution_runtime_request.user_agent,
|
||||
"claude-cli/2.1.161 (external, cli)"
|
||||
"claude-cli/2.1.284 (external, cli)"
|
||||
);
|
||||
assert_eq!(
|
||||
seen_execution_runtime_request.endpoint_tag,
|
||||
|
||||
@@ -567,11 +567,11 @@ async fn gateway_executes_claude_code_cli_sync_via_local_decision_gate_with_loca
|
||||
assert_eq!(seen_execution_runtime_request.x_stainless_helper_method, "");
|
||||
assert_eq!(
|
||||
seen_execution_runtime_request.x_stainless_package_version,
|
||||
"0.94.0"
|
||||
"0.112.1"
|
||||
);
|
||||
assert_eq!(
|
||||
seen_execution_runtime_request.user_agent,
|
||||
"claude-cli/2.1.161 (external, cli)"
|
||||
"claude-cli/2.1.284 (external, cli)"
|
||||
);
|
||||
assert_eq!(
|
||||
seen_execution_runtime_request.endpoint_tag,
|
||||
|
||||
@@ -117,11 +117,11 @@ mod tests {
|
||||
let map = header_fingerprint_from_fingerprint(&fp).expect("header fingerprint");
|
||||
|
||||
assert_eq!(map["identity_profile_version"], "2026-04");
|
||||
assert_eq!(map["cli_version"], "2.1.161");
|
||||
assert_eq!(map["billing_cli_version"], "2.1.161");
|
||||
assert_eq!(map["stainless_package_version"], "0.94.0");
|
||||
assert_eq!(map["stainless_runtime_version"], "v24.3.0");
|
||||
assert_eq!(map["user_agent"], "claude-cli/2.1.161 (external, cli)");
|
||||
assert_eq!(map["cli_version"], "2.1.284");
|
||||
assert_eq!(map["billing_cli_version"], "2.1.284");
|
||||
assert_eq!(map["stainless_package_version"], "0.112.1");
|
||||
assert_eq!(map["stainless_runtime_version"], "v26.3.0");
|
||||
assert_eq!(map["user_agent"], "claude-cli/2.1.284 (external, cli)");
|
||||
assert_eq!(
|
||||
fp["transport_profile"]["extra"]["claude_code_identity_profile_version"],
|
||||
"2026-04"
|
||||
@@ -144,9 +144,9 @@ mod tests {
|
||||
|
||||
let sanitized = sanitize_fingerprint(&raw, "test-key");
|
||||
let map = header_fingerprint_from_fingerprint(&sanitized).expect("header fingerprint");
|
||||
assert_eq!(map["stainless_package_version"], "0.94.0");
|
||||
assert_eq!(map["stainless_runtime_version"], "v24.3.0");
|
||||
assert_eq!(map["user_agent"], "claude-cli/2.1.161 (external, cli)");
|
||||
assert_eq!(map["stainless_package_version"], "0.112.1");
|
||||
assert_eq!(map["stainless_runtime_version"], "v26.3.0");
|
||||
assert_eq!(map["user_agent"], "claude-cli/2.1.284 (external, cli)");
|
||||
assert_eq!(map["vscode_session_id"], "existing-session");
|
||||
}
|
||||
|
||||
|
||||
@@ -479,7 +479,7 @@ mod tests {
|
||||
let system = body["system"].as_array().unwrap();
|
||||
assert_eq!(system.len(), 3);
|
||||
let billing = system[0]["text"].as_str().unwrap();
|
||||
assert!(billing.starts_with("x-anthropic-billing-header: cc_version=2.1.161."));
|
||||
assert!(billing.starts_with("x-anthropic-billing-header: cc_version=2.1.284."));
|
||||
assert!(billing.ends_with("; cc_entrypoint=cli;"));
|
||||
assert!(system[0].get("cache_control").is_none());
|
||||
assert_eq!(system[1]["text"], CLAUDE_CODE_SYSTEM_PROMPT);
|
||||
@@ -505,22 +505,22 @@ mod tests {
|
||||
fn fingerprint_uses_original_first_user_text_not_migrated_instructions() {
|
||||
let mut body = pi_body();
|
||||
apply_claude_code_body_mimicry(&mut body, CONTEXT);
|
||||
let expected = claude_code_fingerprint("hello world, please help", "2.1.161");
|
||||
let expected = claude_code_fingerprint("hello world, please help", "2.1.284");
|
||||
assert!(body["system"][0]["text"]
|
||||
.as_str()
|
||||
.unwrap()
|
||||
.contains(&format!("cc_version=2.1.161.{expected};")));
|
||||
.contains(&format!("cc_version=2.1.284.{expected};")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fingerprint_is_three_hex_chars_and_pads_short_text_with_zero() {
|
||||
let fp = claude_code_fingerprint("", "2.1.161");
|
||||
let fp = claude_code_fingerprint("", "2.1.284");
|
||||
assert_eq!(fp.len(), 3);
|
||||
assert!(fp.chars().all(|c| c.is_ascii_hexdigit()));
|
||||
assert_eq!(fp, claude_code_fingerprint("abc", "2.1.161"));
|
||||
assert_eq!(fp, claude_code_fingerprint("abc", "2.1.284"));
|
||||
assert_ne!(
|
||||
claude_code_fingerprint("0123456789012345678901234", "2.1.161"),
|
||||
claude_code_fingerprint("", "2.1.161")
|
||||
claude_code_fingerprint("0123456789012345678901234", "2.1.284"),
|
||||
claude_code_fingerprint("", "2.1.284")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,13 +82,13 @@ pub const CLAUDE_CODE_TRANSPORT_IDENTITY_2026_04: ClaudeCodeTransportIdentityPro
|
||||
version: ClaudeCodeTransportIdentityProfileVersion::V2026_04,
|
||||
transport_profile_id: "claude_code_nodejs",
|
||||
anthropic_version: "2023-06-01",
|
||||
cli_version: "2.1.161",
|
||||
cli_version: "2.1.284",
|
||||
stainless_lang: "js",
|
||||
stainless_package_version: "0.94.0",
|
||||
stainless_package_version: "0.112.1",
|
||||
stainless_os: "Linux",
|
||||
stainless_arch: "arm64",
|
||||
stainless_runtime: "node",
|
||||
stainless_runtime_version: "v24.3.0",
|
||||
stainless_runtime_version: "v26.3.0",
|
||||
stainless_retry_count: "0",
|
||||
stainless_timeout: "600",
|
||||
message_required_betas: MESSAGE_BETAS_2026_04,
|
||||
@@ -286,14 +286,14 @@ mod tests {
|
||||
let profile = *current_claude_code_transport_identity_profile();
|
||||
|
||||
assert_eq!(profile.version().as_str(), "2026-04");
|
||||
assert_eq!(profile.cli_version(), "2.1.161");
|
||||
assert_eq!(profile.cli_version(), "2.1.284");
|
||||
assert_eq!(profile.billing_cli_version(), profile.cli_version());
|
||||
assert_eq!(
|
||||
profile.user_agent(),
|
||||
format!("claude-cli/{} (external, cli)", profile.cli_version())
|
||||
);
|
||||
assert_eq!(profile.stainless_package_version(), "0.94.0");
|
||||
assert_eq!(profile.stainless_runtime_version(), "v24.3.0");
|
||||
assert_eq!(profile.stainless_package_version(), "0.112.1");
|
||||
assert_eq!(profile.stainless_runtime_version(), "v26.3.0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -252,11 +252,11 @@ mod tests {
|
||||
assert_eq!(built.get("x-app").map(String::as_str), Some("cli"));
|
||||
assert_eq!(
|
||||
built.get("x-stainless-package-version").map(String::as_str),
|
||||
Some("0.94.0")
|
||||
Some("0.112.1")
|
||||
);
|
||||
assert_eq!(
|
||||
built.get("x-stainless-runtime-version").map(String::as_str),
|
||||
Some("v24.3.0")
|
||||
Some("v26.3.0")
|
||||
);
|
||||
assert_eq!(
|
||||
built.get("x-stainless-timeout").map(String::as_str),
|
||||
@@ -264,7 +264,7 @@ mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
built.get("user-agent").map(String::as_str),
|
||||
Some("claude-cli/2.1.161 (external, cli)")
|
||||
Some("claude-cli/2.1.284 (external, cli)")
|
||||
);
|
||||
assert_eq!(
|
||||
built.get("authorization").map(String::as_str),
|
||||
@@ -367,7 +367,7 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
body["system"][0]["text"],
|
||||
"x-anthropic-billing-header: cc_version=2.1.161.abc; cc_entrypoint=cli;"
|
||||
"x-anthropic-billing-header: cc_version=2.1.284.abc; cc_entrypoint=cli;"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1189,7 +1189,7 @@ mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
build_body(compat_behavior)["system"][0]["text"],
|
||||
"x-anthropic-billing-header: cc_version=2.1.161.abc; cc_entrypoint=cli;"
|
||||
"x-anthropic-billing-header: cc_version=2.1.284.abc; cc_entrypoint=cli;"
|
||||
);
|
||||
|
||||
let mut legacy = sample_transport("claude_code");
|
||||
|
||||
Reference in New Issue
Block a user