pub struct YoAgentState<S: EventStore> { /* private fields */ }Implementations§
Source§impl<S: EventStore> YoAgentState<S>
impl<S: EventStore> YoAgentState<S>
pub async fn load(store: S) -> Result<Self, StateError>
pub fn store(&self) -> Arc<S>
Sourcepub async fn record_event(&self, event: Event) -> Result<EventId, StateError>
pub async fn record_event(&self, event: Event) -> Result<EventId, StateError>
Append one event. Events recorded without an explicit causation_id
while a run is open (between record_run_started and
record_run_finished) are chained to the run’s start event. Provided
all activity happens inside runs within a single process lifetime,
this keeps the causation graph rooted at *.created / *.started —
events recorded with no open run become roots of whatever kind they
are, and the open-run marker is not recovered by load.
pub async fn apply_ops( &self, actor: ActorRef, ops: Vec<StateOp>, ) -> Result<EventId, StateError>
Sourcepub async fn apply_ops_caused_by(
&self,
actor: ActorRef,
ops: Vec<StateOp>,
caused_by: Option<EventId>,
) -> Result<EventId, StateError>
pub async fn apply_ops_caused_by( &self, actor: ActorRef, ops: Vec<StateOp>, caused_by: Option<EventId>, ) -> Result<EventId, StateError>
Append a state.ops_applied event carrying the domain event that caused
it, per the GASP pairing rule: ops that materialize a domain event set
causation_id to that event’s id, keeping the audit layer and the
folded graph mechanically linked.
pub async fn propose_patch( &self, patch: StatePatch, ) -> Result<PatchId, StateError>
pub async fn update_patch_status( &self, patch_id: PatchId, status: PatchStatus, reason: Option<String>, ) -> Result<EventId, StateError>
pub async fn attach_artifact( &self, node_id: NodeId, artifact: ArtifactRef, ) -> Result<EventId, StateError>
pub async fn graph(&self) -> GraphSnapshot
pub async fn get_node(&self, node_id: NodeId) -> Option<Node>
pub async fn outgoing( &self, node_id: NodeId, rel: Option<&str>, ) -> Vec<Relation>
pub async fn incoming( &self, node_id: NodeId, rel: Option<&str>, ) -> Vec<Relation>
pub async fn patches_for_failure(&self, failure_id: NodeId) -> Vec<Node>
pub async fn evals_for_patch(&self, patch_id: PatchId) -> Vec<Node>
pub async fn lineage(&self, node_id: NodeId) -> Lineage
pub async fn record_run_started( &self, actor: ActorRef, run_id: RunId, task: impl Into<String>, ) -> Result<EventId, StateError>
pub async fn record_run_finished( &self, actor: ActorRef, run_id: RunId, outcome: impl Into<String>, ) -> Result<EventId, StateError>
pub async fn record_goal(&self, goal: Goal) -> Result<EventId, StateError>
pub async fn update_goal_status( &self, goal_id: GoalId, status: GoalStatus, reason: Option<String>, ) -> Result<EventId, StateError>
pub async fn record_task(&self, task: Task) -> Result<EventId, StateError>
pub async fn update_task_status( &self, task_id: TaskId, status: TaskStatus, reason: Option<String>, ) -> Result<EventId, StateError>
pub async fn record_observation( &self, actor: ActorRef, observation: Observation, ) -> Result<EventId, StateError>
pub async fn record_hypothesis( &self, actor: ActorRef, hypothesis: Hypothesis, explains: Option<NodeId>, ) -> Result<EventId, StateError>
pub async fn record_failure( &self, actor: ActorRef, failure_id: NodeId, title: impl Into<String>, summary: impl Into<String>, ) -> Result<EventId, StateError>
pub async fn record_eval_result( &self, actor: ActorRef, eval_id: NodeId, patch_id: PatchId, command: impl Into<String>, passed: bool, ) -> Result<EventId, StateError>
pub async fn record_eval( &self, actor: ActorRef, eval: EvalResult, patch_id: Option<PatchId>, ) -> Result<EventId, StateError>
pub async fn record_decision( &self, actor: ActorRef, decision_id: NodeId, patch_id: PatchId, approved: bool, reason: impl Into<String>, ) -> Result<EventId, StateError>
pub async fn record_decision_node( &self, actor: ActorRef, decision: Decision, target: Option<NodeId>, ) -> Result<EventId, StateError>
pub async fn record_project_snapshot( &self, actor: ActorRef, snapshot: ProjectSnapshot, ) -> Result<EventId, StateError>
pub async fn record_model_call( &self, actor: ActorRef, call: ModelCall, ) -> Result<EventId, StateError>
pub async fn record_tool_call( &self, actor: ActorRef, call: ToolCall, ) -> Result<EventId, StateError>
pub async fn record_frame( &self, actor: ActorRef, frame: Frame, ) -> Result<EventId, StateError>
pub async fn link( &self, actor: ActorRef, from: NodeId, rel: impl Into<String>, to: NodeId, ) -> Result<EventId, StateError>
pub async fn fork_at_event( &self, fork_id: ForkId, parent_event: Option<EventId>, ) -> Result<ForkSnapshot, StateError>
pub async fn diff_with(&self, other: &Graph) -> GraphDiff
Trait Implementations§
Source§impl<S: EventStore> Clone for YoAgentState<S>
impl<S: EventStore> Clone for YoAgentState<S>
Auto Trait Implementations§
impl<S> !RefUnwindSafe for YoAgentState<S>
impl<S> !UnwindSafe for YoAgentState<S>
impl<S> Freeze for YoAgentState<S>
impl<S> Send for YoAgentState<S>
impl<S> Sync for YoAgentState<S>
impl<S> Unpin for YoAgentState<S>
impl<S> UnsafeUnpin for YoAgentState<S>
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