fix: address findings from the full Docker evaluation of main

Critical and high:
- repos: unlinking a local repo removes only the Manager reference and alias,
  never the repository files; confirm button reads "Unlink"
- auth: rate-limit by the socket address; trust proxy headers only when
  AUTH_TRUSTED_PROXY_HEADERS is set (documented and forwarded in compose)
- composer: per-session in-memory drafts (text, bash mode, attachments);
  Escape no longer clears the prompt
- url params: compose same-tick updates so schedule dialogs stay closed after
  create/delete; delete dialog names the job

Medium:
- tool rows show failures (non-zero shell exit, failed exploration members)
- voice conversation shows the specific error and a starting state
- settings: Escape in dropdowns and the shortcut recorder no longer closes
  the dialog; mobile deep links open the requested section; one content tree
  per platform
- closing pushed sheets, settings, tool panels and schedule dialogs goes back
  in history
- login returns to the requested page; signed-out pages make no
  authenticated requests
- action terminals keep their output (Manager-side output capture and replay)
- unpushed-commit detection, commit message kept on failure
- binary files with unknown extensions are detected and not editable
- tool panel resizes when docked and floats as a dismissible sheet when the
  page is too narrow
- Docker image runs tini as PID 1

Low: not-found states, add-repo and branch validation errors (4xx),
search-aware empty states, mobile repo sort/filter/select cues, sidebar
resize affordance and collapse shortcut, mobile unread badge, preview port
filtering, terminal close handling, walkthrough empty state and helper
session filtering, placeholder contrast, permission labels and focus,
TTS task-list sanitizing, git identity email validation, quieter git
logging, hermetic worktree tests, and accessible names for icon-only
controls.
This commit is contained in:
ioplex committed 2026-10-23 11:42:37 -04:00
1 parent 1c22ef6ea1
commit 4ec62cd4e7
191 files changed
+6674 -696

No files matched your search

@@ -16,6 +16,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { LOCAL_OPENCODE_SERVER_ID } from '@opencode-manager/shared/schemas'
import { MobileTabBar } from './MobileTabBar'
import { useMobile } from '@/hooks/useMobile'
import { useUnreadScheduleRuns } from '@/hooks/useSchedules'
import { useSidebarServerStore } from '@/stores/sidebarServerStore'
function LocationSpy() {
@@ -27,6 +28,9 @@ describe('MobileTabBar', () => {
beforeEach(() => {
vi.clearAllMocks()
localStorage.clear()
vi.mocked(useUnreadScheduleRuns).mockReturnValue(
{ data: undefined } as unknown as ReturnType<typeof useUnreadScheduleRuns>,
)
useSidebarServerStore.setState({ serverId: LOCAL_OPENCODE_SERVER_ID })
})
@@ -420,4 +424,43 @@ describe('MobileTabBar', () => {
expect(container.firstChild).toBeNull()
})
it('shows the unread schedule indicator on More when the Schedules tab is replaced by Git', () => {
vi.mocked(useMobile).mockReturnValue(true)
vi.mocked(useUnreadScheduleRuns).mockReturnValue({
data: { total: 2, runs: [] },
} as unknown as ReturnType<typeof useUnreadScheduleRuns>)
const queryClient = new QueryClient()
render(
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={['/repos/123']}>
<MobileTabBar />
</MemoryRouter>
</QueryClientProvider>,
)
expect(screen.queryByText('Schedules')).not.toBeInTheDocument()
expect(screen.getByRole('button', { name: 'More' }).querySelector('[data-unread-badge]')).not.toBeNull()
expect(screen.getByRole('button', { name: 'Git' }).querySelector('[data-unread-badge]')).toBeNull()
})
it('keeps the unread schedule indicator on Schedules and off More when that tab is shown', () => {
vi.mocked(useMobile).mockReturnValue(true)
vi.mocked(useUnreadScheduleRuns).mockReturnValue({
data: { total: 1, runs: [] },
} as unknown as ReturnType<typeof useUnreadScheduleRuns>)
const queryClient = new QueryClient()
render(
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={['/']}>
<MobileTabBar />
</MemoryRouter>
</QueryClientProvider>,
)
expect(screen.getByRole('button', { name: 'Schedules' }).querySelector('[data-unread-badge]')).not.toBeNull()
expect(screen.getByRole('button', { name: 'More' }).querySelector('[data-unread-badge]')).toBeNull()
})
})
@@ -159,6 +159,7 @@ function buildGlobalTabs({ pathname, openSheet, open, close, navigate, isInsideR
icon: Menu,
onClick: () => open('more'),
active: openSheet === 'more',
badge: !showsSchedules && unreadScheduleCount > 0,
},
]
}
@@ -213,7 +214,11 @@ const TabBarRow = memo(function TabBarRow({ tabs }: TabBarRowProps) {
<div className="relative">
<Icon className="w-5 h-5" />
{tab.badge && (
<span className="absolute -top-0.5 -right-1 w-2 h-2 rounded-full bg-highlight ring-2 ring-card animate-pulse" />
<span
aria-hidden="true"
data-unread-badge
className="absolute -top-0.5 -right-1 w-2 h-2 rounded-full bg-highlight ring-2 ring-card animate-pulse"
/>
)}
</div>
<span className="leading-none">{tab.label}</span>
@@ -229,7 +229,7 @@ describe('MoreDrawer', () => {
renderMoreDrawer({ onClose: handleClose })
fireEvent.click(screen.getByText('Settings'))
expect(navigateMock).toHaveBeenCalledWith(
{ search: 'settings=open&settingsTab=account' },
{ search: 'settings=open' },
{ replace: true },
)
})
@@ -332,7 +332,10 @@ describe('MoreDrawer', () => {
fireEvent.click(screen.getByText('Repos'))
expect(navigateMock).toHaveBeenCalledWith({ search: 'mobileTab=repos' }, { replace: false })
expect(navigateMock).toHaveBeenCalledWith(
{ search: 'mobileTab=repos' },
{ state: { urlParamHistory: { previousSearch: '?mobileTab=more' } } },
)
})
it('keeps Home and hides the Repos row outside a session', () => {
@@ -110,7 +110,7 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) {
updateParams((p) => {
p.delete('mobileTab')
p.set('settings', 'open')
p.set('settingsTab', 'account')
p.delete('settingsTab')
}, 'replace')
}
@@ -5,6 +5,7 @@ import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { RepoQuickSwitchSheet } from './RepoQuickSwitchSheet'
import { getRepoSiblings, listRepos } from '@/api/repos'
import { stubMatchMedia } from '@/test/test-utils'
import { listProjects, type OpenCodeProject } from '@/api/opencode'
import { useMobileTabBar } from '@/hooks/useMobileTabBar'
import { ASSISTANT_REPO_ID } from '@opencode-manager/shared/utils'
@@ -236,6 +237,7 @@ describe('RepoQuickSwitchSheet', () => {
activityMocks.useActivityWindowMinutes.mockReturnValue(30)
setActivityGroups({})
setLinkedServers([])
stubMatchMedia(true)
})
it('renders with loading state', async () => {
@@ -246,7 +248,7 @@ describe('RepoQuickSwitchSheet', () => {
{ wrapper: createWrapper() },
)
await waitFor(() => {
expect(screen.getByPlaceholderText('Search projects...')).toBeInTheDocument()
expect(screen.getByPlaceholderText('Search repos...')).toBeInTheDocument()
})
})
@@ -294,7 +296,7 @@ describe('RepoQuickSwitchSheet', () => {
expect(screen.getByText('repo1')).toBeInTheDocument()
expect(screen.getByText('repo2')).toBeInTheDocument()
})
const input = screen.getByPlaceholderText('Search projects...')
const input = screen.getByPlaceholderText('Search repos...')
fireEvent.change(input, { target: { value: 'repo1' } })
await waitFor(() => {
expect(screen.getByText('repo1')).toBeInTheDocument()
@@ -773,7 +775,7 @@ describe('RepoQuickSwitchSheet', () => {
render(<RepoQuickSwitchSheet isOpen onClose={vi.fn()} />, { wrapper: createWrapper() })
const input = await screen.findByPlaceholderText('Search projects...')
const input = await screen.findByPlaceholderText('Search repos...')
await waitFor(() => expect(screen.getByText('repo2')).toBeInTheDocument())
expect(screen.queryByLabelText('Clear search')).toBeNull()
@@ -927,7 +929,7 @@ describe('RepoQuickSwitchSheet', () => {
expect(await screen.findByRole('heading', { name: 'Activity' })).toBeInTheDocument()
fireEvent.change(screen.getByPlaceholderText('Search projects...'), { target: { value: 'repo' } })
fireEvent.change(screen.getByPlaceholderText('Search repos...'), { target: { value: 'repo' } })
expect(screen.queryByRole('heading', { name: 'Activity' })).toBeNull()
expect(screen.queryByText('Session s1')).toBeNull()
@@ -1093,4 +1095,34 @@ describe('RepoQuickSwitchSheet', () => {
)
expect(handleClose).toHaveBeenCalled()
})
it('leaves the search input unfocused on touch screens so the keyboard stays closed', async () => {
vi.mocked(listRepos).mockResolvedValue([createRepo(1, 'repo1', '/path/to/repo1')])
stubMatchMedia(false)
render(<RepoQuickSwitchSheet isOpen onClose={vi.fn()} />, { wrapper: createWrapper() })
const input = await screen.findByPlaceholderText('Search repos...')
expect(input).not.toHaveFocus()
})
it('focuses the search input when a fine pointer is available', async () => {
vi.mocked(listRepos).mockResolvedValue([createRepo(1, 'repo1', '/path/to/repo1')])
stubMatchMedia(true)
render(<RepoQuickSwitchSheet isOpen onClose={vi.fn()} />, { wrapper: createWrapper() })
const input = await screen.findByPlaceholderText('Search repos...')
await waitFor(() => expect(input).toHaveFocus())
})
it('uses project wording for the search placeholder when a linked server is selected', async () => {
vi.mocked(listRepos).mockResolvedValue([createRepo(1, 'repo1', '/path/to/repo1')])
vi.mocked(listProjects).mockResolvedValue([createProject('p1', 'Alpha', '/projects/alpha')])
useSidebarServerStore.setState({ serverId: 'srv_kitchen' })
render(<RepoQuickSwitchSheet isOpen onClose={vi.fn()} />, { wrapper: createWrapper() })
expect(await screen.findByPlaceholderText('Search projects...')).toBeInTheDocument()
})
})
@@ -2,6 +2,7 @@ import { useState, useMemo } from 'react'
import { useNavigate, useLocation } from 'react-router-dom'
import { LOCAL_OPENCODE_SERVER_ID } from '@opencode-manager/shared/schemas'
import { useRefreshOnOpen } from '@/hooks/useRefreshOnOpen'
import { FINE_POINTER_MEDIA_QUERY, useMediaQuery } from '@/hooks/useMediaQuery'
import { Input } from '@/components/ui/input'
import { BottomSheet, BottomSheetHeader, BottomSheetContent } from '@/components/ui/bottom-sheet'
import { Button } from '@/components/ui/button'
@@ -32,6 +33,7 @@ export function RepoQuickSwitchSheet({ isOpen, onClose }: RepoQuickSwitchSheetPr
const [selectedServerId] = useSidebarServerSelection()
const isRemote = selectedServerId !== LOCAL_OPENCODE_SERVER_ID
const activeRepoId = getActiveRepoId(location.pathname)
const hasFinePointer = useMediaQuery(FINE_POINTER_MEDIA_QUERY)
const { repos, isLoading, refetch } = useNavigableRepos(isOpen)
@@ -76,10 +78,10 @@ export function RepoQuickSwitchSheet({ isOpen, onClose }: RepoQuickSwitchSheetPr
<div className="relative flex-1">
<Input
type="text"
placeholder="Search projects..."
placeholder={isRemote ? 'Search projects...' : 'Search repos...'}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
autoFocus
autoFocus={hasFinePointer}
className="pr-9"
autoComplete="off"
name="repo-quick-switch"
@@ -36,6 +36,9 @@ vi.mock('@/components/terminal/TerminalPanel', () => ({
TerminalWorkspace: ({ onLastTerminalExited }: { onLastTerminalExited?: () => void }) => (
<div>
terminal-tool
<div className="xterm">
<textarea aria-label="terminal input" />
</div>
<button type="button" onClick={onLastTerminalExited}>Exit last terminal</button>
</div>
),
@@ -100,6 +103,14 @@ function search(): URLSearchParams {
return new URLSearchParams(screen.getByTestId('search').textContent ?? '')
}
function stubNarrowPage(): () => void {
const main = document.createElement('main')
main.getBoundingClientRect = () =>
({ width: 560, height: 800, top: 0, left: 0, right: 560, bottom: 800, x: 0, y: 0, toJSON: () => ({}) }) as DOMRect
document.body.append(main)
return () => main.remove()
}
const WINDOW_MINUTES = 30
const NOW = Date.now()
@@ -276,6 +287,137 @@ describe('ToolSidePanel', () => {
await waitFor(() => expect(search().has('panel')).toBe(false))
})
it('renders the panel as a modal sheet over the page when docking would squeeze it', async () => {
const removePage = stubNarrowPage()
try {
renderAt('?panel=files')
const panel = await screen.findByRole('dialog', { name: 'Files' })
const backdrop = screen.getByTestId('tool-panel-backdrop')
expect(panel.className).toContain('fixed')
expect(panel).toHaveAttribute('aria-modal', 'true')
expect(panel).not.toHaveAttribute('style')
expect(panel.className).toContain('z-50')
expect(backdrop.className).toContain('z-50')
expect(backdrop).toHaveAttribute('aria-hidden', 'true')
expect(screen.queryByRole('separator', { name: 'Resize panel' })).not.toBeInTheDocument()
} finally {
removePage()
}
})
it('portals the floating overlay into the document body so page stacking contexts cannot cover it', async () => {
const removePage = stubNarrowPage()
try {
renderAt('?panel=files')
const panel = await screen.findByRole('dialog', { name: 'Files' })
const backdrop = screen.getByTestId('tool-panel-backdrop')
expect(panel.parentElement).toBe(document.body)
expect(backdrop.parentElement).toBe(document.body)
expect(backdrop.className).toContain('inset-y-0')
} finally {
removePage()
}
})
it('moves focus into the floating panel and returns it to the rail on close', async () => {
const user = userEvent.setup()
const removePage = stubNarrowPage()
try {
renderAt('')
const filesButton = screen.getByRole('button', { name: 'Files' })
await user.click(filesButton)
const panel = await screen.findByRole('dialog', { name: 'Files' })
await waitFor(() => expect(document.activeElement).toBe(panel))
await user.keyboard('{Escape}')
await waitFor(() => expect(screen.queryByRole('dialog', { name: 'Files' })).not.toBeInTheDocument())
await waitFor(() => expect(document.activeElement).toBe(filesButton))
expect(search().has('panel')).toBe(false)
} finally {
removePage()
}
})
it('closes the floating panel on Escape and on an outside click', async () => {
const user = userEvent.setup()
const removePage = stubNarrowPage()
try {
renderAt('?panel=files')
await screen.findByRole('dialog', { name: 'Files' })
await user.keyboard('{Escape}')
await waitFor(() => expect(search().has('panel')).toBe(false))
await user.click(screen.getByRole('button', { name: 'Files' }))
await screen.findByRole('dialog', { name: 'Files' })
await user.click(screen.getByTestId('tool-panel-backdrop'))
await waitFor(() => expect(search().has('panel')).toBe(false))
} finally {
removePage()
}
})
it('keeps the floating terminal open on Escape typed into the terminal', async () => {
const user = userEvent.setup()
const removePage = stubNarrowPage()
try {
renderAt('?panel=terminal&terminal=pty-1')
await screen.findByRole('dialog', { name: 'Terminal' })
const terminalInput = screen.getByLabelText('terminal input')
await user.click(terminalInput)
await user.keyboard('{Escape}')
expect(screen.getByRole('dialog', { name: 'Terminal' })).toBeInTheDocument()
expect(search().get('panel')).toBe('terminal')
} finally {
removePage()
}
})
it('keeps a docked panel open on Escape', async () => {
const user = userEvent.setup()
renderAt('?panel=files')
await screen.findByRole('complementary', { name: 'Files' })
await user.keyboard('{Escape}')
expect(search().get('panel')).toBe('files')
})
it('resizes the docked panel from the keyboard and clamps it', async () => {
const user = userEvent.setup()
renderAt('?panel=files')
const handle = await screen.findByRole('separator', { name: 'Resize panel' })
const panel = screen.getByRole('complementary', { name: 'Files' })
expect(panel.parentElement).not.toBe(document.body)
const initial = Number(handle.getAttribute('aria-valuenow'))
handle.focus()
await user.keyboard('{ArrowRight}')
expect(Number(handle.getAttribute('aria-valuenow'))).toBe(initial - 16)
expect(panel).toHaveStyle({ width: `${initial - 16}px` })
await user.keyboard('{Home}')
expect(Number(handle.getAttribute('aria-valuenow'))).toBe(320)
expect(panel).toHaveStyle({ width: '320px' })
})
it('opens non-panel session items from the rail as dialogs', async () => {
const user = userEvent.setup()
renderAt('?panel=files')
@@ -1,5 +1,6 @@
import { useEffect, useRef } from 'react'
import type { ReactNode } from 'react'
import { useCallback, useEffect, useRef } from 'react'
import type { ReactNode, RefObject } from 'react'
import { createPortal } from 'react-dom'
import { X } from 'lucide-react'
import { useLocation, useNavigate } from 'react-router-dom'
import { FileBrowser } from '@/components/file-browser/FileBrowser'
@@ -32,15 +33,138 @@ import { useActiveWorkCounts, useActivityWindowMinutes } from '@/hooks/useActive
import { formatActivityWindow } from '@/lib/activeWork'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TOOLTIP_OPEN_DELAY_MS } from '@/components/ui/tooltip'
import { restoreOverlayFocus } from '@/lib/overlayFocus'
import { useRestoreFocusOnClose } from '@/hooks/useRestoreFocusOnClose'
import { cn } from '@/lib/utils'
import { useToolPanelLayout, useToolPanelWidth } from '@/hooks/useToolPanelLayout'
import { isLocalOpenCodeServer, useRouteOpenCodeServerId } from '@/contexts/OpenCodeServerContext'
const PANEL_WIDTH_CLASSES: Partial<Record<PanelTool, string>> = {
activity: 'w-80',
}
interface PanelResizeState {
pointerId: number
startX: number
startWidth: number
}
interface PanelResizeHandleProps {
width: number
minWidth: number
maxWidth: number
onWidthChange: (width: number) => void
}
function PanelResizeHandle({ width, minWidth, maxWidth, onWidthChange }: PanelResizeHandleProps) {
const dragRef = useRef<PanelResizeState | null>(null)
const handlePointerDown = useCallback(
(event: React.PointerEvent<HTMLDivElement>) => {
if (event.button !== 0) return
event.preventDefault()
event.currentTarget.setPointerCapture?.(event.pointerId)
dragRef.current = { pointerId: event.pointerId, startX: event.clientX, startWidth: width }
},
[width],
)
const handlePointerMove = useCallback(
(event: React.PointerEvent<HTMLDivElement>) => {
const drag = dragRef.current
if (!drag || drag.pointerId !== event.pointerId) return
onWidthChange(drag.startWidth - (event.clientX - drag.startX))
},
[onWidthChange],
)
const handlePointerEnd = useCallback((event: React.PointerEvent<HTMLDivElement>) => {
const drag = dragRef.current
if (!drag || drag.pointerId !== event.pointerId) return
if (event.currentTarget.hasPointerCapture?.(event.pointerId)) {
event.currentTarget.releasePointerCapture?.(event.pointerId)
}
dragRef.current = null
}, [])
const handleKeyDown = useCallback(
(event: React.KeyboardEvent<HTMLDivElement>) => {
const step = event.shiftKey ? 64 : 16
let nextWidth: number
switch (event.key) {
case 'ArrowLeft':
nextWidth = width + step
break
case 'ArrowRight':
nextWidth = width - step
break
case 'Home':
nextWidth = minWidth
break
case 'End':
nextWidth = maxWidth
break
default:
return
}
event.preventDefault()
onWidthChange(nextWidth)
},
[maxWidth, minWidth, onWidthChange, width],
)
return (
<div
role="separator"
aria-orientation="vertical"
aria-label="Resize panel"
tabIndex={0}
aria-valuenow={width}
aria-valuemin={minWidth}
aria-valuemax={maxWidth}
className="absolute inset-y-0 -left-1 z-10 w-2 cursor-col-resize touch-none bg-transparent hover:bg-highlight/30 focus-visible:bg-highlight/30 focus-visible:outline-none"
onPointerDown={handlePointerDown}
onPointerMove={handlePointerMove}
onPointerUp={handlePointerEnd}
onPointerCancel={handlePointerEnd}
onKeyDown={handleKeyDown}
/>
)
}
const REMOTE_TOOL_KEYS: ReadonlySet<string> = new Set(['activity', 'mcp', 'skills', 'source-control', 'terminal'])
/**
* Escape closes the floating panel, except while a nested menu is open or the terminal owns
* the key. Focus moving into the opener is handled by `useRestoreFocusOnClose`.
*/
function useFloatingPanelDismiss(
floating: boolean,
closePanel: () => void,
panelRef: RefObject<HTMLElement | null>,
) {
const closeRef = useRef(closePanel)
closeRef.current = closePanel
useEffect(() => {
if (!floating) return
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key !== 'Escape' || event.defaultPrevented) return
const target = event.target
if (target instanceof Element) {
if (target.closest('.xterm')) return
if (target.closest('[role="listbox"], [role="menu"]')) return
const dialog = target.closest('[role="dialog"]')
if (dialog !== null && dialog !== panelRef.current) return
}
closeRef.current()
}
document.addEventListener('keydown', handleKeyDown)
return () => document.removeEventListener('keydown', handleKeyDown)
}, [floating, panelRef])
}
function ActivityWindowLabel() {
const minutes = useActivityWindowMinutes()
return (
@@ -141,8 +265,10 @@ function RailButton({ item, active, onClick, indicator }: RailButtonProps) {
}
/**
* Desktop-only docked tool panel with its icon rail, rendered to the right of a page's content.
* The rail lists the current route's tool items; repo- and session-scoped tools render only when their context is given.
* Desktop-only tool panel with its icon rail, rendered to the right of a page's content. The panel
* docks when the page has room and otherwise floats over the page as a sheet, so the content keeps
* a usable width. The rail lists the current route's tool items; repo- and session-scoped tools
* render only when their context is given.
*/
export function ToolSidePanel({
panel,
@@ -167,7 +293,21 @@ export function ToolSidePanel({
const routeServerId = useRouteOpenCodeServerId()
const isRemoteRoute = !isLocalOpenCodeServer(routeServerId)
const railRef = useRef<HTMLElement>(null)
const panelRef = useRef<HTMLElement>(null)
const previousActiveToolRef = useRef(activeTool)
const panelWidth = useToolPanelWidth()
const { docked } = useToolPanelLayout()
const floating = activeTool !== null && !docked
useRestoreFocusOnClose(floating, panelRef)
useFloatingPanelDismiss(floating, closePanel, panelRef)
useEffect(() => {
if (!floating) return
const panelElement = panelRef.current
if (panelElement === null || panelElement.contains(document.activeElement)) return
panelElement.focus()
}, [floating])
useEffect(() => {
const previousTool = previousActiveToolRef.current
@@ -247,40 +387,73 @@ export function ToolSidePanel({
}
}
const panelContent =
const fixedWidthClass = activeTool ? PANEL_WIDTH_CLASSES[activeTool] : undefined
const panelBody =
activeTool && activeLabel ? (
<aside
aria-label={activeLabel}
className={cn(
'flex shrink-0 flex-col border-l border-border bg-background',
PANEL_WIDTH_CLASSES[activeTool] ?? 'w-[min(600px,45vw)]',
)}
>
<div className="flex shrink-0 items-center gap-2 border-b border-border px-3 py-2">
<div className="flex min-w-0 flex-1 items-baseline gap-2">
<h2 className="min-w-0 truncate text-sm font-semibold text-foreground">{activeLabel}</h2>
{activeTool === 'activity' ? <ActivityWindowLabel /> : null}
</div>
{activeTool === 'walkthrough' ? (
<>
<ChangesWalkthroughSourcePicker />
<ChangesWalkthroughCancel />
<ChangesWalkthroughRegenerate />
</>
) : null}
<button
type="button"
<>
{docked ? null : (
<div
data-testid="tool-panel-backdrop"
aria-hidden="true"
className="fixed inset-y-0 left-0 right-11 z-50 bg-black/50 backdrop-blur-sm"
onClick={closePanel}
aria-label="Close panel"
className="rounded-sm p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
>
<X className="h-4 w-4" />
</button>
</div>
<div className="flex min-h-0 flex-1 flex-col">{renderTool(activeTool)}</div>
</aside>
/>
)}
<aside
ref={panelRef}
aria-label={activeLabel}
role={docked ? undefined : 'dialog'}
aria-modal={docked ? undefined : true}
tabIndex={docked ? undefined : -1}
className={cn(
'flex flex-col border-l border-border bg-background outline-none',
docked
? 'relative shrink-0'
: 'fixed inset-y-0 right-11 z-50 w-[min(420px,calc(100vw-2.75rem))] pt-safe pb-safe shadow-2xl',
fixedWidthClass,
)}
style={docked && !fixedWidthClass ? { width: panelWidth.width } : undefined}
>
{docked && !fixedWidthClass ? (
<PanelResizeHandle
width={panelWidth.width}
minWidth={panelWidth.minWidth}
maxWidth={panelWidth.maxWidth}
onWidthChange={panelWidth.setWidth}
/>
) : null}
<div className="flex shrink-0 items-center gap-2 border-b border-border px-3 py-2">
<div className="flex min-w-0 flex-1 items-baseline gap-2">
<h2 className="min-w-0 truncate text-sm font-semibold text-foreground">{activeLabel}</h2>
{activeTool === 'activity' ? <ActivityWindowLabel /> : null}
</div>
{activeTool === 'walkthrough' ? (
<>
<ChangesWalkthroughSourcePicker />
<ChangesWalkthroughCancel />
<ChangesWalkthroughRegenerate />
</>
) : null}
<button
type="button"
onClick={closePanel}
aria-label="Close panel"
className="rounded-sm p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
>
<X className="h-4 w-4" />
</button>
</div>
<div className="flex min-h-0 flex-1 flex-col">{renderTool(activeTool)}</div>
</aside>
</>
) : null
const panelContent =
panelBody !== null && !docked && typeof document !== 'undefined'
? createPortal(panelBody, document.body)
: panelBody
return (
<>
{panelContent ? (