pub struct AgentContextMiddleware { /* private fields */ }Expand description
SpawnerLayer that materializes an AgentContextView from ctx
(after merging in the BP-declared agent-context supply tiers — see the
module doc), snapshots it into engine state (Worker axis source), and
stashes the serialized view into ctx.meta.runtime[AGENT_CONTEXT_KEY]
(Spawner axis source) before delegating to inner.
Implementations§
Source§impl AgentContextMiddleware
impl AgentContextMiddleware
Sourcepub fn new(
global_ctx: Option<Value>,
per_agent_ctx: HashMap<String, Value>,
default_policy: Option<ContextPolicy>,
per_agent_policy: HashMap<String, ContextPolicy>,
) -> Self
pub fn new( global_ctx: Option<Value>, per_agent_ctx: HashMap<String, Value>, default_policy: Option<ContextPolicy>, per_agent_policy: HashMap<String, ContextPolicy>, ) -> Self
Wraps the 4-piece agent-context supply state derived at launch time
(service::task_launch::derive_agent_ctx /
derive_context_policies) to apply on every spawn.
Trait Implementations§
Source§impl Default for AgentContextMiddleware
impl Default for AgentContextMiddleware
Source§impl SpawnerLayer for AgentContextMiddleware
impl SpawnerLayer for AgentContextMiddleware
Source§fn wrap(&self, inner: Arc<dyn SpawnerAdapter>) -> Arc<dyn SpawnerAdapter> ⓘ
fn wrap(&self, inner: Arc<dyn SpawnerAdapter>) -> Arc<dyn SpawnerAdapter> ⓘ
Wraps
inner in this layer’s behaviour, returning a new
SpawnerAdapter that delegates to inner (directly or via
wrap_join) while adding this layer’s cross-cutting effect.Auto Trait Implementations§
impl Freeze for AgentContextMiddleware
impl RefUnwindSafe for AgentContextMiddleware
impl Send for AgentContextMiddleware
impl Sync for AgentContextMiddleware
impl Unpin for AgentContextMiddleware
impl UnsafeUnpin for AgentContextMiddleware
impl UnwindSafe for AgentContextMiddleware
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more