Skip to main content

codetether_agent/rlm/router/
context.rs

1//! Context types matching the original API so call sites are unchanged.
2//!
3//! `AutoProcessContext` keeps the same concrete fields (`Arc<dyn Provider>`,
4//! `Option<SessionBus>`, etc.) so every existing construction site compiles
5//! without modification.
6
7use std::sync::Arc;
8use uuid::Uuid;
9
10use crate::provider::Provider;
11use crate::session::SessionBus;
12
13/// Progress tick during RLM auto-processing.
14pub use codetether_rlm::router::ProcessProgress;
15
16/// Context for a routing decision.
17pub use codetether_rlm::router::RoutingContext;
18
19/// Outcome of a routing decision.
20pub use codetether_rlm::router::RoutingResult;
21
22/// Context for auto-processing — concrete host types.
23///
24/// Thinly mirrors the crate's internal `CrateAutoProcessContext` but
25/// holds the concrete `Provider` and `SessionBus` so downstream code
26/// (session helpers, compression) doesn't need trait-object wrapping.
27pub struct AutoProcessContext<'a> {
28    pub tool_id: &'a str,
29    pub tool_args: serde_json::Value,
30    pub session_id: &'a str,
31    pub abort: Option<tokio::sync::watch::Receiver<bool>>,
32    pub on_progress: Option<Box<dyn Fn(ProcessProgress) + Send + Sync>>,
33    pub provider: Arc<dyn Provider>,
34    pub model: String,
35    pub bus: Option<SessionBus>,
36    pub trace_id: Option<Uuid>,
37    pub subcall_provider: Option<Arc<dyn Provider>>,
38    pub subcall_model: Option<String>,
39}