diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index ff448a3a..8dfd7e1a 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -839,6 +839,15 @@ Codex Apps connector filtering functions that no longer exist in the live module. Do not recreate those tests unless the app connector product is being rebuilt on purpose, which is not the current objective. +The TUI app connector surface is deleted, not hard-off. `/apps` is gone as a +slash command, the app-link view file is deleted, connector AppEvent variants +and dispatch arms are gone, `ChatWidget` no longer owns connector cache, popup, +or prefetch state, the composer no longer generates app mentions, `app://` is +no longer a blessed mention-codec tool path, and stale app-popup tests were +deleted. The browser-opening shim and one-use selection-refresh plumbing died +with the popup. Verification: `cargo check -p codex-tui` passed; `cargo test -p +codex-tui --lib --no-run` timed out after 3 minutes without a diagnostic. + That husk has now been cut from `codex-core`. The root core crate no longer exports `plugins`, no longer depends on `codex-core-plugins` or `codex-plugin`, and the core plugin manager / marketplace add-remove-sync modules and tests @@ -892,10 +901,7 @@ compatibility stump to cut next, not auth/model spine machinery. That stump is now cut from TUI. `/plugins` is no longer a slash command, the `chatwidget/plugins.rs` marketplace popup module is deleted, plugin AppEvent variants and background RPC helpers are gone, plugin enablement write queuing -is gone, and the plugin marketplace popup tests/helpers were deleted. TUI still -has ordinary app connector fields whose protocol shape mentions historical -`plugin_display_names`; those are connector metadata compatibility, not plugin -runtime authority. +is gone, and the plugin marketplace popup tests/helpers were deleted. The app-server plugin JSON-RPC verbs are gone too. `plugin/list`, `plugin/read`, `plugin/install`, and `plugin/uninstall` are no longer diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 5ad40e7b..06983d9c 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index feca3854..413ebb6c 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -280,7 +280,7 @@ rejected_paths: reason: making Epiphany cleaner inside Codex still preserves the wrong organ; Codex must be starved down to OpenAI subscription auth/model transport, while Epiphany data and subsystem communication move to typed CultCache/CultNet. current_status: - summary: The Codex starvation pass has five typing receipts, thirty-eight processor/foundation cuts, a real physical extraction in `epiphany-codex-bridge`, a root `epiphany-state-model` crate for durable Epiphany state, a source-grounded Codex auth spine inventory, the native `epiphany-openai-adapter` document boundary, a buildable Codex auth/model wrapper in `epiphany-openai-codex-spine`, the first native runtime caller in `epiphany-openai-runtime`, native heartbeat launch planning/job opening in `epiphany-core`, native state-update contract/validation/application in `epiphany-core`, native exact retrieval path matching in `epiphany-core`, and the route-facing mutation/view/coordinator projection services in `epiphany-codex-bridge`. `codex-protocol` no longer defines the durable `Epiphany*` state structs; it re-exports the native model for legacy rollout/API compatibility while `epiphany-core` imports the native model directly. `epiphany-core` now has no direct vendored Codex dependency: pressure derivation accepts native `EpiphanyTokenUsageSnapshot`, Codex rollout replay moved to `codex-core::epiphany_rollout`, and exact retrieval search uses Epiphany-owned workspace walking/path scoring instead of `codex-file-search`. The bridge owns Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval/indexing projection, result projection, runtime-spine result adaptation, launch/prompt doctrine, mutation document mechanics, mutation service update/promote/role-accept/reorient-accept/role-launch/reorient-launch/job-launch/job-interrupt application, live-state projection, pressure/pre-compaction rendering, freshness/reorientation projection, CRRC/coordinator/role-board projection, watcher invalidation adaptation, full `thread/epiphany/view` response construction, freshness/context/graph-query response construction, role/reorient result response construction, distill/propose patch-response construction, coordinator status/view construction, and acceptance/evidence signal helpers. Vendored app-server no longer retains root Epiphany modules; `codex_message_processor.rs` still contains route dispatch, JSON-RPC response shaping, watcher registration/snapshotting calls, and notification emission, but its root no longer imports the evacuated Epiphany policy/protocol registry or owns the watcher invalidation manager. Codex product surfaces for apps, skills, plugins, marketplace, and external agent config import are now inert in the app-server compatibility path: list routes return empty lists, mutation/detail/import routes report disabled, `externalAgentConfig/detect` returns no import candidates, helper/import modules and stale implementation-shape tests were deleted, runtime feature enablement no longer supports `apps` or `plugins`, config writes no longer emit plugin-toggle analytics, plugin/skill cache invalidation on config writes is gone, plugin startup warmups and app-list refreshes were removed, and app-server no longer directly depends on `codex-plugin`, `codex-chatgpt`, or `codex-core-plugins`. `Config::to_mcp_config` now keeps user-declared MCP servers but no longer accepts `PluginsManager`, folds plugin MCP servers into the runtime, enables Codex apps, enables skill MCP dependency install, or advertises plugin capability summaries; `TurnContext::apps_enabled()` now returns false so model turns cannot awaken Codex Apps through ChatGPT auth or feature flags; session startup and per-turn context no longer load skills, turns receive an empty `SkillLoadOutcome`, internal `Op::ListSkills` returns empty compatibility entries without loading config layers, plugin roots, skill files, or conversion helpers, the Codex skill watcher has been collapsed to a no-op marker with no file watcher, skill-root registration, cache-clear task, or `SkillsUpdateAvailable` session listener, model turns no longer run skill mention collection, skill env-var prompts, skill MCP dependency installation, skill instruction injection, or implicit skill invocation analytics from shell tools, and the turn prompt/router path no longer loads plugin/app capability summaries, injects available-skill/available-plugin/plugin instruction fragments, parses plugin/app mentions, records app/plugin invocation telemetry, or filters MCP tools through Codex app connectors. `codex_message_processor.rs` is about 9,637 lines; root `message_processor.rs` is about 1,292 lines after the external-agent/config-product cuts; `epiphany_read_routes.rs` is about 579 lines after the full view and read-response extractions; `epiphany_mutation_routes.rs` is about 694 lines after route-load/notification helper cuts and product-surface starvation; `epiphany_state_helpers.rs` is down to a 19-line rollout-state loader; and `codex_thread.rs` is about 1,425 lines after state-update law moved native. `epiphany-openai-adapter` defines CultCache `DatabaseEntry` request/event/receipt/auth-status documents with no Codex app-server or generic JSON dependency. `epiphany-openai-codex-spine` owns all direct Codex auth/model-transport imports for the native OpenAI path: it exposes `default_codex_home` and `auth_manager`, projects `AuthManager` / `CodexAuth` into typed `EpiphanyOpenAiAdapterStatus`, maps typed `EpiphanyOpenAiModelRequest` into Codex API `ResponsesApiRequest`, resolves auth/provider through keeper Codex crates, opens HTTP Responses streams through `codex-api`, maps deltas / completion into typed stream events and receipts, and no longer directly depends on `codex-app-server-protocol` just to name auth mode. `epiphany-openai-runtime` no longer depends directly on `codex-login`; it writes OpenAI status/request/stream-event/receipt records plus runtime sessions/jobs/results/events into `epiphany-core::runtime_spine_cache`, can emit the assistant text artifact for legacy result consumers, is now the default executor for startup-only repo birth specialists, and now has `run-worker` to load a durable `EpiphanyRuntimeWorkerLaunchRequest`, call the typed OpenAI runtime through the spine, persist typed `EpiphanyRuntimeRoleWorkerResult` / `EpiphanyRuntimeReorientWorkerResult` documents, and complete the original heartbeat/specialist runtime job without Codex worker execution; `codex exec` survives only as explicit fallback in repo-birth startup. `epiphany-mvp-coordinator` now invokes `epiphany-openai-runtime run-worker` for launched runtime job ids and no longer creates a second coordinator-owned shadow runtime job/result as a compensator. `epiphany-core::plan_runtime_spine_heartbeat_launch` validates launch contracts/conflicts and projects durable job bindings/runtime links; `epiphany-core::open_runtime_spine_heartbeat_job` owns the initialize-runtime/ensure-session/create-job sequence and now persists `EpiphanyRuntimeWorkerLaunchRequest` CultCache records keyed by runtime job id, with indexed kind/contract fields plus MessagePack-encoded typed launch documents instead of discarding work intent after queue receipt creation; `roleResult` and `reorientResult` now prefer typed worker result documents and fall back only to generic job summaries for older receipts; `epiphany-core::EpiphanyStateUpdate`, `epiphany_state_update_validation_errors`, and `apply_epiphany_state_update` own state-update document shape and mutation law while `codex-core` calls them for compatibility. Vendored `CodexThread::epiphany_launch_job` is now mostly revision check, persistence validation, launch request handoff, and rollout/session writeback for the compatibility route. Vendored `codex-core` no longer has `epiphany_distillation`, `epiphany_promotion`, `epiphany_proposal`, or `epiphany_retrieval` husk modules; it re-exports native surfaces from `epiphany-core` directly, and now owns only the real Codex rollout adapter because it is a host seam. `epiphany-runtime-spine` advertises OpenAI adapter status/model-request/stream-event/receipt CultNet schemas and mutation contracts, so the native caller now has a real storage route instead of only JSON-RPC. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON. The current OpenAI spine still pulls `codex-api` and a large transport dependency stack, so its next cut is dependency starvation after richer live callers move. + summary: The Codex starvation pass has five typing receipts, thirty-nine processor/foundation cuts, a real physical extraction in `epiphany-codex-bridge`, a root `epiphany-state-model` crate for durable Epiphany state, a source-grounded Codex auth spine inventory, the native `epiphany-openai-adapter` document boundary, a buildable Codex auth/model wrapper in `epiphany-openai-codex-spine`, the first native runtime caller in `epiphany-openai-runtime`, native heartbeat launch planning/job opening in `epiphany-core`, native state-update contract/validation/application in `epiphany-core`, native exact retrieval path matching in `epiphany-core`, and the route-facing mutation/view/coordinator projection services in `epiphany-codex-bridge`. `codex-protocol` no longer defines the durable `Epiphany*` state structs; it re-exports the native model for legacy rollout/API compatibility while `epiphany-core` imports the native model directly. `epiphany-core` now has no direct vendored Codex dependency: pressure derivation accepts native `EpiphanyTokenUsageSnapshot`, Codex rollout replay moved to `codex-core::epiphany_rollout`, and exact retrieval search uses Epiphany-owned workspace walking/path scoring instead of `codex-file-search`. The bridge owns Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval/indexing projection, result projection, runtime-spine result adaptation, launch/prompt doctrine, mutation document mechanics, mutation service update/promote/role-accept/reorient-accept/role-launch/reorient-launch/job-launch/job-interrupt application, live-state projection, pressure/pre-compaction rendering, freshness/reorientation projection, CRRC/coordinator/role-board projection, watcher invalidation adaptation, full `thread/epiphany/view` response construction, freshness/context/graph-query response construction, role/reorient result response construction, distill/propose patch-response construction, coordinator status/view construction, and acceptance/evidence signal helpers. Vendored app-server no longer retains root Epiphany modules; `codex_message_processor.rs` still contains route dispatch, JSON-RPC response shaping, watcher registration/snapshotting calls, and notification emission, but its root no longer imports the evacuated Epiphany policy/protocol registry or owns the watcher invalidation manager. Codex product surfaces for apps, skills, plugins, marketplace, and external agent config import are now inert in the app-server compatibility path: list routes return empty lists, mutation/detail/import routes report disabled, `externalAgentConfig/detect` returns no import candidates, helper/import modules and stale implementation-shape tests were deleted, runtime feature enablement no longer supports `apps` or `plugins`, config writes no longer emit plugin-toggle analytics, plugin/skill cache invalidation on config writes is gone, plugin startup warmups and app-list refreshes were removed, and app-server no longer directly depends on `codex-plugin`, `codex-chatgpt`, or `codex-core-plugins`. `Config::to_mcp_config` now keeps user-declared MCP servers but no longer accepts `PluginsManager`, folds plugin MCP servers into the runtime, enables Codex apps, enables skill MCP dependency install, or advertises plugin capability summaries; `TurnContext::apps_enabled()` now returns false so model turns cannot awaken Codex Apps through ChatGPT auth or feature flags; session startup and per-turn context no longer load skills, turns receive an empty `SkillLoadOutcome`, internal `Op::ListSkills` returns empty compatibility entries without loading config layers, plugin roots, skill files, or conversion helpers, the Codex skill watcher has been collapsed to a no-op marker with no file watcher, skill-root registration, cache-clear task, or `SkillsUpdateAvailable` session listener, model turns no longer run skill mention collection, skill env-var prompts, skill MCP dependency installation, skill instruction injection, or implicit skill invocation analytics from shell tools, and the turn prompt/router path no longer loads plugin/app capability summaries, injects available-skill/available-plugin/plugin instruction fragments, parses plugin/app mentions, records app/plugin invocation telemetry, or filters MCP tools through Codex app connectors. The TUI app connector product path is also deleted: no `/apps` slash command, app-link view, connector AppEvent variants, app connector cache/popup/refresh loop, app mention insertion, `app://` mention codec support, stale app-popup tests, or TUI browser-opening shim remains. `codex_message_processor.rs` is about 9,637 lines; root `message_processor.rs` is about 1,292 lines after the external-agent/config-product cuts; `epiphany_read_routes.rs` is about 579 lines after the full view and read-response extractions; `epiphany_mutation_routes.rs` is about 694 lines after route-load/notification helper cuts and product-surface starvation; `epiphany_state_helpers.rs` is down to a 19-line rollout-state loader; and `codex_thread.rs` is about 1,425 lines after state-update law moved native. `epiphany-openai-adapter` defines CultCache `DatabaseEntry` request/event/receipt/auth-status documents with no Codex app-server or generic JSON dependency. `epiphany-openai-codex-spine` owns all direct Codex auth/model-transport imports for the native OpenAI path: it exposes `default_codex_home` and `auth_manager`, projects `AuthManager` / `CodexAuth` into typed `EpiphanyOpenAiAdapterStatus`, maps typed `EpiphanyOpenAiModelRequest` into Codex API `ResponsesApiRequest`, resolves auth/provider through keeper Codex crates, opens HTTP Responses streams through `codex-api`, maps deltas / completion into typed stream events and receipts, and no longer directly depends on `codex-app-server-protocol` just to name auth mode. `epiphany-openai-runtime` no longer depends directly on `codex-login`; it writes OpenAI status/request/stream-event/receipt records plus runtime sessions/jobs/results/events into `epiphany-core::runtime_spine_cache`, can emit the assistant text artifact for legacy result consumers, is now the default executor for startup-only repo birth specialists, and now has `run-worker` to load a durable `EpiphanyRuntimeWorkerLaunchRequest`, call the typed OpenAI runtime through the spine, persist typed `EpiphanyRuntimeRoleWorkerResult` / `EpiphanyRuntimeReorientWorkerResult` documents, and complete the original heartbeat/specialist runtime job without Codex worker execution; `codex exec` survives only as explicit fallback in repo-birth startup. `epiphany-mvp-coordinator` now invokes `epiphany-openai-runtime run-worker` for launched runtime job ids and no longer creates a second coordinator-owned shadow runtime job/result as a compensator. `epiphany-core::plan_runtime_spine_heartbeat_launch` validates launch contracts/conflicts and projects durable job bindings/runtime links; `epiphany-core::open_runtime_spine_heartbeat_job` owns the initialize-runtime/ensure-session/create-job sequence and now persists `EpiphanyRuntimeWorkerLaunchRequest` CultCache records keyed by runtime job id, with indexed kind/contract fields plus MessagePack-encoded typed launch documents instead of discarding work intent after queue receipt creation; `roleResult` and `reorientResult` now prefer typed worker result documents and fall back only to generic job summaries for older receipts; `epiphany-core::EpiphanyStateUpdate`, `epiphany_state_update_validation_errors`, and `apply_epiphany_state_update` own state-update document shape and mutation law while `codex-core` calls them for compatibility. Vendored `CodexThread::epiphany_launch_job` is now mostly revision check, persistence validation, launch request handoff, and rollout/session writeback for the compatibility route. Vendored `codex-core` no longer has `epiphany_distillation`, `epiphany_promotion`, `epiphany_proposal`, or `epiphany_retrieval` husk modules; it re-exports native surfaces from `epiphany-core` directly, and now owns only the real Codex rollout adapter because it is a host seam. `epiphany-runtime-spine` advertises OpenAI adapter status/model-request/stream-event/receipt CultNet schemas and mutation contracts, so the native caller now has a real storage route instead of only JSON-RPC. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON. The current OpenAI spine still pulls `codex-api` and a large transport dependency stack, so its next cut is dependency starvation after richer live callers move. latest_cut: > Codex Apps no longer have privileged MCP/runtime treatment in the keeper path. MCP exposure is now uniform: small tool sets are direct, large or @@ -349,6 +349,12 @@ current_status: were removed, and TUI connector activation is hard-off while the core connector list remains an inert compatibility stub. The unreferenced `core/src/connectors_tests.rs` app-policy/cache fossil was deleted rather - than preserved as a fake guardrail. MCP remains JSON-RPC at the edge; - user-declared MCP servers are the only runtime MCP authority. + than preserved as a fake guardrail. The TUI app connector surface has now + been deleted instead of left hard-off: `/apps`, the app-link view, + connector AppEvent variants, connector cache/popup/refresh machinery, app + mention insertion, `app://` mention codec support, stale app-popup tests, + the browser-opening shim, and the one-use selection-refresh plumbing are + gone. `cargo check -p codex-tui` passes; `cargo test -p codex-tui --lib + --no-run` timed out at 3 minutes without a diagnostic. MCP remains JSON-RPC + at the edge; user-declared MCP servers are the only runtime MCP authority. next_action: Continue starving coordinator/runtime execution and operator surfaces off app-server JSON-RPC and out of `codex_message_processor.rs`; keep the vestigial Codex organ narrowed to subscription auth/model transport. diff --git a/vendor/codex/codex-rs/tui/src/app/event_dispatch.rs b/vendor/codex/codex-rs/tui/src/app/event_dispatch.rs index 553062a8..5d3fc5b5 100644 --- a/vendor/codex/codex-rs/tui/src/app/event_dispatch.rs +++ b/vendor/codex/codex-rs/tui/src/app/event_dispatch.rs @@ -274,32 +274,6 @@ impl App { )); tui.frame_requester().schedule_frame(); } - AppEvent::OpenAppLink { - app_id, - title, - description, - instructions, - url, - is_installed, - is_enabled, - } => { - self.chat_widget - .open_app_link_view(crate::bottom_pane::AppLinkViewParams { - app_id, - title, - description, - instructions, - url, - is_installed, - is_enabled, - }); - } - AppEvent::OpenUrlInBrowser { url } => { - self.open_url_in_browser(url); - } - AppEvent::RefreshConnectors { force_refetch } => { - self.chat_widget.refresh_connectors(force_refetch); - } AppEvent::FetchMcpInventory { detail } => { self.fetch_mcp_inventory(app_server, detail); } @@ -356,9 +330,6 @@ impl App { } } }, - AppEvent::ConnectorsLoaded { result, is_final } => { - self.chat_widget.on_connectors_loaded(result, is_final); - } AppEvent::UpdateReasoningEffort(effort) => { self.on_update_reasoning_effort(effort); } @@ -1215,55 +1186,6 @@ impl App { } } } - AppEvent::SetAppEnabled { id, enabled } => { - let edits = if enabled { - vec![ - ConfigEdit::ClearPath { - segments: vec!["apps".to_string(), id.clone(), "enabled".to_string()], - }, - ConfigEdit::ClearPath { - segments: vec![ - "apps".to_string(), - id.clone(), - "disabled_reason".to_string(), - ], - }, - ] - } else { - vec![ - ConfigEdit::SetPath { - segments: vec!["apps".to_string(), id.clone(), "enabled".to_string()], - value: false.into(), - }, - ConfigEdit::SetPath { - segments: vec![ - "apps".to_string(), - id.clone(), - "disabled_reason".to_string(), - ], - value: "user".into(), - }, - ] - }; - match ConfigEditsBuilder::new(&self.config.codex_home) - .with_edits(edits) - .apply() - .await - { - Ok(()) => { - self.chat_widget.update_connector_enabled(&id, enabled); - if let Err(err) = self.refresh_in_memory_config_from_disk().await { - tracing::warn!(error = %err, "failed to refresh config after app toggle"); - } - self.chat_widget.submit_op(AppCommand::reload_user_config()); - } - Err(err) => { - self.chat_widget.add_error_message(format!( - "Failed to update app config for {id}: {err}" - )); - } - } - } AppEvent::OpenPermissionsPopup => { self.chat_widget.open_permissions_popup(); } diff --git a/vendor/codex/codex-rs/tui/src/app/history_ui.rs b/vendor/codex/codex-rs/tui/src/app/history_ui.rs index 703cc38c..be59597a 100644 --- a/vendor/codex/codex-rs/tui/src/app/history_ui.rs +++ b/vendor/codex/codex-rs/tui/src/app/history_ui.rs @@ -6,17 +6,6 @@ use super::*; impl App { - pub(super) fn open_url_in_browser(&mut self, url: String) { - if let Err(err) = webbrowser::open(&url) { - self.chat_widget - .add_error_message(format!("Failed to open browser for {url}: {err}")); - return; - } - - self.chat_widget - .add_info_message(format!("Opened {url} in your browser."), /*hint*/ None); - } - pub(super) fn clear_ui_header_lines_with_version( &self, width: u16, diff --git a/vendor/codex/codex-rs/tui/src/app_command.rs b/vendor/codex/codex-rs/tui/src/app_command.rs index 9bd02467..e2a4aa73 100644 --- a/vendor/codex/codex-rs/tui/src/app_command.rs +++ b/vendor/codex/codex-rs/tui/src/app_command.rs @@ -238,10 +238,6 @@ impl AppCommand { Self(Op::RequestPermissionsResponse { id, response }) } - pub(crate) fn reload_user_config() -> Self { - Self(Op::ReloadUserConfig) - } - pub(crate) fn list_skills(cwds: Vec, force_reload: bool) -> Self { Self(Op::ListSkills { cwds, force_reload }) } diff --git a/vendor/codex/codex-rs/tui/src/app_event.rs b/vendor/codex/codex-rs/tui/src/app_event.rs index 9c25d189..474fcaf6 100644 --- a/vendor/codex/codex-rs/tui/src/app_event.rs +++ b/vendor/codex/codex-rs/tui/src/app_event.rs @@ -12,7 +12,6 @@ use std::path::PathBuf; use codex_app_server_protocol::AddCreditsNudgeCreditType; use codex_app_server_protocol::AddCreditsNudgeEmailStatus; -use codex_app_server_protocol::AppInfo; use codex_app_server_protocol::McpServerStatus; use codex_app_server_protocol::McpServerStatusDetail; use codex_app_server_protocol::SkillsListResponse; @@ -71,12 +70,6 @@ pub(crate) enum WindowsSandboxEnableMode { Legacy, } -#[derive(Debug, Clone)] -#[cfg_attr(not(target_os = "windows"), allow(dead_code))] -pub(crate) struct ConnectorsSnapshot { - pub(crate) connectors: Vec, -} - /// Distinguishes why a rate-limit refresh was requested so the completion /// handler can route the result correctly. /// @@ -197,36 +190,9 @@ pub(crate) enum AppEvent { result: Result, }, - /// Result of prefetching connectors. - ConnectorsLoaded { - result: Result, - is_final: bool, - }, - /// Result of computing a `/diff` command. DiffResult(String), - /// Open the app link view in the bottom pane. - OpenAppLink { - app_id: String, - title: String, - description: Option, - instructions: String, - url: String, - is_installed: bool, - is_enabled: bool, - }, - - /// Open the provided URL in the user's browser. - OpenUrlInBrowser { - url: String, - }, - - /// Refresh app connector state and mention bindings. - RefreshConnectors { - force_refetch: bool, - }, - /// Fetch MCP inventory via app-server RPCs and render it into history. FetchMcpInventory { detail: McpServerStatusDetail, @@ -476,12 +442,6 @@ pub(crate) enum AppEvent { enabled: bool, }, - /// Enable or disable an app by connector ID. - SetAppEnabled { - id: String, - enabled: bool, - }, - /// Notify that the manage skills popup was closed. ManageSkillsClosed, diff --git a/vendor/codex/codex-rs/tui/src/bottom_pane/app_link_view.rs b/vendor/codex/codex-rs/tui/src/bottom_pane/app_link_view.rs deleted file mode 100644 index 5dbbcf1e..00000000 --- a/vendor/codex/codex-rs/tui/src/bottom_pane/app_link_view.rs +++ /dev/null @@ -1,597 +0,0 @@ -use crossterm::event::KeyCode; -use crossterm::event::KeyEvent; -use crossterm::event::KeyModifiers; -use ratatui::buffer::Buffer; -use ratatui::layout::Constraint; -use ratatui::layout::Layout; -use ratatui::layout::Rect; -use ratatui::style::Stylize; -use ratatui::text::Line; -use ratatui::widgets::Block; -use ratatui::widgets::Paragraph; -use ratatui::widgets::Widget; -use ratatui::widgets::Wrap; -use textwrap::wrap; - -use super::CancellationEvent; -use super::bottom_pane_view::BottomPaneView; -use super::scroll_state::ScrollState; -use super::selection_popup_common::GenericDisplayRow; -use super::selection_popup_common::measure_rows_height; -use super::selection_popup_common::render_rows; -use crate::app_event::AppEvent; -use crate::app_event_sender::AppEventSender; -use crate::key_hint; -use crate::render::Insets; -use crate::render::RectExt as _; -use crate::style::user_message_style; -use crate::wrapping::RtOptions; -use crate::wrapping::adaptive_wrap_lines; - -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -enum AppLinkScreen { - Link, - InstallConfirmation, -} - -pub(crate) struct AppLinkViewParams { - pub(crate) app_id: String, - pub(crate) title: String, - pub(crate) description: Option, - pub(crate) instructions: String, - pub(crate) url: String, - pub(crate) is_installed: bool, - pub(crate) is_enabled: bool, -} - -pub(crate) struct AppLinkView { - app_id: String, - title: String, - description: Option, - instructions: String, - url: String, - is_installed: bool, - is_enabled: bool, - app_event_tx: AppEventSender, - screen: AppLinkScreen, - selected_action: usize, - complete: bool, -} - -impl AppLinkView { - pub(crate) fn new(params: AppLinkViewParams, app_event_tx: AppEventSender) -> Self { - let AppLinkViewParams { - app_id, - title, - description, - instructions, - url, - is_installed, - is_enabled, - } = params; - Self { - app_id, - title, - description, - instructions, - url, - is_installed, - is_enabled, - app_event_tx, - screen: AppLinkScreen::Link, - selected_action: 0, - complete: false, - } - } - - fn action_labels(&self) -> Vec<&'static str> { - match self.screen { - AppLinkScreen::Link => { - if self.is_installed { - vec![ - "Manage on ChatGPT", - if self.is_enabled { - "Disable app" - } else { - "Enable app" - }, - "Back", - ] - } else { - vec!["Install on ChatGPT", "Back"] - } - } - AppLinkScreen::InstallConfirmation => vec!["I already Installed it", "Back"], - } - } - - fn move_selection_prev(&mut self) { - self.selected_action = self.selected_action.saturating_sub(1); - } - - fn move_selection_next(&mut self) { - self.selected_action = (self.selected_action + 1).min(self.action_labels().len() - 1); - } - - fn open_chatgpt_link(&mut self) { - self.app_event_tx.send(AppEvent::OpenUrlInBrowser { - url: self.url.clone(), - }); - if !self.is_installed { - self.screen = AppLinkScreen::InstallConfirmation; - self.selected_action = 0; - } - } - - fn refresh_connectors_and_close(&mut self) { - self.app_event_tx.send(AppEvent::RefreshConnectors { - force_refetch: true, - }); - self.complete = true; - } - - fn back_to_link_screen(&mut self) { - self.screen = AppLinkScreen::Link; - self.selected_action = 0; - } - - fn toggle_enabled(&mut self) { - self.is_enabled = !self.is_enabled; - self.app_event_tx.send(AppEvent::SetAppEnabled { - id: self.app_id.clone(), - enabled: self.is_enabled, - }); - } - - fn activate_selected_action(&mut self) { - match self.screen { - AppLinkScreen::Link => match self.selected_action { - 0 => self.open_chatgpt_link(), - 1 if self.is_installed => self.toggle_enabled(), - _ => self.complete = true, - }, - AppLinkScreen::InstallConfirmation => match self.selected_action { - 0 => self.refresh_connectors_and_close(), - _ => self.back_to_link_screen(), - }, - } - } - - fn content_lines(&self, width: u16) -> Vec> { - match self.screen { - AppLinkScreen::Link => self.link_content_lines(width), - AppLinkScreen::InstallConfirmation => self.install_confirmation_lines(width), - } - } - - fn link_content_lines(&self, width: u16) -> Vec> { - let usable_width = width.max(1) as usize; - let mut lines: Vec> = Vec::new(); - - lines.push(Line::from(self.title.clone().bold())); - if let Some(description) = self - .description - .as_deref() - .map(str::trim) - .filter(|description| !description.is_empty()) - { - for line in wrap(description, usable_width) { - lines.push(Line::from(line.into_owned().dim())); - } - } - - lines.push(Line::from("")); - if self.is_installed { - for line in wrap("Use $ to insert this app into the prompt.", usable_width) { - lines.push(Line::from(line.into_owned())); - } - lines.push(Line::from("")); - } - - let instructions = self.instructions.trim(); - if !instructions.is_empty() { - for line in wrap(instructions, usable_width) { - lines.push(Line::from(line.into_owned())); - } - for line in wrap( - "Newly installed apps can take a few minutes to appear in /apps.", - usable_width, - ) { - lines.push(Line::from(line.into_owned())); - } - if !self.is_installed { - for line in wrap( - "After installed, use $ to insert this app into the prompt.", - usable_width, - ) { - lines.push(Line::from(line.into_owned())); - } - } - lines.push(Line::from("")); - } - - lines - } - - fn install_confirmation_lines(&self, width: u16) -> Vec> { - let usable_width = width.max(1) as usize; - let mut lines: Vec> = Vec::new(); - - lines.push(Line::from("Finish App Setup".bold())); - lines.push(Line::from("")); - - for line in wrap( - "Complete app setup on ChatGPT in the browser window that just opened.", - usable_width, - ) { - lines.push(Line::from(line.into_owned())); - } - for line in wrap( - "Sign in there if needed, then return here and select \"I already Installed it\".", - usable_width, - ) { - lines.push(Line::from(line.into_owned())); - } - - lines.push(Line::from("")); - lines.push(Line::from(vec!["Setup URL:".dim()])); - let url_line = Line::from(vec![self.url.clone().cyan().underlined()]); - lines.extend(adaptive_wrap_lines( - vec![url_line], - RtOptions::new(usable_width), - )); - - lines - } - - fn action_rows(&self) -> Vec { - self.action_labels() - .into_iter() - .enumerate() - .map(|(index, label)| { - let prefix = if self.selected_action == index { - '›' - } else { - ' ' - }; - GenericDisplayRow { - name: format!("{prefix} {}. {label}", index + 1), - ..Default::default() - } - }) - .collect() - } - - fn action_state(&self) -> ScrollState { - let mut state = ScrollState::new(); - state.selected_idx = Some(self.selected_action); - state - } - - fn action_rows_height(&self, width: u16) -> u16 { - let rows = self.action_rows(); - let state = self.action_state(); - measure_rows_height(&rows, &state, rows.len().max(1), width.max(1)) - } - - fn hint_line(&self) -> Line<'static> { - Line::from(vec![ - "Use ".into(), - key_hint::plain(KeyCode::Tab).into(), - " / ".into(), - key_hint::plain(KeyCode::Up).into(), - " ".into(), - key_hint::plain(KeyCode::Down).into(), - " to move, ".into(), - key_hint::plain(KeyCode::Enter).into(), - " to select, ".into(), - key_hint::plain(KeyCode::Esc).into(), - " to close".into(), - ]) - } -} - -impl BottomPaneView for AppLinkView { - fn handle_key_event(&mut self, key_event: KeyEvent) { - match key_event { - KeyEvent { - code: KeyCode::Esc, .. - } => { - self.on_ctrl_c(); - } - KeyEvent { - code: KeyCode::Up, .. - } - | KeyEvent { - code: KeyCode::Left, - .. - } - | KeyEvent { - code: KeyCode::BackTab, - .. - } - | KeyEvent { - code: KeyCode::Char('k'), - modifiers: KeyModifiers::NONE, - .. - } - | KeyEvent { - code: KeyCode::Char('h'), - modifiers: KeyModifiers::NONE, - .. - } => self.move_selection_prev(), - KeyEvent { - code: KeyCode::Down, - .. - } - | KeyEvent { - code: KeyCode::Right, - .. - } - | KeyEvent { - code: KeyCode::Tab, .. - } - | KeyEvent { - code: KeyCode::Char('j'), - modifiers: KeyModifiers::NONE, - .. - } - | KeyEvent { - code: KeyCode::Char('l'), - modifiers: KeyModifiers::NONE, - .. - } => self.move_selection_next(), - KeyEvent { - code: KeyCode::Char(c), - modifiers: KeyModifiers::NONE, - .. - } => { - if let Some(index) = c - .to_digit(10) - .and_then(|digit| digit.checked_sub(1)) - .map(|index| index as usize) - && index < self.action_labels().len() - { - self.selected_action = index; - self.activate_selected_action(); - } - } - KeyEvent { - code: KeyCode::Enter, - modifiers: KeyModifiers::NONE, - .. - } => self.activate_selected_action(), - _ => {} - } - } - - fn on_ctrl_c(&mut self) -> CancellationEvent { - self.complete = true; - CancellationEvent::Handled - } - - fn is_complete(&self) -> bool { - self.complete - } -} - -impl crate::render::renderable::Renderable for AppLinkView { - fn desired_height(&self, width: u16) -> u16 { - let content_width = width.saturating_sub(4).max(1); - let content_lines = self.content_lines(content_width); - let content_rows = Paragraph::new(content_lines) - .wrap(Wrap { trim: false }) - .line_count(content_width) - .max(1) as u16; - let action_rows_height = self.action_rows_height(content_width); - content_rows + action_rows_height + 3 - } - - fn render(&self, area: Rect, buf: &mut Buffer) { - if area.height == 0 || area.width == 0 { - return; - } - - Block::default() - .style(user_message_style()) - .render(area, buf); - - let actions_height = self.action_rows_height(area.width.saturating_sub(4)); - let [content_area, actions_area, hint_area] = Layout::vertical([ - Constraint::Fill(1), - Constraint::Length(actions_height), - Constraint::Length(1), - ]) - .areas(area); - - let inner = content_area.inset(Insets::vh(/*v*/ 1, /*h*/ 2)); - let content_width = inner.width.max(1); - let lines = self.content_lines(content_width); - Paragraph::new(lines) - .wrap(Wrap { trim: false }) - .render(inner, buf); - - if actions_area.height > 0 { - let actions_area = Rect { - x: actions_area.x.saturating_add(2), - y: actions_area.y, - width: actions_area.width.saturating_sub(2), - height: actions_area.height, - }; - let action_rows = self.action_rows(); - let action_state = self.action_state(); - render_rows( - actions_area, - buf, - &action_rows, - &action_state, - action_rows.len().max(1), - "No actions", - ); - } - - if hint_area.height > 0 { - let hint_area = Rect { - x: hint_area.x.saturating_add(2), - y: hint_area.y, - width: hint_area.width.saturating_sub(2), - height: hint_area.height, - }; - self.hint_line().dim().render(hint_area, buf); - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::app_event::AppEvent; - use crate::render::renderable::Renderable; - use pretty_assertions::assert_eq; - use tokio::sync::mpsc::unbounded_channel; - - #[test] - fn installed_app_has_toggle_action() { - let (tx_raw, _rx) = unbounded_channel::(); - let tx = AppEventSender::new(tx_raw); - let view = AppLinkView::new( - AppLinkViewParams { - app_id: "connector_1".to_string(), - title: "Notion".to_string(), - description: None, - instructions: "Manage app".to_string(), - url: "https://example.test/notion".to_string(), - is_installed: true, - is_enabled: true, - }, - tx, - ); - - assert_eq!( - view.action_labels(), - vec!["Manage on ChatGPT", "Disable app", "Back"] - ); - } - - #[test] - fn toggle_action_sends_set_app_enabled_and_updates_label() { - let (tx_raw, mut rx) = unbounded_channel::(); - let tx = AppEventSender::new(tx_raw); - let mut view = AppLinkView::new( - AppLinkViewParams { - app_id: "connector_1".to_string(), - title: "Notion".to_string(), - description: None, - instructions: "Manage app".to_string(), - url: "https://example.test/notion".to_string(), - is_installed: true, - is_enabled: true, - }, - tx, - ); - - view.handle_key_event(KeyEvent::new(KeyCode::Char('2'), KeyModifiers::NONE)); - - match rx.try_recv() { - Ok(AppEvent::SetAppEnabled { id, enabled }) => { - assert_eq!(id, "connector_1"); - assert!(!enabled); - } - Ok(other) => panic!("unexpected app event: {other:?}"), - Err(err) => panic!("missing app event: {err}"), - } - - assert_eq!( - view.action_labels(), - vec!["Manage on ChatGPT", "Enable app", "Back"] - ); - } - - #[test] - fn install_confirmation_does_not_split_long_url_like_token_without_scheme() { - let (tx_raw, _rx) = unbounded_channel::(); - let tx = AppEventSender::new(tx_raw); - let url_like = - "example.test/api/v1/projects/alpha-team/releases/2026-02-17/builds/1234567890"; - let mut view = AppLinkView::new( - AppLinkViewParams { - app_id: "connector_1".to_string(), - title: "Notion".to_string(), - description: None, - instructions: "Manage app".to_string(), - url: url_like.to_string(), - is_installed: true, - is_enabled: true, - }, - tx, - ); - view.screen = AppLinkScreen::InstallConfirmation; - - let rendered: Vec = view - .content_lines(/*width*/ 40) - .into_iter() - .map(|line| { - line.spans - .into_iter() - .map(|span| span.content.into_owned()) - .collect::() - }) - .collect(); - - assert_eq!( - rendered - .iter() - .filter(|line| line.contains(url_like)) - .count(), - 1, - "expected full URL-like token in one rendered line, got: {rendered:?}" - ); - } - - #[test] - fn install_confirmation_render_keeps_url_tail_visible_when_narrow() { - let (tx_raw, _rx) = unbounded_channel::(); - let tx = AppEventSender::new(tx_raw); - let url = "https://example.test/api/v1/projects/alpha-team/releases/2026-02-17/builds/1234567890/artifacts/reports/performance/summary/detail/with/a/very/long/path/tail42"; - let mut view = AppLinkView::new( - AppLinkViewParams { - app_id: "connector_1".to_string(), - title: "Notion".to_string(), - description: None, - instructions: "Manage app".to_string(), - url: url.to_string(), - is_installed: true, - is_enabled: true, - }, - tx, - ); - view.screen = AppLinkScreen::InstallConfirmation; - - let width: u16 = 36; - let height = view.desired_height(width); - let area = Rect::new(0, 0, width, height); - let mut buf = Buffer::empty(area); - view.render(area, &mut buf); - - let rendered_blob = (0..area.height) - .map(|y| { - (0..area.width) - .map(|x| { - let symbol = buf[(x, y)].symbol(); - if symbol.is_empty() { - ' ' - } else { - symbol.chars().next().unwrap_or(' ') - } - }) - .collect::() - }) - .collect::>() - .join("\n"); - - assert!( - rendered_blob.contains("tail42"), - "expected wrapped setup URL tail to remain visible in narrow pane, got:\n{rendered_blob}" - ); - } -} diff --git a/vendor/codex/codex-rs/tui/src/bottom_pane/chat_composer.rs b/vendor/codex/codex-rs/tui/src/bottom_pane/chat_composer.rs index 8eb8e67f..4da7010d 100644 --- a/vendor/codex/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/vendor/codex/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -3,7 +3,7 @@ //! It is responsible for: //! //! - Editing the input buffer (a [`TextArea`]), including placeholder "elements" for attachments. -//! - Routing keys to the active popup (slash commands, file search, skill/apps mentions). +//! - Routing keys to the active popup (slash commands, file search, skill mentions). //! - Promoting typed slash commands into atomic elements when the command name is completed. //! - Handling submit vs newline on Enter. //! - Turning raw key streams into explicit paste operations on platforms where terminals @@ -197,7 +197,6 @@ mod history_search; use self::history_search::HistorySearchSession; use crate::app_event::AppEvent; -use crate::app_event::ConnectorsSnapshot; use crate::app_event_sender::AppEventSender; use crate::bottom_pane::LocalImageAttachment; use crate::bottom_pane::MentionBinding; @@ -209,7 +208,6 @@ use crate::history_cell; use crate::skills_helpers::skill_display_name; use crate::tui::FrameRequester; use crate::ui_consts::LIVE_PREFIX_COLS; -use codex_app_server_protocol::AppInfo; #[cfg(test)] use codex_core_skills::model::SkillInterface; use codex_core_skills::model::SkillMetadata; @@ -360,14 +358,12 @@ pub(crate) struct ChatComposer { next_element_id: u64, context_window_used_tokens: Option, skills: Option>, - connectors_snapshot: Option, dismissed_mention_popup_token: Option, mention_bindings: HashMap, recent_submission_mention_bindings: Vec, collaboration_modes_enabled: bool, config: ChatComposerConfig, collaboration_mode_indicator: Option, - connectors_enabled: bool, fast_command_enabled: bool, personality_command_enabled: bool, realtime_conversation_enabled: bool, @@ -426,7 +422,6 @@ impl ChatComposer { fn builtin_command_flags(&self) -> BuiltinCommandFlags { BuiltinCommandFlags { collaboration_modes_enabled: self.collaboration_modes_enabled, - connectors_enabled: self.connectors_enabled, fast_command_enabled: self.fast_command_enabled, personality_command_enabled: self.personality_command_enabled, realtime_conversation_enabled: self.realtime_conversation_enabled, @@ -502,14 +497,12 @@ impl ChatComposer { next_element_id: 0, context_window_used_tokens: None, skills: None, - connectors_snapshot: None, dismissed_mention_popup_token: None, mention_bindings: HashMap::new(), recent_submission_mention_bindings: Vec::new(), collaboration_modes_enabled: false, config, collaboration_mode_indicator: None, - connectors_enabled: false, fast_command_enabled: false, personality_command_enabled: false, realtime_conversation_enabled: false, @@ -555,11 +548,6 @@ impl ChatComposer { self.config.image_paste_enabled = enabled; } - pub fn set_connector_mentions(&mut self, connectors_snapshot: Option) { - self.connectors_snapshot = connectors_snapshot; - self.sync_popups(); - } - pub(crate) fn take_mention_bindings(&mut self) -> Vec { let elements = self.current_mention_elements(); let mut ordered = Vec::new(); @@ -581,10 +569,6 @@ impl ChatComposer { self.collaboration_modes_enabled = enabled; } - pub fn set_connectors_enabled(&mut self, enabled: bool) { - self.connectors_enabled = enabled; - } - pub fn set_fast_command_enabled(&mut self, enabled: bool) { self.fast_command_enabled = enabled; } @@ -1974,12 +1958,7 @@ impl ChatComposer { .skills .as_ref() .is_some_and(|skills| !skills.is_empty()); - let connectors_ready = self.connectors_enabled - && self - .connectors_snapshot - .as_ref() - .is_some_and(|snapshot| !snapshot.connectors.is_empty()); - skills_ready || connectors_ready + skills_ready } /// Extract a token prefixed with `prefix` under the cursor, if any. @@ -3447,14 +3426,12 @@ impl ChatComposer { _ => { if is_editing_slash_command_name { let collaboration_modes_enabled = self.collaboration_modes_enabled; - let connectors_enabled = self.connectors_enabled; let fast_command_enabled = self.fast_command_enabled; let personality_command_enabled = self.personality_command_enabled; let realtime_conversation_enabled = self.realtime_conversation_enabled; let audio_device_selection_enabled = self.audio_device_selection_enabled; let mut command_popup = CommandPopup::new(CommandPopupFlags { collaboration_modes_enabled, - connectors_enabled, fast_command_enabled, personality_command_enabled, realtime_conversation_enabled, @@ -3560,46 +3537,9 @@ impl ChatComposer { } } - if self.connectors_enabled - && let Some(snapshot) = self.connectors_snapshot.as_ref() - { - for connector in &snapshot.connectors { - if !connector.is_accessible || !connector.is_enabled { - continue; - } - let display_name = codex_connectors::metadata::connector_display_label(connector); - let description = Some(Self::connector_brief_description(connector)); - let slug = codex_connectors::metadata::connector_mention_slug(connector); - let search_terms = vec![display_name.clone(), connector.id.clone(), slug.clone()]; - let connector_id = connector.id.as_str(); - mentions.push(MentionItem { - display_name: display_name.clone(), - description, - insert_text: format!("${slug}"), - search_terms, - path: Some(format!("app://{connector_id}")), - category_tag: Some("[App]".to_string()), - sort_rank: 1, - }); - } - } - mentions } - fn connector_brief_description(connector: &AppInfo) -> String { - Self::connector_description(connector).unwrap_or_default() - } - - fn connector_description(connector: &AppInfo) -> Option { - connector - .description - .as_deref() - .map(str::trim) - .filter(|description| !description.is_empty()) - .map(str::to_string) - } - fn set_has_focus(&mut self, has_focus: bool) { self.has_focus = has_focus; } @@ -5174,85 +5114,6 @@ mod tests { assert_eq!(composer.textarea.text(), "hi?there"); assert_ne!(composer.footer_mode, FooterMode::ShortcutOverlay); } - - #[test] - fn set_connector_mentions_refreshes_open_mention_popup() { - let (tx, _rx) = unbounded_channel::(); - let sender = AppEventSender::new(tx); - let mut composer = ChatComposer::new( - /*has_input_focus*/ true, - sender, - /*enhanced_keys_supported*/ false, - "Ask Codex to do anything".to_string(), - /*disable_paste_burst*/ false, - ); - composer.set_connectors_enabled(/*enabled*/ true); - composer.set_text_content("$".to_string(), Vec::new(), Vec::new()); - assert!(matches!(composer.active_popup, ActivePopup::None)); - - let connectors = vec![AppInfo { - id: "connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }]; - composer.set_connector_mentions(Some(ConnectorsSnapshot { connectors })); - - let ActivePopup::Skill(popup) = &composer.active_popup else { - panic!("expected mention popup to open after connectors update"); - }; - let mention = popup - .selected_mention() - .expect("expected connector mention to be selected"); - assert_eq!(mention.insert_text, "$notion".to_string()); - assert_eq!(mention.path, Some("app://connector_1".to_string())); - } - - #[test] - fn set_connector_mentions_skips_disabled_connectors() { - let (tx, _rx) = unbounded_channel::(); - let sender = AppEventSender::new(tx); - let mut composer = ChatComposer::new( - /*has_input_focus*/ true, - sender, - /*enhanced_keys_supported*/ false, - "Ask Codex to do anything".to_string(), - /*disable_paste_burst*/ false, - ); - composer.set_connectors_enabled(/*enabled*/ true); - composer.set_text_content("$".to_string(), Vec::new(), Vec::new()); - assert!(matches!(composer.active_popup, ActivePopup::None)); - - let connectors = vec![AppInfo { - id: "connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: false, - }]; - composer.set_connector_mentions(Some(ConnectorsSnapshot { connectors })); - - assert!( - matches!(composer.active_popup, ActivePopup::None), - "disabled connectors should not appear in the mention popup" - ); - } - #[test] fn set_skill_mentions_refreshes_open_mention_popup() { let (tx, _rx) = unbounded_channel::(); @@ -5288,143 +5149,6 @@ mod tests { assert_eq!(mention.insert_text, "$codex".to_string()); assert_eq!(mention.path, Some(skill_path.display().to_string())); } - - #[test] - fn mention_items_show_skill_and_app_duplicates() { - let skill_path = test_path_buf("/tmp/repo/google-calendar/SKILL.md").abs(); - let (tx, _rx) = unbounded_channel::(); - let sender = AppEventSender::new(tx); - let mut composer = ChatComposer::new( - /*has_input_focus*/ true, - sender, - /*enhanced_keys_supported*/ false, - "Ask Codex to do anything".to_string(), - /*disable_paste_burst*/ false, - ); - composer.set_connectors_enabled(/*enabled*/ true); - composer.set_text_content("$goog".to_string(), Vec::new(), Vec::new()); - composer.set_skill_mentions(Some(vec![SkillMetadata { - name: "google-calendar:availability".to_string(), - description: "Find availability and plan event changes".to_string(), - short_description: None, - interface: Some(SkillInterface { - display_name: Some("Google Calendar".to_string()), - short_description: None, - icon_small: None, - icon_large: None, - brand_color: None, - default_prompt: None, - }), - dependencies: None, - policy: None, - path_to_skills_md: skill_path.clone(), - scope: codex_protocol::protocol::SkillScope::Repo, - }])); - composer.set_connector_mentions(Some(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: "google_calendar".to_string(), - name: "Google Calendar".to_string(), - description: Some("Look up events and availability".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/google-calendar".to_string()), - is_accessible: true, - is_enabled: true, - }], - })); - - let mentions = composer.mention_items(); - assert_eq!(mentions.len(), 2); - assert_eq!(mentions[0].category_tag, Some("[Skill]".to_string())); - assert_eq!(mentions[0].path, Some(skill_path.display().to_string())); - assert_eq!(mentions[0].display_name, "Google Calendar".to_string()); - assert_eq!(mentions[1].category_tag, Some("[App]".to_string())); - assert_eq!(mentions[1].path, Some("app://google_calendar".to_string())); - } - - #[test] - fn mention_popup_type_prefixes_snapshot() { - snapshot_composer_state_with_width( - "mention_popup_type_prefixes", - /*width*/ 72, - /*enhanced_keys_supported*/ false, - |composer| { - composer.set_connectors_enabled(/*enabled*/ true); - composer.set_text_content("$goog".to_string(), Vec::new(), Vec::new()); - composer.set_skill_mentions(Some(vec![SkillMetadata { - name: "google-calendar-skill".to_string(), - description: "Find availability and plan event changes".to_string(), - short_description: None, - interface: Some(SkillInterface { - display_name: Some("Google Calendar".to_string()), - short_description: None, - icon_small: None, - icon_large: None, - brand_color: None, - default_prompt: None, - }), - dependencies: None, - policy: None, - path_to_skills_md: test_path_buf("/tmp/repo/google-calendar/SKILL.md").abs(), - scope: codex_protocol::protocol::SkillScope::Repo, - }])); - composer.set_connector_mentions(Some(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: "google_calendar".to_string(), - name: "Google Calendar".to_string(), - description: Some("Look up events and availability".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/google-calendar".to_string()), - is_accessible: true, - is_enabled: true, - }], - })); - }, - ); - } - - #[test] - fn set_connector_mentions_excludes_disabled_apps_from_mention_popup() { - let (tx, _rx) = unbounded_channel::(); - let sender = AppEventSender::new(tx); - let mut composer = ChatComposer::new( - /*has_input_focus*/ true, - sender, - /*enhanced_keys_supported*/ false, - "Ask Codex to do anything".to_string(), - /*disable_paste_burst*/ false, - ); - composer.set_connectors_enabled(/*enabled*/ true); - composer.set_text_content("$".to_string(), Vec::new(), Vec::new()); - - let connectors = vec![AppInfo { - id: "connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: false, - }]; - composer.set_connector_mentions(Some(ConnectorsSnapshot { connectors })); - - assert!(matches!(composer.active_popup, ActivePopup::None)); - } - #[test] fn shortcut_overlay_persists_while_task_running() { use crossterm::event::KeyCode; diff --git a/vendor/codex/codex-rs/tui/src/bottom_pane/command_popup.rs b/vendor/codex/codex-rs/tui/src/bottom_pane/command_popup.rs index 9ace6ccc..9153ebcb 100644 --- a/vendor/codex/codex-rs/tui/src/bottom_pane/command_popup.rs +++ b/vendor/codex/codex-rs/tui/src/bottom_pane/command_popup.rs @@ -31,7 +31,6 @@ pub(crate) struct CommandPopup { #[derive(Clone, Copy, Debug, Default)] pub(crate) struct CommandPopupFlags { pub(crate) collaboration_modes_enabled: bool, - pub(crate) connectors_enabled: bool, pub(crate) fast_command_enabled: bool, pub(crate) personality_command_enabled: bool, pub(crate) realtime_conversation_enabled: bool, @@ -44,7 +43,6 @@ impl From for slash_commands::BuiltinCommandFlags { fn from(value: CommandPopupFlags) -> Self { Self { collaboration_modes_enabled: value.collaboration_modes_enabled, - connectors_enabled: value.connectors_enabled, fast_command_enabled: value.fast_command_enabled, personality_command_enabled: value.personality_command_enabled, realtime_conversation_enabled: value.realtime_conversation_enabled, @@ -62,7 +60,6 @@ impl CommandPopup { slash_commands::builtins_for_input(flags.into()) .into_iter() .filter(|(name, _)| !name.starts_with("debug")) - .filter(|(_, cmd)| *cmd != SlashCommand::Apps) .collect(); Self { command_filter: String::new(), @@ -352,7 +349,6 @@ mod tests { fn collab_command_visible_when_collaboration_modes_enabled() { let mut popup = CommandPopup::new(CommandPopupFlags { collaboration_modes_enabled: true, - connectors_enabled: false, fast_command_enabled: false, personality_command_enabled: true, realtime_conversation_enabled: false, @@ -372,7 +368,6 @@ mod tests { fn plan_command_visible_when_collaboration_modes_enabled() { let mut popup = CommandPopup::new(CommandPopupFlags { collaboration_modes_enabled: true, - connectors_enabled: false, fast_command_enabled: false, personality_command_enabled: true, realtime_conversation_enabled: false, @@ -392,7 +387,6 @@ mod tests { fn personality_command_hidden_when_disabled() { let mut popup = CommandPopup::new(CommandPopupFlags { collaboration_modes_enabled: true, - connectors_enabled: false, fast_command_enabled: false, personality_command_enabled: false, realtime_conversation_enabled: false, @@ -419,7 +413,6 @@ mod tests { fn personality_command_visible_when_enabled() { let mut popup = CommandPopup::new(CommandPopupFlags { collaboration_modes_enabled: true, - connectors_enabled: false, fast_command_enabled: false, personality_command_enabled: true, realtime_conversation_enabled: false, @@ -439,7 +432,6 @@ mod tests { fn settings_command_hidden_when_audio_device_selection_is_disabled() { let mut popup = CommandPopup::new(CommandPopupFlags { collaboration_modes_enabled: false, - connectors_enabled: false, fast_command_enabled: false, personality_command_enabled: true, realtime_conversation_enabled: true, diff --git a/vendor/codex/codex-rs/tui/src/bottom_pane/mod.rs b/vendor/codex/codex-rs/tui/src/bottom_pane/mod.rs index 8d035ccc..632df384 100644 --- a/vendor/codex/codex-rs/tui/src/bottom_pane/mod.rs +++ b/vendor/codex/codex-rs/tui/src/bottom_pane/mod.rs @@ -16,7 +16,6 @@ use std::path::PathBuf; use crate::app::app_server_requests::ResolvedAppServerRequest; -use crate::app_event::ConnectorsSnapshot; use crate::app_event_sender::AppEventSender; use crate::bottom_pane::pending_input_preview::PendingInputPreview; use crate::bottom_pane::pending_thread_approvals::PendingThreadApprovals; @@ -42,7 +41,6 @@ use ratatui::layout::Rect; use ratatui::text::Line; use std::time::Duration; -mod app_link_view; mod approval_overlay; mod mcp_server_elicitation; mod multi_select_picker; @@ -50,8 +48,6 @@ mod request_user_input; mod status_line_setup; mod status_surface_preview; mod title_setup; -pub(crate) use app_link_view::AppLinkView; -pub(crate) use app_link_view::AppLinkViewParams; pub(crate) use approval_overlay::ApprovalOverlay; pub(crate) use approval_overlay::ApprovalRequest; pub(crate) use approval_overlay::format_requested_permissions_rule; @@ -70,7 +66,7 @@ pub(crate) struct LocalImageAttachment { pub(crate) struct MentionBinding { /// Mention token text without the leading `$`. pub(crate) mention: String, - /// Canonical mention target (for example `app://...` or absolute SKILL.md path). + /// Canonical mention target (for example `mcp://...` or absolute SKILL.md path). pub(crate) path: String, } mod chat_composer; @@ -87,7 +83,6 @@ mod skill_popup; mod skills_toggle_view; pub(crate) mod slash_commands; pub(crate) use footer::CollaborationModeIndicator; -pub(crate) use list_selection_view::ColumnWidthMode; pub(crate) use list_selection_view::SelectionViewParams; pub(crate) use list_selection_view::SideContentWidth; pub(crate) use list_selection_view::popup_content_width; @@ -264,11 +259,6 @@ impl BottomPane { self.request_redraw(); } - pub fn set_connectors_snapshot(&mut self, snapshot: Option) { - self.composer.set_connector_mentions(snapshot); - self.request_redraw(); - } - pub fn take_mention_bindings(&mut self) -> Vec { self.composer.take_mention_bindings() } @@ -298,10 +288,6 @@ impl BottomPane { self.request_redraw(); } - pub fn set_connectors_enabled(&mut self, enabled: bool) { - self.composer.set_connectors_enabled(enabled); - } - #[cfg(target_os = "windows")] pub fn set_windows_degraded_sandbox_active(&mut self, enabled: bool) { self.composer.set_windows_degraded_sandbox_active(enabled); @@ -824,33 +810,6 @@ impl BottomPane { self.push_view(Box::new(view)); } - /// Replace the active selection view when it matches `view_id`. - pub(crate) fn replace_selection_view_if_active( - &mut self, - view_id: &'static str, - params: list_selection_view::SelectionViewParams, - ) -> bool { - let is_match = self - .view_stack - .last() - .is_some_and(|view| view.view_id() == Some(view_id)); - if !is_match { - return false; - } - - self.view_stack.pop(); - let view = list_selection_view::ListSelectionView::new(params, self.app_event_tx.clone()); - self.push_view(Box::new(view)); - true - } - - pub(crate) fn selected_index_for_active_view(&self, view_id: &'static str) -> Option { - self.view_stack - .last() - .filter(|view| view.view_id() == Some(view_id)) - .and_then(|view| view.selected_index()) - } - /// Update the pending-input preview shown above the composer. pub(crate) fn set_pending_input_preview( &mut self, diff --git a/vendor/codex/codex-rs/tui/src/bottom_pane/slash_commands.rs b/vendor/codex/codex-rs/tui/src/bottom_pane/slash_commands.rs index 1d62010a..b74b2d72 100644 --- a/vendor/codex/codex-rs/tui/src/bottom_pane/slash_commands.rs +++ b/vendor/codex/codex-rs/tui/src/bottom_pane/slash_commands.rs @@ -13,7 +13,6 @@ use crate::slash_command::built_in_slash_commands; #[derive(Clone, Copy, Debug, Default)] pub(crate) struct BuiltinCommandFlags { pub(crate) collaboration_modes_enabled: bool, - pub(crate) connectors_enabled: bool, pub(crate) fast_command_enabled: bool, pub(crate) personality_command_enabled: bool, pub(crate) realtime_conversation_enabled: bool, @@ -31,7 +30,6 @@ pub(crate) fn builtins_for_input(flags: BuiltinCommandFlags) -> Vec<(&'static st flags.collaboration_modes_enabled || !matches!(*cmd, SlashCommand::Collab | SlashCommand::Plan) }) - .filter(|(_, cmd)| flags.connectors_enabled || *cmd != SlashCommand::Apps) .filter(|(_, cmd)| flags.fast_command_enabled || *cmd != SlashCommand::Fast) .filter(|(_, cmd)| flags.personality_command_enabled || *cmd != SlashCommand::Personality) .filter(|(_, cmd)| flags.realtime_conversation_enabled || *cmd != SlashCommand::Realtime) @@ -70,7 +68,6 @@ mod tests { fn all_enabled_flags() -> BuiltinCommandFlags { BuiltinCommandFlags { collaboration_modes_enabled: true, - connectors_enabled: true, fast_command_enabled: true, personality_command_enabled: true, realtime_conversation_enabled: true, diff --git a/vendor/codex/codex-rs/tui/src/chatwidget.rs b/vendor/codex/codex-rs/tui/src/chatwidget.rs index 02541b3a..57698bf2 100644 --- a/vendor/codex/codex-rs/tui/src/chatwidget.rs +++ b/vendor/codex/codex-rs/tui/src/chatwidget.rs @@ -61,7 +61,6 @@ use crate::legacy_core::DEFAULT_AGENTS_MD_FILENAME; use crate::legacy_core::config::Config; use crate::legacy_core::config::Constrained; use crate::legacy_core::config::ConstraintResult; -use crate::legacy_core::connectors; #[cfg(target_os = "windows")] use crate::legacy_core::windows_sandbox::WindowsSandboxLevelExt; use crate::mention_codec::LinkedMention; @@ -81,7 +80,6 @@ use crate::text_formatting::proper_join; use crate::version::CODEX_CLI_VERSION; use codex_app_server_protocol::AddCreditsNudgeCreditType; use codex_app_server_protocol::AddCreditsNudgeEmailStatus; -use codex_app_server_protocol::AppInfo; use codex_app_server_protocol::CodexErrorInfo as AppServerCodexErrorInfo; use codex_app_server_protocol::CollabAgentState as AppServerCollabAgentState; use codex_app_server_protocol::CollabAgentStatus as AppServerCollabAgentStatus; @@ -262,7 +260,6 @@ const MEMORIES_ENABLE_NOTICE: &str = "Memories will be enabled in the next sessi const PLAN_MODE_REASONING_SCOPE_TITLE: &str = "Apply reasoning change"; const PLAN_MODE_REASONING_SCOPE_PLAN_ONLY: &str = "Apply to Plan mode override"; const PLAN_MODE_REASONING_SCOPE_ALL_MODES: &str = "Apply to global default and Plan mode override"; -const CONNECTORS_SELECTION_VIEW_ID: &str = "connectors-selection"; const TUI_STUB_MESSAGE: &str = "Not available in TUI yet."; /// Choose the keybinding used to edit the most-recently queued message. @@ -301,7 +298,6 @@ fn queued_message_edit_binding_for_terminal(terminal_info: TerminalInfo) -> KeyB } use crate::app_event::AppEvent; -use crate::app_event::ConnectorsSnapshot; use crate::app_event::ExitMode; use crate::app_event::RateLimitRefreshOrigin; #[cfg(target_os = "windows")] @@ -312,7 +308,6 @@ use crate::bottom_pane::BottomPane; use crate::bottom_pane::BottomPaneParams; use crate::bottom_pane::CancellationEvent; use crate::bottom_pane::CollaborationModeIndicator; -use crate::bottom_pane::ColumnWidthMode; use crate::bottom_pane::DOUBLE_PRESS_QUIT_SHORTCUT_ENABLED; use crate::bottom_pane::ExperimentalFeatureItem; use crate::bottom_pane::ExperimentalFeaturesView; @@ -368,7 +363,6 @@ use self::session_header::SessionHeader; mod skills; mod slash_dispatch; use self::skills::collect_tool_mentions; -use self::skills::find_app_mentions; use self::skills::find_skill_mentions_with_tool_mentions; mod plan_implementation; use self::plan_implementation::PLAN_IMPLEMENTATION_TITLE; @@ -596,15 +590,6 @@ enum RateLimitSwitchPromptState { Shown, } -#[derive(Debug, Clone, Default)] -enum ConnectorsCacheState { - #[default] - Uninitialized, - Loading, - Ready(ConnectorsSnapshot), - Failed(String), -} - #[derive(Debug)] enum RateLimitErrorKind { ServerOverloaded, @@ -843,10 +828,6 @@ pub(crate) struct ChatWidget { mcp_startup_pending_next_round: HashMap, /// Tracks whether the buffered next round has seen any `Starting` update yet. mcp_startup_pending_next_round_saw_starting: bool, - connectors_cache: ConnectorsCacheState, - connectors_partial_snapshot: Option, - connectors_prefetch_in_flight: bool, - connectors_force_refetch_pending: bool, // Queue of interruptive UI events deferred during an active write cycle interrupts: InterruptManager, // Accumulates the current reasoning block text to extract a header @@ -2168,9 +2149,6 @@ impl ChatWidget { } self.saw_copy_source_this_turn = false; self.refresh_skills_for_current_cwd(/*force_reload*/ true); - if self.connectors_enabled() { - self.prefetch_connectors(); - } if let Some(user_message) = self.initial_user_message.take() { if self.suppress_initial_user_message_submit { self.initial_user_message = Some(user_message); @@ -2298,12 +2276,6 @@ impl ChatWidget { self.request_redraw(); } - pub(crate) fn open_app_link_view(&mut self, params: crate::bottom_pane::AppLinkViewParams) { - let view = crate::bottom_pane::AppLinkView::new(params, self.app_event_tx.clone()); - self.bottom_pane.show_view(Box::new(view)); - self.request_redraw(); - } - pub(crate) fn dismiss_app_server_request(&mut self, request: &ResolvedAppServerRequest) { // A remotely resolved request must not remain user-actionable. It may be // materialized in the bottom pane or still deferred behind active streaming. @@ -5147,10 +5119,6 @@ impl ChatWidget { mcp_startup_allow_terminal_only_next_round: false, mcp_startup_pending_next_round: HashMap::new(), mcp_startup_pending_next_round_saw_starting: false, - connectors_cache: ConnectorsCacheState::default(), - connectors_partial_snapshot: None, - connectors_prefetch_in_flight: false, - connectors_force_refetch_pending: false, interrupts: InterruptManager::new(), reasoning_buffer: String::new(), full_reasoning_buffer: String::new(), @@ -5243,9 +5211,6 @@ impl ChatWidget { ); widget.update_collaboration_mode_indicator(); - widget - .bottom_pane - .set_connectors_enabled(widget.connectors_enabled()); widget.refresh_status_surfaces(); widget @@ -5784,14 +5749,8 @@ impl ChatWidget { .iter() .map(|binding| binding.mention.clone()) .collect(); - let mut skill_names_lower: HashSet = HashSet::new(); let mut selected_skill_paths: HashSet = HashSet::new(); if let Some(skills) = self.bottom_pane.skills() { - skill_names_lower = skills - .iter() - .map(|skill| skill.name.to_ascii_lowercase()) - .collect(); - for binding in &mention_bindings { let path = binding .path @@ -5824,41 +5783,6 @@ impl ChatWidget { } } - let mut selected_app_ids: HashSet = HashSet::new(); - if let Some(apps) = self.connectors_for_mentions() { - for binding in &mention_bindings { - let Some(app_id) = binding - .path - .strip_prefix("app://") - .filter(|id| !id.is_empty()) - else { - continue; - }; - if !selected_app_ids.insert(app_id.to_string()) { - continue; - } - if let Some(app) = apps.iter().find(|app| app.id == app_id && app.is_enabled) { - items.push(UserInput::Mention { - name: app.name.clone(), - path: binding.path.clone(), - }); - } - } - - let app_mentions = find_app_mentions(&mentions, apps, &skill_names_lower); - for app in app_mentions { - let slug = codex_connectors::metadata::connector_mention_slug(&app); - if bound_names.contains(&slug) || !selected_app_ids.insert(app.id.clone()) { - continue; - } - let app_id = app.id.as_str(); - items.push(UserInput::Mention { - name: app.name.clone(), - path: format!("app://{app_id}"), - }); - } - } - let effective_mode = self.effective_collaboration_mode(); if effective_mode.model().trim().is_empty() { self.add_error_message( @@ -7730,78 +7654,6 @@ impl ChatWidget { fn stop_rate_limit_poller(&mut self) {} - pub(crate) fn refresh_connectors(&mut self, force_refetch: bool) { - self.prefetch_connectors_with_options(force_refetch); - } - - fn prefetch_connectors(&mut self) { - self.prefetch_connectors_with_options(/*force_refetch*/ false); - } - - fn prefetch_connectors_with_options(&mut self, force_refetch: bool) { - if !self.connectors_enabled() { - return; - } - if self.connectors_prefetch_in_flight { - if force_refetch { - self.connectors_force_refetch_pending = true; - } - return; - } - - self.connectors_prefetch_in_flight = true; - if !matches!(self.connectors_cache, ConnectorsCacheState::Ready(_)) { - self.connectors_cache = ConnectorsCacheState::Loading; - } - - let config = self.config.clone(); - let app_event_tx = self.app_event_tx.clone(); - tokio::spawn(async move { - let accessible_result = - match connectors::list_accessible_connectors_from_mcp_tools_with_options_and_status( - &config, - force_refetch, - ) - .await - { - Ok(connectors) => connectors, - Err(err) => { - app_event_tx.send(AppEvent::ConnectorsLoaded { - result: Err(format!("Failed to load apps: {err}")), - is_final: true, - }); - return; - } - }; - let accessible_connectors = accessible_result.connectors; - - app_event_tx.send(AppEvent::ConnectorsLoaded { - result: Ok(ConnectorsSnapshot { - connectors: accessible_connectors.clone(), - }), - is_final: false, - }); - - let result: Result = async { - let all_connectors = - connectors::list_all_connectors_with_options(&config, force_refetch).await?; - let connectors = connectors::merge_connectors_with_accessible( - all_connectors, - accessible_connectors, - /*all_connectors_loaded*/ true, - ); - Ok(ConnectorsSnapshot { connectors }) - } - .await - .map_err(|err: anyhow::Error| format!("Failed to load apps: {err}")); - - app_event_tx.send(AppEvent::ConnectorsLoaded { - result, - is_final: true, - }); - }); - } - #[cfg_attr(not(test), allow(dead_code))] fn prefetch_rate_limits(&mut self) { self.stop_rate_limit_poller(); @@ -9817,8 +9669,6 @@ impl ChatWidget { self.status_account_display = status_account_display; self.plan_type = plan_type; self.has_chatgpt_account = has_chatgpt_account; - self.bottom_pane - .set_connectors_enabled(self.connectors_enabled()); } pub(crate) fn should_show_fast_status( @@ -10175,25 +10025,6 @@ impl ChatWidget { self.request_redraw(); } - fn connectors_enabled(&self) -> bool { - false - } - - fn connectors_for_mentions(&self) -> Option<&[AppInfo]> { - if !self.connectors_enabled() { - return None; - } - - if let Some(snapshot) = &self.connectors_partial_snapshot { - return Some(snapshot.connectors.as_slice()); - } - - match &self.connectors_cache { - ConnectorsCacheState::Ready(snapshot) => Some(snapshot.connectors.as_slice()), - _ => None, - } - } - /// Build a placeholder header cell while the session is configuring. fn placeholder_session_header_cell(config: &Config) -> Box { let placeholder_style = Style::default().add_modifier(Modifier::DIM | Modifier::ITALIC); @@ -10315,228 +10146,6 @@ impl ChatWidget { self.request_redraw(); } - pub(crate) fn add_connectors_output(&mut self) { - if !self.connectors_enabled() { - self.add_info_message( - "Apps are disabled.".to_string(), - Some("Enable the apps feature to use $ or /apps.".to_string()), - ); - return; - } - - let connectors_cache = self.connectors_cache.clone(); - let should_force_refetch = !self.connectors_prefetch_in_flight - || matches!(connectors_cache, ConnectorsCacheState::Ready(_)); - self.prefetch_connectors_with_options(should_force_refetch); - - match connectors_cache { - ConnectorsCacheState::Ready(snapshot) => { - if snapshot.connectors.is_empty() { - self.add_info_message("No apps available.".to_string(), /*hint*/ None); - } else { - self.open_connectors_popup(&snapshot.connectors); - } - } - ConnectorsCacheState::Failed(err) => { - self.add_to_history(history_cell::new_error_event(err)); - } - ConnectorsCacheState::Loading | ConnectorsCacheState::Uninitialized => { - self.open_connectors_loading_popup(); - } - } - self.request_redraw(); - } - - fn open_connectors_loading_popup(&mut self) { - if !self.bottom_pane.replace_selection_view_if_active( - CONNECTORS_SELECTION_VIEW_ID, - self.connectors_loading_popup_params(), - ) { - self.bottom_pane - .show_selection_view(self.connectors_loading_popup_params()); - } - } - - fn open_connectors_popup(&mut self, connectors: &[AppInfo]) { - self.bottom_pane.show_selection_view( - self.connectors_popup_params(connectors, /*selected_connector_id*/ None), - ); - } - - fn connectors_loading_popup_params(&self) -> SelectionViewParams { - let mut header = ColumnRenderable::new(); - header.push(Line::from("Apps".bold())); - header.push(Line::from("Loading installed and available apps...".dim())); - - SelectionViewParams { - view_id: Some(CONNECTORS_SELECTION_VIEW_ID), - header: Box::new(header), - items: vec![SelectionItem { - name: "Loading apps...".to_string(), - description: Some("This updates when the full list is ready.".to_string()), - is_disabled: true, - ..Default::default() - }], - ..Default::default() - } - } - - fn connectors_popup_params( - &self, - connectors: &[AppInfo], - selected_connector_id: Option<&str>, - ) -> SelectionViewParams { - let total = connectors.len(); - let installed = connectors - .iter() - .filter(|connector| connector.is_accessible) - .count(); - let mut header = ColumnRenderable::new(); - header.push(Line::from("Apps".bold())); - header.push(Line::from( - "Use $ to insert an installed app into your prompt.".dim(), - )); - header.push(Line::from( - format!("Installed {installed} of {total} available apps.").dim(), - )); - let initial_selected_idx = selected_connector_id.and_then(|selected_connector_id| { - connectors - .iter() - .position(|connector| connector.id == selected_connector_id) - }); - let mut items: Vec = Vec::with_capacity(connectors.len()); - for connector in connectors { - let connector_label = codex_connectors::metadata::connector_display_label(connector); - let connector_title = connector_label.clone(); - let link_description = Self::connector_description(connector); - let description = Self::connector_brief_description(connector); - let status_label = Self::connector_status_label(connector); - let search_value = format!("{connector_label} {}", connector.id); - let mut item = SelectionItem { - name: connector_label, - description: Some(description), - search_value: Some(search_value), - ..Default::default() - }; - let is_installed = connector.is_accessible; - let selected_label = if is_installed { - format!( - "{status_label}. Press Enter to open the app page to install, manage, or enable/disable this app." - ) - } else { - format!("{status_label}. Press Enter to open the app page to install this app.") - }; - let missing_label = format!("{status_label}. App link unavailable."); - let instructions = if connector.is_accessible { - "Manage this app in your browser." - } else { - "Install this app in your browser, then reload Codex." - }; - if let Some(install_url) = connector.install_url.clone() { - let app_id = connector.id.clone(); - let is_enabled = connector.is_enabled; - let title = connector_title.clone(); - let instructions = instructions.to_string(); - let description = link_description.clone(); - item.actions = vec![Box::new(move |tx| { - tx.send(AppEvent::OpenAppLink { - app_id: app_id.clone(), - title: title.clone(), - description: description.clone(), - instructions: instructions.clone(), - url: install_url.clone(), - is_installed, - is_enabled, - }); - })]; - item.dismiss_on_select = true; - item.selected_description = Some(selected_label); - } else { - let missing_label_for_action = missing_label.clone(); - item.actions = vec![Box::new(move |tx| { - tx.send(AppEvent::InsertHistoryCell(Box::new( - history_cell::new_info_event( - missing_label_for_action.clone(), - /*hint*/ None, - ), - ))); - })]; - item.dismiss_on_select = true; - item.selected_description = Some(missing_label); - } - items.push(item); - } - - SelectionViewParams { - view_id: Some(CONNECTORS_SELECTION_VIEW_ID), - header: Box::new(header), - footer_hint: Some(Self::connectors_popup_hint_line()), - items, - is_searchable: true, - search_placeholder: Some("Type to search apps".to_string()), - col_width_mode: ColumnWidthMode::AutoAllRows, - initial_selected_idx, - ..Default::default() - } - } - - fn refresh_connectors_popup_if_open(&mut self, connectors: &[AppInfo]) { - let selected_connector_id = - if let (Some(selected_index), ConnectorsCacheState::Ready(snapshot)) = ( - self.bottom_pane - .selected_index_for_active_view(CONNECTORS_SELECTION_VIEW_ID), - &self.connectors_cache, - ) { - snapshot - .connectors - .get(selected_index) - .map(|connector| connector.id.as_str()) - } else { - None - }; - let _ = self.bottom_pane.replace_selection_view_if_active( - CONNECTORS_SELECTION_VIEW_ID, - self.connectors_popup_params(connectors, selected_connector_id), - ); - } - - fn connectors_popup_hint_line() -> Line<'static> { - Line::from(vec![ - "Press ".into(), - key_hint::plain(KeyCode::Esc).into(), - " to close.".into(), - ]) - } - - fn connector_brief_description(connector: &AppInfo) -> String { - let status_label = Self::connector_status_label(connector); - match Self::connector_description(connector) { - Some(description) => format!("{status_label} · {description}"), - None => status_label.to_string(), - } - } - - fn connector_status_label(connector: &AppInfo) -> &'static str { - if connector.is_accessible { - if connector.is_enabled { - "Installed" - } else { - "Installed · Disabled" - } - } else { - "Can be installed" - } - } - - fn connector_description(connector: &AppInfo) -> Option { - connector - .description - .as_deref() - .map(str::trim) - .filter(|description| !description.is_empty()) - .map(str::to_string) - } - /// Forward file-search results to the bottom pane. pub(crate) fn apply_file_search_result(&mut self, query: String, matches: Vec) { self.bottom_pane.on_file_search_result(query, matches); @@ -10815,100 +10424,6 @@ impl ChatWidget { self.set_skills_from_response(&ev); } - pub(crate) fn on_connectors_loaded( - &mut self, - result: Result, - is_final: bool, - ) { - let mut trigger_pending_force_refetch = false; - if is_final { - self.connectors_prefetch_in_flight = false; - if self.connectors_force_refetch_pending { - self.connectors_force_refetch_pending = false; - trigger_pending_force_refetch = true; - } - } - - match result { - Ok(mut snapshot) => { - if !is_final { - snapshot.connectors = connectors::merge_connectors_with_accessible( - Vec::new(), - snapshot.connectors, - /*all_connectors_loaded*/ false, - ); - } - snapshot.connectors = - connectors::with_app_enabled_state(snapshot.connectors, &self.config); - if let ConnectorsCacheState::Ready(existing_snapshot) = &self.connectors_cache { - let enabled_by_id: HashMap<&str, bool> = existing_snapshot - .connectors - .iter() - .map(|connector| (connector.id.as_str(), connector.is_enabled)) - .collect(); - for connector in &mut snapshot.connectors { - if let Some(is_enabled) = enabled_by_id.get(connector.id.as_str()) { - connector.is_enabled = *is_enabled; - } - } - } - if is_final { - self.connectors_partial_snapshot = None; - self.refresh_connectors_popup_if_open(&snapshot.connectors); - self.connectors_cache = ConnectorsCacheState::Ready(snapshot.clone()); - } else { - self.connectors_partial_snapshot = Some(snapshot.clone()); - } - self.bottom_pane.set_connectors_snapshot(Some(snapshot)); - } - Err(err) => { - let partial_snapshot = self.connectors_partial_snapshot.take(); - if let ConnectorsCacheState::Ready(snapshot) = &self.connectors_cache { - warn!("failed to refresh apps list; retaining current apps snapshot: {err}"); - self.bottom_pane - .set_connectors_snapshot(Some(snapshot.clone())); - } else if let Some(snapshot) = partial_snapshot { - warn!( - "failed to load full apps list; falling back to installed apps snapshot: {err}" - ); - self.refresh_connectors_popup_if_open(&snapshot.connectors); - self.connectors_cache = ConnectorsCacheState::Ready(snapshot.clone()); - self.bottom_pane.set_connectors_snapshot(Some(snapshot)); - } else { - self.connectors_cache = ConnectorsCacheState::Failed(err); - self.bottom_pane.set_connectors_snapshot(/*snapshot*/ None); - } - } - } - - if trigger_pending_force_refetch { - self.prefetch_connectors_with_options(/*force_refetch*/ true); - } - } - - pub(crate) fn update_connector_enabled(&mut self, connector_id: &str, enabled: bool) { - let ConnectorsCacheState::Ready(mut snapshot) = self.connectors_cache.clone() else { - return; - }; - - let mut changed = false; - for connector in &mut snapshot.connectors { - if connector.id == connector_id { - changed = connector.is_enabled != enabled; - connector.is_enabled = enabled; - break; - } - } - - if !changed { - return; - } - - self.refresh_connectors_popup_if_open(&snapshot.connectors); - self.connectors_cache = ConnectorsCacheState::Ready(snapshot.clone()); - self.bottom_pane.set_connectors_snapshot(Some(snapshot)); - } - pub(crate) fn open_review_popup(&mut self) { let mut items: Vec = Vec::new(); diff --git a/vendor/codex/codex-rs/tui/src/chatwidget/skills.rs b/vendor/codex/codex-rs/tui/src/chatwidget/skills.rs index cfa0fdd0..ce9a90d8 100644 --- a/vendor/codex/codex-rs/tui/src/chatwidget/skills.rs +++ b/vendor/codex/codex-rs/tui/src/chatwidget/skills.rs @@ -10,7 +10,6 @@ use crate::bottom_pane::SkillsToggleView; use crate::bottom_pane::popup_consts::standard_popup_hint_line; use crate::skills_helpers::skill_description; use crate::skills_helpers::skill_display_name; -use codex_app_server_protocol::AppInfo; use codex_core_skills::model::SkillDependencies; use codex_core_skills::model::SkillInterface; use codex_core_skills::model::SkillMetadata; @@ -280,44 +279,6 @@ pub(crate) fn find_skill_mentions_with_tool_mentions( matches } -pub(crate) fn find_app_mentions( - mentions: &ToolMentions, - apps: &[AppInfo], - skill_names_lower: &HashSet, -) -> Vec { - let mut explicit_names = HashSet::new(); - let mut selected_ids = HashSet::new(); - for (name, path) in &mentions.linked_paths { - if let Some(connector_id) = app_id_from_path(path) { - explicit_names.insert(name.clone()); - selected_ids.insert(connector_id.to_string()); - } - } - - let mut slug_counts: HashMap = HashMap::new(); - for app in apps.iter().filter(|app| app.is_enabled) { - let slug = codex_connectors::metadata::connector_mention_slug(app); - *slug_counts.entry(slug).or_insert(0) += 1; - } - - for app in apps.iter().filter(|app| app.is_enabled) { - let slug = codex_connectors::metadata::connector_mention_slug(app); - let slug_count = slug_counts.get(&slug).copied().unwrap_or(0); - if mentions.names.contains(&slug) - && !explicit_names.contains(&slug) - && slug_count == 1 - && !skill_names_lower.contains(&slug) - { - selected_ids.insert(app.id.clone()); - } - } - - apps.iter() - .filter(|app| app.is_enabled && selected_ids.contains(&app.id)) - .cloned() - .collect() -} - pub(crate) struct ToolMentions { names: HashSet, linked_paths: HashMap, @@ -466,14 +427,14 @@ fn is_mention_name_char(byte: u8) -> bool { } fn is_skill_path(path: &str) -> bool { - !path.starts_with("app://") && !path.starts_with("mcp://") && !path.starts_with("plugin://") + path.starts_with("skill://") + || (!path.contains("://") + && path + .rsplit(['/', '\\']) + .next() + .is_some_and(|name| name.eq_ignore_ascii_case("SKILL.md"))) } fn normalize_skill_path(path: &str) -> &str { path.strip_prefix("skill://").unwrap_or(path) } - -fn app_id_from_path(path: &str) -> Option<&str> { - path.strip_prefix("app://") - .filter(|value| !value.is_empty()) -} diff --git a/vendor/codex/codex-rs/tui/src/chatwidget/slash_dispatch.rs b/vendor/codex/codex-rs/tui/src/chatwidget/slash_dispatch.rs index 3f5738d9..c3d1170e 100644 --- a/vendor/codex/codex-rs/tui/src/chatwidget/slash_dispatch.rs +++ b/vendor/codex/codex-rs/tui/src/chatwidget/slash_dispatch.rs @@ -361,9 +361,6 @@ impl ChatWidget { SlashCommand::Mcp => { self.add_mcp_output(McpServerStatusDetail::ToolsAndAuthOnly); } - SlashCommand::Apps => { - self.add_connectors_output(); - } SlashCommand::Rollout => { if let Some(path) = self.rollout_path() { self.add_info_message( @@ -698,7 +695,6 @@ impl ChatWidget { slash_commands::BuiltinCommandFlags { collaboration_modes_enabled: self.collaboration_modes_enabled(), - connectors_enabled: self.connectors_enabled(), fast_command_enabled: self.fast_mode_enabled(), personality_command_enabled: self.config.features.enabled(Feature::Personality), realtime_conversation_enabled: self.realtime_conversation_enabled(), @@ -721,7 +717,6 @@ impl ChatWidget { | SlashCommand::MemoryDrop | SlashCommand::MemoryUpdate | SlashCommand::Mcp - | SlashCommand::Apps | SlashCommand::Rollout | SlashCommand::Copy | SlashCommand::Diff diff --git a/vendor/codex/codex-rs/tui/src/chatwidget/tests.rs b/vendor/codex/codex-rs/tui/src/chatwidget/tests.rs index b6efce13..270d9e45 100644 --- a/vendor/codex/codex-rs/tui/src/chatwidget/tests.rs +++ b/vendor/codex/codex-rs/tui/src/chatwidget/tests.rs @@ -213,7 +213,6 @@ pub(super) use tokio::sync::mpsc::error::TryRecvError; pub(super) use tokio::sync::mpsc::unbounded_channel; pub(super) use toml::Value as TomlValue; - pub(super) fn chatwidget_snapshot_dir() -> PathBuf { let snapshot_file = codex_utils_cargo_bin::find_resource!( "src/chatwidget/snapshots/codex_tui__chatwidget__tests__chatwidget_tall.snap" diff --git a/vendor/codex/codex-rs/tui/src/chatwidget/tests/composer_submission.rs b/vendor/codex/codex-rs/tui/src/chatwidget/tests/composer_submission.rs index 2f8c6a9b..778b6d60 100644 --- a/vendor/codex/codex-rs/tui/src/chatwidget/tests/composer_submission.rs +++ b/vendor/codex/codex-rs/tui/src/chatwidget/tests/composer_submission.rs @@ -1004,7 +1004,7 @@ fn rendered_user_message_event_from_inputs_matches_flattened_user_message_shape( }, UserInput::Mention { name: "repo".to_string(), - path: "app://repo".to_string(), + path: "mcp://repo".to_string(), }, UserInput::Text { text: "world".to_string(), diff --git a/vendor/codex/codex-rs/tui/src/chatwidget/tests/helpers.rs b/vendor/codex/codex-rs/tui/src/chatwidget/tests/helpers.rs index b5dc88f5..51606891 100644 --- a/vendor/codex/codex-rs/tui/src/chatwidget/tests/helpers.rs +++ b/vendor/codex/codex-rs/tui/src/chatwidget/tests/helpers.rs @@ -235,10 +235,6 @@ pub(super) async fn make_chatwidget_manual( mcp_startup_allow_terminal_only_next_round: false, mcp_startup_pending_next_round: HashMap::new(), mcp_startup_pending_next_round_saw_starting: false, - connectors_cache: ConnectorsCacheState::default(), - connectors_partial_snapshot: None, - connectors_prefetch_in_flight: false, - connectors_force_refetch_pending: false, interrupts: InterruptManager::new(), reasoning_buffer: String::new(), full_reasoning_buffer: String::new(), diff --git a/vendor/codex/codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs b/vendor/codex/codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs index a9d93532..e56dcf4d 100644 --- a/vendor/codex/codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs +++ b/vendor/codex/codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs @@ -1,5 +1,4 @@ use super::*; -use codex_app_server_protocol::AppInfo; use codex_features::Stage; use pretty_assertions::assert_eq; @@ -85,840 +84,6 @@ async fn experimental_mode_plan_is_ignored_on_startup() { assert_eq!(chat.active_collaboration_mode_kind(), ModeKind::Default); assert_eq!(chat.current_model(), resolved_model); } - -#[tokio::test] -async fn apps_popup_stays_loading_until_final_snapshot_updates() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - let notion_id = "unit_test_apps_popup_refresh_connector_1"; - let linear_id = "unit_test_apps_popup_refresh_connector_2"; - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: notion_id.to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }], - }), - /*is_final*/ false, - ); - chat.add_connectors_output(); - assert!( - chat.connectors_prefetch_in_flight, - "expected /apps to trigger a forced connectors refresh" - ); - - let before = render_bottom_popup(&chat, /*width*/ 80); - assert!( - before.contains("Loading installed and available apps..."), - "expected /apps to stay in the loading state until the full list arrives, got:\n{before}" - ); - assert_chatwidget_snapshot!("apps_popup_loading_state", before); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![ - AppInfo { - id: notion_id.to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }, - AppInfo { - id: linear_id.to_string(), - name: "Linear".to_string(), - description: Some("Project tracking".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/linear".to_string()), - is_accessible: true, - is_enabled: true, - }, - ], - }), - /*is_final*/ true, - ); - - let after = render_bottom_popup(&chat, /*width*/ 80); - assert!( - after.contains("Installed 2 of 2 available apps."), - "expected refreshed apps popup snapshot, got:\n{after}" - ); - assert!( - after.contains("Linear"), - "expected refreshed popup to include new connector, got:\n{after}" - ); -} - -#[tokio::test] -async fn apps_refresh_failure_keeps_existing_full_snapshot() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - let notion_id = "unit_test_apps_refresh_failure_connector_1"; - let linear_id = "unit_test_apps_refresh_failure_connector_2"; - - let full_connectors = vec![ - AppInfo { - id: notion_id.to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }, - AppInfo { - id: linear_id.to_string(), - name: "Linear".to_string(), - description: Some("Project tracking".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/linear".to_string()), - is_accessible: false, - is_enabled: true, - }, - ]; - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: full_connectors.clone(), - }), - /*is_final*/ true, - ); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: notion_id.to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }], - }), - /*is_final*/ false, - ); - chat.on_connectors_loaded( - Err("failed to load apps".to_string()), - /*is_final*/ true, - ); - - assert_matches!( - &chat.connectors_cache, - ConnectorsCacheState::Ready(snapshot) if snapshot.connectors == full_connectors - ); - - chat.add_connectors_output(); - let popup = render_bottom_popup(&chat, /*width*/ 80); - assert!( - popup.contains("Installed 1 of 2 available apps."), - "expected previous full snapshot to be preserved, got:\n{popup}" - ); -} - -#[tokio::test] -async fn apps_popup_preserves_selected_app_across_refresh() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![ - AppInfo { - id: "notion".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }, - AppInfo { - id: "slack".to_string(), - name: "Slack".to_string(), - description: Some("Team chat".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/slack".to_string()), - is_accessible: true, - is_enabled: true, - }, - ], - }), - /*is_final*/ true, - ); - chat.add_connectors_output(); - chat.handle_key_event(KeyEvent::from(KeyCode::Down)); - - let before = render_bottom_popup(&chat, /*width*/ 80); - assert!( - before.contains("› Slack"), - "expected Slack to be selected before refresh, got:\n{before}" - ); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![ - AppInfo { - id: "airtable".to_string(), - name: "Airtable".to_string(), - description: Some("Spreadsheets".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/airtable".to_string()), - is_accessible: true, - is_enabled: true, - }, - AppInfo { - id: "notion".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }, - AppInfo { - id: "slack".to_string(), - name: "Slack".to_string(), - description: Some("Team chat".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/slack".to_string()), - is_accessible: true, - is_enabled: true, - }, - ], - }), - /*is_final*/ true, - ); - - let after = render_bottom_popup(&chat, /*width*/ 80); - assert!( - after.contains("› Slack"), - "expected Slack to stay selected after refresh, got:\n{after}" - ); - assert!( - !after.contains("› Notion"), - "did not expect selection to reset to Notion after refresh, got:\n{after}" - ); -} - -#[tokio::test] -async fn apps_refresh_failure_with_cached_snapshot_triggers_pending_force_refetch() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - chat.connectors_prefetch_in_flight = true; - chat.connectors_force_refetch_pending = true; - - let full_connectors = vec![AppInfo { - id: "unit_test_apps_refresh_failure_pending_connector".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }]; - chat.connectors_cache = ConnectorsCacheState::Ready(ConnectorsSnapshot { - connectors: full_connectors.clone(), - }); - - chat.on_connectors_loaded( - Err("failed to load apps".to_string()), - /*is_final*/ true, - ); - - assert!(chat.connectors_prefetch_in_flight); - assert!(!chat.connectors_force_refetch_pending); - assert_matches!( - &chat.connectors_cache, - ConnectorsCacheState::Ready(snapshot) if snapshot.connectors == full_connectors - ); -} - -#[tokio::test] -async fn apps_popup_keeps_existing_full_snapshot_while_partial_refresh_loads() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - - let full_connectors = vec![ - AppInfo { - id: "unit_test_connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }, - AppInfo { - id: "unit_test_connector_2".to_string(), - name: "Linear".to_string(), - description: Some("Project tracking".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/linear".to_string()), - is_accessible: false, - is_enabled: true, - }, - ]; - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: full_connectors.clone(), - }), - /*is_final*/ true, - ); - chat.add_connectors_output(); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![ - AppInfo { - id: "unit_test_connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }, - AppInfo { - id: "connector_openai_hidden".to_string(), - name: "Hidden OpenAI".to_string(), - description: Some("Should be filtered".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/hidden-openai".to_string()), - is_accessible: true, - is_enabled: true, - }, - ], - }), - /*is_final*/ false, - ); - - assert_matches!( - &chat.connectors_cache, - ConnectorsCacheState::Ready(snapshot) if snapshot.connectors == full_connectors - ); - - let popup = render_bottom_popup(&chat, /*width*/ 80); - assert!( - popup.contains("Installed 1 of 2 available apps."), - "expected popup to keep the last full snapshot while partial refresh loads, got:\n{popup}" - ); - assert!( - !popup.contains("Hidden OpenAI"), - "expected popup to ignore partial refresh rows until the full list arrives, got:\n{popup}" - ); -} - -#[tokio::test] -async fn apps_refresh_failure_without_full_snapshot_falls_back_to_installed_apps() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: "unit_test_apps_refresh_failure_fallback_connector".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }], - }), - /*is_final*/ false, - ); - - chat.add_connectors_output(); - let loading_popup = render_bottom_popup(&chat, /*width*/ 80); - assert!( - loading_popup.contains("Loading installed and available apps..."), - "expected /apps to keep showing loading before the final result, got:\n{loading_popup}" - ); - - chat.on_connectors_loaded( - Err("failed to load apps".to_string()), - /*is_final*/ true, - ); - - assert_matches!( - &chat.connectors_cache, - ConnectorsCacheState::Ready(snapshot) if snapshot.connectors.len() == 1 - ); - - let popup = render_bottom_popup(&chat, /*width*/ 80); - assert!( - popup.contains("Installed 1 of 1 available apps."), - "expected /apps to fall back to the installed apps snapshot, got:\n{popup}" - ); - assert!( - popup.contains("Installed. Press Enter to open the app page"), - "expected the fallback popup to behave like the installed apps view, got:\n{popup}" - ); -} - -#[tokio::test] -async fn apps_popup_shows_disabled_status_for_installed_but_disabled_apps() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: "connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: false, - }], - }), - /*is_final*/ true, - ); - - chat.add_connectors_output(); - let popup = render_bottom_popup(&chat, /*width*/ 80); - assert!( - popup.contains("Installed · Disabled. Press Enter to open the app page"), - "expected selected app description to include disabled status, got:\n{popup}" - ); - assert!( - popup.contains("enable/disable this app."), - "expected selected app description to mention enable/disable action, got:\n{popup}" - ); -} - -#[tokio::test] -async fn apps_initial_load_applies_enabled_state_from_config() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - - let temp = tempdir().expect("tempdir"); - let config_toml_path = temp.path().join("config.toml").abs(); - let user_config = toml::from_str::( - "[apps.connector_1]\nenabled = false\ndisabled_reason = \"user\"\n", - ) - .expect("apps config"); - chat.config.config_layer_stack = chat - .config - .config_layer_stack - .with_user_config(&config_toml_path, user_config); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: "connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }], - }), - /*is_final*/ true, - ); - - assert_matches!( - &chat.connectors_cache, - ConnectorsCacheState::Ready(snapshot) - if snapshot - .connectors - .iter() - .find(|connector| connector.id == "connector_1") - .is_some_and(|connector| !connector.is_enabled) - ); -} - -#[tokio::test] -async fn apps_initial_load_applies_enabled_state_from_requirements_with_user_override() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - - let requirements = ConfigRequirementsToml { - apps: Some(AppsRequirementsToml { - apps: BTreeMap::from([( - "connector_1".to_string(), - AppRequirementToml { - enabled: Some(false), - }, - )]), - }), - ..Default::default() - }; - let temp = tempdir().expect("tempdir"); - let config_toml_path = temp.path().join("config.toml").abs(); - chat.config.config_layer_stack = - ConfigLayerStack::new(Vec::new(), ConfigRequirements::default(), requirements) - .expect("requirements stack") - .with_user_config( - &config_toml_path, - toml::from_str::( - "[apps.connector_1]\nenabled = true\ndisabled_reason = \"user\"\n", - ) - .expect("apps config"), - ); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: "connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }], - }), - /*is_final*/ true, - ); - - assert_matches!( - &chat.connectors_cache, - ConnectorsCacheState::Ready(snapshot) - if snapshot - .connectors - .iter() - .find(|connector| connector.id == "connector_1") - .is_some_and(|connector| !connector.is_enabled) - ); - - chat.add_connectors_output(); - let popup = render_bottom_popup(&chat, /*width*/ 80); - assert!( - popup.contains("Installed · Disabled. Press Enter to open the app page"), - "expected requirements-disabled connector to render as disabled, got:\n{popup}" - ); -} - -#[tokio::test] -async fn apps_initial_load_applies_enabled_state_from_requirements_without_user_entry() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - - let requirements = ConfigRequirementsToml { - apps: Some(AppsRequirementsToml { - apps: BTreeMap::from([( - "connector_1".to_string(), - AppRequirementToml { - enabled: Some(false), - }, - )]), - }), - ..Default::default() - }; - chat.config.config_layer_stack = - ConfigLayerStack::new(Vec::new(), ConfigRequirements::default(), requirements) - .expect("requirements stack"); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: "connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }], - }), - /*is_final*/ true, - ); - - assert_matches!( - &chat.connectors_cache, - ConnectorsCacheState::Ready(snapshot) - if snapshot - .connectors - .iter() - .find(|connector| connector.id == "connector_1") - .is_some_and(|connector| !connector.is_enabled) - ); - - chat.add_connectors_output(); - let popup = render_bottom_popup(&chat, /*width*/ 80); - assert!( - popup.contains("Installed · Disabled. Press Enter to open the app page"), - "expected requirements-disabled connector to render as disabled, got:\n{popup}" - ); -} - -#[tokio::test] -async fn apps_refresh_preserves_toggled_enabled_state() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: "connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }], - }), - /*is_final*/ true, - ); - chat.update_connector_enabled("connector_1", /*enabled*/ false); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: "connector_1".to_string(), - name: "Notion".to_string(), - description: Some("Workspace docs".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/notion".to_string()), - is_accessible: true, - is_enabled: true, - }], - }), - /*is_final*/ true, - ); - - assert_matches!( - &chat.connectors_cache, - ConnectorsCacheState::Ready(snapshot) - if snapshot - .connectors - .iter() - .find(|connector| connector.id == "connector_1") - .is_some_and(|connector| !connector.is_enabled) - ); - - chat.add_connectors_output(); - let popup = render_bottom_popup(&chat, /*width*/ 80); - assert!( - popup.contains("Installed · Disabled. Press Enter to open the app page"), - "expected disabled status to persist after reload, got:\n{popup}" - ); -} - -#[tokio::test] -async fn apps_popup_for_not_installed_app_uses_install_only_selected_description() { - let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; - set_chatgpt_auth(&mut chat); - chat.config - .features - .enable(Feature::Apps) - .expect("test config should allow feature update"); - chat.bottom_pane.set_connectors_enabled(/*enabled*/ true); - - chat.on_connectors_loaded( - Ok(ConnectorsSnapshot { - connectors: vec![AppInfo { - id: "connector_2".to_string(), - name: "Linear".to_string(), - description: Some("Project tracking".to_string()), - logo_url: None, - logo_url_dark: None, - distribution_channel: None, - branding: None, - app_metadata: None, - labels: None, - install_url: Some("https://example.test/linear".to_string()), - is_accessible: false, - is_enabled: true, - }], - }), - /*is_final*/ true, - ); - - chat.add_connectors_output(); - let popup = render_bottom_popup(&chat, /*width*/ 80); - assert!( - popup.contains("Can be installed. Press Enter to open the app page to install"), - "expected selected app description to be install-only for not-installed apps, got:\n{popup}" - ); - assert!( - !popup.contains("enable/disable this app."), - "did not expect enable/disable text for not-installed apps, got:\n{popup}" - ); -} - #[tokio::test] async fn experimental_features_popup_snapshot() { let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await; diff --git a/vendor/codex/codex-rs/tui/src/mention_codec.rs b/vendor/codex/codex-rs/tui/src/mention_codec.rs index e957bc1d..6335a6a5 100644 --- a/vendor/codex/codex-rs/tui/src/mention_codec.rs +++ b/vendor/codex/codex-rs/tui/src/mention_codec.rs @@ -199,8 +199,8 @@ fn is_common_env_var(name: &str) -> bool { } fn is_tool_path(path: &str) -> bool { - path.starts_with("app://") - || path.starts_with("mcp://") + path.starts_with("mcp://") + || path.starts_with("plugin://") || path.starts_with("skill://") || path .rsplit(['/', '\\']) @@ -216,15 +216,15 @@ mod tests { #[test] fn decode_history_mentions_restores_visible_tokens() { let decoded = decode_history_mentions( - "Use [$figma](app://figma-1), [$sample](plugin://sample@test), and [$figma](/tmp/figma/SKILL.md).", + "Use [$repo](mcp://repo), [$sample](plugin://sample@test), and [$figma](/tmp/figma/SKILL.md).", ); - assert_eq!(decoded.text, "Use $figma, $sample, and $figma."); + assert_eq!(decoded.text, "Use $repo, $sample, and $figma."); assert_eq!( decoded.mentions, vec![ LinkedMention { - mention: "figma".to_string(), - path: "app://figma-1".to_string(), + mention: "repo".to_string(), + path: "mcp://repo".to_string(), }, LinkedMention { mention: "sample".to_string(), @@ -239,10 +239,10 @@ mod tests { } #[test] - fn decode_history_mentions_ignores_at_sigil_for_non_plugin_paths() { - let decoded = decode_history_mentions("Use [@figma](app://figma-1)."); + fn decode_history_mentions_ignores_at_sigil_for_tool_paths() { + let decoded = decode_history_mentions("Use [@repo](mcp://repo)."); - assert_eq!(decoded.text, "Use [@figma](app://figma-1)."); + assert_eq!(decoded.text, "Use [@repo](mcp://repo)."); assert_eq!(decoded.mentions, Vec::::new()); } @@ -254,7 +254,7 @@ mod tests { &[ LinkedMention { mention: "figma".to_string(), - path: "app://figma-app".to_string(), + path: "mcp://figma".to_string(), }, LinkedMention { mention: "sample".to_string(), @@ -268,7 +268,7 @@ mod tests { ); assert_eq!( encoded, - "[$figma](app://figma-app) then [$sample](plugin://sample@test) then [$figma](/tmp/figma/SKILL.md) then $other" + "[$figma](mcp://figma) then [$sample](plugin://sample@test) then [$figma](/tmp/figma/SKILL.md) then $other" ); } } diff --git a/vendor/codex/codex-rs/tui/src/slash_command.rs b/vendor/codex/codex-rs/tui/src/slash_command.rs index ceb53e07..4f7ba782 100644 --- a/vendor/codex/codex-rs/tui/src/slash_command.rs +++ b/vendor/codex/codex-rs/tui/src/slash_command.rs @@ -44,7 +44,6 @@ pub enum SlashCommand { Statusline, Theme, Mcp, - Apps, Logout, Quit, Exit, @@ -115,7 +114,6 @@ impl SlashCommand { SlashCommand::Experimental => "toggle experimental features", SlashCommand::Memories => "configure memory use and generation", SlashCommand::Mcp => "list configured MCP tools; use /mcp verbose for details", - SlashCommand::Apps => "manage apps", SlashCommand::Logout => "log out of Codex", SlashCommand::Rollout => "print the rollout file path", SlashCommand::TestApproval => "test approval request", @@ -185,7 +183,6 @@ impl SlashCommand { | SlashCommand::Ps | SlashCommand::Stop | SlashCommand::Mcp - | SlashCommand::Apps | SlashCommand::Feedback | SlashCommand::Quit | SlashCommand::Exit