Skip to content

feat(chat): autoscroll, sub-agent auto-open, jump-to-bottom button#11

Merged
albanm merged 1 commit into
mainfrom
feat-auto-scroll-bottom
Jun 5, 2026
Merged

feat(chat): autoscroll, sub-agent auto-open, jump-to-bottom button#11
albanm merged 1 commit into
mainfrom
feat-auto-scroll-bottom

Conversation

@BatLeDev
Copy link
Copy Markdown
Member

@BatLeDev BatLeDev commented Jun 4, 2026

Move the chat transcript's autoscroll into the shared useAutoScrollBottom composable (@data-fair/lib-vue), make sub-agent panel auto-open deterministic, and add a jump-to-bottom button.

  • Autoscroll now lives in AgentChatMessages via the shared composable; the parent-driven scroll watchers (and messagesRef/defineExpose) are removed from AgentChat.vue.
  • The growth signal (streamedLength) counts parent text, tool-invocation chips, and nested sub-agent growth, so following keeps up while a sub-agent — not the parent message — is streaming.
  • Sub-agent panels hold per-message open state: while following, the active message auto-opens its latest panel (a newer sub-agent collapses the previous one); once the user scrolls up, panel state is left untouched.
  • A jump-to-bottom button appears whenever the container isn't at the bottom. atBottom is tracked on scroll, on content growth, and via a ResizeObserver, so it stays correct when content height shrinks (a panel collapsing, a turn ending) without firing a scroll event.
  • Extracts pure helpers into auto-scroll.ts with 11 unit tests, hardens the e2e to assert auto-open/auto-close, and bumps @data-fair/lib-vue to ^1.28.1 (position-based stick-to-bottom fix; it adds an optional @vueuse/core peer, which is what re-marks the peer: true churn in package-lock.json).

Why: follow the streaming tail reliably (the old last-message-length signal froze during sub-agent delegation, and panel auto-open was flaky because it was gated on scroll state), and share the composable with processings' run log.

Regression risks:

  • Scroll behavior change: the transcript no longer force-scrolls to the bottom on every new message/content — it follows only while the user is at the bottom. Someone who scrolled up to read history is no longer yanked down.
  • AgentChat.vue no longer owns scroll logic or exposes messagesContainer — verified no other consumer referenced the ref.
  • openPanels is keyed by message index and only cleared while following is true; if the user is scrolled up when a new conversation loads, manually-opened panel state can carry over by index. Low impact.
  • New ResizeObserver on the scroll container and its content (disconnected on unmount) — double-check it doesn't fire excessively on very large transcripts.

@BatLeDev BatLeDev marked this pull request as draft June 4, 2026 15:38
@BatLeDev BatLeDev changed the title feat(chat): stick-to-bottom autoscroll and auto-open latest sub-agent panel feat(chat): stick-to-bottom autoscroll, auto-open latest sub-agent panel Jun 5, 2026
@github-actions github-actions Bot added feature and removed feature labels Jun 5, 2026
@BatLeDev BatLeDev changed the title feat(chat): stick-to-bottom autoscroll, auto-open latest sub-agent panel feat(chat): autoscroll, sub-agent auto-open, jump-to-bottom button Jun 5, 2026
@github-actions github-actions Bot added feature and removed feature labels Jun 5, 2026
Move the chat transcript's autoscroll into the shared useAutoScrollBottom
composable (@data-fair/lib-vue), make sub-agent panel auto-open deterministic,
and add a jump-to-bottom button.

- Autoscroll lives in AgentChatMessages via the shared composable; the
  parent-driven scroll watchers (and messagesRef/defineExpose) are removed
  from AgentChat.vue.
- The growth signal (streamedLength) counts parent text, tool-invocation chips,
  and nested sub-agent growth, so following keeps up while a sub-agent is
  streaming, not just when the parent message grows.
- Sub-agent panels hold per-message open state: while following, the active
  message auto-opens its latest panel (a newer sub-agent collapses the previous
  one); once the user scrolls up, panel state is left untouched.
- A jump-to-bottom button appears when the container isn't at the bottom;
  atBottom is tracked on scroll, on content growth, and via a ResizeObserver so
  it stays correct when content height shrinks without firing a scroll event.
- Extract pure helpers into auto-scroll.ts with 11 unit tests, harden the e2e to
  assert auto-open/auto-close, and bump @data-fair/lib-vue to ^1.28.1.
@BatLeDev BatLeDev force-pushed the feat-auto-scroll-bottom branch from 67e60c4 to b755170 Compare June 5, 2026 12:55
@albanm albanm marked this pull request as ready for review June 5, 2026 15:38
@albanm albanm merged commit c618c2a into main Jun 5, 2026
3 checks passed
@albanm albanm deleted the feat-auto-scroll-bottom branch June 5, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants