mirror of
https://github.com/openai/codex.git
synced 2026-05-01 18:06:47 +00:00
## Summary Adds the `/permissions` command, with a (usually) shorter set of permissions. `/approvals` still exists, for backwards compatibility. <img width="863" height="309" alt="Screenshot 2026-01-20 at 4 12 51 PM" src="https://github.com/user-attachments/assets/c49b5ba5-bc47-46dd-9067-e1a5670328fe" /> ## Testing - [x] updated unit tests - [x] Tested locally
47 lines
1.8 KiB
Rust
47 lines
1.8 KiB
Rust
use codex_core::protocol::AskForApproval;
|
|
use codex_core::protocol::SandboxPolicy;
|
|
|
|
/// A simple preset pairing an approval policy with a sandbox policy.
|
|
#[derive(Debug, Clone)]
|
|
pub struct ApprovalPreset {
|
|
/// Stable identifier for the preset.
|
|
pub id: &'static str,
|
|
/// Display label shown in UIs.
|
|
pub label: &'static str,
|
|
/// Short human description shown next to the label in UIs.
|
|
pub description: &'static str,
|
|
/// Approval policy to apply.
|
|
pub approval: AskForApproval,
|
|
/// Sandbox policy to apply.
|
|
pub sandbox: SandboxPolicy,
|
|
}
|
|
|
|
/// Built-in list of approval presets that pair approval and sandbox policy.
|
|
///
|
|
/// Keep this UI-agnostic so it can be reused by both TUI and MCP server.
|
|
pub fn builtin_approval_presets() -> Vec<ApprovalPreset> {
|
|
vec![
|
|
ApprovalPreset {
|
|
id: "read-only",
|
|
label: "Read Only",
|
|
description: "Codex can read files in the current workspace. Approval is required to edit files or access the internet.",
|
|
approval: AskForApproval::OnRequest,
|
|
sandbox: SandboxPolicy::ReadOnly,
|
|
},
|
|
ApprovalPreset {
|
|
id: "auto",
|
|
label: "Default",
|
|
description: "Codex can read and edit files in the current workspace, and run commands. Approval is required to access the internet or edit other files. (Identical to Agent mode)",
|
|
approval: AskForApproval::OnRequest,
|
|
sandbox: SandboxPolicy::new_workspace_write_policy(),
|
|
},
|
|
ApprovalPreset {
|
|
id: "full-access",
|
|
label: "Full Access",
|
|
description: "Codex can edit files outside this workspace and access the internet without asking for approval. Exercise caution when using.",
|
|
approval: AskForApproval::Never,
|
|
sandbox: SandboxPolicy::DangerFullAccess,
|
|
},
|
|
]
|
|
}
|