ras_agent/domain/
agent_output.rs1use ras_types::ActionName;
2use serde::{Deserialize, Deserializer, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct AgentBrain {
6 #[serde(default, deserialize_with = "null_to_empty")]
7 pub evaluation_previous_goal: String,
8 #[serde(default, deserialize_with = "null_to_empty")]
9 pub memory: String,
10 #[serde(default, deserialize_with = "null_to_empty")]
11 pub next_goal: String,
12}
13
14fn null_to_empty<'de, D>(de: D) -> Result<String, D::Error>
15where
16 D: Deserializer<'de>,
17{
18 use serde_json::Value;
19 let v = Value::deserialize(de)?;
20 Ok(match v {
21 Value::Null => String::new(),
22 Value::String(s) => s,
23 other => other.to_string(),
24 })
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct PlanItem {
29 pub step: u32,
30 pub description: String,
31 pub completed: bool,
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct AgentOutput {
36 pub current_state: AgentBrain,
37 pub action: Vec<ActionInvocation>,
38 pub plan: Option<Vec<PlanItem>>,
39 pub current_plan_item: Option<u32>,
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
43pub struct ActionInvocation {
44 pub name: ActionName,
45 pub parameters: serde_json::Value,
46}