60 lines
1.6 KiB
Rust
60 lines
1.6 KiB
Rust
pub mod client;
|
|
mod event_hub;
|
|
pub mod schema;
|
|
mod server;
|
|
mod status;
|
|
mod subscriptions;
|
|
mod wait;
|
|
|
|
pub use event_hub::EventHub;
|
|
pub use server::{start_server, start_server_with_capabilities, ServerHandle};
|
|
pub use status::{read_runtime_status_at, RuntimeStatus};
|
|
|
|
use std::path::PathBuf;
|
|
|
|
use tokio::sync::mpsc;
|
|
|
|
use crate::api::schema::{Method, Request};
|
|
|
|
pub const SOCKET_PATH_ENV_VAR: &str = "HERDR_SOCKET_PATH";
|
|
|
|
pub(crate) fn request_changes_ui(request: &Request) -> bool {
|
|
matches!(
|
|
&request.method,
|
|
Method::ServerReloadConfig(_)
|
|
| Method::WorkspaceCreate(_)
|
|
| Method::WorkspaceFocus(_)
|
|
| Method::WorkspaceRename(_)
|
|
| Method::WorkspaceClose(_)
|
|
| Method::WorktreeCreate(_)
|
|
| Method::WorktreeOpen(_)
|
|
| Method::WorktreeRemove(_)
|
|
| Method::TabCreate(_)
|
|
| Method::TabFocus(_)
|
|
| Method::TabRename(_)
|
|
| Method::TabClose(_)
|
|
| Method::AgentRename(_)
|
|
| Method::AgentFocus(_)
|
|
| Method::AgentStart(_)
|
|
| Method::PaneSplit(_)
|
|
| Method::PaneRename(_)
|
|
| Method::PaneReportAgent(_)
|
|
| Method::PaneReportAgentSession(_)
|
|
| Method::PaneReportMetadata(_)
|
|
| Method::PaneClearAgentAuthority(_)
|
|
| Method::PaneReleaseAgent(_)
|
|
| Method::PaneClose(_)
|
|
)
|
|
}
|
|
|
|
pub struct ApiRequestMessage {
|
|
pub request: Request,
|
|
pub respond_to: std::sync::mpsc::Sender<String>,
|
|
}
|
|
|
|
pub type ApiRequestSender = mpsc::UnboundedSender<ApiRequestMessage>;
|
|
|
|
pub fn socket_path() -> PathBuf {
|
|
crate::session::active_api_socket_path()
|
|
}
|