2025-05-13 16:52:52 -07:00
|
|
|
use serde::Deserialize;
|
2025-08-04 09:34:46 -07:00
|
|
|
use std::path::PathBuf;
|
2025-05-13 16:52:52 -07:00
|
|
|
|
|
|
|
|
use crate::protocol::AskForApproval;
|
2025-08-18 11:50:17 -07:00
|
|
|
use codex_protocol::config_types::ReasoningEffort;
|
|
|
|
|
use codex_protocol::config_types::ReasoningSummary;
|
2025-09-03 12:20:31 -07:00
|
|
|
use codex_protocol::config_types::Verbosity;
|
2025-05-13 16:52:52 -07:00
|
|
|
|
|
|
|
|
/// Collection of common configuration options that a user can define as a unit
|
|
|
|
|
/// in `config.toml`.
|
|
|
|
|
#[derive(Debug, Clone, Default, PartialEq, Deserialize)]
|
|
|
|
|
pub struct ConfigProfile {
|
|
|
|
|
pub model: Option<String>,
|
|
|
|
|
/// The key in the `model_providers` map identifying the
|
|
|
|
|
/// [`ModelProviderInfo`] to use.
|
|
|
|
|
pub model_provider: Option<String>,
|
|
|
|
|
pub approval_policy: Option<AskForApproval>,
|
2025-07-08 22:05:22 +03:00
|
|
|
pub model_reasoning_effort: Option<ReasoningEffort>,
|
|
|
|
|
pub model_reasoning_summary: Option<ReasoningSummary>,
|
2025-08-22 17:12:10 +01:00
|
|
|
pub model_verbosity: Option<Verbosity>,
|
2025-07-11 13:30:11 -04:00
|
|
|
pub chatgpt_base_url: Option<String>,
|
2025-08-04 09:34:46 -07:00
|
|
|
pub experimental_instructions_file: Option<PathBuf>,
|
2025-10-14 18:50:00 +01:00
|
|
|
pub include_plan_tool: Option<bool>,
|
|
|
|
|
pub include_apply_patch_tool: Option<bool>,
|
|
|
|
|
pub include_view_image_tool: Option<bool>,
|
|
|
|
|
pub experimental_use_unified_exec_tool: Option<bool>,
|
|
|
|
|
pub experimental_use_exec_command_tool: Option<bool>,
|
|
|
|
|
pub experimental_use_rmcp_client: Option<bool>,
|
|
|
|
|
pub experimental_use_freeform_apply_patch: Option<bool>,
|
|
|
|
|
pub tools_web_search: Option<bool>,
|
|
|
|
|
pub tools_view_image: Option<bool>,
|
|
|
|
|
/// Optional feature toggles scoped to this profile.
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
pub features: Option<crate::features::FeaturesToml>,
|
2025-05-13 16:52:52 -07:00
|
|
|
}
|
2025-09-04 16:26:41 -07:00
|
|
|
|
fix: remove mcp-types from app server protocol (#4537)
We continue the separation between `codex app-server` and `codex
mcp-server`.
In particular, we introduce a new crate, `codex-app-server-protocol`,
and migrate `codex-rs/protocol/src/mcp_protocol.rs` into it, renaming it
`codex-rs/app-server-protocol/src/protocol.rs`.
Because `ConversationId` was defined in `mcp_protocol.rs`, we move it
into its own file, `codex-rs/protocol/src/conversation_id.rs`, and
because it is referenced in a ton of places, we have to touch a lot of
files as part of this PR.
We also decide to get away from proper JSON-RPC 2.0 semantics, so we
also introduce `codex-rs/app-server-protocol/src/jsonrpc_lite.rs`, which
is basically the same `JSONRPCMessage` type defined in `mcp-types`
except with all of the `"jsonrpc": "2.0"` removed.
Getting rid of `"jsonrpc": "2.0"` makes our serialization logic
considerably simpler, as we can lean heavier on serde to serialize
directly into the wire format that we use now.
2025-09-30 19:16:26 -07:00
|
|
|
impl From<ConfigProfile> for codex_app_server_protocol::Profile {
|
2025-09-04 16:26:41 -07:00
|
|
|
fn from(config_profile: ConfigProfile) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
model: config_profile.model,
|
|
|
|
|
model_provider: config_profile.model_provider,
|
|
|
|
|
approval_policy: config_profile.approval_policy,
|
|
|
|
|
model_reasoning_effort: config_profile.model_reasoning_effort,
|
|
|
|
|
model_reasoning_summary: config_profile.model_reasoning_summary,
|
|
|
|
|
model_verbosity: config_profile.model_verbosity,
|
|
|
|
|
chatgpt_base_url: config_profile.chatgpt_base_url,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|