agentmux_srv/server/app_api/
layout_intent.rs1use super::*;
9
10pub fn register(engine: &Arc<WshRpcEngine>, state: &AppState) {
11 let state = state.clone();
12 engine.register_typed(COMMAND_LAYOUT_APPLY_INTENT, move |cmd: CommandLayoutIntentData, _ctx| {
13 let state = state.clone();
14 async move { apply_intent(&state, cmd).await }
15 });
16}
17
18pub(crate) async fn apply_intent(state: &AppState, cmd: CommandLayoutIntentData) -> Result<LayoutIntentResult, String> {
19 let view = agentmux_common::LayoutViewState {
20 focused_node_id: cmd.focused_node_id,
21 magnified_node_id: cmd.magnified_node_id,
22 };
23 let outcome = crate::server::service::layout_intents::apply_layout_intent(
24 state,
25 &cmd.tab_id,
26 cmd.intent,
27 &cmd.action_id,
28 Some(view),
29 )
30 .await?;
31 Ok(LayoutIntentResult { applied: outcome.applied, error: outcome.error, version: outcome.version })
32}