mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
config: own layer provenance types (#29722)
## Why Config layer provenance describes how effective configuration was assembled, so it belongs with the config loader rather than in app-server's serialized API types. ## What changed - Moved `ConfigLayerSource`, `ConfigLayerMetadata`, and `ConfigLayer` ownership into `codex-config`. - Kept app-server's wire payloads unchanged and added explicit conversions at the app boundary. - Removed lower-level app-server-protocol dependencies from config consumers. ## Stack This is PR 3 of 6, stacked on [PR #29721](https://github.com/openai/codex/pull/29721). Review only the delta from `codex/split-auth-domain-types`. Next: [PR #29723](https://github.com/openai/codex/pull/29723). ## Validation - `codex-config` coverage passed. - App-server config-manager and config RPC coverage passed.
This commit is contained in:
committed by
GitHub
Unverified
parent
4fe02f4fcf
commit
1d65ccabd5
Generated
-2
@@ -2537,7 +2537,6 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.22.1",
|
||||
"codex-app-server-protocol",
|
||||
"codex-execpolicy",
|
||||
"codex-features",
|
||||
"codex-file-system",
|
||||
@@ -2801,7 +2800,6 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"codex-analytics",
|
||||
"codex-app-server-protocol",
|
||||
"codex-config",
|
||||
"codex-context-fragments",
|
||||
"codex-exec-server",
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
use codex_app_server_protocol::ConfigLayer as ApiConfigLayer;
|
||||
use codex_app_server_protocol::ConfigLayerMetadata as ApiConfigLayerMetadata;
|
||||
use codex_app_server_protocol::ConfigLayerSource as ApiConfigLayerSource;
|
||||
use codex_config::ConfigLayer;
|
||||
use codex_config::ConfigLayerMetadata;
|
||||
use codex_config::ConfigLayerSource;
|
||||
|
||||
/// Converts a config-layer source owned by `codex-config` into the app-server wire type owned by
|
||||
/// `codex-app-server-protocol`.
|
||||
///
|
||||
/// The types stay separate so app-server protocol ownership does not leak into the config domain
|
||||
/// crate. Because this crate owns neither type, Rust's orphan rules require an explicit conversion
|
||||
/// function instead of a `From` implementation.
|
||||
pub(crate) fn config_layer_source_to_api(source: ConfigLayerSource) -> ApiConfigLayerSource {
|
||||
match source {
|
||||
ConfigLayerSource::Mdm { domain, key } => ApiConfigLayerSource::Mdm { domain, key },
|
||||
ConfigLayerSource::System { file } => ApiConfigLayerSource::System { file },
|
||||
ConfigLayerSource::EnterpriseManaged { id, name } => {
|
||||
ApiConfigLayerSource::EnterpriseManaged { id, name }
|
||||
}
|
||||
ConfigLayerSource::User { file, profile } => ApiConfigLayerSource::User { file, profile },
|
||||
ConfigLayerSource::Project { dot_codex_folder } => {
|
||||
ApiConfigLayerSource::Project { dot_codex_folder }
|
||||
}
|
||||
ConfigLayerSource::SessionFlags => ApiConfigLayerSource::SessionFlags,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromFile { file } => {
|
||||
ApiConfigLayerSource::LegacyManagedConfigTomlFromFile { file }
|
||||
}
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromMdm => {
|
||||
ApiConfigLayerSource::LegacyManagedConfigTomlFromMdm
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts config-layer metadata owned by `codex-config` into the app-server wire type owned by
|
||||
/// `codex-app-server-protocol`.
|
||||
///
|
||||
/// The types stay separate so app-server protocol ownership does not leak into the config domain
|
||||
/// crate. Because this crate owns neither type, Rust's orphan rules require an explicit conversion
|
||||
/// function instead of a `From` implementation.
|
||||
pub(crate) fn config_layer_metadata_to_api(
|
||||
metadata: ConfigLayerMetadata,
|
||||
) -> ApiConfigLayerMetadata {
|
||||
ApiConfigLayerMetadata {
|
||||
name: config_layer_source_to_api(metadata.name),
|
||||
version: metadata.version,
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts a config layer owned by `codex-config` into the app-server wire type owned by
|
||||
/// `codex-app-server-protocol`.
|
||||
///
|
||||
/// The types stay separate so app-server protocol ownership does not leak into the config domain
|
||||
/// crate. Because this crate owns neither type, Rust's orphan rules require an explicit conversion
|
||||
/// function instead of a `From` implementation.
|
||||
pub(crate) fn config_layer_to_api(layer: ConfigLayer) -> ApiConfigLayer {
|
||||
ApiConfigLayer {
|
||||
name: config_layer_source_to_api(layer.name),
|
||||
version: layer.version,
|
||||
config: layer.config,
|
||||
disabled_reason: layer.disabled_reason,
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::config_layer::config_layer_metadata_to_api;
|
||||
use crate::config_layer::config_layer_to_api;
|
||||
use crate::config_manager::ConfigManager;
|
||||
use codex_app_server_protocol::Config as ApiConfig;
|
||||
use codex_app_server_protocol::ConfigBatchWriteParams;
|
||||
use codex_app_server_protocol::ConfigLayerMetadata;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_app_server_protocol::ConfigReadParams;
|
||||
use codex_app_server_protocol::ConfigReadResponse;
|
||||
use codex_app_server_protocol::ConfigValueWriteParams;
|
||||
@@ -13,6 +13,8 @@ use codex_app_server_protocol::OverriddenMetadata;
|
||||
use codex_app_server_protocol::WriteStatus;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerMetadata;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::ConfigRequirementsToml;
|
||||
@@ -136,7 +138,11 @@ impl ConfigManager {
|
||||
|
||||
Ok(ConfigReadResponse {
|
||||
config,
|
||||
origins: layers.origins(),
|
||||
origins: layers
|
||||
.origins()
|
||||
.into_iter()
|
||||
.map(|(path, metadata)| (path, config_layer_metadata_to_api(metadata)))
|
||||
.collect(),
|
||||
layers: params.include_layers.then(|| {
|
||||
layers
|
||||
.get_layers(
|
||||
@@ -144,7 +150,7 @@ impl ConfigManager {
|
||||
/*include_disabled*/ true,
|
||||
)
|
||||
.iter()
|
||||
.map(|layer| layer.as_layer())
|
||||
.map(|layer| config_layer_to_api(layer.as_layer()))
|
||||
.collect()
|
||||
}),
|
||||
})
|
||||
@@ -671,7 +677,7 @@ fn compute_override_metadata(
|
||||
|
||||
Some(OverriddenMetadata {
|
||||
message,
|
||||
overriding_layer,
|
||||
overriding_layer: config_layer_metadata_to_api(overriding_layer),
|
||||
effective_value: effective_value
|
||||
.and_then(|value| serde_json::to_value(value).ok())
|
||||
.unwrap_or(JsonValue::Null),
|
||||
|
||||
@@ -4,6 +4,7 @@ use codex_app_server_protocol::AppConfig;
|
||||
use codex_app_server_protocol::AppToolApproval;
|
||||
use codex_app_server_protocol::AppsConfig;
|
||||
use codex_app_server_protocol::AskForApproval;
|
||||
use codex_app_server_protocol::ConfigLayerSource as ApiConfigLayerSource;
|
||||
use codex_config::CloudConfigBundleLoader;
|
||||
use codex_config::LoaderOverrides;
|
||||
use codex_config::test_support::CloudConfigBundleFixture;
|
||||
@@ -374,7 +375,7 @@ async fn read_includes_origins_and_layers() {
|
||||
.get("approval_policy")
|
||||
.expect("origin")
|
||||
.name,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromFile {
|
||||
ApiConfigLayerSource::LegacyManagedConfigTomlFromFile {
|
||||
file: managed_file.clone()
|
||||
},
|
||||
);
|
||||
@@ -383,7 +384,7 @@ async fn read_includes_origins_and_layers() {
|
||||
// top of the stack; ignore it so this test stays focused on file/user/system ordering.
|
||||
let layers = if matches!(
|
||||
layers.first().map(|layer| &layer.name),
|
||||
Some(ConfigLayerSource::LegacyManagedConfigTomlFromMdm)
|
||||
Some(ApiConfigLayerSource::LegacyManagedConfigTomlFromMdm)
|
||||
) {
|
||||
&layers[1..]
|
||||
} else {
|
||||
@@ -392,20 +393,20 @@ async fn read_includes_origins_and_layers() {
|
||||
assert_eq!(layers.len(), 3, "expected three layers");
|
||||
assert_eq!(
|
||||
layers.first().unwrap().name,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromFile {
|
||||
ApiConfigLayerSource::LegacyManagedConfigTomlFromFile {
|
||||
file: managed_file.clone()
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
layers.get(1).unwrap().name,
|
||||
ConfigLayerSource::User {
|
||||
ApiConfigLayerSource::User {
|
||||
file: user_file.clone(),
|
||||
profile: None,
|
||||
}
|
||||
);
|
||||
assert!(matches!(
|
||||
layers.get(2).unwrap().name,
|
||||
ConfigLayerSource::System { .. }
|
||||
ApiConfigLayerSource::System { .. }
|
||||
));
|
||||
}
|
||||
|
||||
@@ -505,7 +506,7 @@ async fn write_value_reports_override() {
|
||||
.get("approval_policy")
|
||||
.expect("origin")
|
||||
.name,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromFile {
|
||||
ApiConfigLayerSource::LegacyManagedConfigTomlFromFile {
|
||||
file: managed_file.clone()
|
||||
}
|
||||
);
|
||||
@@ -776,7 +777,7 @@ async fn read_reports_managed_overrides_user_and_session_flags() {
|
||||
assert_eq!(response.config.model.as_deref(), Some("system"));
|
||||
assert_eq!(
|
||||
response.origins.get("model").expect("origin").name,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromFile {
|
||||
ApiConfigLayerSource::LegacyManagedConfigTomlFromFile {
|
||||
file: managed_file.clone()
|
||||
},
|
||||
);
|
||||
@@ -785,7 +786,7 @@ async fn read_reports_managed_overrides_user_and_session_flags() {
|
||||
// top of the stack; ignore it so this test stays focused on file/session/user ordering.
|
||||
let layers = if matches!(
|
||||
layers.first().map(|layer| &layer.name),
|
||||
Some(ConfigLayerSource::LegacyManagedConfigTomlFromMdm)
|
||||
Some(ApiConfigLayerSource::LegacyManagedConfigTomlFromMdm)
|
||||
) {
|
||||
&layers[1..]
|
||||
} else {
|
||||
@@ -793,12 +794,15 @@ async fn read_reports_managed_overrides_user_and_session_flags() {
|
||||
};
|
||||
assert_eq!(
|
||||
layers.first().unwrap().name,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromFile { file: managed_file }
|
||||
ApiConfigLayerSource::LegacyManagedConfigTomlFromFile { file: managed_file }
|
||||
);
|
||||
assert_eq!(
|
||||
layers.get(1).unwrap().name,
|
||||
ApiConfigLayerSource::SessionFlags
|
||||
);
|
||||
assert_eq!(layers.get(1).unwrap().name, ConfigLayerSource::SessionFlags);
|
||||
assert_eq!(
|
||||
layers.get(2).unwrap().name,
|
||||
ConfigLayerSource::User {
|
||||
ApiConfigLayerSource::User {
|
||||
file: user_file,
|
||||
profile: None
|
||||
}
|
||||
@@ -836,7 +840,7 @@ async fn write_value_reports_managed_override() {
|
||||
let overridden = result.overridden_metadata.expect("overridden metadata");
|
||||
assert_eq!(
|
||||
overridden.overriding_layer.name,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromFile { file: managed_file }
|
||||
ApiConfigLayerSource::LegacyManagedConfigTomlFromFile { file: managed_file }
|
||||
);
|
||||
assert_eq!(overridden.effective_value, serde_json::json!("never"));
|
||||
}
|
||||
|
||||
@@ -47,12 +47,12 @@ use crate::transport::start_remote_control;
|
||||
use crate::transport::start_stdio_connection;
|
||||
use crate::transport::start_websocket_acceptor;
|
||||
use codex_analytics::AppServerRpcTransport;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_app_server_protocol::ConfigWarningNotification;
|
||||
use codex_app_server_protocol::JSONRPCMessage;
|
||||
use codex_app_server_protocol::ServerNotification;
|
||||
use codex_app_server_protocol::TextPosition as AppTextPosition;
|
||||
use codex_app_server_protocol::TextRange as AppTextRange;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLoadError;
|
||||
use codex_config::TextRange as CoreTextRange;
|
||||
use codex_core::ExecPolicyError;
|
||||
@@ -86,6 +86,7 @@ mod auth_mode;
|
||||
mod bespoke_event_handling;
|
||||
mod command_exec;
|
||||
mod config;
|
||||
mod config_layer;
|
||||
mod config_manager;
|
||||
mod config_manager_service;
|
||||
mod connection_cleanup;
|
||||
|
||||
@@ -14,7 +14,6 @@ workspace = true
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
codex-app-server-protocol = { workspace = true }
|
||||
codex-execpolicy = { workspace = true }
|
||||
codex-features = { workspace = true }
|
||||
codex-file-system = { workspace = true }
|
||||
|
||||
@@ -1,4 +1,76 @@
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use serde_json::Value as JsonValue;
|
||||
|
||||
/// Provenance for one layer in the effective Codex configuration.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ConfigLayerSource {
|
||||
/// Managed preferences delivered by MDM.
|
||||
Mdm { domain: String, key: String },
|
||||
/// Host-wide configuration loaded from a file.
|
||||
System { file: AbsolutePathBuf },
|
||||
/// Configuration delivered by an enterprise cloud bundle.
|
||||
EnterpriseManaged { id: String, name: String },
|
||||
/// User configuration, optionally augmented by a selected profile.
|
||||
User {
|
||||
file: AbsolutePathBuf,
|
||||
profile: Option<String>,
|
||||
},
|
||||
/// Configuration loaded from a project's `.codex` directory.
|
||||
Project { dot_codex_folder: AbsolutePathBuf },
|
||||
/// Overrides supplied for the current session.
|
||||
SessionFlags,
|
||||
/// Legacy managed configuration loaded from a file.
|
||||
LegacyManagedConfigTomlFromFile { file: AbsolutePathBuf },
|
||||
/// Legacy managed configuration delivered by MDM.
|
||||
LegacyManagedConfigTomlFromMdm,
|
||||
}
|
||||
|
||||
impl ConfigLayerSource {
|
||||
/// A setting from a layer with a higher precedence overrides a setting
|
||||
/// from a layer with a lower precedence.
|
||||
pub fn precedence(&self) -> i16 {
|
||||
match self {
|
||||
ConfigLayerSource::Mdm { .. } => 0,
|
||||
ConfigLayerSource::System { .. } => 10,
|
||||
ConfigLayerSource::EnterpriseManaged { .. } => 15,
|
||||
ConfigLayerSource::User { profile, .. } => {
|
||||
if profile.is_some() {
|
||||
21
|
||||
} else {
|
||||
20
|
||||
}
|
||||
}
|
||||
ConfigLayerSource::Project { .. } => 25,
|
||||
ConfigLayerSource::SessionFlags => 30,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromFile { .. } => 40,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromMdm => 50,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Compares [`ConfigLayerSource`] by precedence, so `A < B` means settings
|
||||
/// from layer `A` will be overridden by settings from layer `B`.
|
||||
impl PartialOrd for ConfigLayerSource {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||
Some(self.precedence().cmp(&other.precedence()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Identity and version information for a configuration layer.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct ConfigLayerMetadata {
|
||||
pub name: ConfigLayerSource,
|
||||
pub version: String,
|
||||
}
|
||||
|
||||
/// A materialized configuration layer and its provenance.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct ConfigLayer {
|
||||
pub name: ConfigLayerSource,
|
||||
pub version: String,
|
||||
pub config: JsonValue,
|
||||
pub disabled_reason: Option<String>,
|
||||
}
|
||||
|
||||
pub fn format_config_layer_source(source: &ConfigLayerSource, config_toml_file: &str) -> String {
|
||||
match source {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
//! rendering them in a user-friendly way.
|
||||
|
||||
use crate::ConfigLayerEntry;
|
||||
use crate::ConfigLayerSource;
|
||||
use crate::ConfigLayerStack;
|
||||
use crate::ConfigLayerStackOrdering;
|
||||
use crate::format_config_layer_source;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_utils_absolute_path::AbsolutePathBufGuard;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde_path_to_error::Path as SerdePath;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use codex_app_server_protocol::ConfigLayerMetadata;
|
||||
use crate::ConfigLayerMetadata;
|
||||
use serde_json::Value as JsonValue;
|
||||
use sha2::Digest;
|
||||
use sha2::Sha256;
|
||||
|
||||
@@ -44,10 +44,12 @@ pub use cloud_config_layers::CloudConfigFragment;
|
||||
pub use cloud_config_layers::CloudConfigFragmentSource;
|
||||
pub use cloud_config_layers::CloudConfigLayerError;
|
||||
pub use cloud_config_layers::cloud_config_layers_from_fragments;
|
||||
pub use codex_app_server_protocol::ConfigLayerSource;
|
||||
pub use codex_protocol::config_types::ProfileV2Name;
|
||||
pub use codex_protocol::config_types::ProfileV2NameParseError;
|
||||
pub use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
pub use config_layer_source::ConfigLayer;
|
||||
pub use config_layer_source::ConfigLayerMetadata;
|
||||
pub use config_layer_source::ConfigLayerSource;
|
||||
pub use config_layer_source::format_config_layer_source;
|
||||
pub use config_requirements::AppRequirementToml;
|
||||
pub use config_requirements::AppToolRequirementToml;
|
||||
|
||||
@@ -7,6 +7,7 @@ mod tests;
|
||||
use self::layer_io::LoadedConfigLayers;
|
||||
use crate::CONFIG_TOML_FILE;
|
||||
use crate::CloudConfigBundleLayers;
|
||||
use crate::ConfigLayerSource;
|
||||
use crate::ProfileV2Name;
|
||||
use crate::RequirementsLayerEntry;
|
||||
use crate::compose_requirements;
|
||||
@@ -31,7 +32,6 @@ use crate::strict_config::ignored_toml_value_field;
|
||||
use crate::strict_config::unknown_feature_toml_value_field;
|
||||
use crate::thread_config::ThreadConfigContext;
|
||||
use crate::thread_config::ThreadConfigLoader;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_file_system::ExecutorFileSystem;
|
||||
use codex_git_utils::resolve_root_git_project_for_trust;
|
||||
use codex_protocol::config_types::ApprovalsReviewer;
|
||||
|
||||
@@ -6,10 +6,10 @@ use super::fingerprint::version_for_toml;
|
||||
use super::key_aliases::normalized_with_key_aliases;
|
||||
use super::merge::merge_toml_values;
|
||||
use crate::CloudConfigBundleLoader;
|
||||
use crate::ConfigLayer;
|
||||
use crate::ConfigLayerMetadata;
|
||||
use crate::ConfigLayerSource;
|
||||
use crate::ProfileV2Name;
|
||||
use codex_app_server_protocol::ConfigLayer;
|
||||
use codex_app_server_protocol::ConfigLayerMetadata;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use serde_json::Value as JsonValue;
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::collections::HashMap;
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use crate::ConfigLayerSource;
|
||||
use codex_model_provider_info::ModelProviderInfo;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -920,17 +920,6 @@ pub struct SandboxWorkspaceWrite {
|
||||
pub exclude_slash_tmp: bool,
|
||||
}
|
||||
|
||||
impl From<SandboxWorkspaceWrite> for codex_app_server_protocol::SandboxSettings {
|
||||
fn from(sandbox_workspace_write: SandboxWorkspaceWrite) -> Self {
|
||||
Self {
|
||||
writable_roots: sandbox_workspace_write.writable_roots,
|
||||
network_access: Some(sandbox_workspace_write.network_access),
|
||||
exclude_tmpdir_env_var: Some(sandbox_workspace_write.exclude_tmpdir_env_var),
|
||||
exclude_slash_tmp: Some(sandbox_workspace_write.exclude_slash_tmp),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Policy for building the `env` when spawning a process via shell-like tools.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default, JsonSchema)]
|
||||
#[schemars(deny_unknown_fields)]
|
||||
|
||||
@@ -25,10 +25,10 @@ use crate::test_support::write_curated_plugin_sha_with as write_curated_plugin_s
|
||||
use crate::test_support::write_file;
|
||||
use crate::test_support::write_openai_api_curated_marketplace;
|
||||
use crate::test_support::write_openai_curated_marketplace;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::AppToolApproval;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigRequirements;
|
||||
use codex_config::ConfigRequirementsToml;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::*;
|
||||
use crate::marketplace_upgrade::upgrade_configured_git_marketplaces;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::RequirementSource;
|
||||
use codex_config::RequirementsLayerEntry;
|
||||
use codex_config::compose_requirements;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::*;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigRequirements;
|
||||
use codex_config::ConfigRequirementsToml;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
@@ -15,7 +15,6 @@ workspace = true
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
codex-analytics = { workspace = true }
|
||||
codex-app-server-protocol = { workspace = true }
|
||||
codex-config = { workspace = true }
|
||||
codex-context-fragments = { workspace = true }
|
||||
codex-exec-server = { workspace = true }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::SkillConfig;
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::model::SkillMetadata;
|
||||
use crate::model::SkillPolicy;
|
||||
use crate::model::SkillToolDependency;
|
||||
use crate::system::system_cache_root_dir;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::default_project_root_markers;
|
||||
|
||||
@@ -2,9 +2,9 @@ use super::*;
|
||||
use crate::SkillMetadata;
|
||||
use crate::config_rules::resolve_disabled_skill_paths;
|
||||
use crate::config_rules::skill_config_rules_from_stack;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigRequirementsToml;
|
||||
use codex_exec_server::LOCAL_FS;
|
||||
|
||||
@@ -12,8 +12,8 @@ use crate::config::ConfigOverrides;
|
||||
use crate::config::agent_roles::parse_agent_role_file_contents;
|
||||
use crate::config::deserialize_config_toml_with_base;
|
||||
use anyhow::anyhow;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::config_toml::ConfigToml;
|
||||
|
||||
@@ -19,7 +19,7 @@ use crate::config::Config;
|
||||
use crate::context::ContextualUserFragment;
|
||||
use crate::context::UserInstructions as ContextUserInstructions;
|
||||
use crate::environment_selection::TurnEnvironmentSnapshot;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::default_project_root_markers;
|
||||
use codex_config::merge_toml_values;
|
||||
|
||||
@@ -3,12 +3,12 @@ use crate::config::ConfigOverrides;
|
||||
use crate::config::ConstraintError;
|
||||
use crate::config::PermissionProfileCatalogEntry;
|
||||
use crate::config::permission_profile_catalog;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::CloudConfigBundleLoadError;
|
||||
use codex_config::CloudConfigBundleLoader;
|
||||
use codex_config::ConfigError;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::ConfigLoadError;
|
||||
use codex_config::ConfigLoadOptions;
|
||||
@@ -3501,8 +3501,8 @@ async fn project_root_markers_supports_alternate_markers() -> std::io::Result<()
|
||||
|
||||
mod requirements_exec_policy_tests {
|
||||
use crate::exec_policy::load_exec_policy;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigRequirements;
|
||||
use codex_config::ConfigRequirementsToml;
|
||||
|
||||
@@ -4,6 +4,7 @@ use crate::config::edit::apply_blocking;
|
||||
use assert_matches::assert_matches;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ProfileV2Name;
|
||||
use codex_config::RequirementSource;
|
||||
@@ -4401,7 +4402,7 @@ async fn rebuild_preserving_session_layers_refreshes_requirements() -> std::io::
|
||||
let refreshed_layer_stack = ConfigLayerStack::new(
|
||||
vec![
|
||||
ConfigLayerEntry::new(
|
||||
codex_app_server_protocol::ConfigLayerSource::User {
|
||||
ConfigLayerSource::User {
|
||||
file: user_file.clone(),
|
||||
profile: None,
|
||||
},
|
||||
@@ -4416,7 +4417,7 @@ async fn rebuild_preserving_session_layers_refreshes_requirements() -> std::io::
|
||||
.into(),
|
||||
),
|
||||
ConfigLayerEntry::new(
|
||||
codex_app_server_protocol::ConfigLayerSource::Project {
|
||||
ConfigLayerSource::Project {
|
||||
dot_codex_folder: project_dot_codex.clone(),
|
||||
},
|
||||
toml::toml! {
|
||||
@@ -4426,7 +4427,7 @@ async fn rebuild_preserving_session_layers_refreshes_requirements() -> std::io::
|
||||
.into(),
|
||||
),
|
||||
ConfigLayerEntry::new(
|
||||
codex_app_server_protocol::ConfigLayerSource::LegacyManagedConfigTomlFromMdm,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromMdm,
|
||||
toml::toml! {
|
||||
[mcp_servers.managed_overrides_session]
|
||||
command = "managed-command"
|
||||
@@ -4456,7 +4457,7 @@ async fn rebuild_preserving_session_layers_refreshes_requirements() -> std::io::
|
||||
let thread_layer_stack = ConfigLayerStack::new(
|
||||
vec![
|
||||
ConfigLayerEntry::new(
|
||||
codex_app_server_protocol::ConfigLayerSource::User {
|
||||
ConfigLayerSource::User {
|
||||
file: user_file.clone(),
|
||||
profile: None,
|
||||
},
|
||||
@@ -4471,7 +4472,7 @@ async fn rebuild_preserving_session_layers_refreshes_requirements() -> std::io::
|
||||
.into(),
|
||||
),
|
||||
ConfigLayerEntry::new(
|
||||
codex_app_server_protocol::ConfigLayerSource::Project {
|
||||
ConfigLayerSource::Project {
|
||||
dot_codex_folder: project_dot_codex,
|
||||
},
|
||||
toml::toml! {
|
||||
@@ -4481,7 +4482,7 @@ async fn rebuild_preserving_session_layers_refreshes_requirements() -> std::io::
|
||||
.into(),
|
||||
),
|
||||
ConfigLayerEntry::new(
|
||||
codex_app_server_protocol::ConfigLayerSource::SessionFlags,
|
||||
ConfigLayerSource::SessionFlags,
|
||||
toml::toml! {
|
||||
[mcp_servers.session_overrides_user]
|
||||
command = "session-command"
|
||||
@@ -4493,7 +4494,7 @@ async fn rebuild_preserving_session_layers_refreshes_requirements() -> std::io::
|
||||
.into(),
|
||||
),
|
||||
ConfigLayerEntry::new(
|
||||
codex_app_server_protocol::ConfigLayerSource::LegacyManagedConfigTomlFromMdm,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromMdm,
|
||||
toml::toml! {
|
||||
[mcp_servers.managed_overrides_session]
|
||||
command = "old-managed-command"
|
||||
@@ -4587,7 +4588,7 @@ async fn rebuild_preserving_session_layers_refreshes_plugin_derived_mcp_config()
|
||||
let user_file = AbsolutePathBuf::resolve_path_against_base(CONFIG_TOML_FILE, codex_home.path());
|
||||
let refreshed_layer_stack = ConfigLayerStack::new(
|
||||
vec![ConfigLayerEntry::new(
|
||||
codex_app_server_protocol::ConfigLayerSource::User {
|
||||
ConfigLayerSource::User {
|
||||
file: user_file.clone(),
|
||||
profile: None,
|
||||
},
|
||||
@@ -4616,7 +4617,7 @@ async fn rebuild_preserving_session_layers_refreshes_plugin_derived_mcp_config()
|
||||
.await?;
|
||||
let thread_layer_stack = ConfigLayerStack::new(
|
||||
vec![ConfigLayerEntry::new(
|
||||
codex_app_server_protocol::ConfigLayerSource::User {
|
||||
ConfigLayerSource::User {
|
||||
file: user_file,
|
||||
profile: None,
|
||||
},
|
||||
@@ -7193,7 +7194,7 @@ config_file = "./agents/researcher.toml"
|
||||
.expect("agent role layer config should parse");
|
||||
let config_layer_stack = codex_config::ConfigLayerStack::new(
|
||||
vec![codex_config::ConfigLayerEntry::new(
|
||||
codex_app_server_protocol::ConfigLayerSource::User {
|
||||
ConfigLayerSource::User {
|
||||
file: codex_home.path().join(CONFIG_TOML_FILE).abs(),
|
||||
profile: None,
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::sync::Arc;
|
||||
|
||||
use arc_swap::ArcSwap;
|
||||
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_execpolicy::AmendError;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use super::*;
|
||||
use crate::config::Config;
|
||||
use crate::config::ConfigBuilder;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::ConfigRequirements;
|
||||
|
||||
@@ -26,11 +26,11 @@ use crate::turn_metadata::McpTurnMetadataContext;
|
||||
use codex_analytics::AppInvocation;
|
||||
use codex_analytics::InvocationType;
|
||||
use codex_analytics::build_track_events_context;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_app_server_protocol::McpElicitationObjectType;
|
||||
use codex_app_server_protocol::McpElicitationSchema;
|
||||
use codex_app_server_protocol::McpServerElicitationRequest;
|
||||
use codex_app_server_protocol::McpServerElicitationRequestParams;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::types::AppToolApproval;
|
||||
use codex_config::types::ApprovalsReviewer;
|
||||
use codex_connectors::AppToolPolicy;
|
||||
|
||||
@@ -7,8 +7,8 @@ use crate::exec_policy::format_exec_policy_error_with_source;
|
||||
use crate::exec_policy::load_exec_policy;
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::LoaderOverrides;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::*;
|
||||
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigRequirements;
|
||||
use codex_config::ConfigRequirementsToml;
|
||||
|
||||
@@ -9,8 +9,8 @@ use crate::tools::context::ToolCallSource;
|
||||
use crate::tools::context::ToolOutput;
|
||||
use crate::tools::context::ToolPayload;
|
||||
use crate::turn_diff_tracker::TurnDiffTracker;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigRequirements;
|
||||
use codex_config::ConfigRequirementsToml;
|
||||
use codex_exec_server::EnvironmentManager;
|
||||
|
||||
@@ -88,7 +88,6 @@ use codex_app_server_protocol::AskForApproval;
|
||||
use codex_app_server_protocol::ClientRequest;
|
||||
use codex_app_server_protocol::CodexErrorInfo as AppServerCodexErrorInfo;
|
||||
use codex_app_server_protocol::ConfigBatchWriteParams;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_app_server_protocol::ConfigReadResponse;
|
||||
use codex_app_server_protocol::ConfigValueWriteParams;
|
||||
use codex_app_server_protocol::ConfigWriteResponse;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//! catalog state into one-time TUI prompts or warning cells without owning the main event loop.
|
||||
|
||||
use super::*;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use std::collections::HashSet;
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
||||
@@ -87,7 +87,6 @@ use codex_app_server_protocol::CollabAgentTool;
|
||||
use codex_app_server_protocol::CollabAgentToolCallStatus;
|
||||
use codex_app_server_protocol::CommandExecutionRequestApprovalParams;
|
||||
use codex_app_server_protocol::CommandExecutionSource as ExecCommandSource;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_app_server_protocol::CreditsSnapshot;
|
||||
use codex_app_server_protocol::ErrorNotification;
|
||||
use codex_app_server_protocol::FileChangeRequestApprovalParams;
|
||||
|
||||
@@ -11,6 +11,7 @@ use crate::chatwidget::rate_limits::get_limits_duration;
|
||||
use crate::legacy_core::config::Config;
|
||||
use crate::status::format_tokens_compact;
|
||||
use codex_app_server_protocol::AskForApproval;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_protocol::config_types::ApprovalsReviewer;
|
||||
use codex_protocol::config_types::ServiceTier;
|
||||
use codex_protocol::models::PermissionProfile;
|
||||
|
||||
@@ -2,9 +2,9 @@ use crate::history_cell::PlainHistoryCell;
|
||||
use crate::legacy_core::config::Config;
|
||||
use crate::legacy_core::config::Permissions;
|
||||
use crate::session_state::SessionNetworkProxyRuntime;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::ManagedHooksRequirementsToml;
|
||||
@@ -557,8 +557,8 @@ mod tests {
|
||||
use super::session_all_proxy_url;
|
||||
use crate::legacy_core::config::Permissions;
|
||||
use codex_app_server_protocol::AskForApproval;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigRequirements;
|
||||
use codex_config::ConfigRequirementsToml;
|
||||
|
||||
Reference in New Issue
Block a user