Skip to content

Commit 7dd67ff

Browse files
committed
wip
1 parent c83deab commit 7dd67ff

25 files changed

Lines changed: 239 additions & 159 deletions

app/src/ai/blocklist/action_model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ use crate::ai::get_relevant_files::controller::GetRelevantFilesController;
7070
use crate::terminal::TerminalModel;
7171
use crate::terminal::model::session::active_session::ActiveSession;
7272
use crate::terminal::model_events::ModelEventDispatcher;
73-
use crate::{TelemetryEvent, send_telemetry_from_ctx};
7473
use crate::workspaces::user_workspaces::TeamContextResolver;
74+
use crate::{TelemetryEvent, send_telemetry_from_ctx};
7575

7676
/// The status of an action from an AI output.
7777
#[derive(Clone, Debug)]

app/src/ai/blocklist/action_model/execute.rs

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ use crate::terminal::model::session::{ExecuteCommandOptions, Session};
103103
use crate::terminal::model_events::ModelEventDispatcher;
104104
use crate::terminal::shell::ShellType;
105105
use crate::terminal::{ShellLaunchData, TerminalModel};
106-
use crate::workspaces::user_workspaces::TeamContextResolver;
107106
#[cfg(feature = "local_fs")]
108107
use crate::util::image::{
109108
ProcessImageResult, is_supported_image_mime_type, process_image_for_agent,
110109
};
111110
#[cfg(feature = "local_fs")]
112111
use crate::util::openable_file_type::is_binary_file;
112+
use crate::workspaces::user_workspaces::TeamContextResolver;
113113

114114
/// Types of actions that can be executed in parallel.
115115
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -965,41 +965,39 @@ impl BlocklistAIActionExecutor {
965965
AIAgentActionType::RequestCommandOutput { .. }
966966
| AIAgentActionType::WriteToLongRunningShellCommand { .. }
967967
| AIAgentActionType::ReadShellCommandOutput { .. }
968-
| AIAgentActionType::TransferShellCommandControlToUser { .. } => self
969-
.shell_command_executor
970-
.update(ctx, |executor, ctx| {
968+
| AIAgentActionType::TransferShellCommandControlToUser { .. } => {
969+
self.shell_command_executor.update(ctx, |executor, ctx| {
971970
executor.should_autoexecute(input, &team_context_resolver, ctx)
972-
}),
973-
AIAgentActionType::ReadFiles(_) => self
974-
.read_files_executor
975-
.update(ctx, |executor, ctx| {
971+
})
972+
}
973+
AIAgentActionType::ReadFiles(_) => {
974+
self.read_files_executor.update(ctx, |executor, ctx| {
976975
executor.should_autoexecute(input, &team_context_resolver, ctx)
977-
}),
978-
AIAgentActionType::UploadArtifact(_) => self
979-
.upload_artifact_executor
980-
.update(ctx, |executor, ctx| {
976+
})
977+
}
978+
AIAgentActionType::UploadArtifact(_) => {
979+
self.upload_artifact_executor.update(ctx, |executor, ctx| {
981980
executor.should_autoexecute(input, &team_context_resolver, ctx)
982-
}),
983-
AIAgentActionType::SearchCodebase(_) => self
984-
.search_codebase_executor
985-
.update(ctx, |executor, ctx| {
981+
})
982+
}
983+
AIAgentActionType::SearchCodebase(_) => {
984+
self.search_codebase_executor.update(ctx, |executor, ctx| {
986985
executor.should_autoexecute(input, &team_context_resolver, ctx)
987-
}),
986+
})
987+
}
988988
AIAgentActionType::RequestFileEdits { .. } => self
989989
.request_file_edits_executor
990990
.update(ctx, |executor, ctx| {
991991
executor.should_autoexecute(input, &team_context_resolver, ctx)
992992
}),
993-
AIAgentActionType::Grep { .. } => self
994-
.grep_executor
995-
.update(ctx, |executor, ctx| {
996-
executor.should_autoexecute(input, &team_context_resolver, ctx)
997-
}),
998-
AIAgentActionType::FileGlob { .. } | AIAgentActionType::FileGlobV2 { .. } => self
999-
.file_glob_executor
1000-
.update(ctx, |executor, ctx| {
993+
AIAgentActionType::Grep { .. } => self.grep_executor.update(ctx, |executor, ctx| {
994+
executor.should_autoexecute(input, &team_context_resolver, ctx)
995+
}),
996+
AIAgentActionType::FileGlob { .. } | AIAgentActionType::FileGlobV2 { .. } => {
997+
self.file_glob_executor.update(ctx, |executor, ctx| {
1001998
executor.should_autoexecute(input, &team_context_resolver, ctx)
1002-
}),
999+
})
1000+
}
10031001
AIAgentActionType::CallMCPTool { .. } => self
10041002
.call_mcp_tool_executor
10051003
.update(ctx, |executor, ctx| executor.should_autoexecute(input, ctx)),

app/src/ai/blocklist/action_model/execute/file_glob.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use crate::terminal::model::session::active_session::ActiveSession;
2121
use crate::terminal::model::session::command_executor::shell_quote_arg;
2222
use crate::terminal::model::session::{ExecuteCommandOptions, Session};
2323
use crate::terminal::shell::ShellType;
24-
use crate::{TelemetryEvent, send_telemetry_from_app_ctx};
2524
use crate::workspaces::user_workspaces::TeamContextResolver;
25+
use crate::{TelemetryEvent, send_telemetry_from_app_ctx};
2626

2727
const FILE_GLOB_TIMEOUT: Duration = Duration::from_secs(10);
2828

app/src/ai/blocklist/action_model/execute/search_codebase.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ use crate::ai::get_relevant_files::controller::{
2424
};
2525
use crate::features::FeatureFlag;
2626
use crate::terminal::model::session::active_session::ActiveSession;
27-
use crate::{TelemetryEvent, send_telemetry_from_ctx};
2827
use crate::workspaces::user_workspaces::TeamContextResolver;
28+
use crate::{TelemetryEvent, send_telemetry_from_ctx};
2929

3030
pub struct SearchCodebaseExecutor {
3131
active_session: ModelHandle<ActiveSession>,

app/src/ai/blocklist/action_model/execute/shell_command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ use crate::terminal::model::block::{
3434
use crate::terminal::model::session::active_session::ActiveSession;
3535
use crate::terminal::model_events::{ModelEvent, ModelEventDispatcher};
3636
use crate::terminal::shell::ShellType;
37-
use crate::{TelemetryEvent, send_telemetry_from_ctx};
3837
use crate::workspaces::user_workspaces::TeamContextResolver;
38+
use crate::{TelemetryEvent, send_telemetry_from_ctx};
3939

4040
pub struct ShellCommandExecutor {
4141
active_session: ModelHandle<ActiveSession>,

app/src/ai/blocklist/action_model/execute/upload_artifact_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ fn should_autoexecute_honors_file_read_permissions_for_resolved_path() {
175175
action: &action,
176176
conversation_id,
177177
},
178+
&UserWorkspaces::teamless_context_resolver_for_test(),
178179
ctx,
179180
)
180181
});
@@ -193,6 +194,7 @@ fn should_autoexecute_honors_file_read_permissions_for_resolved_path() {
193194
action: &action,
194195
conversation_id,
195196
},
197+
&UserWorkspaces::teamless_context_resolver_for_test(),
196198
ctx,
197199
)
198200
});

app/src/ai/blocklist/permissions.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,10 @@ impl BlocklistAIPermissions {
192192
execute_commands: self.get_execute_commands_setting_for_profile(profile_id, scope, ctx),
193193
mcp_permissions: self.get_mcp_permissions_setting_for_profile(ctx, profile_id),
194194
write_to_pty: self.get_write_to_pty_setting_for_profile(profile_id, scope, ctx),
195-
command_allowlist: self.get_execute_commands_allowlist_for_profile(profile_id, scope, ctx),
196-
command_denylist: self.get_execute_commands_denylist_for_profile(profile_id, scope, ctx),
195+
command_allowlist: self
196+
.get_execute_commands_allowlist_for_profile(profile_id, scope, ctx),
197+
command_denylist: self
198+
.get_execute_commands_denylist_for_profile(profile_id, scope, ctx),
197199
directory_allowlist: self.get_read_files_allowlist_for_profile(profile_id, scope, ctx),
198200
mcp_allowlist: self.get_mcp_allowlist_for_profile(ctx, profile_id),
199201
mcp_denylist: self.get_mcp_denylist_for_profile(ctx, profile_id),
@@ -228,10 +230,7 @@ impl BlocklistAIPermissions {
228230
/// Returns the applicable workspace autonomy settings based on execution mode.
229231
/// In sandboxed mode, returns settings derived from the sandboxed agent config.
230232
/// In unsandboxed mode, returns the standard AI autonomy settings.
231-
fn team_autonomy_settings(
232-
scope: &impl TeamScope,
233-
ctx: &AppContext,
234-
) -> AiAutonomySettings {
233+
fn team_autonomy_settings(scope: &impl TeamScope, ctx: &AppContext) -> AiAutonomySettings {
235234
if AppExecutionMode::as_ref(ctx).is_sandboxed() {
236235
let sandboxed = UserWorkspaces::as_ref(ctx).sandboxed_agent_settings();
237236
AiAutonomySettings {

0 commit comments

Comments
 (0)