todo-53.2-console-interaction-state.md 2.0 KB

Todo 53.2: Console Interaction State

Problem

Commit fd9c31e introduced the professional console shell, but the new collapsed Agent Config/Snapshot sections and Hide Debug button have no JavaScript handlers. The intermediate UI therefore makes controls unreachable and cannot close the drawer.

Scope

  • Bind all .control-section-toggle buttons and update aria-expanded plus target hidden state.
  • Bind #toggle-debug-drawer, update #console-layout.debug-drawer-closed, drawer hidden, button text, and ARIA state.
  • Persist section and drawer preferences in a dedicated browser-only localStorage record.
  • Treat storage parse/write failures as non-fatal presentation failures.
  • Update #current-session-label and #current-mode-label from existing runtime state.
  • Keep presentation state out of workspace snapshots and WebSocket requests.
  • Preserve EventPrompt, active-turn, stale-socket, session, and backend contracts.

TDD Steps

  1. Add failing tests in tests/test_websocket_api.py that execute the interaction helpers with lightweight DOM/localStorage fakes, not only source substring checks.
  2. Confirm RED for unreachable sections/drawer and missing topbar synchronization.
  3. Add the smallest interaction state implementation to src/agent_lab/presentation/static/app.js.
  4. Verify bootstrap, mode refresh, session create/load/start, and session reset paths update topbar status.
  5. Run focused/full WebSocket tests, Node syntax, and diff checks.
  6. Commit and repeat specification plus code-quality review.

Acceptance

  • Agent Config and Snapshot can be expanded from their default collapsed state.
  • Drawer open/closed state changes layout and visibility consistently on desktop and narrow layouts.
  • Reload restores the last section/drawer preferences when storage is valid.
  • Invalid or unavailable storage does not block the runtime.
  • Topbar mode and abbreviated session labels stay current.
  • No console UI preference appears in request or snapshot payloads.