@@ -9,7 +9,7 @@ use anyhow::Result;
99use schemars:: JsonSchema ;
1010use serde:: { Deserialize , Serialize } ;
1111
12- use crate :: { ContentBlock , EnvVariable , Error , Plan , SessionId , ToolCall , ToolCallUpdate } ;
12+ use crate :: { ContentBlock , Error , Plan , SessionId , ToolCall , ToolCallUpdate } ;
1313
1414/// Defines the interface that ACP-compliant clients must implement.
1515///
@@ -76,6 +76,7 @@ pub trait Client {
7676 ///
7777 /// This method is not part of the spec, and may be removed or changed at any point.
7878 #[ doc( hidden) ]
79+ #[ cfg( feature = "unstable" ) ]
7980 fn create_terminal (
8081 & self ,
8182 args : CreateTerminalRequest ,
@@ -85,6 +86,7 @@ pub trait Client {
8586 ///
8687 /// This method is not part of the spec, and may be removed or changed at any point.
8788 #[ doc( hidden) ]
89+ #[ cfg( feature = "unstable" ) ]
8890 fn terminal_output (
8991 & self ,
9092 args : TerminalOutputRequest ,
@@ -94,6 +96,7 @@ pub trait Client {
9496 ///
9597 /// This method is not part of the spec, and may be removed or changed at any point.
9698 #[ doc( hidden) ]
99+ #[ cfg( feature = "unstable" ) ]
97100 fn release_terminal (
98101 & self ,
99102 args : ReleaseTerminalRequest ,
@@ -103,6 +106,7 @@ pub trait Client {
103106 ///
104107 /// This method is not part of the spec, and may be removed or changed at any point.
105108 #[ doc( hidden) ]
109+ #[ cfg( feature = "unstable" ) ]
106110 fn wait_for_terminal_exit (
107111 & self ,
108112 args : WaitForTerminalExitRequest ,
@@ -286,8 +290,10 @@ pub struct ReadTextFileResponse {
286290
287291#[ derive( Debug , Clone , Serialize , Deserialize , JsonSchema , PartialEq , Eq , Hash ) ]
288292#[ serde( transparent) ]
293+ #[ cfg( feature = "unstable" ) ]
289294pub struct TerminalId ( pub Arc < str > ) ;
290295
296+ #[ cfg( feature = "unstable" ) ]
291297impl std:: fmt:: Display for TerminalId {
292298 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
293299 write ! ( f, "{}" , self . 0 )
@@ -297,13 +303,14 @@ impl std::fmt::Display for TerminalId {
297303#[ derive( Debug , Clone , Serialize , Deserialize , JsonSchema ) ]
298304#[ schemars( extend( "x-docs-ignore" = true ) ) ]
299305#[ serde( rename_all = "camelCase" ) ]
306+ #[ cfg( feature = "unstable" ) ]
300307pub struct CreateTerminalRequest {
301308 pub session_id : SessionId ,
302309 pub command : String ,
303310 #[ serde( default , skip_serializing_if = "Vec::is_empty" ) ]
304311 pub args : Vec < String > ,
305312 #[ serde( default , skip_serializing_if = "Vec::is_empty" ) ]
306- pub env : Vec < EnvVariable > ,
313+ pub env : Vec < crate :: EnvVariable > ,
307314 #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
308315 pub cwd : Option < PathBuf > ,
309316 #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
@@ -313,13 +320,15 @@ pub struct CreateTerminalRequest {
313320#[ derive( Debug , Clone , Serialize , Deserialize , JsonSchema ) ]
314321#[ schemars( extend( "x-docs-ignore" = true ) ) ]
315322#[ serde( rename_all = "camelCase" ) ]
323+ #[ cfg( feature = "unstable" ) ]
316324pub struct CreateTerminalResponse {
317325 pub terminal_id : TerminalId ,
318326}
319327
320328#[ derive( Debug , Clone , Serialize , Deserialize , JsonSchema ) ]
321329#[ schemars( extend( "x-docs-ignore" = true ) ) ]
322330#[ serde( rename_all = "camelCase" ) ]
331+ #[ cfg( feature = "unstable" ) ]
323332pub struct TerminalOutputRequest {
324333 pub session_id : SessionId ,
325334 pub terminal_id : TerminalId ,
@@ -328,6 +337,7 @@ pub struct TerminalOutputRequest {
328337#[ derive( Debug , Clone , Serialize , Deserialize , JsonSchema ) ]
329338#[ schemars( extend( "x-docs-ignore" = true ) ) ]
330339#[ serde( rename_all = "camelCase" ) ]
340+ #[ cfg( feature = "unstable" ) ]
331341pub struct TerminalOutputResponse {
332342 pub output : String ,
333343 pub truncated : bool ,
@@ -337,6 +347,7 @@ pub struct TerminalOutputResponse {
337347#[ derive( Debug , Clone , Serialize , Deserialize , JsonSchema ) ]
338348#[ schemars( extend( "x-docs-ignore" = true ) ) ]
339349#[ serde( rename_all = "camelCase" ) ]
350+ #[ cfg( feature = "unstable" ) ]
340351pub struct ReleaseTerminalRequest {
341352 pub session_id : SessionId ,
342353 pub terminal_id : TerminalId ,
@@ -345,6 +356,7 @@ pub struct ReleaseTerminalRequest {
345356#[ derive( Debug , Clone , Serialize , Deserialize , JsonSchema ) ]
346357#[ schemars( extend( "x-docs-ignore" = true ) ) ]
347358#[ serde( rename_all = "camelCase" ) ]
359+ #[ cfg( feature = "unstable" ) ]
348360pub struct WaitForTerminalExitRequest {
349361 pub session_id : SessionId ,
350362 pub terminal_id : TerminalId ,
@@ -353,6 +365,7 @@ pub struct WaitForTerminalExitRequest {
353365#[ derive( Debug , Clone , Serialize , Deserialize , JsonSchema ) ]
354366#[ schemars( extend( "x-docs-ignore" = true ) ) ]
355367#[ serde( rename_all = "camelCase" ) ]
368+ #[ cfg( feature = "unstable" ) ]
356369pub struct WaitForTerminalExitResponse {
357370 #[ serde( flatten) ]
358371 pub exit_status : TerminalExitStatus ,
@@ -361,6 +374,7 @@ pub struct WaitForTerminalExitResponse {
361374#[ derive( Debug , Clone , Serialize , Deserialize , JsonSchema ) ]
362375#[ schemars( extend( "x-docs-ignore" = true ) ) ]
363376#[ serde( rename_all = "camelCase" ) ]
377+ #[ cfg( feature = "unstable" ) ]
364378pub struct TerminalExitStatus {
365379 pub exit_code : Option < u32 > ,
366380 pub signal : Option < String > ,
@@ -420,12 +434,16 @@ pub struct ClientMethodNames {
420434 /// Method for reading text files.
421435 pub fs_read_text_file : & ' static str ,
422436 /// Method for creating new terminals.
437+ #[ cfg( feature = "unstable" ) ]
423438 pub terminal_create : & ' static str ,
424439 /// Method for getting terminals output.
440+ #[ cfg( feature = "unstable" ) ]
425441 pub terminal_output : & ' static str ,
426442 /// Method for releasing a terminal.
443+ #[ cfg( feature = "unstable" ) ]
427444 pub terminal_release : & ' static str ,
428445 /// Method for waiting for a terminal to finish.
446+ #[ cfg( feature = "unstable" ) ]
429447 pub terminal_wait_for_exit : & ' static str ,
430448}
431449
@@ -435,9 +453,13 @@ pub const CLIENT_METHOD_NAMES: ClientMethodNames = ClientMethodNames {
435453 session_request_permission : SESSION_REQUEST_PERMISSION_METHOD_NAME ,
436454 fs_write_text_file : FS_WRITE_TEXT_FILE_METHOD_NAME ,
437455 fs_read_text_file : FS_READ_TEXT_FILE_METHOD_NAME ,
456+ #[ cfg( feature = "unstable" ) ]
438457 terminal_create : TERMINAL_CREATE_METHOD_NAME ,
458+ #[ cfg( feature = "unstable" ) ]
439459 terminal_output : TERMINAL_OUTPUT_METHOD_NAME ,
460+ #[ cfg( feature = "unstable" ) ]
440461 terminal_release : TERMINAL_RELEASE_METHOD_NAME ,
462+ #[ cfg( feature = "unstable" ) ]
441463 terminal_wait_for_exit : TERMINAL_WAIT_FOR_EXIT_METHOD_NAME ,
442464} ;
443465
@@ -450,12 +472,16 @@ pub(crate) const FS_WRITE_TEXT_FILE_METHOD_NAME: &str = "fs/write_text_file";
450472/// Method name for reading text files.
451473pub ( crate ) const FS_READ_TEXT_FILE_METHOD_NAME : & str = "fs/read_text_file" ;
452474/// Method name for creating a new terminal.
475+ #[ cfg( feature = "unstable" ) ]
453476pub ( crate ) const TERMINAL_CREATE_METHOD_NAME : & str = "terminal/create" ;
454477/// Method for getting terminals output.
478+ #[ cfg( feature = "unstable" ) ]
455479pub ( crate ) const TERMINAL_OUTPUT_METHOD_NAME : & str = "terminal/output" ;
456480/// Method for releasing a terminal.
481+ #[ cfg( feature = "unstable" ) ]
457482pub ( crate ) const TERMINAL_RELEASE_METHOD_NAME : & str = "terminal/release" ;
458483/// Method for waiting for a terminal to finish.
484+ #[ cfg( feature = "unstable" ) ]
459485pub ( crate ) const TERMINAL_WAIT_FOR_EXIT_METHOD_NAME : & str = "terminal/wait_for_exit" ;
460486
461487/// All possible requests that an agent can send to a client.
@@ -471,9 +497,13 @@ pub enum AgentRequest {
471497 WriteTextFileRequest ( WriteTextFileRequest ) ,
472498 ReadTextFileRequest ( ReadTextFileRequest ) ,
473499 RequestPermissionRequest ( RequestPermissionRequest ) ,
500+ #[ cfg( feature = "unstable" ) ]
474501 CreateTerminalRequest ( CreateTerminalRequest ) ,
502+ #[ cfg( feature = "unstable" ) ]
475503 TerminalOutputRequest ( TerminalOutputRequest ) ,
504+ #[ cfg( feature = "unstable" ) ]
476505 ReleaseTerminalRequest ( ReleaseTerminalRequest ) ,
506+ #[ cfg( feature = "unstable" ) ]
477507 WaitForTerminalExitRequest ( WaitForTerminalExitRequest ) ,
478508}
479509
@@ -490,9 +520,13 @@ pub enum ClientResponse {
490520 WriteTextFileResponse ,
491521 ReadTextFileResponse ( ReadTextFileResponse ) ,
492522 RequestPermissionResponse ( RequestPermissionResponse ) ,
523+ #[ cfg( feature = "unstable" ) ]
493524 CreateTerminalResponse ( CreateTerminalResponse ) ,
525+ #[ cfg( feature = "unstable" ) ]
494526 TerminalOutputResponse ( TerminalOutputResponse ) ,
527+ #[ cfg( feature = "unstable" ) ]
495528 ReleaseTerminalResponse ,
529+ #[ cfg( feature = "unstable" ) ]
496530 WaitForTerminalExitResponse ( WaitForTerminalExitResponse ) ,
497531}
498532
0 commit comments