feat(chat): autoscroll, sub-agent auto-open, jump-to-bottom button#11
Merged
Conversation
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.
67e60c4 to
b755170
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move the chat transcript's autoscroll into the shared
useAutoScrollBottomcomposable (@data-fair/lib-vue), make sub-agent panel auto-open deterministic, and add a jump-to-bottom button.AgentChatMessagesvia the shared composable; the parent-driven scroll watchers (andmessagesRef/defineExpose) are removed fromAgentChat.vue.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.atBottomis tracked on scroll, on content growth, and via aResizeObserver, so it stays correct when content height shrinks (a panel collapsing, a turn ending) without firing a scroll event.auto-scroll.tswith 11 unit tests, hardens the e2e to assert auto-open/auto-close, and bumps@data-fair/lib-vueto^1.28.1(position-based stick-to-bottom fix; it adds an optional@vueuse/corepeer, which is what re-marks thepeer: truechurn inpackage-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:
AgentChat.vueno longer owns scroll logic or exposesmessagesContainer— verified no other consumer referenced the ref.openPanelsis keyed by message index and only cleared whilefollowingis true; if the user is scrolled up when a new conversation loads, manually-opened panel state can carry over by index. Low impact.ResizeObserveron the scroll container and its content (disconnected on unmount) — double-check it doesn't fire excessively on very large transcripts.