pub struct EnvironmentContext {
pub working_dir: String,
pub git_branch: Option<String>,
pub os: String,
pub model_name: String,
}Fields§
§working_dir: String§git_branch: Option<String>§os: String§model_name: StringImplementations§
Source§impl EnvironmentContext
impl EnvironmentContext
pub fn gather(model_name: &str) -> Self
pub fn gather_for_dir(model_name: &str, working_dir: &Path) -> Self
Sourcepub async fn refresh_git_branch(&mut self)
pub async fn refresh_git_branch(&mut self)
Update only the git branch, leaving all other fields unchanged.
The underlying git subprocess call is dispatched to the blocking thread
pool via tokio::task::spawn_blocking so it never stalls the tokio
worker thread driving the agent turn loop (this is called on every turn).
pub fn format(&self) -> String
Sourcepub fn format_cacheable(&self) -> String
pub fn format_cacheable(&self) -> String
Like format but omits working_directory (#6032, S1 cache fix).
Used to build the cacheable (pre-cache:stable) portion of the system prompt.
working_directory changes on every /cd and is emitted separately in the volatile
tail (after <!-- cache:volatile -->) so a directory switch does not bust the stable
prompt-cache block for os/model/git_branch, which rarely change mid-session.
Trait Implementations§
Source§impl Clone for EnvironmentContext
impl Clone for EnvironmentContext
Source§fn clone(&self) -> EnvironmentContext
fn clone(&self) -> EnvironmentContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EnvironmentContext
impl RefUnwindSafe for EnvironmentContext
impl Send for EnvironmentContext
impl Sync for EnvironmentContext
impl Unpin for EnvironmentContext
impl UnsafeUnpin for EnvironmentContext
impl UnwindSafe for EnvironmentContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request