Skip to main content

agentmux_srv/server/
mod.rs

1// Copyright 2025-2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4pub(crate) mod cli_handlers;
5mod files;
6pub(crate) mod app_api;
7// `pub` so `bootstrap::install_agent_turn_delivery` can reach `run_agent_turn`
8// to start a turn outside the RPC path.
9pub mod agent_resources;
10pub mod agent_handlers;
11mod agent_takeover;
12mod editor_handlers;
13mod fs_handlers;
14pub(crate) mod identity_auth_dirs;
15mod identity_auth_persist;
16mod identity_auth_spawn;
17pub(crate) mod identity_handlers;
18pub mod install_handlers;
19mod lsp_handlers;
20mod system_install_handlers;
21mod messagebus;
22// pub(crate): muxbus::cloud_subscriber (the WAN delivery path) calls
23// resolve_transcript_request_tier_fields directly — see that function's
24// own doc comment for why.
25pub(crate) mod reactive;
26mod name_resolution;
27pub(crate) mod caller;
28pub(crate) mod agent_self_keys;
29pub(crate) mod jekt_held;
30pub(crate) mod actor;
31pub(crate) mod service;
32mod shell_handlers;
33mod tool_handlers;
34mod providers_handlers;
35mod voice;
36mod attachments;
37pub(crate) mod mux_obj_bridge;
38mod websocket;
39mod drone_handlers;
40mod cron;
41pub(crate) mod work_queue;
42mod messaging_handlers;
43mod muxbus_handlers;
44mod muxspect_handlers;
45mod work_claims_handlers;
46mod work_facts_handlers;
47pub(crate) mod native_memory_handlers;
48pub(crate) mod memory_delivery_handlers;
49mod notify_handlers;
50pub(crate) mod browser_allowlist;
51pub(crate) mod browser_attention;
52pub(crate) mod browser_host_sync;
53pub(crate) mod browser_identity;
54pub(crate) mod browser_owner;
55pub(crate) mod browser_popup;
56pub(crate) mod browser_uploads;
57pub(crate) mod host_http;
58pub(crate) mod ui_handlers;
59pub(crate) mod ui_shortcuts;
60pub(crate) mod widget_access_handlers;
61pub(crate) mod widget_agent_handlers;
62pub(crate) mod widget_handlers;
63
64#[cfg(test)]
65pub(crate) mod tests;
66#[cfg(test)]
67mod rpc_schema_export;
68
69use std::sync::Arc;
70
71use axum::{
72    body::Body,
73    extract::{Extension, Query, Request, State},
74    http::{header, Method, StatusCode},
75    middleware::{self, Next},
76    response::{IntoResponse, Json, Response},
77    routing::{delete, get, patch, post},
78    Router,
79};
80use agentmux_common::secret_eq::secret_eq;
81use serde_json::json;
82use tower_http::cors::{Any, CorsLayer};
83
84use crate::backend::eventbus::EventBus;
85use crate::backend::lan_discovery::LanDiscoveryController;
86use crate::backend::lsp::LspSupervisor;
87use crate::backend::messagebus::MessageBus;
88use crate::backend::reactive::{Poller, ReactiveHandler};
89use crate::backend::storage::filestore::FileStore;
90use crate::backend::blockcontroller;
91use crate::backend::storage::store::Store;
92use crate::backend::history::HistoryService;
93use crate::backend::subagent_watcher::SubagentWatcher;
94use crate::backend::wconfig;
95use crate::backend::mps::Broker;
96use agentmux_common::api_types::{
97    PaneTitleRequest, PtyShellCreateRequest, PtyShellCreateResponse, PtyShellInputRequest,
98    PtyShellInputResponse, PtyShellReadRequest, PtyShellReadResponse, PtyShellResizeRequest,
99    PtyShellResizeResponse, PtyShellStatusRequest,
100    PtyShellStatusResponse, PtyShellStopRequest, PtyShellStopResponse, ShellCreateRequest,
101    ShellCreateResponse, ShellInputFailure, ShellInputRequest, ShellInputResponse,
102    ShellStatusRequest, ShellStatusResponse, ShellStopRequest, TabActivateRequest, TabNameRequest,
103    TabNewRequest, WindowFocusRequest, WindowNameRequest, WorkspaceNameRequest, WpsPublishRequest,
104};
105
106// ---- AppState ----
107
108mod state;
109mod routes;
110mod http_health;
111mod http_fleet;
112mod http_viewer;
113mod http_viewer_sysinfo;
114mod http_viewer_terminal;
115mod http_shell;
116mod http_pty_shell;
117mod http_open;
118mod http_app_api;
119mod http_self;
120mod http_naming;
121mod http_layout;
122mod auth;
123pub use state::*;
124pub use routes::*;
125pub use http_viewer::build_viewer_router;
126use http_health::*;
127use http_fleet::*;
128pub(crate) use http_shell::*;
129use http_pty_shell::*;
130use http_open::*;
131use http_app_api::*;
132use http_self::*;
133use http_naming::*;
134use http_layout::*;
135pub(crate) use auth::*;