Skip to content

Commit 431dfab

Browse files
committed
docs(nori): Update noridocs for agent picker work
1 parent f6e0652 commit 431dfab

4 files changed

Lines changed: 30 additions & 9 deletions

File tree

.claude/settings.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
{
22
"$schema": "https://json.schemastore.org/claude-code-settings.json",
33
"permissions": {
4-
"additionalDirectories": [],
54
"allow": [
65
"Bash(cat:*)",
76
"Bash(cd:*)",
8-
"Bash(git diff:*)",
9-
"Bash(git log:*)",
10-
"Bash(git show:*)",
117
"Bash(git status:*)",
12-
"Bash(ls:*)",
138
"Bash(mkdir:*)",
149
"Bash(tree:*)",
1510
"Bash(cargo build:*)",
@@ -26,10 +21,10 @@
2621
"Bash(cargo test:*)",
2722
"Bash(cargo t:*)",
2823
"Bash(cargo search:*)"
24+
],
25+
"additionalDirectories": [
26+
"~/Documents/source/nori/cli/.claude/profiles",
27+
"~/Documents/source/nori/cli/.claude/skills"
2928
]
30-
},
31-
"sandbox": {
32-
"enabled": true,
33-
"autoAllowBashIfSandboxed": true
3429
}
3530
}

codex-rs/acp/docs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ The ACP registry in `@/codex-rs/acp/src/registry.rs` is **model-centric** rather
3131
- `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
3232
- 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
3333

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+
3442
### Embedded Provider Info
3543

3644
ACP providers embed their configuration directly in `AcpAgentConfig` via `AcpProviderInfo`:

codex-rs/tui/docs.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ In `spawn_acp_agent()`, the main task must drop its `Arc<AcpBackend>` reference
7373
- `slash_command.rs`: `/command` parsing and execution
7474
- `file_search.rs`: Fuzzy file finder
7575

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+
7684
**Onboarding:**
7785

7886
The `onboarding/` module handles first-run experience:
@@ -122,6 +130,10 @@ Most event types (exec begin/end, MCP calls, elicitation) are queued during acti
122130
- The `InterruptManager` still contains `ExecApproval` and `ApplyPatchApproval` variants for completeness, but these methods are marked `#[allow(dead_code)]`
123131
- `on_task_complete()` calls `flush_interrupt_queue()` for any remaining queued items
124132

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+
125137
**Agent Switch Event Filtering:**
126138

127139
When switching between ACP agents (e.g., via `/agent` command), `ChatWidget` uses an event filtering mechanism to prevent race conditions:

codex-rs/tui/src/nori/docs.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ The `NoriSessionHeaderCell` struct implements `HistoryCell` and renders:
4848

4949
The banner uses green+bold for alphabetic characters and dark gray for structural characters (pipes, slashes) to create a two-tone visual effect.
5050

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.
56+
5157
### Things to Know
5258

5359
**Profile Display:**

0 commit comments

Comments
 (0)