mirror of
https://github.com/openai/codex.git
synced 2026-11-05 08:28:29 +00:00
TUI Plugin Sharing 1 - add remote plugin identity (#26701)
This commit is contained in:
1 parent
51b3cd51f6
commit
fb8f1ea0d5
7 files changed
+573
-74
No files matched your search
@@ -241,7 +241,7 @@ impl App {
|
||||
&mut self,
|
||||
app_server: &AppServerSession,
|
||||
cwd: PathBuf,
|
||||
marketplace_path: AbsolutePathBuf,
|
||||
location: PluginLocation,
|
||||
plugin_name: String,
|
||||
plugin_display_name: String,
|
||||
) {
|
||||
@@ -249,14 +249,14 @@ impl App {
|
||||
let app_event_tx = self.app_event_tx.clone();
|
||||
tokio::spawn(async move {
|
||||
let cwd_for_event = cwd.clone();
|
||||
let marketplace_path_for_event = marketplace_path.clone();
|
||||
let location_for_event = location.clone();
|
||||
let plugin_name_for_event = plugin_name.clone();
|
||||
let result = fetch_plugin_install(request_handle, marketplace_path, plugin_name)
|
||||
let result = fetch_plugin_install(request_handle, location, plugin_name)
|
||||
.await
|
||||
.map_err(|err| format!("Failed to install plugin: {err}"));
|
||||
app_event_tx.send(AppEvent::PluginInstallLoaded {
|
||||
cwd: cwd_for_event,
|
||||
marketplace_path: marketplace_path_for_event,
|
||||
location: location_for_event,
|
||||
plugin_name: plugin_name_for_event,
|
||||
plugin_display_name,
|
||||
result,
|
||||
@@ -835,16 +835,17 @@ pub(super) async fn fetch_marketplace_upgrade(
|
||||
}
|
||||
pub(super) async fn fetch_plugin_install(
|
||||
request_handle: AppServerRequestHandle,
|
||||
marketplace_path: AbsolutePathBuf,
|
||||
location: PluginLocation,
|
||||
plugin_name: String,
|
||||
) -> Result<PluginInstallResponse> {
|
||||
let request_id = RequestId::String(format!("plugin-install-{}", Uuid::new_v4()));
|
||||
let (marketplace_path, remote_marketplace_name) = location.into_request_params();
|
||||
request_handle
|
||||
.request_typed(ClientRequest::PluginInstall {
|
||||
request_id,
|
||||
params: PluginInstallParams {
|
||||
marketplace_path: Some(marketplace_path),
|
||||
remote_marketplace_name: None,
|
||||
marketplace_path,
|
||||
remote_marketplace_name,
|
||||
plugin_name,
|
||||
},
|
||||
})
|
||||
@@ -1062,6 +1063,26 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plugin_location_request_params_select_exactly_one_location() {
|
||||
let local_path = test_absolute_path("/marketplaces/local");
|
||||
|
||||
assert_eq!(
|
||||
PluginLocation::Local {
|
||||
marketplace_path: local_path.clone()
|
||||
}
|
||||
.into_request_params(),
|
||||
(Some(local_path), None)
|
||||
);
|
||||
assert_eq!(
|
||||
PluginLocation::Remote {
|
||||
marketplace_name: "workspace-directory".to_string()
|
||||
}
|
||||
.into_request_params(),
|
||||
(None, Some("workspace-directory".to_string()))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mcp_inventory_maps_prefix_tool_names_by_server() {
|
||||
let statuses = vec![
|
||||
|
||||
@@ -573,14 +573,14 @@ impl App {
|
||||
}
|
||||
AppEvent::FetchPluginInstall {
|
||||
cwd,
|
||||
marketplace_path,
|
||||
location,
|
||||
plugin_name,
|
||||
plugin_display_name,
|
||||
} => {
|
||||
self.fetch_plugin_install(
|
||||
app_server,
|
||||
cwd,
|
||||
marketplace_path,
|
||||
location,
|
||||
plugin_name,
|
||||
plugin_display_name,
|
||||
);
|
||||
@@ -601,7 +601,7 @@ impl App {
|
||||
}
|
||||
AppEvent::PluginInstallLoaded {
|
||||
cwd,
|
||||
marketplace_path,
|
||||
location,
|
||||
plugin_name,
|
||||
plugin_display_name,
|
||||
result,
|
||||
@@ -612,7 +612,7 @@ impl App {
|
||||
}
|
||||
let should_refresh_plugin_detail = self.chat_widget.on_plugin_install_loaded(
|
||||
cwd.clone(),
|
||||
marketplace_path.clone(),
|
||||
location.clone(),
|
||||
plugin_name.clone(),
|
||||
plugin_display_name,
|
||||
result,
|
||||
@@ -621,12 +621,14 @@ impl App {
|
||||
{
|
||||
self.fetch_plugins_list(app_server, cwd.clone());
|
||||
if should_refresh_plugin_detail {
|
||||
let (marketplace_path, remote_marketplace_name) =
|
||||
location.into_request_params();
|
||||
self.fetch_plugin_detail(
|
||||
app_server,
|
||||
cwd,
|
||||
PluginReadParams {
|
||||
marketplace_path: Some(marketplace_path),
|
||||
remote_marketplace_name: None,
|
||||
marketplace_path,
|
||||
remote_marketplace_name,
|
||||
plugin_name,
|
||||
},
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user