pub struct EnvironmentManager { /* private fields */ }Expand description
Owns the execution/filesystem environments available to the Codex runtime.
EnvironmentManager is a shared registry for concrete environments. Its
default constructor preserves the legacy CODEX_EXEC_SERVER_URL behavior
while configured construction accepts a provider-supplied snapshot.
Setting CODEX_EXEC_SERVER_URL=none disables environment access by leaving
the default environment unset and omitting the local environment. Callers
use default_environment().is_some() as the signal for model-facing
shell/filesystem tool availability.
Remote environments begin connecting when added to the manager. Their filesystem and execution backends share that startup result and reconnect after later disconnects as needed.
Implementations§
Source§impl EnvironmentManager
impl EnvironmentManager
Sourcepub fn default_for_tests() -> Self
pub fn default_for_tests() -> Self
Builds a test-only manager without configured sandbox helper paths.
Sourcepub fn without_environments() -> Self
pub fn without_environments() -> Self
Builds a manager with no configured execution environments.
Sourcepub async fn create_for_tests(
exec_server_url: Option<String>,
local_runtime_paths: Option<ExecServerRuntimePaths>,
) -> Self
pub async fn create_for_tests( exec_server_url: Option<String>, local_runtime_paths: Option<ExecServerRuntimePaths>, ) -> Self
Builds a test-only manager from a raw exec-server URL value.
Sourcepub async fn from_codex_home(
codex_home: impl AsRef<Path>,
local_runtime_paths: Option<ExecServerRuntimePaths>,
) -> Result<Self, ExecServerError>
pub async fn from_codex_home( codex_home: impl AsRef<Path>, local_runtime_paths: Option<ExecServerRuntimePaths>, ) -> Result<Self, ExecServerError>
Builds a manager from CODEX_HOME and local runtime paths used when
creating local filesystem helpers.
If CODEX_HOME/environments.toml is present, it defines the configured
environments. Otherwise this preserves the legacy
CODEX_EXEC_SERVER_URL behavior.
Sourcepub async fn from_env(
local_runtime_paths: Option<ExecServerRuntimePaths>,
) -> Result<Self, ExecServerError>
pub async fn from_env( local_runtime_paths: Option<ExecServerRuntimePaths>, ) -> Result<Self, ExecServerError>
Builds a manager from the legacy environment-variable provider without
reading user config files from CODEX_HOME.
Sourcepub async fn create_for_tests_with_local(
exec_server_url: Option<String>,
local_runtime_paths: ExecServerRuntimePaths,
) -> Self
pub async fn create_for_tests_with_local( exec_server_url: Option<String>, local_runtime_paths: ExecServerRuntimePaths, ) -> Self
Builds a test-only manager that keeps the provider default while also allowing tests to select the local environment explicitly.
Sourcepub fn default_environment(&self) -> Option<Arc<Environment>>
pub fn default_environment(&self) -> Option<Arc<Environment>>
Returns the default environment instance.
Sourcepub fn default_environment_id(&self) -> Option<&str>
pub fn default_environment_id(&self) -> Option<&str>
Returns the id of the default environment.
Sourcepub fn default_environment_ids(&self) -> Vec<String>
pub fn default_environment_ids(&self) -> Vec<String>
Returns the ordered environment ids used for new thread startup.
Sourcepub fn try_local_environment(&self) -> Option<Arc<Environment>>
pub fn try_local_environment(&self) -> Option<Arc<Environment>>
Returns the local environment instance when one is configured.
Sourcepub fn get_environment(&self, environment_id: &str) -> Option<Arc<Environment>>
pub fn get_environment(&self, environment_id: &str) -> Option<Arc<Environment>>
Returns a named environment instance.
Sourcepub async fn get_environment_status(
&self,
environment_id: &str,
) -> Option<EnvironmentObservedStatus>
pub async fn get_environment_status( &self, environment_id: &str, ) -> Option<EnvironmentObservedStatus>
Returns the current status of one named environment when it is configured.
Sourcepub fn upsert_environment(
&self,
environment_id: String,
exec_server_url: String,
connect_timeout: Option<Duration>,
) -> Result<(), ExecServerError>
pub fn upsert_environment( &self, environment_id: String, exec_server_url: String, connect_timeout: Option<Duration>, ) -> Result<(), ExecServerError>
Adds or replaces a named remote environment without changing the manager’s default environment selection. Uses the default WebSocket connection timeout when none is provided.
Sourcepub fn register_deferred_noise_environment(
&self,
environment_id: String,
provider: Arc<dyn NoiseRendezvousConnectProvider>,
) -> Result<DeferredEnvironmentRegistration, ExecServerError>
pub fn register_deferred_noise_environment( &self, environment_id: String, provider: Arc<dyn NoiseRendezvousConnectProvider>, ) -> Result<DeferredEnvironmentRegistration, ExecServerError>
Adds or replaces a Noise rendezvous environment that will become ready later.
Sourcepub fn upsert_noise_environment(
&self,
environment_id: String,
provider: Arc<dyn NoiseRendezvousConnectProvider>,
) -> Result<(), ExecServerError>
pub fn upsert_noise_environment( &self, environment_id: String, provider: Arc<dyn NoiseRendezvousConnectProvider>, ) -> Result<(), ExecServerError>
Adds or replaces a named remote environment that connects through an authenticated, end-to-end encrypted rendezvous stream.
The provider is retained so every reconnect obtains fresh authorization. This transport never falls back to the URL-only remote environment path.
Source§impl EnvironmentManager
impl EnvironmentManager
Sourcepub fn inspect_selected_capability_roots(
&self,
selected_roots: &[SelectedCapabilityRoot],
) -> SelectedCapabilityRootsStatus
pub fn inspect_selected_capability_roots( &self, selected_roots: &[SelectedCapabilityRoot], ) -> SelectedCapabilityRootsStatus
Inspects selected roots without starting or waiting for an environment.
Starting or recovering environments are omitted. Missing environments and terminal connection failures are returned as warnings so read-only catalog clients can distinguish them from an empty catalog.
Environment IDs are stable identities, so callers can safely resolve a returned root by ID when they read it.
Sourcepub async fn resolve_selected_capability_roots(
&self,
selected_roots: &[SelectedCapabilityRoot],
captured_environments: &HashMap<String, Option<Arc<Environment>>>,
) -> Vec<ResolvedSelectedCapabilityRoot>
pub async fn resolve_selected_capability_roots( &self, selected_roots: &[SelectedCapabilityRoot], captured_environments: &HashMap<String, Option<Arc<Environment>>>, ) -> Vec<ResolvedSelectedCapabilityRoot>
Resolves selected roots whose stable environments are ready for the current model step.
Environment identity comes from the selected root’s stable environment ID. A ready environment captured for the step carries its exact process-local handle so readiness and execution cannot come from different registry snapshots. Missing, starting, or failed environments are omitted. A lazy environment is started for a later step.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for EnvironmentManager
impl !RefUnwindSafe for EnvironmentManager
impl !UnwindSafe for EnvironmentManager
impl Send for EnvironmentManager
impl Sync for EnvironmentManager
impl Unpin for EnvironmentManager
impl UnsafeUnpin for EnvironmentManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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>
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>
T in a tonic::Request