mirror of
https://github.com/openai/codex.git
synced 2026-11-29 00:00:54 +00:00
Add onboarding option picker tool
This commit is contained in:
@@ -21,6 +21,7 @@ pub mod models;
|
||||
pub mod network_policy;
|
||||
pub mod num_format;
|
||||
pub mod openai_models;
|
||||
pub mod option_picker;
|
||||
pub mod parse_command;
|
||||
pub mod permissions;
|
||||
pub mod plan_tool;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OptionPickerOption {
|
||||
pub label: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OptionPickerArgs {
|
||||
pub question: String,
|
||||
pub options: Vec<OptionPickerOption>,
|
||||
#[serde(default)]
|
||||
pub allow_multiple: bool,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub submit_label: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub skip_label: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum OptionPickerAction {
|
||||
Submit,
|
||||
Skip,
|
||||
Dismiss,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OptionPickerResponse {
|
||||
pub action: OptionPickerAction,
|
||||
pub selected_options: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub freeform_answer: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OptionPickerEvent {
|
||||
/// Responses API call id for the associated tool call, if available.
|
||||
pub call_id: String,
|
||||
/// Turn ID that this request belongs to.
|
||||
pub turn_id: String,
|
||||
pub question: String,
|
||||
pub options: Vec<OptionPickerOption>,
|
||||
pub allow_multiple: bool,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub submit_label: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub skip_label: Option<String>,
|
||||
}
|
||||
@@ -43,6 +43,7 @@ use crate::models::SandboxEnforcement;
|
||||
use crate::models::WebSearchAction;
|
||||
use crate::num_format::format_with_separators;
|
||||
use crate::openai_models::ReasoningEffort as ReasoningEffortConfig;
|
||||
use crate::option_picker::OptionPickerResponse;
|
||||
use crate::parse_command::ParsedCommand;
|
||||
use crate::plan_tool::UpdatePlanArgs;
|
||||
use crate::request_permissions::RequestPermissionsEvent;
|
||||
@@ -75,6 +76,7 @@ pub use crate::approvals::NetworkApprovalContext;
|
||||
pub use crate::approvals::NetworkApprovalProtocol;
|
||||
pub use crate::approvals::NetworkPolicyAmendment;
|
||||
pub use crate::approvals::NetworkPolicyRuleAction;
|
||||
pub use crate::option_picker::OptionPickerEvent;
|
||||
pub use crate::permissions::FileSystemAccessMode;
|
||||
pub use crate::permissions::FileSystemPath;
|
||||
pub use crate::permissions::FileSystemSandboxEntry;
|
||||
@@ -579,6 +581,14 @@ pub enum Op {
|
||||
response: RequestUserInputResponse,
|
||||
},
|
||||
|
||||
/// Resolve a request_option_picker tool call.
|
||||
OptionPickerResponse {
|
||||
/// Turn id for the in-flight request.
|
||||
id: String,
|
||||
/// User-provided selection.
|
||||
response: OptionPickerResponse,
|
||||
},
|
||||
|
||||
/// Resolve a request_permissions tool call.
|
||||
RequestPermissionsResponse {
|
||||
/// Call id for the in-flight request.
|
||||
@@ -728,6 +738,7 @@ impl Op {
|
||||
Self::PatchApproval { .. } => "patch_approval",
|
||||
Self::ResolveElicitation { .. } => "resolve_elicitation",
|
||||
Self::UserInputAnswer { .. } => "user_input_answer",
|
||||
Self::OptionPickerResponse { .. } => "option_picker_response",
|
||||
Self::RequestPermissionsResponse { .. } => "request_permissions_response",
|
||||
Self::DynamicToolResponse { .. } => "dynamic_tool_response",
|
||||
Self::RefreshMcpServers { .. } => "refresh_mcp_servers",
|
||||
@@ -1246,6 +1257,8 @@ pub enum EventMsg {
|
||||
|
||||
RequestUserInput(RequestUserInputEvent),
|
||||
|
||||
OptionPicker(OptionPickerEvent),
|
||||
|
||||
DynamicToolCallRequest(DynamicToolCallRequest),
|
||||
|
||||
DynamicToolCallResponse(DynamicToolCallResponseEvent),
|
||||
|
||||
Reference in New Issue
Block a user