@@ -1424,8 +1424,9 @@ export function makeClaudeQueryOptions(input: {
14241424 readonly appendSystemPromptFileText ?: string ;
14251425 // Flag settings, because a user's settings.json env beats the process env in Claude Code.
14261426 readonly toolSearchOverride ?: "true" ;
1427+ readonly modelCatalog ?: ClaudeModelCatalog ;
14271428} ) : ClaudeAgentSdkQueryOptions {
1428- const compiledSelection = compileClaudeModelSelection ( input . modelSelection ) ;
1429+ const compiledSelection = compileClaudeModelSelection ( input . modelSelection , input . modelCatalog ) ;
14291430 const {
14301431 "permission-mode" : launchArgPermissionMode ,
14311432 "dangerously-skip-permissions" : launchArgSkipPermissions ,
@@ -4242,7 +4243,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
42424243 const spawner = yield * ChildProcessSpawner . ChildProcessSpawner ;
42434244 const serverSettings = yield * Effect . serviceOption ( ServerSettings . ServerSettingsService ) ;
42444245 const { attachmentsDir, fileSystem, path, crypto, idAllocator, queryRunner } = adapterOptions ;
4245- const subagentModelCatalog = scopeClaudeModelCatalog (
4246+ const scopedModelCatalog = scopeClaudeModelCatalog (
42464247 BUNDLED_CLAUDE_MODEL_CATALOG ,
42474248 adapterOptions . settings . customModels ,
42484249 ) ;
@@ -6081,7 +6082,8 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
60816082 existingSubagent === undefined
60826083 ? ( input . effort ??
60836084 input . owner ?. effort ??
6084- compileClaudeModelSelection ( input . context . input . modelSelection ) . effort )
6085+ compileClaudeModelSelection ( input . context . input . modelSelection , scopedModelCatalog )
6086+ . effort )
60856087 : existingSubagent . effort ;
60866088 const model = input . model ?? priorTask ?. model ?? null ;
60876089 const task = {
@@ -6119,7 +6121,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
61196121 ...( existingSubagent === undefined || existingSubagent . task . modelSelection !== undefined
61206122 ? {
61216123 modelSelection : claudeSubagentModelSelection (
6122- subagentModelCatalog ,
6124+ scopedModelCatalog ,
61236125 input . context . input . modelSelection . instanceId ,
61246126 model || input . context . input . modelSelection . model ,
61256127 effort ,
@@ -8424,7 +8426,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
84248426 const model =
84258427 snapshotModel . length === 0 || snapshotModel === "<synthetic>"
84268428 ? undefined
8427- : canonicalClaudeSubagentModel ( subagentModelCatalog , snapshotModel ) ;
8429+ : canonicalClaudeSubagentModel ( scopedModelCatalog , snapshotModel ) ;
84288430 if ( parentToolUseId !== null && model !== undefined ) {
84298431 const subagent = yield * resolveSubagentByToolUseId ( context , parentToolUseId ) ;
84308432 if ( subagent === undefined ) {
@@ -8708,7 +8710,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
87088710 const nativeToolInput = claudeNativeToolInputFromUnknown ( toolUse . input ) ;
87098711 if ( toolUse . name === "Agent" ) {
87108712 rememberClaudeSubagentLaunch (
8711- subagentModelCatalog ,
8713+ scopedModelCatalog ,
87128714 context ,
87138715 pendingSubagentLaunchesByToolUseId ,
87148716 toolUse . id ,
@@ -9280,7 +9282,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
92809282 const heldForEcho = context . heldRootFrames . length > 0 ;
92819283 if ( toolName === "Agent" ) {
92829284 rememberClaudeSubagentLaunch (
9283- subagentModelCatalog ,
9285+ scopedModelCatalog ,
92849286 context ,
92859287 pendingSubagentLaunchesByToolUseId ,
92869288 nativeRequestId ,
@@ -9631,7 +9633,10 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
96319633 : { allowedTools : queryPolicy . allowedTools } ) ,
96329634 } ) ;
96339635 const queryPolicyKey = claudeEffectiveQueryPolicyKey ( queryPolicy , mcpOverrides ) ;
9634- const compiledSelection = compileClaudeModelSelection ( turnInput . modelSelection ) ;
9636+ const compiledSelection = compileClaudeModelSelection (
9637+ turnInput . modelSelection ,
9638+ scopedModelCatalog ,
9639+ ) ;
96359640 const resumeSessionAt = yield * getNativeConversationHeadId ( turnInput . providerThread ) ;
96369641 const existing = yield * Ref . get ( queryContext ) ;
96379642 // Continuations drain existing output without prompting; retain the live process regardless of selection.
@@ -9759,6 +9764,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
97599764 supportedDialogKinds : [ "resume_return" ] ,
97609765 ...( appendSystemPromptFileText === undefined ? { } : { appendSystemPromptFileText } ) ,
97619766 ...( toolSearchOverride === undefined ? { } : { toolSearchOverride } ) ,
9767+ modelCatalog : scopedModelCatalog ,
97629768 } ) ;
97639769 const querySession = yield * queryRunner
97649770 . open ( {
@@ -9927,7 +9933,8 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
99279933 : yield * makeClaudeUserMessageWithAttachments ( {
99289934 text : applyClaudePromptEffortPrefix (
99299935 turnInput . message . text ,
9930- compileClaudeModelSelection ( turnInput . modelSelection ) . promptEffort ,
9936+ compileClaudeModelSelection ( turnInput . modelSelection , scopedModelCatalog )
9937+ . promptEffort ,
99319938 ) ,
99329939 attachments : turnInput . message . attachments ,
99339940 attachmentsDir,
@@ -10380,7 +10387,8 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
1038010387 const userMessage = yield * makeClaudeUserMessageWithAttachments ( {
1038110388 text : applyClaudePromptEffortPrefix (
1038210389 turnInput . message . text ,
10383- compileClaudeModelSelection ( currentTurn . input . modelSelection ) . promptEffort ,
10390+ compileClaudeModelSelection ( currentTurn . input . modelSelection , scopedModelCatalog )
10391+ . promptEffort ,
1038410392 ) ,
1038510393 attachments : turnInput . message . attachments ,
1038610394 priority : "now" ,
0 commit comments