@@ -111,10 +111,7 @@ export class AutohandAcpAdapter implements Agent {
111111 }
112112
113113 private cloneConfigOptions ( options : SessionConfigOption [ ] ) : SessionConfigOption [ ] {
114- return options . map ( ( opt ) => ( {
115- ...opt ,
116- options : opt . options . map ( ( valueOption ) => ( { ...valueOption } ) ) ,
117- } ) ) ;
114+ return structuredClone ( options ) ;
118115 }
119116
120117 private getSessionConfigOptions ( sessionId : string ) : SessionConfigOption [ ] {
@@ -141,13 +138,13 @@ export class AutohandAcpAdapter implements Agent {
141138 }
142139
143140 return mcpServers . map ( ( server ) : McpServerConfig => {
144- if ( server . type === 'stdio' ) {
141+ if ( 'command' in server ) {
145142 return {
146143 name : server . name ,
147144 transport : 'stdio' ,
148145 command : server . command ,
149146 args : [ ...server . args ] ,
150- env : Object . fromEntries ( server . env . map ( ( variable ) => [ variable . name , variable . value ] ) ) ,
147+ env : Object . fromEntries ( server . env . map ( ( variable : { name : string ; value : string } ) => [ variable . name , variable . value ] ) ) ,
151148 autoConnect : true ,
152149 } ;
153150 }
@@ -156,7 +153,7 @@ export class AutohandAcpAdapter implements Agent {
156153 name : server . name ,
157154 transport : server . type ,
158155 url : server . url ,
159- headers : Object . fromEntries ( server . headers . map ( ( header ) => [ header . name , header . value ] ) ) ,
156+ headers : Object . fromEntries ( server . headers . map ( ( header : { name : string ; value : string } ) => [ header . name , header . value ] ) ) ,
160157 autoConnect : true ,
161158 } ;
162159 } ) ;
@@ -646,7 +643,16 @@ export class AutohandAcpAdapter implements Agent {
646643 throw RequestError . invalidParams ( { message : `Unknown config option: ${ params . configId } ` } ) ;
647644 }
648645
649- const validValues = option . options . map ( ( entry ) => entry . value ) ;
646+ const validValues : string [ ] = [ ] ;
647+ for ( const entry of option . options ) {
648+ if ( 'value' in entry ) {
649+ validValues . push ( entry . value ) ;
650+ } else if ( 'options' in entry ) {
651+ for ( const subEntry of entry . options ) {
652+ validValues . push ( subEntry . value ) ;
653+ }
654+ }
655+ }
650656 if ( ! validValues . includes ( params . value ) ) {
651657 throw RequestError . invalidParams ( {
652658 message : `Invalid value "${ params . value } " for config option "${ params . configId } "` ,
0 commit comments