blob: bd2983e42285c5cd412bdec325d9cf92fe98b230 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
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::ServerHandle;
pub(crate) use server::{api_method_name, start_server_with_stop_control};
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::ServerReloadAgentManifests(_)
| Method::NotificationShow(_)
| Method::ProductAnnouncementDismiss(_)
| Method::ReleaseNotesDismiss(_)
| Method::CommandInvoke(_)
| Method::WorkspaceCreate(_)
| Method::WorkspaceFocus(_)
| Method::WorkspaceRename(_)
| Method::WorkspaceMove(_)
| Method::WorkspaceMoveBlock(_)
| Method::WorkspaceReportMetadata(_)
| Method::WorkspaceClose(_)
| Method::WorktreeCreate(_)
| Method::WorktreeOpen(_)
| Method::WorktreeRemove(_)
| Method::TabCreate(_)
| Method::TabFocus(_)
| Method::TabRename(_)
| Method::TabMove(_)
| Method::TabClose(_)
| Method::LayoutApply(_)
| Method::LayoutSetSplitRatio(_)
| Method::AgentRename(_)
| Method::AgentViewSet(_)
| Method::AgentViewClear(_)
| Method::AgentFocus(_)
| Method::AgentStart(_)
| Method::AgentPrompt(_)
| Method::AgentSendKeys(_)
| Method::PaneSplit(_)
| Method::PaneSwap(_)
| Method::PaneMove(_)
| Method::PaneZoom(_)
| Method::PaneFocusDirection(_)
| Method::PaneResize(_)
| Method::PaneScroll(_)
| Method::PaneClear(_)
| Method::PaneEditScrollback(_)
| Method::PaneFocus(_)
| Method::PaneInputSet(_)
| Method::PaneRename(_)
| Method::PaneGraphicsSet(_)
| Method::PaneGraphicsClear(_)
| Method::PaneGraphicsStream(_)
| Method::PaneGraphicsStreamSet(_)
| Method::PaneGraphicsStreamDirect(_)
| Method::PaneGraphicsStreamOpen(_)
| Method::PaneGraphicsStreamClose(_)
| Method::PaneReportAgent(_)
| Method::PaneReportAgentSession(_)
| Method::PaneReportMetadata(_)
| Method::PaneClearAgentAuthority(_)
| Method::PaneReleaseAgent(_)
| Method::PaneClose(_)
| Method::PopupClose(_)
| Method::PluginUnlink(_)
| Method::PluginDisable(_)
| Method::PluginActionInvoke(_)
| Method::PluginPaneOpen(_)
| Method::PluginPaneFocus(_)
| Method::PluginPaneClose(_)
)
}
pub struct ApiRequestMessage {
pub request: Request,
pub respond_to: std::sync::mpsc::Sender<String>,
pub response_write_complete: Option<std::sync::mpsc::Receiver<()>>,
pub stream_active: Option<std::sync::Arc<std::sync::atomic::AtomicBool>>,
}
pub type ApiRequestSender = mpsc::UnboundedSender<ApiRequestMessage>;
pub fn socket_path() -> PathBuf {
crate::session::active_api_socket_path()
}
|