Sfoglia il codice sorgente

docs: plan console interaction state

Problem: the new collapsed sections and debug drawer control were present without handlers, leaving controls unreachable.\n\nRisk: presentation persistence must stay isolated from session snapshots and runtime requests.
zhenyu.hu 2 settimane fa
parent
commit
7b5b0fbb31
2 ha cambiato i file con 34 aggiunte e 0 eliminazioni
  1. 33 0
      docs/plans/todo-53.2-console-interaction-state.md
  2. 1 0
      docs/plans/todos.md

+ 33 - 0
docs/plans/todo-53.2-console-interaction-state.md

@@ -0,0 +1,33 @@
+# 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.

+ 1 - 0
docs/plans/todos.md

@@ -116,3 +116,4 @@
 | 52.13 | done | `docs/plans/todo-52.13-provider-cleanup-exception-priority.md` | Preserve active provider/cancellation exceptions when iterator cleanup also fails. | Provider failures and cancellation retain priority; cleanup failures propagate only when no earlier exception is active; timing attempts are still recorded. |
 | 53 | in_progress | `docs/plans/todo-53-professional-debug-console-ui.md` | Redesign the static UI as a professional debug console and make EventPrompt visibility/content follow invocation mode and selected tools. | Written design is approved; implementation verification covers focused static/WebSocket regressions, JS syntax, full pytest, and desktop/narrow browser QA. |
 | 53.1 | done | `docs/plans/todo-53.1-event-prompt-order-preservation.md` | Preserve the user-selected EventPrompt position while mode/tool refreshes still deduplicate and regenerate its content. | RED: `3 failed, 5 passed`; GREEN: focused `8 passed`, full WebSocket file `84 passed`; Node syntax and diff checks pass; behavior tests cover refresh, mode round trip, restore position, and duplicate cleanup. |
+| 53.2 | in_progress | `docs/plans/todo-53.2-console-interaction-state.md` | Make the new collapsible control sections and Audit/Usage drawer operable, persistent, and synchronized with session/mode status. | Tests prove initially hidden controls can be opened, the drawer can release workspace width, presentation state stays browser-only, and topbar labels follow runtime state. |