@@ -109,6 +109,7 @@ use crate::util::image::{
109109} ;
110110#[ cfg( feature = "local_fs" ) ]
111111use crate :: util:: openable_file_type:: is_binary_file;
112+ use crate :: workspaces:: user_workspaces:: TeamContextResolver ;
112113
113114/// Types of actions that can be executed in parallel.
114115#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
@@ -282,6 +283,7 @@ pub struct BlocklistAIActionExecutor {
282283
283284 /// Reference to the terminal model for checking session sharing state.
284285 terminal_model : Arc < FairMutex < TerminalModel > > ,
286+ team_context_resolver : TeamContextResolver ,
285287}
286288
287289impl BlocklistAIActionExecutor {
@@ -291,6 +293,7 @@ impl BlocklistAIActionExecutor {
291293 model_event_dispatcher : & ModelHandle < ModelEventDispatcher > ,
292294 get_relevant_files_controller : ModelHandle < GetRelevantFilesController > ,
293295 terminal_view_id : EntityId ,
296+ team_context_resolver : TeamContextResolver ,
294297 ctx : & mut ModelContext < Self > ,
295298 ) -> Self {
296299 let read_files_executor =
@@ -368,6 +371,7 @@ impl BlocklistAIActionExecutor {
368371 stop_recording_executor,
369372 async_executing_actions : Default :: default ( ) ,
370373 terminal_model,
374+ team_context_resolver,
371375 read_skill_executor,
372376 fetch_conversation_executor,
373377 start_agent_executor,
@@ -956,31 +960,45 @@ impl BlocklistAIActionExecutor {
956960 }
957961
958962 fn should_autoexecute ( & self , input : ExecuteActionInput , ctx : & mut ModelContext < Self > ) -> bool {
963+ let team_context_resolver = self . team_context_resolver . clone ( ) ;
959964 match input. action . action {
960965 AIAgentActionType :: RequestCommandOutput { .. }
961966 | AIAgentActionType :: WriteToLongRunningShellCommand { .. }
962967 | AIAgentActionType :: ReadShellCommandOutput { .. }
963- | AIAgentActionType :: TransferShellCommandControlToUser { .. } => self
964- . shell_command_executor
965- . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
966- AIAgentActionType :: ReadFiles ( _) => self
967- . read_files_executor
968- . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
969- AIAgentActionType :: UploadArtifact ( _) => self
970- . upload_artifact_executor
971- . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
972- AIAgentActionType :: SearchCodebase ( _) => self
973- . search_codebase_executor
974- . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
975- AIAgentActionType :: RequestFileEdits { .. } => self
976- . request_file_edits_executor
977- . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
978- AIAgentActionType :: Grep { .. } => self
979- . grep_executor
980- . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
981- AIAgentActionType :: FileGlob { .. } | AIAgentActionType :: FileGlobV2 { .. } => self
982- . file_glob_executor
983- . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
968+ | AIAgentActionType :: TransferShellCommandControlToUser { .. } => {
969+ self . shell_command_executor . update ( ctx, |executor, ctx| {
970+ executor. should_autoexecute ( input, & team_context_resolver ( ctx) , ctx)
971+ } )
972+ }
973+ AIAgentActionType :: ReadFiles ( _) => {
974+ self . read_files_executor . update ( ctx, |executor, ctx| {
975+ executor. should_autoexecute ( input, & team_context_resolver ( ctx) , ctx)
976+ } )
977+ }
978+ AIAgentActionType :: UploadArtifact ( _) => {
979+ self . upload_artifact_executor . update ( ctx, |executor, ctx| {
980+ executor. should_autoexecute ( input, & team_context_resolver ( ctx) , ctx)
981+ } )
982+ }
983+ AIAgentActionType :: SearchCodebase ( _) => {
984+ self . search_codebase_executor . update ( ctx, |executor, ctx| {
985+ executor. should_autoexecute ( input, & team_context_resolver ( ctx) , ctx)
986+ } )
987+ }
988+ AIAgentActionType :: RequestFileEdits { .. } => {
989+ self . request_file_edits_executor
990+ . update ( ctx, |executor, ctx| {
991+ executor. should_autoexecute ( input, & team_context_resolver ( ctx) , ctx)
992+ } )
993+ }
994+ AIAgentActionType :: Grep { .. } => self . grep_executor . update ( ctx, |executor, ctx| {
995+ executor. should_autoexecute ( input, & team_context_resolver ( ctx) , ctx)
996+ } ) ,
997+ AIAgentActionType :: FileGlob { .. } | AIAgentActionType :: FileGlobV2 { .. } => {
998+ self . file_glob_executor . update ( ctx, |executor, ctx| {
999+ executor. should_autoexecute ( input, & team_context_resolver ( ctx) , ctx)
1000+ } )
1001+ }
9841002 AIAgentActionType :: CallMCPTool { .. } => self
9851003 . call_mcp_tool_executor
9861004 . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
@@ -1008,9 +1026,12 @@ impl BlocklistAIActionExecutor {
10081026 AIAgentActionType :: UseComputer ( _) => self
10091027 . use_computer_executor
10101028 . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
1011- AIAgentActionType :: RequestComputerUse ( _) => self
1012- . request_computer_use_executor
1013- . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
1029+ AIAgentActionType :: RequestComputerUse ( _) => {
1030+ self . request_computer_use_executor
1031+ . update ( ctx, |executor, ctx| {
1032+ executor. should_autoexecute ( input, & team_context_resolver ( ctx) , ctx)
1033+ } )
1034+ }
10141035 AIAgentActionType :: StartRecording { .. } => self
10151036 . start_recording_executor
10161037 . update ( ctx, |executor, ctx| executor. should_autoexecute ( input, ctx) ) ,
0 commit comments