Files
DeepSeek-TUI/crates
Hunter Bown f77ff18255 feat(tui): the work surface sits under the composer by default (#5809)
* feat(tui): the work surface sits under the composer by default

Round 3 of the shell design (codewhale-ops/design/SHELL-DESIGN-20260901.md
§2.0): the bar's information — posture, agent roster, to-do — lives UNDER
the composer, so scrolling up reads as intentional history and nothing
paints above the stage by default.

- `WorkSurfacePlacement::Bottom`: a strip placement that shares Top's
  auto-fit height math (`is_strip()`) and row machinery; only its slot in
  the frame differs (after the composer, before the footer). Its divider
  is the strip's top edge, so a drag on it inverts Top's delta; the body
  starts one row below the divider so row hitboxes stay honest.
- `bottom` is the default (`work_surface_placement`, `WorkSurfaceState`,
  `/rail on`, the rail hotbar toggle and Ctrl+Alt+0 all restore it) and
  the fallback for unknown values. Narrow terminals keep Bottom; only the
  side rails still fall back to Top below the side-rail width.
- `/config work_surface_placement bottom` is accepted; the error text
  lists the five placements.

Upgrade note: the default for `work_surface_placement` changes from
`left` to `bottom`. Users who set it explicitly are untouched.

Legacy ui/sidebar/mouse test fixtures pin `Top` because they assert the
old strip-above-transcript geometry; the Bottom default has its own
coverage (`bottom_placement_draws_the_work_strip_under_the_composer`,
`rail_panels_render_in_all_placements` now includes Bottom).

No goldens changed: the startup goldens carry no work rows, so the strip
is zero-height in both placements.

Evidence:
  scripts/dev-test.sh tui (cargo test -p codewhale-tui --lib):
    test result: FAILED. 11848 passed; 3 failed; 13 ignored
    (the 3 — runtime_api::omitted_runtime_models_use_the_active_provider_default,
    runtime_threads::approval_required_awaits_external_decision_allow,
    sandbox::seatbelt::file_provider_synthetic_operations_are_independent_under_seatbelt —
    are unrelated to this change and pass in isolation:
    test result: ok. 3 passed; 0 failed)
  focused rerun after the last edits:
    test result: ok. 11 passed; 0 failed; 0 ignored
  cargo clippy --workspace --all-targets -D warnings (CI allows): clean
Signed-off-by: CodeWhale Bot <bot@codewhale.net>

* fix(tui): the bottom strip keeps every other frame slot in place

Buildkite 1535 on #5809: two cucumber PTY tests against the real binary
failed under the new Bottom default — at 40x12 a queued message had no
`Queued #1:` preview, and the plugin acceptance stage stayed blank.

Cause: the Bottom layout dropped the strip's leading slot and re-ordered
the constraint list, but the stage, workflow panel, pending-input preview
and background chip are addressed by fixed slot index (`body_chunks[1..4]`),
so under Bottom they drew into the wrong, zero-height slots.

Fix: one nine-slot layout in both placements. The strip owns a slot at
each end (above the stage for `top`, under the composer for `bottom`) and
only one has height, so every other slot keeps its index. The dual
constraint list is gone.

Test: `bottom_placement_keeps_the_stage_and_queued_preview_at_twelve_rows`
renders a 40x12 frame under Bottom with a transcript row and a queued
message and asserts both paint.

Evidence:
  cargo test -p codewhale-tui --all-features --locked --test cucumber -- \
    active_composer_pointer_submit_queues_without_provider \
    plugin_toml_binary_lifecycle_skill_and_stdio_mcp_acceptance
    test result: ok. 2 passed; 0 failed; 0 ignored
    (before the fix, the pointer test failed exactly as on Buildkite:
     "40x12: queued preview ... not visible after pointer submit")
  cargo test -p codewhale-tui --lib -- work_surface tui::ui::tests
    test result: ok. 808 passed; 0 failed; 0 ignored
  cargo test -p codewhale-tui --lib -- bottom_placement
    test result: ok. 3 passed; 0 failed; 0 ignored
  cargo clippy -p codewhale-tui --all-targets -D warnings (CI allows): clean
Signed-off-by: CodeWhale Bot <bot@codewhale.net>

---------

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
Co-authored-by: CodeWhale Bot <bot@codewhale.net>
2026-09-01 18:47:14 -07:00
..