diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 820dc826..1041034f 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -82,7 +82,7 @@ Terminal editor + headless CLI for AI agent orchestration. Rust 2024.
### Memory + MCP + write path
- [`MemoryStores`](crates/gaviero-core/src/memory/stores.rs) + [`WriterHandle`](crates/gaviero-core/src/memory/writer.rs) — multi-DB; single writer task.
-- [`GavieroMcpServer`](crates/gaviero-core/src/mcp/server.rs) — ten tools over [`McpEndpoint`](crates/gaviero-core/src/mcp/transport.rs) (stdio shim) plus a loopback streamable-HTTP listener ([`mcp/http.rs`](crates/gaviero-core/src/mcp/http.rs)). Nine read-only (including `memory_ping` and the function-level `symbol_refs`) plus write-adjacent `memory_flag`. Nested-agent reach is probed (`--mcp-reach-probe`) and recorded in `.gaviero/mcp_reach.json`. `gaviero-mcp-shim --resolve` walks up for `mcp-endpoint.json`. User-scope MCP registration: `--mcp-register-user`. Lean tool list: `mcp.gavieroServer.exposedTools`. DeepSeek `deepseek:` does not use the shim; `dsh:` mounts gaviero MCP on `session/new`.
+- [`GavieroMcpServer`](crates/gaviero-core/src/mcp/server.rs) — eleven tools over [`McpEndpoint`](crates/gaviero-core/src/mcp/transport.rs) (stdio shim) plus a loopback streamable-HTTP listener ([`mcp/http.rs`](crates/gaviero-core/src/mcp/http.rs)). Nine read-only (including `memory_ping` and the function-level `symbol_refs`) plus write-adjacent `memory_flag`, plus the interactive `ask_user_question` — that last one exists only on a connection that names its chat conversation with `x-gaviero-conversation` (the `dsh:` path) and parks the TUI's question overlay. Nested-agent reach is probed (`--mcp-reach-probe`) and recorded in `.gaviero/mcp_reach.json`. `gaviero-mcp-shim --resolve` walks up for `mcp-endpoint.json`. User-scope MCP registration: `--mcp-register-user`. Lean tool list: `mcp.gavieroServer.exposedTools`. DeepSeek `deepseek:` does not use the shim; `dsh:` mounts gaviero MCP on `session/new`.
- [`WriteGatePipeline`](crates/gaviero-core/src/write_gate.rs) — every agent file change.
### Observers
diff --git a/CLAUDE.md b/CLAUDE.md
index 74347b44..5b839ad5 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -52,14 +52,14 @@ All interactive coding providers — Claude Code, Codex, Cursor, Ollama, DeepSee
- **File edits never bypass review.** In TUI chat the host captures the turn, not the tools: [`turn_capture`](crates/gaviero-core/src/turn_capture/mod.rs) snapshots the workspace folders before the agent starts and diffs them after the session closes (no git — `.gitignore` is read as a plain pattern file, plus `files.exclude`; `.gaviero/` and `.git/` skipped; `.gaviero/settings.json`, `.gaviero/dsl/`, `.gaviero/skills/`, sensitive paths and the gitignored folders listed in `turnReview.includeIgnored` always scanned). Every provider writes freely during the turn (`AgentOptions::host_capture` skips their own snapshot/revert/propose paths and pre-approves `Write`/`Edit`/`MultiEdit`); Bash keeps `ToolPolicy`. Whatever changed — edit tools, Bash, formatters, deletes, renames — becomes a `TurnChangeSet`, sensitive paths are auto-reverted, and the conversation is blocked until the TURN REVIEW is done (accept or reject each file, or the whole turn; reject = back to the pre-prompt version). If the baseline cannot be taken, the turn falls back to the provider-side Write Gate path. Swarm and `gaviero-cli` keep the Write Gate: native tools write inside their worktree, `dsh:` reconciles out-of-band writes via git dirty-set, Ollama's `…` blocks are extracted by [crates/gaviero-core/src/acp/protocol.rs](crates/gaviero-core/src/acp/protocol.rs).
- **One review path per entry point.** TUI chat: the turn change set ([crates/gaviero-tui/src/app/turn_review.rs](crates/gaviero-tui/src/app/turn_review.rs)). Swarm (CLI or the TUI SWARM panel) / CLI: `write_gate::WriteGatePipeline` ([crates/gaviero-core/src/write_gate.rs](crates/gaviero-core/src/write_gate.rs)).
- **Scope enforcement.** Proposals are checked against the active `FileScope` ([crates/gaviero-core/src/scope_enforcer.rs](crates/gaviero-core/src/scope_enforcer.rs)) before they leave the gate.
-- **MCP routes every effect through the writer task.** Ten tools ([crates/gaviero-core/src/mcp/tools.rs](crates/gaviero-core/src/mcp/tools.rs)). Nine read-only: `memory_search`, `memory_get`, `memory_ping`, `blast_radius`, `node_doc`, `repo_outline`, `symbol_refs`, plus `symbol_search` / `symbol_doc` behind `repoMap.symbolEnrichment.enabled`. `memory_ping` writes only to an in-memory probe ledger. One write-adjacent: `memory_flag` (`mcp.flag.enabled`, default true) demotes a stale memory's trust — it creates and deletes nothing, refuses user-authored and History rows, is idempotent, and every applied flag writes a reversible audit row. It reaches the writer through the narrow [`MemorySignalSink`](crates/gaviero-core/src/mcp/signal.rs), so `mcp/server.rs` still holds no `WriterHandle`.
+- **MCP routes every effect through the writer task.** Eleven tools ([crates/gaviero-core/src/mcp/tools.rs](crates/gaviero-core/src/mcp/tools.rs)). Nine read-only: `memory_search`, `memory_get`, `memory_ping`, `blast_radius`, `node_doc`, `repo_outline`, `symbol_refs`, plus `symbol_search` / `symbol_doc` behind `repoMap.symbolEnrichment.enabled`. `memory_ping` writes only to an in-memory probe ledger. One write-adjacent: `memory_flag` (`mcp.flag.enabled`, default true) demotes a stale memory's trust — it creates and deletes nothing, refuses user-authored and History rows, is idempotent, and every applied flag writes a reversible audit row. It reaches the writer through the narrow [`MemorySignalSink`](crates/gaviero-core/src/mcp/signal.rs), so `mcp/server.rs` still holds no `WriterHandle`. One interactive: `ask_user_question` ([`mcp/ask.rs`](crates/gaviero-core/src/mcp/ask.rs)) — listed **only** for a loopback-HTTP connection whose requests carry `x-gaviero-conversation` (the `dsh:` session's MCP entry adds it) and only when the TUI installed a sink; it parks the same conversation overlay as Claude's `AskUserQuestion`, returns the answers as text, touches no store, and is exempt from `exposedTools` (but hidden and rejected by `mcp.permissions`).
## Conventions
- **Model spec is `provider:model`.** Bare names are rejected at dispatch (`validate_model_spec`, [crates/gaviero-core/src/swarm/backend/shared.rs](crates/gaviero-core/src/swarm/backend/shared.rs)). Prefixes: `claude:`, `codex:`, `cursor:`, `ollama:`, `local:`, `deepseek:`, `dsh:`.
- **Lock discipline.** Never hold a `Mutex` across I/O, parsing, or embedding. The memory `writer` task is the single owner of SQLite writes.
- **Two-layer graph context.** The pre-prompt assembler injects `` (shallow filesystem-only folder map, [crates/gaviero-core/src/repo_map/topology.rs](crates/gaviero-core/src/repo_map/topology.rs)) plus `` (PageRank-ranked code outline). The TUI `/lite` chat command drops `` + memory + impact and keeps only topology.
-- **Plan production.** When drafting implementation plans for other agents, assume Claude Code (`claude:fable` / `claude:opus`) or Codex (`codex:gpt-5.6-sol`) unless the user will implement themselves. Plans must be agent-executable: concrete work units, ownership boundaries, expected files/modules, verification steps, sequencing constraints. Example model profile (clients per tier): [crates/gaviero-dsl/examples/profiles/default.gaviero](crates/gaviero-dsl/examples/profiles/default.gaviero). Drafting is separate from *consuming*: a stored plan binds only while it is being executed — see the `plans/` rule under Rules.
+- **Plan production.** When drafting implementation plans for other agents, assume Claude Code (`claude:fable` / `claude:opus`) or Codex (`codex:gpt-6.1-sol`) unless the user will implement themselves. Plans must be agent-executable: concrete work units, ownership boundaries, expected files/modules, verification steps, sequencing constraints. Example model profile (clients per tier): [crates/gaviero-dsl/examples/profiles/default.gaviero](crates/gaviero-dsl/examples/profiles/default.gaviero). Drafting is separate from *consuming*: a stored plan binds only while it is being executed — see the `plans/` rule under Rules.
## Rules
diff --git a/Cargo.lock b/Cargo.lock
index d9c02a1d..ef3d9c09 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1434,7 +1434,7 @@ dependencies = [
[[package]]
name = "gaviero-cli"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"anyhow",
"clap",
@@ -1452,7 +1452,7 @@ dependencies = [
[[package]]
name = "gaviero-core"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"anyhow",
"async-trait",
@@ -1464,6 +1464,7 @@ dependencies = [
"dirs",
"futures",
"git2",
+ "http",
"ignore",
"insta",
"ndarray",
@@ -1520,7 +1521,7 @@ dependencies = [
[[package]]
name = "gaviero-dsl"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"chumsky",
"gaviero-core",
@@ -1533,7 +1534,7 @@ dependencies = [
[[package]]
name = "gaviero-mcp-shim"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"anyhow",
"clap",
@@ -1569,7 +1570,7 @@ dependencies = [
[[package]]
name = "gaviero-remote"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"axum",
"axum-server",
@@ -1593,7 +1594,7 @@ dependencies = [
[[package]]
name = "gaviero-tui"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"anyhow",
"arboard",
diff --git a/Cargo.toml b/Cargo.toml
index 5a2981e1..624ac3c9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,7 +7,7 @@ resolver = "2"
# built from. To release: bump it, then run `./scripts/release.ps1`, which tags
# v and pushes the tag (.github/workflows/release.yml takes it from
# there). gaviero-relay and tree-sitter-gaviero keep their own versions.
-version = "0.1.0"
+version = "0.1.1"
license = "Apache-2.0"
repository = "https://github.com/neich/gaviero"
homepage = "https://github.com/neich/gaviero"
diff --git a/README.md b/README.md
index f7abb5d1..a9fdb42d 100644
--- a/README.md
+++ b/README.md
@@ -152,7 +152,7 @@ gaviero-cli --script review.gaviero --prompt "the auth module" --tier fixer=high
gaviero-cli --script review.gaviero --prompt "the auth module" --profile codex # every model at once
```
-**Skills** — turn-scoped instruction templates under `.gaviero/skills//SKILL.md`, invoked in chat with `$skill-name`. They are found in each folder's `.gaviero/skills/`, in the workspace's — the `.gaviero/skills/` beside the `.gaviero-workspace` file, also for a one-folder workspace or a member folder opened on its own — and in the global `$GAVIERO_ROOT/.gaviero/skills/` (folder beats workspace beats global). Adding or removing a skill is picked up while gaviero runs, even when the `skills/` directory is created after launch. Use `/skills` to list or `/skills search ` for semantic discovery; `/skills` also lists every folder it scanned and each skill it could not load, with the reason (a missing `description`, a frontmatter `name` that differs from the folder name, a folder name outside `A-Za-z0-9_-`). `SKILL.md` may be any letter case, start with a BOM, and use YAML block values (`description: >`). Optional `skills.extraRoots` (array of paths, default `[]`, `~` expanded) adds foreign roots such as `~/.claude/skills` or `~/.codex/skills`; a missing configured root is a chat warning, not a silent skip.
+**Skills** — turn-scoped instruction templates under `.gaviero/skills//SKILL.md`, invoked in chat with `$skill-name`. They are found in each folder's `.gaviero/skills/`, in the workspace's — the `.gaviero/skills/` beside the `.gaviero-workspace` file, also for a one-folder workspace or a member folder opened on its own — and in the global `$GAVIERO_ROOT/.gaviero/skills/` (folder beats workspace beats global). Adding or removing a skill is picked up while gaviero runs, even when the `skills/` directory is created after launch. Use `/skills` to list or `/skills search ` for semantic discovery; `/skills` also lists every folder it scanned and each skill it could not load, with the reason (a missing `description`, a frontmatter `name` that differs from the folder name, a folder name outside `A-Za-z0-9_-`). `SKILL.md` may be any letter case, start with a BOM, and use YAML block values (`description: >`). Optional `skills.extraRoots` (array of paths, default `[]`, `~` expanded) adds foreign roots such as `~/.claude/skills` or `~/.codex/skills`; a missing configured root is a chat warning, not a silent skip. Chat resolves `$skill-name` for every provider (the rendered body rides the prompt as a `` block); for `dsh:` the same folders — every workspace member plus the `$GAVIERO_ROOT/.gaviero/skills/` global root, `~/.gaviero/skills/` only when `GAVIERO_ROOT` is unset — are also added to dsh's own skill catalog (`skill-filesystem.customSkillDirs`, through gaviero's launch patch), so the model's `skill` tool and available-skills list know them by name too.
## Configuration
diff --git a/crates/gaviero-cli/README.md b/crates/gaviero-cli/README.md
index 73fbc691..77190896 100644
--- a/crates/gaviero-cli/README.md
+++ b/crates/gaviero-cli/README.md
@@ -43,7 +43,7 @@ gaviero-cli --work-units '[{"id":"design","description":"Plan","scope":{"owned_p
| Provider | Examples |
|---|---|
| Claude | `claude:fable`, `claude:sonnet`, `claude:opus`, `claude:claude-fable-5-2`, `claude:claude-opus-5-5` |
-| Codex | `codex:gpt-6.1-sol`, `codex:gpt-6-astra`, `codex:gpt-6.1-terra`, `codex:gpt-6-sol`, `codex:gpt-6-luna`, `codex:gpt-5.6-sol`, `codex:gpt-5.6-terra`, `codex:gpt-5.6-luna` |
+| Codex | `codex:gpt-6.1-sol`, `codex:gpt-6-astra`, `codex:gpt-6-sol`, `codex:gpt-6-luna`, `codex:gpt-5.6-sol`, `codex:gpt-6.1-terra`, `codex:gpt-5.6-terra`, `codex:gpt-5.6-luna`, `codex:gpt-5.5` |
| Cursor | `cursor:composer-2.5`, `cursor:grok-4.7-high` (ids embed effort — see `agent --list-models`) |
| Ollama / local | `ollama:qwen2.5-coder:7b`, `local:qwen2.5-coder:14b` |
| DeepSeek | `deepseek:deepseek-flash`, `deepseek:deepseek-v4-pro` (legacy: `deepseek:deepseek-v4-flash`) |
diff --git a/crates/gaviero-cli/src/main.rs b/crates/gaviero-cli/src/main.rs
index c7e3cf13..8e175543 100644
--- a/crates/gaviero-cli/src/main.rs
+++ b/crates/gaviero-cli/src/main.rs
@@ -89,7 +89,7 @@ struct Cli {
/// Model spec to use for synthetic task execution and as the default runtime model.
/// Canonical form is `provider:model` — e.g. `claude:sonnet`, `claude:opus`,
- /// `codex:gpt-5.5`, `ollama:qwen2.5-coder:7b`. Defaults to workspace agent.model,
+ /// `codex:gpt-6.1-sol`, `ollama:qwen2.5-coder:7b`. Defaults to workspace agent.model,
/// then `claude:sonnet`.
#[arg(long)]
model: Option,
diff --git a/crates/gaviero-core/ARCHITECTURE.md b/crates/gaviero-core/ARCHITECTURE.md
index 22f089da..392edd7d 100644
--- a/crates/gaviero-core/ARCHITECTURE.md
+++ b/crates/gaviero-core/ARCHITECTURE.md
@@ -86,7 +86,7 @@ gaviero-core/src/
├─ mcp/ In-process MCP server
│ ├─ server.rs spawn_mcp_server, GavieroMcpServer
│ ├─ signal.rs MemorySignalSink — the one write-adjacent seam
-│ ├─ tools.rs Ten tools (see MCP below)
+│ ├─ tools.rs Eleven tools (see MCP below)
│ ├─ probe.rs ProbeLedger + memory_ping receipts
│ ├─ transport.rs McpEndpoint (Unix socket / Windows named pipe)
│ ├─ http.rs Loopback streamable-HTTP listener
@@ -168,7 +168,7 @@ Writes, TUI chat: every provider writes during the turn (`AgentOptions::host_cap
### Memory / MCP / observers
- [`MemoryStores`](src/memory/stores.rs) + [`WriterHandle`](src/memory/writer.rs) — multi-DB; single writer task.
-- [`GavieroMcpServer`](src/mcp/server.rs) — ten tools (nine read-only including `memory_ping` and `symbol_refs` + write-adjacent `memory_flag`); **no `WriterHandle`** — `memory_flag` signals through [`mcp/signal.rs`](src/mcp/signal.rs) into the writer task. `memory_ping` records only on an in-memory [`ProbeLedger`](src/mcp/probe.rs). Loopback HTTP: [`mcp/http.rs`](src/mcp/http.rs). Shim lookup: [`mcp/endpoint_file.rs`](src/mcp/endpoint_file.rs). Lean surface: `mcp.gavieroServer.exposedTools` (default all ten; lean preset `memory_search`/`memory_get`/`memory_ping`).
+- [`GavieroMcpServer`](src/mcp/server.rs) — eleven tools (nine read-only including `memory_ping` and `symbol_refs` + write-adjacent `memory_flag` + interactive `ask_user_question`, listed only for a loopback-HTTP connection that names its conversation with `x-gaviero-conversation`, and parking the TUI question overlay); **no `WriterHandle`** — `memory_flag` signals through [`mcp/signal.rs`](src/mcp/signal.rs) into the writer task. `memory_ping` records only on an in-memory [`ProbeLedger`](src/mcp/probe.rs). Loopback HTTP: [`mcp/http.rs`](src/mcp/http.rs). Shim lookup: [`mcp/endpoint_file.rs`](src/mcp/endpoint_file.rs). Lean surface: `mcp.gavieroServer.exposedTools` (default all ten routed; lean preset `memory_search`/`memory_get`/`memory_ping`).
- Observers in [`observer.rs`](src/observer.rs) / [`memory/observer.rs`](src/memory/observer.rs) / [`mcp/observer.rs`](src/mcp/observer.rs).
---
diff --git a/crates/gaviero-core/CLAUDE.md b/crates/gaviero-core/CLAUDE.md
index 4e8b083f..dceadd58 100644
--- a/crates/gaviero-core/CLAUDE.md
+++ b/crates/gaviero-core/CLAUDE.md
@@ -20,7 +20,7 @@ Network/model tests (Ollama, embedder downloads, Cursor/Codex/Claude CLI presenc
|---|---|---|
| Swarm | [`swarm/`](src/swarm) | Six-phase pipeline; backends in [`swarm/backend/`](src/swarm/backend): `claude_code`, `codex`, `cursor`, `ollama`, `deepseek`, `dsh`, `mock`, `Custom` — all behind [`AgentBackend`](src/swarm/backend/mod.rs). |
| Agent session | [`agent_session/`](src/agent_session) | `claude`, `codex_exec`, `codex_app_server`, `cursor`, `ollama`, [`tool_agent/`](src/agent_session/tool_agent) (`deepseek:`), [`agent_client_protocol/`](src/agent_session/agent_client_protocol) (`dsh:`), `registry`. |
-| MCP | [`mcp/`](src/mcp) | Ten tools — nine read-only (incl. `memory_ping`, `symbol_refs`) + write-adjacent `memory_flag` ([`tools.rs`](src/mcp/tools.rs)); stdio endpoint via [`transport.rs`](src/mcp/transport.rs); loopback HTTP ([`http.rs`](src/mcp/http.rs)); reach probe; user-scope registration; signal sink ([`signal.rs`](src/mcp/signal.rs)). |
+| MCP | [`mcp/`](src/mcp) | Eleven tools — nine read-only (incl. `memory_ping`, `symbol_refs`) + write-adjacent `memory_flag` ([`tools.rs`](src/mcp/tools.rs)) + interactive `ask_user_question` ([`ask.rs`](src/mcp/ask.rs): listed only on a loopback-HTTP connection carrying `x-gaviero-conversation`, parks the TUI question overlay, touches no store); stdio endpoint via [`transport.rs`](src/mcp/transport.rs); loopback HTTP ([`http.rs`](src/mcp/http.rs)); reach probe; user-scope registration; signal sink ([`signal.rs`](src/mcp/signal.rs)). |
| Memory | [`memory/`](src/memory) | Multi-DB ONNX store; single writer task ([`writer.rs`](src/memory/writer.rs)); merged multi-scope hybrid retrieval (RRF). |
| Write path | [`write_gate.rs`](src/write_gate.rs), [`scope_enforcer.rs`](src/scope_enforcer.rs) | Modes: Interactive / AutoAccept / Deferred / RejectAll. Swarm, CLI, and the TUI's fallback when turn capture is unavailable. |
| Agent guard | [`agent_guard/`](src/agent_guard) | `.gaviero/settings.json` → per-provider read policy (Claude `--settings`, Cursor `hooks.json`, Codex thread config) + `gaviero-cli --hook` decisions. Per-conversation `/add-dir` read grants ride `AgentOptions::session_read_folders`. |
@@ -28,7 +28,7 @@ Network/model tests (Ollama, embedder downloads, Cursor/Codex/Claude CLI presenc
| Secret scan | [`secret_scan.rs`](src/secret_scan.rs) | High-precision secret patterns for redaction (memory, transcripts, history, hook output). |
| Turn capture | [`turn_capture/`](src/turn_capture) | Host-side, git-free record of everything a chat turn changed: baseline manifest + SHA-256 blob store (`/.gaviero/turns`, blobs ≤ 8 MiB), `begin`/`end` diff, host-write ledger, overlap marking, sensitive auto-revert, byte-exact file/hunk revert, persisted pending reviews, retention (last 5 reviewed turns + pending). Sessions honour it via `AgentOptions::host_capture`. |
| Repo map | [`repo_map/`](src/repo_map) | Graph + [`topology.rs`](src/repo_map/topology.rs) + symbol enrichment/search. Live per-folder graph: [`repo_map/service.rs`](src/repo_map/service.rs) (`GraphService`, single writer thread). |
-| Skills | [`skills/`](src/skills) | Frontmatter, catalog, planner `ResolvedSkill` seam, opt-in constitution emit ([`skills/emit.rs`](src/skills/emit.rs)). |
+| Skills | [`skills/`](src/skills) | Frontmatter, catalog, planner `ResolvedSkill` seam, opt-in constitution emit ([`skills/emit.rs`](src/skills/emit.rs)). `dsh:` also gets the catalog folders natively — the launch patch [`dsh.rs`](src/agent_session/agent_client_protocol/dsh.rs) sets `skill-filesystem.customSkillDirs` to every workspace member's `.gaviero/skills` plus the user-wide `$GAVIERO_ROOT/.gaviero/skills` (`~/.gaviero/skills` only when `GAVIERO_ROOT` is unset), so dsh's `skill` tool lists what `$name` resolves. |
| Scripts | [`scripts.rs`](src/scripts.rs), [`script_profiles.rs`](src/script_profiles.rs) | Named `.gaviero/dsl//.gaviero` workflows and `.gaviero/dsl/profiles/.gaviero` model profiles (located here, parsed by `gaviero-dsl`; `profiles` is therefore not a valid script name). Scopes and name resolution are shared with skills in [`scoped_folders.rs`](src/scoped_folders.rs); run preparation shared by CLI and TUI is in [`swarm/script_run.rs`](src/swarm/script_run.rs). Run records for the TUI SWARM panel's History and continue (`/.gaviero/swarm-runs/`, `resume_checkpoint` over the pipeline's `.gaviero/state/.json`) are in [`swarm/run_history.rs`](src/swarm/run_history.rs). `gaviero-cli` runs publish a live record for the phone in [`swarm/live_run.rs`](src/swarm/live_run.rs) (machine folder `~/.gaviero/remote/cli-runs/`, `GAVIERO_CLI_RUNS_DIR` overrides; keeps 20; a running record not written for 90 s reads `interrupted`). `CliRunStore::list_json` / `detail_json` build the `GET /v1/cli-runs[/]` bodies the TUI serves. |
| History | [`history/`](src/history) | Per-turn NDJSON log (`.gaviero/history/turns.ndjson`): record model, the single `HistoryRecorder` (keys every capture by `turn_id`), tolerant reader shared by the TUI panel and `gaviero-cli --history`, the one token estimator. Write-only from host capture points; nothing under `memory/`, `context_planner/`, `mcp/`, `agent_session/`, `swarm/` imports it. Size-rotated through [`util::ndjson`](src/util/ndjson.rs), shared with the MCP telemetry sink. |
| Session persistence | [`session_state.rs`](src/session_state.rs), [`session_journal.rs`](src/session_journal.rs) | State + conversations save only on a clean quit; the journal appends each prompt at dispatch (fsync) so a crash can't lose it. All saves are tmp-file + rename. |
diff --git a/crates/gaviero-core/Cargo.toml b/crates/gaviero-core/Cargo.toml
index 8589924f..c4106aef 100644
--- a/crates/gaviero-core/Cargo.toml
+++ b/crates/gaviero-core/Cargo.toml
@@ -102,6 +102,11 @@ ignore = { workspace = true }
rustdoc-types = "0.57"
syn = { version = "2", features = ["full", "parsing"] }
axum = { version = "0.8", default-features = false, features = ["http1", "tokio", "json"] }
+# `mcp/ask.rs` reads the `http::request::Parts` rmcp inserts into a request's
+# extensions, to recover the conversation header. Crate-local and versionless
+# with the `http` axum/rmcp already resolve (1.x) — a second copy never enters
+# the graph.
+http = "1"
subtle = "2.6"
rand = "0.9"
diff --git a/crates/gaviero-core/README.md b/crates/gaviero-core/README.md
index 73b9c6ce..6a0b5ab6 100644
--- a/crates/gaviero-core/README.md
+++ b/crates/gaviero-core/README.md
@@ -49,7 +49,7 @@ println!("{}", plan.to_gaviero_script()?);
| Provider | Examples | Notes |
|---|---|---|
| Claude | `claude:fable`, `claude:sonnet`, `claude:opus`, `claude:claude-fable-5-2`, `claude:claude-opus-5-5` | Subprocess (Claude Code); `fable` → Fable 5.2, `opus` → Opus 5.5, `sonnet` → Sonnet 5 — the bare `fable`/`opus`/`sonnet` aliases are pinned to those ids at dispatch, so Opus 5.5 needs Claude Code ≥ 2.1.280 |
-| Codex | `codex:gpt-6.1-sol`, `codex:gpt-6-astra`, `codex:gpt-6.1-terra`, `codex:gpt-6-sol`, `codex:gpt-6-luna`, `codex:gpt-5.6-sol`, `codex:gpt-5.6-terra`, `codex:gpt-5.6-luna` | Subprocess (exec / app-server); the `/model` picker reads the installed CLI's catalog (`codex debug models`) |
+| Codex | `codex:gpt-6.1-sol`, `codex:gpt-6-astra`, `codex:gpt-6-sol`, `codex:gpt-6-luna`, `codex:gpt-5.6-sol`, `codex:gpt-6.1-terra`, `codex:gpt-5.6-terra`, `codex:gpt-5.6-luna`, `codex:gpt-5.5` | Subprocess (exec / app-server); the `/model` picker reads the installed CLI's catalog (`codex debug models`) |
| Cursor | `cursor:composer-2.5`, `cursor:grok-4.7-high` | Subprocess (Cursor CLI); ids embed effort — list them with `agent --list-models` |
| Ollama / local | `ollama:qwen2.5-coder:7b`, `local:model-name` | Local server |
| DeepSeek | `deepseek:deepseek-flash`, `deepseek:deepseek-v4-pro` | In-process HTTP (`tool_agent`) |
@@ -114,7 +114,7 @@ Reads `.gaviero/settings.json` (cascade documented in [gaviero-tui](../gaviero-t
| `acp/` | Claude subprocess protocol, file-block routing |
| `agent_session/` | Per-provider sessions: `claude`, `codex_exec`, `codex_app_server`, `cursor`, `ollama`, `tool_agent` (`deepseek:`), `agent_client_protocol` (`dsh:`), `registry` |
| `swarm/` | Orchestration, tier routing, DAG execution, backends, verification, git merge |
-| `mcp/` | In-process MCP server (ten tools: nine read-only incl. `memory_ping` and `symbol_refs` + write-adjacent `memory_flag`), config synthesis, stdio + loopback HTTP transport, reach probe |
+| `mcp/` | In-process MCP server (eleven tools: nine read-only incl. `memory_ping` and `symbol_refs` + write-adjacent `memory_flag` + interactive `ask_user_question`, listed only for a loopback-HTTP connection that names its conversation), config synthesis, stdio + loopback HTTP transport, reach probe |
| `memory/` | Five-level scoped embeddings, RRF retrieval, consolidation, soft-delete |
| `write_gate/` | Diff review, hunk acceptance, scope enforcement |
| `validation_gate/` | tree-sitter syntax, cargo compile, test verification |
diff --git a/crates/gaviero-core/src/agent_session/agent_client_protocol/dsh.rs b/crates/gaviero-core/src/agent_session/agent_client_protocol/dsh.rs
index 55596e93..0132b381 100644
--- a/crates/gaviero-core/src/agent_session/agent_client_protocol/dsh.rs
+++ b/crates/gaviero-core/src/agent_session/agent_client_protocol/dsh.rs
@@ -38,6 +38,35 @@ pub const GAVIERO_ACP_PATCH: &str = "\
";
pub const GAVIERO_ACP_PATCH_FILE: &str = "gaviero-acp.patch.yml";
+/// dsh patch overlay that mounts gaviero's own skill folders into dsh's
+/// `skill-filesystem` provider.
+///
+/// Two halves make a skill usable on a provider:
+///
+/// * **The body.** `$name` is gaviero's invocation syntax: the TUI resolves it
+/// against [`crate::skills::SkillCatalog`] and the rendered `SKILL.md` rides
+/// the ACP prompt as a `` block
+/// ([`super::build_prompt_blocks`]) — identical to Claude's enriched prompt.
+/// * **The catalog.** dsh's `skill` tool and its `` reminder
+/// are fed by dsh's own provider registry, which scans `/.dsh/skills`,
+/// `/.agents/skills`, `~/.dsh/skills`, `~/.agents/skills` and the
+/// bundled root — none of them gaviero's `.gaviero/skills`. Claude reads
+/// `.claude/skills` natively, so a project that mirrors its skills there has
+/// them in Claude's own catalog; dsh has no equivalent for `.gaviero/skills`.
+/// Without this row the `$name` body still arrives, but the model's catalog
+/// contradicts it and it can answer as if nothing was injected.
+///
+/// Applied as an **id-targeted config override** of the bundle's own
+/// `skill-filesystem` row (not a second provider): dsh keeps its default
+/// roots, watchers and `bundledSkillDir`, and the overlay imports no package,
+/// so a dsh that does not ship the provider has nothing new to resolve.
+/// `watch` stays at its default, so a skill added mid-session is catalogued on
+/// the next lookup.
+pub const DSH_SKILLS_PATCH_FILE: &str = "gaviero-skills.patch.yml";
+
+/// Row id of the provider this overlay extends.
+pub const DSH_SKILLS_ROW_ID: &str = "skill-filesystem";
+
/// Whose DeepSeek key `dsh:` uses (`providers.dsh.credentialSource`).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum DshCredentialSource {
@@ -195,6 +224,26 @@ impl DshLaunchSpec {
),
}
}
+ // Gaviero's skills: dsh's own provider registry also scans gaviero's
+ // skill folders, so the `skill` tool and `` catalog
+ // match what `$name` resolves in chat. Skipped when no skill folder
+ // exists — a `dsh:` launch pays nothing for a feature with no skills.
+ // Real dsh only — the fake agent takes no patch overlays.
+ if !self.skip_api_key {
+ let skill_dirs = gaviero_skill_dirs(workspace_root, additional_roots);
+ if !skill_dirs.is_empty() {
+ match acp_patch_dir() {
+ Some(dir) => patches.push(ensure_patch_file(
+ &dir,
+ DSH_SKILLS_PATCH_FILE,
+ &skills_patch_body(&skill_dirs),
+ )?),
+ None => tracing::warn!(
+ "dsh: cannot locate ~/.gaviero; dsh's skill catalog stays gaviero-unaware"
+ ),
+ }
+ }
+ }
let patch_refs: Vec<&Path> = patches.iter().map(|p| p.as_path()).collect();
cmd.args(self.launch_args(&patch_refs));
cmd.current_dir(workspace_root);
@@ -208,6 +257,90 @@ fn acp_patch_dir() -> Option {
crate::workspace::home_gaviero_dir().map(|d| d.join("dsh"))
}
+/// The gaviero skill folders in scope for a launch, most specific first.
+///
+/// Mirrors what `$name` resolves against in a chat turn
+/// ([`crate::skills::SkillCatalog::scan`]): every workspace folder's
+/// `.gaviero/skills`, the workspace layer's (beside the `.gaviero-workspace`
+/// file), and the user-wide root. That user-wide root is
+/// **`$GAVIERO_ROOT/.gaviero/skills`** — the folder gaviero's global skills
+/// have always lived in; `~/.gaviero/skills` is only that root when
+/// `GAVIERO_ROOT` is unset (see [`crate::workspace::user_gaviero_dir`]).
+pub fn gaviero_skill_dirs(
+ workspace_root: &Path,
+ additional_roots: &[std::path::PathBuf],
+) -> Vec {
+ gaviero_skill_dirs_with_global(
+ workspace_root,
+ additional_roots,
+ &crate::skills::SkillCatalog::global_skills_dir(),
+ )
+}
+
+/// [`gaviero_skill_dirs`] with an explicit global folder, so tests do not
+/// depend on `$GAVIERO_ROOT`.
+///
+/// The primary folder, the workspace layer and the global root come from
+/// [`crate::skills::SkillCatalog::scan`] itself, so the list cannot drift from
+/// the cascade. `skills.extraRoots` entries ride along for the same reason.
+/// Sibling folders are added explicitly: a single-folder scan only sees the
+/// primary, while `$name` resolves against every member of a multi-folder
+/// workspace.
+pub fn gaviero_skill_dirs_with_global(
+ workspace_root: &Path,
+ additional_roots: &[std::path::PathBuf],
+ global_dir: &Path,
+) -> Vec {
+ let workspace = crate::workspace::Workspace::single_folder(workspace_root.to_path_buf());
+ let (catalog, _warnings) = crate::skills::SkillCatalog::scan(&workspace, global_dir);
+ let mut dirs: Vec = catalog
+ .scanned_dirs()
+ .iter()
+ .filter(|dir| dir.exists)
+ .map(|dir| dir.path.clone())
+ .collect();
+ // `native_roots` puts the global root last; keep every sibling folder
+ // before it so dsh's catalog keeps the same reach, nearest scope first.
+ let mut insert_at = dirs
+ .iter()
+ .position(|dir| dir.as_path() == global_dir)
+ .unwrap_or(dirs.len());
+ for root in additional_roots {
+ let dir = root.join(".gaviero").join("skills");
+ if dir.is_dir() && !dirs.contains(&dir) {
+ dirs.insert(insert_at, dir);
+ insert_at += 1;
+ }
+ }
+ dirs
+}
+
+/// YAML body of [`DSH_SKILLS_PATCH_FILE`] for `dirs`.
+///
+/// Paths are written with forward slashes and YAML single quotes (literal, so
+/// backslashes need no doubling); a `'` in a path is doubled, the one escape
+/// YAML single-quoted scalars have.
+pub fn skills_patch_body(dirs: &[std::path::PathBuf]) -> String {
+ let mut body = String::from(
+ "# Written by gaviero; regenerated on every dsh: launch. Do not edit.\n\
+ # Extend dsh's own skill provider with gaviero's skill folders, so its\n\
+ # `skill` tool and catalog list the skills that\n\
+ # `$name` resolves in gaviero's chat. dsh's default roots, watchers and\n\
+ # bundled skills are untouched: this only adds scan roots.\n",
+ );
+ body.push_str(&format!("- id: {DSH_SKILLS_ROW_ID}\n"));
+ body.push_str(" config:\n");
+ body.push_str(" customSkillDirs:\n");
+ for dir in dirs {
+ let slashy = dir
+ .to_string_lossy()
+ .replace('\\', "/")
+ .replace('\'', "''");
+ body.push_str(&format!(" - '{slashy}'\n"));
+ }
+ body
+}
+
/// Write [`GAVIERO_ACP_PATCH`] to `/gaviero-acp.patch.yml` (tmp + rename)
/// unless it is already current, and return its path.
pub fn ensure_acp_patch_file(dir: &Path) -> Result {
@@ -297,7 +430,18 @@ pub fn stdio_mcp_server(_root: &Path) -> serde_json::Value {
}
/// HTTP MCP server entry from the endpoint descriptor, if live.
-pub fn http_mcp_server(root: &Path) -> Option {
+///
+/// `conv_id` is the chat conversation this session belongs to. When present it
+/// rides as [`crate::mcp::ask::CONVERSATION_HEADER`] on every request dsh makes
+/// to gaviero's server, which is what lets `ask_user_question` exist for a
+/// `dsh:` session and nowhere else: ACP carries no elicitation, so the question
+/// has to travel over MCP, and the server needs to know which conversation's
+/// overlay to park it on.
+///
+/// Only the `gaviero` entry is tagged. context7 and `mcp.extraServers` are
+/// other people's servers; the header means nothing to them and would leak a
+/// local conversation id into a third party.
+pub fn http_mcp_server(root: &Path, conv_id: Option<&str>) -> Option {
let desc = crate::mcp::read_descriptor(&crate::mcp::McpEndpointDescriptor::path(root)).ok()?;
let url = desc.http_url?;
let token_path = desc.http_token_path?;
@@ -306,11 +450,21 @@ pub fn http_mcp_server(root: &Path) -> Option {
if token.is_empty() {
return None;
}
+ let mut headers = vec![serde_json::json!({
+ "name": "Authorization",
+ "value": format!("Bearer {token}")
+ })];
+ if let Some(conv_id) = conv_id {
+ headers.push(serde_json::json!({
+ "name": crate::mcp::ask::CONVERSATION_HEADER,
+ "value": conv_id,
+ }));
+ }
Some(serde_json::json!({
"type": "http",
"name": "gaviero",
"url": url,
- "headers": [{ "name": "Authorization", "value": format!("Bearer {token}") }]
+ "headers": headers,
}))
}
@@ -368,11 +522,21 @@ pub fn registers_gaviero(servers: &[serde_json::Value]) -> bool {
/// session is constructed below `create_session` where no `Workspace` is in
/// scope, and this keeps one call site rather than a new session field.
///
+/// `conv_id` tags the `gaviero` entry only ([`http_mcp_server`]). It is what
+/// makes `ask_user_question` available to a `dsh:` session and to nothing else:
+/// the ACP wire has no elicitation, so a structured question has to travel over
+/// MCP, and the header tells gaviero's server which conversation's overlay to
+/// park it on.
+///
/// Separately: dsh's `session/new` carries **no tool list and no permission
/// policy** (`agent_client_protocol/mod.rs`), so `agent.availableTools` is
/// *structurally unenforced* for dsh. That is recorded as
/// `ToolEnforcement::Unenforced` in the capability table, not attempted here.
-pub fn mcp_servers_for_session(root: &Path, caps: McpCapabilities) -> Vec {
+pub fn mcp_servers_for_session(
+ root: &Path,
+ caps: McpCapabilities,
+ conv_id: Option<&str>,
+) -> Vec {
// An in-process provider links servers as a live value; it has no MCP
// transport to hang a `mcpServers` entry on. The two capability axes say
// *what* a provider may use, not *how* it receives it — so an in-process row
@@ -383,7 +547,7 @@ pub fn mcp_servers_for_session(root: &Path, caps: McpCapabilities) -> Vec//SKILL.md` with a minimal valid frontmatter.
+ fn write_skill(dir: &Path, name: &str) {
+ let folder = dir.join(name);
+ std::fs::create_dir_all(&folder).unwrap();
+ std::fs::write(
+ folder.join("SKILL.md"),
+ format!("---\nname: {name}\ndescription: test skill\n---\n\nBody.\n"),
+ )
+ .unwrap();
+ }
+
+ #[test]
+ fn skill_dirs_are_the_scanned_roots_that_exist() {
+ let dir = tempdir().unwrap();
+ let root = dir.path().join("repo");
+ // The user-wide root is `$GAVIERO_ROOT/.gaviero/skills`, not a copy
+ // under the home directory.
+ let global = dir
+ .path()
+ .join("gaviero-root")
+ .join(".gaviero")
+ .join("skills");
+ std::fs::create_dir_all(&root).unwrap();
+ write_skill(&root.join(".gaviero").join("skills"), "lint");
+ write_skill(&global, "migrate-component");
+
+ let dirs = gaviero_skill_dirs_with_global(&root, &[], &global);
+ let root_skills = root.join(".gaviero").join("skills");
+ assert!(dirs.contains(&root_skills), "{dirs:?}");
+ assert!(dirs.contains(&global), "{dirs:?}");
+ // Most specific first, so dsh's rank tie-break prefers the folder and
+ // the global root stays the fallback.
+ let root_at = dirs.iter().position(|d| d == &root_skills).unwrap();
+ let global_at = dirs.iter().position(|d| d == &global).unwrap();
+ assert!(root_at < global_at, "{dirs:?}");
+ assert_eq!(dirs.last(), Some(&global), "{dirs:?}");
+ // A folder that does not exist is not mounted.
+ assert!(dirs.iter().all(|d| d.exists()), "{dirs:?}");
+ }
+
+ /// A stale `~/.gaviero/skills` left behind by an older setup must never be
+ /// mounted: the launch names `$GAVIERO_ROOT/.gaviero/skills` and nothing
+ /// else for the user-wide scope.
+ #[test]
+ fn skill_dirs_never_add_a_stale_home_copy() {
+ let dir = tempdir().unwrap();
+ let root = dir.path().join("repo");
+ let global = dir
+ .path()
+ .join("gaviero-root")
+ .join(".gaviero")
+ .join("skills");
+ let home = dir.path().join("home").join(".gaviero").join("skills");
+ std::fs::create_dir_all(&root).unwrap();
+ write_skill(&global, "deep-research");
+ write_skill(&home, "deep-research");
+
+ let dirs = gaviero_skill_dirs_with_global(&root, &[], &global);
+ assert!(dirs.contains(&global), "{dirs:?}");
+ assert!(!dirs.contains(&home), "{dirs:?}");
+ }
+
+ #[test]
+ fn skill_dirs_include_sibling_workspace_folders() {
+ let dir = tempdir().unwrap();
+ let root = dir.path().join("repo");
+ let sibling = dir.path().join("flutter");
+ let global = dir
+ .path()
+ .join("gaviero-root")
+ .join(".gaviero")
+ .join("skills");
+ std::fs::create_dir_all(&root).unwrap();
+ std::fs::create_dir_all(&sibling).unwrap();
+ write_skill(&sibling.join(".gaviero").join("skills"), "flutter-widget");
+
+ let dirs = gaviero_skill_dirs_with_global(&root, &[sibling.clone()], &global);
+ let sibling_skills = sibling.join(".gaviero").join("skills");
+ assert!(dirs.contains(&sibling_skills), "{dirs:?}");
+
+ // A sibling without a skills folder is not mounted, and the folder is
+ // not listed twice when it is passed twice.
+ let bare = dir.path().join("bare");
+ std::fs::create_dir_all(&bare).unwrap();
+ let dirs =
+ gaviero_skill_dirs_with_global(&root, &[sibling.clone(), sibling, bare], &global);
+ assert_eq!(
+ dirs.iter().filter(|d| **d == sibling_skills).count(),
+ 1,
+ "{dirs:?}"
+ );
+ }
+
+ /// The global root the launcher mounts is `$GAVIERO_ROOT/.gaviero/skills`
+ /// when the variable is set; the home directory is only the fallback.
+ #[test]
+ fn global_skill_root_follows_gaviero_root() {
+ let dir = crate::skills::SkillCatalog::global_skills_dir();
+ eprintln!("global skills root: {}", dir.display());
+ let Some(root) = std::env::var(crate::workspace::GAVIERO_ROOT_ENV).ok() else {
+ return;
+ };
+ if root.trim().is_empty() {
+ return;
+ }
+ let root = std::path::absolute(std::path::PathBuf::from(root)).unwrap();
+ assert_eq!(dir, root.join(".gaviero").join("skills"));
+ if let Some(home) = dirs::home_dir() {
+ let home_skills = home.join(".gaviero").join("skills");
+ if home_skills != dir {
+ assert_ne!(dir, home_skills);
+ }
+ }
+ }
+
+ #[test]
+ fn skill_dirs_are_empty_when_nothing_is_installed() {
+ let dir = tempdir().unwrap();
+ let root = dir.path().join("repo");
+ std::fs::create_dir_all(&root).unwrap();
+ let global = dir.path().join("absent").join("skills");
+ assert!(gaviero_skill_dirs_with_global(&root, &[], &global).is_empty());
+ }
+
+ #[test]
+ fn skills_patch_extends_the_bundle_provider_with_each_dir_quoted() {
+ let dirs = vec![
+ std::path::PathBuf::from("C:/repo/.gaviero/skills"),
+ // Backslashes become forward slashes; a quote is YAML-doubled.
+ std::path::PathBuf::from(r"C:\it's\.gaviero\skills"),
+ ];
+ let body = skills_patch_body(&dirs);
+ assert!(body.contains("- id: skill-filesystem\n"), "{body}");
+ assert!(body.contains(" config:\n"), "{body}");
+ assert!(body.contains(" customSkillDirs:\n"), "{body}");
+ assert!(
+ body.contains(" - 'C:/repo/.gaviero/skills'\n"),
+ "{body}"
+ );
+ assert!(
+ body.contains(" - 'C:/it''s/.gaviero/skills'\n"),
+ "{body}"
+ );
+ // An override of the existing row, not a second provider: no insert,
+ // no second registration under another provider name.
+ assert!(!body.contains("insert:"), "{body}");
+ assert!(!body.contains("providerName:"), "{body}");
+ assert_eq!(body.matches("- id: ").count(), 1, "{body}");
+ }
+
+ #[test]
+ fn skills_patch_file_is_written_once_and_reused() {
+ let dir = tempdir().unwrap();
+ let body = skills_patch_body(&[std::path::PathBuf::from("C:/repo/.gaviero/skills")]);
+ let first = ensure_patch_file(dir.path(), DSH_SKILLS_PATCH_FILE, &body).unwrap();
+ let second = ensure_patch_file(dir.path(), DSH_SKILLS_PATCH_FILE, &body).unwrap();
+ assert_eq!(first, second);
+ assert_eq!(std::fs::read_to_string(&first).unwrap(), body);
+ }
+
#[test]
fn missing_api_key_is_a_clear_error() {
if std::env::var_os("DEEPSEEK_API_KEY").is_some()
@@ -559,7 +883,7 @@ mod tests {
#[test]
fn mcp_servers_http_only_without_descriptor_is_empty() {
let dir = tempdir().unwrap();
- assert!(mcp_servers_for_session(dir.path(), dsh_caps()).is_empty());
+ assert!(mcp_servers_for_session(dir.path(), dsh_caps(), None).is_empty());
let stdio = stdio_mcp_server(dir.path());
assert_eq!(stdio["name"], "gaviero");
assert!(stdio.get("command").and_then(|c| c.as_str()).is_some());
@@ -572,6 +896,87 @@ mod tests {
std::fs::write(gav.join("settings.json"), body).unwrap();
}
+ /// A live-looking HTTP endpoint descriptor plus its token file, so
+ /// [`http_mcp_server`] returns an entry.
+ fn write_http_descriptor(root: &Path) {
+ let gav = root.join(".gaviero");
+ std::fs::create_dir_all(&gav).unwrap();
+ let token_path = gav.join("mcp-http-token");
+ std::fs::write(&token_path, "test-token\n").unwrap();
+ let desc = serde_json::json!({
+ "v": 1,
+ "workspace_id": "test",
+ "http_url": "http://127.0.0.1:9/mcp",
+ "http_token_path": token_path,
+ "pid": std::process::id(),
+ "started_at": chrono::Utc::now(),
+ });
+ std::fs::write(
+ crate::mcp::McpEndpointDescriptor::path(root),
+ desc.to_string(),
+ )
+ .unwrap();
+ }
+
+ /// A `dsh:` session's gaviero entry names the conversation; nothing else
+ /// does. That header is the only thing that makes `ask_user_question`
+ /// exist for this session, so the two must travel together.
+ #[test]
+ fn the_gaviero_http_entry_carries_the_conversation_header() {
+ let dir = tempdir().unwrap();
+ write_http_descriptor(dir.path());
+ write_settings(dir.path(), r#"{"mcp":{"context7":{"enabled":true}}}"#);
+
+ let tagged = mcp_servers_for_session(dir.path(), dsh_caps(), Some("conv-1"));
+ let gaviero = tagged
+ .iter()
+ .find(|s| s["name"] == "gaviero")
+ .expect("live endpoint must register gaviero");
+ let headers = gaviero["headers"].as_array().expect("headers array");
+ assert!(
+ headers
+ .iter()
+ .any(|h| h["name"] == "Authorization" && h["value"]
+ .as_str()
+ .is_some_and(|v| v.starts_with("Bearer "))),
+ "the bearer header must stay: {gaviero}"
+ );
+ let conversation = headers
+ .iter()
+ .find(|h| h["name"] == crate::mcp::ask::CONVERSATION_HEADER)
+ .unwrap_or_else(|| panic!("no conversation header in {gaviero}"));
+ assert_eq!(conversation["value"], "conv-1");
+
+ // context7 is another party's server: the conversation id stays home.
+ let ctx7 = tagged
+ .iter()
+ .find(|s| s["name"] == "context7")
+ .expect("context7 enabled in settings");
+ assert!(
+ !ctx7["headers"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .any(|h| h["name"] == crate::mcp::ask::CONVERSATION_HEADER),
+ "a local conversation id must not leak to context7: {ctx7}"
+ );
+
+ // A session with no conversation sends no such header.
+ let untagged = mcp_servers_for_session(dir.path(), dsh_caps(), None);
+ let gaviero = untagged
+ .iter()
+ .find(|s| s["name"] == "gaviero")
+ .expect("live endpoint must register gaviero");
+ assert!(
+ !gaviero["headers"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .any(|h| h["name"] == crate::mcp::ask::CONVERSATION_HEADER),
+ "no conversation, no header: {gaviero}"
+ );
+ }
+
fn names(servers: &[serde_json::Value]) -> Vec {
servers
.iter()
@@ -604,7 +1009,7 @@ mod tests {
let allowed = crate::context_planner::types::Provider::Dsh.mcp_capabilities();
assert!(allowed.context7 && allowed.extra_servers);
assert_eq!(
- names(&mcp_servers_for_session(dir.path(), allowed)),
+ names(&mcp_servers_for_session(dir.path(), allowed, None)),
vec!["context7", "consensus"]
);
@@ -617,7 +1022,7 @@ mod tests {
let in_process = crate::context_planner::types::Provider::Deepseek.mcp_capabilities();
assert!(in_process.extra_servers);
assert!(!in_process.uses_mcp_servers());
- assert!(mcp_servers_for_session(dir.path(), in_process).is_empty());
+ assert!(mcp_servers_for_session(dir.path(), in_process, None).is_empty());
}
/// Decision E: with no gaviero endpoint but context7 on, dsh still gets
@@ -627,7 +1032,7 @@ mod tests {
fn context7_http_is_registered_without_a_gaviero_endpoint() {
let dir = tempdir().unwrap();
write_settings(dir.path(), r#"{"mcp":{"context7":{"enabled":true}}}"#);
- let servers = mcp_servers_for_session(dir.path(), dsh_caps());
+ let servers = mcp_servers_for_session(dir.path(), dsh_caps(), None);
assert_eq!(names(&servers), vec!["context7"]);
let ctx7 = &servers[0];
assert_eq!(ctx7["type"], "http");
@@ -647,7 +1052,7 @@ mod tests {
dir.path(),
r#"{"mcp":{"context7":{"enabled":true,"url":""}}}"#,
);
- assert!(mcp_servers_for_session(dir.path(), dsh_caps()).is_empty());
+ assert!(mcp_servers_for_session(dir.path(), dsh_caps(), None).is_empty());
}
/// Disabled by default: no workspace opt-in, no entry.
@@ -655,7 +1060,7 @@ mod tests {
fn context7_is_opt_in() {
let dir = tempdir().unwrap();
write_settings(dir.path(), r#"{"mcp":{"context7":{"enabled":false}}}"#);
- assert!(mcp_servers_for_session(dir.path(), dsh_caps()).is_empty());
+ assert!(mcp_servers_for_session(dir.path(), dsh_caps(), None).is_empty());
}
/// Decision E: URL extras register, stdio extras are skipped.
@@ -669,7 +1074,7 @@ mod tests {
{"name":"local-thing","command":"some-server","args":["--x"]}
]}}"#,
);
- let servers = mcp_servers_for_session(dir.path(), dsh_caps());
+ let servers = mcp_servers_for_session(dir.path(), dsh_caps(), None);
assert_eq!(names(&servers), vec!["consensus"]);
assert_eq!(servers[0]["type"], "http");
}
@@ -687,7 +1092,7 @@ mod tests {
"permissions":{"deny":["context7:*","consensus:*"]}
}}"#,
);
- assert!(mcp_servers_for_session(dir.path(), dsh_caps()).is_empty());
+ assert!(mcp_servers_for_session(dir.path(), dsh_caps(), None).is_empty());
}
/// An `allow` list that never names a server excludes it, matching
@@ -703,6 +1108,6 @@ mod tests {
"permissions":{"allow":["gaviero:*"]}
}}"#,
);
- assert!(mcp_servers_for_session(dir.path(), dsh_caps()).is_empty());
+ assert!(mcp_servers_for_session(dir.path(), dsh_caps(), None).is_empty());
}
}
diff --git a/crates/gaviero-core/src/agent_session/agent_client_protocol/mod.rs b/crates/gaviero-core/src/agent_session/agent_client_protocol/mod.rs
index bf4b81cf..2e7425ad 100644
--- a/crates/gaviero-core/src/agent_session/agent_client_protocol/mod.rs
+++ b/crates/gaviero-core/src/agent_session/agent_client_protocol/mod.rs
@@ -246,7 +246,11 @@ impl AcpClientSession {
} else {
self.additional_roots.clone()
};
- let servers = mcp_servers_for_session(&self.workspace_root, self.capabilities);
+ let servers = mcp_servers_for_session(
+ &self.workspace_root,
+ self.capabilities,
+ self.conv_id.as_deref(),
+ );
// Keyed on gaviero's *own* server, not on the list being empty:
// context7 and `extraServers` can be registered while gaviero's
// endpoint is down, and `exposedTools` describes gaviero's retrieval
diff --git a/crates/gaviero-core/src/agent_session/agent_client_protocol/permission.rs b/crates/gaviero-core/src/agent_session/agent_client_protocol/permission.rs
index 830f3e87..0c5661e3 100644
--- a/crates/gaviero-core/src/agent_session/agent_client_protocol/permission.rs
+++ b/crates/gaviero-core/src/agent_session/agent_client_protocol/permission.rs
@@ -118,6 +118,19 @@ pub(super) fn plan_permission(
let name = field("title").and_then(|v| v.as_str()).unwrap_or("");
let raw_input = field("rawInput").cloned().unwrap_or(Value::Null);
+ // The ask-user tool *is* the question channel: gaviero's MCP
+ // `ask_user_question` parks the overlay itself, so approving the call would
+ // put two prompts in a row — the approval first, the question second. There
+ // is nothing to approve either: the call's only effect is that question.
+ // Same rule as `agent_session/tool_agent/tools/ask.rs` ("the permission
+ // channel is the question channel").
+ //
+ // Matched as a suffix because clients namespace MCP tools differently —
+ // `mcp__gaviero__ask_user_question` under Claude, and dsh may prefix its own.
+ if name.trim_end().ends_with(crate::mcp::ask::TOOL_ASK_USER_QUESTION) {
+ return PermissionPlan::Allow;
+ }
+
if is_shell_tool(name)
&& let Some(command) = raw_input.get("command").and_then(|v| v.as_str())
{
@@ -306,6 +319,41 @@ mod tests {
);
}
+ /// `ask_user_question` must never cost two prompts: the tool exists only to
+ /// ask, so its own call is allowed straight through and the parked question
+ /// is the one thing the user sees.
+ #[test]
+ fn the_ask_user_tool_is_allowed_without_an_extra_prompt() {
+ for title in [
+ "ask_user_question",
+ "mcp__gaviero__ask_user_question",
+ "gaviero/ask_user_question",
+ ] {
+ let log = log_with("c1", title, json!({ "questions": [] }));
+ let plan = plan_permission(
+ &request("c1"),
+ &log,
+ &surface(&[], &[], &[]),
+ false,
+ Path::new("."),
+ );
+ assert_eq!(plan, PermissionPlan::Allow, "{title} must not prompt");
+ }
+ // A lookalike that is not the tool still asks.
+ let log = log_with("c1", "ask_user_question_helper", json!({}));
+ let plan = plan_permission(
+ &request("c1"),
+ &log,
+ &surface(&[], &[], &[]),
+ false,
+ Path::new("."),
+ );
+ assert!(
+ matches!(&plan, PermissionPlan::Ask { tool_name, .. } if tool_name == "ask_user_question_helper"),
+ "{plan:?}"
+ );
+ }
+
#[test]
fn auto_approve_allows_everything() {
let plan = plan_permission(
diff --git a/crates/gaviero-core/src/agent_session/tool_agent/tools/ask.rs b/crates/gaviero-core/src/agent_session/tool_agent/tools/ask.rs
index ed44cdec..09085d7f 100644
--- a/crates/gaviero-core/src/agent_session/tool_agent/tools/ask.rs
+++ b/crates/gaviero-core/src/agent_session/tool_agent/tools/ask.rs
@@ -17,15 +17,17 @@
//! remote protocol. A second channel would need a second overlay, a second
//! remote frame, and a second "first valid answer wins" race.
//!
-//! 2. **The wire shape is Claude's, byte-for-byte.** `questions[]` entries are
-//! `{ question, header, multiSelect, options[{ label, description }] }` — the
-//! exact shape `AskUserQuestionState::from_input` parses in the TUI. The
-//! overlay therefore needed no new renderer, and the answers come back in the
-//! same `updated_input.answers` object the desktop and remote paths already
-//! agree on. What *did* have to change is that the TUI used to key the
-//! overlay on the tool *name*; it now keys on the shape (see
-//! `PendingPermission::new`), which is what makes this tool reach the UI at
-//! all.
+//! 2. **The wire shape is Claude's, byte-for-byte** — and it is shared with the
+//! MCP surface for `dsh:` ([`crate::mcp::ask`]) through
+//! [`crate::ask_user`], so the two channels cannot drift apart.
+//! `questions[]` entries are `{ question, header, multiSelect,
+//! options[{ label, description }] }` — the exact shape
+//! `AskUserQuestionState::from_input` parses in the TUI. The overlay
+//! therefore needed no new renderer, and the answers come back in the same
+//! `updated_input.answers` object the desktop and remote paths already agree
+//! on. What *did* have to change is that the TUI used to key the overlay on
+//! the tool *name*; it now keys on the shape (see `PendingPermission::new`),
+//! which is what makes this tool reach the UI at all.
//!
//! Deliberately **not** gated on `ToolCtx::auto_approve`: `/autoapprove` grants
//! *permission to run a tool*, not the answer to a question. Auto-allowing this
@@ -35,13 +37,7 @@ use serde_json::{Value, json};
use super::{Tool, ToolCtx, ToolOutcome};
use crate::acp::session::ASK_USER_QUESTION_TOOL;
-
-/// Claude's documented ceiling. Enforced (not just advertised) because the
-/// overlay auto-grows to fit the questions and a model that ignores the schema
-/// would otherwise produce an unusable full-screen form.
-const MAX_QUESTIONS: usize = 4;
-/// Claude's documented ceiling per question.
-const MAX_OPTIONS: usize = 4;
+use crate::ask_user::{self, ASK_TOOL_DESCRIPTION};
/// The in-process loop's implementation of Claude's `AskUserQuestion`.
pub struct AskQuestionTool;
@@ -57,66 +53,14 @@ impl Tool for AskQuestionTool {
"type": "function",
"function": {
"name": ASK_USER_QUESTION_TOOL,
- "description": "Ask the user one or more multiple-choice questions when you need a \
- decision you cannot make from the repository alone. Use this instead of \
- guessing, and instead of writing the question as prose — the user gets a \
- selectable list and the answers come back to you as text.",
- "parameters": {
- "type": "object",
- "properties": {
- "questions": {
- "type": "array",
- "minItems": 1,
- "maxItems": MAX_QUESTIONS,
- "description": "The questions to ask, at most 4.",
- "items": {
- "type": "object",
- "properties": {
- "question": {
- "type": "string",
- "description": "The question to ask, in the user's language."
- },
- "header": {
- "type": "string",
- "description": "Short label (max ~12 chars) for the question."
- },
- "multiSelect": {
- "type": "boolean",
- "description": "True when more than one option may be selected."
- },
- "options": {
- "type": "array",
- "minItems": 2,
- "maxItems": MAX_OPTIONS,
- "description": "The selectable answers, at most 4.",
- "items": {
- "type": "object",
- "properties": {
- "label": {
- "type": "string",
- "description": "Short name for the option."
- },
- "description": {
- "type": "string",
- "description": "What choosing this option means."
- }
- },
- "required": ["label", "description"]
- }
- }
- },
- "required": ["question", "header", "multiSelect", "options"]
- }
- }
- },
- "required": ["questions"]
- }
+ "description": ASK_TOOL_DESCRIPTION,
+ "parameters": ask_user::ask_tool_schema(),
}
})
}
async fn run(&self, args: Value, ctx: &ToolCtx) -> ToolOutcome {
- if let Err(e) = validate_questions(&args) {
+ if let Err(e) = ask_user::validate_questions(&args) {
return ToolOutcome::error(e);
}
@@ -126,7 +70,7 @@ impl Tool for AskQuestionTool {
);
};
- let description = first_question(&args).unwrap_or("Clarifying question");
+ let description = ask_user::first_question(&args).unwrap_or("Clarifying question");
let (tx, rx) = tokio::sync::oneshot::channel();
observer.on_permission_request(ASK_USER_QUESTION_TOOL, description, &args, tx);
@@ -140,7 +84,7 @@ impl Tool for AskQuestionTool {
match decision {
crate::observer::PermissionDecision::Allow { .. } => {
- match answers_from(decision.updated_input()) {
+ match ask_user::answers_from(decision.updated_input()) {
Some(text) => ToolOutcome::ok(text),
// The host allowed the call but supplied no answer — e.g. an
// observer whose `on_permission_request` is the default
@@ -159,99 +103,6 @@ impl Tool for AskQuestionTool {
}
}
-/// First question's text, for the one-line summary the host shows.
-fn first_question(args: &Value) -> Option<&str> {
- args.get("questions")?
- .as_array()?
- .first()?
- .get("question")?
- .as_str()
-}
-
-/// Reject anything the overlay would not be able to render as a form.
-///
-/// `AskUserQuestionState::from_input` silently drops questions with no options
-/// and returns `None` when every question is dropped. Without this check that
-/// turns into a dead end the model cannot diagnose: the user sees a y/n overlay
-/// for `AskUserQuestion`, answers it, and the tool reports "no answers". Failing
-/// before the prompt means the model gets a message it can act on instead.
-fn validate_questions(args: &Value) -> Result<(), String> {
- let Some(questions) = args.get("questions").and_then(Value::as_array) else {
- return Err(
- "missing required argument 'questions' (expected a non-empty array)".to_string(),
- );
- };
- if questions.is_empty() {
- return Err("'questions' must contain at least one question".to_string());
- }
- if questions.len() > MAX_QUESTIONS {
- return Err(format!(
- "'questions' holds {} entries; at most {MAX_QUESTIONS} are supported",
- questions.len()
- ));
- }
- for (i, q) in questions.iter().enumerate() {
- let n = i + 1;
- if q.get("question")
- .and_then(Value::as_str)
- .is_none_or(|s| s.trim().is_empty())
- {
- return Err(format!(
- "question {n} is missing a non-empty 'question' string"
- ));
- }
- let Some(options) = q.get("options").and_then(Value::as_array) else {
- return Err(format!(
- "question {n} is missing an 'options' array (at least 2 are required)"
- ));
- };
- if options.is_empty() {
- return Err(format!("question {n} has an empty 'options' array"));
- }
- if options.len() > MAX_OPTIONS {
- return Err(format!(
- "question {n} holds {} options; at most {MAX_OPTIONS} are supported",
- options.len()
- ));
- }
- for (j, opt) in options.iter().enumerate() {
- if opt
- .get("label")
- .and_then(Value::as_str)
- .is_none_or(|s| s.trim().is_empty())
- {
- return Err(format!(
- "question {n} option {} is missing a non-empty 'label' string",
- j + 1
- ));
- }
- }
- }
- Ok(())
-}
-
-/// Render the host's `answers` object as the tool result the model reads back.
-///
-/// Questions are matched by **text**, not by position: `answers` is a JSON
-/// object keyed by question text, and object key order is not guaranteed to
-/// survive the round trip (it is alphabetical unless `serde_json` was built with
-/// `preserve_order`). Printing each pair keeps the association unambiguous.
-fn answers_from(updated_input: Option<&Value>) -> Option {
- let answers = updated_input?.get("answers")?.as_object()?;
- if answers.is_empty() {
- return None;
- }
- let mut lines = Vec::with_capacity(answers.len());
- for (question, answer) in answers {
- let value = match answer {
- Value::String(s) => s.clone(),
- other => other.to_string(),
- };
- lines.push(format!("{question}\n → {value}"));
- }
- Some(format!("Answers from the user:\n{}", lines.join("\n")))
-}
-
#[cfg(test)]
mod tests {
use super::*;
@@ -444,72 +295,6 @@ mod tests {
assert_eq!(observer.seen_tool.lock().unwrap().len(), 1);
}
- #[test]
- fn validate_rejects_shapes_the_overlay_could_not_render() {
- assert!(validate_questions(&json!({})).is_err());
- assert!(validate_questions(&json!({ "questions": [] })).is_err());
- assert!(validate_questions(&json!({ "questions": "nope" })).is_err());
- // A question with no options is the dead-end case: the overlay would
- // drop it (and, if it were the only question, show a y/n prompt).
- assert!(
- validate_questions(&json!({
- "questions": [{ "question": "Q?", "options": [] }]
- }))
- .is_err()
- );
- assert!(
- validate_questions(&json!({
- "questions": [{ "question": "Q?" }]
- }))
- .is_err()
- );
- assert!(
- validate_questions(&json!({
- "questions": [{
- "question": "Q?",
- "options": [{ "description": "no label" }]
- }]
- }))
- .is_err()
- );
- assert!(
- validate_questions(&json!({
- "questions": [{ "question": " ", "options": [{ "label": "A" }] }]
- }))
- .is_err()
- );
- assert!(validate_questions(&two_questions()).is_ok());
- // `multiSelect` absent is fine — the overlay defaults it to false.
- assert!(
- validate_questions(&json!({
- "questions": [{
- "question": "Q?",
- "options": [{ "label": "A" }, { "label": "B" }]
- }]
- }))
- .is_ok()
- );
- }
-
- #[test]
- fn validate_enforces_the_declared_ceilings() {
- let opt = |i: usize| json!({ "label": format!("o{i}") });
- let q =
- |n: usize| json!({ "question": "Q?", "options": (0..n).map(opt).collect::>() });
- let many = json!({ "questions": (0..MAX_QUESTIONS + 1).map(|_| q(2)).collect::>() });
- assert!(validate_questions(&many).is_err());
- let wide = json!({ "questions": [q(MAX_OPTIONS + 1)] });
- assert!(validate_questions(&wide).is_err());
- }
-
- #[test]
- fn answers_from_tolerates_a_missing_or_empty_answers_object() {
- assert!(answers_from(None).is_none());
- assert!(answers_from(Some(&json!({}))).is_none());
- assert!(answers_from(Some(&json!({ "answers": {} }))).is_none());
- assert!(answers_from(Some(&json!({ "answers": { "Q?": "A" } }))).is_some());
- }
-
#[test]
fn the_schema_uses_the_camel_case_keys_the_overlay_parses() {
let schema = AskQuestionTool.schema();
@@ -517,5 +302,7 @@ mod tests {
assert!(text.contains("multiSelect"), "{text}");
assert!(!text.contains("multi_select"), "{text}");
assert_eq!(schema["function"]["name"], ASK_USER_QUESTION_TOOL);
+ // The parameters are the shared ones, not a private copy.
+ assert_eq!(schema["function"]["parameters"], ask_user::ask_tool_schema());
}
}
diff --git a/crates/gaviero-core/src/ask_user.rs b/crates/gaviero-core/src/ask_user.rs
new file mode 100644
index 00000000..092153d8
--- /dev/null
+++ b/crates/gaviero-core/src/ask_user.rs
@@ -0,0 +1,303 @@
+//! The one question contract shared by both ask-user surfaces.
+//!
+//! Claude Code ships an `AskUserQuestion` tool natively. gaviero has two
+//! channels that need to speak its wire shape, and they must not drift:
+//!
+//! * the in-process loop (`deepseek:` / `ollama:`) exposes it as a tool
+//! ([`crate::agent_session::tool_agent::tools::ask`]);
+//! * the MCP server exposes it to `dsh:` as `ask_user_question`
+//! ([`crate::mcp::ask`]).
+//!
+//! Both park the *same* TUI overlay, because the overlay is keyed on the
+//! input shape (`PendingPermission::new` → `AskUserQuestionState::from_input`)
+//! rather than on a tool name. So the shape — questions of
+//! `{ question, header, multiSelect, options[{ label, description }] }`, and
+//! answers returned as an `answers` object keyed by question text — lives
+//! here once, together with the ceiling checks that stop a model from
+//! producing a form the overlay cannot render.
+//!
+//! The schema is deliberately camelCase: `multiSelect`, not `multi_select`.
+//! Claude's shape is the one the TUI parses, and `mcp::ask` must not
+//! normalise it into something else on the way through MCP.
+
+use serde_json::{Value, json};
+
+/// Claude's documented ceiling. Enforced (not just advertised) because the
+/// overlay auto-grows to fit the questions and a model that ignores the schema
+/// would otherwise produce an unusable full-screen form.
+pub const MAX_QUESTIONS: usize = 4;
+/// Claude's documented ceiling per question.
+pub const MAX_OPTIONS: usize = 4;
+
+/// What the model reads when deciding whether to call the tool. Shared so the
+/// in-process schema and the MCP `tools/list` entry cannot say different
+/// things about the same capability.
+pub const ASK_TOOL_DESCRIPTION: &str = "Ask the user one or more multiple-choice questions when you need a \
+ decision you cannot make from the repository alone. Use this instead of \
+ guessing, and instead of writing the question as prose — the user gets a \
+ selectable list and the answers come back to you as text.";
+
+/// The `parameters` object of the `AskUserQuestion` schema.
+///
+/// Callers wrap it differently — the in-process loop as
+/// `{type:"function", function:{name, description, parameters}}`, MCP as a
+/// bare `inputSchema` — so only the parameters object lives here.
+pub fn ask_tool_schema() -> Value {
+ json!({
+ "type": "object",
+ "properties": {
+ "questions": {
+ "type": "array",
+ "minItems": 1,
+ "maxItems": MAX_QUESTIONS,
+ "description": "The questions to ask, at most 4.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "question": {
+ "type": "string",
+ "description": "The question to ask, in the user's language."
+ },
+ "header": {
+ "type": "string",
+ "description": "Short label (max ~12 chars) for the question."
+ },
+ "multiSelect": {
+ "type": "boolean",
+ "description": "True when more than one option may be selected."
+ },
+ "options": {
+ "type": "array",
+ "minItems": 2,
+ "maxItems": MAX_OPTIONS,
+ "description": "The selectable answers, at most 4.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "label": {
+ "type": "string",
+ "description": "Short name for the option."
+ },
+ "description": {
+ "type": "string",
+ "description": "What choosing this option means."
+ }
+ },
+ "required": ["label", "description"]
+ }
+ }
+ },
+ "required": ["question", "header", "multiSelect", "options"]
+ }
+ }
+ },
+ "required": ["questions"]
+ })
+}
+
+/// First question's text, for the one-line summary the host shows.
+pub fn first_question(args: &Value) -> Option<&str> {
+ args.get("questions")?
+ .as_array()?
+ .first()?
+ .get("question")?
+ .as_str()
+}
+
+/// Reject anything the overlay would not be able to render as a form.
+///
+/// `AskUserQuestionState::from_input` silently drops questions with no options
+/// and returns `None` when every question is dropped. Without this check that
+/// turns into a dead end the model cannot diagnose: the user sees a y/n overlay
+/// for a question, answers it, and the tool reports "no answers". Failing
+/// before the prompt means the model gets a message it can act on instead.
+pub fn validate_questions(args: &Value) -> Result<(), String> {
+ let Some(questions) = args.get("questions").and_then(Value::as_array) else {
+ return Err(
+ "missing required argument 'questions' (expected a non-empty array)".to_string(),
+ );
+ };
+ if questions.is_empty() {
+ return Err("'questions' must contain at least one question".to_string());
+ }
+ if questions.len() > MAX_QUESTIONS {
+ return Err(format!(
+ "'questions' holds {} entries; at most {MAX_QUESTIONS} are supported",
+ questions.len()
+ ));
+ }
+ for (i, q) in questions.iter().enumerate() {
+ let n = i + 1;
+ if q.get("question")
+ .and_then(Value::as_str)
+ .is_none_or(|s| s.trim().is_empty())
+ {
+ return Err(format!(
+ "question {n} is missing a non-empty 'question' string"
+ ));
+ }
+ let Some(options) = q.get("options").and_then(Value::as_array) else {
+ return Err(format!(
+ "question {n} is missing an 'options' array (at least 2 are required)"
+ ));
+ };
+ if options.is_empty() {
+ return Err(format!("question {n} has an empty 'options' array"));
+ }
+ if options.len() > MAX_OPTIONS {
+ return Err(format!(
+ "question {n} holds {} options; at most {MAX_OPTIONS} are supported",
+ options.len()
+ ));
+ }
+ for (j, opt) in options.iter().enumerate() {
+ if opt
+ .get("label")
+ .and_then(Value::as_str)
+ .is_none_or(|s| s.trim().is_empty())
+ {
+ return Err(format!(
+ "question {n} option {} is missing a non-empty 'label' string",
+ j + 1
+ ));
+ }
+ }
+ }
+ Ok(())
+}
+
+/// Render the host's `answers` object as the tool result the model reads back.
+///
+/// Questions are matched by **text**, not by position: `answers` is a JSON
+/// object keyed by question text, and object key order is not guaranteed to
+/// survive the round trip (it is alphabetical unless `serde_json` was built with
+/// `preserve_order`). Printing each pair keeps the association unambiguous.
+///
+/// `None` means "the host allowed the call but supplied no answer" — callers
+/// must report that as an error, never as a success.
+pub fn answers_from(updated_input: Option<&Value>) -> Option {
+ let answers = updated_input?.get("answers")?.as_object()?;
+ if answers.is_empty() {
+ return None;
+ }
+ let mut lines = Vec::with_capacity(answers.len());
+ for (question, answer) in answers {
+ let value = match answer {
+ Value::String(s) => s.clone(),
+ other => other.to_string(),
+ };
+ lines.push(format!("{question}\n → {value}"));
+ }
+ Some(format!("Answers from the user:\n{}", lines.join("\n")))
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn two_questions() -> Value {
+ json!({
+ "questions": [
+ {
+ "question": "Which database?",
+ "header": "DB",
+ "multiSelect": false,
+ "options": [
+ { "label": "Postgres", "description": "relational" },
+ { "label": "SQLite", "description": "embedded" }
+ ]
+ },
+ {
+ "question": "Which targets?",
+ "header": "Targets",
+ "multiSelect": true,
+ "options": [
+ { "label": "api", "description": "the server" },
+ { "label": "cli", "description": "the client" }
+ ]
+ }
+ ]
+ })
+ }
+
+ #[test]
+ fn validate_rejects_shapes_the_overlay_could_not_render() {
+ assert!(validate_questions(&json!({})).is_err());
+ assert!(validate_questions(&json!({ "questions": [] })).is_err());
+ assert!(validate_questions(&json!({ "questions": "nope" })).is_err());
+ // A question with no options is the dead-end case: the overlay would
+ // drop it (and, if it were the only question, show a y/n prompt).
+ assert!(
+ validate_questions(&json!({
+ "questions": [{ "question": "Q?", "options": [] }]
+ }))
+ .is_err()
+ );
+ assert!(
+ validate_questions(&json!({
+ "questions": [{ "question": "Q?" }]
+ }))
+ .is_err()
+ );
+ assert!(
+ validate_questions(&json!({
+ "questions": [{
+ "question": "Q?",
+ "options": [{ "description": "no label" }]
+ }]
+ }))
+ .is_err()
+ );
+ assert!(
+ validate_questions(&json!({
+ "questions": [{ "question": " ", "options": [{ "label": "A" }] }]
+ }))
+ .is_err()
+ );
+ assert!(validate_questions(&two_questions()).is_ok());
+ // `multiSelect` absent is fine — the overlay defaults it to false.
+ assert!(
+ validate_questions(&json!({
+ "questions": [{
+ "question": "Q?",
+ "options": [{ "label": "A" }, { "label": "B" }]
+ }]
+ }))
+ .is_ok()
+ );
+ }
+
+ #[test]
+ fn validate_enforces_the_declared_ceilings() {
+ let opt = |i: usize| json!({ "label": format!("o{i}") });
+ let q =
+ |n: usize| json!({ "question": "Q?", "options": (0..n).map(opt).collect::>() });
+ let many = json!({ "questions": (0..MAX_QUESTIONS + 1).map(|_| q(2)).collect::>() });
+ assert!(validate_questions(&many).is_err());
+ let wide = json!({ "questions": [q(MAX_OPTIONS + 1)] });
+ assert!(validate_questions(&wide).is_err());
+ }
+
+ #[test]
+ fn answers_from_tolerates_a_missing_or_empty_answers_object() {
+ assert!(answers_from(None).is_none());
+ assert!(answers_from(Some(&json!({}))).is_none());
+ assert!(answers_from(Some(&json!({ "answers": {} }))).is_none());
+ assert!(answers_from(Some(&json!({ "answers": { "Q?": "A" } }))).is_some());
+ }
+
+ #[test]
+ fn first_question_reads_the_prompt_text_only() {
+ assert_eq!(first_question(&two_questions()), Some("Which database?"));
+ assert_eq!(first_question(&json!({})), None);
+ assert_eq!(first_question(&json!({ "questions": [] })), None);
+ }
+
+ #[test]
+ fn the_shared_schema_uses_the_camel_case_keys_the_overlay_parses() {
+ let text = ask_tool_schema().to_string();
+ assert!(text.contains("multiSelect"), "{text}");
+ assert!(!text.contains("multi_select"), "{text}");
+ assert!(text.contains("\"description\""), "{text}");
+ }
+}
diff --git a/crates/gaviero-core/src/lib.rs b/crates/gaviero-core/src/lib.rs
index c4251d44..f03d8d8c 100644
--- a/crates/gaviero-core/src/lib.rs
+++ b/crates/gaviero-core/src/lib.rs
@@ -1,6 +1,7 @@
pub mod acp;
pub mod agent_guard;
pub mod agent_session;
+pub mod ask_user;
pub mod context_planner;
pub mod diff_engine;
pub mod egress;
diff --git a/crates/gaviero-core/src/mcp/ask.rs b/crates/gaviero-core/src/mcp/ask.rs
new file mode 100644
index 00000000..d3291287
--- /dev/null
+++ b/crates/gaviero-core/src/mcp/ask.rs
@@ -0,0 +1,243 @@
+//! The MCP side of the ask-user channel: one interactive tool, `ask_user_question`.
+//!
+//! `dsh:` speaks ACP, and dsh's ACP profile deliberately does not surface any
+//! user-question presentation (its own package contract lists elicitation as
+//! unsupported; the `tool-ask-user` tool is mounted only in the SDK app). So a
+//! structured question cannot cross the ACP wire. It *can* cross the MCP one,
+//! which dsh already mounts: dsh's `session/new` hands gaviero's loopback HTTP
+//! endpoint to the child as an `mcpServers[]` entry, and dsh calls tools over
+//! it like any other MCP client.
+//!
+//! The tool parks the *same* overlay the TUI already renders for Claude and for
+//! the in-process loop. That works because the overlay is keyed on the input
+//! shape ([`crate::ask_user`]), not on a tool name, so this module contributes
+//! no UI: it translates a transport-neutral request into the existing
+//! [`AcpObserver::on_permission_request`](crate::observer::AcpObserver::on_permission_request)
+//! oneshot and turns the answer back into a tool result.
+//!
+//! ## Why a header decides whether the tool exists
+//!
+//! A question needs somewhere to be shown. The server is one
+//! `GavieroMcpServer` shared by every connection (shim, loopback HTTP, Codex,
+//! Claude, …), so "does this connection have a chat conversation behind it" is
+//! not a property of the server. rmcp 1.5 inserts the `http::request::Parts` of
+//! every streamable-HTTP request into `RequestContext.extensions`
+//! (`transport/streamable_http_server/tower.rs`), so a per-request header —
+//! [`CONVERSATION_HEADER`], set per `dsh:` session by
+//! [`crate::agent_session::agent_client_protocol::dsh`] — identifies the
+//! conversation. Absent (stdio, named pipe, any other HTTP client), the tool is
+//! simply not listed, which is also what keeps its ~150–250 prompt tokens off
+//! every other provider's turn.
+
+use rmcp::model::Tool;
+
+use crate::observer::PermissionDecision;
+
+#[cfg(test)]
+use std::sync::Arc;
+
+/// The MCP tool name. Namespaced by clients as `mcp__gaviero__ask_user_question`.
+pub const TOOL_ASK_USER_QUESTION: &str = "ask_user_question";
+
+/// Per-session request header carrying the chat conversation that owns the
+/// question. Lower-case because HTTP header names are case-insensitive and the
+/// `http` crate normalises to this form.
+pub const CONVERSATION_HEADER: &str = "x-gaviero-conversation";
+
+/// Where a parked question goes.
+///
+/// The server holds this as `Arc` and deliberately knows
+/// nothing else about the host: in the TUI it forwards to the event loop, in
+/// tests it is a fake. `respond` is the same oneshot
+/// [`crate::observer::AcpObserver::on_permission_request`] takes, so the answer
+/// path is byte-identical to Claude's and the in-process loop's — including
+/// `updated_input["answers"]`.
+///
+/// A dropped `respond` sender means "the question was cancelled", exactly as
+/// the observer contract documents.
+pub trait UserQuestionSink: Send + Sync {
+ fn ask(
+ &self,
+ conv_id: &str,
+ input: &serde_json::Value,
+ respond: tokio::sync::oneshot::Sender,
+ );
+}
+
+/// The conversation id a request is tagged with, if any.
+///
+/// Returns `None` for a missing header, a non-ASCII value, or one that is empty
+/// or only whitespace — all of which mean "this connection has no conversation
+/// to ask".
+pub fn conversation_from(parts: &http::request::Parts) -> Option<&str> {
+ parts
+ .headers
+ .get(CONVERSATION_HEADER)?
+ .to_str()
+ .ok()
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+}
+
+/// The `tools/list` entry for `ask_user_question`.
+///
+/// Built straight from [`crate::ask_user`] rather than through
+/// `listed_tools()`'s `strip_schema_descriptions`: the per-option `description`
+/// strings are *data the model must fill in*, not prose about the schema, and
+/// dropping them would leave a question whose choices cannot be described.
+pub fn tool_definition() -> Tool {
+ let serde_json::Value::Object(schema) = crate::ask_user::ask_tool_schema() else {
+ unreachable!("ask_tool_schema always returns an object");
+ };
+ Tool::new(
+ TOOL_ASK_USER_QUESTION,
+ crate::ask_user::ASK_TOOL_DESCRIPTION,
+ schema,
+ )
+}
+
+/// How a [`FakeQuestionSink`] answers. Test-only.
+#[cfg(test)]
+#[derive(Clone, Copy)]
+pub(crate) enum FakeQuestionReply {
+ /// Answer every question with its first option — what `answers_map` does
+ /// in the TUI.
+ FirstOption,
+ /// Refuse to answer.
+ Deny(&'static str),
+ /// Allow the call but supply no `answers` — a host with no question UI.
+ NoAnswers,
+}
+
+/// A sink that records what it was asked and answers per [`FakeQuestionReply`].
+#[cfg(test)]
+pub(crate) struct FakeQuestionSink {
+ reply: FakeQuestionReply,
+ seen: std::sync::Mutex>,
+}
+
+#[cfg(test)]
+impl FakeQuestionSink {
+ pub(crate) fn new(reply: FakeQuestionReply) -> Arc {
+ Arc::new(Self {
+ reply,
+ seen: std::sync::Mutex::new(Vec::new()),
+ })
+ }
+
+ /// `(conversation id, input)` for every question this sink was handed.
+ pub(crate) fn seen(&self) -> Vec<(String, serde_json::Value)> {
+ self.seen.lock().unwrap().clone()
+ }
+}
+
+#[cfg(test)]
+impl UserQuestionSink for FakeQuestionSink {
+ fn ask(
+ &self,
+ conv_id: &str,
+ input: &serde_json::Value,
+ respond: tokio::sync::oneshot::Sender,
+ ) {
+ self.seen
+ .lock()
+ .unwrap()
+ .push((conv_id.to_string(), input.clone()));
+ let decision = match self.reply {
+ FakeQuestionReply::FirstOption => {
+ let mut updated = input.clone();
+ let mut answers = serde_json::Map::new();
+ for question in input
+ .get("questions")
+ .and_then(serde_json::Value::as_array)
+ .into_iter()
+ .flatten()
+ {
+ let text = question
+ .get("question")
+ .and_then(serde_json::Value::as_str)
+ .unwrap_or("");
+ let label = question
+ .get("options")
+ .and_then(serde_json::Value::as_array)
+ .and_then(|options| options.first())
+ .and_then(|option| option.get("label"))
+ .and_then(serde_json::Value::as_str)
+ .unwrap_or("");
+ answers.insert(
+ text.to_string(),
+ serde_json::Value::String(label.to_string()),
+ );
+ }
+ if let Some(object) = updated.as_object_mut() {
+ object.insert("answers".into(), serde_json::Value::Object(answers));
+ }
+ PermissionDecision::Allow {
+ updated_input: Some(updated),
+ }
+ }
+ FakeQuestionReply::Deny(message) => PermissionDecision::deny_with_message(message),
+ FakeQuestionReply::NoAnswers => PermissionDecision::Allow {
+ updated_input: Some(input.clone()),
+ },
+ };
+ let _ = respond.send(decision);
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn parts(header: Option<&str>) -> http::request::Parts {
+ let mut builder = http::Request::builder()
+ .method("POST")
+ .uri("http://127.0.0.1:9/mcp");
+ if let Some(value) = header {
+ builder = builder.header(CONVERSATION_HEADER, value);
+ }
+ builder.body(()).unwrap().into_parts().0
+ }
+
+ #[test]
+ fn conversation_header_is_read_when_present() {
+ assert_eq!(
+ conversation_from(&parts(Some("conv-1"))),
+ Some("conv-1"),
+ "a dsh session tags every request with its conversation"
+ );
+ }
+
+ #[test]
+ fn conversation_header_absent_means_no_conversation() {
+ assert_eq!(conversation_from(&parts(None)), None);
+ }
+
+ #[test]
+ fn empty_or_whitespace_conversation_is_no_conversation() {
+ assert_eq!(conversation_from(&parts(Some(""))), None);
+ assert_eq!(conversation_from(&parts(Some(" "))), None);
+ assert_eq!(
+ conversation_from(&parts(Some(" conv-2 "))),
+ Some("conv-2"),
+ "surrounding whitespace is not part of the id"
+ );
+ }
+
+ #[test]
+ fn tool_definition_carries_the_shared_name_description_and_schema() {
+ let tool = tool_definition();
+ assert_eq!(tool.name, TOOL_ASK_USER_QUESTION);
+ assert_eq!(
+ tool.description.as_deref(),
+ Some(crate::ask_user::ASK_TOOL_DESCRIPTION)
+ );
+ let schema = serde_json::Value::Object((*tool.input_schema).clone());
+ assert_eq!(schema, crate::ask_user::ask_tool_schema());
+ // The per-option `description` is data the model fills in. It must
+ // survive `tools/list`, which strips schema descriptions elsewhere.
+ let text = schema.to_string();
+ assert!(text.contains("What choosing this option means."), "{text}");
+ assert!(text.contains("multiSelect"), "{text}");
+ }
+}
diff --git a/crates/gaviero-core/src/mcp/http.rs b/crates/gaviero-core/src/mcp/http.rs
index cad919bb..1cc0d3df 100644
--- a/crates/gaviero-core/src/mcp/http.rs
+++ b/crates/gaviero-core/src/mcp/http.rs
@@ -527,4 +527,217 @@ mod tests {
handle.shutdown().await;
drop(occupant);
}
+
+ // ── ask_user_question over the real loopback HTTP listener ───────
+
+ use crate::mcp::ask::{FakeQuestionReply, FakeQuestionSink};
+
+ fn fixture_server_with_sink(sink: Arc) -> GavieroMcpServer {
+ let embedder = Arc::new(MockEmbedder) as Arc;
+ let stores = MemoryStores::for_tests_in_memory(embedder).unwrap();
+ GavieroMcpServer::with_defaults(stores, PathBuf::from("/tmp")).with_user_question_sink(sink)
+ }
+
+ /// The JSON payload of an SSE response: the last non-empty `data:` line.
+ fn last_sse_json(body: &str) -> serde_json::Value {
+ let line = body
+ .lines()
+ .filter_map(|line| line.strip_prefix("data:"))
+ .map(str::trim)
+ .rfind(|line| !line.is_empty())
+ .unwrap_or_else(|| panic!("no data: line in SSE body: {body}"));
+ serde_json::from_str(line).unwrap_or_else(|e| panic!("bad SSE json ({e}): {line}"))
+ }
+
+ /// One JSON-RPC POST to `/mcp`, with the same headers a client must send.
+ ///
+ /// Returns `(status, new session id, body)`.
+ async fn post_rpc(
+ client: &reqwest::Client,
+ port: u16,
+ token: &str,
+ session: Option<&str>,
+ conversation: Option<&str>,
+ body: String,
+ ) -> (reqwest::StatusCode, Option, String) {
+ let mut request = client
+ .post(format!("http://127.0.0.1:{port}/mcp"))
+ .header("Host", format!("127.0.0.1:{port}"))
+ .header("Authorization", format!("Bearer {token}"))
+ .header("Accept", "application/json, text/event-stream")
+ .header("Content-Type", "application/json")
+ .body(body);
+ if let Some(session) = session {
+ request = request.header("Mcp-Session-Id", session);
+ }
+ if let Some(conversation) = conversation {
+ request = request.header(crate::mcp::ask::CONVERSATION_HEADER, conversation);
+ }
+ let response = request.send().await.unwrap();
+ let status = response.status();
+ let session = response
+ .headers()
+ .get("mcp-session-id")
+ .and_then(|v| v.to_str().ok())
+ .map(str::to_string);
+ let text = tokio::time::timeout(
+ std::time::Duration::from_secs(20),
+ response.text(),
+ )
+ .await
+ .expect("SSE body must close after the response")
+ .unwrap();
+ (status, session, text)
+ }
+
+ fn ask_question() -> serde_json::Value {
+ serde_json::json!({
+ "questions": [{
+ "question": "Which database?",
+ "header": "DB",
+ "multiSelect": false,
+ "options": [
+ { "label": "Postgres", "description": "relational" },
+ { "label": "SQLite", "description": "embedded" }
+ ]
+ }]
+ })
+ }
+
+ /// The load-bearing check for the whole feature: the header on the real
+ /// HTTP request is what makes the tool exist, and the parked question's
+ /// answer comes back as the tool result.
+ #[tokio::test]
+ async fn http_conversation_header_gates_ask_user_question() {
+ let dir = tempfile::tempdir().unwrap();
+ let token = "test-token-abcdefghijklmnopqrstuvwxyz".to_string();
+ write_token_file(&token_path(dir.path()), &token).unwrap();
+ let std_l = StdTcpListener::bind(("127.0.0.1", 0)).unwrap();
+ let preferred = std_l.local_addr().unwrap().port();
+ drop(std_l);
+
+ let sink = FakeQuestionSink::new(FakeQuestionReply::FirstOption);
+ let handle = spawn_http_listener(
+ fixture_server_with_sink(sink.clone()),
+ dir.path(),
+ preferred,
+ token.clone(),
+ )
+ .unwrap();
+ let port = handle.endpoint.port;
+ let client = reqwest::Client::new();
+
+ let (status, session, _body) = post_rpc(
+ &client,
+ port,
+ &token,
+ None,
+ None,
+ r#"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"t","version":"0"}}}"#.to_string(),
+ )
+ .await;
+ assert!(status.is_success(), "initialize {status}");
+ let session = session.expect("initialize returns a session id");
+
+ // 1. With the conversation header: the tool is advertised.
+ let (status, _, body) = post_rpc(
+ &client,
+ port,
+ &token,
+ Some(&session),
+ Some("conv-1"),
+ r#"{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}"#.to_string(),
+ )
+ .await;
+ assert!(status.is_success(), "tools/list {status}");
+ let list = last_sse_json(&body);
+ let names: Vec = list["result"]["tools"]
+ .as_array()
+ .expect("tools array")
+ .iter()
+ .map(|tool| tool["name"].as_str().unwrap_or_default().to_string())
+ .collect();
+ assert!(
+ names.contains(&crate::mcp::ask::TOOL_ASK_USER_QUESTION.to_string()),
+ "ask_user_question must be listed for a dsh connection: {names:?}"
+ );
+
+ // 2. With the header: the call parks on the sink and returns labels.
+ let call = serde_json::json!({
+ "jsonrpc": "2.0",
+ "id": 3,
+ "method": "tools/call",
+ "params": {
+ "name": crate::mcp::ask::TOOL_ASK_USER_QUESTION,
+ "arguments": ask_question(),
+ }
+ })
+ .to_string();
+ let (status, _, body) = post_rpc(
+ &client,
+ port,
+ &token,
+ Some(&session),
+ Some("conv-1"),
+ call.clone(),
+ )
+ .await;
+ assert!(status.is_success(), "tools/call {status}: {body}");
+ let result = last_sse_json(&body);
+ assert_eq!(
+ result["result"]["isError"],
+ serde_json::Value::Bool(false),
+ "{}",
+ result
+ );
+ let text = result["result"]["content"][0]["text"]
+ .as_str()
+ .unwrap_or_else(|| panic!("no text content: {result}"));
+ assert!(text.contains("Which database?"), "{text}");
+ assert!(text.contains("Postgres"), "{text}");
+ assert_eq!(
+ sink.seen().first().map(|(conv, _)| conv.as_str()),
+ Some("conv-1"),
+ "the sink must receive the conversation the header named"
+ );
+
+ // 3. The same session without the header: the tool is gone.
+ let (status, _, body) = post_rpc(
+ &client,
+ port,
+ &token,
+ Some(&session),
+ None,
+ r#"{"jsonrpc":"2.0","id":4,"method":"tools/list","params":{}}"#.to_string(),
+ )
+ .await;
+ assert!(status.is_success(), "tools/list {status}");
+ let list = last_sse_json(&body);
+ let names: Vec = list["result"]["tools"]
+ .as_array()
+ .expect("tools array")
+ .iter()
+ .map(|tool| tool["name"].as_str().unwrap_or_default().to_string())
+ .collect();
+ assert!(
+ !names.contains(&crate::mcp::ask::TOOL_ASK_USER_QUESTION.to_string()),
+ "without the header the tool must not exist: {names:?}"
+ );
+
+ // 4. And an explicit call for it is rejected, not parked.
+ let (status, _, body) = post_rpc(&client, port, &token, Some(&session), None, call).await;
+ assert!(status.is_success(), "tools/call {status}");
+ let result = last_sse_json(&body);
+ assert!(
+ result.get("error").is_some(),
+ "a call without the header must be a JSON-RPC error: {result}"
+ );
+ assert_eq!(
+ sink.seen().len(),
+ 1,
+ "the rejected call must never reach the sink"
+ );
+
+ handle.shutdown().await;
+ }
}
diff --git a/crates/gaviero-core/src/mcp/mod.rs b/crates/gaviero-core/src/mcp/mod.rs
index ac66ea90..7502e75f 100644
--- a/crates/gaviero-core/src/mcp/mod.rs
+++ b/crates/gaviero-core/src/mcp/mod.rs
@@ -1,6 +1,6 @@
//! Gaviero as an MCP server (Tier A / A5).
//!
-//! Ten tools for subprocess coding agents — nine read-only:
+//! Eleven tools for subprocess coding agents — nine read-only:
//! * `memory_search` — merged multi-scope hybrid search over memories
//! (repo + workspace + global; `module` / `run` need per-file / per-run
//! identity that does not cross the shim)
@@ -18,6 +18,15 @@
//! nothing; refuses user-authored and History rows; idempotent; every
//! applied flag writes a reversible audit row.
//!
+//! …and one that is interactive ([`ask`]):
+//! * `ask_user_question` — ask the user a multiple-choice question and return
+//! the answers as the tool result. Listed **only** on a loopback-HTTP
+//! connection that carries [`ask::CONVERSATION_HEADER`] and only when the
+//! host installed a [`ask::UserQuestionSink`]; it parks the same overlay
+//! Claude's `AskUserQuestion` uses. It touches no store, and `mcp.permissions`
+//! hides and rejects it like any other tool. This is the only way a `dsh:`
+//! session can ask a structured question: ACP carries no elicitation.
+//!
//! The server runs as an in-process tokio task launched at
//! `Workspace::open` time. A small `gaviero-mcp-shim` binary connects
//! subprocess agents' stdio to the server's workspace endpoint
@@ -58,6 +67,7 @@
//! nothing here bypasses the writer task or the Write Gate.
pub mod agent_defs;
+pub mod ask;
pub mod client;
pub mod client_http;
pub mod config_synth;
@@ -83,6 +93,9 @@ pub use agent_defs::{
claude_agents_json, claude_agents_json_if_required, codex_agent_toml,
report_user_agent_definitions,
};
+pub use ask::{
+ CONVERSATION_HEADER, TOOL_ASK_USER_QUESTION, UserQuestionSink, conversation_from, tool_definition,
+};
pub use config_synth::{
BashPermissions, Context7Config, ExtraMcpServer, ExtraMcpTransport, HttpSynthEndpoint,
ManagedRules, McpConfigSynth, McpPermissions, McpTransportChoice, McpTransportKind,
diff --git a/crates/gaviero-core/src/mcp/server.rs b/crates/gaviero-core/src/mcp/server.rs
index 5d3bceec..2239b752 100644
--- a/crates/gaviero-core/src/mcp/server.rs
+++ b/crates/gaviero-core/src/mcp/server.rs
@@ -4,7 +4,7 @@
//! at `.gaviero/mcp.sock` on Unix, a `\\.\pipe\gaviero-…` named pipe
//! on Windows. Each shim connection is a single MCP session
//! speaking JSON-RPC 2.0 over `AsyncRead + AsyncWrite` — rmcp handles
-//! framing, initialize, and tools/list. Gaviero owns only the ten
+//! framing, initialize, and tools/list. Gaviero owns only the eleven
//! tool handlers below.
//!
//! **The invariant this module enforces is #11: every write goes
@@ -15,7 +15,7 @@
//! `store_scoped`. Rejected `memory_store` / `memory_update` /
//! `memory_delete` tools remain unimplementable by construction.
//!
-//! Nine of the ten tools are strictly read-only. `memory_ping` writes
+//! Nine of the ten routed tools are strictly read-only. `memory_ping` writes
//! only to an in-memory [`super::probe::ProbeLedger`]. `memory_flag` is
//! write-adjacent: it emits a signal through
//! [`super::signal::MemorySignalSink`] — a narrow trait object, not the
@@ -23,6 +23,10 @@
//! plus an audit row. It creates and deletes nothing. See
//! `mcp/mod.rs`'s header for why read-only is a default posture rather
//! than a hard constraint.
+//!
+//! The eleventh tool, `ask_user_question` ([`super::ask`]), is outside the
+//! router: it exists only on a loopback-HTTP connection that names a chat
+//! conversation, and it writes nothing at all.
use std::path::{Path, PathBuf};
use std::sync::Arc;
@@ -34,7 +38,7 @@ use rmcp::ServiceExt;
use rmcp::handler::server::tool::ToolCallContext;
use rmcp::handler::server::tool::ToolRouter;
use rmcp::handler::server::wrapper::{Json, Parameters};
-use rmcp::model::{CallToolRequestParams, ListToolsResult};
+use rmcp::model::{CallToolRequestParams, Content, ListToolsResult};
use rmcp::service::RequestContext;
use rmcp::{ErrorData, RoleServer, ServerHandler, tool, tool_handler, tool_router};
@@ -59,8 +63,9 @@ use super::tools::{
};
/// Gaviero's MCP server. One instance lives per workspace; it
-/// dispatches tool calls to the ten handlers below (nine read-only
-/// plus write-adjacent `memory_flag`).
+/// dispatches tool calls to the ten routed handlers below (nine
+/// read-only plus write-adjacent `memory_flag`), and — on a connection
+/// that names a chat conversation — to `ask_user_question` ([`super::ask`]).
///
/// `tool_router` is the rmcp-macro-generated dispatch table — see
/// `rmcp::handler::server::router::tool` for the shape.
@@ -142,6 +147,15 @@ pub struct GavieroMcpServer {
/// without [`Self::with_signal_sink`]) makes `memory_flag` return a
/// clear error rather than silently no-op.
signal_sink: Option>,
+ /// The interactive seam: where `ask_user_question` parks a question.
+ /// `None` (every server built without [`Self::with_user_question_sink`],
+ /// including the CLI's and the shim's) means the tool is never listed and
+ /// every call reports that no interactive host is attached — never a
+ /// silent empty answer.
+ ///
+ /// Held as a trait object for the same reason as `signal_sink`: the server
+ /// learns nothing about the TUI, only that a question has somewhere to go.
+ user_questions: Option>,
/// Optional in-memory ping ledger for `memory_ping`. Unattached
/// servers still answer the tool; they just do not record.
probe_ledger: Option,
@@ -385,6 +399,7 @@ impl GavieroMcpServer {
permissions: super::McpPermissions::default(),
first_tool_call_done: Arc::new(AtomicBool::new(false)),
signal_sink: None,
+ user_questions: None,
probe_ledger: None,
started_at: chrono::Utc::now(),
exposed_tools: None,
@@ -512,6 +527,43 @@ impl GavieroMcpServer {
}
}
+ /// The chat conversation that owns this request, if the connection names
+ /// one.
+ ///
+ /// Only a streamable-HTTP request carries [`super::ask::CONVERSATION_HEADER`]:
+ /// rmcp inserts the request's `http::request::Parts` into the handler
+ /// context (`transport/streamable_http_server/tower.rs`), and it is cloned
+ /// into `RequestContext.extensions` (`service/server.rs`). stdio, the named
+ /// pipe and the shim therefore never have one — and never see the tool.
+ ///
+ /// Takes the `Parts` rather than the context so the gate is testable:
+ /// `RequestContext` cannot be built outside rmcp (its `Peer` constructor is
+ /// crate-private), while a `Parts` is one `http::Request::builder()` away.
+ /// The `list_tools` / `call_tool` callers pass
+ /// `context.extensions.get::()` and nothing else.
+ fn ask_conversation(parts: Option<&http::request::Parts>) -> Option {
+ super::ask::conversation_from(parts?).map(str::to_string)
+ }
+
+ /// Whether `ask_user_question` belongs on this connection's `tools/list`.
+ ///
+ /// Three conditions, all required: an interactive host installed a sink, the
+ /// `mcp.permissions` policy allows the tool, and the request names a
+ /// conversation to park the question in.
+ ///
+ /// Deliberately **exempt from `exposedTools`**, the same exemption
+ /// `memory_ping` has ([`Self::tool_is_listed`]): that list budgets
+ /// *retrieval* tools, and this one is the interactive channel itself. Hiding
+ /// it would leave a `dsh:` session unable to ask anything. A deny in
+ /// `mcp.permissions` still hides and rejects it.
+ fn ask_tool_listed(&self, parts: Option<&http::request::Parts>) -> bool {
+ self.user_questions.is_some()
+ && self
+ .permissions
+ .tool_allowed("gaviero", super::ask::TOOL_ASK_USER_QUESTION)
+ && Self::ask_conversation(parts).is_some()
+ }
+
/// Enable symbol MCP tools (`symbol_search`, `symbol_doc`). Requires a
/// populated `symbol_docs` sidecar from `gaviero-cli --graph --enrich`.
pub fn with_symbol_enrichment(mut self, enabled: bool) -> Self {
@@ -530,6 +582,22 @@ impl GavieroMcpServer {
self
}
+ /// Install the interactive host that `ask_user_question` parks questions
+ /// in. Without it the tool is **not listed at all** (unlike `memory_flag`,
+ /// which stays listed and errors): there is nothing a question could reach,
+ /// and the schema is not free on every turn.
+ ///
+ /// Listing additionally requires [`super::ask::CONVERSATION_HEADER`] on the
+ /// request, which only a `dsh:` session sends, so no other provider pays
+ /// for the tool.
+ pub fn with_user_question_sink(
+ mut self,
+ sink: Arc,
+ ) -> Self {
+ self.user_questions = Some(sink);
+ self
+ }
+
/// Attach a [`ProbeLedger`] so `memory_ping` records nonce + depth.
/// Without it the tool still returns a receipt (needed for nested
/// sessions that inherit a server that was not started as a probe).
@@ -1753,6 +1821,61 @@ impl GavieroMcpServer {
)),
}
}
+
+ /// Park one question on the conversation's overlay and turn the answer into
+ /// a tool result.
+ ///
+ /// Everything that can go wrong is a `CallToolResult` **error**, not a
+ /// dropped call: the model must be able to read what happened and retry.
+ /// In particular an `Allow` with no `answers` is an error — reporting
+ /// success there would make the model believe a question was answered when
+ /// nothing was asked (the same rule `tools/ask.rs` follows).
+ ///
+ /// Validation runs *before* the sink: an unusable form must never become a
+ /// parked question the user has to dismiss.
+ async fn ask_user_question_impl(
+ &self,
+ conv_id: &str,
+ args: serde_json::Value,
+ ) -> Result {
+ let error = |message: String| -> Result {
+ Ok(rmcp::model::CallToolResult::error(vec![Content::text(
+ message,
+ )]))
+ };
+ if let Err(e) = crate::ask_user::validate_questions(&args) {
+ return error(e);
+ }
+ let Some(sink) = self.user_questions.as_ref() else {
+ return error(
+ "ask_user_question is not configured (no interactive host attached)".to_string(),
+ );
+ };
+ let (tx, rx) = tokio::sync::oneshot::channel();
+ sink.ask(conv_id, &args, tx);
+ let decision = match rx.await {
+ Ok(decision) => decision,
+ // A dropped sender is a cancel, by the observer contract.
+ Err(_) => {
+ return error("the question was cancelled before it was answered".to_string());
+ }
+ };
+ match decision {
+ crate::observer::PermissionDecision::Allow { .. } => {
+ match crate::ask_user::answers_from(decision.updated_input()) {
+ Some(text) => Ok(rmcp::model::CallToolResult::success(vec![Content::text(text)])),
+ None => error(
+ "the question was allowed but the host returned no answers; \
+ ask the user in prose instead"
+ .to_string(),
+ ),
+ }
+ }
+ crate::observer::PermissionDecision::Deny { message } => error(
+ message.unwrap_or_else(|| "the user declined to answer".to_string()),
+ ),
+ }
+ }
}
/// One advertised tool, flattened for callers that drive the server in-process
@@ -1770,10 +1893,17 @@ impl ServerHandler for GavieroMcpServer {
async fn list_tools(
&self,
_request: Option,
- _context: RequestContext,
+ context: RequestContext,
) -> Result {
+ let mut tools = self.listed_tools();
+ // Context-dependent extra: `listed_tools()` stays context-free so the
+ // in-process callers, the size pins and every non-HTTP connection keep
+ // exactly the router surface they had.
+ if self.ask_tool_listed(context.extensions.get::()) {
+ tools.push(super::ask::tool_definition());
+ }
Ok(ListToolsResult {
- tools: self.listed_tools(),
+ tools,
..Default::default()
})
}
@@ -1796,12 +1926,31 @@ impl ServerHandler for GavieroMcpServer {
.clone()
.map(serde_json::Value::Object)
.unwrap_or(serde_json::Value::Null);
- let result = match self.ensure_tool_allowed(&request.name) {
- Ok(()) => {
- let tcc = ToolCallContext::new(self, request, context);
- self.tool_router.call(tcc).await
+ let result = if request.name.as_ref() == super::ask::TOOL_ASK_USER_QUESTION {
+ let parts = context.extensions.get::();
+ match Self::ask_conversation(parts) {
+ Some(conv_id) if self.ask_tool_listed(parts) => {
+ // `input` is the same arguments the telemetry tail logs.
+ self.ask_user_question_impl(&conv_id, input.clone()).await
+ }
+ // Not listed on this connection, so this call is out of
+ // contract: report it the same way a permission-denied tool is
+ // reported rather than parking a question nobody can answer.
+ _ => Err(ErrorData::invalid_request(
+ "gaviero MCP tool \"ask_user_question\" is not available on this \
+ connection (it needs an interactive host, mcp.permissions allowing it \
+ and an x-gaviero-conversation request header)",
+ None,
+ )),
+ }
+ } else {
+ match self.ensure_tool_allowed(&request.name) {
+ Ok(()) => {
+ let tcc = ToolCallContext::new(self, request, context);
+ self.tool_router.call(tcc).await
+ }
+ Err(e) => Err(e),
}
- Err(e) => Err(e),
};
let (output, error) = match &result {
Ok(r) if r.is_error == Some(true) => (
@@ -1819,6 +1968,18 @@ impl ServerHandler for GavieroMcpServer {
}
fn get_tool(&self, name: &str) -> Option {
+ if name == super::ask::TOOL_ASK_USER_QUESTION {
+ // This method carries no `RequestContext`, so the conversation
+ // header cannot be checked here. It is only used by rmcp for
+ // task-support validation, and `call_tool` re-checks header,
+ // permissions and sink before anything is parked — the reply below
+ // can never be a way to call the tool.
+ return (self.user_questions.is_some()
+ && self
+ .permissions
+ .tool_allowed("gaviero", super::ask::TOOL_ASK_USER_QUESTION))
+ .then(super::ask::tool_definition);
+ }
if !self.tool_is_listed(name) {
return None;
}
@@ -4652,4 +4813,176 @@ mod tests {
lean_min.len()
);
}
+
+ // ── ask_user_question: dsh's interactive channel ─────────────────
+
+ use super::super::ask::{FakeQuestionReply, FakeQuestionSink};
+
+ fn ask_parts(header: Option<&str>) -> http::request::Parts {
+ let mut builder = http::Request::builder()
+ .method("POST")
+ .uri("http://127.0.0.1:9/mcp");
+ if let Some(value) = header {
+ builder = builder.header(super::super::ask::CONVERSATION_HEADER, value);
+ }
+ builder.body(()).unwrap().into_parts().0
+ }
+
+ fn question_input() -> serde_json::Value {
+ serde_json::json!({
+ "questions": [{
+ "question": "Which database?",
+ "header": "DB",
+ "multiSelect": false,
+ "options": [
+ { "label": "Postgres", "description": "relational" },
+ { "label": "SQLite", "description": "embedded" }
+ ]
+ }]
+ })
+ }
+
+ fn server_with_sink(reply: FakeQuestionReply) -> (GavieroMcpServer, Arc) {
+ let sink = FakeQuestionSink::new(reply);
+ (
+ fixture().with_user_question_sink(sink.clone()),
+ sink,
+ )
+ }
+
+ fn render(result: &rmcp::model::CallToolResult) -> String {
+ super::super::client::render_call_result(result)
+ }
+
+ #[tokio::test]
+ async fn ask_user_question_returns_the_chosen_labels() {
+ let (s, sink) = server_with_sink(FakeQuestionReply::FirstOption);
+ let out = s
+ .ask_user_question_impl("conv-1", question_input())
+ .await
+ .expect("a parked question is a normal result, not a protocol error");
+ assert_ne!(out.is_error, Some(true), "{}", render(&out));
+ let text = render(&out);
+ assert!(text.contains("Which database?"), "{text}");
+ assert!(text.contains("Postgres"), "{text}");
+ // The sink got the conversation and the model's input verbatim — the
+ // overlay parses that input, so any rewrite would break the card.
+ let seen = sink.seen();
+ assert_eq!(seen.len(), 1);
+ assert_eq!(seen[0].0, "conv-1");
+ assert_eq!(seen[0].1, question_input());
+ }
+
+ #[tokio::test]
+ async fn a_denied_question_is_a_tool_error_carrying_the_host_message() {
+ let (s, _sink) = server_with_sink(FakeQuestionReply::Deny("user said no"));
+ let out = s
+ .ask_user_question_impl("conv-1", question_input())
+ .await
+ .unwrap();
+ assert_eq!(out.is_error, Some(true));
+ assert!(render(&out).contains("user said no"), "{}", render(&out));
+ }
+
+ #[tokio::test]
+ async fn an_allowed_question_without_answers_is_a_tool_error() {
+ // Never a fake success: the model would believe it has an answer.
+ let (s, _sink) = server_with_sink(FakeQuestionReply::NoAnswers);
+ let out = s
+ .ask_user_question_impl("conv-1", question_input())
+ .await
+ .unwrap();
+ assert_eq!(out.is_error, Some(true));
+ assert!(render(&out).contains("no answers"), "{}", render(&out));
+ }
+
+ #[tokio::test]
+ async fn ask_user_question_without_a_sink_is_a_tool_error() {
+ let out = fixture()
+ .ask_user_question_impl("conv-1", question_input())
+ .await
+ .unwrap();
+ assert_eq!(out.is_error, Some(true));
+ assert!(render(&out).contains("not configured"), "{}", render(&out));
+ }
+
+ #[tokio::test]
+ async fn invalid_questions_never_reach_the_sink() {
+ let (s, sink) = server_with_sink(FakeQuestionReply::FirstOption);
+ // Five options: over Claude's documented ceiling of four.
+ let five = serde_json::json!({
+ "questions": [{
+ "question": "Pick one",
+ "options": [
+ { "label": "a" }, { "label": "b" }, { "label": "c" },
+ { "label": "d" }, { "label": "e" }
+ ]
+ }]
+ });
+ let out = s.ask_user_question_impl("conv-1", five).await.unwrap();
+ assert_eq!(out.is_error, Some(true));
+ assert!(render(&out).contains("at most 4"), "{}", render(&out));
+ assert!(
+ sink.seen().is_empty(),
+ "an unusable form must not become a parked question"
+ );
+ }
+
+ #[test]
+ fn ask_tool_is_listed_only_with_a_sink_permission_and_conversation() {
+ let with_sink = fixture().with_user_question_sink(FakeQuestionSink::new(
+ FakeQuestionReply::FirstOption,
+ ));
+ // No HTTP request (stdio / named pipe / shim): no conversation, no tool.
+ assert!(!with_sink.ask_tool_listed(None));
+ // Header absent from an HTTP request.
+ assert!(!with_sink.ask_tool_listed(Some(&ask_parts(None))));
+ // The dsh case.
+ assert!(with_sink.ask_tool_listed(Some(&ask_parts(Some("conv-1")))));
+ // No interactive host installed.
+ assert!(!fixture().ask_tool_listed(Some(&ask_parts(Some("conv-1")))));
+ // mcp.permissions denies it.
+ let denied = with_sink.clone().with_permissions(super::super::McpPermissions {
+ allow: vec![],
+ deny: vec!["gaviero:ask_user_question".into()],
+ });
+ assert!(!denied.ask_tool_listed(Some(&ask_parts(Some("conv-1")))));
+ }
+
+ #[test]
+ fn ask_tool_is_exempt_from_the_exposed_tools_budget() {
+ // `exposedTools` budgets retrieval tools; hiding the interactive
+ // channel would leave a dsh session unable to ask anything. Same
+ // precedent as `memory_ping`.
+ let s = fixture()
+ .with_user_question_sink(FakeQuestionSink::new(FakeQuestionReply::FirstOption))
+ .with_exposed_tools(vec!["memory_search".into()]);
+ assert!(s.ask_tool_listed(Some(&ask_parts(Some("conv-1")))));
+ }
+
+ #[test]
+ fn get_tool_exposes_the_ask_tool_only_when_a_sink_exists() {
+ let s = fixture().with_user_question_sink(FakeQuestionSink::new(
+ FakeQuestionReply::FirstOption,
+ ));
+ let tool = s
+ .get_tool(super::super::ask::TOOL_ASK_USER_QUESTION)
+ .expect("sink installed");
+ assert_eq!(tool.name, super::super::ask::TOOL_ASK_USER_QUESTION);
+ assert!(fixture().get_tool(super::super::ask::TOOL_ASK_USER_QUESTION).is_none());
+ }
+
+ #[test]
+ fn the_context_free_tool_list_never_contains_the_ask_tool() {
+ // `listed_tools()` has no request context, so it must not advertise a
+ // tool whose presence depends on one — the snapshots and the in-process
+ // specs are built from it.
+ let s = fixture().with_user_question_sink(FakeQuestionSink::new(
+ FakeQuestionReply::FirstOption,
+ ));
+ assert!(
+ !s.listed_tool_names()
+ .contains(&super::super::ask::TOOL_ASK_USER_QUESTION.to_string())
+ );
+ }
}
diff --git a/crates/gaviero-core/src/swarm/backend/codex.rs b/crates/gaviero-core/src/swarm/backend/codex.rs
index 5afafcf1..36014bc6 100644
--- a/crates/gaviero-core/src/swarm/backend/codex.rs
+++ b/crates/gaviero-core/src/swarm/backend/codex.rs
@@ -64,8 +64,8 @@ use super::{
pub const DEFAULT_CODEX_MODEL: &str = "gpt-6.1-sol";
/// Context window, in tokens, the Codex catalog advertises for `model`
-/// (`context_window` in `codex debug models`, client 0.167.0, 2026-11-09).
-/// The 6.1 family has 500k; every other listed model has 272k, which is also
+/// (`context_window` in `codex debug models`, client 0.167.0, 2026-11-17).
+/// `gpt-6.1-terra` has 500k; every other listed model has 272k, which is also
/// the assumption for a model the catalog does not describe.
pub fn codex_context_window(model: &str) -> usize {
let model = model.trim().to_ascii_lowercase();
@@ -74,7 +74,7 @@ pub fn codex_context_window(model: &str) -> usize {
} else {
model.as_str()
};
- if model.starts_with("gpt-6.1") {
+ if model.starts_with("gpt-6.1-terra") {
500_000
} else {
272_000
@@ -751,7 +751,8 @@ pub fn codex_effort_levels(model: &str) -> Vec {
/// Highest `model_reasoning_effort` per the catalog as of client 0.167.0
/// (2026-11): any `-luna` model reaches `max`, every other `gpt-6*` /
-/// `gpt-5.6*` model `ultra`, and older models `xhigh`.
+/// `gpt-5.6*` model `ultra`, and older models (including the re-listed
+/// `gpt-5.5`) `xhigh`.
fn codex_effort_ceiling(model: &str) -> &'static str {
let m = model
.trim()
@@ -1091,10 +1092,11 @@ url = "https://example/mcp/"
#[test]
fn test_context_window_follows_the_catalog() {
- assert_eq!(codex_context_window("gpt-6.1-sol"), 500_000);
+ assert_eq!(codex_context_window("gpt-6.1-sol"), 272_000);
assert_eq!(codex_context_window("gpt-6.1-terra"), 500_000);
assert_eq!(codex_context_window("gpt-6-astra"), 272_000);
assert_eq!(codex_context_window("gpt-5.6-luna"), 272_000);
+ assert_eq!(codex_context_window("gpt-5.5"), 272_000);
assert_eq!(codex_context_window("some-future-model"), 272_000);
assert_eq!(
codex_context_window(""),
diff --git a/crates/gaviero-core/src/swarm/backend/shared.rs b/crates/gaviero-core/src/swarm/backend/shared.rs
index b3612ab5..65fb50a7 100644
--- a/crates/gaviero-core/src/swarm/backend/shared.rs
+++ b/crates/gaviero-core/src/swarm/backend/shared.rs
@@ -71,27 +71,30 @@ pub const CLAUDE_MODEL_ALIASES: &[&str] = &[
/// list when the CLI is missing or fails.
///
/// Mirrors the `visibility: "list"` slugs of that catalog (client 0.167.0,
-/// 2026-11-09), in upstream `priority` order. Hidden slugs (`gpt-reserve`,
-/// `codex-auto-review`) are deliberately absent.
+/// 2026-11-17), in upstream `priority` order. Hidden slugs (the
+/// `gpt-daybreak-*-latest` experiments and `codex-auto-review`) are
+/// deliberately absent.
///
/// Listing a model an older CLI is not served is deliberate: this is host-side
/// picker UX, and the spec is forwarded verbatim to whichever CLI is installed,
/// so an outdated CLI fails at dispatch rather than silently substituting a
/// model.
///
-/// `gpt-5.2` / `gpt-5.3-codex-spark` / `gpt-5.4` / `gpt-5.4-mini` / `gpt-5.5`
-/// are gone because Codex delisted them upstream. Free-form ids still pass
-/// [`validate_model_spec`], so an existing pin is still sent as written; it
-/// just no longer shows up in the picker.
+/// `gpt-5.2` / `gpt-5.3-codex-spark` / `gpt-5.4` / `gpt-5.4-mini` are gone
+/// because Codex delisted them upstream; `gpt-5.5` was delisted too and came
+/// back as the last `list` entry, so it is offered again. Free-form ids still
+/// pass [`validate_model_spec`], so a pin to a delisted id is still sent as
+/// written; it just no longer shows up in the picker.
pub const CODEX_MODEL_ALIASES: &[&str] = &[
"gpt-6.1-sol",
"gpt-6-astra",
- "gpt-6.1-terra",
"gpt-6-sol",
"gpt-6-luna",
"gpt-5.6-sol",
+ "gpt-6.1-terra",
"gpt-5.6-terra",
"gpt-5.6-luna",
+ "gpt-5.5",
];
/// Concrete Claude CLI `--model` id that the bare `sonnet` alias resolves to.
@@ -1298,12 +1301,12 @@ mod tests {
);
// Delisted upstream, so they are no longer offered — but an explicit
// pin must still validate, since the picker list is UX only.
+ // (`gpt-5.5` is listed again and is covered by the alias loop above.)
for delisted in [
"codex:gpt-5.2",
"codex:gpt-5.4",
"codex:gpt-5.4-mini",
"codex:gpt-5.3-codex-spark",
- "codex:gpt-5.5",
] {
assert!(!hits.contains(&delisted.to_string()), "got {hits:?}");
validate_model_spec(delisted).unwrap();
diff --git a/crates/gaviero-core/tests/acp_client.rs b/crates/gaviero-core/tests/acp_client.rs
index db8c3ba5..d50cb06c 100644
--- a/crates/gaviero-core/tests/acp_client.rs
+++ b/crates/gaviero-core/tests/acp_client.rs
@@ -1042,6 +1042,36 @@ async fn dsh_backend_happy_turn_with_fake_agent() {
);
}
+/// `$skill` invocations must reach a `dsh:` turn the same way they reach
+/// Claude: the rendered `SKILL.md` body rides the ACP prompt as a
+/// `` block.
+#[tokio::test]
+async fn skill_selection_is_rendered_into_the_acp_prompt() {
+ let dir = workspace();
+ let args = construction(
+ dir.path(),
+ Box::new(NoopAcp),
+ Box::new(RecWrite {
+ paths: Arc::new(Mutex::new(Vec::new())),
+ }),
+ true,
+ );
+ let mut session =
+ AcpClientSession::new_with_scope(args, FileScope::default()).with_extra(extra("inspect"));
+ let mut t = turn("please migrate", true);
+ t.skill_selections
+ .push(gaviero_core::context_planner::SkillSelection {
+ name: "migrate-component".into(),
+ scope_level: 0,
+ rendered_body: "SKILL-BODY-SENTINEL".into(),
+ });
+ let events = drain_turn(&mut session, t).await;
+ let report = inspect_prompt(&events);
+ let prompt = report["prompt"].to_string();
+ assert!(prompt.contains("SKILL-BODY-SENTINEL"), "{prompt}");
+ Box::new(session).close().await;
+}
+
#[tokio::test]
async fn missing_api_key_surfaces_on_first_turn() {
if std::env::var_os("DEEPSEEK_API_KEY").is_some()
diff --git a/crates/gaviero-dsl/README.md b/crates/gaviero-dsl/README.md
index a3e311ef..ae9e3fc8 100644
--- a/crates/gaviero-dsl/README.md
+++ b/crates/gaviero-dsl/README.md
@@ -99,7 +99,7 @@ Model strings appear only in model profiles (`client { model "…" }`). Canonica
| Provider | Examples |
|---|---|
| Claude | `claude:fable`, `claude:sonnet`, `claude:opus`, `claude:claude-fable-5-2`, `claude:claude-opus-5-5` |
-| Codex | `codex:gpt-6.1-sol`, `codex:gpt-6-astra`, `codex:gpt-6.1-terra`, `codex:gpt-6-sol`, `codex:gpt-6-luna`, `codex:gpt-5.6-sol`, `codex:gpt-5.6-terra`, `codex:gpt-5.6-luna` |
+| Codex | `codex:gpt-6.1-sol`, `codex:gpt-6-astra`, `codex:gpt-6-sol`, `codex:gpt-6-luna`, `codex:gpt-5.6-sol`, `codex:gpt-6.1-terra`, `codex:gpt-5.6-terra`, `codex:gpt-5.6-luna`, `codex:gpt-5.5` |
| Cursor | `cursor:composer-2.5`, `cursor:grok-4.7-high` (ids embed effort — see `agent --list-models`) |
| Ollama / local | `ollama:qwen2.5-coder:7b`, `local:model-name` |
| DeepSeek | `deepseek:deepseek-flash`, `deepseek:deepseek-v4-pro` (legacy: `deepseek:deepseek-v4-flash`) |
diff --git a/crates/gaviero-tui/CLAUDE.md b/crates/gaviero-tui/CLAUDE.md
index 60e63f63..2c6bafd3 100644
--- a/crates/gaviero-tui/CLAUDE.md
+++ b/crates/gaviero-tui/CLAUDE.md
@@ -46,7 +46,7 @@ Workspace dispatch: directory → `Workspace::single_folder`; `*.gaviero-workspa
**Restart on new build:** [`supervisor.rs`](src/supervisor.rs) + [`app/restart.rs`](src/app/restart.rs). The `gaviero` a user starts (on a TTY, unless `GAVIERO_NO_SUPERVISOR` is set) is a thin parent that runs the real TUI as a child with `GAVIERO_SUPERVISED=1` and relaunches it in the same pane whenever it exits with code 75. The child stats its own exe every 2s and decides once when a changed exe has settled: if a task is running (agent turn, background agent, terminal command) or it is unsupervised, it keeps running the old build and shows a "new version installed — restart manually" popup (any key dismisses), with no automatic restart afterwards. Otherwise it waits out transient blockers (unsaved buffer, review, dialog, input in the last 15s), then quits through the normal save path and exits 75. The session host gets the same: `gaviero --sessions` is supervised by `supervisor::supervise_host` (the child carries `GAVIERO_SESSION_HOST_RESTART`, a private record file), and [`session_host/restart.rs`](src/session_host/restart.rs) waits until no tab reports work, no host dialog is open and no host input for 15s, writes the record (tab paths in order, the current tab, each tab's launch-state file verbatim), quits like Ctrl+Q and exits 75; the next host reopens from the record (consumed once) instead of its arguments. Its tabs carry `GAVIERO_SESSION_HOST_RESTARTS` and skip their own build watch, so a busy tab never gets the "restart manually" popup — the host restarts it once idle. An unsupervised host only says once on the tab bar that a restart by hand is needed. [`scripts/deploy.ps1`](../../scripts/deploy.ps1) installs over running binaries by renaming them to `*.exe.old-` (Windows allows renaming a running exe, not deleting it).
-**Session host** (`gaviero --sessions [path]`, [`session_host/`](src/session_host)): a separate program in the same binary, dispatched first thing in `main()` (before the input probe and the supervisor; refused inside a session). One host per state file: the process the user starts takes an exclusive OS lock on `session-host.lock` beside the state file (`state::lock_instance`, released by the OS however the process ends) and holds it across restarts onto a new build — its supervised child (`HOST_RESTART_ENV`) skips the check; a second host prints `session_host::ALREADY_RUNNING` and exits 1. A lock that cannot be tried at all only warns. It runs every session as an unmodified `gaviero ` child in a pseudo-terminal (ConPTY on Windows) with `GAVIERO_SUPERVISED` + `GAVIERO_LAUNCH_STATE` (it supervises each tab: exit 75 relaunches in place, with the supervisor's `MIN_RUN` / `RESTART_BACKOFF`), `GAVIERO_SESSION_HOST` and `GAVIERO_SESSION_CONTROL`, emulates each screen with `vt100`, and draws the active one under a one-row tab bar. Modules: [`target`](src/session_host/target.rs) (`Target::{Local, Ssh}` — what a tab runs), [`osc7`](src/session_host/osc7.rs) (folder reports), [`clipboard`](src/session_host/clipboard.rs) (local clipboard for SSH tabs), [`keys`](src/session_host/keys.rs) (the one key decision, both input paths), [`encode`](src/session_host/encode.rs) (std only — win32-input-mode key sequences, SGR mouse, DSR/DA1 answers; ConPTY itself asks DSR at startup), [`session`](src/session_host/session.rs) (child, reader/writer threads, status), [`input_windows`](src/session_host/input_windows.rs) (`ReadConsoleInputW` records; `encode::KeyEncoder` sends text keys — printable, bare Enter/Tab, AltGr symbols — as plain UTF-8 and drops their key-ups and bare modifier records, everything else as win32-input-mode: the inbox conhost drops the start of a sequence split across pipe reads, so a paste burst sent as sequences came out as `;0;0;1_` garbage) / [`input_term`](src/session_host/input_term.rs) (Unix: crossterm events re-encoded; compiled, not live-tested), [`render`](src/session_host/render.rs), [`picker`](src/session_host/picker.rs) (Alt+N; a whole-disk folder browser — empty box = recents + start folder + home + `platform::filesystem_roots` (drives via `GetLogicalDrives`), Left = parent, Right = enter; completion from [`widgets/path_listing.rs`](src/widgets/path_listing.rs)), [`state`](src/session_host/state.rs) (`session-host.json` under the data dir — recents + open set; `GAVIERO_SESSION_HOST_STATE` overrides). Host keys: Alt+Left/Right, Alt+Shift+Left/Right (move the current tab one place, no wrap; `HostState::reorder_open` saves the order — Windows Terminal 1.24 passes these through with one pane despite its default Resize Pane binding), Alt+N, Alt+Q (close the active tab; the previous one becomes current), Ctrl+Q (quit the host, open set kept — taken by the host, never forwarded; Ctrl without Alt so AltGr+Q stays text). Alt+X is never bound: Windows intercepts it, click on a tab (its leading `x` — `TabBar::closable` / `close_at_x` — closes it); everything else goes to the active session — except Ctrl+wheel, which the host takes first (dialogs and tab bar included) and answers by turning its mouse reporting and alternate scroll (`?1007`, on by default in Windows Terminal and checked before zoom) off for `theme::ZOOM_PASSTHROUGH_MS` (`Host::begin_zoom`, extended by each resize) so the outer terminal zooms its font: one zoom for the whole window, every tab, and no tab ever sees the gesture. A child reports status in its title, OSC 2 `gaviero-session:[:work,…]` (`App::session_host_status`, written by `main` only under the host; work = `restart::work_in_progress` keywords `agent`, `swarm`, `terminal`, `unsaved`, separated by `:` because terminals split OSC parameters on `;`). `main` re-checks it after every event (ticks included) and appends `shell-input` when a shell command seems to wait for the user (`TerminalInstance::awaiting_input`: a bare BEL or an OSC 9/777/99 notification while running, cleared by the user's next input; else, after `INPUT_WAIT_QUIET` = 5 s with no output and no input, the alternate screen or the cursor left after text on its line). The host reads it as `session::Activity` (`waiting` = `attention`, `agent` = `agent`/`swarm`, `shell` = `terminal`, `shell_waiting` = `shell-input`) and draws two badges after every tab's label, the current one included (`render::tab_badges` → `TabBar::badges`, fixed 3-cell slots so widths never change): a letter on a pill of the state colour, rounded by the Powerline half circles U+E0B6 / U+E0B4 drawn in that colour on the tab background (Windows Terminal draws them as built-in glyphs) — `A` agent running / waiting / finished, `S` shell running / waiting / finished. "Finished" is latched in `on_output` only when the work ends while the tab is not current (`agent_done_unseen` / `shell_done_unseen`) and cleared by `switch_to` on the tab being left (the tab made current keeps its badges), or in `on_output` when the current tab's activity changes. Closing a tab or quitting the host with work in progress opens the close guard (`Confirm`, a centred popup listing it per tab; only `y` proceeds); with none it acts at once. The host controls a child through its control file, which `App::poll_session_control` consumes on Tick: `exit` quits at once through the normal exit path (session state saved, no question), `quit` goes through `try_quit`. Closing a tab removes it immediately and writes `exit`; quitting the host writes `exit` to every child. Either way a child still running after `EXIT_GRACE` (3 s) is killed, and the host waits for closing children before it exits. Test-only: `GAVIERO_INPUT_PROBE` turns the binary into an input probe ([`probe`](src/session_host/probe.rs)) for `tests/session_host_*.rs`. Host log: `gaviero-sessions.log` beside `gaviero.log`.
+**Session host** (`gaviero --sessions [path]`, [`session_host/`](src/session_host)): a separate program in the same binary, dispatched first thing in `main()` (before the input probe and the supervisor; refused inside a session). One host per state file: the process the user starts takes an exclusive OS lock on `session-host.lock` beside the state file (`state::lock_instance`, released by the OS however the process ends) and holds it across restarts onto a new build — its supervised child (`HOST_RESTART_ENV`) skips the check; a second host prints `session_host::ALREADY_RUNNING` and exits 1. A lock that cannot be tried at all only warns. It runs every session as an unmodified `gaviero ` child in a pseudo-terminal (ConPTY on Windows) with `GAVIERO_SUPERVISED` + `GAVIERO_LAUNCH_STATE` (it supervises each tab: exit 75 relaunches in place, with the supervisor's `MIN_RUN` / `RESTART_BACKOFF`), `GAVIERO_SESSION_HOST` and `GAVIERO_SESSION_CONTROL`, emulates each screen with `vt100`, and draws the active one under a one-row tab bar. Modules: [`target`](src/session_host/target.rs) (`Target::{Local, Ssh}` — what a tab runs), [`osc7`](src/session_host/osc7.rs) (folder reports), [`clipboard`](src/session_host/clipboard.rs) (local clipboard for SSH tabs), [`keys`](src/session_host/keys.rs) (the one key decision, both input paths), [`encode`](src/session_host/encode.rs) (std only — win32-input-mode key sequences, SGR mouse, DSR/DA1 answers; ConPTY itself asks DSR at startup), [`session`](src/session_host/session.rs) (child, reader/writer threads, status), [`input_windows`](src/session_host/input_windows.rs) (`ReadConsoleInputW` records; `encode::KeyEncoder` sends text keys — printable, bare Enter/Tab, AltGr symbols — as plain UTF-8 and drops their key-ups and bare modifier records, everything else as win32-input-mode: the inbox conhost drops the start of a sequence split across pipe reads, so a paste burst sent as sequences came out as `;0;0;1_` garbage) / [`input_term`](src/session_host/input_term.rs) (Unix: crossterm events re-encoded; compiled, not live-tested), [`render`](src/session_host/render.rs), [`picker`](src/session_host/picker.rs) (Alt+N; a whole-disk folder browser — empty box = recents + start folder + home + `platform::filesystem_roots` (drives via `GetLogicalDrives`), Left = parent, Right = enter; completion from [`widgets/path_listing.rs`](src/widgets/path_listing.rs)), [`state`](src/session_host/state.rs) (`session-host.json` under the data dir — recents + open set; `GAVIERO_SESSION_HOST_STATE` overrides). Host keys: Alt+Left/Right, Alt+Shift+Left/Right (move the current tab one place, no wrap; `HostState::reorder_open` saves the order — Windows Terminal 1.24 passes these through with one pane despite its default Resize Pane binding), Alt+N, Alt+Q (close the active tab; the previous one becomes current), Ctrl+Q (quit the host, open set kept — taken by the host, never forwarded; Ctrl without Alt so AltGr+Q stays text). Alt+X is never bound: Windows intercepts it, click on a tab (its leading `x` — `TabBar::closable` / `close_at_x` — closes it); everything else goes to the active session — except Ctrl+wheel, which the host takes first (dialogs and tab bar included) and answers by turning its mouse reporting and alternate scroll (`?1007`, on by default in Windows Terminal and checked before zoom) off for `theme::ZOOM_PASSTHROUGH_MS` (`Host::begin_zoom`, extended by each resize) so the outer terminal zooms its font: one zoom for the whole window, every tab, and no tab ever sees the gesture. A child reports status in its title, OSC 2 `gaviero-session:[:work,…]` (`App::session_host_status`, written by `main` only under the host; work = `restart::work_in_progress` keywords `agent`, `swarm`, `terminal`, `unsaved`, separated by `:` because terminals split OSC parameters on `;`). `main` re-checks it after every event (ticks included) and appends `shell-input` when a shell command seems to wait for the user (`TerminalInstance::awaiting_input`: a bare BEL or an OSC 9/777/99 notification while running, cleared by the user's next input; else, after `INPUT_WAIT_QUIET` = 5 s with no output and no input, the alternate screen or the cursor left after text on its line). The host reads it as `session::Activity` (`waiting` = `attention`, `review` = `review` — a pending turn review, whose turn is finished; `agent` = `agent`/`swarm`, `shell` = `terminal`, `shell_waiting` = `shell-input`) and draws two badges after every tab's label, the current one included (`render::tab_badges` → `TabBar::badges`, fixed 3-cell slots so widths never change): a letter on a pill of the state colour, rounded by the Powerline half circles U+E0B6 / U+E0B4 drawn in that colour on the tab background (Windows Terminal draws them as built-in glyphs) — `A` agent running / waiting / finished (a pending turn review counts as finished, blue), `S` shell running / waiting / finished. "Finished" is latched in `on_output` only when the work ends while the tab is not current (`agent_done_unseen` / `shell_done_unseen`) and cleared by `switch_to` on the tab being left (the tab made current keeps its badges), or in `on_output` when the current tab's activity changes. Closing a tab or quitting the host with work in progress opens the close guard (`Confirm`, a centred popup listing it per tab; only `y` proceeds); with none it acts at once. The host controls a child through its control file, which `App::poll_session_control` consumes on Tick: `exit` quits at once through the normal exit path (session state saved, no question), `quit` goes through `try_quit`. Closing a tab removes it immediately and writes `exit`; quitting the host writes `exit` to every child. Either way a child still running after `EXIT_GRACE` (3 s) is killed, and the host waits for closing children before it exits. Test-only: `GAVIERO_INPUT_PROBE` turns the binary into an input probe ([`probe`](src/session_host/probe.rs)) for `tests/session_host_*.rs`. Host log: `gaviero-sessions.log` beside `gaviero.log`.
**SSH tabs** (session host): a tab runs a [`Target`](src/session_host/target.rs) — `Local(path)` or `Ssh { host, path: Option }` — saved in `session-host.json` and the restart record as the plain path (old files load unchanged) or `ssh://` (`ssh:///~/…`). The Alt+N picker switches Local / SSH with Ctrl+T (`PickerKey::ToggleMode`; `Picker::new_with_ssh`); SSH mode takes `host` or `host:/path`, listing `~/.ssh/config` `Host` aliases (`picker::ssh_config_hosts`, no `Include`) and recent SSH targets. An SSH tab runs `target::ssh_program()` — `GAVIERO_SSH` if set (tests), else the inbox `%SystemRoot%\System32\OpenSSH\ssh.exe` (Git's `ssh`, often first on PATH, is a different console implementation), else `ssh` — with `-t -o ServerAliveInterval=15 -o ServerAliveCountMax=3 "exec $SHELL -l -c 'exec env GAVIERO_SESSION_HOST=1 ""|--pick'"` in the same pseudo-terminal as a local tab (measured: ConPTY hands `ssh.exe` correct xterm VT for the host's keys, SGR mouse, bracketed paste and resize; OSC 0/2/7/52 come back). Hosts, paths and the gaviero override refuse `' " \ $` and backticks, so the quoting holds in sh/bash/zsh/fish (csh and Windows remotes are out of scope). `sshHosts..gaviero` in `session-host.json` overrides where gaviero is on that machine; the host re-reads `sshHosts` from disk before every save and before every connection, so hand edits survive. No session-host env vars or control file reach an SSH tab: the remote gaviero supervises itself (remote builds restart there). `gaviero --pick [START]` runs the folder picker (`picker::run_standalone`) **before** `supervisor::supervise(&args)`, rewriting the args to the chosen path, so a restart never asks again. Every child under the host (`GAVIERO_SESSION_HOST`) writes its opened folder once as OSC 7 (`main.rs::write_session_path`, `osc7::encode_file_url`); the host decodes it in `TitleCb::unhandled_osc` and, for SSH tabs only, adopts it (`Host::adopt_reported_path`: label `host:folder`, `HostState::replace_open`). That report also marks a local tab ready for focus reports: after every host event `Host::sync_focus` sends `ESC[I` to the shown local tab and `ESC[O` to the others, once per change (`Session::sync_focus`; ConPTY turns them into focus events), so a hidden tab's `terminal_has_focus` is false — otherwise every local tab acted on a desktop-wide Ctrl+V (`platform::take_ctrl_v_press_edge`) and attached the clipboard image in the wrong tab. SSH tabs get none (the remote end may be a shell); Ctrl+V there with no clipboard text says so on the tab bar. Closing or quitting kills an SSH tab's `ssh` at once (`close_grace` = 0) — the remote gaviero gets SIGHUP, and `platform::install_hangup_forwarder` (Unix) turns SIGHUP/SIGTERM into `Event::HangUp`, which leaves through the normal save path (`platform::hung_up` stops drawing to the dead terminal; log line `exit: session state saved`). `ssh` exiting 255 (`SSH_CONNECTION_LOST`) keeps the tab `disconnected` with a ` Disconnected ` box: Enter reconnects (`Host::reconnect`), other input is dropped. OSC 52 copies from any tab reach the local clipboard (`TitleCb::copy_to_clipboard` → `session_host::clipboard`, ≤ 1 MiB UTF-8), and Ctrl+V in an SSH tab sends the local clipboard text as a (bracketed) paste. Shift+Enter in an SSH tab is sent as Alt+Enter (`encode::ssh_key_record`; every tab of a Unix host via `keys::vt_override`): `ssh.exe` reads VT, where conhost writes Shift+Enter as a bare `\r`, while Alt+Enter crosses as `ESC \r` and the remote gaviero binds both to the chat newline. Test hooks: `GAVIERO_SSH` (point it at the gaviero binary: with `GAVIERO_INPUT_PROBE` it becomes the probe), `GAVIERO_PROBE_ARGS` (the probe records its argv; Ctrl+K exits 255, Ctrl+O sends OSC 7, Ctrl+Y sends OSC 52), `GAVIERO_SESSION_HOST_CLIPBOARD` (a file instead of the system clipboard). `tests/session_host_ssh.rs` covers the Windows side; `tests/remote_side_unix.rs` (`--pick`, OSC 7, SIGHUP save) runs only on Unix — on this Windows PC run it in WSL (`wsl.exe -d Ubuntu-26.04`, `CARGO_TARGET_DIR=$HOME/.cache/gaviero-wsl-target`); cross-compiling from Windows fails on openssl-sys.
diff --git a/crates/gaviero-tui/README.md b/crates/gaviero-tui/README.md
index f1144a0a..3c78be18 100644
--- a/crates/gaviero-tui/README.md
+++ b/crates/gaviero-tui/README.md
@@ -27,7 +27,7 @@ gaviero --sessions /path/to/repo # session host with only this ses
gaviero --pick [PATH] # choose the folder in a folder browser first (starts at PATH)
```
-`gaviero --sessions` runs several gaviero sessions in one terminal, each a full `gaviero` process, under a one-row tab bar. Alt+Left / Alt+Right switch sessions (or click a tab), Alt+Shift+Left / Alt+Shift+Right move the current tab one place (the order is kept for the next start), Alt+N opens a new one in a folder browser over the whole disk (the empty box lists recent paths, the start folder, home and every drive; type a folder / `.gaviero-workspace` path with Tab completion, → enters the selected folder, ← goes to the parent, Enter opens the selection — a listed folder shows itself first), Alt+Q or a click on the `x` at the start of a tab closes that tab and ends its gaviero (it saves its session state; a session that has not exited after 3 s is killed), and the tab before it becomes current. Ctrl+Q quits the host the same way, keeping every tab for the next start; inside the host Ctrl+Q never reaches a session. (Alt+X is not used: Windows keeps it.) Both act at once unless something would be lost — an agent, a swarm or a shell command running, or unsaved files — in which case a popup lists it per tab and only `y` goes ahead. Every tab, the current one included, ends in two badges, a letter on a rounded pill of the state's colour. `A` is the agent's: green while an agent or a swarm runs, yellow while it waits for you (a permission prompt, an agent's question or a turn review), blue once it finished while you were elsewhere. `S` is the shells': green while a command runs in one of the session's shells, yellow when that command seems to wait for you, blue once one finished while you were elsewhere. Yellow is certain when the program rings the bell or sends a desktop notification (OSC 9, 777 or 99); otherwise it is a guess, made after 5 seconds with no output and no typing: a full-screen program sitting idle (vim, less), or a line left unfinished like `Password: ` or `[y/N] `. A long silent step that leaves a half-written line can show yellow by mistake. Typing in that shell turns it green again (seen through the shell integration gaviero injects into bash, zsh, fish and PowerShell 7.2+; other shells never show it). Making a tab current keeps both; a finished badge clears when you leave the tab again, or as soon as new work starts in it. A tab closes when its gaviero exits; the host exits after the last one. Without a path the host reopens the sessions open when it last ended, else the current directory. Only one host runs at a time: a second `gaviero --sessions` (for example from a shell profile in a new terminal) prints a warning and exits without opening anything — switch to the running host instead. When a new build is installed (`scripts/deploy.ps1`), the host restarts itself and every tab onto it once no tab has an agent, a swarm or a shell command running or unsaved files and you have not typed into it for 15 s; the same tabs reopen, with the same one current. Until then the tab bar says what it is waiting for. A host started with `GAVIERO_NO_SUPERVISOR` (or without a terminal) cannot restart itself and says so once. Windows is the tested platform.
+`gaviero --sessions` runs several gaviero sessions in one terminal, each a full `gaviero` process, under a one-row tab bar. Alt+Left / Alt+Right switch sessions (or click a tab), Alt+Shift+Left / Alt+Shift+Right move the current tab one place (the order is kept for the next start), Alt+N opens a new one in a folder browser over the whole disk (the empty box lists recent paths, the start folder, home and every drive; type a folder / `.gaviero-workspace` path with Tab completion, → enters the selected folder, ← goes to the parent, Enter opens the selection — a listed folder shows itself first), Alt+Q or a click on the `x` at the start of a tab closes that tab and ends its gaviero (it saves its session state; a session that has not exited after 3 s is killed), and the tab before it becomes current. Ctrl+Q quits the host the same way, keeping every tab for the next start; inside the host Ctrl+Q never reaches a session. (Alt+X is not used: Windows keeps it.) Both act at once unless something would be lost — an agent, a swarm or a shell command running, or unsaved files — in which case a popup lists it per tab and only `y` goes ahead. Every tab, the current one included, ends in two badges, a letter on a rounded pill of the state's colour. `A` is the agent's: green while an agent or a swarm runs, yellow while it waits for you to continue the turn (a permission prompt or an agent's question), blue once it finished — while a turn review is pending, or once it ended while you were elsewhere. `S` is the shells': green while a command runs in one of the session's shells, yellow when that command seems to wait for you, blue once one finished while you were elsewhere. Yellow is certain when the program rings the bell or sends a desktop notification (OSC 9, 777 or 99); otherwise it is a guess, made after 5 seconds with no output and no typing: a full-screen program sitting idle (vim, less), or a line left unfinished like `Password: ` or `[y/N] `. A long silent step that leaves a half-written line can show yellow by mistake. Typing in that shell turns it green again (seen through the shell integration gaviero injects into bash, zsh, fish and PowerShell 7.2+; other shells never show it). Making a tab current keeps both; a finished badge clears when you leave the tab again, or as soon as new work starts in it. A tab closes when its gaviero exits; the host exits after the last one. Without a path the host reopens the sessions open when it last ended, else the current directory. Only one host runs at a time: a second `gaviero --sessions` (for example from a shell profile in a new terminal) prints a warning and exits without opening anything — switch to the running host instead. When a new build is installed (`scripts/deploy.ps1`), the host restarts itself and every tab onto it once no tab has an agent, a swarm or a shell command running or unsaved files and you have not typed into it for 15 s; the same tabs reopen, with the same one current. Until then the tab bar says what it is waiting for. A host started with `GAVIERO_NO_SUPERVISOR` (or without a terminal) cannot restart itself and says so once. Windows is the tested platform.
**SSH tabs.** In the Alt+N picker, Ctrl+T switches between **Local** and **SSH**. In SSH mode type `host` or `host:/path` (`host:~/path` works too); the list offers the `Host` aliases from `~/.ssh/config` and recent SSH tabs. The tab runs Windows' own OpenSSH (`%SystemRoot%\System32\OpenSSH\ssh.exe`; `ssh` elsewhere), which starts gaviero on that machine through your login shell, so keys, mouse, tab badges and the close guard work as in a local tab, and ssh's own prompts (password, host key) appear in the tab. With no path the remote gaviero opens its folder browser (`gaviero --pick`) and the tab takes the folder you choose there as its name (`host:folder`) and for reopening. gaviero must be installed on the remote; when it is not on the login PATH, set its location in the host state file (`session-host.json` in gaviero's data folder — `%APPDATA%\gaviero\` on Windows, `~/.local/share/gaviero/` on Linux): `"sshHosts": { "myhost": { "gaviero": "~/.cargo/bin/gaviero" } }`. Closing an SSH tab ends the connection at once and the remote gaviero saves its session as it exits. A dropped connection keeps the tab with a **Disconnected** box: Enter reconnects (the remote session is restored; an agent turn that was running is lost), Alt+Q closes it. Text the remote gaviero copies lands on this machine's clipboard, and Ctrl+V in an SSH tab pastes this machine's clipboard text (images do not cross). Remote machines must have a POSIX login shell (sh, bash, zsh, fish); paths containing `'`, `"`, `\`, `$` or a backtick are refused.
diff --git a/crates/gaviero-tui/src/app.rs b/crates/gaviero-tui/src/app.rs
index 702b7b66..db5b0e68 100644
--- a/crates/gaviero-tui/src/app.rs
+++ b/crates/gaviero-tui/src/app.rs
@@ -1317,21 +1317,24 @@ impl App {
}
/// What a session host shows on this session's tab: `attention` while a
- /// permission prompt or a turn review waits for the user, `busy` while
- /// an agent, swarm or terminal task runs, else `idle`. `main` reports it
- /// in the window title, only under a host, followed by `:` and the work
- /// closing this session would cut off (`restart::work_in_progress`), so
- /// the host can warn before it closes the tab: `busy:agent,unsaved`.
- /// Not `;`: terminals split OSC parameters on it. `shell-input` is
- /// added when a shell command seems to wait for the user, for the
- /// host's shell circle; it is not work the close guard lists.
+ /// permission prompt or an agent's question waits for the user, `busy`
+ /// while an agent, swarm or terminal task runs, else `idle`. A pending
+ /// turn review is *not* attention: its turn finished and the user can
+ /// continue whenever, so it only adds the `review` detail and the host
+ /// draws the finished badge. `main` reports the status in the window
+ /// title, only under a host, followed by `:` and the work closing this
+ /// session would cut off (`restart::work_in_progress`), so the host can
+ /// warn before it closes the tab: `busy:agent,unsaved`. Not `;`:
+ /// terminals split OSC parameters on it. `shell-input` is added when a
+ /// shell command seems to wait for the user, for the host's shell
+ /// badge; it is not work the close guard lists.
pub(crate) fn session_host_status(&self) -> String {
let waiting = self
.chat_state
.conversations
.iter()
- .any(|c| c.pending_permission.is_some())
- || !self.pending_turn_reviews.is_empty();
+ .any(|c| c.pending_permission.is_some());
+ let review = !self.pending_turn_reviews.is_empty();
let status = if waiting {
"attention"
} else if restart::running_task(self).is_some() {
@@ -1340,6 +1343,12 @@ impl App {
"idle"
};
let mut work = restart::work_in_progress(self);
+ // A pending review means the turn is over, so it is reported beside
+ // the work keywords, never as `attention`; the host reads it as the
+ // finished state (`session_host::session::parse_activity`).
+ if review {
+ work.push("review");
+ }
if restart::terminal_awaiting_input(self) {
work.push("shell-input");
}
@@ -1852,6 +1861,28 @@ mod session_host_tests {
cleanup_session(dir.path());
}
+ #[test]
+ fn session_host_status_reports_a_turn_review_as_finished() {
+ let dir = tempfile::tempdir().unwrap();
+ let mut app = host_app(dir.path());
+ let set = gaviero_core::turn_capture::TurnChangeSet {
+ turn_id: "t1".into(),
+ conv_id: None,
+ started_at_ms: 0,
+ ended_at_ms: 1,
+ outcome: gaviero_core::turn_capture::TurnOutcome::Completed,
+ files: Vec::new(),
+ warnings: Vec::new(),
+ auto_reverted: Vec::new(),
+ };
+ app.pending_turn_reviews
+ .push(gaviero_core::turn_capture::PendingReview::new(set));
+ // The review's turn is over, so the host is told `review` (finished,
+ // blue) and never `attention` (waiting, yellow).
+ assert_eq!(app.session_host_status(), "idle:review");
+ cleanup_session(dir.path());
+ }
+
#[test]
fn session_host_status_lists_unsaved_files_while_idle() {
let dir = tempfile::tempdir().unwrap();
diff --git a/crates/gaviero-tui/src/app/controller.rs b/crates/gaviero-tui/src/app/controller.rs
index 6668918c..a4e65419 100644
--- a/crates/gaviero-tui/src/app/controller.rs
+++ b/crates/gaviero-tui/src/app/controller.rs
@@ -1489,7 +1489,17 @@ pub(super) fn handle_event(app: &mut App, event: Event) {
))
// The same live graphs chat injection reads (last: it
// supersedes the fallback the builders above configure).
- .with_graph_services(app.graph_services.clone());
+ .with_graph_services(app.graph_services.clone())
+ // `dsh:`'s interactive channel: an MCP `ask_user_question`
+ // call parks the overlay via `Event::PermissionRequest`,
+ // exactly as Claude's `AskUserQuestion` does. The tool is
+ // only listed for a connection whose request carries the
+ // conversation header `dsh.rs` puts on dsh's MCP entry.
+ .with_user_question_sink(std::sync::Arc::new(
+ super::observers::TuiUserQuestionSink {
+ tx: app.event_tx.clone(),
+ },
+ ));
// D3: memory_flag ships enabled. The sink is the only
// seam through which a tool call can cause a write, and
// it goes through the S2 writer task like everything else.
diff --git a/crates/gaviero-tui/src/app/observers.rs b/crates/gaviero-tui/src/app/observers.rs
index e70b1ec2..da684a5b 100644
--- a/crates/gaviero-tui/src/app/observers.rs
+++ b/crates/gaviero-tui/src/app/observers.rs
@@ -235,6 +235,45 @@ impl AcpObserver for TuiAcpObserver {
}
}
+/// The interactive half of the MCP server: `dsh:`'s `ask_user_question` parks a
+/// question here, on the same `Event::PermissionRequest` path an in-process
+/// `AskUserQuestion` uses.
+///
+/// That reuse is the whole point — `PendingPermission::new` keys the overlay on
+/// the input *shape*, so the same card renders whether the question came from
+/// Claude, from gaviero's own agent loop, or from dsh over MCP. Nothing here
+/// re-renders or re-validates: the input is forwarded verbatim, because the
+/// overlay parses it.
+///
+/// The conversation id comes from the MCP request header rather than from this
+/// struct: one sink serves every connection, and the server resolves which chat
+/// asked. Sending fails only after the TUI has exited, and dropping the
+/// `respond` sender is the documented "cancelled" path — the parked MCP call
+/// then reports that the question was never answered.
+pub(super) struct TuiUserQuestionSink {
+ pub tx: mpsc::UnboundedSender,
+}
+
+impl gaviero_core::mcp::UserQuestionSink for TuiUserQuestionSink {
+ fn ask(
+ &self,
+ conv_id: &str,
+ input: &serde_json::Value,
+ respond: tokio::sync::oneshot::Sender,
+ ) {
+ let description = gaviero_core::ask_user::first_question(input)
+ .unwrap_or("Clarifying question")
+ .to_string();
+ let _ = self.tx.send(Event::PermissionRequest {
+ conv_id: conv_id.to_string(),
+ tool_name: gaviero_core::mcp::TOOL_ASK_USER_QUESTION.to_string(),
+ description,
+ input: input.clone(),
+ respond,
+ });
+ }
+}
+
/// A4: forwards `MemoryObserver` callbacks from the writer task to the
/// TUI event loop. Fires on every write the writer task processes, so
/// the memory panel's "Recently Written" section can refresh in real
@@ -458,4 +497,71 @@ mod tests {
);
assert_eq!(turns[0].summary.out_tokens_est, 1);
}
+
+ // ── dsh's MCP ask-user channel ───────────────────────────────────
+
+ fn ask_input() -> serde_json::Value {
+ serde_json::json!({
+ "questions": [{
+ "question": "Which database?",
+ "header": "DB",
+ "multiSelect": false,
+ "options": [
+ { "label": "Postgres", "description": "relational" },
+ { "label": "SQLite", "description": "embedded" }
+ ]
+ }]
+ })
+ }
+
+ #[tokio::test]
+ async fn user_question_sink_parks_the_question_on_the_right_conversation() {
+ use gaviero_core::mcp::UserQuestionSink as _;
+
+ let (tx, mut rx) = mpsc::unbounded_channel();
+ let sink = TuiUserQuestionSink { tx };
+ let (respond, answer) = tokio::sync::oneshot::channel();
+ sink.ask("conv-7", &ask_input(), respond);
+
+ let event = rx.try_recv().expect("the question must reach the event loop");
+ let Event::PermissionRequest {
+ conv_id,
+ tool_name,
+ description,
+ input,
+ respond,
+ } = event
+ else {
+ panic!("expected Event::PermissionRequest");
+ };
+ assert_eq!(conv_id, "conv-7");
+ assert_eq!(tool_name, gaviero_core::mcp::TOOL_ASK_USER_QUESTION);
+ // The overlay's one-line summary is the first question's text.
+ assert_eq!(description, "Which database?");
+ // Verbatim: the overlay parses this shape.
+ assert_eq!(input, ask_input());
+
+ respond
+ .send(gaviero_core::observer::PermissionDecision::allow())
+ .ok();
+ assert!(answer.await.is_ok(), "the answer must travel back");
+ }
+
+ #[tokio::test]
+ async fn a_closed_event_channel_cancels_the_parked_question() {
+ use gaviero_core::mcp::UserQuestionSink as _;
+
+ let (tx, rx) = mpsc::unbounded_channel();
+ drop(rx);
+ let sink = TuiUserQuestionSink { tx };
+ let (respond, answer) = tokio::sync::oneshot::channel();
+ sink.ask("conv-7", &ask_input(), respond);
+
+ // The failed send drops the whole event, `respond` included, which the
+ // parked MCP call reports as "cancelled" rather than hanging forever.
+ assert!(
+ answer.await.is_err(),
+ "a dropped sender must be observable as a cancel"
+ );
+ }
}
diff --git a/crates/gaviero-tui/src/panels/agent_chat.rs b/crates/gaviero-tui/src/panels/agent_chat.rs
index e802ebcc..f9b5afab 100644
--- a/crates/gaviero-tui/src/panels/agent_chat.rs
+++ b/crates/gaviero-tui/src/panels/agent_chat.rs
@@ -1999,9 +1999,9 @@ impl AgentChatState {
"claude:fable, claude:sonnet, claude:opus, claude:haiku, \
claude:opusplan, claude:sonnet[1m], claude:opus[1m], \
claude:claude-fable-5-2, claude:claude-opus-5-5, \
- codex:gpt-6.1-sol, codex:gpt-6-astra, codex:gpt-6.1-terra, \
- codex:gpt-6-sol, codex:gpt-6-luna, codex:gpt-5.6-sol, \
- codex:gpt-5.6-terra, codex:gpt-5.6-luna, \
+ codex:gpt-6.1-sol, codex:gpt-6-astra, codex:gpt-6-sol, \
+ codex:gpt-6-luna, codex:gpt-5.6-sol, codex:gpt-6.1-terra, \
+ codex:gpt-5.6-terra, codex:gpt-5.6-luna, codex:gpt-5.5, \
cursor:composer-2.5, cursor:grok-4.7-high, \
ollama:qwen2.5-coder:7b"
.to_string()
@@ -7493,7 +7493,9 @@ mod tests {
8_192
);
assert_eq!(state.context_limit_tokens_for("codex:gpt-5.6-sol"), 272_000);
- assert_eq!(state.context_limit_tokens_for("codex:gpt-6.1-sol"), 500_000);
+ assert_eq!(state.context_limit_tokens_for("codex:gpt-6.1-sol"), 272_000);
+ assert_eq!(state.context_limit_tokens_for("codex:gpt-6.1-terra"), 500_000);
+ assert_eq!(state.context_limit_tokens_for("codex:gpt-5.5"), 272_000);
assert_eq!(
state.context_limit_tokens_for("claude:sonnet[1m]"),
1_000_000
diff --git a/crates/gaviero-tui/src/session_host/render.rs b/crates/gaviero-tui/src/session_host/render.rs
index 9638e09e..056d194a 100644
--- a/crates/gaviero-tui/src/session_host/render.rs
+++ b/crates/gaviero-tui/src/session_host/render.rs
@@ -32,13 +32,14 @@ pub(crate) fn render_screen(screen: &vt100::Screen, area: Rect, buf: &mut Buffer
}
/// Badge palette, shared by both badges: green = working, yellow = waiting
-/// for the user, blue = finished while out of view. Pure hues at 80%
-/// brightness (204/255), so the three tell apart at a glance.
+/// for the user, blue = finished (a turn whose review is pending, or work
+/// that ended while the tab was out of view). Pure hues at 80% brightness
+/// (204/255), so the three tell apart at a glance.
const GREEN: Color = Color::Rgb(0, 204, 0);
const YELLOW: Color = Color::Rgb(204, 204, 0);
const BLUE: Color = Color::Rgb(0, 0, 204);
/// Agent badge (`A`): an agent or swarm is running / waits for the user (a
-/// permission, a question, a turn review) / finished while out of view.
+/// permission, a question) / finished, its turn review included.
const AGENT_LETTER: char = 'A';
const AGENT_RUNNING: Color = GREEN;
const AGENT_WAITING: Color = YELLOW;
@@ -60,7 +61,9 @@ pub(crate) fn tab_titles(host: &Host) -> Vec<(String, bool, TabKind)> {
/// The colours of a tab's two badges: the agent one, then the shell one.
/// The current tab shows them too; its "finished" marks stay until the user
-/// leaves it.
+/// leaves it. A pending turn review is finished, not waiting: the turn is
+/// over, so it is blue like work that ended out of view (a running agent
+/// still wins, the tab being busy).
pub(crate) fn badges(
activity: Activity,
agent_done_unseen: bool,
@@ -70,7 +73,7 @@ pub(crate) fn badges(
Some(AGENT_WAITING)
} else if activity.agent {
Some(AGENT_RUNNING)
- } else if agent_done_unseen {
+ } else if activity.review || agent_done_unseen {
Some(AGENT_DONE)
} else {
None
@@ -261,7 +264,7 @@ mod tests {
#[test]
fn badges_show_agent_and_shell_state() {
let none = Activity::default();
- let running = Activity { waiting: false, agent: true, shell: true, shell_waiting: false };
+ let running = Activity { agent: true, shell: true, ..none };
let asking = Activity { waiting: true, ..running };
assert_eq!(badges(none, false, false), [None, None]);
assert_eq!(
@@ -270,9 +273,14 @@ mod tests {
);
// Waiting for the user wins over running.
assert_eq!(badges(asking, false, false)[0], Some(AGENT_WAITING));
- // A turn review pending after the turn: waiting, not finished.
- let review = Activity { waiting: true, ..none };
- assert_eq!(badges(review, true, false), [Some(AGENT_WAITING), None]);
+ // A turn review pending after the turn: finished, so blue.
+ let review = Activity { review: true, ..none };
+ assert_eq!(badges(review, false, false), [Some(AGENT_DONE), None]);
+ // A running agent still wins over a pending review.
+ assert_eq!(
+ badges(Activity { review: true, ..running }, false, false)[0],
+ Some(AGENT_RUNNING)
+ );
// Finished while out of view.
assert_eq!(badges(none, true, true), [Some(AGENT_DONE), Some(SHELL_DONE)]);
// Running again wins over an earlier finish.
diff --git a/crates/gaviero-tui/src/session_host/session.rs b/crates/gaviero-tui/src/session_host/session.rs
index 3769f22c..1a68ba72 100644
--- a/crates/gaviero-tui/src/session_host/session.rs
+++ b/crates/gaviero-tui/src/session_host/session.rs
@@ -46,9 +46,13 @@ impl vt100::Callbacks for TitleCb {
/// its tab (`render::tab_badges`).
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
pub(crate) struct Activity {
- /// Waiting for the user: a permission prompt, an agent's question or a
- /// pending turn review (`attention`).
+ /// Waiting for the user to continue the turn: a permission prompt or an
+ /// agent's question (`attention`).
pub waiting: bool,
+ /// A turn finished and its review awaits decisions (`review`). The turn
+ /// itself is done — the user can continue whenever — so the tab shows the
+ /// finished colour, not the waiting one.
+ pub review: bool,
/// An agent or a swarm script is running.
pub agent: bool,
/// A command is running in one of the session's shells.
@@ -70,6 +74,8 @@ pub(crate) fn parse_activity(title: Option<&str>) -> Activity {
let shell = has("terminal");
Activity {
waiting: status == "attention",
+ // Reported beside the work keywords, so it is not `attention`.
+ review: has("review"),
agent: agent || (status == "busy" && !shell),
shell,
shell_waiting: shell && has("shell-input"),
@@ -447,51 +453,62 @@ mod tests {
#[test]
fn activity_parses_from_the_title() {
let activity = |t| parse_activity(Some(t));
- assert_eq!(activity("gaviero-session:idle"), Activity::default());
- assert_eq!(activity("gaviero-session:other"), Activity::default());
- assert_eq!(parse_activity(Some("vim")), Activity::default());
- assert_eq!(parse_activity(None), Activity::default());
+ let none = Activity::default();
+ assert_eq!(activity("gaviero-session:idle"), none);
+ assert_eq!(activity("gaviero-session:other"), none);
+ assert_eq!(parse_activity(Some("vim")), none);
+ assert_eq!(parse_activity(None), none);
assert_eq!(
activity("gaviero-session:busy:agent,terminal"),
- Activity { waiting: false, agent: true, shell: true, shell_waiting: false }
+ Activity { agent: true, shell: true, ..none }
);
assert_eq!(
activity("gaviero-session:busy:swarm,unsaved"),
- Activity { waiting: false, agent: true, shell: false, shell_waiting: false }
+ Activity { agent: true, ..none }
);
assert_eq!(
activity("gaviero-session:busy:terminal"),
- Activity { waiting: false, agent: false, shell: true, shell_waiting: false }
+ Activity { shell: true, ..none }
);
// A permission prompt or question while the agent runs.
assert_eq!(
activity("gaviero-session:attention:agent"),
- Activity { waiting: true, agent: true, shell: false, shell_waiting: false }
+ Activity { waiting: true, agent: true, ..none }
+ );
+ // Waiting with no agent running (a question with other detail).
+ assert_eq!(
+ activity("gaviero-session:attention:unsaved"),
+ Activity { waiting: true, ..none }
+ );
+ // A pending turn review after the turn: review, not waiting.
+ assert_eq!(
+ activity("gaviero-session:idle:review"),
+ Activity { review: true, ..none }
);
- // A pending turn review after the turn.
+ // A review pending while another turn runs keeps both facts.
assert_eq!(
- activity("gaviero-session:attention"),
- Activity { waiting: true, agent: false, shell: false, shell_waiting: false }
+ activity("gaviero-session:busy:agent,review"),
+ Activity { agent: true, review: true, ..none }
);
// An older child: busy, no detail.
assert_eq!(
activity("gaviero-session:busy"),
- Activity { waiting: false, agent: true, shell: false, shell_waiting: false }
+ Activity { agent: true, ..none }
);
// Unsaved files alone are no activity.
- assert_eq!(activity("gaviero-session:idle:unsaved"), Activity::default());
+ assert_eq!(activity("gaviero-session:idle:unsaved"), none);
// A shell command waiting for the user.
assert_eq!(
activity("gaviero-session:busy:terminal,shell-input"),
- Activity { waiting: false, agent: false, shell: true, shell_waiting: true }
+ Activity { shell: true, shell_waiting: true, ..none }
);
// `shell-input` without a running command means nothing.
- assert_eq!(activity("gaviero-session:idle:shell-input"), Activity::default());
+ assert_eq!(activity("gaviero-session:idle:shell-input"), none);
}
#[test]
fn work_that_ends_is_reported_finished() {
- let both = Activity { waiting: false, agent: true, shell: true, shell_waiting: false };
+ let both = Activity { agent: true, shell: true, ..Activity::default() };
let none = Activity::default();
assert_eq!(finished(both, none), (true, true));
assert_eq!(finished(none, both), (false, false));
@@ -499,8 +516,8 @@ mod tests {
let shell_only = Activity { agent: false, ..both };
assert_eq!(finished(both, shell_only), (true, false));
// The turn ends into a turn review: the agent finished.
- let review = Activity { waiting: true, agent: false, shell: false, shell_waiting: false };
- assert_eq!(finished(both, review), (true, true));
+ let turn_review = Activity { review: true, ..none };
+ assert_eq!(finished(both, turn_review), (true, true));
}
#[test]