mirror of
https://github.com/openai/codex.git
synced 2026-09-07 15:40:00 +00:00
## What changed - Add the `environmentConfig/read` RPC for selecting literal TOML paths from executor-local config and requirements layers. - Return layer precedence, cloud insertion points, source and base-directory metadata, and executor home and hostname context without normalizing path-bearing values. - Expose the operation through both remote clients and local `Environment` instances, with invalid selectors reported as invalid parameters. ## Testing - Cover projected remote config reads and rejection of empty selectors. GitOrigin-RevId: fee15bf833de6bcb2058d405ed5b1d5d928d7218
51 lines
2.0 KiB
Rust
51 lines
2.0 KiB
Rust
use codex_utils_path_uri::PathUri;
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
pub const ENVIRONMENT_CONFIG_READ_METHOD: &str = "environmentConfig/read";
|
|
|
|
/// Selects executor-local config and requirements fields by literal TOML key path.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct EnvironmentConfigReadParams {
|
|
pub cwd: PathUri,
|
|
pub config_paths: Vec<Vec<String>>,
|
|
pub requirements_paths: Vec<Vec<String>>,
|
|
}
|
|
|
|
/// Executor-local config and requirements layers selected for one environment.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct EnvironmentConfigReadResponse {
|
|
/// Executor user home used to expand `~` in path-bearing values.
|
|
pub user_home_dir: Option<PathUri>,
|
|
/// Executor Codex home used as the base directory for cloud-provided layers.
|
|
pub codex_home_dir: PathUri,
|
|
/// Executor hostname used to select matching remote sandbox requirements.
|
|
pub hostname: Option<String>,
|
|
pub config: EnvironmentConfigLayerStack,
|
|
pub requirements: EnvironmentConfigLayerStack,
|
|
}
|
|
|
|
/// One ordered set of selected TOML layers.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct EnvironmentConfigLayerStack {
|
|
/// Layers ordered from lowest to highest precedence.
|
|
pub layers: Vec<EnvironmentConfigLayer>,
|
|
/// Position at which cloud-provided layers should be inserted.
|
|
pub cloud_insertion_index: usize,
|
|
}
|
|
|
|
/// One selected executor-local TOML layer.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct EnvironmentConfigLayer {
|
|
/// Opaque provenance for diagnostics. Callers must not derive behavior from it.
|
|
pub source: String,
|
|
/// Directory used to interpret relative paths in this layer.
|
|
pub base_dir: PathUri,
|
|
/// Selected raw TOML. Path-bearing values have not been normalized.
|
|
pub toml: String,
|
|
}
|