Skip to main content

agentmux_srv/server/app_api/
shells.rs

1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! `shell.list`: the shells installed here, and which one a new local terminal
5//! starts with, for Settings' default-shell picker (`backend::shells`).
6
7use super::*;
8
9pub fn register(engine: &Arc<WshRpcEngine>, state: &AppState) {
10    let config = state.config_watcher.clone();
11    engine.register_typed(COMMAND_SHELL_LIST, move |_req: Option<NoArgsReq>, _ctx| {
12        let config = config.clone();
13        async move {
14            let setting = config.get_settings().term_local_shell_path;
15            // Finding versions runs each shell once: off the async runtime.
16            tokio::task::spawn_blocking(move || crate::backend::shells::list(&setting))
17                .await
18                .map_err(|e| format!("shell.list: {e}"))
19        }
20    });
21}