mirror of
https://github.com/openai/codex.git
synced 2026-11-19 23:05:23 +00:00
TUI Plugin Sharing 3 - render remote plugin catalog sections (#26703)
## Summary [#26701](https://github.com/openai/codex/pull/26701) added remote plugin identity support, [#26702](https://github.com/openai/codex/pull/26702) added remote-section fetching and state, and [#28768](https://github.com/openai/codex/pull/28768) extracted the catalog rendering module. This PR builds the product-facing `/plugins` catalog on that foundation so remote records appear as OpenAI Curated, Workspace, and Shared with me sections rather than backend marketplace implementation details. Plugin details remain read-only for sharing metadata. This PR does not add share-authoring actions or change the app-server protocol. ## Changes - Renders OpenAI Curated, Workspace, and Shared with me sections with loading, empty, and error states. - Preserves section selection and stable tab ordering as remote sections transition between fallback and populated states. - Shows OpenAI Curated loading only when the explicit vertical fallback request was issued. - Centralizes remote marketplace identity matching around the existing marketplace constants. - Uses product labels for remote marketplaces and identifies the personal marketplace as Local by its path. - Shows read-only source, authentication, version, and sharing metadata in plugin detail views. - Applies narrow display deduplication for local and remote records sharing a remote plugin ID: - installed records take precedence; - local mapped sources are preferred for details only when their installed state matches the selected record. - Returns from detail and confirmation views through the current plugin cache so newly loaded remote sections are not overwritten by an older captured response. - Keeps admin-disabled plugins view-only and labels default-installed plugins as Available by default. ## Tests New tests: - `plugins_popup_admin_disabled_available_plugin_has_view_only_hint` - `plugins_popup_remote_section_fallback_states_snapshot` - `plugins_popup_installed_remote_row_keeps_remote_detail_when_local_share_is_uninstalled` Updated existing plugin catalog tests and snapshots for product labels, detail metadata, personal-marketplace labeling, and stable tab ordering. Verification: - `cargo clippy -p codex-tui --all-targets -- -D warnings` ## Follow-ups - Local/remote duplicate normalization should eventually move into app-server. This PR intentionally keeps the compatibility behavior narrow and display-only. - PR5 will sanitize sensitive components before displaying Git source URLs.
This commit is contained in:
1 parent
44dbae90eb
commit
f6fa259312
9 files changed
+1003
-150
No files matched your search
@@ -42,6 +42,7 @@ pub(super) const ADD_MARKETPLACE_TAB_ID: &str = "add-marketplace";
|
||||
pub(super) struct PluginListFetchState {
|
||||
pub(super) cache_cwd: Option<PathBuf>,
|
||||
pub(super) in_flight_cwd: Option<PathBuf>,
|
||||
pub(super) vertical_section_requested: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -147,6 +148,7 @@ impl ChatWidget {
|
||||
Err(err) => {
|
||||
self.plugin_remote_sections_loading = false;
|
||||
self.plugin_remote_sections_loaded = false;
|
||||
self.plugins_fetch_state.vertical_section_requested = false;
|
||||
if should_refresh_plugins_popup {
|
||||
self.plugins_fetch_state.cache_cwd = None;
|
||||
self.plugins_cache = PluginsCacheState::Failed(err.clone());
|
||||
@@ -175,6 +177,7 @@ impl ChatWidget {
|
||||
.is_some();
|
||||
self.plugin_remote_sections_loading = false;
|
||||
self.plugin_remote_sections_loaded = true;
|
||||
self.plugins_fetch_state.vertical_section_requested = false;
|
||||
let refreshed_response = match &mut self.plugins_cache {
|
||||
PluginsCacheState::Ready(response)
|
||||
if self.plugins_fetch_state.cache_cwd.as_deref() == Some(cwd.as_path()) =>
|
||||
@@ -212,6 +215,8 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
self.plugins_fetch_state.in_flight_cwd = Some(cwd.clone());
|
||||
self.plugins_fetch_state.vertical_section_requested =
|
||||
!self.config.features.enabled(Feature::RemotePlugin);
|
||||
if self.plugins_fetch_state.cache_cwd.as_deref() != Some(cwd.as_path()) {
|
||||
self.plugins_cache = PluginsCacheState::Loading;
|
||||
}
|
||||
@@ -245,6 +250,36 @@ impl ChatWidget {
|
||||
));
|
||||
}
|
||||
|
||||
pub(crate) fn open_plugins_list(&mut self, cwd: PathBuf, response: PluginListResponse) {
|
||||
if self.config.cwd.as_path() != cwd.as_path() {
|
||||
return;
|
||||
}
|
||||
|
||||
let response = match self.plugins_cache_for_current_cwd() {
|
||||
PluginsCacheState::Ready(current_response) => current_response,
|
||||
PluginsCacheState::Uninitialized
|
||||
| PluginsCacheState::Loading
|
||||
| PluginsCacheState::Failed(_) => response,
|
||||
};
|
||||
self.plugins_fetch_state.cache_cwd = Some(cwd);
|
||||
self.plugins_cache = PluginsCacheState::Ready(response.clone());
|
||||
let active_tab_id = self
|
||||
.bottom_pane
|
||||
.active_tab_id_for_active_view(PLUGINS_SELECTION_VIEW_ID)
|
||||
.map(str::to_string)
|
||||
.or_else(|| self.plugins_active_tab_id.clone())
|
||||
.or_else(|| Some(ALL_PLUGINS_TAB_ID.to_string()));
|
||||
self.plugins_active_tab_id = active_tab_id.clone();
|
||||
let params =
|
||||
self.plugins_popup_params(&response, active_tab_id, /*initial_selected_idx*/ None);
|
||||
if !self
|
||||
.bottom_pane
|
||||
.replace_selection_view_if_active(PLUGINS_SELECTION_VIEW_ID, params)
|
||||
{
|
||||
self.open_plugins_popup(&response);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn open_marketplace_add_prompt(&mut self) {
|
||||
self.plugins_active_tab_id = Some(ADD_MARKETPLACE_TAB_ID.to_string());
|
||||
let tx = self.app_event_tx.clone();
|
||||
|
||||
Reference in new issue
Block a user