Files
codewhale/docs/MODES.md
T
Hunter Bown 88c2a06024 fix(tui): default mouse capture off in JetBrains JediTerm (#878, #898)
JetBrains' JediTerm — the terminal embedded in PyCharm, IDEA, CLion,
WebStorm, GoLand, etc. — advertises mouse support but forwards SGR
mouse-event escape sequences as raw input characters rather than
interpreting them. Users see the composer auto-fill with garbled
characters when they move the mouse over the TUI window. The
workaround was already a one-flag fix (`--no-mouse-capture` or
`[tui] mouse_capture = false` in config) but discovering it required
finding a maintainer comment on a related issue.

Auto-detect via `TERMINAL_EMULATOR=JetBrains-JediTerm` (the env var
JediTerm sets) and default `mouse_capture` off for that environment,
mirroring the existing Windows handling. Explicit `--mouse-capture`
or `[tui] mouse_capture = true` still wins, so power users who don't
hit the issue can opt back in.

Implementation:
- `default_mouse_capture_enabled` now takes `terminal_emulator: Option<&str>`
  so the function is pure and trivially testable. The CLI entry point
  reads the env var once and passes it through.
- `should_use_mouse_capture` keeps the same public signature; tests
  call `should_use_mouse_capture_with` which takes the env explicitly,
  removing test sensitivity to the host's actual TERMINAL_EMULATOR.
- Match is `eq_ignore_ascii_case` because JetBrains has occasionally
  varied the casing across releases.

Tests:
- 4 new tests covering JetBrains default-off, case-insensitive match,
  CLI override, and config-file override.
- Existing 6 mouse-capture tests retained, all passing.
- `cargo test -p deepseek-tui --bin deepseek-tui --all-features
  terminal_mode_tests --locked` → 10/10 pass.
- `cargo clippy -p deepseek-tui --bins --all-features --locked --
  -D warnings` clean.
- `cargo fmt --all -- --check` clean.

Docs in `docs/MODES.md` and `docs/CONFIGURATION.md` updated.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-06 15:12:47 -05:00

4.2 KiB
Raw Blame History

Modes and Approvals

DeepSeek TUI has two related concepts:

  • TUI mode: what kind of visible interaction you're in (Plan/Agent/YOLO).
  • Approval mode: how aggressively the UI asks before executing tools.

TUI Modes

Press Tab to complete composer menus, queue a draft as a next-turn follow-up while a turn is running, or cycle through the visible modes when the composer is otherwise idle: Plan → Agent → YOLO → Plan. Press Shift+Tab to cycle reasoning effort.

  • Plan: design-first prompting. Read-only investigation tools stay available; shell and patch execution stay off. Use this when you want to think out loud and produce a plan to hand to a human (yourself later, or a reviewer).
  • Agent: multi-step tool use. Approvals for shell and paid tools (file writes are allowed without a prompt).
  • YOLO: enables shell + trust mode and auto-approves all tools. Use only in trusted repos.

All three modes have access to the rlm tool. Inside its Python REPL, llm_query_batched fans out 116 cheap parallel child calls pinned to deepseek-v4-flash. The model reaches for it when work is decomposable.

Compatibility Notes

  • /normal is a hidden compatibility alias that switches to Agent.
  • Older settings files with default_mode = "normal" still load as agent; saving rewrites the normalized value.

Escape Key Behavior

Esc is a cancel stack, not a mode switch.

  • Close slash menus or transient UI first.
  • Cancel the active request if a turn is running.
  • Discard a queued draft if the composer is empty.
  • Clear the current input if text is present.
  • Otherwise it is a no-op.

Approval Mode

You can override approval behavior at runtime:

/config
# edit the approval_mode row to: suggest | auto | never

Legacy note: /set approval_mode ... was retired in favor of /config.

  • suggest (default): uses the per-mode rules above.
  • auto: auto-approves all tools (similar to YOLO approval behavior, but without forcing YOLO mode).
  • never: blocks any tool that isn't considered safe/read-only.

Small-Screen Status Behavior

When terminal height is constrained, the status area compacts first so header/chat/composer/footer remain visible:

  • Loading and queued status rows are budgeted by available height.
  • Queued previews collapse to compact summaries when full previews do not fit.
  • /queue workflows remain available; compact status only affects rendering density.

Workspace Boundary and Trust Mode

By default, file tools are restricted to the --workspace directory. Enable trust mode to allow file access outside the workspace:

/trust

YOLO mode enables trust mode automatically.

MCP Behavior

MCP tools are exposed as mcp_<server>_<tool> and use the same approval flow as built-in tools. Read-only MCP helpers may auto-run in suggestive approval modes; MCP tools with possible side effects require approval.

See MCP.md.

Run deepseek --help for the canonical list. Common flags:

  • -p, --prompt <TEXT>: one-shot prompt mode (prints and exits)
  • --model <MODEL>: when using the deepseek facade, forward a DeepSeek model override to the TUI
  • --workspace <DIR>: workspace root for file tools
  • --yolo: start in YOLO mode
  • -r, --resume <ID|PREFIX|latest>: resume a saved session
  • -c, --continue: resume the most recent session in this workspace
  • --max-subagents <N>: clamp to 1..=20
  • --no-alt-screen: run inline without the alternate screen buffer
  • --mouse-capture / --no-mouse-capture: opt in or out of internal mouse scrolling, transcript selection, and right-click context actions. Mouse capture is enabled by default on non-Windows terminals so drag selection copies only user/assistant transcript text; hold Shift while dragging or use --no-mouse-capture for raw terminal selection. It defaults off on Windows (CMD/terminal mouse-escape spam in the prompt) and inside JetBrains JediTerm — PyCharm/IDEA/CLion/etc. — where the terminal advertises mouse support but forwards SGR mouse events as raw text (#878, #898). Use --mouse-capture to opt in anywhere it's defaulted off.
  • --profile <NAME>: select config profile
  • --config <PATH>: config file path
  • -v, --verbose: verbose logging