@@ -42,6 +42,7 @@ import {
4242 resolveFastServiceTier ,
4343} from "./FastModeConfig" ;
4444import packageJson from "../package.json" ;
45+ import { isJetBrains2026_1Client } from "./JBUtils" ;
4546
4647export interface SessionState {
4748 sessionId : string ,
@@ -90,6 +91,7 @@ export class CodexAcpServer implements acp.Agent {
9091 private readonly defaultAuthRequest : CodexAuthRequest | null ;
9192 private readonly getExitCode : ( ) => number | null ;
9293 private readonly availableCommands : CodexCommands ;
94+ private clientInfo : acp . Implementation | null ;
9395
9496 private readonly sessions : Map < string , SessionState > ;
9597 private readonly pendingMcpStartupSessions : Map < string , PendingMcpStartupSession > ;
@@ -116,6 +118,7 @@ export class CodexAcpServer implements acp.Agent {
116118 this . codexAcpClient = codexAcpClient ;
117119 this . defaultAuthRequest = defaultAuthRequest ?? null ;
118120 this . getExitCode = getExitCode ?? ( ( ) => null ) ;
121+ this . clientInfo = null ;
119122 this . availableCommands = new CodexCommands (
120123 connection ,
121124 codexAcpClient ,
@@ -127,6 +130,7 @@ export class CodexAcpServer implements acp.Agent {
127130 _params : acp . InitializeRequest ,
128131 ) : Promise < acp . InitializeResponse > {
129132 logger . log ( "Initialize request received" ) ;
133+ this . clientInfo = _params . clientInfo ?? null ;
130134 await this . runWithProcessCheck ( ( ) => this . codexAcpClient . initialize ( _params ) ) ;
131135 return {
132136 protocolVersion : acp . PROTOCOL_VERSION ,
@@ -382,7 +386,7 @@ export class CodexAcpServer implements acp.Agent {
382386 return {
383387 models : modelState ,
384388 modes : modeState ,
385- configOptions : this . createSessionConfigOptions ( this . getSessionState ( sessionId ) ) ,
389+ ... this . createSessionConfigOptionsResponse ( this . getSessionState ( sessionId ) ) ,
386390 } ;
387391 }
388392
@@ -398,7 +402,7 @@ export class CodexAcpServer implements acp.Agent {
398402 return {
399403 models : modelState ,
400404 modes : modeState ,
401- configOptions : this . createSessionConfigOptions ( this . getSessionState ( sessionId ) ) ,
405+ ... this . createSessionConfigOptionsResponse ( this . getSessionState ( sessionId ) ) ,
402406 } ;
403407 }
404408
@@ -458,7 +462,7 @@ export class CodexAcpServer implements acp.Agent {
458462 sessionId : sessionId ,
459463 models : modelState ,
460464 modes : modeState ,
461- configOptions : this . createSessionConfigOptions ( this . getSessionState ( sessionId ) ) ,
465+ ... this . createSessionConfigOptionsResponse ( this . getSessionState ( sessionId ) ) ,
462466 } ;
463467 }
464468
@@ -516,9 +520,7 @@ export class CodexAcpServer implements acp.Agent {
516520 }
517521
518522 sessionState . fastModeEnabled = params . value === FAST_MODE_ON ;
519- return {
520- configOptions : this . createSessionConfigOptions ( sessionState ) ,
521- } ;
523+ return this . createSessionConfigOptionsResponse ( sessionState ) as acp . SetSessionConfigOptionResponse ;
522524 }
523525
524526 async unstable_setSessionModel ( params : acp . SetSessionModelRequest ) : Promise < acp . SetSessionModelResponse | void > {
@@ -567,6 +569,21 @@ export class CodexAcpServer implements acp.Agent {
567569 ] ;
568570 }
569571
572+ private createSessionConfigOptionsResponse ( sessionState : SessionState ) : {
573+ configOptions ?: Array < acp . SessionConfigOption > ;
574+ } {
575+ if ( ! this . isSessionConfigEnabled ( ) ) {
576+ return { } ;
577+ }
578+ return {
579+ configOptions : this . createSessionConfigOptions ( sessionState ) ,
580+ } ;
581+ }
582+
583+ private isSessionConfigEnabled ( ) : boolean {
584+ return ! isJetBrains2026_1Client ( this . clientInfo ) ;
585+ }
586+
570587 private publishAvailableCommandsAsync ( sessionId : string ) {
571588 void this . availableCommands . publish ( sessionId ) ;
572589 }
0 commit comments