agentmux_srv/server/
muxbus_hooks.rs1use std::sync::Arc;
8
9use agentmux_common::jekt_files::CloudFile;
10
11use crate::backend::reactive::handler::ReactiveHandler;
12use crate::backend::reactive::types::InjectionRequest;
13use crate::backend::storage::store::Store;
14use crate::muxbus::server_hooks::{BoxFuture, ServerHooks};
15
16struct Hooks;
17
18static HOOKS: Hooks = Hooks;
19
20pub(crate) fn hooks() -> &'static dyn ServerHooks {
22 &HOOKS
23}
24
25pub(crate) fn install() {
27 crate::muxbus::server_hooks::install(hooks());
28}
29
30impl ServerHooks for Hooks {
31 fn hold_wan_for_unavailable(&self, mstore: &Store, handler: &ReactiveHandler, req: &InjectionRequest) -> bool {
32 super::jekt_hold::hold_wan_for_unavailable(mstore, handler, req)
33 }
34
35 fn give_back_for_unavailable(&self, mstore: &Store, handler: &ReactiveHandler, req: &InjectionRequest) -> bool {
36 super::jekt_hold::give_back_for_unavailable(mstore, handler, req)
37 }
38
39 fn agent_unavailable(&self, mstore: &Store, handler: &ReactiveHandler, target: &str) -> bool {
40 super::jekt_hold::agent_unavailable(mstore, handler, target)
41 }
42
43 fn hold_relayed<'a>(&'a self, req: &'a InjectionRequest) -> BoxFuture<'a, bool> {
44 Box::pin(super::jekt_cold::hold_relayed(req))
45 }
46
47 fn settle_files(&self, req: &InjectionRequest, delivered: bool) {
48 super::jekt_files::settle(req, delivered);
49 }
50
51 fn resolve_transcript_request_tier_fields(&self, mstore: &Arc<Store>, req: &mut InjectionRequest) {
52 super::reactive::resolve_transcript_request_tier_fields(mstore, req);
53 }
54
55 fn fetch_files<'a>(
56 &'a self,
57 base: &'a str,
58 http: &'a reqwest::Client,
59 token: &'a str,
60 agent_id: &'a str,
61 req: &'a mut InjectionRequest,
62 files: Vec<CloudFile>,
63 wan_msg_id: Option<&'a str>,
64 ) -> BoxFuture<'a, Result<(), String>> {
65 Box::pin(super::jekt_cloud::fetch(base, http, token, agent_id, req, files, wan_msg_id))
66 }
67
68 fn prepare_files<'a>(&'a self, req: &'a mut InjectionRequest) -> BoxFuture<'a, ()> {
69 Box::pin(super::jekt_files::prepare(req))
70 }
71}