mirror of
https://github.com/openai/codex.git
synced 2026-05-04 21:32:21 +03:00
[apps] Add tool_suggest tool. (#14287)
- [x] Add tool_suggest tool. - [x] Move chatgpt/src/connectors.rs and core/src/connectors.rs into a dedicated mod so that we have all the logic and global cache in one place. - [x] Update TUI app link view to support rendering the installation view for mcp elicitation. --------- Co-authored-by: Shaqayeq <shaqayeq@openai.com> Co-authored-by: Eric Traut <etraut@openai.com> Co-authored-by: pakrym-oai <pakrym@openai.com> Co-authored-by: Ahmed Ibrahim <aibrahim@openai.com> Co-authored-by: guinness-oai <guinness@openai.com> Co-authored-by: Eugene Brevdo <ebrevdo@users.noreply.github.com> Co-authored-by: Charlie Guo <cguo@openai.com> Co-authored-by: Fouad Matin <fouad@openai.com> Co-authored-by: Fouad Matin <169186268+fouad-openai@users.noreply.github.com> Co-authored-by: xl-openai <xl@openai.com> Co-authored-by: alexsong-oai <alexsong@openai.com> Co-authored-by: Owen Lin <owenlin0@gmail.com> Co-authored-by: sdcoffey <stevendcoffey@gmail.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: Won Park <won@openai.com> Co-authored-by: Dylan Hurd <dylan.hurd@openai.com> Co-authored-by: celia-oai <celia@openai.com> Co-authored-by: gabec-openai <gabec@openai.com> Co-authored-by: joeytrasatti-openai <joey.trasatti@openai.com> Co-authored-by: Leo Shimonaka <leoshimo@openai.com> Co-authored-by: Rasmus Rygaard <rasmus@openai.com> Co-authored-by: maja-openai <163171781+maja-openai@users.noreply.github.com> Co-authored-by: pash-openai <pash@openai.com> Co-authored-by: Josh McKinney <joshka@openai.com>
This commit is contained in:
@@ -47,6 +47,8 @@ mod mcp_server_elicitation;
|
||||
mod multi_select_picker;
|
||||
mod request_user_input;
|
||||
mod status_line_setup;
|
||||
pub(crate) use app_link_view::AppLinkElicitationTarget;
|
||||
pub(crate) use app_link_view::AppLinkSuggestionType;
|
||||
pub(crate) use app_link_view::AppLinkView;
|
||||
pub(crate) use app_link_view::AppLinkViewParams;
|
||||
pub(crate) use approval_overlay::ApprovalOverlay;
|
||||
@@ -963,6 +965,52 @@ impl BottomPane {
|
||||
request
|
||||
};
|
||||
|
||||
if let Some(tool_suggestion) = request.tool_suggestion() {
|
||||
let suggestion_type = match tool_suggestion.suggest_type {
|
||||
mcp_server_elicitation::ToolSuggestionType::Install => {
|
||||
AppLinkSuggestionType::Install
|
||||
}
|
||||
mcp_server_elicitation::ToolSuggestionType::Enable => AppLinkSuggestionType::Enable,
|
||||
};
|
||||
let is_installed = matches!(
|
||||
tool_suggestion.suggest_type,
|
||||
mcp_server_elicitation::ToolSuggestionType::Enable
|
||||
);
|
||||
let view = AppLinkView::new(
|
||||
AppLinkViewParams {
|
||||
app_id: tool_suggestion.tool_id.clone(),
|
||||
title: tool_suggestion.tool_name.clone(),
|
||||
description: None,
|
||||
instructions: match suggestion_type {
|
||||
AppLinkSuggestionType::Install => {
|
||||
"Install this app in your browser, then return here.".to_string()
|
||||
}
|
||||
AppLinkSuggestionType::Enable => {
|
||||
"Enable this app to use it for the current request.".to_string()
|
||||
}
|
||||
},
|
||||
url: tool_suggestion.install_url.clone(),
|
||||
is_installed,
|
||||
is_enabled: false,
|
||||
suggest_reason: Some(tool_suggestion.suggest_reason.clone()),
|
||||
suggestion_type: Some(suggestion_type),
|
||||
elicitation_target: Some(AppLinkElicitationTarget {
|
||||
thread_id: request.thread_id(),
|
||||
server_name: request.server_name().to_string(),
|
||||
request_id: request.request_id().clone(),
|
||||
}),
|
||||
},
|
||||
self.app_event_tx.clone(),
|
||||
);
|
||||
self.pause_status_timer_for_modal();
|
||||
self.set_composer_input_enabled(
|
||||
false,
|
||||
Some("Respond to the tool suggestion to continue.".to_string()),
|
||||
);
|
||||
self.push_view(Box::new(view));
|
||||
return;
|
||||
}
|
||||
|
||||
let modal = McpServerElicitationOverlay::new(
|
||||
request,
|
||||
self.app_event_tx.clone(),
|
||||
|
||||
Reference in New Issue
Block a user