@@ -9,8 +9,8 @@ use tokio::sync::{mpsc, oneshot, Mutex};
99
1010use crate :: acp:: error_handling:: to_acp_error;
1111use crate :: acp:: types:: convert_prompt_to_content_blocks;
12- use crate :: acp:: ACPUserUI ;
13- use crate :: config:: DefaultProjectManager ;
12+ use crate :: acp:: { ACPUserUI , AcpProjectManager } ;
13+ use crate :: config:: { DefaultProjectManager , ProjectManager } ;
1414use crate :: persistence:: SessionModelConfig ;
1515use crate :: session:: instance:: SessionActivityState ;
1616use crate :: session:: { SessionConfig , SessionManager } ;
@@ -491,6 +491,7 @@ impl acp::Agent for ACPAgentImpl {
491491 let fast_playback = self . fast_playback ;
492492 let active_uis = self . active_uis . clone ( ) ;
493493 let client_capabilities = self . client_capabilities . clone ( ) ;
494+ let client_connection = get_acp_client_connection ( ) ;
494495
495496 Box :: pin ( async move {
496497 tracing:: info!(
@@ -503,6 +504,13 @@ impl acp::Agent for ACPAgentImpl {
503504 caps. as_ref ( ) . map ( |caps| caps. terminal ) . unwrap_or ( false )
504505 } ;
505506
507+ let filesystem_supported = {
508+ let caps = client_capabilities. lock ( ) . await ;
509+ caps. as_ref ( )
510+ . map ( |caps| caps. fs . read_text_file && caps. fs . write_text_file )
511+ . unwrap_or ( false )
512+ } ;
513+
506514 let base_path = {
507515 let manager = session_manager. lock ( ) . await ;
508516 manager
@@ -573,12 +581,21 @@ impl acp::Agent for ACPAgentImpl {
573581 }
574582 } ;
575583
584+ let use_acp_fs = filesystem_supported && client_connection. is_some ( ) ;
585+
576586 // Create project manager and command executor
577- let project_manager = Box :: new ( DefaultProjectManager :: new ( ) ) ;
587+ let project_manager: Box < dyn ProjectManager > = if use_acp_fs {
588+ Box :: new ( AcpProjectManager :: new (
589+ DefaultProjectManager :: new ( ) ,
590+ arguments. session_id . clone ( ) ,
591+ ) )
592+ } else {
593+ Box :: new ( DefaultProjectManager :: new ( ) )
594+ } ;
578595
579596 // Use ACP Terminal Command Executor if client connection is available
580597 let command_executor: Box < dyn crate :: utils:: command:: CommandExecutor > = {
581- if terminal_supported && get_acp_client_connection ( ) . is_some ( ) {
598+ if terminal_supported && client_connection . is_some ( ) {
582599 tracing:: info!(
583600 "ACP: Using ACPTerminalCommandExecutor for session {}" ,
584601 arguments. session_id. 0
0 commit comments