File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -760,6 +760,19 @@ export function startAcpServer(): Promise<void> {
760760 return ;
761761 }
762762
763+ // Re-advertise commands on every prompt — Zed sometimes drops the initial
764+ // `available_commands_update` from session/new because the thread_view
765+ // isn't registered yet on Zed's side (race against the session/new
766+ // response). Re-sending here guarantees `/` autocomplete works by the
767+ // time the user could plausibly type the next prompt.
768+ transport . notify ( 'session/update' , {
769+ sessionId : params . sessionId ,
770+ update : {
771+ sessionUpdate : 'available_commands_update' ,
772+ availableCommands : AVAILABLE_COMMANDS ,
773+ } ,
774+ } ) ;
775+
763776 // Extract text from ContentBlock[]
764777 let prompt = params . prompt
765778 . filter ( ( b ) => b . type === 'text' )
Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ export class StdioTransport {
3434 const trimmed = line . trim ( ) ;
3535 if ( ! trimmed ) continue ;
3636 try {
37+ if ( process . env . CODEEP_ACP_DEBUG ) {
38+ process . stderr . write ( `[ACP←client] ${ trimmed } \n` ) ;
39+ }
3740 const msg = JSON . parse ( trimmed ) as JsonRpcRequest | JsonRpcResponse | JsonRpcNotification ;
3841 // Check if this is a response to one of our outbound requests
3942 if ( 'result' in msg || 'error' in msg ) {
@@ -53,7 +56,11 @@ export class StdioTransport {
5356 }
5457
5558 send ( msg : JsonRpcResponse | JsonRpcNotification ) : void {
56- process . stdout . write ( JSON . stringify ( msg ) + '\n' ) ;
59+ const line = JSON . stringify ( msg ) ;
60+ if ( process . env . CODEEP_ACP_DEBUG ) {
61+ process . stderr . write ( `[ACP→client] ${ line } \n` ) ;
62+ }
63+ process . stdout . write ( line + '\n' ) ;
5764 }
5865
5966 respond ( id : number | string , result : unknown ) : void {
You can’t perform that action at this time.
0 commit comments