@@ -48,25 +48,83 @@ const CLAUDE_PRESENTATION = {
4848 displayName : "Claude" ,
4949 showInteractionModeToggle : true ,
5050} as const ;
51+ const MINIMUM_CLAUDE_OPUS_4_8_VERSION = "2.1.154" ;
5152const MINIMUM_CLAUDE_OPUS_4_7_VERSION = "2.1.111" ;
53+
54+ const CLAUDE_EFFORT_OPTIONS = {
55+ opus48 : [
56+ { value : "low" , label : "Low" } ,
57+ { value : "medium" , label : "Medium" } ,
58+ { value : "high" , label : "High" , isDefault : true } ,
59+ { value : "xhigh" , label : "Extra High" } ,
60+ { value : "max" , label : "Max" } ,
61+ { value : "ultracode" , label : "Ultracode" } ,
62+ { value : "ultrathink" , label : "Ultrathink" } ,
63+ ] ,
64+ opus47 : [
65+ { value : "low" , label : "Low" } ,
66+ { value : "medium" , label : "Medium" } ,
67+ { value : "high" , label : "High" } ,
68+ { value : "xhigh" , label : "Extra High" , isDefault : true } ,
69+ { value : "max" , label : "Max" } ,
70+ { value : "ultrathink" , label : "Ultrathink" } ,
71+ ] ,
72+ opus46 : [
73+ { value : "low" , label : "Low" } ,
74+ { value : "medium" , label : "Medium" } ,
75+ { value : "high" , label : "High" , isDefault : true } ,
76+ { value : "max" , label : "Max" } ,
77+ { value : "ultrathink" , label : "Ultrathink" } ,
78+ ] ,
79+ sonnet46 : [
80+ { value : "low" , label : "Low" } ,
81+ { value : "medium" , label : "Medium" } ,
82+ { value : "high" , label : "High" , isDefault : true } ,
83+ { value : "max" , label : "Max" } ,
84+ { value : "ultrathink" , label : "Ultrathink" } ,
85+ ] ,
86+ opus45 : [
87+ { value : "low" , label : "Low" } ,
88+ { value : "medium" , label : "Medium" } ,
89+ { value : "high" , label : "High" , isDefault : true } ,
90+ { value : "max" , label : "Max" } ,
91+ ] ,
92+ } as const ;
93+
5294const BUILT_IN_MODELS : ReadonlyArray < ServerProviderModel > = [
5395 {
54- slug : "claude-opus-4-7 " ,
55- name : "Claude Opus 4.7 " ,
96+ slug : "claude-opus-4-8 " ,
97+ name : "Claude Opus 4.8 " ,
5698 isCustom : false ,
5799 capabilities : createModelCapabilities ( {
58100 optionDescriptors : [
59101 buildSelectOptionDescriptor ( {
60102 id : "effort" ,
61103 label : "Reasoning" ,
104+ options : CLAUDE_EFFORT_OPTIONS . opus48 ,
105+ promptInjectedValues : [ "ultrathink" ] ,
106+ } ) ,
107+ buildSelectOptionDescriptor ( {
108+ id : "contextWindow" ,
109+ label : "Context Window" ,
62110 options : [
63- { value : "low" , label : "Low" } ,
64- { value : "medium" , label : "Medium" } ,
65- { value : "high" , label : "High" } ,
66- { value : "xhigh" , label : "Extra High" , isDefault : true } ,
67- { value : "max" , label : "Max" } ,
68- { value : "ultrathink" , label : "Ultrathink" } ,
111+ { value : "200k" , label : "200k" , isDefault : true } ,
112+ { value : "1m" , label : "1M" } ,
69113 ] ,
114+ } ) ,
115+ ] ,
116+ } ) ,
117+ } ,
118+ {
119+ slug : "claude-opus-4-7" ,
120+ name : "Claude Opus 4.7" ,
121+ isCustom : false ,
122+ capabilities : createModelCapabilities ( {
123+ optionDescriptors : [
124+ buildSelectOptionDescriptor ( {
125+ id : "effort" ,
126+ label : "Reasoning" ,
127+ options : CLAUDE_EFFORT_OPTIONS . opus47 ,
70128 promptInjectedValues : [ "ultrathink" ] ,
71129 } ) ,
72130 buildSelectOptionDescriptor ( {
@@ -89,13 +147,7 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [
89147 buildSelectOptionDescriptor ( {
90148 id : "effort" ,
91149 label : "Reasoning" ,
92- options : [
93- { value : "low" , label : "Low" } ,
94- { value : "medium" , label : "Medium" } ,
95- { value : "high" , label : "High" , isDefault : true } ,
96- { value : "max" , label : "Max" } ,
97- { value : "ultrathink" , label : "Ultrathink" } ,
98- ] ,
150+ options : CLAUDE_EFFORT_OPTIONS . opus46 ,
99151 promptInjectedValues : [ "ultrathink" ] ,
100152 } ) ,
101153 buildBooleanOptionDescriptor ( {
@@ -122,12 +174,7 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [
122174 buildSelectOptionDescriptor ( {
123175 id : "effort" ,
124176 label : "Reasoning" ,
125- options : [
126- { value : "low" , label : "Low" } ,
127- { value : "medium" , label : "Medium" } ,
128- { value : "high" , label : "High" , isDefault : true } ,
129- { value : "max" , label : "Max" } ,
130- ] ,
177+ options : CLAUDE_EFFORT_OPTIONS . opus45 ,
131178 } ) ,
132179 buildBooleanOptionDescriptor ( {
133180 id : "fastMode" ,
@@ -145,12 +192,7 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [
145192 buildSelectOptionDescriptor ( {
146193 id : "effort" ,
147194 label : "Reasoning" ,
148- options : [
149- { value : "low" , label : "Low" } ,
150- { value : "medium" , label : "Medium" } ,
151- { value : "high" , label : "High" , isDefault : true } ,
152- { value : "ultrathink" , label : "Ultrathink" } ,
153- ] ,
195+ options : CLAUDE_EFFORT_OPTIONS . sonnet46 ,
154196 promptInjectedValues : [ "ultrathink" ] ,
155197 } ) ,
156198 buildSelectOptionDescriptor ( {
@@ -179,17 +221,31 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [
179221 } ,
180222] ;
181223
224+ function supportsClaudeOpus48 ( version : string | null | undefined ) : boolean {
225+ return version ? compareSemverVersions ( version , MINIMUM_CLAUDE_OPUS_4_8_VERSION ) >= 0 : false ;
226+ }
227+
182228function supportsClaudeOpus47 ( version : string | null | undefined ) : boolean {
183229 return version ? compareSemverVersions ( version , MINIMUM_CLAUDE_OPUS_4_7_VERSION ) >= 0 : false ;
184230}
185231
186232function getBuiltInClaudeModelsForVersion (
187233 version : string | null | undefined ,
188234) : ReadonlyArray < ServerProviderModel > {
189- if ( supportsClaudeOpus47 ( version ) ) {
190- return BUILT_IN_MODELS ;
191- }
192- return BUILT_IN_MODELS . filter ( ( model ) => model . slug !== "claude-opus-4-7" ) ;
235+ return BUILT_IN_MODELS . filter ( ( model ) => {
236+ if ( model . slug === "claude-opus-4-8" ) {
237+ return supportsClaudeOpus48 ( version ) ;
238+ }
239+ if ( model . slug === "claude-opus-4-7" ) {
240+ return supportsClaudeOpus47 ( version ) ;
241+ }
242+ return true ;
243+ } ) ;
244+ }
245+
246+ function formatClaudeOpus48UpgradeMessage ( version : string | null ) : string {
247+ const versionLabel = version ? `v${ version } ` : "the installed version" ;
248+ return `Claude Code ${ versionLabel } is too old for Claude Opus 4.8. Upgrade to v${ MINIMUM_CLAUDE_OPUS_4_8_VERSION } or newer to access it.` ;
193249}
194250
195251function formatClaudeOpus47UpgradeMessage ( version : string | null ) : string {
@@ -223,21 +279,34 @@ export function resolveClaudeEffort(
223279 * CLI's `--effort` flag.
224280 *
225281 * Mirrors the mapping used when invoking the Claude Agent SDK
226- * ({@link getEffectiveClaudeAgentEffort} in ClaudeAdapter): the Opus 4.7
227- * capability `"xhigh"` is rewritten to the accepted CLI value `"max" `, and
228- * `"ultrathink"` is filtered out because it is a prompt-prefix mode rather
229- * than a CLI-effort value. Returns `undefined` when no flag should be passed .
282+ * ({@link getEffectiveClaudeAgentEffort} in ClaudeAdapter): `ultracode` is a
283+ * Claude Code setting that pairs with `xhigh `, `ultrathink` is filtered out
284+ * because it is a prompt-prefix mode, and older model compatibility mappings
285+ * are preserved for current Claude Code behavior .
230286 */
231- export function normalizeClaudeCliEffort ( effort : string | null | undefined ) : string | undefined {
287+ export function normalizeClaudeCliEffort (
288+ effort : string | null | undefined ,
289+ model : string | null | undefined ,
290+ ) : string | undefined {
232291 if ( ! effort || effort === "ultrathink" ) {
233292 return undefined ;
234293 }
235- if ( effort === "xhigh" ) {
294+ if ( effort === "ultracode" ) {
295+ return "xhigh" ;
296+ }
297+ if ( effort === "xhigh" && model !== "claude-opus-4-8" ) {
236298 return "max" ;
237299 }
300+ if ( effort === "max" && model === "claude-sonnet-4-6" ) {
301+ return "high" ;
302+ }
238303 return effort ;
239304}
240305
306+ export function isClaudeUltracodeEffort ( effort : string | null | undefined ) : boolean {
307+ return effort === "ultracode" ;
308+ }
309+
241310export function resolveClaudeApiModelId ( modelSelection : ModelSelection ) : string {
242311 switch ( getModelSelectionStringOptionValue ( modelSelection , "contextWindow" ) ) {
243312 case "1m" :
@@ -617,9 +686,11 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
617686 claudeSettings . customModels ,
618687 DEFAULT_CLAUDE_MODEL_CAPABILITIES ,
619688 ) ;
620- const opus47UpgradeMessage = supportsClaudeOpus47 ( parsedVersion )
689+ const versionUpgradeMessage = supportsClaudeOpus48 ( parsedVersion )
621690 ? undefined
622- : formatClaudeOpus47UpgradeMessage ( parsedVersion ) ;
691+ : supportsClaudeOpus47 ( parsedVersion )
692+ ? formatClaudeOpus48UpgradeMessage ( parsedVersion )
693+ : formatClaudeOpus47UpgradeMessage ( parsedVersion ) ;
623694
624695 const capabilities = resolveCapabilities
625696 ? yield * resolveCapabilities ( claudeSettings ) . pipe ( Effect . orElseSucceed ( ( ) => undefined ) )
@@ -663,7 +734,7 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
663734 ...( capabilities . email ? { email : capabilities . email } : { } ) ,
664735 ...( authMetadata ? authMetadata : { } ) ,
665736 } ,
666- ...( opus47UpgradeMessage ? { message : opus47UpgradeMessage } : { } ) ,
737+ ...( versionUpgradeMessage ? { message : versionUpgradeMessage } : { } ) ,
667738 } ,
668739 } ) ;
669740} ) ;
0 commit comments