Skip to main content

hyprstream_core/services/
generated.rs

1//! RPC surface used by the AGPL daemon.
2//!
3//! Public contracts and clients are generated once by the Apache-2.0
4//! `hyprstream-rpc-std` crate. This module invokes the server-only generator
5//! for the daemon's handlers only. Client/data consumers must import the
6//! canonical `hyprstream_rpc_std` modules directly.
7
8pub mod model_client {
9    #![allow(dead_code, unused_imports, unused_variables)]
10    #![allow(clippy::all)]
11    hyprstream_rpc_derive::generate_rpc_server!(
12        "model",
13        types_crate = hyprstream_rpc_std,
14        scope_handlers,
15    );
16
17    /// Send the canonical Model health request and retain its typed response.
18    ///
19    /// The generated `health_check` convenience method turns `ErrorInfo` into
20    /// an untyped error. OAI startup needs to distinguish one authenticated
21    /// Model denial from local transport and response-verification failures,
22    /// so this narrow helper keeps the method-bound call and parses the
23    /// already-verified response bytes without changing shared code generation.
24    pub(crate) async fn verified_health_check_response(
25        client: &hyprstream_rpc_std::model_client::ModelClient,
26    ) -> anyhow::Result<hyprstream_rpc_std::model_client::ModelResponseVariant> {
27        const HEALTH_CHECK_METHOD: u16 = 3;
28
29        let request_id = client.next_id();
30        let payload = hyprstream_rpc::serialize_message(|message| {
31            let mut request =
32                message.init_root::<hyprstream_rpc_std::model_capnp::model_request::Builder>();
33            request.set_id(request_id);
34            request.set_health_check(());
35        })?;
36        let response = client
37            .call_with_method(HEALTH_CHECK_METHOD, payload)
38            .await?;
39        hyprstream_rpc_std::model_client::ModelClient::parse_response(&response)
40    }
41}
42
43pub mod registry_client {
44    #![allow(dead_code, unused_imports, unused_variables)]
45    #![allow(clippy::all)]
46    hyprstream_rpc_derive::generate_rpc_server!(
47        "registry",
48        types_crate = hyprstream_rpc_std,
49        scope_handlers,
50    );
51}
52
53pub mod policy_client {
54    #![allow(dead_code, unused_imports, unused_variables)]
55    #![allow(clippy::all)]
56    hyprstream_rpc_derive::generate_rpc_server!(
57        "policy",
58        types_crate = hyprstream_rpc_std,
59        scope_handlers,
60    );
61}
62
63pub mod inference_client {
64    #![allow(dead_code, unused_imports, unused_variables)]
65    #![allow(clippy::all)]
66    hyprstream_rpc_derive::generate_rpc_server!(
67        "inference",
68        types_crate = hyprstream_rpc_std,
69        scope_handlers,
70    );
71}
72
73pub mod mcp_client {
74    #![allow(dead_code, unused_imports, unused_variables)]
75    #![allow(clippy::all)]
76    hyprstream_rpc_derive::generate_rpc_server!(
77        "mcp",
78        types_crate = hyprstream_rpc_std,
79        scope_handlers,
80    );
81}
82
83pub mod tui_client {
84    #![allow(dead_code, unused_imports, unused_variables)]
85    #![allow(clippy::all)]
86    hyprstream_rpc_derive::generate_rpc_server!(
87        "tui",
88        types_crate = hyprstream_rpc_std,
89        scope_handlers,
90    );
91}
92
93pub mod metrics_client {
94    #![allow(dead_code, unused_imports, unused_variables)]
95    #![allow(clippy::all)]
96    hyprstream_rpc_derive::generate_rpc_server!(
97        "metrics",
98        types_crate = hyprstream_rpc_std,
99        scope_handlers,
100    );
101}
102
103pub mod oauth_client {
104    #![allow(dead_code, unused_imports, unused_variables)]
105    #![allow(clippy::all)]
106    hyprstream_rpc_derive::generate_rpc_server!(
107        "oauth",
108        types_crate = hyprstream_rpc_std,
109        scope_handlers,
110    );
111}