Skip to main content

Effect

Enum Effect 

Source
pub enum Effect<M: TurnProtocol = UnitTurnProtocol> {
    SyncExecutionSurface {
        id: EffectId,
        update_machine_config: bool,
    },
    LlmCall {
        id: EffectId,
        request: Arc<LlmRequest>,
    },
    CancelLlm {
        id: EffectId,
    },
    ToolCalls {
        id: EffectId,
        calls: Vec<PendingToolCall>,
    },
    ExecCode {
        id: EffectId,
        code: String,
    },
    Checkpoint {
        id: EffectId,
        checkpoint: CheckpointKind,
    },
    Log {
        event: LogEvent,
    },
    Emit(SessionEvent),
    Progress {
        messages: MessageSequence,
        event_delta: Vec<SessionEventRecord<M::Event>>,
        protocol_iteration: usize,
    },
    Done {
        messages: MessageSequence,
        event_delta: Vec<SessionEventRecord<M::Event>>,
        protocol_iteration: usize,
    },
}
Expand description

An effect the host must fulfil.

Variants§

§

SyncExecutionSurface

Sync the live execution surface before the turn proceeds.

update_machine_config is only needed after the turn has already advanced at least once and the host may need to swap in a refreshed system prompt or tool schema for the next protocol iteration. Initial syncs are host-only because the machine was already constructed from a fresh execution surface.

Fields

§update_machine_config: bool
§

LlmCall

Start an LLM call.

Fields

§request: Arc<LlmRequest>
§

CancelLlm

Cancel an in-progress LLM stream.

Fields

§

ToolCalls

Execute one or more driver-scheduled tool calls.

§

ExecCode

Execute a protocol-owned code block.

Fields

§code: String
§

Checkpoint

Run a host/plugin checkpoint before the machine continues or completes.

Fields

§checkpoint: CheckpointKind
§

Log

Host-implemented fire-and-forget logging.

Fields

§event: LogEvent
§

Emit(SessionEvent)

Fire-and-forget event (no response needed).

§

Progress

Prompt-history progress that may be durably persisted by the host.

This is separate from SessionEvent: UI stream events can be partial, duplicated, or display-only, while Progress is emitted only after the state machine has applied semantic message or protocol-step changes.

Fields

§event_delta: Vec<SessionEventRecord<M::Event>>
§protocol_iteration: usize
§

Done

Turn is done.

Fields

§event_delta: Vec<SessionEventRecord<M::Event>>
§protocol_iteration: usize

Trait Implementations§

Source§

impl<M: TurnProtocol> Clone for Effect<M>

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<M: Debug + TurnProtocol> Debug for Effect<M>
where M::Event: Debug,

Source§

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

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

impl<'de, M: TurnProtocol> Deserialize<'de> for Effect<M>

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<M: TurnProtocol> Serialize for Effect<M>

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

Auto Trait Implementations§

§

impl<M = UnitTurnProtocol> !Freeze for Effect<M>

§

impl<M = UnitTurnProtocol> !RefUnwindSafe for Effect<M>

§

impl<M = UnitTurnProtocol> !UnwindSafe for Effect<M>

§

impl<M> Send for Effect<M>

§

impl<M> Sync for Effect<M>

§

impl<M> Unpin for Effect<M>
where <M as TurnProtocol>::Event: Unpin,

§

impl<M> UnsafeUnpin for Effect<M>

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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.