mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
2cf2a6a844
## Summary Deletes the OnFailure variant of the `AskForApproval` enum. This option has been deprecated since #11631. ## Testing - [x] Tests pass
32 lines
1000 B
Rust
32 lines
1000 B
Rust
//! Standard type to use with the `--approval-mode` CLI option.
|
|
|
|
use clap::ValueEnum;
|
|
|
|
use codex_protocol::protocol::AskForApproval;
|
|
|
|
#[derive(Clone, Copy, Debug, ValueEnum)]
|
|
#[value(rename_all = "kebab-case")]
|
|
pub enum ApprovalModeCliArg {
|
|
/// Only run "trusted" commands (e.g. ls, cat, sed) without asking for user
|
|
/// approval. Will escalate to the user if the model proposes a command that
|
|
/// is not in the "trusted" set.
|
|
Untrusted,
|
|
|
|
/// The model decides when to ask the user for approval.
|
|
OnRequest,
|
|
|
|
/// Never ask for user approval
|
|
/// Execution failures are immediately returned to the model.
|
|
Never,
|
|
}
|
|
|
|
impl From<ApprovalModeCliArg> for AskForApproval {
|
|
fn from(value: ApprovalModeCliArg) -> Self {
|
|
match value {
|
|
ApprovalModeCliArg::Untrusted => AskForApproval::UnlessTrusted,
|
|
ApprovalModeCliArg::OnRequest => AskForApproval::OnRequest,
|
|
ApprovalModeCliArg::Never => AskForApproval::Never,
|
|
}
|
|
}
|
|
}
|