aboutsummaryrefslogtreecommitdiff
path: root/src/api/schema
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/schema')
-rw-r--r--src/api/schema/panes.rs55
-rw-r--r--src/api/schema/response.rs4
2 files changed, 59 insertions, 0 deletions
diff --git a/src/api/schema/panes.rs b/src/api/schema/panes.rs
index 2e37e734..097b6366 100644
--- a/src/api/schema/panes.rs
+++ b/src/api/schema/panes.rs
@@ -2,6 +2,9 @@ use std::collections::HashMap;
use serde::{Deserialize, Serialize};
+pub(crate) const PANE_GRAPHICS_SET_MAX_BYTES: usize = 512 * 1024;
+pub(crate) const PANE_GRAPHICS_STREAM_MAX_BYTES: usize = 16 * 1024 * 1024;
+
use super::agents::AgentSessionInfo;
use super::common::{AgentStatus, PaneAgentState, ReadFormat, ReadSource, SplitDirection};
@@ -257,6 +260,58 @@ pub struct PaneReadParams {
pub strip_ansi: bool,
}
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum PaneGraphicsFormat {
+ Png,
+ Rgb,
+ Rgba,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
+pub struct PaneGraphicsSetParams {
+ pub pane_id: String,
+ #[serde(skip)]
+ #[schemars(skip)]
+ pub owner: String,
+ pub format: PaneGraphicsFormat,
+ pub image_width: u32,
+ pub image_height: u32,
+ #[serde(skip)]
+ pub data: Option<Vec<u8>>,
+ #[serde(default)]
+ pub data_base64: String,
+ #[serde(default)]
+ pub placement: PaneGraphicsPlacementParams,
+}
+
+#[derive(
+ Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema, Default,
+)]
+pub struct PaneGraphicsPlacementParams {
+ #[serde(default)]
+ pub viewport_col: i32,
+ #[serde(default)]
+ pub viewport_row: i32,
+ #[serde(default)]
+ pub grid_cols: u32,
+ #[serde(default)]
+ pub grid_rows: u32,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
+pub struct PaneGraphicsClearParams {
+ pub pane_id: String,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
+pub struct PaneGraphicsStreamParams {
+ pub pane_id: String,
+ #[serde(skip)]
+ #[schemars(skip)]
+ pub owner: String,
+}
+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
pub struct PaneReportAgentParams {
pub pane_id: String,
diff --git a/src/api/schema/response.rs b/src/api/schema/response.rs
index 18a2635d..129c8f91 100644
--- a/src/api/schema/response.rs
+++ b/src/api/schema/response.rs
@@ -152,6 +152,10 @@ pub enum ResponseResult {
PaneRead {
read: PaneReadResult,
},
+ PaneGraphicsInfo {
+ cell_width_px: u32,
+ cell_height_px: u32,
+ },
AgentExplain {
explain: serde_json::Value,
},