tui: minor correctness/perf fixes (Etap 5)
The last batch from the code review — real bugs and edge cases, not cosmetics:

- tui_app._resolve_session: read session_id with .get and return None when a
  malformed server response omits it, instead of KeyError slipping past the
  api-call except (5.B3).
- cli /switch: surface the original error cause (404 vs network vs server) on
  a non-unique prefix match instead of swallowing it into a generic "not found"
  (6.B2).
- input_box _complete_command: a bare "/" with no hint list available no longer
  auto-picks the first command in the registry (3.B3).
- filesystem _render_grep: when the grep ran in regex mode, highlight with the
  actual regex so marked spans match what the server found — a literal highlight
  of a regex pattern would mark nothing (2.B2).
- file_refs _collect_files: filter sensitive entries out in the generator before
  sorted() so a huge directory is not fully materialized only to be mostly
  discarded (5.P1).
- renderers/tool ToolResultRenderer: cap a generic tool result at 200 lines
  (tail + marker) so a non-filesystem tool with huge output does not flood the
  chat bubble — filesystem has its own renderer (2.P3).

Tests: malformed-response /switch error surfacing, bare-slash no-auto-pick,
grep regex highlight, sensitive-subdir skip, tool-result truncation. Full
suite: 953 passed, 1 skipped.
1 parent d2bdf4c commit efda6b46aa52baf4f50c1c9206c6e93bc98cb3bf
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored 2 hours ago
Showing 12 changed files
View
clients/terminal/cli.py
View
clients/terminal/tui/file_refs.py
View
clients/terminal/tui/renderers/filesystem.py
View
clients/terminal/tui/renderers/tool.py
View
clients/terminal/tui/tui_app.py
View
clients/terminal/tui/widgets/input_box.py
View
tests/clients/test_file_refs.py
View
tests/clients/test_filesystem_renderer.py
View
tests/clients/test_input_box.py
View
tests/clients/test_terminal_client.py
View
tests/clients/test_tool_result_renderer.py 0 → 100644
View
tests/clients/test_tui_app.py