feat: add floating popup panes

refs #1125
This commit is contained in:
Ogulcan Celik
2026-07-15 04:02:14 +03:00
parent 88370e1516
commit 2c7c8beb07
33 changed files with 2049 additions and 104 deletions
+1
View File
@@ -64,6 +64,7 @@ pub(crate) fn request_changes_ui(request: &Request) -> bool {
| Method::PaneClearAgentAuthority(_)
| Method::PaneReleaseAgent(_)
| Method::PaneClose(_)
| Method::PopupClose(_)
| Method::PluginActionInvoke(_)
| Method::PluginPaneOpen(_)
| Method::PluginPaneFocus(_)
+2
View File
@@ -191,6 +191,8 @@ pub enum Method {
PaneReleaseAgent(PaneReleaseAgentParams),
#[serde(rename = "pane.close")]
PaneClose(PaneTarget),
#[serde(rename = "popup.close")]
PopupClose(EmptyParams),
#[serde(rename = "events.subscribe")]
EventsSubscribe(EventsSubscribeParams),
#[serde(rename = "events.wait")]
+10
View File
@@ -6,6 +6,7 @@ use super::common::AgentStatus;
use super::common::SplitDirection;
use super::panes::PaneInfo;
use super::workspaces::WorkspaceWorktreeInfo;
use crate::popup_size::PopupSize;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
pub struct PluginLinkParams {
@@ -261,6 +262,10 @@ pub struct PluginManifestPane {
pub platforms: Option<Vec<PluginPlatform>>,
#[serde(default)]
pub placement: PluginPanePlacement,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub width: Option<PopupSize>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub height: Option<PopupSize>,
pub command: Vec<String>,
}
@@ -407,6 +412,10 @@ pub struct PluginPaneOpenParams {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub placement: Option<PluginPanePlacement>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub width: Option<PopupSize>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub height: Option<PopupSize>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub workspace_id: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub target_pane_id: Option<String>,
@@ -427,6 +436,7 @@ pub struct PluginPaneOpenParams {
pub enum PluginPanePlacement {
#[default]
Overlay,
Popup,
Split,
Tab,
Zoomed,
+23 -3
View File
@@ -814,6 +814,8 @@ fn plugin_link_list_unlink_round_trip() {
description: None,
platforms: None,
placement: PluginPanePlacement::Overlay,
width: None,
height: None,
command: vec!["bun".into(), "run".into(), "board.ts".into()],
}],
link_handlers: vec![PluginManifestLinkHandler {
@@ -1152,10 +1154,12 @@ fn plugin_pane_open_request_round_trips() {
method: Method::PluginPaneOpen(PluginPaneOpenParams {
plugin_id: "example.board".into(),
entrypoint: "board".into(),
placement: Some(PluginPanePlacement::Zoomed),
placement: Some(PluginPanePlacement::Popup),
width: Some(crate::popup_size::PopupSize::Cells(90)),
height: Some(crate::popup_size::PopupSize::Percent(80)),
workspace_id: None,
target_pane_id: Some("1-1".into()),
direction: Some(SplitDirection::Right),
target_pane_id: None,
direction: None,
cwd: Some("/tmp".into()),
focus: true,
env: [("HERDR_ROLE".to_string(), "board".to_string())].into(),
@@ -1164,7 +1168,23 @@ fn plugin_pane_open_request_round_trips() {
let json = serde_json::to_value(&request).unwrap();
assert_eq!(json["method"], "plugin.pane.open");
assert_eq!(json["params"]["placement"], "popup");
assert_eq!(json["params"]["width"], 90);
assert_eq!(json["params"]["height"], "80%");
assert_eq!(json["params"]["env"]["HERDR_ROLE"], "board");
let restored: Request = serde_json::from_value(json).unwrap();
assert_eq!(restored, request);
}
#[test]
fn popup_close_request_round_trips() {
let request = Request {
id: "popup-close".into(),
method: Method::PopupClose(EmptyParams::default()),
};
let json = serde_json::to_value(request).unwrap();
assert_eq!(json["method"], "popup.close");
assert_eq!(json["params"], serde_json::json!({}));
}
+1
View File
@@ -406,6 +406,7 @@ fn api_method_name(method: &Method) -> &'static str {
Method::PaneClearAgentAuthority(_) => "pane.clear_agent_authority",
Method::PaneReleaseAgent(_) => "pane.release_agent",
Method::PaneClose(_) => "pane.close",
Method::PopupClose(_) => "popup.close",
Method::EventsSubscribe(_) => "events.subscribe",
Method::EventsWait(_) => "events.wait",
Method::PaneWaitForOutput(_) => "pane.wait_for_output",