@@ -1264,8 +1264,9 @@ export function makeClaudeQueryOptions(input: {
12641264 readonly supportedDialogKinds ?: ClaudeQueryOptions [ "supportedDialogKinds" ] ;
12651265 readonly allowDangerouslySkipPermissions ?: boolean ;
12661266 readonly appendSystemPromptFileText ?: string ;
1267+ readonly modelCatalog ?: ClaudeModelCatalog ;
12671268} ) : ClaudeAgentSdkQueryOptions {
1268- const compiledSelection = compileClaudeModelSelection ( input . modelSelection ) ;
1269+ const compiledSelection = compileClaudeModelSelection ( input . modelSelection , input . modelCatalog ) ;
12691270 const {
12701271 "permission-mode" : launchArgPermissionMode ,
12711272 "dangerously-skip-permissions" : launchArgSkipPermissions ,
@@ -3816,7 +3817,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
38163817) {
38173818 const mcpSessions = yield * McpProviderSessions . McpProviderSessions ;
38183819 const { attachmentsDir, fileSystem, path, crypto, idAllocator, queryRunner } = adapterOptions ;
3819- const subagentModelCatalog = scopeClaudeModelCatalog (
3820+ const scopedModelCatalog = scopeClaudeModelCatalog (
38203821 BUNDLED_CLAUDE_MODEL_CATALOG ,
38213822 adapterOptions . settings . customModels ,
38223823 ) ;
@@ -5538,7 +5539,8 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
55385539 existingSubagent === undefined
55395540 ? ( input . effort ??
55405541 input . owner ?. effort ??
5541- compileClaudeModelSelection ( input . context . input . modelSelection ) . effort )
5542+ compileClaudeModelSelection ( input . context . input . modelSelection , scopedModelCatalog )
5543+ . effort )
55425544 : existingSubagent . effort ;
55435545 const model = input . model ?? priorTask ?. model ?? null ;
55445546 const task = {
@@ -5576,7 +5578,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
55765578 ...( existingSubagent === undefined || existingSubagent . task . modelSelection !== undefined
55775579 ? {
55785580 modelSelection : claudeSubagentModelSelection (
5579- subagentModelCatalog ,
5581+ scopedModelCatalog ,
55805582 input . context . input . modelSelection . instanceId ,
55815583 model || input . context . input . modelSelection . model ,
55825584 effort ,
@@ -7865,7 +7867,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
78657867 const model =
78667868 snapshotModel . length === 0 || snapshotModel === "<synthetic>"
78677869 ? undefined
7868- : canonicalClaudeSubagentModel ( subagentModelCatalog , snapshotModel ) ;
7870+ : canonicalClaudeSubagentModel ( scopedModelCatalog , snapshotModel ) ;
78697871 if ( parentToolUseId !== null && model !== undefined ) {
78707872 const subagent = yield * resolveSubagentByToolUseId ( context , parentToolUseId ) ;
78717873 if ( subagent === undefined ) {
@@ -8150,7 +8152,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
81508152 const nativeToolInput = claudeNativeToolInputFromUnknown ( toolUse . input ) ;
81518153 if ( toolUse . name === "Agent" ) {
81528154 rememberClaudeSubagentLaunch (
8153- subagentModelCatalog ,
8155+ scopedModelCatalog ,
81548156 context ,
81558157 pendingSubagentLaunchesByToolUseId ,
81568158 toolUse . id ,
@@ -8708,7 +8710,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
87088710 const heldForEcho = context . heldRootFrames . length > 0 ;
87098711 if ( toolName === "Agent" ) {
87108712 rememberClaudeSubagentLaunch (
8711- subagentModelCatalog ,
8713+ scopedModelCatalog ,
87128714 context ,
87138715 pendingSubagentLaunchesByToolUseId ,
87148716 nativeRequestId ,
@@ -9047,7 +9049,10 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
90479049 : { allowedTools : queryPolicy . allowedTools } ) ,
90489050 } ) ;
90499051 const queryPolicyKey = claudeEffectiveQueryPolicyKey ( queryPolicy , mcpOverrides ) ;
9050- const compiledSelection = compileClaudeModelSelection ( turnInput . modelSelection ) ;
9052+ const compiledSelection = compileClaudeModelSelection (
9053+ turnInput . modelSelection ,
9054+ scopedModelCatalog ,
9055+ ) ;
90519056 const resumeSessionAt = yield * getNativeConversationHeadId ( turnInput . providerThread ) ;
90529057 const existing = yield * Ref . get ( queryContext ) ;
90539058 // A continuation prompts nothing: it drains output the live process
@@ -9172,6 +9177,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
91729177 onUserDialog,
91739178 supportedDialogKinds : [ "resume_return" ] ,
91749179 ...( appendSystemPromptFileText === undefined ? { } : { appendSystemPromptFileText } ) ,
9180+ modelCatalog : scopedModelCatalog ,
91759181 } ) ;
91769182 const querySession = yield * queryRunner
91779183 . open ( {
@@ -9335,7 +9341,8 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
93359341 : yield * makeClaudeUserMessageWithAttachments ( {
93369342 text : applyClaudePromptEffortPrefix (
93379343 turnInput . message . text ,
9338- compileClaudeModelSelection ( turnInput . modelSelection ) . promptEffort ,
9344+ compileClaudeModelSelection ( turnInput . modelSelection , scopedModelCatalog )
9345+ . promptEffort ,
93399346 ) ,
93409347 attachments : turnInput . message . attachments ,
93419348 attachmentsDir,
@@ -9772,7 +9779,8 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
97729779 const userMessage = yield * makeClaudeUserMessageWithAttachments ( {
97739780 text : applyClaudePromptEffortPrefix (
97749781 turnInput . message . text ,
9775- compileClaudeModelSelection ( currentTurn . input . modelSelection ) . promptEffort ,
9782+ compileClaudeModelSelection ( currentTurn . input . modelSelection , scopedModelCatalog )
9783+ . promptEffort ,
97769784 ) ,
97779785 attachments : turnInput . message . attachments ,
97789786 priority : "now" ,
0 commit comments