Skip to main content

ArtifactRef

Struct ArtifactRef 

Source
pub struct ArtifactRef {
    pub kind: String,
    pub uri: String,
    pub hash: Option<String>,
    pub summary: Option<String>,
    pub metadata: Value,
}

Fields§

§kind: String§uri: String§hash: Option<String>§summary: Option<String>§metadata: Value

Implementations§

Source§

impl ArtifactRef

Source

pub fn new(kind: impl Into<String>, uri: impl Into<String>) -> Self

Examples found in repository?
examples/patch_eval_decision.rs (line 37)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9    let state = YoAgentState::load(MemoryEventStore::new()).await?;
10    let actor = ActorRef::agent("yoyo-evolve");
11
12    let failure = NodeId::new("failure_17");
13    state
14        .record_failure(
15            actor.clone(),
16            failure.clone(),
17            "tool_retry_survives_timeout fails",
18            "Retry state is lost when timeout cancels the future.",
19        )
20        .await?;
21
22    let patch_id = PatchId::new("patch_42");
23    let mut patch = StatePatch::new(
24        patch_id.clone(),
25        "Persist retry state across timeout",
26        "Add RetryState and keep attempt count outside the cancelled future.",
27        actor.clone(),
28    );
29    patch.evidence.push(failure);
30    patch.preconditions.push(Precondition::TestStillFailing {
31        name: "tool_retry_survives_timeout".to_string(),
32    });
33    patch.expected_effects.push(ExpectedEffect::TestPasses {
34        name: "tool_retry_survives_timeout".to_string(),
35    });
36    patch.artifacts.push(
37        ArtifactRef::new("git.diff", "file://.yoyo/artifacts/patch_42.diff")
38            .with_summary("Fix retry persistence and add timeout regression test")
39            .with_metadata(json!({
40                "base_commit": "abc123",
41                "files_changed": [
42                    "crates/yoagent-runtime/src/tool.rs",
43                    "crates/yoagent-runtime/tests/retry.rs"
44                ]
45            })),
46    );
47
48    state.propose_patch(patch).await?;
49    state
50        .record_eval_result(
51            actor,
52            NodeId::new("eval_55"),
53            patch_id.clone(),
54            "cargo test tool_retry_survives_timeout",
55            true,
56        )
57        .await?;
58    state
59        .record_decision(
60            ActorRef::user("yuanhao"),
61            NodeId::new("decision_9"),
62            patch_id.clone(),
63            true,
64            "Eval passed; approve promotion",
65        )
66        .await?;
67    state
68        .update_patch_status(
69            patch_id.clone(),
70            PatchStatus::Approved,
71            Some("Eval passed".to_string()),
72        )
73        .await?;
74    state
75        .update_patch_status(
76            patch_id.clone(),
77            PatchStatus::Promoted,
78            Some("Promoted as commit def456".to_string()),
79        )
80        .await?;
81
82    print!(
83        "{}",
84        state.lineage(NodeId::new(patch_id.0)).await.to_markdown()
85    );
86    Ok(())
87}
More examples
Hide additional examples
examples/goal_lineage.rs (lines 63-66)
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}
Source

pub fn with_hash(self, hash: impl Into<String>) -> Self

Source

pub fn with_summary(self, summary: impl Into<String>) -> Self

Examples found in repository?
examples/patch_eval_decision.rs (line 38)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9    let state = YoAgentState::load(MemoryEventStore::new()).await?;
10    let actor = ActorRef::agent("yoyo-evolve");
11
12    let failure = NodeId::new("failure_17");
13    state
14        .record_failure(
15            actor.clone(),
16            failure.clone(),
17            "tool_retry_survives_timeout fails",
18            "Retry state is lost when timeout cancels the future.",
19        )
20        .await?;
21
22    let patch_id = PatchId::new("patch_42");
23    let mut patch = StatePatch::new(
24        patch_id.clone(),
25        "Persist retry state across timeout",
26        "Add RetryState and keep attempt count outside the cancelled future.",
27        actor.clone(),
28    );
29    patch.evidence.push(failure);
30    patch.preconditions.push(Precondition::TestStillFailing {
31        name: "tool_retry_survives_timeout".to_string(),
32    });
33    patch.expected_effects.push(ExpectedEffect::TestPasses {
34        name: "tool_retry_survives_timeout".to_string(),
35    });
36    patch.artifacts.push(
37        ArtifactRef::new("git.diff", "file://.yoyo/artifacts/patch_42.diff")
38            .with_summary("Fix retry persistence and add timeout regression test")
39            .with_metadata(json!({
40                "base_commit": "abc123",
41                "files_changed": [
42                    "crates/yoagent-runtime/src/tool.rs",
43                    "crates/yoagent-runtime/tests/retry.rs"
44                ]
45            })),
46    );
47
48    state.propose_patch(patch).await?;
49    state
50        .record_eval_result(
51            actor,
52            NodeId::new("eval_55"),
53            patch_id.clone(),
54            "cargo test tool_retry_survives_timeout",
55            true,
56        )
57        .await?;
58    state
59        .record_decision(
60            ActorRef::user("yuanhao"),
61            NodeId::new("decision_9"),
62            patch_id.clone(),
63            true,
64            "Eval passed; approve promotion",
65        )
66        .await?;
67    state
68        .update_patch_status(
69            patch_id.clone(),
70            PatchStatus::Approved,
71            Some("Eval passed".to_string()),
72        )
73        .await?;
74    state
75        .update_patch_status(
76            patch_id.clone(),
77            PatchStatus::Promoted,
78            Some("Promoted as commit def456".to_string()),
79        )
80        .await?;
81
82    print!(
83        "{}",
84        state.lineage(NodeId::new(patch_id.0)).await.to_markdown()
85    );
86    Ok(())
87}
Source

pub fn with_metadata(self, metadata: JsonValue) -> Self

Examples found in repository?
examples/patch_eval_decision.rs (lines 39-45)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9    let state = YoAgentState::load(MemoryEventStore::new()).await?;
10    let actor = ActorRef::agent("yoyo-evolve");
11
12    let failure = NodeId::new("failure_17");
13    state
14        .record_failure(
15            actor.clone(),
16            failure.clone(),
17            "tool_retry_survives_timeout fails",
18            "Retry state is lost when timeout cancels the future.",
19        )
20        .await?;
21
22    let patch_id = PatchId::new("patch_42");
23    let mut patch = StatePatch::new(
24        patch_id.clone(),
25        "Persist retry state across timeout",
26        "Add RetryState and keep attempt count outside the cancelled future.",
27        actor.clone(),
28    );
29    patch.evidence.push(failure);
30    patch.preconditions.push(Precondition::TestStillFailing {
31        name: "tool_retry_survives_timeout".to_string(),
32    });
33    patch.expected_effects.push(ExpectedEffect::TestPasses {
34        name: "tool_retry_survives_timeout".to_string(),
35    });
36    patch.artifacts.push(
37        ArtifactRef::new("git.diff", "file://.yoyo/artifacts/patch_42.diff")
38            .with_summary("Fix retry persistence and add timeout regression test")
39            .with_metadata(json!({
40                "base_commit": "abc123",
41                "files_changed": [
42                    "crates/yoagent-runtime/src/tool.rs",
43                    "crates/yoagent-runtime/tests/retry.rs"
44                ]
45            })),
46    );
47
48    state.propose_patch(patch).await?;
49    state
50        .record_eval_result(
51            actor,
52            NodeId::new("eval_55"),
53            patch_id.clone(),
54            "cargo test tool_retry_survives_timeout",
55            true,
56        )
57        .await?;
58    state
59        .record_decision(
60            ActorRef::user("yuanhao"),
61            NodeId::new("decision_9"),
62            patch_id.clone(),
63            true,
64            "Eval passed; approve promotion",
65        )
66        .await?;
67    state
68        .update_patch_status(
69            patch_id.clone(),
70            PatchStatus::Approved,
71            Some("Eval passed".to_string()),
72        )
73        .await?;
74    state
75        .update_patch_status(
76            patch_id.clone(),
77            PatchStatus::Promoted,
78            Some("Promoted as commit def456".to_string()),
79        )
80        .await?;
81
82    print!(
83        "{}",
84        state.lineage(NodeId::new(patch_id.0)).await.to_markdown()
85    );
86    Ok(())
87}

Trait Implementations§

Source§

impl Clone for ArtifactRef

Source§

fn clone(&self) -> ArtifactRef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ArtifactRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ArtifactRef

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ArtifactRef

Source§

fn eq(&self, other: &ArtifactRef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ArtifactRef

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ArtifactRef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.