feat(server): add Opus 4.7 to claude provider with xhigh effort
Adds claude-opus-4-7 and claude-opus-4-7[1m] alongside the existing 4.6 entries (4.6 stays default). Opus 4.7 introduces a new "xhigh" effort level between high and max; the option only surfaces on 4.7 models. The SDK 0.2.71 effort union doesn't yet include xhigh, so the value is cast at the assignment site.
This commit is contained in:
@@ -31,6 +31,16 @@ type ProviderModel = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const EXPECTED_CLAUDE_MODELS = [
|
const EXPECTED_CLAUDE_MODELS = [
|
||||||
|
{
|
||||||
|
id: "claude-opus-4-7[1m]",
|
||||||
|
model: "Opus 4.7 1M",
|
||||||
|
descriptionFragment: "1M context window",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "claude-opus-4-7",
|
||||||
|
model: "Opus 4.7",
|
||||||
|
descriptionFragment: "Latest release",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "claude-opus-4-6[1m]",
|
id: "claude-opus-4-6[1m]",
|
||||||
model: "Opus 4.6 1M",
|
model: "Opus 4.6 1M",
|
||||||
|
|||||||
@@ -340,6 +340,8 @@ describe("ClaudeAgentClient.listModels", () => {
|
|||||||
const models = await client.listModels();
|
const models = await client.listModels();
|
||||||
|
|
||||||
expect(models.map((m) => m.id)).toEqual([
|
expect(models.map((m) => m.id)).toEqual([
|
||||||
|
"claude-opus-4-7[1m]",
|
||||||
|
"claude-opus-4-7",
|
||||||
"claude-opus-4-6[1m]",
|
"claude-opus-4-6[1m]",
|
||||||
"claude-opus-4-6",
|
"claude-opus-4-6",
|
||||||
"claude-sonnet-4-6",
|
"claude-sonnet-4-6",
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ type ClaudeAgentSessionOptions = {
|
|||||||
queryFactory?: typeof query;
|
queryFactory?: typeof query;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ClaudeThinkingEffort = "low" | "medium" | "high" | "max";
|
type ClaudeThinkingEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
||||||
|
|
||||||
function resolveClaudeSpawnCommand(
|
function resolveClaudeSpawnCommand(
|
||||||
spawnOptions: SpawnOptions,
|
spawnOptions: SpawnOptions,
|
||||||
@@ -238,7 +238,13 @@ function applyRuntimeSettingsToClaudeOptions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isClaudeThinkingEffort(value: string | null | undefined): value is ClaudeThinkingEffort {
|
function isClaudeThinkingEffort(value: string | null | undefined): value is ClaudeThinkingEffort {
|
||||||
return value === "low" || value === "medium" || value === "high" || value === "max";
|
return (
|
||||||
|
value === "low" ||
|
||||||
|
value === "medium" ||
|
||||||
|
value === "high" ||
|
||||||
|
value === "xhigh" ||
|
||||||
|
value === "max"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sanitizeClaudeProjectPath(cwd: string): string {
|
function sanitizeClaudeProjectPath(cwd: string): string {
|
||||||
@@ -2114,7 +2120,9 @@ class ClaudeAgentSession implements AgentSession {
|
|||||||
let effort: ClaudeOptions["effort"];
|
let effort: ClaudeOptions["effort"];
|
||||||
if (thinkingOptionId && isClaudeThinkingEffort(thinkingOptionId)) {
|
if (thinkingOptionId && isClaudeThinkingEffort(thinkingOptionId)) {
|
||||||
thinking = { type: "adaptive" };
|
thinking = { type: "adaptive" };
|
||||||
effort = thinkingOptionId;
|
// SDK 0.2.71 types `effort` as 'low' | 'medium' | 'high' | 'max'; Opus 4.7
|
||||||
|
// adds 'xhigh' which the binary accepts but the typings don't yet expose.
|
||||||
|
effort = thinkingOptionId as ClaudeOptions["effort"];
|
||||||
}
|
}
|
||||||
|
|
||||||
const appendedSystemPrompt = [
|
const appendedSystemPrompt = [
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ describe("getClaudeModels", () => {
|
|||||||
it("returns all claude models", () => {
|
it("returns all claude models", () => {
|
||||||
const models = getClaudeModels();
|
const models = getClaudeModels();
|
||||||
expect(models.map((m) => m.id)).toEqual([
|
expect(models.map((m) => m.id)).toEqual([
|
||||||
|
"claude-opus-4-7[1m]",
|
||||||
|
"claude-opus-4-7",
|
||||||
"claude-opus-4-6[1m]",
|
"claude-opus-4-6[1m]",
|
||||||
"claude-opus-4-6",
|
"claude-opus-4-6",
|
||||||
"claude-sonnet-4-6",
|
"claude-sonnet-4-6",
|
||||||
|
|||||||
@@ -7,7 +7,29 @@ const CLAUDE_THINKING_OPTIONS = [
|
|||||||
{ id: "max", label: "Max" },
|
{ id: "max", label: "Max" },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
|
const CLAUDE_OPUS_4_7_THINKING_OPTIONS = [
|
||||||
|
{ id: "low", label: "Low" },
|
||||||
|
{ id: "medium", label: "Medium" },
|
||||||
|
{ id: "high", label: "High" },
|
||||||
|
{ id: "xhigh", label: "Extra High" },
|
||||||
|
{ id: "max", label: "Max" },
|
||||||
|
] as const;
|
||||||
|
|
||||||
const CLAUDE_MODELS: AgentModelDefinition[] = [
|
const CLAUDE_MODELS: AgentModelDefinition[] = [
|
||||||
|
{
|
||||||
|
provider: "claude",
|
||||||
|
id: "claude-opus-4-7[1m]",
|
||||||
|
label: "Opus 4.7 1M",
|
||||||
|
description: "Opus 4.7 with 1M context window",
|
||||||
|
thinkingOptions: [...CLAUDE_OPUS_4_7_THINKING_OPTIONS],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider: "claude",
|
||||||
|
id: "claude-opus-4-7",
|
||||||
|
label: "Opus 4.7",
|
||||||
|
description: "Opus 4.7 · Latest release",
|
||||||
|
thinkingOptions: [...CLAUDE_OPUS_4_7_THINKING_OPTIONS],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
provider: "claude",
|
provider: "claude",
|
||||||
id: "claude-opus-4-6[1m]",
|
id: "claude-opus-4-6[1m]",
|
||||||
|
|||||||
Reference in New Issue
Block a user