mirror of
https://github.com/openai/codex.git
synced 2026-05-02 12:21:26 +03:00
Add skill approval event/response (#12633)
Set the stage for skill-level permission approval in addition to command-level. Behind a feature flag.
This commit is contained in:
@@ -15,4 +15,5 @@ pub mod parse_command;
|
||||
pub mod plan_tool;
|
||||
pub mod protocol;
|
||||
pub mod request_user_input;
|
||||
pub mod skill_approval;
|
||||
pub mod user_input;
|
||||
|
||||
@@ -40,6 +40,7 @@ use crate::openai_models::ReasoningEffort as ReasoningEffortConfig;
|
||||
use crate::parse_command::ParsedCommand;
|
||||
use crate::plan_tool::UpdatePlanArgs;
|
||||
use crate::request_user_input::RequestUserInputResponse;
|
||||
use crate::skill_approval::SkillApprovalResponse;
|
||||
use crate::user_input::UserInput;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use schemars::JsonSchema;
|
||||
@@ -60,6 +61,7 @@ pub use crate::approvals::NetworkApprovalProtocol;
|
||||
pub use crate::approvals::NetworkPolicyAmendment;
|
||||
pub use crate::approvals::NetworkPolicyRuleAction;
|
||||
pub use crate::request_user_input::RequestUserInputEvent;
|
||||
pub use crate::skill_approval::SkillRequestApprovalEvent;
|
||||
|
||||
/// Open/close tags for special user-input blocks. Used across crates to avoid
|
||||
/// duplicated hardcoded strings.
|
||||
@@ -293,6 +295,14 @@ pub enum Op {
|
||||
response: DynamicToolResponse,
|
||||
},
|
||||
|
||||
/// Resolve a skill approval request.
|
||||
SkillApproval {
|
||||
/// Item id for the in-flight request.
|
||||
id: String,
|
||||
/// User decision.
|
||||
response: SkillApprovalResponse,
|
||||
},
|
||||
|
||||
/// Append an entry to the persistent cross-session message history.
|
||||
///
|
||||
/// Note the entry is not guaranteed to be logged if the user has
|
||||
@@ -1043,6 +1053,8 @@ pub enum EventMsg {
|
||||
|
||||
DynamicToolCallRequest(DynamicToolCallRequest),
|
||||
|
||||
SkillRequestApproval(SkillRequestApprovalEvent),
|
||||
|
||||
ElicitationRequest(ElicitationRequestEvent),
|
||||
|
||||
ApplyPatchApprovalRequest(ApplyPatchApprovalRequestEvent),
|
||||
|
||||
15
codex-rs/protocol/src/skill_approval.rs
Normal file
15
codex-rs/protocol/src/skill_approval.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
|
||||
pub struct SkillRequestApprovalEvent {
|
||||
pub item_id: String,
|
||||
pub skill_name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
|
||||
pub struct SkillApprovalResponse {
|
||||
pub approved: bool,
|
||||
}
|
||||
Reference in New Issue
Block a user