The existing `wire_format.rs` should share more types with the `codex-protocol` crate (like `AskForApproval` instead of maintaining a parallel `CodexToolCallApprovalPolicy` enum), so this PR moves `wire_format.rs` into `codex-protocol`, renaming it as `mcp-protocol.rs`. We also de-dupe types, where appropriate. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2423). * #2424 * __->__ #2423
29 lines
988 B
Rust
29 lines
988 B
Rust
//! Standard type to use with the `--sandbox` (`-s`) CLI option.
|
|
//!
|
|
//! This mirrors the variants of [`codex_core::protocol::SandboxPolicy`], but
|
|
//! without any of the associated data so it can be expressed as a simple flag
|
|
//! on the command-line. Users that need to tweak the advanced options for
|
|
//! `workspace-write` can continue to do so via `-c` overrides or their
|
|
//! `config.toml`.
|
|
|
|
use clap::ValueEnum;
|
|
use codex_protocol::config_types::SandboxMode;
|
|
|
|
#[derive(Clone, Copy, Debug, ValueEnum)]
|
|
#[value(rename_all = "kebab-case")]
|
|
pub enum SandboxModeCliArg {
|
|
ReadOnly,
|
|
WorkspaceWrite,
|
|
DangerFullAccess,
|
|
}
|
|
|
|
impl From<SandboxModeCliArg> for SandboxMode {
|
|
fn from(value: SandboxModeCliArg) -> Self {
|
|
match value {
|
|
SandboxModeCliArg::ReadOnly => SandboxMode::ReadOnly,
|
|
SandboxModeCliArg::WorkspaceWrite => SandboxMode::WorkspaceWrite,
|
|
SandboxModeCliArg::DangerFullAccess => SandboxMode::DangerFullAccess,
|
|
}
|
|
}
|
|
}
|