codetether_agent/rlm/
executor_bridge.rs1use anyhow::Result;
4use std::sync::Arc;
5
6use crate::provider::Provider;
7use crate::rlm::context_trace::{ContextTrace, ContextTraceSummary};
8use crate::rlm::oracle::TraceStep;
9use crate::rlm::{RlmAnalysisResult, RlmConfig};
10
11mod analysis;
12mod context;
13mod trace;
14
15pub struct RlmExecutor {
17 pub(super) context: String,
18 pub(super) provider: Arc<dyn Provider>,
19 pub(super) model: String,
20 pub(super) max_iterations: usize,
21 pub(super) trace_steps: Vec<TraceStep>,
22 pub(super) context_trace: ContextTrace,
23}
24
25impl RlmExecutor {
26 pub fn new(context: String, provider: Arc<dyn Provider>, model: String) -> Self {
28 Self {
29 context,
30 provider,
31 model,
32 max_iterations: RlmConfig::default().max_iterations,
33 trace_steps: Vec::new(),
34 context_trace: ContextTrace::new(32_768),
35 }
36 }
37
38 pub fn with_max_iterations(mut self, max: usize) -> Self {
40 self.max_iterations = max;
41 self
42 }
43
44 pub fn with_temperature(self, _temperature: f32) -> Self {
46 self
47 }
48
49 pub fn with_verbose(self, _verbose: bool) -> Self {
51 self
52 }
53
54 pub fn trace_steps(&self) -> &[TraceStep] {
56 &self.trace_steps
57 }
58
59 pub fn context_trace_summary(&self) -> ContextTraceSummary {
61 self.context_trace.summary()
62 }
63
64 pub async fn analyze(&mut self, query: &str) -> Result<RlmAnalysisResult> {
66 analysis::analyze(self, query).await
67 }
68}