Skip to main content

CodeMode

Struct CodeMode 

Source
pub struct CodeMode { /* private fields */ }
Expand description

Generic Code Mode lifecycle over interchangeable execution and storage adapters.

Implementations§

Source§

impl CodeMode

Source

pub fn new( store: Arc<dyn RuntimeStore>, executor: impl CodeExecutor + 'static, connectors: Vec<Arc<dyn Connector>>, ) -> Self

Creates a native Code Mode runtime using the system clock.

Source

pub fn with_artifact_store( store: Arc<dyn RuntimeStore>, artifacts: Arc<dyn ArtifactStore>, executor: impl CodeExecutor + 'static, connectors: Vec<Arc<dyn Connector>>, ) -> Self

Creates Code Mode with an explicit oversized-value artifact store.

Source

pub fn with_clock( store: Arc<dyn RuntimeStore>, executor: impl CodeExecutor + 'static, connectors: Vec<Arc<dyn Connector>>, clock: impl Clock + 'static, ) -> Self

Creates Code Mode with an explicit platform clock.

Source

pub fn with_clock_and_artifact_store( store: Arc<dyn RuntimeStore>, artifacts: Arc<dyn ArtifactStore>, executor: impl CodeExecutor + 'static, connectors: Vec<Arc<dyn Connector>>, clock: impl Clock + 'static, ) -> Self

Creates Code Mode with explicit platform clock and artifact storage.

Source

pub fn runtime(&self) -> Arc<CodeModeRuntime>

Returns the portable runtime for approvals, history, and snippets.

Source

pub async fn instructions(&self) -> Result<String, String>

Returns model-facing JavaScript declarations and connector guidance.

Source

pub async fn search(&self, query: &str) -> Result<SearchOutput, String>

Searches current connector methods and saved snippets.

Source

pub async fn execution( &self, execution_id: &str, ) -> Result<ExecutionState, String>

Returns one execution by identifier.

Source

pub async fn execution_snapshot( &self, execution_id: &str, ) -> Result<ExecutionState, String>

Returns one bounded execution snapshot with artifact references intact.

Source

pub async fn artifact( &self, execution_id: &str, artifact_id: &str, ) -> Result<Value, String>

Returns one oversized value owned by an execution.

Source

pub async fn events( &self, execution_id: &str, ) -> Result<Vec<ExecutionEvent>, String>

Returns ordered retained events for one execution.

Source

pub async fn cancel(&self, execution_id: &str) -> Result<ExecutionState, String>

Cancels a running or paused execution.

Source

pub async fn start(&self, code: &str) -> Result<ExecutionState, String>

Creates a durable running execution without driving its first pass.

Source

pub async fn execute(&self, code: &str) -> Result<ExecutionState, String>

Starts and drives a new execution until it completes, fails, or pauses.

Source

pub async fn execute_with( &self, code: &str, options: CodeModeRunOptions, ) -> Result<ExecutionState, String>

Starts and drives a new execution with transport request context.

Source

pub async fn resume(&self, execution_id: &str) -> Result<ExecutionState, String>

Resumes a paused execution and drives the next replay pass.

Source

pub async fn resume_with( &self, execution_id: &str, options: CodeModeRunOptions, ) -> Result<ExecutionState, String>

Resumes a paused execution with transport request context.

Source

pub async fn approve( &self, execution_id: &str, seq: u64, ) -> Result<ExecutionState, String>

Approves a pending action and resumes only if this call won the race.

Source

pub async fn approve_with( &self, execution_id: &str, seq: u64, options: CodeModeRunOptions, ) -> Result<ExecutionState, String>

Approves a pending action and resumes with transport request context.

Source

pub async fn reject( &self, execution_id: &str, seq: u64, ) -> Result<ExecutionState, String>

Rejects a pending action and notifies connector lifecycle hooks.

Source

pub async fn rollback( &self, execution_id: &str, ) -> Result<ExecutionState, String>

Compensates applied connector actions in reverse order.

Source

pub async fn expire(&self, max_age_ms: u64) -> Result<Vec<String>, String>

Expires stale live executions and releases connector resources.

Source

pub async fn dispatch(&self, request: DispatchRequest) -> Result<Value, String>

Handles one program-to-host dispatch request.

Source

pub async fn drive_with( &self, execution_id: &str, options: CodeModeRunOptions, ) -> Result<ExecutionState, String>

Drives one running execution pass with transport request context.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more