From 49a3ec7a722eaccfc511426a866f18c2ca7a34b8 Mon Sep 17 00:00:00 2001 From: Brokenc0de Date: Fri, 26 Jun 2026 11:37:21 +0700 Subject: [PATCH] fix(capabilities): mark Claude Opus 4.7 (dashed id) as 1M context Registry exposes the dashed id claude-opus-4-7; matchPattern treats "." as a literal, so it missed the dotted pattern and fell through to the generic claude opus entry (200k / claude-budget). Add an exact entry so it resolves to 1M context + adaptive thinking, plus a unit test covering the dashed Opus ids. Co-authored-by: Cursor --- open-sse/providers/capabilities.js | 1 + tests/unit/capabilities-opus-context.test.js | 34 ++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/unit/capabilities-opus-context.test.js diff --git a/open-sse/providers/capabilities.js b/open-sse/providers/capabilities.js index bc5a69f3..b8c326c1 100644 --- a/open-sse/providers/capabilities.js +++ b/open-sse/providers/capabilities.js @@ -74,6 +74,7 @@ export const MODEL_CAPABILITIES = { // Claude 4.6/4.7/4.8 have 1M context + adaptive thinking (override generic claude pattern) "claude-opus-4.6": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 }, "claude-opus-4.7": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 }, + "claude-opus-4-7": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 }, "claude-opus-4.8": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 }, "claude-opus-4-6": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 }, "claude-opus-4-8": { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 }, diff --git a/tests/unit/capabilities-opus-context.test.js b/tests/unit/capabilities-opus-context.test.js new file mode 100644 index 00000000..9bb7518f --- /dev/null +++ b/tests/unit/capabilities-opus-context.test.js @@ -0,0 +1,34 @@ +import { describe, expect, it } from "vitest"; + +import { getCapabilitiesForModel } from "../../open-sse/providers/capabilities.js"; + +// Claude Opus 4.6+ ships a 1M-token context window (GA, standard pricing). +// The registry exposes dashed ids (claude-opus-4-8, claude-opus-4-7), which +// must resolve to the 1M context + adaptive thinking caps rather than falling +// through to the generic *claude*opus* pattern (200k / budget thinking). +describe("Claude Opus 1M context capabilities", () => { + const expected = { + contextWindow: 1000000, + maxOutput: 128000, + thinkingFormat: "claude-adaptive", + reasoning: true, + vision: true, + search: true, + }; + + for (const model of [ + "claude-opus-4-8", + "claude-opus-4.8", + "claude-opus-4-7", + "claude-opus-4.7", + "claude-opus-4-6", + ]) { + it(`resolves ${model} to a 1M context window`, () => { + expect(getCapabilitiesForModel("cc", model)).toMatchObject(expected); + }); + } + + it("keeps the older Opus 4.5 at the standard 200k context", () => { + expect(getCapabilitiesForModel("cc", "claude-opus-4-5-20251101").contextWindow).toBe(200000); + }); +});