You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: codex-rs/acp/docs.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,14 @@ The ACP registry in `@/codex-rs/acp/src/registry.rs` is **model-centric** rather
31
31
-`mock-model-alt` uses the same binary as `mock-model` but with provider_slug `mock-acp-alt` for E2E testing agent switching between different configurations
32
32
- Claude ACP is registered for both "claude-4.5" and "claude-acp" model names, using `npx @zed-industries/claude-code-acp` command with no arguments
33
33
34
+
### Agent Picker Metadata
35
+
36
+
`list_available_agents()` (also in `acp/src/registry.rs`) returns `Vec<AcpAgentInfo>` so the TUI can render the `/agent` picker:
37
+
-`model_name`, `display_name`, and `description` describe what to present in the selection view.
38
+
-`provider_slug` mirrors the config slug so the UI can explain when different agents reuse the same backend.
39
+
-`codex_tui::nori::agent_picker` consumes these entries to build the selection popup shown by `/agent`, while `/model` uses `acp_model_picker_params()` to surface a disabled message pointing back to `/agent`.
40
+
- Selecting an agent raises `AppEvent::SetPendingAgent`, stores a `PendingAgentSelection`, and defers the actual switch until `AppEvent::SubmitWithAgentSwitch` rebuilds the `ChatWidget` with the new model.
41
+
34
42
### Embedded Provider Info
35
43
36
44
ACP providers embed their configuration directly in `AcpAgentConfig` via `AcpProviderInfo`:
Copy file name to clipboardExpand all lines: codex-rs/tui/docs.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,14 @@ In `spawn_acp_agent()`, the main task must drop its `Arc<AcpBackend>` reference
73
73
-`slash_command.rs`: `/command` parsing and execution
74
74
-`file_search.rs`: Fuzzy file finder
75
75
76
+
**ACP Agent Switching:**
77
+
78
+
-`/agent` now opens the Nori-specific agent picker popup in `tui/src/chatwidget.rs`, which drives `nori::agent_picker::agent_picker_params()` and renders the metadata returned by `codex_acp::list_available_agents()` as `SelectionItem`s.
79
+
- Selecting an agent sends `AppEvent::SetPendingAgent`, so both the App and `ChatWidget` store a `pending_agent` (see `PendingAgentSelection` and `PendingAgentInfo`). The UI informs the user that the switch will happen on the next prompt submission.
80
+
- When the next prompt is submitted, `ChatWidget` intercepts the queued `UserMessage`, forwards it as `AppEvent::SubmitWithAgentSwitch`, and lets the App restart the conversation with the new model (clearing the pending flag, updating `Config`, shutting down the old conversation, and creating a `ChatWidget` with `expected_model` to filter out leftover events).
81
+
-`/model` now checks `codex_acp::get_agent_config()`; if the workspace is in ACP mode it shows the disabled `acp_model_picker_params()` view that explicitly tells users to use `/agent` instead of selecting models directly.
82
+
- This workflow avoids disrupting active turns and powers the agent-switching verification in `tui-pty-e2e/tests/agent_switching.rs`, including the message-flow and pending-selection tests added in the last commits.
83
+
76
84
**Onboarding:**
77
85
78
86
The `onboarding/` module handles first-run experience:
@@ -122,6 +130,10 @@ Most event types (exec begin/end, MCP calls, elicitation) are queued during acti
122
130
- The `InterruptManager` still contains `ExecApproval` and `ApplyPatchApproval` variants for completeness, but these methods are marked `#[allow(dead_code)]`
123
131
-`on_task_complete()` calls `flush_interrupt_queue()` for any remaining queued items
124
132
133
+
**ACP File Tracing:**
134
+
135
+
- The TUI calls `codex_acp::init_file_tracing()` at startup (`tui/src/lib.rs`) to write `.codex-acp.log` in the current directory. Every mock agent logs `ACP agent spawned (pid: ...)` there, which makes the agent-switching tests in `tui-pty-e2e` deterministic and ensures developers can inspect agent subprocess lifecycles during debugging.
136
+
125
137
**Agent Switch Event Filtering:**
126
138
127
139
When switching between ACP agents (e.g., via `/agent` command), `ChatWidget` uses an event filtering mechanism to prevent race conditions:
Copy file name to clipboardExpand all lines: codex-rs/tui/src/nori/docs.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,12 @@ The `NoriSessionHeaderCell` struct implements `HistoryCell` and renders:
48
48
49
49
The banner uses green+bold for alphabetic characters and dark gray for structural characters (pipes, slashes) to create a two-tone visual effect.
50
50
51
+
**Agent Picker (`agent_picker.rs`):**
52
+
53
+
-`agent_picker_params()` consumes `codex_acp::list_available_agents()` so `/agent` can display each `AcpAgentInfo` entry (model name, display name, description, provider slug) with a `SelectionAction` that sends `AppEvent::SetPendingAgent`.
54
+
-`acp_model_picker_params()` renders the `/model` fallback page that disables selection when ACP mode is active and points the user back to `/agent`.
55
+
-`PendingAgentSelection` holds the selected model/display name pair so the App and `ChatWidget` can store it until the next prompt triggers `AppEvent::SubmitWithAgentSwitch`, at which point the conversation is rebuilt with the new model and the picker view is dismissed.
0 commit comments