aboutsummaryrefslogtreecommitdiff
path: root/src/server/client_commands.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-06 02:27:06 +0300
committerGitHub <noreply@github.com>2026-09-06 02:27:06 +0300
commit9e9bc8a144667a6b7debfd4f0c7a31ff0e11493a (patch)
tree03f1259f91fd9edeacfd4b904f2e84d4acf25232 /src/server/client_commands.rs
parent35b0dff96579f099e0436290085024424ffb289c (diff)
feat: manage multiple ssh machines from one client (#3670)
Diffstat (limited to 'src/server/client_commands.rs')
-rw-r--r--src/server/client_commands.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/server/client_commands.rs b/src/server/client_commands.rs
index 34be0519..0af1fad1 100644
--- a/src/server/client_commands.rs
+++ b/src/server/client_commands.rs
@@ -13,6 +13,7 @@ pub(crate) const MAX_ENDPOINT_REQUEST_ID_BYTES: usize = 128;
const ENDPOINT_RESPONSE_CHUNK_BYTES: usize = 512 * 1024;
const CLIENT_SHELL_METHODS: &[&str] = &[
+ "client_shell.surface.set",
"command.invoke",
"integration.install",
"integration.list",
@@ -77,6 +78,30 @@ pub(crate) fn error_response(id: String, code: &str, message: impl Into<String>)
})
}
+pub(crate) fn success_message_with_result(
+ boot_id: String,
+ request_id: String,
+ result: crate::api::schema::ResponseResult,
+) -> crate::protocol::ServerMessage {
+ let response = serde_json::to_string(&crate::api::schema::SuccessResponse {
+ id: request_id.clone(),
+ result,
+ })
+ .unwrap_or_else(|_| {
+ error_response(
+ request_id.clone(),
+ "serialization_error",
+ "failed to serialize endpoint response",
+ )
+ });
+ crate::protocol::ServerMessage::ClientShellEndpointResponseChunk {
+ boot_id,
+ request_id,
+ final_chunk: true,
+ data: response.into_bytes(),
+ }
+}
+
pub(crate) fn error_message(
boot_id: String,
request_id: String,
@@ -312,6 +337,11 @@ mod tests {
#[test]
fn client_shell_lane_excludes_api_front_door_and_lifecycle_methods() {
+ assert!(supports_client_shell_method(
+ &Method::ClientShellSurfaceSet(crate::api::schema::ClientShellSurfaceSetParams {
+ active: false,
+ })
+ ));
assert!(supports_client_shell_method(&Method::ServerReloadConfig(
crate::api::schema::EmptyParams::default(),
)));