Skip to main content

YoAgentState

Struct YoAgentState 

Source
pub struct YoAgentState<S: EventStore> { /* private fields */ }

Implementations§

Source§

impl<S: EventStore> YoAgentState<S>

Source

pub async fn load(store: S) -> Result<Self, StateError>

Source

pub fn store(&self) -> Arc<S>

Source

pub async fn resume_open_run(&self) -> Result<Option<RunId>, StateError>

Recover the open-run marker from the committed log: the last run.started with no matching run.finished becomes the current run, so auto-chaining and correlation continue across process boundaries (load itself never sets the marker — readers stay side-effect free). Returns the resumed run id, or None when every run is closed.

Source

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, and events without an explicit correlation_id are correlated to the run’s id. 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 carry no run correlation, and the open-run marker is not recovered by load.

Source

pub async fn apply_ops( &self, actor: ActorRef, ops: Vec<StateOp>, ) -> Result<EventId, StateError>

Source

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.

Source

pub async fn propose_patch( &self, patch: StatePatch, ) -> Result<PatchId, StateError>

Source

pub async fn update_patch_status( &self, patch_id: PatchId, status: PatchStatus, reason: Option<String>, ) -> Result<EventId, StateError>

Source

pub async fn attach_artifact( &self, node_id: NodeId, artifact: ArtifactRef, ) -> Result<EventId, StateError>

Source

pub async fn graph(&self) -> GraphSnapshot

Source

pub async fn get_node(&self, node_id: NodeId) -> Option<Node>

Source

pub async fn outgoing( &self, node_id: NodeId, rel: Option<&str>, ) -> Vec<Relation>

Source

pub async fn incoming( &self, node_id: NodeId, rel: Option<&str>, ) -> Vec<Relation>

Source

pub async fn related(&self, node_id: NodeId) -> Vec<Relation>

Source

pub async fn patches_for_failure(&self, failure_id: NodeId) -> Vec<Node>

Source

pub async fn evals_for_patch(&self, patch_id: PatchId) -> Vec<Node>

Source

pub async fn lineage(&self, node_id: NodeId) -> Lineage

Source

pub async fn record_run_started( &self, actor: ActorRef, run_id: RunId, task: impl Into<String>, ) -> Result<EventId, StateError>

Source

pub async fn record_run_finished( &self, actor: ActorRef, run_id: RunId, outcome: impl Into<String>, ) -> Result<EventId, StateError>

Source

pub async fn record_goal(&self, goal: Goal) -> Result<EventId, StateError>

Source

pub async fn update_goal_status( &self, goal_id: GoalId, status: GoalStatus, reason: Option<String>, ) -> Result<EventId, StateError>

Source

pub async fn record_task(&self, task: Task) -> Result<EventId, StateError>

Source

pub async fn update_task_status( &self, task_id: TaskId, status: TaskStatus, reason: Option<String>, ) -> Result<EventId, StateError>

Source

pub async fn record_observation( &self, actor: ActorRef, observation: Observation, ) -> Result<EventId, StateError>

Source

pub async fn record_hypothesis( &self, actor: ActorRef, hypothesis: Hypothesis, explains: Option<NodeId>, ) -> Result<EventId, StateError>

Source

pub async fn record_failure( &self, actor: ActorRef, failure_id: NodeId, title: impl Into<String>, summary: impl Into<String>, ) -> Result<EventId, StateError>

Source

pub async fn record_eval_result( &self, actor: ActorRef, eval_id: NodeId, patch_id: PatchId, command: impl Into<String>, passed: bool, ) -> Result<EventId, StateError>

Source

pub async fn record_eval( &self, actor: ActorRef, eval: EvalResult, patch_id: Option<PatchId>, ) -> Result<EventId, StateError>

Source

pub async fn record_decision( &self, actor: ActorRef, decision_id: NodeId, patch_id: PatchId, approved: bool, reason: impl Into<String>, ) -> Result<EventId, StateError>

Source

pub async fn record_decision_node( &self, actor: ActorRef, decision: Decision, target: Option<NodeId>, ) -> Result<EventId, StateError>

Source

pub async fn record_project_snapshot( &self, actor: ActorRef, snapshot: ProjectSnapshot, ) -> Result<EventId, StateError>

Source

pub async fn record_model_call( &self, actor: ActorRef, call: ModelCall, ) -> Result<EventId, StateError>

Source

pub async fn record_tool_call( &self, actor: ActorRef, call: ToolCall, ) -> Result<EventId, StateError>

Source

pub async fn record_frame( &self, actor: ActorRef, frame: Frame, ) -> Result<EventId, StateError>

Source

pub async fn fork_at_event( &self, fork_id: ForkId, parent_event: Option<EventId>, ) -> Result<ForkSnapshot, StateError>

Source

pub async fn diff_with(&self, other: &Graph) -> GraphDiff

Trait Implementations§

Source§

impl<S: EventStore> Clone for YoAgentState<S>

Source§

fn clone(&self) -> Self

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<S: Debug + EventStore> Debug for YoAgentState<S>

Source§

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

Formats the value using the given formatter. Read more

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> 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> 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.