@@ -673,28 +673,30 @@ export class ClaudeAcpAgent implements Agent {
673673 throw RequestError . authRequired ( ) ;
674674 }
675675
676- // Text /thinking content is streamed via stream_event, so we only process
677- // non-text blocks (tool_use, etc.) here to avoid duplication.
676+ // When using the gateway service, text /thinking is streamed via stream_event,
677+ // so skip them here to avoid duplication.
678678 const content = message . message . content ;
679- const contentToProcess = Array . isArray ( content )
680- ? content . filter (
681- ( block ) => block . type !== "text" && block . type !== "thinking" ,
682- )
683- : [ ] ;
684-
685- if ( contentToProcess . length > 0 ) {
686- for ( const notification of toAcpNotifications (
687- contentToProcess ,
688- message . message . role ,
689- params . sessionId ,
690- this . toolUseCache ,
691- this . fileContentCache ,
692- this . client ,
693- this . logger ,
694- ) ) {
695- await this . client . sessionUpdate ( notification ) ;
696- this . appendNotification ( params . sessionId , notification ) ;
697- }
679+ const isUsingGatewayService = ! ! (
680+ process . env . LLM_GATEWAY_URL
681+ ) ;
682+ const contentToProcess =
683+ isUsingGatewayService && Array . isArray ( content )
684+ ? content . filter (
685+ ( block ) => block . type !== "text" && block . type !== "thinking" ,
686+ )
687+ : content ;
688+
689+ for ( const notification of toAcpNotifications (
690+ contentToProcess ,
691+ message . message . role ,
692+ params . sessionId ,
693+ this . toolUseCache ,
694+ this . fileContentCache ,
695+ this . client ,
696+ this . logger ,
697+ ) ) {
698+ await this . client . sessionUpdate ( notification ) ;
699+ this . appendNotification ( params . sessionId , notification ) ;
698700 }
699701 break ;
700702 }
0 commit comments