Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions app/src/ai/blocklist/block/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ use crate::server::telemetry::TelemetryEvent;
use crate::settings::{AISettings, SelectionSettings};
use crate::terminal::input::SET_INPUT_MODE_TERMINAL_ACTION_NAME;
use crate::terminal::model::block::{AgentInteractionMetadata, BlockId};
use crate::terminal::resizable_data::{ModalType, ResizableData};
use crate::terminal::{ShellLaunchData, TerminalModel};
use crate::view_components::DismissibleToast;
use crate::workspace::WorkspaceAction;
Expand Down Expand Up @@ -837,6 +838,28 @@ impl CLISubagentView {
_ => {}
});

let resizable_data_handle = ResizableData::handle(ctx);
let resizable_width = match resizable_data_handle
.as_ref(ctx)
.get_handle(ctx.window_id(), ModalType::CliSubagentWidth)
{
Some(handle) => handle,
None => {
log::error!("Couldn't retrieve CLI subagent width resizable state handle.");
resizable_state_handle(MIN_RESIZABLE_WIDTH)
}
};
let resizable_height = match resizable_data_handle
.as_ref(ctx)
.get_handle(ctx.window_id(), ModalType::CliSubagentHeight)
{
Some(handle) => handle,
None => {
log::error!("Couldn't retrieve CLI subagent height resizable state handle.");
resizable_state_handle(MAX_HEIGHT)
}
};

let mut view = Self {
block_id,
model,
Expand Down Expand Up @@ -867,8 +890,8 @@ impl CLISubagentView {
hidden_response_scroll_offset: None,
is_input_dismissed: false,
input_dismiss_timer_handle: None,
resizable_width: resizable_state_handle(MIN_RESIZABLE_WIDTH),
resizable_height: resizable_state_handle(MAX_HEIGHT),
resizable_width,
resizable_height,
current_working_directory,
shell_launch_data,
selected_text: Arc::new(RwLock::new(None)),
Expand Down
2 changes: 2 additions & 0 deletions app/src/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pub struct WindowSnapshot {
pub vertical_tabs_panel_open: bool,
pub left_panel_width: Option<f32>,
pub right_panel_width: Option<f32>,
pub cli_subagent_width: Option<f32>,
pub cli_subagent_height: Option<f32>,
pub agent_management_filters: Option<PersistedAgentManagementFilters>,
/// The per-window theme override for this window, if the user set one via the
/// theme chooser's "This window" scope. Re-applied on restore.
Expand Down
4 changes: 4 additions & 0 deletions app/src/launch_configs/launch_config_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ fn single_tab_snapshot(root: PaneNodeSnapshot) -> AppState {
fullscreen_state: Default::default(),
left_panel_width: None,
right_panel_width: None,
cli_subagent_width: None,
cli_subagent_height: None,
agent_management_filters: None,
theme_override: None,
}],
Expand All @@ -59,6 +61,8 @@ fn multi_tab_snapshot(active_tab_index: usize, tabs: Vec<TabSnapshot>) -> AppSta
fullscreen_state: Default::default(),
left_panel_width: None,
right_panel_width: None,
cli_subagent_width: None,
cli_subagent_height: None,
agent_management_filters: None,
theme_override: None,
}],
Expand Down
4 changes: 4 additions & 0 deletions app/src/persistence/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,8 @@ fn save_app_state(conn: &mut SqliteConnection, app_state: &AppState) -> Result<(
.theme_override
.as_ref()
.and_then(|k| serde_json::to_string(k).ok()),
cli_subagent_width: window.cli_subagent_width,
cli_subagent_height: window.cli_subagent_height,
};
diesel::insert_into(schema::windows::dsl::windows)
.values(new_window)
Expand Down Expand Up @@ -2851,6 +2853,8 @@ fn read_sqlite_data(
fullscreen_state: fullscreen_state_val,
left_panel_width,
right_panel_width,
cli_subagent_width: window.cli_subagent_width,
cli_subagent_height: window.cli_subagent_height,
agent_management_filters: window
.agent_management_filters
.and_then(|s| serde_json::from_str(&s).ok()),
Expand Down
6 changes: 6 additions & 0 deletions app/src/persistence/sqlite_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ fn test_terminal_window_snapshot(vertical_tabs_panel_open: bool) -> WindowSnapsh
vertical_tabs_panel_open,
left_panel_width: None,
right_panel_width: None,
cli_subagent_width: None,
cli_subagent_height: None,
agent_management_filters: None,
theme_override: None,
}
Expand Down Expand Up @@ -238,6 +240,8 @@ fn test_sqlite_round_trips_custom_vertical_tabs_title() {
vertical_tabs_panel_open: false,
left_panel_width: None,
right_panel_width: None,
cli_subagent_width: None,
cli_subagent_height: None,
agent_management_filters: None,
theme_override: None,
}],
Expand Down Expand Up @@ -311,6 +315,8 @@ fn test_sqlite_round_trips_code_pane_with_multiple_tabs() {
vertical_tabs_panel_open: false,
left_panel_width: None,
right_panel_width: None,
cli_subagent_width: None,
cli_subagent_height: None,
agent_management_filters: None,
theme_override: None,
}],
Expand Down
20 changes: 20 additions & 0 deletions app/src/terminal/resizable_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pub const DEFAULT_WARP_DRIVE_INDEX_WIDTH: f32 = 300.;
pub const DEFAULT_SETTINGS_PANEL_WIDTH: f32 = 194.;
pub const DEFAULT_LEFT_PANEL_WIDTH: f32 = 240.;
pub const DEFAULT_RIGHT_PANEL_WIDTH: f32 = 480.;
pub const DEFAULT_CLI_SUBAGENT_WIDTH: f32 = 360.;
pub const DEFAULT_CLI_SUBAGENT_HEIGHT: f32 = 320.;
/// A naming system for the ResizableStateHandles
pub enum ModalType {
UniversalSearchWidth,
Expand All @@ -24,6 +26,8 @@ pub enum ModalType {
SettingsPanelWidth,
LeftPanelWidth,
RightPanelWidth,
CliSubagentWidth,
CliSubagentHeight,
}

/// A grouping of state handles for the resizables that should be stored and loaded as a part
Expand All @@ -36,6 +40,8 @@ pub struct ModalSizes {
pub settings_panel_width: ResizableStateHandle,
pub left_panel_width: ResizableStateHandle,
pub right_panel_width: ResizableStateHandle,
pub cli_subagent_width: ResizableStateHandle,
pub cli_subagent_height: ResizableStateHandle,
}

impl ModalSizes {
Expand All @@ -62,6 +68,12 @@ impl ModalSizes {
let right_panel_width = window_snapshot
.right_panel_width
.unwrap_or(right_panel_size);
let cli_subagent_width = window_snapshot
.cli_subagent_width
.unwrap_or(DEFAULT_CLI_SUBAGENT_WIDTH);
let cli_subagent_height = window_snapshot
.cli_subagent_height
.unwrap_or(DEFAULT_CLI_SUBAGENT_HEIGHT);

Self {
universal_search_width: resizable_state_handle(universal_search_width),
Expand All @@ -71,6 +83,8 @@ impl ModalSizes {
settings_panel_width: resizable_state_handle(settings_panel_width),
left_panel_width: resizable_state_handle(left_panel_width),
right_panel_width: resizable_state_handle(right_panel_width),
cli_subagent_width: resizable_state_handle(cli_subagent_width),
cli_subagent_height: resizable_state_handle(cli_subagent_height),
}
}

Expand All @@ -83,6 +97,8 @@ impl ModalSizes {
settings_panel_width: resizable_state_handle(DEFAULT_SETTINGS_PANEL_WIDTH),
left_panel_width: resizable_state_handle(left_default),
right_panel_width: resizable_state_handle(right_default),
cli_subagent_width: resizable_state_handle(DEFAULT_CLI_SUBAGENT_WIDTH),
cli_subagent_height: resizable_state_handle(DEFAULT_CLI_SUBAGENT_HEIGHT),
}
}

Expand All @@ -96,6 +112,8 @@ impl ModalSizes {
ModalType::SettingsPanelWidth => self.settings_panel_width.clone(),
ModalType::LeftPanelWidth => self.left_panel_width.clone(),
ModalType::RightPanelWidth => self.right_panel_width.clone(),
ModalType::CliSubagentWidth => self.cli_subagent_width.clone(),
ModalType::CliSubagentHeight => self.cli_subagent_height.clone(),
}
}
}
Expand All @@ -111,6 +129,8 @@ impl Default for ModalSizes {
settings_panel_width: resizable_state_handle(DEFAULT_SETTINGS_PANEL_WIDTH),
left_panel_width: resizable_state_handle(DEFAULT_LEFT_PANEL_WIDTH),
right_panel_width: resizable_state_handle(DEFAULT_RIGHT_PANEL_WIDTH),
cli_subagent_width: resizable_state_handle(DEFAULT_CLI_SUBAGENT_WIDTH),
cli_subagent_height: resizable_state_handle(DEFAULT_CLI_SUBAGENT_HEIGHT),
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions app/src/workspace/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9662,6 +9662,20 @@ impl Workspace {
.unwrap_or(DEFAULT_RIGHT_PANEL_WIDTH)
});

let cli_subagent_width = modal_sizes.map(|ms| {
ms.cli_subagent_width
.lock()
.expect("should be able to lock cli subagent resizable state handle")
.size()
});

let cli_subagent_height = modal_sizes.map(|ms| {
ms.cli_subagent_height
.lock()
.expect("should be able to lock cli subagent resizable state handle")
.size()
});

WindowSnapshot {
tabs,
active_tab_index,
Expand All @@ -9676,6 +9690,8 @@ impl Workspace {
vertical_tabs_panel_open: self.vertical_tabs_panel_open,
left_panel_width,
right_panel_width,
cli_subagent_width,
cli_subagent_height,
agent_management_filters: None,
theme_override: self.theme_override.clone(),
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE windows DROP COLUMN cli_subagent_width;
ALTER TABLE windows DROP COLUMN cli_subagent_height;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE windows ADD cli_subagent_width FLOAT CHECK (cli_subagent_width >= 0);
ALTER TABLE windows ADD cli_subagent_height FLOAT CHECK (cli_subagent_height >= 0);
4 changes: 4 additions & 0 deletions crates/persistence/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub struct Window {
pub left_panel_open: Option<bool>,
pub vertical_tabs_panel_open: Option<bool>,
pub theme_override: Option<String>,
pub cli_subagent_width: Option<f32>,
pub cli_subagent_height: Option<f32>,
}

#[derive(Identifiable, Insertable, Queryable)]
Expand Down Expand Up @@ -305,6 +307,8 @@ pub struct NewWindow {
pub left_panel_open: Option<bool>,
pub vertical_tabs_panel_open: Option<bool>,
pub theme_override: Option<String>,
pub cli_subagent_width: Option<f32>,
pub cli_subagent_height: Option<f32>,
}

#[derive(Identifiable, Queryable, Associations)]
Expand Down
2 changes: 2 additions & 0 deletions crates/persistence/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ diesel::table! {
left_panel_open -> Nullable<Bool>,
vertical_tabs_panel_open -> Nullable<Bool>,
theme_override -> Nullable<Text>,
cli_subagent_width -> Nullable<Float>,
cli_subagent_height -> Nullable<Float>,
}
}

Expand Down