opencode-anthropic-fix 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -7408,6 +7408,12 @@ function buildAnthropicBetaHeader(
7408
7408
  betas.push("context-hint-2026-04-09");
7409
7409
  }
7410
7410
 
7411
+ // extended-cache-ttl-2025-04-11 — found in CC v2.1.133. Extends server-side
7412
+ // prompt cache TTL. Auto-on for 1P + Claude 4+ to improve cache hit rates.
7413
+ if (isFirstPartyProvider && !/claude-3-/i.test(model)) {
7414
+ betas.push("extended-cache-ttl-2025-04-11");
7415
+ }
7416
+
7411
7417
  // Files API — scoped to file endpoints/references
7412
7418
  if (isFilesEndpoint || hasFileReferences) {
7413
7419
  betas.push("files-api-2025-04-14");
@@ -7798,6 +7804,18 @@ function transformRequestBody(body, signature, runtime, betaHeader, config) {
7798
7804
  delete parsed.effort;
7799
7805
  }
7800
7806
 
7807
+ // Claude Code v2.1.117+: default effort for Pro/Max on adaptive models is
7808
+ // "high" (was "medium"). If the host omits effort entirely, inject the
7809
+ // default so the wire shape matches real CC.
7810
+ if (parsed.model && isAdaptiveThinkingModel(parsed.model)) {
7811
+ if (!parsed.output_config || typeof parsed.output_config !== "object") {
7812
+ parsed.output_config = {};
7813
+ }
7814
+ if (!("effort" in parsed.output_config)) {
7815
+ parsed.output_config.effort = "high";
7816
+ }
7817
+ }
7818
+
7801
7819
  // Claude Code temperature rule: when extended thinking is active (any type),
7802
7820
  // temperature must be omitted (undefined). Otherwise default to 1.
7803
7821
  const thinkingActive =
@@ -16,20 +16,34 @@
16
16
  // Version / build / SDK constants
17
17
  // ---------------------------------------------------------------------------
18
18
 
19
- export const FALLBACK_CLAUDE_CLI_VERSION = "2.1.119";
19
+ export const FALLBACK_CLAUDE_CLI_VERSION = "2.1.133";
20
20
  export const CLAUDE_CODE_NPM_LATEST_URL = "https://registry.npmjs.org/@anthropic-ai/claude-code/latest";
21
- export const CLAUDE_CODE_BUILD_TIME = "2026-04-23T19:08:52Z";
21
+ export const CLAUDE_CODE_BUILD_TIME = "2026-05-07T18:26:46Z";
22
22
 
23
23
  // The @anthropic-ai/sdk version bundled with Claude Code.
24
24
  // This is distinct from the CLI version and goes in X-Stainless-Package-Version.
25
25
  // v2.1.107 switched from @anthropic-ai/sdk v0.208.0 to v0.81.0 (confirmed via bundle var x$H="0.81.0").
26
- // Still 0.81.0 in v2.1.119 (verified via strings extraction from native Bun binary;
27
- // adds cache-diagnosis-2026-04-07 beta gated by GrowthBook tengu_prompt_cache_diagnostics;
28
- // no other beta additions/removals vs 2.1.117; OAuth flow unchanged).
26
+ // Still 0.81.0 in v2.1.133 (verified via changelog; 2.1.120-2.1.133 are OAuth/MCP/Bedrock
27
+ // fixes with no SDK version bump; cache-diagnosis-2026-04-07 added in 2.1.119 behind
28
+ // GrowthBook tengu_prompt_cache_diagnostics; default effort changed to "high" in 2.1.117).
29
29
  export const ANTHROPIC_SDK_VERSION = "0.81.0";
30
30
 
31
31
  // Map of CLI version to bundled SDK version (update when CLI version changes)
32
32
  export const CLI_TO_SDK_VERSION = new Map([
33
+ ["2.1.133", "0.81.0"],
34
+ ["2.1.132", "0.81.0"],
35
+ ["2.1.131", "0.81.0"],
36
+ ["2.1.130", "0.81.0"],
37
+ ["2.1.129", "0.81.0"],
38
+ ["2.1.128", "0.81.0"],
39
+ ["2.1.127", "0.81.0"],
40
+ ["2.1.126", "0.81.0"],
41
+ ["2.1.125", "0.81.0"],
42
+ ["2.1.124", "0.81.0"],
43
+ ["2.1.123", "0.81.0"],
44
+ ["2.1.122", "0.81.0"],
45
+ ["2.1.121", "0.81.0"],
46
+ ["2.1.120", "0.81.0"],
33
47
  ["2.1.119", "0.81.0"],
34
48
  ["2.1.117", "0.81.0"],
35
49
  ["2.1.116", "0.81.0"],
@@ -93,6 +107,8 @@ export const EXPERIMENTAL_BETA_FLAGS = new Set([
93
107
  "context-1m-2025-08-07",
94
108
  "context-hint-2026-04-09",
95
109
  "context-management-2025-06-27",
110
+ "environments-2025-11-01",
111
+ "extended-cache-ttl-2025-04-11",
96
112
  "fast-mode-2026-02-01",
97
113
  "files-api-2025-04-14",
98
114
  "interleaved-thinking-2025-05-14",
@@ -111,7 +127,10 @@ export const BETA_SHORTCUTS = new Map([
111
127
  ["context-1m", "context-1m-2025-08-07"],
112
128
  ["cache-diagnosis", "cache-diagnosis-2026-04-07"],
113
129
  ["cache-diag", "cache-diagnosis-2026-04-07"],
130
+ ["cache-ttl", "extended-cache-ttl-2025-04-11"],
114
131
  ["context-hint", "context-hint-2026-04-09"],
132
+ ["environments", "environments-2025-11-01"],
133
+ ["extended-cache-ttl", "extended-cache-ttl-2025-04-11"],
115
134
  ["hint", "context-hint-2026-04-09"],
116
135
  ["fast", "fast-mode-2026-02-01"],
117
136
  ["fast-mode", "fast-mode-2026-02-01"],
@@ -13,8 +13,8 @@ import {
13
13
  } from "./request-headers.mjs";
14
14
 
15
15
  describe("request-headers constants", () => {
16
- it("FALLBACK_CLAUDE_CLI_VERSION is 2.1.119", () => {
17
- expect(FALLBACK_CLAUDE_CLI_VERSION).toBe("2.1.119");
16
+ it("FALLBACK_CLAUDE_CLI_VERSION is 2.1.133", () => {
17
+ expect(FALLBACK_CLAUDE_CLI_VERSION).toBe("2.1.133");
18
18
  });
19
19
 
20
20
  it("ANTHROPIC_SDK_VERSION matches expected value", () => {
@@ -24,9 +24,9 @@ describe("request-headers constants", () => {
24
24
  });
25
25
 
26
26
  describe("getSdkVersion", () => {
27
- it("returns known SDK version for CLI version 2.1.119", () => {
28
- // 2.1.119 is in the VERSION_TO_SDK_MAP
29
- const v = getSdkVersion("2.1.119");
27
+ it("returns known SDK version for CLI version 2.1.133", () => {
28
+ // 2.1.133 is in the VERSION_TO_SDK_MAP
29
+ const v = getSdkVersion("2.1.133");
30
30
  expect(typeof v).toBe("string");
31
31
  expect(v).toMatch(/^\d+\.\d+\.\d+$/);
32
32
  });
@@ -95,26 +95,26 @@ describe("buildExtendedUserAgent", () => {
95
95
  delete process.env.CLAUDE_CODE_ENTRYPOINT;
96
96
  delete process.env.CLAUDE_AGENT_SDK_VERSION;
97
97
  delete process.env.CLAUDE_AGENT_SDK_CLIENT_APP;
98
- const ua = buildExtendedUserAgent("2.1.119");
99
- expect(ua).toBe("claude-cli/2.1.119 (external, cli)");
98
+ const ua = buildExtendedUserAgent("2.1.133");
99
+ expect(ua).toBe("claude-cli/2.1.133 (external, cli)");
100
100
  });
101
101
 
102
102
  it("uses CLAUDE_CODE_ENTRYPOINT when set", () => {
103
103
  process.env.CLAUDE_CODE_ENTRYPOINT = "vscode";
104
- const ua = buildExtendedUserAgent("2.1.119");
105
- expect(ua).toBe("claude-cli/2.1.119 (external, vscode)");
104
+ const ua = buildExtendedUserAgent("2.1.133");
105
+ expect(ua).toBe("claude-cli/2.1.133 (external, vscode)");
106
106
  });
107
107
 
108
108
  it("appends agent-sdk suffix when CLAUDE_AGENT_SDK_VERSION is set", () => {
109
109
  process.env.CLAUDE_AGENT_SDK_VERSION = "1.2.3";
110
- const ua = buildExtendedUserAgent("2.1.119");
110
+ const ua = buildExtendedUserAgent("2.1.133");
111
111
  expect(ua).toContain("agent-sdk/1.2.3");
112
- expect(ua).toMatch(/^claude-cli\/2\.1\.119/);
112
+ expect(ua).toMatch(/^claude-cli\/2\.1\.133/);
113
113
  });
114
114
 
115
115
  it("appends client-app suffix when CLAUDE_AGENT_SDK_CLIENT_APP is set", () => {
116
116
  process.env.CLAUDE_AGENT_SDK_CLIENT_APP = "myapp";
117
- const ua = buildExtendedUserAgent("2.1.119");
117
+ const ua = buildExtendedUserAgent("2.1.133");
118
118
  expect(ua).toContain("client-app/myapp");
119
119
  });
120
120
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-anthropic-fix",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "repository": {
6
6
  "type": "git",