Skip to main content

IngressContext

Struct IngressContext 

pub struct IngressContext {
    pub message_id: Option<String>,
    pub source_class: SourceClass,
    pub sender: Option<String>,
    pub transport: Transport,
    pub trust: TrustClass,
    pub origin: TurnOrigin,
    pub internal_principal: Option<InternalPrincipal>,
}
Expand description

The envelope stamped by the entry layer; travels with the turn into the engine. See the module docs.

Fields§

§message_id: Option<String>

Stable inbound id (e.g. a ChannelMessage.id) — provenance + audit handle. None for id-less internal turns.

§source_class: SourceClass

Whether the turn is external or internally driven.

§sender: Option<String>

Platform user id / principal of the sender, if any.

§transport: Transport

The transport the turn arrived on.

§trust: TrustClass

The resolved trust class of the sender.

§origin: TurnOrigin

Who initiated the turn (see TurnOrigin). Serde-defaults to TurnOrigin::SubTurn so envelopes serialized before this field existed deserialize fail-closed (no origin-gated behavior).

§internal_principal: Option<InternalPrincipal>

The internal principal that initiated the turn, when the dispatching surface stamps one (see InternalPrincipal). None for external turns, for internal paths that have no principal contract yet, and for envelopes serialized before this field existed (serde-defaults fail-closed to absent).

Implementations§

Source§

impl IngressContext

Source

pub fn interactive() -> Self

Envelope for an interactive operator turn (CLI chat loop, one-shot run).

Source

pub fn channel() -> Self

Envelope for a turn the channel orchestrator dispatches for a channel peer. Keeps the placeholder source/transport/trust; the real channel transport identity is not stamped at the edge yet.

Source

pub fn cron() -> Self

Envelope for a scheduled cron job turn.

Source

pub fn daemon() -> Self

Envelope for a daemon-initiated turn (heartbeat task pipeline).

Source

pub fn agent_direct() -> Self

Envelope for a direct embedded Agent::turn call.

Source

pub fn sub_turn() -> Self

Envelope for a nested sub-turn inside a parent turn (delegate subagent, safety net, skills review). Sub-turns never receive origin-gated behavior such as context injection.

Source

pub fn from_origin(origin: TurnOrigin) -> Self

Envelope for a turn whose origin is threaded in from the entry point (e.g. agent::run / process_message, whose one body serves several distinct entries: CLI, cron, daemon, subagent spawn). Equivalent to the per-origin constructors above.

Source

pub fn from_parts( origin: TurnOrigin, internal_principal: Option<InternalPrincipal>, ) -> Self

Envelope for a turn whose origin and (optional) internal principal are both threaded in from the entry point. With None this is exactly IngressContext::from_origin.

Source

pub fn cron_job(job_id: impl Into<String>, job_name: Option<String>) -> Self

Envelope for a scheduled cron job turn stamped with its initiating job. The principal is resolved from the job’s stored config at dispatch and is immutable for the turn’s lifetime.

Source

pub fn peer_agent(sender_alias: impl Into<String>) -> Self

Envelope for a peer-agent dispatch stamped with the sending agent’s canonical alias — the initiator; the recipient turn still executes under the recipient’s own alias.

Source

pub fn daemon_task(task: impl Into<String>) -> Self

Envelope for a daemon-driven turn stamped with a runtime-owned task identifier (never model-authored text).

Trait Implementations§

Source§

impl Clone for IngressContext

Source§

fn clone(&self) -> IngressContext

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for IngressContext

Source§

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

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

impl<'de> Deserialize<'de> for IngressContext

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 Eq for IngressContext

Source§

impl PartialEq for IngressContext

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · §

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

Inequality operator !=. Read more
Source§

impl Serialize for IngressContext

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 IngressContext

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