Skip to main content

ExecContext

Struct ExecContext 

Source
pub struct ExecContext {
Show 13 fields pub token: CancellationToken, pub background: CancellationToken, pub progress: Sender<ProgressEvent>, pub call_id: ToolCallId, pub turn: TurnId, pub workdir: PathBuf, pub config: Arc<Config>, pub model_id: String, pub task_id: Option<String>, pub safety_mode: SafetyMode, pub intent: Option<String>, pub classifier: Option<Arc<dyn AutoClassifier>>, pub approval: Option<ApprovalBroker>,
}
Expand description

What a ToolExecutor::execute() receives.

Fields§

§token: CancellationToken§background: CancellationToken

Ctrl+B “background this” signal, parallel to token. Tools that can detach a running child (execute_command) select on it; the live path sets it from the turn scope, tests leave it never-fired.

§progress: Sender<ProgressEvent>§call_id: ToolCallId§turn: TurnId§workdir: PathBuf§config: Arc<Config>

Parent session’s app::Config. Needed by SubagentTool so the child reducer uses the same Ollama host, reasoning prefs, MCP servers, etc. Other tools don’t consult it — keeping it as a typed field (rather than a global) means the dependency is explicit in the signature.

§model_id: String

Parent session’s active model id (e.g. "anthropic/claude-opus-4-7"). Subagents inherit this so they hit the same provider.

§task_id: Option<String>

Durable daemon task that owns this tool call, when execution was launched through the runtime task queue.

§safety_mode: SafetyMode

Effective live safety mode for this call (from the session, not the static config). The policy gate builds its PolicyEngine from this.

§intent: Option<String>

The user’s stated intent for the turn (latest user message), passed to the Auto-mode classifier so it can judge whether an action is aligned.

§classifier: Option<Arc<dyn AutoClassifier>>

LLM classifier for SafetyMode::Auto. Some only when the effective mode is Auto and a provider is bound; the gate awaits it to resolve a PolicyDecision::Classify. None ⇒ the gate fails safe (escalate).

§approval: Option<ApprovalBroker>

Inline-approval back-channel (interactive runs only). Some lets the gate prompt the user and park until they answer; None (headless) falls back to the out-of-band DB-approval flow.

Implementations§

Source§

impl ExecContext

Source

pub fn new( token: CancellationToken, progress: Sender<ProgressEvent>, call_id: ToolCallId, turn: TurnId, workdir: PathBuf, config: Arc<Config>, model_id: String, task_id: Option<String>, safety_mode: SafetyMode, intent: Option<String>, classifier: Option<Arc<dyn AutoClassifier>>, approval: Option<ApprovalBroker>, ) -> Self

Trait Implementations§

Source§

impl Debug for ExecContext

Source§

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

Formats the value using the given formatter. Read more

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

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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