The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): the dimmed composer comes back after 5s without scrolling
Brooklyn Nicholson08165d589318
diff --git a/apps/desktop/src/components/assistant-ui/thread/list.tsx b/apps/desktop/src/components/assistant-ui/thread/list.tsxindex f458c54438b..19f97056788 100644--- a/apps/desktop/src/components/assistant-ui/thread/list.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/list.tsx@@ -151,6 +151,9 @@ const BACKFILL_STEP = 290// re-arming forever.const PARKED_OFFSET_MAX_PAGES = 96+// A reader parked this long has stopped scrolling past the composer; bring it back.+const COMPOSER_UNDIM_AFTER_STALL_MS = 5000+export const transcriptBackfillFrameCount = (firstPaint = FIRST_PAINT_BUDGET,step = BACKFILL_STEP,@@ -736,10 +739,33 @@ const ThreadMessageListInner: FC<ThreadMessageListProps> = ({const surfaceId = useComposerSurfaceId()const scrollSessionId = sessionId ?? surfaceId- useEffect(- () => publishThreadAtBottom(isAtBottom && !isHistorical, { paneVisible, sessionId: scrollSessionId }),- [isAtBottom, isHistorical, paneVisible, scrollSessionId]- )+ useEffect(() => {+ const atBottom = isAtBottom && !isHistorical+ const publisher = { paneVisible, sessionId: scrollSessionId }+ const el = scrollRef.current++ publishThreadAtBottom(atBottom, publisher)++ if (atBottom || !el) {+ return+ }++ let timer = 0++ const arm = () => {+ publishThreadAtBottom(false, publisher)+ clearTimeout(timer)+ timer = window.setTimeout(() => publishThreadAtBottom(false, publisher, false), COMPOSER_UNDIM_AFTER_STALL_MS)+ }++ arm()+ el.addEventListener('scroll', arm, { passive: true })++ return () => {+ clearTimeout(timer)+ el.removeEventListener('scroll', arm)+ }+ }, [isAtBottom, isHistorical, paneVisible, scrollRef, scrollSessionId])useEffect(() => () => resetPublishedThreadScroll({ paneVisible, sessionId: scrollSessionId }),[paneVisible, scrollSessionId]diff --git a/apps/desktop/src/store/thread-scroll.test.ts b/apps/desktop/src/store/thread-scroll.test.tsindex f6ef1f6dac9..3397e45d6a3 100644--- a/apps/desktop/src/store/thread-scroll.test.ts+++ b/apps/desktop/src/store/thread-scroll.test.ts@@ -26,6 +26,13 @@ describe('publishThreadAtBottom', () => {expect(Boolean($threadScrolledUpBySession.get()['session-a'])).toBe(true)})+ it('lets a stalled reader un-dim the composer while the jump pill stays', () => {+ publishThreadAtBottom(false, { paneVisible: true, sessionId: 'session-a' }, false)++ expect(Boolean($threadJumpButtonVisibleBySession.get()['session-a'])).toBe(true)+ expect(Boolean($threadScrolledUpBySession.get()['session-a'])).toBe(false)+ })+it('ignores stick-to-bottom misses from a hidden keep-alive pane', () => {setThreadAtBottom(true, 'session-a')diff --git a/apps/desktop/src/store/thread-scroll.ts b/apps/desktop/src/store/thread-scroll.tsindex a619258acae..18ee4d144fb 100644--- a/apps/desktop/src/store/thread-scroll.ts+++ b/apps/desktop/src/store/thread-scroll.ts@@ -55,8 +55,10 @@ function setSessionValue<T extends boolean | number>(target.set(next)}-export const setThreadAtBottom = (isAtBottom: boolean, sessionId: string | null = null) => {- setSessionValue($threadScrolledUpBySession, sessionId, !isAtBottom, false)+// `scrolledUp` dims the composer; it diverges from the jump pill once the reader+// stalls (see list.tsx), so the composer comes back while the pill stays.+export const setThreadAtBottom = (isAtBottom: boolean, sessionId: string | null = null, scrolledUp = !isAtBottom) => {+ setSessionValue($threadScrolledUpBySession, sessionId, scrolledUp, false)setSessionValue($threadJumpButtonVisibleBySession, sessionId, !isAtBottom, false)}@@ -67,13 +69,14 @@ export const resetThreadScroll = (sessionId: string | null = null) => {export const publishThreadAtBottom = (isAtBottom: boolean,- publisher: { paneVisible: boolean; sessionId?: string | null }+ publisher: { paneVisible: boolean; sessionId?: string | null },+ scrolledUp = !isAtBottom): void => {if (!publisher.paneVisible) {return}- setThreadAtBottom(isAtBottom, publisher.sessionId)+ setThreadAtBottom(isAtBottom, publisher.sessionId, scrolledUp)}export const resetPublishedThreadScroll = (publisher: { paneVisible: boolean; sessionId?: string | null }): void => {