Skip to main content

BuildCtx

Struct BuildCtx 

Source
pub struct BuildCtx<'a> {
    pub bin: &'a str,
    pub prompt: &'a str,
    pub model: Option<&'a str>,
    pub system: Option<&'a str>,
    pub resume: Option<&'a str>,
    pub fork: bool,
    pub mode: PermissionMode,
    pub output_format: OutputFormat,
    pub schema: Option<&'a str>,
}
Expand description

Everything build_argv needs, with no I/O: the resolved binary, the prompt, the optional model, whether to request the harness’s “don’t prompt” mode, and the effective output format (the harness default, or a --output-format override) for harnesses that take a format flag.

Fields§

§bin: &'a str§prompt: &'a str§model: Option<&'a str>§system: Option<&'a str>

System prompt to apply. Adapters with a native system flag map it (Claude Code’s --append-system-prompt, Goose’s --system); adapters without one prepend it to the prompt via prompt_with_system so the instructions still reach the model, rather than dropping it.

§resume: Option<&'a str>

Session id to continue, for harnesses that support resumption. Only set after the command layer has verified the selected harness’s supports_resume, so an adapter that maps it can assume support.

§fork: bool

When resuming, branch a new session from the resumed one instead of appending to it — so the original (and its cached prefix) is untouched and can seed independent follow-ups. Only honored alongside resume, and only set after the command layer has verified supports_fork; an adapter maps it to its native fork flag (Claude Code’s --fork-session, OpenCode’s --fork). Ignored by adapters that cannot fork (they are never selected with it).

§mode: PermissionMode

The normalized approval mode to request. Each adapter maps it to its harness’s native mechanism (argv flags here; any environment via the matching ModeSpec). The command layer guarantees the selected harness actually supports mode before calling build_argv, so an adapter only needs correct output for the modes in its HarnessSpec::modes.

§output_format: OutputFormat§schema: Option<&'a str>

Inline JSON-Schema text to deliver through the harness’s native structured-output flag, set only for an adapter with a HarnessSpec::native_schema when a schema run is requested. Adapters without native support ignore it — the command layer instead appends the schema instruction to the prompt — so it is never silently dropped.

Auto Trait Implementations§

§

impl<'a> Freeze for BuildCtx<'a>

§

impl<'a> RefUnwindSafe for BuildCtx<'a>

§

impl<'a> Send for BuildCtx<'a>

§

impl<'a> Sync for BuildCtx<'a>

§

impl<'a> Unpin for BuildCtx<'a>

§

impl<'a> UnsafeUnpin for BuildCtx<'a>

§

impl<'a> UnwindSafe for BuildCtx<'a>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.