mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00: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:
1 parent
a4076ab4b1
commit
58763afa0f
32 files changed
+671
-4
No files matched your search
@@ -11,6 +11,7 @@ use tokio_util::task::AbortOnDropHandle;
|
||||
use codex_protocol::dynamic_tools::DynamicToolResponse;
|
||||
use codex_protocol::models::ResponseInputItem;
|
||||
use codex_protocol::request_user_input::RequestUserInputResponse;
|
||||
use codex_protocol::skill_approval::SkillApprovalResponse;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
use crate::codex::TurnContext;
|
||||
@@ -71,6 +72,7 @@ impl ActiveTurn {
|
||||
pub(crate) struct TurnState {
|
||||
pending_approvals: HashMap<String, oneshot::Sender<ReviewDecision>>,
|
||||
pending_user_input: HashMap<String, oneshot::Sender<RequestUserInputResponse>>,
|
||||
pending_skill_approvals: HashMap<String, oneshot::Sender<SkillApprovalResponse>>,
|
||||
pending_dynamic_tools: HashMap<String, oneshot::Sender<DynamicToolResponse>>,
|
||||
pending_input: Vec<ResponseInputItem>,
|
||||
}
|
||||
@@ -94,6 +96,7 @@ impl TurnState {
|
||||
pub(crate) fn clear_pending(&mut self) {
|
||||
self.pending_approvals.clear();
|
||||
self.pending_user_input.clear();
|
||||
self.pending_skill_approvals.clear();
|
||||
self.pending_dynamic_tools.clear();
|
||||
self.pending_input.clear();
|
||||
}
|
||||
@@ -121,6 +124,21 @@ impl TurnState {
|
||||
self.pending_dynamic_tools.insert(key, tx)
|
||||
}
|
||||
|
||||
pub(crate) fn insert_pending_skill_approval(
|
||||
&mut self,
|
||||
key: String,
|
||||
tx: oneshot::Sender<SkillApprovalResponse>,
|
||||
) -> Option<oneshot::Sender<SkillApprovalResponse>> {
|
||||
self.pending_skill_approvals.insert(key, tx)
|
||||
}
|
||||
|
||||
pub(crate) fn remove_pending_skill_approval(
|
||||
&mut self,
|
||||
key: &str,
|
||||
) -> Option<oneshot::Sender<SkillApprovalResponse>> {
|
||||
self.pending_skill_approvals.remove(key)
|
||||
}
|
||||
|
||||
pub(crate) fn remove_pending_dynamic_tool(
|
||||
&mut self,
|
||||
key: &str,
|
||||
|
||||
Reference in new issue
Block a user