Skip to main content

agentmux_srv/server/service/
object.rs

1// Copyright 2025-2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! `object` service handler (GetObject, CreateBlock, UpdateObject, …).
5
6use crate::backend::service::{WebCallType, WebReturnType};
7
8use super::super::AppState;
9
10#[path = "object_methods.rs"]
11mod methods;
12
13pub(super) async fn handle_object_service(state: &AppState, call: &WebCallType, caller_uid: Option<&str>) -> WebReturnType {
14    let args = &call.args;
15    let reply = match call.method.as_str() {
16        "GetObject" => methods::get_object(state, args),
17        "GetObjects" => methods::get_objects(state, args),
18        "CreateBlock" => methods::create_block(state, call).await,
19        "DeleteBlock" => methods::delete_block(state, args).await,
20        "QuitAgent" => methods::quit_agent(state, args, caller_uid),
21        "ShutdownAgent" => methods::shutdown_agent(state, args, caller_uid),
22        "ShutdownPreview" => methods::shutdown_preview(state, args, caller_uid).await,
23        "ClosePane" => methods::close_pane(state, args).await,
24        "ApplyLayoutIntent" => methods::apply_layout_intent(state, args).await,
25        "UpdateObject" => methods::update_object_row(state, args),
26        "UpdateObjectMeta" => methods::update_object_meta_patch(state, args).await,
27        "UpdateTabName" => methods::update_tab_name(state, args).await,
28        _ => Err(WebReturnType::error(format!("unknown object method: {}", call.method))),
29    };
30    match reply {
31        Ok(reply) | Err(reply) => reply,
32    }
33}