meerkat_runtime/
service_ext.rs1use meerkat_core::lifecycle::InputId;
8use meerkat_core::types::SessionId;
9
10use crate::accept::AcceptOutcome;
11use crate::completion::CompletionHandle;
12use crate::input::Input;
13use crate::input_state::InputState;
14use crate::runtime_state::RuntimeState;
15use crate::traits::{ResetReport, RetireReport, RuntimeDriverError};
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq)]
21pub enum RuntimeMode {
22 V9Compliant,
24}
25
26#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
31#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
32pub trait SessionServiceRuntimeExt: Send + Sync {
33 fn runtime_mode(&self) -> RuntimeMode;
35
36 async fn accept_input(
38 &self,
39 session_id: &SessionId,
40 input: Input,
41 ) -> Result<AcceptOutcome, RuntimeDriverError>;
42
43 async fn accept_input_with_completion(
46 &self,
47 session_id: &SessionId,
48 input: Input,
49 ) -> Result<(AcceptOutcome, Option<CompletionHandle>), RuntimeDriverError>;
50
51 async fn runtime_state(
53 &self,
54 session_id: &SessionId,
55 ) -> Result<RuntimeState, RuntimeDriverError>;
56
57 async fn retire_runtime(
59 &self,
60 session_id: &SessionId,
61 ) -> Result<RetireReport, RuntimeDriverError>;
62
63 async fn reset_runtime(
65 &self,
66 session_id: &SessionId,
67 ) -> Result<ResetReport, RuntimeDriverError>;
68
69 async fn input_state(
71 &self,
72 session_id: &SessionId,
73 input_id: &InputId,
74 ) -> Result<Option<InputState>, RuntimeDriverError>;
75
76 async fn list_active_inputs(
78 &self,
79 session_id: &SessionId,
80 ) -> Result<Vec<InputId>, RuntimeDriverError>;
81}
82
83#[cfg(test)]
84mod tests {
85 use super::*;
86
87 fn _assert_object_safe(_: &dyn SessionServiceRuntimeExt) {}
89
90 #[test]
91 fn runtime_mode_equality() {
92 assert_eq!(RuntimeMode::V9Compliant, RuntimeMode::V9Compliant);
93 }
94}