The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): match HUD transcript rows with aui_message-group slot
KoNit-K84a07e7683ea
diff --git a/apps/desktop/src/app/hud/transcript-band.test.tsx b/apps/desktop/src/app/hud/transcript-band.test.tsxindex adbca1f01c7..e74ba1c4745 100644--- a/apps/desktop/src/app/hud/transcript-band.test.tsx+++ b/apps/desktop/src/app/hud/transcript-band.test.tsx@@ -1,12 +1,20 @@import { act, render } from '@testing-library/react'-import { useRef } from 'react'+import { type ReactNode, useRef } from 'react'import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import { stubResizeObserver } from '@/test/jsdom'import { useHudTranscriptBand } from './transcript-band'-function Harness({ withViewport }: { withViewport: boolean }) {+function Harness({+ children,+ withThreadContent = true,+ withViewport+}: {+ children?: ReactNode+ withThreadContent?: boolean+ withViewport: boolean+}) {const ref = useRef<HTMLDivElement | null>(null)useHudTranscriptBand(ref)@@ -16,15 +24,29 @@ function Harness({ withViewport }: { withViewport: boolean }) {<div data-slot="composer-dock" />{withViewport && (<div data-slot="aui_thread-viewport">- <div data-slot="aui_thread-content">- <div>row</div>- </div>+ {withThreadContent && <div data-slot="aui_thread-content">{children ?? <div>row</div>}</div>}</div>)}</div>)}+function bandHeight(container: HTMLElement): number {+ const root = container.firstElementChild as HTMLElement++ return Number.parseFloat(root.style.getPropertyValue('--hud-band-height') || '0')+}++function stubMeasuredRects() {+ vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(function (this: HTMLElement) {+ if (this.dataset.slot === 'composer-dock') {+ return { bottom: 768, height: 58, top: 710 } as DOMRect+ }++ return { bottom: 172, height: 72, top: 100 } as DOMRect+ })+}+beforeEach(() => {stubResizeObserver()vi.useFakeTimers()@@ -32,6 +54,7 @@ beforeEach(() => {afterEach(() => {vi.useRealTimers()+ vi.restoreAllMocks()})describe('useHudTranscriptBand', () => {@@ -61,4 +84,48 @@ describe('useHudTranscriptBand', () => {expect(muchLater).toBe(justAfterFound)})++ // TurnRow roots now carry data-slot="aui_message-group". The band must still+ // treat them as transcript rows; matching only *:not([data-slot]) leaves a+ // short session at --hud-band-height: 0px and clips the transcript.+ it('measures a TurnRow with data-slot="aui_message-group" as transcript height', () => {+ stubMeasuredRects()+ const { container } = render(+ <Harness withViewport>+ <div data-slot="aui_message-group">turn</div>+ </Harness>+ )++ expect(bandHeight(container)).toBeGreaterThan(0)+ })++ it('still measures slot-less direct children such as show-earlier', () => {+ stubMeasuredRects()+ const { container } = render(+ <Harness withViewport>+ <button type="button">Show earlier</button>+ </Harness>+ )++ expect(bandHeight(container)).toBeGreaterThan(0)+ })++ it('does not treat clearance or background-resume spacers as message rows', () => {+ stubMeasuredRects()+ const { container } = render(+ <Harness withViewport>+ <div data-slot="aui_background-resume">resume</div>+ <div data-slot="aui_composer-clearance" />+ </Harness>+ )++ expect(bandHeight(container)).toBe(0)+ })++ it('keeps an empty band when aui_thread-content is missing', () => {+ stubMeasuredRects()+ const { container } = render(<Harness withThreadContent={false} withViewport />)++ expect(bandHeight(container)).toBe(0)+ })})diff --git a/apps/desktop/src/app/hud/transcript-band.ts b/apps/desktop/src/app/hud/transcript-band.tsindex ddde46a2c63..83d9208126c 100644--- a/apps/desktop/src/app/hud/transcript-band.ts+++ b/apps/desktop/src/app/hud/transcript-band.ts@@ -49,7 +49,9 @@ export function useHudTranscriptBand(rootRef: RefObject<HTMLDivElement | null>):// rows only. Measuring to the viewport edge counted the full-window scroll// container (min-height: 100%) as transcript and painted a empty slab almost// the size of the HUD.- const rows = el?.querySelectorAll<HTMLElement>('[data-slot="aui_thread-content"] > *:not([data-slot])')+ const rows = el?.querySelectorAll<HTMLElement>(+ '[data-slot="aui_thread-content"] > [data-slot="aui_message-group"], [data-slot="aui_thread-content"] > *:not([data-slot])'+ )// Zero-height rows are not a transcript. A fresh thread still renders// scaffolding inside the content box (clearance, empty state), so