chore: bump Claude Code identity to 2.1.158 + sync beta flags from HAR captures

- Bump CLAUDE_CLI_VERSION / CLAUDE_CODE_VERSION from 2.1.146 to 2.1.158
  (matches claude-cli 2.1.158 captures)
- Add redact-thinking-2026-02-12 to the always-sent beta tier
  (present in Haiku, Sonnet, and Opus CC 2.1.158 captures)
- Add mid-conversation-system-2026-04-07 for Opus full-agent only
  (present in Opus capture, absent from Sonnet/Haiku)
- Remove afk-mode-2026-01-31 from heavy-agent beta flags
  (not present in any real Claude Code 2.1.158 capture)
- Add mid-conversation-system-2026-04-07 to ANTHROPIC_BETA_BASE
- Update CC-compatible bridge version strings
- Fix STEALTH_GUIDE.md outdated version + Stainless version (0.81.0 → 0.94.0)
- Update claude-beta-flags-2454 tests to match real CC behavior
This commit is contained in:
Tentoxa
2026-05-31 18:13:02 +02:00
committed by diegosouzapw
parent 9f254a6e19
commit 7b6007bc2d
7 changed files with 21 additions and 15 deletions

View File

@@ -682,7 +682,7 @@ GITHUB_OAUTH_CLIENT_ID=Iv1.b507a08c87ecfe98
# Used by: open-sse/executors/base.ts — buildHeaders() dynamic lookup.
# Update these when providers release new CLI versions to avoid blocks.
CLAUDE_USER_AGENT="claude-cli/2.1.146 (external, cli)"
CLAUDE_USER_AGENT="claude-cli/2.1.158 (external, cli)"
# Disable the deterministic tool-name cloak applied on both Anthropic-bound paths
# (executors/base.ts native OAuth + executors/cliproxyapi.ts CLIProxyAPI) —

View File

@@ -88,8 +88,8 @@ Applied to: `system` blocks, all `messages[].content`, and `tools[].description`
For third-party Anthropic relays that only accept "real Claude Code" traffic:
- `CLAUDE_CODE_COMPATIBLE_USER_AGENT = "claude-cli/2.1.146 (external, sdk-cli)"`
- `CLAUDE_CODE_COMPATIBLE_STAINLESS_PACKAGE_VERSION = "0.81.0"`
- `CLAUDE_CODE_COMPATIBLE_USER_AGENT = "claude-cli/2.1.158 (external, sdk-cli)"`
- `CLAUDE_CODE_COMPATIBLE_STAINLESS_PACKAGE_VERSION = "0.94.0"`
- `CLAUDE_CODE_COMPATIBLE_STAINLESS_RUNTIME_VERSION = "v24.3.0"`
- `anthropic-beta = "claude-code-20250219,interleaved-thinking-2025-05-14,effort-2025-11-24"`
- `CONTEXT_1M_BETA_HEADER = "context-1m-2025-08-07"` (Opus/Sonnet 4.x family)
@@ -212,7 +212,7 @@ All MITM endpoints require management auth (`requireCliToolsAuth`). The sudo pas
| Variable | Default |
| ------------------------ | --------------------------------------------- |
| `CLAUDE_USER_AGENT` | `claude-cli/2.1.146 (external, cli)` |
| `CLAUDE_USER_AGENT` | `claude-cli/2.1.158 (external, cli)` |
| `CODEX_USER_AGENT` | `codex-cli/0.132.0 (Windows 10.0.26200; x64)` |
| `GITHUB_USER_AGENT` | `GitHubCopilotChat/0.45.1` |
| `ANTIGRAVITY_USER_AGENT` | `antigravity/2.0.1 darwin/arm64` |

View File

@@ -11,6 +11,7 @@ const ANTHROPIC_BETA_BASE = Object.freeze([
"structured-outputs-2025-12-15",
"fast-mode-2026-02-01",
"redact-thinking-2026-02-12",
"mid-conversation-system-2026-04-07",
"token-efficient-tools-2026-03-28",
"advisor-tool-2026-03-01",
"extended-cache-ttl-2025-04-11",
@@ -29,7 +30,7 @@ export const ANTHROPIC_BETA_CLAUDE_OAUTH = [
...ANTHROPIC_BETA_BASE.slice(3),
].join(",");
export const CLAUDE_CLI_VERSION = "2.1.146";
export const CLAUDE_CLI_VERSION = "2.1.158";
export const CLAUDE_CLI_USER_AGENT = `claude-cli/${CLAUDE_CLI_VERSION} (external, cli)`;
export const CLAUDE_CLI_STAINLESS_PACKAGE_VERSION = "0.94.0";
export const CLAUDE_CLI_STAINLESS_RUNTIME_VERSION = "v24.3.0";

View File

@@ -12,7 +12,7 @@ import { createHash, randomBytes, randomUUID } from "node:crypto";
// ---------- Versions ------------------------------------------------------
export const CLAUDE_CODE_VERSION = "2.1.146";
export const CLAUDE_CODE_VERSION = "2.1.158";
/** Bundled @anthropic-ai/sdk version for the pinned CLI release. */
export const CLAUDE_CODE_STAINLESS_VERSION = "0.94.0";
@@ -342,9 +342,12 @@ export function selectBetaFlags(
const flags: string[] = [];
if (isFullAgent) flags.push("claude-code-20250219");
flags.push("oauth-2025-04-20");
if (isContext1m) flags.push("context-1m-2025-08-07");
if (isContext1m) {
flags.push("context-1m-2025-08-07", "mid-conversation-system-2026-04-07");
}
flags.push(
"interleaved-thinking-2025-05-14",
"redact-thinking-2026-02-12",
"thinking-token-count-2026-05-13",
"context-management-2025-06-27",
"prompt-caching-scope-2026-01-05"
@@ -357,7 +360,7 @@ export function selectBetaFlags(
flags.push("extended-cache-ttl-2025-04-11", "cache-diagnosis-2026-04-07");
}
if (isHeavyAgent) {
flags.push("afk-mode-2026-01-31", "advanced-tool-use-2025-11-20", "effort-2025-11-24");
flags.push("advanced-tool-use-2025-11-20", "effort-2025-11-24");
}
return flags.join(",");
}

View File

@@ -114,7 +114,7 @@ export const CCH_SALT = "59cf53e54c78";
/** Character positions sampled from the first user message text. */
export const CCH_POSITIONS = [4, 7, 20] as const;
/** Default `cc_version=` value embedded in the billing header. */
export const DEFAULT_CLAUDE_CODE_VERSION = "2.1.146";
export const DEFAULT_CLAUDE_CODE_VERSION = "2.1.158";
/** Identity sentinel prepended for Claude Agent SDK callers. */
export const CLAUDE_AGENT_SDK_IDENTITY =
"You are a Claude agent, built on Anthropic's Claude Agent SDK.";

View File

@@ -39,8 +39,8 @@ export const CLAUDE_CODE_COMPATIBLE_ANTHROPIC_BETA = [
"interleaved-thinking-2025-05-14",
"effort-2025-11-24",
].join(",");
export const CLAUDE_CODE_COMPATIBLE_VERSION = "2.1.146";
export const CLAUDE_CODE_COMPATIBLE_USER_AGENT = "claude-cli/2.1.146 (external, sdk-cli)";
export const CLAUDE_CODE_COMPATIBLE_VERSION = "2.1.158";
export const CLAUDE_CODE_COMPATIBLE_USER_AGENT = "claude-cli/2.1.158 (external, sdk-cli)";
export const CLAUDE_CODE_COMPATIBLE_STAINLESS_PACKAGE_VERSION = "0.94.0";
export const CLAUDE_CODE_COMPATIBLE_STAINLESS_RUNTIME_VERSION = "v24.3.0";
export const CONTEXT_1M_BETA_HEADER = "context-1m-2025-08-07";

View File

@@ -20,7 +20,7 @@ function fullAgentBody(model: string) {
test("#2454 Haiku full-agent omits heavy-agent beta flags", () => {
const flags = selectBetaFlags(fullAgentBody("claude-haiku-4-5-20251001"));
assert.ok(!flags.includes("context-1m-2025-08-07"), "Haiku must NOT receive context-1m");
assert.ok(!flags.includes("afk-mode-2026-01-31"), "Haiku must NOT receive afk-mode");
assert.ok(!flags.includes("afk-mode-2026-01-31"), "afk-mode removed — not in any CC capture");
assert.ok(!flags.includes("effort-2025-11-24"), "Haiku must NOT receive effort");
assert.ok(
!flags.includes("advanced-tool-use-2025-11-20"),
@@ -39,13 +39,15 @@ test("#2454 Sonnet full-agent includes heavy-agent flags but omits context-1m",
assert.ok(flags.includes("effort-2025-11-24"));
assert.ok(flags.includes("advanced-tool-use-2025-11-20"));
assert.ok(flags.includes("thinking-token-count-2026-05-13"));
assert.ok(flags.includes("afk-mode-2026-01-31"));
assert.ok(!flags.includes("redact-thinking-2026-02-12"));
assert.ok(flags.includes("redact-thinking-2026-02-12"), "Sonnet sends redact-thinking");
assert.ok(!flags.includes("afk-mode-2026-01-31"), "afk-mode removed — not in any CC capture");
assert.ok(!flags.includes("mid-conversation-system-2026-04-07"), "Sonnet must NOT receive mid-conversation-system");
});
test("#2454 Opus full-agent includes heavy-agent beta flags", () => {
test("#2454 Opus full-agent includes context-1m and mid-conversation-system", () => {
const flags = selectBetaFlags(fullAgentBody("claude-opus-4-7"));
assert.ok(flags.includes("context-1m-2025-08-07"), "Opus should receive context-1m");
assert.ok(flags.includes("mid-conversation-system-2026-04-07"), "Opus should receive mid-conversation-system");
});
test("#2454 explicit model arg overrides body.model for tiering", () => {