diff --git a/.env.example b/.env.example index fa9f1ef541..aba2be8c17 100644 --- a/.env.example +++ b/.env.example @@ -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) — diff --git a/docs/security/STEALTH_GUIDE.md b/docs/security/STEALTH_GUIDE.md index c280d33bc4..d342e6a3ac 100644 --- a/docs/security/STEALTH_GUIDE.md +++ b/docs/security/STEALTH_GUIDE.md @@ -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` | diff --git a/open-sse/config/anthropicHeaders.ts b/open-sse/config/anthropicHeaders.ts index 5f708a5a80..682e0f971f 100644 --- a/open-sse/config/anthropicHeaders.ts +++ b/open-sse/config/anthropicHeaders.ts @@ -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"; diff --git a/open-sse/executors/claudeIdentity.ts b/open-sse/executors/claudeIdentity.ts index ef78832a90..dc3140b1b7 100644 --- a/open-sse/executors/claudeIdentity.ts +++ b/open-sse/executors/claudeIdentity.ts @@ -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(","); } diff --git a/open-sse/services/ccBridgeTransforms.ts b/open-sse/services/ccBridgeTransforms.ts index 83c5138703..eb9a5f79a5 100644 --- a/open-sse/services/ccBridgeTransforms.ts +++ b/open-sse/services/ccBridgeTransforms.ts @@ -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."; diff --git a/open-sse/services/claudeCodeCompatible.ts b/open-sse/services/claudeCodeCompatible.ts index c7c6800687..98e66475ac 100644 --- a/open-sse/services/claudeCodeCompatible.ts +++ b/open-sse/services/claudeCodeCompatible.ts @@ -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"; diff --git a/tests/unit/claude-beta-flags-2454.test.ts b/tests/unit/claude-beta-flags-2454.test.ts index 318f2881c9..d38f194af6 100644 --- a/tests/unit/claude-beta-flags-2454.test.ts +++ b/tests/unit/claude-beta-flags-2454.test.ts @@ -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", () => {