codetether_rlm/result.rs
1//! RLM processing result type.
2
3use serde::{Deserialize, Serialize};
4
5/// RLM processing result.
6///
7/// `trace` is populated when the caller supplied a session bus so
8/// downstream consumers can reconstruct iteration-by-iteration
9/// behaviour. `trace_id` is always generated and echoed on the
10/// matching `RlmComplete` session event
11/// event for correlation.
12///
13/// # Examples
14///
15/// ```rust
16/// use codetether_rlm::{RlmResult, RlmStats};
17///
18/// let r = RlmResult {
19/// processed: "summary".into(),
20/// stats: RlmStats::default(),
21/// success: true,
22/// error: None,
23/// trace: None,
24/// trace_id: None,
25/// };
26/// assert!(r.success);
27/// assert!(r.trace.is_none());
28/// ```
29#[derive(Debug, Clone, Serialize, Deserialize)]
30pub struct RlmResult {
31 /// The final text produced by the loop (summary or answer).
32 pub processed: String,
33 /// Aggregate statistics for the run.
34 pub stats: super::RlmStats,
35 /// `true` when the loop converged within its iteration budget.
36 pub success: bool,
37 /// Populated when `success` is `false` — a short diagnostic.
38 pub error: Option<String>,
39 /// Optional per-iteration event trace.
40 #[serde(default, skip_serializing_if = "Option::is_none")]
41 pub trace: Option<super::context_trace::ContextTrace>,
42 /// Identifier echoed on the matching `RlmComplete` bus event.
43 #[serde(default, skip_serializing_if = "Option::is_none")]
44 pub trace_id: Option<uuid::Uuid>,
45}