pub struct Goal {
pub id: GoalId,
pub title: String,
pub summary: String,
pub status: GoalStatus,
pub owner: ActorRef,
pub metadata: Value,
}Fields§
§id: GoalId§title: String§summary: String§status: GoalStatus§owner: ActorRef§metadata: ValueImplementations§
Source§impl Goal
impl Goal
Sourcepub fn new(
id: GoalId,
title: impl Into<String>,
summary: impl Into<String>,
owner: ActorRef,
) -> Self
pub fn new( id: GoalId, title: impl Into<String>, summary: impl Into<String>, owner: ActorRef, ) -> Self
Examples found in repository?
examples/goal_lineage.rs (lines 14-19)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 let actor = ActorRef::agent("yoyo-evolve");
10 let state = YoAgentState::load(MemoryEventStore::new()).await?;
11
12 let goal = Goal {
13 status: GoalStatus::InProgress,
14 ..Goal::new(
15 GoalId::new("goal_retry_reliability"),
16 "Make retry behavior reliable",
17 "Retry attempts should survive timeout cancellation.",
18 actor.clone(),
19 )
20 };
21 state.record_goal(goal).await?;
22
23 let task = Task {
24 id: TaskId::new("task_retry_timeout"),
25 title: "Fix timeout retry state".to_string(),
26 summary: "Investigate and patch retry state loss.".to_string(),
27 status: TaskStatus::InProgress,
28 goal: Some(GoalId::new("goal_retry_reliability")),
29 created_by: actor.clone(),
30 metadata: json!({}),
31 };
32 state.record_task(task).await?;
33
34 let failure = NodeId::new("failure_retry_timeout");
35 state
36 .record_failure(
37 actor.clone(),
38 failure.clone(),
39 "retry timeout loses state",
40 "The next attempt starts from zero after cancellation.",
41 )
42 .await?;
43 state
44 .link(
45 actor.clone(),
46 failure.clone(),
47 yoagent_state::REL_BLOCKS,
48 NodeId::new("goal_retry_reliability"),
49 )
50 .await?;
51
52 let patch_id = PatchId::new("patch_retry_state");
53 let mut patch = StatePatch::new(
54 patch_id.clone(),
55 "Persist retry state",
56 "Keep attempt count outside the cancelled future.",
57 actor.clone(),
58 );
59 patch.evidence.push(failure);
60 patch.expected_effects.push(ExpectedEffect::TestPasses {
61 name: "tool_retry_survives_timeout".to_string(),
62 });
63 patch.artifacts.push(ArtifactRef::new(
64 "git.diff",
65 "file://.yoyo/artifacts/patch_retry_state.diff",
66 ));
67 state.propose_patch(patch).await?;
68 state
69 .link(
70 actor.clone(),
71 NodeId::new(patch_id.0.clone()),
72 yoagent_state::REL_ADVANCES,
73 NodeId::new("goal_retry_reliability"),
74 )
75 .await?;
76 state
77 .record_eval_result(
78 actor,
79 NodeId::new("eval_retry_timeout"),
80 patch_id.clone(),
81 "cargo test tool_retry_survives_timeout",
82 true,
83 )
84 .await?;
85 state
86 .update_patch_status(
87 patch_id,
88 PatchStatus::Promoted,
89 Some("eval passed".to_string()),
90 )
91 .await?;
92
93 print!(
94 "{}",
95 state
96 .lineage(NodeId::new("goal_retry_reliability"))
97 .await
98 .to_markdown()
99 );
100 Ok(())
101}Trait Implementations§
Source§impl<'de> Deserialize<'de> for Goal
impl<'de> Deserialize<'de> for Goal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Goal
Auto Trait Implementations§
impl Freeze for Goal
impl RefUnwindSafe for Goal
impl Send for Goal
impl Sync for Goal
impl Unpin for Goal
impl UnsafeUnpin for Goal
impl UnwindSafe for Goal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more