Skip to content

Add a Gemini-style AI side panel and unify the dashboard's chat and buttons - #4

Merged
encoreshao merged 1 commit into
mainfrom
feature/ai-panel
Oct 4, 2026
Merged

encoreshao merged 1 commit into
mainfrom
feature/ai-panel

Conversation

@encoreshao

Copy link
Copy Markdown
Owner

Summary

A Gmail/Gemini-style assistant panel, available from every dashboard page, plus a consistency pass on the Dashboard chat and buttons.

AI side panel

  • Topbar AI button (first in the right-hand group) opens a rounded panel to the right of the main card; the main card shifts over to make room.
  • Resizable: drag the panel's left edge (320–720px), or use ←/→ (Shift for bigger steps) and Home/End; double-click resets to 400px. Below 720px it overlays instead and isn't resizable.
  • Persistent: open state, width and the panel's chat session survive page navigation and auto-refresh reloads (restored before first paint, so no flicker).
  • Page-aware prompts: each page offers its own 2–4 suggested prompts (e.g. Memory → "What has the loop learned so far?"). Read-only prompts send immediately; prompts that would start a run only pre-fill the composer.
  • Page context: POST /activity/chat accepts an optional page, so the assistant knows what the user is looking at. Only known nav keys are used; any other value is ignored.
  • Chat history inside the panel lists every session, whether started in the panel on any page or on the Dashboard, and reopens one in place.
  • Reuses the existing chat backend (/activity/chat + /activity/chat-stream SSE). No new state-changing routes.

Chat experience (panel and Dashboard)

  • Shared "Thinking…" indicator: an AI sparkle in a spinning gradient ring, a shimmering label and placeholder lines. Like .md-spinner, it's not gated behind prefers-reduced-motion, since it's the only sign a reply is coming.
  • Paced streaming reveal: the CLI often emits a short reply's deltas within ~1s after a long think, which read as "no streaming". Both chats now reveal received text progressively, catching up a burst in about 2 seconds, and swap in the saved markdown reply only after that. Hidden tabs and reduced-motion users get the text immediately.
  • Reply bubbles show the Loop X icon (and user bubbles "You") while streaming, not only after the reload.

Visual consistency

  • Dashboard History / New chat buttons, suggestion chips and hero links now use the global .btn .btn-neutral style.
  • Links carrying an icon align the glyph with their text (zero-specificity :where() rule, so component styles still win). The Dashboard announcement link uses an arrow icon instead of a text →.
  • Topbar right-group controls share a 40px height.
  • Fix: the empty Dashboard composer drifted off-center when the panel was open (a leftover right offset under position: relative).

i18n

All new strings are translated into Japanese, Simplified Chinese and French.

Test plan

  • python3 -m pytest tests/ -q: 1861 passed
  • New tests: panel markup and trigger, per-page prompts (coverage of every nav page, translations, icon subset, run prompts only pre-fill), page context in build_chat_prompt and the route, chats from any page landing in history, shared thinking indicator, reveal wiring, Dashboard .btn classes, composer centering, topbar control heights
  • Sandboxed dev server (LOOP_ENGINEERING_HOME scratch dir) driven with headless Chrome: open/close, drag and keyboard resize, persistence across navigation, history reopen, Escape handling, Japanese and narrow-viewport layouts, thinking → streaming → saved-reply transition. Chat requests were stubbed at the network layer, so no real messages were saved.

…uttons

- Topbar AI button opens a resizable right-side assistant panel on every
  page (drag or arrow-key resize, width/open state/session persisted),
  backed by the existing /activity/chat + SSE chat backend
- Page-specific suggested prompts; run-starting prompts only pre-fill.
  /activity/chat accepts an optional `page` so the assistant knows which
  dashboard page the user is on (known nav keys only)
- Chat history view inside the panel lists every session, from any page
  or the Dashboard, and reopens one in place
- Shared "Thinking..." indicator and paced reply reveal for both the
  panel and the Dashboard chat; reply bubbles carry the Loop X icon while
  streaming
- Dashboard buttons, chips and hero links use the global .btn style;
  links carrying an icon align it with their text; topbar controls share
  a 40px height with the AI button first in the right group
- Fix the empty Dashboard composer drifting off-center when the panel is
  open
- Japanese, Chinese and French translations for all new strings
@encoreshao
encoreshao merged commit 5b3c950 into main Oct 4, 2026
1 check passed
@encoreshao
encoreshao deleted the feature/ai-panel branch October 7, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant