Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
feat(web-app): responsive layout, overlay layers, mobile sidebar and Cowork side panels
Akarshan Biswas162ad5d36574
diff --git a/web-app/src/components/ai-elements/conversation-column.test.tsx b/web-app/src/components/ai-elements/conversation-column.test.tsxnew file mode 100644index 000000000..518883cef--- /dev/null+++ b/web-app/src/components/ai-elements/conversation-column.test.tsx@@ -0,0 +1,61 @@+import { render, screen } from '@testing-library/react'+import { createRef } from 'react'+import { describe, expect, it } from 'vitest'+import { ConversationColumn } from './conversation-column'+import { Conversation, ConversationContent } from './conversation'+import type { StickToBottomContext } from 'use-stick-to-bottom'++describe('conversation column alignment', () => {+ it('shares responsive message and composer border-edge geometry', () => {+ const { container } = render(+ <>+ <Conversation>+ <ConversationContent column data-testid="messages">Message</ConversationContent>+ </Conversation>+ <ConversationColumn reserveScrollGutter data-testid="composer">Composer</ConversationColumn>+ </>+ )+ const messages = screen.getByTestId('messages')+ const composer = screen.getByTestId('composer')+ for (const column of [messages, composer]) {+ expect(column).toHaveClass('mx-auto', 'w-full', 'max-w-[880px]', 'px-4', 'md:px-6')+ }+ const scrollViewport = messages.parentElement!+ const composerViewport = composer.parentElement!+ expect(composerViewport.style.scrollbarGutter).toBe(scrollViewport.style.scrollbarGutter)+ expect(composerViewport.style.scrollbarGutter).toBe('stable both-edges')+ expect(composerViewport.style.overflowY).toBe('hidden')+ // Reservation belongs outside the capped column, not as a fixed pixel inset.+ expect(composerViewport).not.toHaveClass('max-w-[880px]')+ expect(container.querySelectorAll('[style*="padding"]')).toHaveLength(0)+ })++ it('keeps library content and scroll refs on their original elements', () => {+ const contextRef = createRef<StickToBottomContext>()+ render(+ <Conversation contextRef={contextRef}>+ <ConversationContent column data-testid="content">Message</ConversationContent>+ </Conversation>+ )+ const content = screen.getByTestId('content')+ expect(contextRef.current?.contentRef.current).toBe(content)+ expect(contextRef.current?.scrollRef.current).toBe(content.parentElement)+ })++ it('preserves non-column consumers and passes composer refs through', () => {+ const ref = createRef<HTMLDivElement>()+ render(+ <>+ <Conversation>+ <ConversationContent data-testid="compact" className="px-3">Task</ConversationContent>+ </Conversation>+ <ConversationColumn ref={ref} className="pb-4" data-testid="home">Home</ConversationColumn>+ </>+ )+ expect(screen.getByTestId('compact')).toHaveClass('px-3')+ expect(screen.getByTestId('compact')).not.toHaveClass('max-w-[880px]')+ expect(ref.current).toBe(screen.getByTestId('home'))+ expect(ref.current).toHaveClass('pb-4')+ expect(ref.current?.parentElement?.style.scrollbarGutter).not.toBe('stable both-edges')+ })+})diff --git a/web-app/src/components/ai-elements/conversation-column.tsx b/web-app/src/components/ai-elements/conversation-column.tsxnew file mode 100644index 000000000..fcbc1ddbc--- /dev/null+++ b/web-app/src/components/ai-elements/conversation-column.tsx@@ -0,0 +1,33 @@+import type { ComponentProps } from 'react'+import { cn } from '@/lib/utils'++/** Shared border-edge geometry for message rows and the fixed composer. */+export const conversationColumnClassName =+ 'mx-auto w-full max-w-[880px] px-4 md:px-6'++type ConversationColumnProps = ComponentProps<'div'> & {+ reserveScrollGutter?: boolean+}++export function ConversationColumn({+ className,+ reserveScrollGutter = false,+ ...props+}: ConversationColumnProps) {+ const column = (+ <div className={cn(conversationColumnClassName, className)} {...props} />+ )++ // Match StickToBottom.Content's scroll viewport, including classic scrollbars.+ // `hidden` reserves native stable gutters without adding another scrollbar;+ // overlay-scrollbar platforms naturally reserve no space. Keep this outside+ // the max-width column: gutters reduce the available width BEFORE capping it.+ return reserveScrollGutter ? (+ <div+ className="w-full shrink-0"+ style={{ overflowY: 'hidden', scrollbarGutter: 'stable both-edges' }}+ >+ {column}+ </div>+ ) : column+}diff --git a/web-app/src/components/ai-elements/conversation.tsx b/web-app/src/components/ai-elements/conversation.tsxindex fc9af5f8d..49593d02d 100644--- a/web-app/src/components/ai-elements/conversation.tsx+++ b/web-app/src/components/ai-elements/conversation.tsx@@ -1,5 +1,6 @@/* eslint-disable react-refresh/only-export-components */import { Button } from '@/components/ui/button'+import { conversationColumnClassName } from './conversation-column'import { cn } from '@/lib/utils'import { useTranslation } from '@/i18n/react-i18next-compat'import { IconArrowDown } from '@tabler/icons-react'@@ -48,11 +49,17 @@ export const Conversation = memo(Conversation.displayName = 'Conversation'-export type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>+export type ConversationContentProps = ComponentProps<typeof StickToBottom.Content> & {+ column?: boolean+}-export const ConversationContent = memo(({ className, ...props }: ConversationContentProps) => (+export const ConversationContent = memo(({ className, column = false, ...props }: ConversationContentProps) => (<StickToBottom.Content- className={cn('flex flex-col gap-x-8 gap-y-2 px-2', className)}+ className={cn(+ 'flex flex-col gap-x-8 gap-y-2',+ column ? conversationColumnClassName : 'px-2',+ className+ )}{...props}/>))@@ -192,13 +199,13 @@ export const ConversationScrollButton = ({{/* Mirrors the bottom fade below: text slides out under the headerinstead of being cut at its edge. Hidden at the top so the firstmessage is never dimmed. Both fades end in the surface the app layout- paints behind the chat (neutral-50 light, background dark), so+ paints behind the chat (background in both light and dark themes), soneither shows as a band, and ease in (40% at the midpoint) so thedimming starts gently instead of as a straight ramp. */}<divaria-hidden="true"className={cn(- 'pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-t from-transparent via-neutral-50/40 via-50% to-neutral-50 dark:via-background/40 dark:to-background transition-opacity duration-200',+ 'pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-t from-transparent via-background/40 via-50% to-background transition-opacity duration-200',edges.top ? 'opacity-0' : 'opacity-100')}/>@@ -208,7 +215,7 @@ export const ConversationScrollButton = ({<divaria-hidden="true"className={cn(- 'pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-b from-transparent via-neutral-50/40 via-50% to-neutral-50 dark:via-background/40 dark:to-background transition-opacity duration-200',+ 'pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-b from-transparent via-background/40 via-50% to-background transition-opacity duration-200',edges.bottom ? 'opacity-0' : 'opacity-100')}/>diff --git a/web-app/src/components/left-sidebar/NavMain.tsx b/web-app/src/components/left-sidebar/NavMain.tsxindex ea8ad79a3..52b1f3ce5 100644--- a/web-app/src/components/left-sidebar/NavMain.tsx+++ b/web-app/src/components/left-sidebar/NavMain.tsx@@ -41,6 +41,7 @@ import { useProjectDialog } from '@/hooks/useProjectDialog'import { useAgentMode } from '@/hooks/useAgentMode'import { TEMPORARY_CHAT_ID } from '@/constants/chat'import { PlatformShortcuts, ShortcutAction } from '@/lib/shortcuts'+import { useSidebar } from '@/components/ui/sidebar'type AnimatedIconHandle =| SearchIconHandle@@ -181,6 +182,7 @@ export function NavMain({}) {const { t } = useTranslation()const navigate = useNavigate()+ const { closeMobileForNavigation } = useSidebar()const { addFolder } = useThreadManagement()const { open: searchOpen, setOpen: setSearchOpen } = useSearchDialog()const { open: projectDialogOpen, setOpen: setProjectDialogOpen } =@@ -190,6 +192,8 @@ export function NavMain({() => setSearchOpen(true),() => {useAgentMode.getState().removeThread(TEMPORARY_CHAT_ID)+ // Already on home the path does not change, so close the overlay here.+ closeMobileForNavigation()navigate({ to: route.home })},() => {diff --git a/web-app/src/components/left-sidebar/__tests__/mobileNavigation.test.tsx b/web-app/src/components/left-sidebar/__tests__/mobileNavigation.test.tsxnew file mode 100644index 000000000..04d6250c4--- /dev/null+++ b/web-app/src/components/left-sidebar/__tests__/mobileNavigation.test.tsx@@ -0,0 +1,135 @@+import '@testing-library/jest-dom/vitest'+import type { ReactNode } from 'react'+import { afterEach, beforeEach, expect, it, vi } from 'vitest'+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'++const env = vi.hoisted(() => ({ pathname: '/', mobile: true }))++vi.mock('@tanstack/react-router', () => ({+ useLocation: ({ select }: { select?: (l: { pathname: string }) => unknown } = {}) =>+ select ? select({ pathname: env.pathname }) : { pathname: env.pathname },+ Link: ({ to, children }: { to: string; children: ReactNode }) => <a href={to}>{children}</a>,+}))+vi.mock('@/hooks/use-mobile', () => ({ useIsMobile: () => env.mobile }))+vi.mock('@/i18n/react-i18next-compat', () => ({+ useTranslation: () => ({ t: (key: string) => key }),+}))+vi.mock('@/hooks/useLeftPanel', () => ({ useLeftPanel: () => ({ open: true }) }))+vi.mock('@/stores/titlebar-layout-store', () => ({+ useTitlebarLayout: (selector: (s: unknown) => unknown) =>+ selector({ layout: { left: [], right: [] } }),+}))+vi.mock('@/containers/DownloadManegement', () => ({+ DownloadManagement: () => <div data-testid="downloads" />,+}))+vi.mock('../NavCoworkTools', () => ({ NavCoworkTools: () => null }))+vi.mock('../NavHistory', () => ({ NavHistory: () => null }))+vi.mock('../NavMain', () => ({ NavMain: () => null }))+vi.mock('../NavProjects', () => ({ NavProjects: () => null }))++import { LeftSidebar } from '..'+import { SidebarProvider, SidebarTrigger } from '@/components/ui/sidebar'++const tree = () => (+ <SidebarProvider open>+ <LeftSidebar />+ <SidebarTrigger data-testid="outer-trigger" className="outer" />+ </SidebarProvider>+)++beforeEach(() => {+ env.pathname = '/'+ env.mobile = true+ vi.stubGlobal('IS_MACOS', false)+})+afterEach(() => {+ cleanup()+ vi.unstubAllGlobals()+})++it('closes the mobile overlay when navigation lands on a new page', () => {+ const view = render(tree())+ fireEvent.click(screen.getAllByRole('button', { name: 'common:sidebar.toggle' }).at(-1)!)+ expect(screen.getByRole('dialog', { name: 'common:sidebar.navigation' })).toBeInTheDocument()++ env.pathname = '/threads/1'+ act(() => view.rerender(tree()))+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+})++// Stand-in for a routed page: a fresh composer (as ChatInput) mounts per path.+const routeTree = () => (+ <SidebarProvider open>+ <LeftSidebar />+ <SidebarTrigger data-testid="outer-trigger" className="outer" />+ <textarea+ key={env.pathname}+ aria-label="composer"+ data-navigation-focus-target+ autoFocus+ />+ </SidebarProvider>+)++const settle = () =>+ act(async () => {+ await new Promise((resolve) => setTimeout(resolve, 0))+ })++it('keeps the destination composer focused when navigation closes the overlay', async () => {+ const view = render(routeTree())+ const toggle = screen.getAllByRole('button', { name: 'common:sidebar.toggle' }).at(-1)!+ fireEvent.click(toggle)+ expect(screen.getByRole('dialog')).toBeInTheDocument()++ env.pathname = '/threads/1'+ act(() => view.rerender(routeTree()))+ await settle()++ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+ expect(screen.getByLabelText('composer')).toHaveFocus()+ expect(toggle).not.toHaveFocus()+})++it('still returns focus to the toggle when Escape dismisses the overlay', async () => {+ render(routeTree())+ const toggle = screen.getAllByRole('button', { name: 'common:sidebar.toggle' }).at(-1)!+ fireEvent.click(toggle)+ fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' })+ await settle()++ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+ expect(toggle).toHaveFocus()+})++it('returns focus to the toggle on Escape after an earlier navigation close', async () => {+ const view = render(routeTree())+ const toggle = () => screen.getAllByRole('button', { name: 'common:sidebar.toggle' }).at(-1)!+ fireEvent.click(toggle())+ env.pathname = '/threads/1'+ act(() => view.rerender(routeTree()))+ await settle()++ fireEvent.click(toggle())+ fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' })+ await settle()+ expect(toggle()).toHaveFocus()+})++it('keeps the overlay open while the page does not change', () => {+ const view = render(tree())+ fireEvent.click(screen.getAllByRole('button', { name: 'common:sidebar.toggle' }).at(-1)!)+ act(() => view.rerender(tree()))+ expect(screen.getByRole('dialog')).toBeInTheDocument()+})++it('leaves the download indicator to the page header on mobile but keeps it in the docked sidebar', () => {+ const mobile = render(tree())+ fireEvent.click(screen.getAllByRole('button', { name: 'common:sidebar.toggle' }).at(-1)!)+ expect(screen.queryByTestId('downloads')).not.toBeInTheDocument()+ mobile.unmount()++ env.mobile = false+ render(tree())+ expect(screen.getByTestId('downloads')).toBeInTheDocument()+})diff --git a/web-app/src/components/left-sidebar/index.tsx b/web-app/src/components/left-sidebar/index.tsxindex b1bd703a3..af9f5421a 100644--- a/web-app/src/components/left-sidebar/index.tsx+++ b/web-app/src/components/left-sidebar/index.tsx@@ -5,6 +5,8 @@ import { NavHistory } from './NavHistory'import { NavMain } from './NavMain'import { NavProjects } from './NavProjects'import { useLeftPanel } from '@/hooks/useLeftPanel'+import { useEffect, useRef } from 'react'+import { useLocation } from '@tanstack/react-router'import {Sidebar,@@ -12,6 +14,7 @@ import {SidebarTrigger,SidebarHeader,SidebarRail,+ useSidebar,} from '@/components/ui/sidebar'import { cn } from '@/lib/utils'import { useTitlebarLayout } from '@/stores/titlebar-layout-store'@@ -22,6 +25,17 @@ export function LeftSidebar() {// (macOS, or a Linux DE placing buttons left).const leftButtons = useTitlebarLayout((s) => s.layout.left.length)const reserveLeft = IS_MACOS || leftButtons > 0+ const { isMobile, closeMobileForNavigation } = useSidebar()+ // The mobile overlay is modal: leave it when a navigation lands on a new page+ // (dialogs opened from its rows keep it open underneath).+ const pathname = useLocation({ select: (location) => location.pathname })+ const lastPathname = useRef(pathname)+ useEffect(() => {+ if (lastPathname.current !== pathname) {+ lastPathname.current = pathname+ closeMobileForNavigation()+ }+ }, [pathname, closeMobileForNavigation])return (<div className='relative z-50'><Sidebar variant="floating" collapsible="offcanvas">@@ -29,7 +43,8 @@ export function LeftSidebar() {<div className={cn("flex items-center w-full justify-between", reserveLeft && "justify-end")}>{!reserveLeft && <span className="ml-2 font-medium font-studio">Jan</span>}<div className="flex items-center">- {isLeftPanelOpen && <DownloadManagement />}+ {/* On mobile the page header already hosts the download indicator. */}+ {isLeftPanelOpen && !isMobile && <DownloadManagement />}<SidebarTrigger className="text-muted-foreground rounded-full hover:bg-sidebar-foreground/8! -mt-0.5 relative z-50 ml-0.5" /></div></div>@@ -43,7 +58,7 @@ export function LeftSidebar() {<NavHistory /></SidebarContent><StatusItems />- <SidebarRail />+ {!isMobile && <SidebarRail />}</Sidebar></div>)diff --git a/web-app/src/components/ui/__tests__/sidebar.mobile.test.tsx b/web-app/src/components/ui/__tests__/sidebar.mobile.test.tsxnew file mode 100644index 000000000..6a2460deb--- /dev/null+++ b/web-app/src/components/ui/__tests__/sidebar.mobile.test.tsx@@ -0,0 +1,189 @@+import '@testing-library/jest-dom/vitest'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'++const viewport = vi.hoisted(() => ({ mobile: true }))++vi.mock('@/hooks/use-mobile', () => ({ useIsMobile: () => viewport.mobile }))+vi.mock('@/i18n/react-i18next-compat', () => ({+ useTranslation: () => ({ t: (key: string) => key }),+}))+vi.mock('@/hooks/useLeftPanel', () => ({+ useLeftPanel: () => ({ open: true, setLeftPanel: vi.fn() }),+}))+vi.mock('@/containers/DownloadManegement', () => ({ DownloadManagement: () => null }))++import {+ Sidebar,+ SidebarProvider,+ SidebarTrigger,+ useSidebar,+} from '@/components/ui/sidebar'+import HeaderPage from '@/containers/HeaderPage'++function ShortcutProbe() {+ const { toggleSidebar } = useSidebar()+ return <button onClick={() => toggleSidebar()}>shortcut</button>+}++function renderShell(onOpenChange = vi.fn()) {+ render(+ <SidebarProvider open onOpenChange={onOpenChange}>+ <Sidebar collapsible="offcanvas">+ <a href="#projects">Projects link</a>+ </Sidebar>+ <HeaderPage>+ <span>Page</span>+ </HeaderPage>+ <ShortcutProbe />+ </SidebarProvider>+ )+ return onOpenChange+}++beforeEach(() => {+ viewport.mobile = true+ vi.stubGlobal('IS_MACOS', false)+})+afterEach(() => {+ cleanup()+ vi.unstubAllGlobals()+})++describe('mobile sidebar overlay', () => {+ it('offers a header toggle on a narrow window even though the desktop sidebar preference is open', () => {+ renderShell()+ const toggle = screen.getByTestId('sidebar-toggle')+ expect(toggle).toHaveAttribute('aria-label', 'common:sidebar.toggle')+ expect(toggle).toHaveAttribute('aria-expanded', 'false')+ })++ it('opens a named modal navigation overlay without flipping the persisted desktop state', () => {+ const onOpenChange = renderShell()+ fireEvent.click(screen.getByTestId('sidebar-toggle'))++ const dialog = screen.getByRole('dialog', { name: 'common:sidebar.navigation' })+ expect(dialog).toHaveTextContent('Projects link')+ expect(screen.getByTestId('sidebar-toggle')).toHaveAttribute('aria-expanded', 'true')+ expect(onOpenChange).not.toHaveBeenCalled()+ })++ it('returns focus to the header toggle when the overlay closes, even if the browser never focused it on click', async () => {+ renderShell()+ const toggle = screen.getByTestId('sidebar-toggle')+ // WebKit does not focus a button on click: nothing is active when it opens.+ fireEvent.click(toggle)+ expect(screen.getByRole('dialog')).toBeInTheDocument()++ fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' })+ await act(async () => {+ await new Promise((resolve) => setTimeout(resolve, 0))+ })++ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+ expect(toggle).toHaveFocus()+ })++ it('returns focus to the activated toggle, not a previously focused composer', async () => {+ render(+ <SidebarProvider open>+ <Sidebar collapsible="offcanvas">+ <span>Nav</span>+ </Sidebar>+ <textarea aria-label="composer" />+ <SidebarTrigger />+ </SidebarProvider>+ )+ const composer = screen.getByLabelText('composer')+ const toggle = screen.getByRole('button', { name: 'common:sidebar.toggle' })+ composer.focus()+ // WebKit: clicking the button leaves focus on the composer.+ fireEvent.click(toggle)+ fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' })+ await act(async () => {+ await new Promise((resolve) => setTimeout(resolve, 0))+ })+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+ expect(toggle).toHaveFocus()+ })++ it('falls back to a visible toggle, skipping hidden or disconnected ones', async () => {+ const view = render(+ <SidebarProvider open>+ <Sidebar collapsible="offcanvas">+ <span>Nav</span>+ </Sidebar>+ <div style={{ display: 'none' }}>+ <button data-sidebar-toggle="sidebar">hidden toggle</button>+ </div>+ <button data-sidebar-toggle="sidebar">visible toggle</button>+ <SidebarTrigger data-testid="opener" />+ </SidebarProvider>+ )+ fireEvent.click(screen.getByTestId('opener'))+ // The opener is re-rendered away while the overlay is open.+ screen.getByTestId('opener').remove()+ fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' })+ await act(async () => {+ await new Promise((resolve) => setTimeout(resolve, 0))+ })+ expect(screen.getByText('visible toggle')).toHaveFocus()+ view.unmount()+ })++ it('toggles the overlay, not the desktop sidebar, from the keyboard shortcut path', () => {+ const onOpenChange = renderShell()+ fireEvent.keyDown(window, { key: 'b', ctrlKey: true })+ expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(onOpenChange).not.toHaveBeenCalled()++ fireEvent.keyDown(window, { key: 'b', ctrlKey: true })+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+ expect(onOpenChange).not.toHaveBeenCalled()+ })++ it('does not pop the overlay back open after the window grows and shrinks again', () => {+ const view = render(+ <SidebarProvider open>+ <Sidebar collapsible="offcanvas">+ <span>Nav</span>+ </Sidebar>+ <SidebarTrigger />+ </SidebarProvider>+ )+ fireEvent.click(screen.getByRole('button', { name: 'common:sidebar.toggle' }))+ expect(screen.getByRole('dialog')).toBeInTheDocument()++ viewport.mobile = false+ view.rerender(+ <SidebarProvider open>+ <Sidebar collapsible="offcanvas">+ <span>Nav</span>+ </Sidebar>+ <SidebarTrigger />+ </SidebarProvider>+ )+ viewport.mobile = true+ view.rerender(+ <SidebarProvider open>+ <Sidebar collapsible="offcanvas">+ <span>Nav</span>+ </Sidebar>+ <SidebarTrigger />+ </SidebarProvider>+ )+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+ })+})++describe('desktop sidebar toggle', () => {+ it('keeps the header toggle hidden while docked open and toggles the persisted state when used', () => {+ viewport.mobile = false+ const onOpenChange = renderShell()+ expect(screen.queryByTestId('sidebar-toggle')).not.toBeInTheDocument()++ fireEvent.click(screen.getByText('shortcut'))+ expect(onOpenChange).toHaveBeenCalledWith(false)+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+ })+})diff --git a/web-app/src/components/ui/sidebar.tsx b/web-app/src/components/ui/sidebar.tsxindex 6d686f6c9..e0bdaf77d 100644--- a/web-app/src/components/ui/sidebar.tsx+++ b/web-app/src/components/ui/sidebar.tsx@@ -9,7 +9,12 @@ import * as React from "react";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { Separator } from "@/components/ui/separator";-import { Sheet, SheetContent } from "@/components/ui/sheet";+import {+ Sheet,+ SheetContent,+ SheetDescription,+ SheetTitle,+} from "@/components/ui/sheet";import { Skeleton } from "@/components/ui/skeleton";import {Tooltip,@@ -19,6 +24,7 @@ import {} from "@/components/ui/tooltip";import { useIsMobile } from "@/hooks/use-mobile";import { useSidebarResize } from "@/hooks/use-sidebar-resize";+import { useTranslation } from "@/i18n/react-i18next-compat";import { mergeButtonRefs } from "@/lib/merge-button-refs";import { cn } from "@/lib/utils";@@ -39,14 +45,24 @@ type SidebarContext = {setOpen: (open: boolean) => void;openMobile: boolean;setOpenMobile: (open: boolean) => void;+ /**+ * Close the overlay because navigation already moved the user elsewhere.+ * Focus is not returned to a sidebar toggle; the destination keeps its own.+ */+ closeMobileForNavigation: () => void;isMobile: boolean;- toggleSidebar: () => void;+ /** `opener` is the control that was activated; focus returns there on close. */+ toggleSidebar: (opener?: HTMLElement | null) => void;//* new properties for sidebar resizingwidth: string;setWidth: (width: string) => void;//* new properties for tracking is dragging railisDraggingRail: boolean;setIsDraggingRail: (isDraggingRail: boolean) => void;+ //* element to refocus when the mobile overlay closes+ mobileReturnFocusRef: React.MutableRefObject<HTMLElement | null>;+ //* set when the overlay closed because of navigation, not a dismissal+ closedByNavigationRef: React.MutableRefObject<boolean>;};const SidebarContext = React.createContext<SidebarContext | null>(null);@@ -60,6 +76,54 @@ function useSidebar() {return context;}+/** Like useSidebar, but null outside a provider (isolated header renders). */+function useOptionalSidebar() {+ return React.useContext(SidebarContext);+}++/**+ * Where focus lands when the mobile navigation overlay closes: the control that+ * opened it, or any visible sidebar toggle if that control was re-rendered away+ * (for example by the navigation the overlay just performed).+ */+function isRenderedVisible(element: HTMLElement) {+ if (!element.isConnected) return false;+ for (let node: HTMLElement | null = element; node; node = node.parentElement) {+ if (node.hidden || node.getAttribute("aria-hidden") === "true") return false;+ const style = window.getComputedStyle(node);+ if (style.display === "none" || style.visibility === "hidden") return false;+ }+ return true;+}++/** Marks the destination control that should take focus after a navigation close. */+const NAVIGATION_FOCUS_TARGET = "[data-navigation-focus-target]";++/**+ * After a navigation close the destination page may have tried to focus its own+ * field while the modal trap blocked it. Give it focus now, unless something+ * already has it.+ */+function focusNavigationDestination() {+ const active = document.activeElement;+ if (active && active !== document.body) return;+ Array.from(+ document.querySelectorAll<HTMLElement>(NAVIGATION_FOCUS_TARGET),+ )+ .find(isRenderedVisible)+ ?.focus();+}++function restoreMobileFocus(opener: HTMLElement | null) {+ const target =+ opener && isRenderedVisible(opener)+ ? opener+ : Array.from(+ document.querySelectorAll<HTMLElement>("[data-sidebar-toggle]"),+ ).find(isRenderedVisible);+ target?.focus();+}+const SidebarProvider = React.forwardRef<HTMLDivElement,React.ComponentProps<"div"> & {@@ -68,6 +132,11 @@ const SidebarProvider = React.forwardRef<onOpenChange?: (open: boolean) => void;//* new prop for default widthdefaultWidth?: string;+ /**+ * Register the built-in Cmd/Ctrl+B listener. Apps that own the shortcut+ * elsewhere (configurable KeyboardShortcutsProvider) pass `false`.+ */+ keyboardShortcut?: boolean;//* new prop for width change callbackonWidthChange?: (width: string) => void;}@@ -82,6 +151,7 @@ const SidebarProvider = React.forwardRef<children,defaultWidth = SIDEBAR_WIDTH,onWidthChange,+ keyboardShortcut = true,...props},ref,@@ -95,7 +165,43 @@ const SidebarProvider = React.forwardRef<setWidthState(newWidth);onWidthChange?.(newWidth);}, [onWidthChange]);- const [openMobile, setOpenMobile] = React.useState(false);+ const [openMobile, setOpenMobileState] = React.useState(false);+ const mobileReturnFocusRef = React.useRef<HTMLElement | null>(null);+ const openMobileRef = React.useRef(false);+ const closedByNavigationRef = React.useRef(false);+ // An explicit opener (the control that was activated) always wins over+ // document.activeElement, which may be an unrelated field such as the composer.+ const openMobileFrom = React.useCallback(+ (value: boolean, opener?: HTMLElement | null) => {+ openMobileRef.current = value;+ if (value) {+ closedByNavigationRef.current = false;+ const active = document.activeElement;+ if (opener) mobileReturnFocusRef.current = opener;+ else if (active instanceof HTMLElement && active !== document.body)+ mobileReturnFocusRef.current = active;+ }+ setOpenMobileState(value);+ },+ [],+ );+ const setOpenMobile = React.useCallback(+ (value: boolean) => openMobileFrom(value),+ [openMobileFrom],+ );+ const closeMobileForNavigation = React.useCallback(() => {+ // Only an overlay that is actually open needs its focus return skipped.+ if (openMobileRef.current) closedByNavigationRef.current = true;+ openMobileFrom(false);+ }, [openMobileFrom]);+ // An overlay left open while the window grows to the desktop layout must+ // not pop back open when it shrinks again.+ React.useEffect(() => {+ if (!isMobile) {+ openMobileRef.current = false;+ setOpenMobileState(false);+ }+ }, [isMobile]);//* new state for tracking is dragging railconst [isDraggingRail, setIsDraggingRail] = React.useState(false);@@ -119,19 +225,19 @@ const SidebarProvider = React.forwardRef<);// Helper to toggle the sidebar.- const toggleSidebar = React.useCallback(() => {- return isMobile- ? setOpenMobile((open) => !open)- : setOpen((open) => !open);- }, [- isMobile,- setOpen,- //* remove setOpenMobile from dependencies because setOpenMobile are state setters created by useState- // setOpenMobile- ]);+ const toggleSidebar = React.useCallback(+ (opener?: HTMLElement | null) => {+ if (!isMobile) return setOpen((open) => !open);+ // WebKit does not focus buttons on click, so the activated control is+ // passed in rather than read from document.activeElement.+ openMobileFrom(!openMobile, opener);+ },+ [isMobile, setOpen, openMobileFrom, openMobile],+ );// Adds a keyboard shortcut to toggle the sidebar.React.useEffect(() => {+ if (!keyboardShortcut) return;const handleKeyDown = (event: KeyboardEvent) => {if (event.key === SIDEBAR_KEYBOARD_SHORTCUT &&@@ -144,7 +250,7 @@ const SidebarProvider = React.forwardRef<window.addEventListener("keydown", handleKeyDown);return () => window.removeEventListener("keydown", handleKeyDown);- }, [toggleSidebar]);+ }, [toggleSidebar, keyboardShortcut]);// We add a state so that we can do data-state="expanded" or "collapsed".// This makes it easier to style the sidebar with Tailwind classes.@@ -158,6 +264,7 @@ const SidebarProvider = React.forwardRef<isMobile,openMobile,setOpenMobile,+ closeMobileForNavigation,toggleSidebar,//* new context for sidebar resizingwidth,@@ -165,6 +272,8 @@ const SidebarProvider = React.forwardRef<//* new context for tracking is dragging railisDraggingRail,setIsDraggingRail,+ mobileReturnFocusRef,+ closedByNavigationRef,}),[state,@@ -172,6 +281,8 @@ const SidebarProvider = React.forwardRef<setOpen,isMobile,openMobile,+ setOpenMobile,+ closeMobileForNavigation,toggleSidebar,width,setWidth,@@ -234,7 +345,10 @@ const Sidebar = React.forwardRef<setOpenMobile,//* new property for tracking is dragging railisDraggingRail,+ mobileReturnFocusRef,+ closedByNavigationRef,} = useSidebar();+ const { t } = useTranslation();if (collapsible === "none") {return (@@ -264,7 +378,26 @@ const Sidebar = React.forwardRef<} as React.CSSProperties}side={side}+ onCloseAutoFocus={(event) => {+ // Radix only refocuses a Sheet.Trigger; the sidebar is opened+ // from toggle buttons elsewhere, so return focus explicitly.+ event.preventDefault();+ if (closedByNavigationRef.current) {+ // Navigation, not dismissal: the old opener is gone and any+ // toggle on the new page must not outrank its own autofocus.+ closedByNavigationRef.current = false;+ focusNavigationDestination();+ return;+ }+ restoreMobileFocus(mobileReturnFocusRef.current);+ }}>+ <SheetTitle className="sr-only">+ {t("common:sidebar.navigation")}+ </SheetTitle>+ <SheetDescription className="sr-only">+ {t("common:sidebar.navigationDescription")}+ </SheetDescription><div className="flex h-full w-full flex-col">{children}</div></SheetContent></Sheet>@@ -328,23 +461,26 @@ const SidebarTrigger = React.forwardRef<React.ElementRef<typeof Button>,React.ComponentProps<typeof Button>>(({ className, onClick, ...props }, ref) => {- const { toggleSidebar } = useSidebar();+ const { toggleSidebar, isMobile, openMobile, open } = useSidebar();+ const { t } = useTranslation();return (<Buttonref={ref}data-sidebar="trigger"+ data-sidebar-toggle="sidebar"+ aria-expanded={isMobile ? openMobile : open}variant="ghost"size="icon"className={cn("size-8", className)}onClick={(event) => {onClick?.(event);- toggleSidebar();+ toggleSidebar(event.currentTarget);}}{...props}><PanelLeft />- <span className="sr-only">Toggle Sidebar</span>+ <span className="sr-only">{t("common:sidebar.toggle")}</span></Button>);});@@ -359,6 +495,7 @@ const SidebarRail = React.forwardRef<>(({ className, enableDrag = true, ...props }, ref) => {const { toggleSidebar, setWidth, state, width, setIsDraggingRail } =useSidebar();+ const { t } = useTranslation();const { dragRef, handleMouseDown } = useSidebarResize({direction: "right",@@ -385,12 +522,12 @@ const SidebarRail = React.forwardRef<//* updated ref to use combinedRefref={combinedRef}data-sidebar="rail"- aria-label="Toggle Sidebar"+ aria-label={t("common:sidebar.toggle")}tabIndex={-1}// onClick={toggleSidebar}//* replace onClick with onMouseDownonMouseDown={handleMouseDown}- title="Toggle Sidebar"+ title={t("common:sidebar.toggle")}className={cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 hover:after:bg-sidebar group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",// Cursor styles for resize@@ -857,4 +994,5 @@ export {SidebarSeparator,SidebarTrigger,useSidebar,+ useOptionalSidebar,};\ No newline at end of filediff --git a/web-app/src/containers/ConversationHeaderTitle.tsx b/web-app/src/containers/ConversationHeaderTitle.tsxnew file mode 100644index 000000000..2bf524646--- /dev/null+++ b/web-app/src/containers/ConversationHeaderTitle.tsx@@ -0,0 +1,24 @@+import { Link } from '@tanstack/react-router'+import { cn } from '@/lib/utils'++type Props = {+ title?: string+ project?: { id: string; name: string }+}++/** Header describes the conversation; model configuration lives in its composer. */+export function ConversationHeaderTitle({ title, project }: Props) {+ return (+ <div className="flex min-w-0 items-center gap-2 px-2 text-sm">+ {project && (+ <>+ <Link to="/project/$projectId" params={{ projectId: project.id }} className={cn('min-w-0 truncate text-muted-foreground hover:text-foreground', title ? 'max-w-[40%]' : 'max-w-full')} title={project.name}>+ {project.name}+ </Link>+ {title && <span aria-hidden="true" className="text-muted-foreground/40">/</span>}+ </>+ )}+ {title && <span className="truncate font-medium" title={title}>{title}</span>}+ </div>+ )+}diff --git a/web-app/src/containers/CoworkArtifactCard.tsx b/web-app/src/containers/CoworkArtifactCard.tsxindex f36329584..ef62d9295 100644--- a/web-app/src/containers/CoworkArtifactCard.tsx+++ b/web-app/src/containers/CoworkArtifactCard.tsx@@ -1,4 +1,5 @@-import { ChevronDown, Eye, FolderOpen, SquareArrowOutUpRight } from 'lucide-react'+import { useState } from 'react'+import { ChevronDown, Ellipsis, Eye, FolderOpen, SquareArrowOutUpRight } from 'lucide-react'import {DropdownMenu,DropdownMenuContent,@@ -36,13 +37,14 @@ const GROUP_TINT: Record<CoworkArtifact['group'], string> = {* is shared with the chat surface — the association is derived from a message's* own write/edit parts, so nothing shared needs to know artifacts exist.*- * Card body opens the in-app preview; the split button hands the file to the OS.+ * Card body opens the in-app preview; secondary actions hand the file to the OS.*/export function CoworkArtifactCard({artifact,roots,onPreview,showPath = false,+ variant = 'inline',className,}: {artifact: CoworkArtifact@@ -52,10 +54,14 @@ export function CoworkArtifactCard({onPreview: (path: string) => void/** The library sets this: many sessions' files need the disambiguating path. */showPath?: boolean+ /** Transcript cards stay compact; library cards reserve room for the file. */+ variant?: 'inline' | 'library'className?: string}) {const { t } = useTranslation()const serviceHub = useServiceHub()+ const isLibrary = variant === 'library'+ const [failedThumb, setFailedThumb] = useState<string | null>(null)const Icon = ARTIFACT_ICON[artifact.group]const abs = resolveInRoots(roots, artifact.path)?.abs ?? nullconst kind = previewKindFor(artifact.path)@@ -69,7 +75,10 @@ export function CoworkArtifactCard({return (<CardclassName={cn(- 'group/artifact flex items-center gap-3 p-2.5 transition-all hover:border-accent hover:shadow-sm',+ 'group/artifact flex transition-colors',+ isLibrary+ ? 'min-h-20 flex-row items-center gap-4 rounded-xl border border-border bg-background p-4 shadow-none hover:bg-muted dark:border-border/60 dark:hover:bg-muted/30'+ : 'h-[50px] items-center justify-between gap-2.5 rounded-xl border border-border bg-muted px-2.5 py-2 shadow-none dark:border-transparent dark:bg-muted/40',className)}>@@ -77,75 +86,94 @@ export function CoworkArtifactCard({type="button"onClick={() => onPreview(artifact.path)}title={t('common:artifactOpenPreview')}- className="flex min-w-0 flex-1 cursor-pointer items-center gap-3 text-left"+ aria-label={isLibrary ? `${t('common:artifactOpenPreview')}: ${artifact.title}` : undefined}+ className={cn(+ 'flex min-w-0 flex-1 cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring',+ isLibrary ? 'items-center gap-3' : 'items-center gap-2.5'+ )}>- {thumb ? (+ {thumb && failedThumb !== thumb ? (<imgsrc={thumb}alt=""- className="size-11 shrink-0 rounded-lg border object-cover"+ onError={() => setFailedThumb(thumb)}+ className={isLibrary+ ? 'size-12 shrink-0 rounded-lg bg-muted/30 object-cover'+ : 'size-8 shrink-0 rounded-lg object-cover'}/>) : (<spanclassName={cn(- 'flex size-11 shrink-0 items-center justify-center rounded-lg',+ 'flex shrink-0 items-center justify-center',+ isLibrary ? 'size-12 rounded-lg' : 'size-8 rounded-lg',GROUP_TINT[artifact.group])}>- <Icon size={20} />+ <Icon className={isLibrary ? "size-6!" : "size-[18px]!"} size={isLibrary ? 24 : 18} strokeWidth={isLibrary ? 1.4 : 2} aria-hidden="true" /></span>)}{/* min-w-0 on a block box: `truncate` is inert otherwise. */}- <span className="min-w-0 flex-1">+ <span className={cn("min-w-0 flex-1", isLibrary && "py-0.5")}><span- className="block truncate text-sm font-medium"+ className={cn("block text-sm font-medium", isLibrary ? "line-clamp-2 break-words leading-5" : "truncate")}title={artifact.title}>{artifact.title}</span>- <span className="mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground">- <span className="rounded border px-1 text-[10px] font-semibold tracking-wide">+ <span className="mt-1 flex items-center gap-1.5 text-xs leading-4 text-muted-foreground">+ <span className={cn("text-[10px] font-medium tracking-wide", isLibrary && "text-xs")}>{artifact.label}</span><span className="truncate">{t(`common:artifactGroup${artifact.group}`)}</span></span>- {showPath && (- <span className="mt-0.5 block truncate text-xs text-muted-foreground/70">+ {(showPath || isLibrary) && (+ <span title={artifact.path} className="mt-1 block truncate text-xs text-muted-foreground/70">{artifact.path}</span>)}</span>{/* Hover affordance: the whole body is a preview button, but nothingsaid so before the pointer found the tooltip. */}- <Eye+ {!isLibrary && <Eyesize={14}className="shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/artifact:opacity-100"- />+ />}</button>{abs && (- <div className="flex shrink-0 items-center overflow-hidden rounded-md border">+ <div className={cn(+ "flex shrink-0 items-center",+ isLibrary ? "justify-end gap-1" : "overflow-hidden rounded-full border border-border/60 bg-background"+ )}><buttontype="button"onClick={() => void openOrReveal(artifactOpener(), roots, abs)}title={t('common:artifactOpenExternal')}- className="flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium hover:bg-accent"+ aria-label={t('common:artifactOpenExternal')}+ className={cn(+ 'flex items-center justify-center text-xs font-medium hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',+ isLibrary ? 'size-8 rounded-md' : 'gap-1.5 px-2.5 py-1.5'+ )}><SquareArrowOutUpRight size={13} className="text-muted-foreground" />- <span className="hidden sm:inline">+ {!isLibrary && <span className="hidden sm:inline">{t('common:artifactOpenExternal')}- </span>+ </span>}</button><DropdownMenu><DropdownMenuTrigger asChild><buttontype="button"aria-label={t('common:artifactMoreActions')}- className="border-l px-1.5 py-1.5 hover:bg-accent"+ title={t('common:artifactMoreActions')}+ className={cn(+ 'flex items-center justify-center hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',+ isLibrary ? 'size-8 rounded-md' : 'px-1.5 py-1.5'+ )}>- <ChevronDown size={13} className="text-muted-foreground" />+ {isLibrary ? <Ellipsis size={16} className="text-muted-foreground" /> : <ChevronDown size={13} className="text-muted-foreground" />}</button></DropdownMenuTrigger><DropdownMenuContent align="end">diff --git a/web-app/src/containers/CoworkOverviewPanel.tsx b/web-app/src/containers/CoworkOverviewPanel.tsxnew file mode 100644index 000000000..df90a9fcb--- /dev/null+++ b/web-app/src/containers/CoworkOverviewPanel.tsx@@ -0,0 +1,117 @@+import { useState, type ReactNode } from 'react'+import { motion, useReducedMotion } from 'motion/react'+import { Check, ChevronDown, FileCode2, FileText, FileImage, FileAudio, FileVideo, Loader2, Bot, Activity } from 'lucide-react'+import { cn } from '@/lib/utils'+import { useTranslation } from '@/i18n/react-i18next-compat'+import type { TodoList, CoworkAttachedFile, SubagentRun } from '@/types/coworkSession'+import { type CoworkArtifact } from '@/lib/coworkArtifacts'+import { DIFF_ADD_TEXT, DIFF_DEL_TEXT, type CoworkFileDiff } from '@/lib/coworkDiffs'+import { cleanTaskLabel } from '@/lib/todoLabels'+import { useMediaQuery } from '@/hooks/useMediaQuery'+import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '@/components/ui/sheet'+import { TITLEBAR_HEIGHT, useTitlebarLayout } from '@/stores/titlebar-layout-store'++function Section({ title, children }: { title: string; children: ReactNode }) {+ const [open, setOpen] = useState(true)+ return (+ <section className="py-5 first:pt-0 last:pb-0">+ <button type="button" aria-expanded={open} onClick={() => setOpen(!open)} className="flex w-full items-center justify-between gap-2 rounded-md text-left text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring">+ {title}+ <ChevronDown className={cn('size-3.5 text-muted-foreground transition-transform motion-reduce:transition-none', !open && '-rotate-90')} />+ </button>+ <div className={cn('grid transition-[grid-template-rows,opacity] duration-200 motion-reduce:transition-none', open ? 'grid-rows-[1fr] opacity-100' : 'grid-rows-[0fr] opacity-0')} inert={!open}>+ <div className="overflow-hidden"><div className="pt-4">{children}</div></div>+ </div>+ </section>+ )+}++/** A single quiet information rail; previews and detailed diffs remain separate. */+export function CoworkOverviewPanel({ todos, attachments, artifacts, files, subagents, monitorCount = 0, onPreview, onChanges, onAgents, onClose }: {+ todos?: TodoList+ attachments: CoworkAttachedFile[]+ artifacts: CoworkArtifact[]+ files: CoworkFileDiff[]+ subagents: SubagentRun[]+ monitorCount?: number+ onPreview: (path: string) => void+ onChanges: () => void+ onAgents: () => void+ onClose?: () => void+}) {+ const { t } = useTranslation()+ const reduceMotion = useReducedMotion()+ const desktop = useMediaQuery('(min-width: 1280px)', true)+ const rightButtons = useTitlebarLayout((s) => s.layout.right.length)+ // Move into the header's empty rail column, without covering native caption controls.+ const topInset = !IS_MACOS && rightButtons > 0 ? TITLEBAR_HEIGHT : 8+ const tasks = todos?.phases.flatMap((p) => p.tasks) ?? []+ const additions = files.reduce((n, f) => n + f.additions, 0)+ const deletions = files.reduce((n, f) => n + f.deletions, 0)+ const content = (+ <div className="divide-y divide-sidebar-border rounded-xl border border-sidebar-border bg-linear-to-b from-sidebar to-background px-5 py-5 shadow dark:from-sidebar/70">+ <Section title={t('common:overview.progress')}>+ {tasks.length ? <ul className="space-y-4">{tasks.map((task, i) => (+ <li key={i} className="flex items-start gap-2.5 text-xs leading-5">+ {task.status === 'completed' ? <span className="mt-1 flex size-3.5 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground"><Check className="size-2.5" /></span> : task.status === 'in_progress' ? <Loader2 className="mt-1 size-3.5 shrink-0 animate-spin text-primary" /> : <span className="mt-1 size-3.5 shrink-0 rounded-full border border-border" />}+ <span className={cn(task.status === 'abandoned' && 'text-muted-foreground line-through')}>{cleanTaskLabel(task.content)}</span>+ </li>+ ))}</ul> : <p className="text-sm leading-6 text-muted-foreground">{t('common:overview.noProgress')}</p>}+ </Section>+ <Section title={t('common:overview.files')}>+ <div className="space-y-1">+ {artifacts.map((a) => {+ const Icon = a.group === 'Code' ? FileCode2 : a.group === 'Image' ? FileImage : a.group === 'Audio' ? FileAudio : a.group === 'Video' ? FileVideo : FileText+ const color = a.group === 'Code' ? 'text-violet-500' : a.group === 'Image' ? 'text-emerald-500' : a.group === 'Document' ? 'text-blue-500' : 'text-amber-500'+ return <button key={a.path} type="button" onClick={() => onPreview(a.path)} className="-mx-1 flex w-[calc(100%+0.5rem)] items-center gap-2.5 rounded-lg px-1 py-1.5 text-left hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">+ <span className="flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/60"><Icon className={cn("size-4", color)} /></span>+ <span className="min-w-0 flex-1"><span className="block truncate text-xs font-medium leading-5" title={a.title}>{a.title}</span><span className="block truncate text-[11px] leading-4 text-muted-foreground">{t(`common:artifactGroup${a.group}`)} · {a.label}</span></span>+ </button>+ })}+ {attachments.map((f) => <button key={f.path} type="button" disabled={!f.workspacePath} onClick={() => f.workspacePath && onPreview(f.workspacePath)} className="flex w-full items-center gap-2.5 rounded-lg py-2 text-left hover:bg-muted/60 disabled:cursor-default">+ <FileText className="size-4 shrink-0 text-muted-foreground" /><span className="truncate text-xs">{f.name}</span>+ </button>)}+ {!artifacts.length && !attachments.length && <p className="text-sm leading-6 text-muted-foreground">{t('common:overview.noFiles')}</p>}+ </div>+ </Section>+ {files.length > 0 && <Section title={t('common:changes.title')}>+ <button type="button" onClick={onChanges} className="flex items-center gap-2 rounded-md py-1 text-xs hover:opacity-75"><FileCode2 className="size-4 text-muted-foreground" /><span className={DIFF_ADD_TEXT}>+{additions}</span><span className={DIFF_DEL_TEXT}>-{deletions}</span></button>+ </Section>}+ {(subagents.length > 0 || monitorCount > 0) && <Section title={t('common:overview.backgroundTasks')}>+ <div className="space-y-2">+ {subagents.map((agent) => <button key={agent.runId} type="button" onClick={onAgents} className="flex w-full items-center gap-2.5 rounded-lg py-1.5 text-left text-xs hover:bg-muted/50">+ <Bot className="size-4 shrink-0 text-muted-foreground" />+ <span className="min-w-0 flex-1 truncate">{agent.name}</span>+ <span className="text-[11px] text-muted-foreground">{agent.status}</span>+ </button>)}+ {monitorCount > 0 && <button type="button" onClick={onAgents} className="flex items-center gap-2.5 rounded-lg py-1.5 text-xs text-muted-foreground hover:text-foreground"><Activity className="size-4" />{t('common:overview.monitorCount', { count: monitorCount })}</button>}+ </div>+ </Section>}+ </div>+ )+ if (!desktop) return (+ <Sheet open onOpenChange={(open) => { if (!open) onClose?.() }}>+ <SheetContent className="w-[min(100%,360px)] gap-0 overflow-y-auto p-3" onCloseAutoFocus={(event) => {+ const trigger = document.querySelector<HTMLButtonElement>('[data-testid="overview-toggle"]')+ if (trigger) { event.preventDefault(); trigger.focus() }+ }}>+ <SheetHeader className="sr-only">+ <SheetTitle>{t('common:overview.title')}</SheetTitle>+ <SheetDescription>{t('common:overview.description')}</SheetDescription>+ </SheetHeader>+ {content}+ </SheetContent>+ </Sheet>+ )+ return (+ <motion.aside+ initial={{ opacity: 0, x: reduceMotion ? 0 : 16 }}+ animate={{ opacity: 1, x: 0 }}+ exit={{ opacity: 0, x: reduceMotion ? 0 : 16, pointerEvents: 'none' }}+ transition={{ duration: reduceMotion ? 0 : 0.25, ease: [0.22, 1, 0.36, 1] }}+ aria-label={t('common:overview.title')} className="absolute right-0 bottom-0 z-(--layer-panel) hidden w-80 overflow-y-auto px-3 pb-4 xl:block" style={{ top: topInset }}>+ {content}++ </motion.aside>+ )+}diff --git a/web-app/src/containers/CoworkPage.tsx b/web-app/src/containers/CoworkPage.tsxindex b737c3150..14aa88b23 100644--- a/web-app/src/containers/CoworkPage.tsx+++ b/web-app/src/containers/CoworkPage.tsx@@ -2,6 +2,10 @@import { useNavigate } from '@tanstack/react-router'import ChatInput from '@/containers/ChatInput'import HeaderPage from '@/containers/HeaderPage'+import { ConversationHeaderTitle } from '@/containers/ConversationHeaderTitle'+import { CoworkOverviewPanel } from '@/containers/CoworkOverviewPanel'+import { ConversationColumn } from '@/components/ai-elements/conversation-column'+import { useMediaQuery } from '@/hooks/useMediaQuery'import { useTranslation } from '@/i18n/react-i18next-compat'import { route } from '@/constants/routes'import { useServiceHub } from '@/hooks/useServiceHub'@@ -15,7 +19,7 @@ import {} from 'react'import { toast } from 'sonner'import { invoke } from '@tauri-apps/api/core'-import { Bot, Command, Sparkles } from 'lucide-react'+import { Bot, Command, PanelRight, Sparkles } from 'lucide-react'import { AnimatePresence, motion, useReducedMotion } from 'motion/react'import { cn } from '@/lib/utils'import { getLoadedModels } from '@janhq/tauri-plugin-llamacpp-api'@@ -257,6 +261,9 @@ export function CoworkPage() {)// The rail holds one panel at a time: they all want the width, so showing// two together starves the transcript (C7).+ const desktopOverview = useMediaQuery('(min-width: 1280px)', true)+ const [overviewOpen, setOverviewOpen] = useState(true)+ const [overviewRequested, setOverviewRequested] = useState(false)const [rail, setRail] = useState<| { kind: 'preview'; path: string }| { kind: 'diff' }@@ -267,7 +274,10 @@ export function CoworkPage() {| null>(null)const showPreview = useCallback(- (path: string) => setRail({ kind: 'preview', path }),+ (path: string) => {+ setOverviewOpen(false)+ setRail({ kind: 'preview', path })+ },[])const ask = useCoworkRun((s) =>@@ -1616,9 +1626,44 @@ export function CoworkPage() {return (<divdata-testid="cowork-surface"- className="flex flex-col h-[calc(100dvh-(env(safe-area-inset-bottom)+env(safe-area-inset-top)))]"+ className="relative flex flex-col h-[calc(100dvh-(env(safe-area-inset-bottom)+env(safe-area-inset-top)))]">- <HeaderPage />+ <HeaderPage>+ <div className="flex items-center justify-between w-full pr-2">+ <ConversationHeaderTitle+ title={session?.title}+ project={session?.project}+ />+ <button+ type="button"+ aria-label={t(+ overviewOpen && !dockedRail+ ? 'common:overview.close'+ : 'common:overview.title'+ )}+ data-testid="overview-toggle"+ aria-pressed={overviewOpen && !dockedRail}+ onClick={() => {+ setOverviewRequested(true)+ if (!desktopOverview && !overviewRequested) {+ setRail(null)+ setOverviewOpen(true)+ return+ }+ if (dockedRail) {+ setRail(null)+ setOverviewOpen(true)+ } else setOverviewOpen((open) => !open)+ }}+ className={cn(+ 'ml-auto flex size-8 shrink-0 items-center justify-center rounded-full bg-muted/70 text-muted-foreground transition-[margin,background-color,color] duration-250 ease-out motion-reduce:transition-none hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',+ overviewOpen && !dockedRail && 'xl:mr-80'+ )}+ >+ <PanelRight className="size-4" />+ </button>+ </div>+ </HeaderPage><div className="flex flex-1 h-full overflow-hidden"><div className="flex min-w-0 flex-1 flex-col h-full overflow-hidden">@@ -1634,16 +1679,7 @@ export function CoworkPage() {so with no bottom padding the last row -- the live"Working..." indicator -- rests flush against the input andreads as tucked behind it. */}- <ConversationContent- className={cn(- 'mx-auto w-full px-6 pb-4',- // The centering fractions assume the transcript owns the- // width; with a side panel open the column is already- // narrow, so keeping them crushes the message and composer- // into an unreadable sliver.- !dockedRail && 'md:w-4/5 xl:w-4/6'- )}- >+ <ConversationContent column className="pb-4">{uiMessages.map((message, i) => (<Fragment key={message.id}><MessageItem@@ -1766,7 +1802,7 @@ export function CoworkPage() {{/* pb-only: the scroll area runs right up to the composer. */}<div className="pb-4 shrink-0">- <div className={cn('mx-auto w-full px-6', !dockedRail && 'md:w-4/5 xl:w-4/6')}>+ <ConversationColumn reserveScrollGutter>{/* The card rises in when a question arrives and folds away onceanswered, so the chat box glides instead of jumping. A cardalready pending when the view mounts just appears. */}@@ -1927,10 +1963,18 @@ export function CoworkPage() {}/></div>- </div>+ </ConversationColumn></div></div>+ <div+ className={cn(+ 'hidden shrink-0 transition-[width] duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none xl:block',+ overviewOpen && !dockedRail ? 'w-80' : 'w-0'+ )}+ aria-hidden="true"+ />+ <AnimatePresence initial={false}>{rail?.kind === 'preview' && (<CoworkPreviewPanelroots={[folder, workspacePath]}@@ -1962,6 +2006,7 @@ export function CoworkPage() {onClose={() => setRail(null)}/>)}+ </AnimatePresence>{/* Always mounted so Radix can play the close animation; the sheetoverlays the page, so it is not a docked rail. */}{localModel && modelProvider && (@@ -1975,6 +2020,28 @@ export function CoworkPage() {/>)}</div>+ <AnimatePresence initial={false}>+ {overviewOpen && !dockedRail && (desktopOverview || overviewRequested) && (+ <CoworkOverviewPanel+ todos={session?.todos}+ attachments={attachments}+ artifacts={artifacts}+ files={fileDiffs}+ subagents={subagents}+ monitorCount={monitors.length}+ onPreview={showPreview}+ onChanges={() => {+ setOverviewOpen(false)+ setRail({ kind: 'diff' })+ }}+ onAgents={() => {+ setOverviewOpen(false)+ setRail({ kind: 'tasks' })+ }}+ onClose={() => setOverviewOpen(false)}+ />+ )}+ </AnimatePresence></div>)}diff --git a/web-app/src/containers/CoworkPreviewPanel.tsx b/web-app/src/containers/CoworkPreviewPanel.tsxindex f3ea587ea..e8ddaff95 100644--- a/web-app/src/containers/CoworkPreviewPanel.tsx+++ b/web-app/src/containers/CoworkPreviewPanel.tsx@@ -2,20 +2,22 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'import {FolderOpen,Globe,+ Ellipsis,RotateCw,ShieldOff,SquareArrowOutUpRight,} from 'lucide-react'-import { Button } from '@/components/ui/button'+import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuSeparator } from '@/components/ui/dropdown-menu'import {Tooltip,TooltipContent,TooltipTrigger,} from '@/components/ui/tooltip'import { RenderMarkdown } from '@/containers/RenderMarkdown'-import { CoworkSidePanel } from '@/containers/CoworkSidePanel'+import { CoworkPanelButton, CoworkSidePanel } from '@/containers/CoworkSidePanel'import { getServiceHub, useServiceHub } from '@/hooks/useServiceHub'import { useTranslation } from '@/i18n/react-i18next-compat'+import { cn } from '@/lib/utils'import { buildSrcDoc } from '@/lib/htmlSandbox'import { previewShimError } from '@/lib/previewShim'import {@@ -24,7 +26,6 @@ import {registerPreviewRoot,unregisterPreviewRoot,} from '@/lib/previewProtocol'-import { cn } from '@/lib/utils'import {MAX_PREVIEW_BYTES,basenameOf,@@ -157,72 +158,73 @@ export function CoworkPreviewPanel({ roots, path, onClose }: Props) {return () => void unregisterPreviewRoot(matchedRoot).catch(() => {})}, [live, matchedRoot, allowNetwork, nonce])- const iconButton = (- label: string,- Icon: typeof RotateCw,- onClick: () => void,- active?: boolean- ) => (- <Tooltip>- <TooltipTrigger asChild>- <Button- variant="ghost"- size="icon-xs"- onClick={onClick}- aria-label={label}- aria-pressed={active}- className={cn(- 'shrink-0',- active ? 'text-primary' : 'text-muted-foreground'- )}- >- <Icon className="size-4" />- </Button>- </TooltipTrigger>- <TooltipContent>{label}</TooltipContent>- </Tooltip>- )-return (<CoworkSidePaneltitle={basenameOf(path)}onClose={onClose}summary={- <div className="flex shrink-0 items-center gap-0.5">- {state.status === 'ready' && state.kind === 'html' && (- <>- {iconButton(- t('common:preview.allowNetwork'),- Globe,- () => setAllowNetwork((v) => !v),- allowNetwork- )}- {matchedRoot &&- canUnsandbox() &&- iconButton(- t('common:preview.unsandboxed'),- ShieldOff,- () => setUnsandboxed((v) => !v),- unsandboxed+ <>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <CoworkPanelButton+ aria-label={t('common:artifactMoreActions')}+ title={t('common:artifactMoreActions')}+ >+ <Ellipsis className="size-4" />+ </CoworkPanelButton>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ align="end"+ collisionPadding={12}+ className="w-80 max-w-[calc(100vw-24px)]"+ >+ {abs && <>+ <DropdownMenuItem onSelect={() => void openOrReveal(artifactOpener(), roots, abs)}>+ <SquareArrowOutUpRight />{t('common:artifactOpenExternal')}+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => void serviceHub.opener().revealItemInDir(abs)}>+ <FolderOpen />{t('common:artifactShowInFolder')}+ </DropdownMenuItem>+ </>}+ {state.status === 'ready' && state.kind === 'html' && <>+ {abs && <DropdownMenuSeparator />}+ <DropdownMenuCheckboxItem+ indicatorAlign="right"+ checked={allowNetwork}+ onCheckedChange={setAllowNetwork}+ >+ <Globe className="size-4 text-muted-foreground" />+ <span className="min-w-0 whitespace-normal">+ {t('common:preview.allowNetwork')}+ </span>+ </DropdownMenuCheckboxItem>+ {matchedRoot && canUnsandbox() && (+ <DropdownMenuCheckboxItem+ indicatorAlign="right"+ checked={unsandboxed}+ onCheckedChange={setUnsandboxed}+ >+ <ShieldOff className="size-4 text-muted-foreground" />+ <span className="min-w-0 whitespace-normal">+ {t('common:preview.unsandboxed')}+ </span>+ </DropdownMenuCheckboxItem>)}- </>- )}- {iconButton(t('common:preview.reload'), RotateCw, reload)}- {abs && (- <>- {iconButton(- t('common:artifactOpenExternal'),- SquareArrowOutUpRight,- () => void openOrReveal(artifactOpener(), roots, abs)- )}- {iconButton(- t('common:artifactShowInFolder'),- FolderOpen,- () => void serviceHub.opener().revealItemInDir(abs)- )}- </>- )}- </div>+ </>}+ </DropdownMenuContent>+ </DropdownMenu>+ <Tooltip>+ <TooltipTrigger asChild>+ <CoworkPanelButton+ onClick={reload}+ aria-label={t('common:preview.reload')}+ >+ <RotateCw className="size-4" />+ </CoworkPanelButton>+ </TooltipTrigger>+ <TooltipContent>{t('common:preview.reload')}</TooltipContent>+ </Tooltip>+ </>}><PreviewBody@@ -276,7 +278,7 @@ function HtmlFrame({}, [])const blocked = allowNetwork ? 0 : (state.externalRefs ?? 0)- const notice = 'border-b bg-muted/40 px-3 py-2 text-xs text-muted-foreground'+ const notice = 'border-b bg-muted dark:bg-muted/40 px-3 py-2 text-xs text-muted-foreground'const frameClass = 'min-h-0 w-full flex-1 border-0 bg-white'return (<div className="flex h-full flex-col">@@ -330,7 +332,7 @@ function Notice({ children }: { children: React.ReactNode }) {)}-function PreviewBody({+export function PreviewBody({state,allowNetwork,liveUrl,diff --git a/web-app/src/containers/CoworkSidePanel.tsx b/web-app/src/containers/CoworkSidePanel.tsxindex d306efac2..28805085f 100644--- a/web-app/src/containers/CoworkSidePanel.tsx+++ b/web-app/src/containers/CoworkSidePanel.tsx@@ -1,6 +1,10 @@-import { useCallback, useRef, useState, type ReactNode } from 'react'+import { useCallback, useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react'+import { motion, useReducedMotion } from 'motion/react'import { Maximize2, Minimize2, X } from 'lucide-react'+import { Button } from '@/components/ui/button'+import { useMediaQuery } from '@/hooks/useMediaQuery'import { cn } from '@/lib/utils'+import { TITLEBAR_HEIGHT } from '@/stores/titlebar-layout-store'import { useTranslation } from '@/i18n/react-i18next-compat'type CoworkSidePanelProps = {@@ -11,25 +15,44 @@ type CoworkSidePanelProps = {onClose: () => void}-const PANEL_MIN_W = 240-const PANEL_DEFAULT_W = 320-/** One width across the preview/diff/todo/tasks panels, kept across sessions. */-const PANEL_WIDTH_KEY = 'cowork:sidePanelWidth'+/** Shared 32px rail actions keep preview and panel controls aligned. */+export function CoworkPanelButton({ className, ...props }: React.ComponentProps<typeof Button>) {+ return <Button type="button" variant="ghost" size="icon-sm" {...props}+ className={cn('rounded-md text-main-view-fg/70 hover:bg-main-view-fg/10 hover:text-main-view-fg data-[state=open]:bg-main-view-fg/10 dark:hover:bg-main-view-fg/10', className)} />+}-/** The panel may grow with the window but never crush the transcript. */-function panelMaxWidth(): number {- return Math.max(PANEL_MIN_W, Math.round(window.innerWidth * 0.7))+/** The element whose box the panel is laid out in. A wrapper with+ * `display: contents` has no box of its own, so measuring it would read zero (or+ * the panel's own width); look through it to the real containing row. */+function layoutParent(el: HTMLElement | null): { container: HTMLElement; self: HTMLElement } | null {+ let self = el+ while (self?.parentElement && getComputedStyle(self.parentElement).display === 'contents') self = self.parentElement+ const container = self?.parentElement+ return self && container ? { container, self } : null}-function clampWidth(w: number): number {- return Math.min(panelMaxWidth(), Math.max(PANEL_MIN_W, Math.round(w)))+const PANEL_MIN_W = 320+const TRANSCRIPT_MIN_W = 480+const RESIZE_STEP = 16+/** One user preference across preview/diff/todo/tasks, not a measured width. */+const PANEL_WIDTH_KEY = 'cowork:sidePanelWidthRatio'+const LEGACY_WIDTH_KEY = 'cowork:sidePanelWidth'++function storedWidth(): number | null {+ try {+ const raw = Number(window.localStorage.getItem(PANEL_WIDTH_KEY))+ return Number.isFinite(raw) && raw > 0 && raw <= 1 ? raw : null+ } catch { return null }}-function storedWidth(): number {- const raw = Number(window.localStorage.getItem(PANEL_WIDTH_KEY))- return Number.isFinite(raw) && raw >= PANEL_MIN_W- ? clampWidth(raw)- : PANEL_DEFAULT_W+function persistWidth(width: number | null) {+ try {+ if (width === null) {+ window.localStorage.removeItem(PANEL_WIDTH_KEY)+ window.localStorage.removeItem(LEGACY_WIDTH_KEY)+ }+ else window.localStorage.setItem(PANEL_WIDTH_KEY, String(width))+ } catch { /* Storage can be unavailable or full; resizing must still work. */ }}export function CoworkSidePanel({@@ -40,101 +63,233 @@ export function CoworkSidePanel({onClose,}: CoworkSidePanelProps): React.ReactElement {const { t } = useTranslation()+ const reduceMotion = useReducedMotion()const [expanded, setExpanded] = useState(false)- const [width, setWidth] = useState(storedWidth)+ const [preferredRatio, setPreferredRatio] = useState(storedWidth)+ const [parentWidth, setParentWidth] = useState(0)const [resizing, setResizing] = useState(false)const asideRef = useRef<HTMLElement>(null)- const widthRef = useRef(width)+ const dragCleanup = useRef<(() => void) | null>(null)+ const phone = useMediaQuery('(max-width: 640px)', false)+ const overlay = parentWidth > 0 && parentWidth < PANEL_MIN_W + TRANSCRIPT_MIN_W+ const minWidth = overlay ? parentWidth : PANEL_MIN_W+ const maxWidth = overlay ? parentWidth : parentWidth - TRANSCRIPT_MIN_W+ const clampWidth = useCallback((value: number) => (+ Math.min(maxWidth, Math.max(minWidth, Math.round(value)))+ ), [minWidth, maxWidth])+ const width = overlay || expanded ? maxWidth : clampWidth(parentWidth * (preferredRatio ?? 0.5))++ useLayoutEffect(() => {+ const parent = layoutParent(asideRef.current)?.container+ if (!parent) return+ // The containing block is the remaining content area, never the viewport+ // (which includes the navigation sidebar). Keep the overlay below its header.+ const previousPosition = parent.style.position+ const needsPosition = getComputedStyle(parent).position === 'static' || !getComputedStyle(parent).position+ if (needsPosition) parent.style.position = 'relative'+ let migrated = false+ const measure = () => {+ const available = parent.getBoundingClientRect().width+ setParentWidth(available)+ if (!migrated && available > 0) {+ migrated = true+ try {+ const legacy = Number(window.localStorage.getItem(LEGACY_WIDTH_KEY))+ if (storedWidth() === null && Number.isFinite(legacy) && legacy > 0) {+ const ratio = Math.min(1, legacy / available)+ setPreferredRatio(ratio)+ persistWidth(ratio)+ }+ } catch { /* unavailable */ }+ }+ }+ measure()+ const observer = new ResizeObserver(measure)+ observer.observe(parent)+ return () => {+ observer.disconnect()+ if (needsPosition) parent.style.position = previousPosition+ }+ }, [])++ // Cancel an active drag if its geometry changes or the panel unmounts.+ useEffect(() => {+ return () => { dragCleanup.current?.() }+ }, [parentWidth])++ const closeRef = useRef(onClose)+ closeRef.current = onClose+ useEffect(() => {+ if (!overlay) return+ const panel = asideRef.current+ if (!panel) return+ const previousFocus = document.activeElement as HTMLElement | null+ const placed = layoutParent(panel)+ const siblings = Array.from(placed?.container.children ?? [])+ .filter((element): element is HTMLElement => element instanceof HTMLElement && element !== placed?.self)+ const previousInert = siblings.map((element) => element.inert)+ siblings.forEach((element) => { element.inert = true })+ const focusable = () => Array.from(panel.querySelectorAll<HTMLElement>(+ 'button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"]), [contenteditable="true"], audio[controls], video[controls], summary'+ )).filter((element) => !element.closest('[inert]') && !element.hidden)+ ;(focusable()[0] ?? panel).focus()+ // Dropdowns render in a portal, outside the aside. Keep keyboard focus in+ // menus owned by this panel rather than pulling it back to the header.+ const ownsPortalFocus = (target: EventTarget | null) => target instanceof Node &&+ Array.from(panel.querySelectorAll('[aria-controls]')).some((trigger) => {+ const controlled = document.getElementById(trigger.getAttribute('aria-controls') ?? '')+ return controlled?.contains(target)+ })+ const onKey = (event: KeyboardEvent) => {+ if (event.key === 'Escape' && !event.defaultPrevented && !document.querySelector('[data-state="open"][role="menu"], [data-state="open"][data-slot="popover-content"]')) {+ event.preventDefault()+ event.stopPropagation()+ closeRef.current()+ } else if (event.key === 'Tab' && !ownsPortalFocus(event.target)) {+ const elements = focusable()+ const index = elements.indexOf(document.activeElement as HTMLElement)+ if (!elements.length || (event.shiftKey ? index <= 0 : index === elements.length - 1 || index < 0)) {+ event.preventDefault()+ ;(event.shiftKey ? elements.at(-1) ?? panel : elements[0] ?? panel).focus()+ }+ }+ }+ const onFocus = (event: FocusEvent) => {+ if (!panel.contains(event.target as Node) && !ownsPortalFocus(event.target)) (focusable()[0] ?? panel).focus()+ }+ document.addEventListener('keydown', onKey)+ document.addEventListener('focusin', onFocus)+ return () => {+ document.removeEventListener('keydown', onKey)+ document.removeEventListener('focusin', onFocus)+ siblings.forEach((element, index) => { element.inert = previousInert[index] })+ if (previousFocus?.isConnected) previousFocus.focus()+ }+ }, [overlay])++ const commitWidth = useCallback((value: number) => {+ if (parentWidth <= 0) return+ const next = clampWidth(value)+ setExpanded(false)+ setPreferredRatio(next / parentWidth)+ persistWidth(next / parentWidth)+ }, [clampWidth, parentWidth])- // Pointer capture keeps move events flowing to the handle even while the- // pointer crosses the preview's iframe, which otherwise swallows them and- // freezes the drag mid-resize.const onPointerDown = useCallback((e: React.PointerEvent<HTMLDivElement>) => {+ if (overlay || e.button !== 0 || e.isPrimary === false) returne.preventDefault()+ dragCleanup.current?.()const handle = e.currentTarget+ handle.focus()const pointerId = e.pointerIdconst startX = e.clientX- // Measure the rendered width so a drag that starts while expanded picks- // up from the size on screen instead of a stale state value.- const startW =- asideRef.current?.getBoundingClientRect().width ?? widthRef.current+ const startW = asideRef.current?.getBoundingClientRect().width ?? width+ let next = clampWidth(startW)setExpanded(false)+ setPreferredRatio(next / parentWidth)setResizing(true)handle.setPointerCapture(pointerId)const onMove = (ev: PointerEvent) => {- const next = clampWidth(startW + (startX - ev.clientX)) // left edge -> drag left = wider- widthRef.current = next- setWidth(next)+ if (ev.pointerId !== pointerId) return+ next = clampWidth(startW + startX - ev.clientX)+ setPreferredRatio(next / parentWidth)}- const onUp = () => {+ const cleanup = () => {handle.removeEventListener('pointermove', onMove)- handle.removeEventListener('pointerup', onUp)- handle.removeEventListener('pointercancel', onUp)- if (handle.hasPointerCapture(pointerId)) {- handle.releasePointerCapture(pointerId)- }+ handle.removeEventListener('pointerup', onEnd)+ handle.removeEventListener('pointercancel', onEnd)+ handle.removeEventListener('lostpointercapture', onEnd)+ dragCleanup.current = null+ if (handle.hasPointerCapture(pointerId)) handle.releasePointerCapture(pointerId)setResizing(false)- window.localStorage.setItem(PANEL_WIDTH_KEY, String(widthRef.current))}+ const onEnd = (ev: PointerEvent) => {+ if (ev.pointerId !== pointerId) return+ cleanup()+ persistWidth(next / parentWidth)+ }+ dragCleanup.current = cleanuphandle.addEventListener('pointermove', onMove)- handle.addEventListener('pointerup', onUp)- handle.addEventListener('pointercancel', onUp)+ handle.addEventListener('pointerup', onEnd)+ handle.addEventListener('pointercancel', onEnd)+ handle.addEventListener('lostpointercapture', onEnd)},- []+ [clampWidth, overlay, width, parentWidth])const resetWidth = useCallback(() => {- widthRef.current = PANEL_DEFAULT_W- setWidth(PANEL_DEFAULT_W)+ dragCleanup.current?.()+ setPreferredRatio(null)setExpanded(false)- window.localStorage.setItem(PANEL_WIDTH_KEY, String(PANEL_DEFAULT_W))+ persistWidth(null)}, [])return (- <aside+ <motion.asideref={asideRef}- className="relative flex h-full max-w-[70%] shrink-0 flex-col border-l bg-main-view"- // Expanded takes everything the max-width cap allows, so it can only- // grow the panel; a dragged width is honored otherwise.- style={{ width: expanded ? '70%' : `${width}px` }}+ role={overlay ? 'dialog' : undefined}+ aria-modal={overlay || undefined}+ aria-label={overlay ? t('common:overview.title') : undefined}+ tabIndex={-1}+ // Keep every rail below body-portalled menus, including its opacity animation.+ className={cn('z-(--layer-panel) flex min-w-0 shrink-0 flex-col border-l bg-main-view', overlay ? (phone ? 'fixed inset-x-0 bottom-0' : 'absolute inset-y-0 right-0 h-full') : 'relative h-full')}+ style={overlay && phone ? { top: TITLEBAR_HEIGHT } : undefined}+ initial={reduceMotion ? false : { width: 0, opacity: 0 }}+ animate={{ width: overlay && phone ? '100vw' : width, opacity: 1 }}+ exit={reduceMotion ? { opacity: 0 } : { width: 0, opacity: 0, pointerEvents: 'none' }}+ transition={{ duration: reduceMotion || resizing ? 0 : 0.25, ease: [0.22, 1, 0.36, 1] }}>- {/* Resize handle: thin invisible strip on the left edge. Double-click- resets to the default width. */}<divrole="separator"+ tabIndex={overlay ? -1 : 0}+ aria-label={t('common:overview.resize')}aria-orientation="vertical"+ aria-valuemin={minWidth}+ aria-valuemax={maxWidth}+ aria-valuenow={width}+ aria-valuetext={`${width} pixels`}+ aria-disabled={overlay}onPointerDown={onPointerDown}onDoubleClick={resetWidth}- className="absolute inset-y-0 left-0 z-10 w-1.5 cursor-col-resize touch-none bg-main-view-fg/0 transition-colors hover:bg-main-view-fg/20"+ onKeyDown={(event) => {+ if (overlay) return+ const next = event.key === 'Home' ? minWidth+ : event.key === 'End' ? maxWidth+ : event.key === 'ArrowLeft' ? width + RESIZE_STEP+ : event.key === 'ArrowRight' ? width - RESIZE_STEP : null+ if (next === null) return+ event.preventDefault()+ commitWidth(next)+ }}+ className={cn('absolute inset-y-0 left-0 z-10 w-1.5 touch-none bg-main-view-fg/0 transition-colors motion-reduce:transition-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring', !overlay && 'cursor-col-resize hover:bg-main-view-fg/20')}/>- <div className="flex h-11 shrink-0 items-center gap-2 border-b px-3">+ <div className="flex h-11 shrink-0 items-center gap-2 border-b border-main-view-fg/10 bg-main-view-fg/[0.025] px-3 text-main-view-fg">{leading}<span className="min-w-0 flex-1 truncate text-sm font-medium">{title}</span>- {summary}- <button- type="button"- onClick={() => setExpanded((value) => !value)}- aria-label={expanded ? t('common:collapse') : t('common:expand')}- title={expanded ? t('common:collapse') : t('common:expand')}- className="text-main-view-fg/60 hover:text-main-view-fg"- >- {expanded ? <Minimize2 size={16} /> : <Maximize2 size={16} />}- </button>- <button- type="button"- onClick={onClose}- aria-label={t('common:close')}- className="text-main-view-fg/60 hover:text-main-view-fg"- >- <X size={18} />- </button>+ <div className="flex shrink-0 items-center gap-0.5">+ {summary}+ <CoworkPanelButton+ onClick={() => setExpanded((value) => !value)}+ aria-label={expanded ? t('common:collapse') : t('common:expand')}+ aria-pressed={expanded}+ title={expanded ? t('common:collapse') : t('common:expand')}+ >+ {expanded ? <Minimize2 className="size-4" /> : <Maximize2 className="size-4" />}+ </CoworkPanelButton>+ <CoworkPanelButton+ onClick={onClose}+ aria-label={t('common:close')}+ title={t('common:close')}+ >+ <X className="size-4" />+ </CoworkPanelButton>+ </div></div>- {/* An iframe under the pointer would steal the drag on WebKit even with- pointer capture, so the body goes inert while resizing. */}- <div className={cn('min-h-0 flex-1', resizing && 'pointer-events-none select-none')}>+ {/* Pointer capture alone is insufficient for iframe crossings on WebKit. */}+ <div inert={resizing || undefined} className={cn('min-h-0 flex-1', resizing && 'pointer-events-none select-none')}>{children}</div>- </aside>+ </motion.aside>)}diff --git a/web-app/src/containers/HeaderPage.tsx b/web-app/src/containers/HeaderPage.tsxindex a7dbbcaec..bede24ebb 100644--- a/web-app/src/containers/HeaderPage.tsx+++ b/web-app/src/containers/HeaderPage.tsx@@ -1,10 +1,10 @@import { useLeftPanel } from '@/hooks/useLeftPanel'import { cn } from '@/lib/utils'-import {- IconLayoutSidebar,-} from '@tabler/icons-react'+import { PanelLeft } from 'lucide-react'import { ReactNode, memo } from 'react'import { Button } from "@/components/ui/button"+import { useOptionalSidebar } from '@/components/ui/sidebar'+import { useTranslation } from '@/i18n/react-i18next-compat'import { DownloadManagement } from '@/containers/DownloadManegement'import { useTitlebarLayout } from '@/stores/titlebar-layout-store'@@ -13,21 +13,30 @@ type HeaderPageProps = {}const HeaderPage = memo(function HeaderPage({ children }: HeaderPageProps) {const { open, setLeftPanel } = useLeftPanel()+ const { t } = useTranslation()+ // Below the desktop breakpoint the sidebar is an overlay that is never part of+ // the page, whatever the persisted desktop preference says. The header then+ // owns the top-left strip and the only way to reach navigation.+ const sidebar = useOptionalSidebar()+ const isMobile = sidebar?.isMobile ?? false+ const ownsTopLeft = isMobile || !open// Collapsed, this header owns the top-left strip — indent past left-anchored Linux// window controls (size-8 each at left-4); macOS uses the pl-24 class below.const leftButtons = useTitlebarLayout((s) => s.layout.left.length)const linuxControlsPad =- !IS_MACOS && !open && leftButtons > 0 ? leftButtons * 32 + 24 : undefined+ !IS_MACOS && ownsTopLeft && leftButtons > 0 ? leftButtons * 32 + 24 : undefined// Right-anchored controls (Windows, and Linux DEs that place them there) sit at// right-4 above the header — keep header content clear of them at every width.const rightButtons = useTitlebarLayout((s) => s.layout.right.length)- const rightControlsPad = rightButtons > 0 ? rightButtons * 32 + 24 : undefined+ const rightControlsPad = !IS_MACOS && rightButtons > 0 ? rightButtons * 32 + 24 : undefinedreturn (<divclassName={cn(- 'h-15 flex items-center shrink-0',- (IS_MACOS && !open) ? 'pl-24' : ' pl-4',+ // Sit above the global drag surface, but let empty header space pass+ // through to it. Only interactive descendants receive pointer events.+ 'relative z-30 h-15 flex items-center shrink-0 pointer-events-none [&_button]:pointer-events-auto [&_a]:pointer-events-auto [&_input]:pointer-events-auto [&_[role="button"]]:pointer-events-auto',+ (IS_MACOS && ownsTopLeft) ? 'pl-24' : ' pl-4',children === undefined && 'border-none')}style={{@@ -40,17 +49,25 @@ const HeaderPage = memo(function HeaderPage({ children }: HeaderPageProps) {'flex items-center w-full gap-1',)}>- {!open && (+ {ownsTopLeft && (<><Buttonvariant="ghost"size="icon-sm"className='rounded-full relative z-50'- onClick={() => setLeftPanel(!open)}- aria-label="Toggle sidebar"+ data-sidebar-toggle="header"+ data-testid="sidebar-toggle"+ onClick={(event) =>+ sidebar+ ? sidebar.toggleSidebar(event.currentTarget)+ : setLeftPanel(!open)+ }+ aria-label={t('common:sidebar.toggle')}+ title={t('common:sidebar.toggle')}+ aria-expanded={sidebar ? (isMobile ? sidebar.openMobile : sidebar.open) : open}>- <IconLayoutSidebar- className="text-muted-foreground relative size-4.5"+ <PanelLeft+ className="text-muted-foreground relative size-4"/></Button>{/* After the toggle so the toggle stays put when this appears */}diff --git a/web-app/src/containers/__tests__/ConversationHeaderTitle.test.tsx b/web-app/src/containers/__tests__/ConversationHeaderTitle.test.tsxnew file mode 100644index 000000000..50b337435--- /dev/null+++ b/web-app/src/containers/__tests__/ConversationHeaderTitle.test.tsx@@ -0,0 +1,24 @@+import { render, screen } from '@testing-library/react'+import { describe, expect, it, vi } from 'vitest'+import type { ReactNode } from 'react'+import { ConversationHeaderTitle } from '../ConversationHeaderTitle'++vi.mock('@tanstack/react-router', () => ({+ Link: ({ children, to: _to, params: _params, ...props }: { children: ReactNode; to: string; params: unknown }) => <a {...props}>{children}</a>,+}))++describe('ConversationHeaderTitle', () => {+ const project = { id: 'qa-project', name: 'QA Postfix Assigned' }++ it('gives a project-only header all available width', () => {+ render(<ConversationHeaderTitle project={project} />)+ expect(screen.getByText(project.name)).toHaveClass('max-w-full')+ expect(screen.getByText(project.name)).not.toHaveClass('max-w-[40%]')+ })++ it('shares space when a conversation title is present', () => {+ render(<ConversationHeaderTitle project={project} title="Conversation" />)+ expect(screen.getByText(project.name)).toHaveClass('max-w-[40%]')+ expect(screen.getByText('Conversation')).toHaveAttribute('title', 'Conversation')+ })+})diff --git a/web-app/src/containers/__tests__/CoworkArtifactCard.test.tsx b/web-app/src/containers/__tests__/CoworkArtifactCard.test.tsxindex e4b136522..582929fe2 100644--- a/web-app/src/containers/__tests__/CoworkArtifactCard.test.tsx+++ b/web-app/src/containers/__tests__/CoworkArtifactCard.test.tsx@@ -1,10 +1,24 @@import '@testing-library/jest-dom/vitest'-import { render, screen } from '@testing-library/react'-import { describe, expect, it, vi } from 'vitest'+import { fireEvent, render, screen } from '@testing-library/react'+import userEvent from '@testing-library/user-event'+import { beforeEach, describe, expect, it, vi } from 'vitest'++const mocks = vi.hoisted(() => ({+ openArtifact: vi.fn().mockResolvedValue(undefined),+ revealItemInDir: vi.fn().mockResolvedValue(undefined),+ convertFileSrc: vi.fn((path: string) => `asset://${path}`),+}))vi.mock('@/i18n/react-i18next-compat', () => ({useTranslation: () => ({ t: (key: string) => key }),}))+vi.mock('@/hooks/useServiceHub', () => ({+ useServiceHub: () => ({+ core: () => ({ convertFileSrc: mocks.convertFileSrc }),+ opener: () => ({ revealItemInDir: mocks.revealItemInDir }),+ }),+}))+vi.mock('@/lib/previewProtocol', () => ({ artifactOpener: () => mocks }))import { CoworkArtifactCard } from '../CoworkArtifactCard'import type { CoworkArtifact } from '@/lib/coworkArtifacts'@@ -16,15 +30,64 @@ const artifact: CoworkArtifact = {label: 'HTML',}+beforeEach(() => vi.clearAllMocks())+describe('CoworkArtifactCard', () => {- it('exposes the complete artifact title when the card truncates it', () => {- render(- <CoworkArtifactCard artifact={artifact} roots={[]} onPreview={vi.fn()} />- )-- expect(screen.getByText(artifact.title)).toHaveAttribute(- 'title',- artifact.title- )+ it('keeps the default inline title and text open action', () => {+ const { container } = render(<CoworkArtifactCard artifact={artifact} roots={['/workspace']} onPreview={vi.fn()} />)+ expect(screen.getByText(artifact.title)).toHaveAttribute('title', artifact.title)+ expect(screen.getByText('common:artifactOpenExternal')).toBeInTheDocument()+ expect(screen.queryByText(artifact.path)).not.toBeInTheDocument()+ expect(container.firstChild).toHaveClass('h-[50px]', 'rounded-xl', 'border', 'border-border', 'bg-muted', 'shadow-none', 'dark:border-transparent', 'dark:bg-muted/40')+ })++ it('makes the library main area a keyboard-accessible preview with title, type and path', async () => {+ const onPreview = vi.fn()+ render(<CoworkArtifactCard variant="library" artifact={artifact} roots={['/workspace']} onPreview={onPreview} />)+ const preview = screen.getByRole('button', { name: `common:artifactOpenPreview: ${artifact.title}` })+ expect(preview).toContainElement(screen.getByText(artifact.title))+ expect(preview).toContainElement(screen.getByText(artifact.label))+ expect(preview).toContainElement(screen.getByText(artifact.path))+ expect(screen.queryByRole('img')).not.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'common:artifactOpenExternal' })).toHaveTextContent('')+ preview.focus()+ await userEvent.keyboard('{Enter}')+ expect(onPreview).toHaveBeenCalledWith(artifact.path)+ })++ it('uses a real image thumbnail and falls back to an icon when it cannot load', () => {+ const image: CoworkArtifact = { ...artifact, path: 'images/cover.png', group: 'Image', label: 'PNG' }+ const { container } = render(<CoworkArtifactCard variant="library" artifact={image} roots={['/workspace']} onPreview={vi.fn()} />)+ const thumbnail = container.querySelector('img')!+ expect(thumbnail).toHaveAttribute('src', 'asset:///workspace/images/cover.png')+ fireEvent.error(thumbnail)+ expect(container.querySelector('img')).toBeNull()+ expect(screen.getByText(image.title)).toBeInTheDocument()+ })++ it('opens externally without previewing and keeps preview and reveal actions in the menu', async () => {+ const user = userEvent.setup()+ const onPreview = vi.fn()+ render(<CoworkArtifactCard variant="library" artifact={artifact} roots={['/workspace']} onPreview={onPreview} />)+ await user.click(screen.getByRole('button', { name: 'common:artifactOpenExternal' }))+ expect(mocks.openArtifact).toHaveBeenCalledWith(['/workspace'], `/workspace/${artifact.path}`)+ expect(onPreview).not.toHaveBeenCalled()+ await user.click(screen.getByRole('button', { name: 'common:artifactMoreActions' }))+ await user.click(screen.getByRole('menuitem', { name: 'common:artifactOpenPreview' }))+ expect(onPreview).toHaveBeenCalledWith(artifact.path)+ await user.click(screen.getByRole('button', { name: 'common:artifactMoreActions' }))+ await user.click(screen.getByRole('menuitem', { name: 'common:artifactShowInFolder' }))+ expect(mocks.revealItemInDir).toHaveBeenCalledWith(`/workspace/${artifact.path}`)+ await user.click(screen.getByRole('button', { name: 'common:artifactMoreActions' }))+ await user.click(screen.getByRole('menuitem', { name: 'common:artifactOpenExternal' }))+ expect(mocks.openArtifact).toHaveBeenCalledTimes(2)+ })++ it('still previews unresolved files without offering unavailable OS actions', async () => {+ const onPreview = vi.fn()+ render(<CoworkArtifactCard variant="library" artifact={artifact} roots={[]} onPreview={onPreview} />)+ await userEvent.click(screen.getByRole('button', { name: `common:artifactOpenPreview: ${artifact.title}` }))+ expect(onPreview).toHaveBeenCalledWith(artifact.path)+ expect(screen.queryByRole('button', { name: 'common:artifactOpenExternal' })).not.toBeInTheDocument()})})diff --git a/web-app/src/containers/__tests__/CoworkOverviewPanel.test.tsx b/web-app/src/containers/__tests__/CoworkOverviewPanel.test.tsxnew file mode 100644index 000000000..d99f1cdce--- /dev/null+++ b/web-app/src/containers/__tests__/CoworkOverviewPanel.test.tsx@@ -0,0 +1,75 @@+import { render, screen, fireEvent } from '@testing-library/react'+import { describe, it, expect, vi } from 'vitest'+import '@testing-library/jest-dom/vitest'+import { useTitlebarLayout, TITLEBAR_HEIGHT } from '@/stores/titlebar-layout-store'+import { CoworkOverviewPanel } from '../CoworkOverviewPanel'++const media = vi.hoisted(() => ({ desktop: true }))+vi.mock('@/hooks/useMediaQuery', () => ({ useMediaQuery: () => media.desktop }))+vi.mock('@/i18n/react-i18next-compat', () => ({ useTranslation: () => ({ t: (key: string) => key }) }))++const props = () => ({+ attachments: [],+ artifacts: [{ path: '/report.md', title: 'Report', group: 'Document' as const, label: 'MD' }],+ files: [{ path: 'a.ts', additions: 12, deletions: 3, operations: [] }],+ subagents: [],+ todos: { phases: [{ name: 'Work', tasks: [{ content: 'Prepare the report', status: 'completed' as const }] }] },+ onPreview: vi.fn(), onChanges: vi.fn(), onAgents: vi.fn(), onClose: vi.fn(),+})++describe('CoworkOverviewPanel', () => {+ it('describes the narrow-width sheet so Radix has an accessible description', () => {+ media.desktop = false+ try {+ render(<CoworkOverviewPanel {...props()} />)+ const dialog = screen.getByRole('dialog')+ expect(dialog).toHaveAccessibleName('common:overview.title')+ expect(dialog).toHaveAccessibleDescription('common:overview.description')+ } finally {+ media.desktop = true+ }+ })+ it('shows progress, files and change counts together', () => {+ render(<CoworkOverviewPanel {...props()} />)+ expect(screen.getByLabelText('common:overview.title')).toHaveClass('z-(--layer-panel)')+ expect(screen.getByText('Prepare the report')).toBeInTheDocument()+ expect(screen.getByText('Report')).toBeInTheDocument()+ expect(screen.getByText('+12')).toBeInTheDocument()+ expect(screen.getByText('-3')).toBeInTheDocument()+ })+ it('sections collapse independently', () => {+ render(<CoworkOverviewPanel {...props()} />)+ const progress = screen.getByRole('button', { name: 'common:overview.progress' })+ fireEvent.click(progress)+ expect(progress).toHaveAttribute('aria-expanded', 'false')+ expect(screen.getByRole('button', { name: 'common:overview.files' })).toHaveAttribute('aria-expanded', 'true')+ })+ it('keeps previews and detailed changes reachable', () => {+ const p = props()+ render(<CoworkOverviewPanel {...p} />)+ fireEvent.click(screen.getByText('Report'))+ expect(p.onPreview).toHaveBeenCalledWith('/report.md')+ fireEvent.click(screen.getByText('+12'))+ expect(p.onChanges).toHaveBeenCalledOnce()+ expect(screen.queryByRole('button', { name: 'common:overview.close' })).not.toBeInTheDocument()+ })+ it('hides agent overview and zero counts when there are no changes or agent activity', () => {+ render(<CoworkOverviewPanel {...props()} files={[]} />)+ expect(screen.queryByText('common:overview.agents')).not.toBeInTheDocument()+ expect(screen.queryByText('+0')).not.toBeInTheDocument()+ })+ it('keeps monitor activity visible without showing an empty diff', () => {+ render(<CoworkOverviewPanel {...props()} files={[]} monitorCount={1} />)+ expect(screen.getByText('common:overview.monitorCount')).toBeInTheDocument()+ expect(screen.queryByText('+0')).not.toBeInTheDocument()+ })++ it('starts below the complete right-side caption control strip', () => {+ vi.stubGlobal('IS_MACOS', false)+ useTitlebarLayout.setState({ layout: { left: [], right: ['minimize', 'maximize', 'close'] } })+ render(<CoworkOverviewPanel {...props()} />)+ expect(screen.getByLabelText('common:overview.title')).toHaveStyle({ top: `${TITLEBAR_HEIGHT}px` })+ vi.unstubAllGlobals()+ })++})diff --git a/web-app/src/containers/__tests__/CoworkPreviewPanel.test.tsx b/web-app/src/containers/__tests__/CoworkPreviewPanel.test.tsxindex 45baaaba7..da9f4c76e 100644--- a/web-app/src/containers/__tests__/CoworkPreviewPanel.test.tsx+++ b/web-app/src/containers/__tests__/CoworkPreviewPanel.test.tsx@@ -1,5 +1,6 @@import { describe, it, expect, vi, beforeEach } from 'vitest'-import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'+import userEvent from '@testing-library/user-event'+import { act, render, screen, waitFor } from '@testing-library/react'vi.mock('@/i18n/react-i18next-compat', () => ({useTranslation: () => ({@@ -56,6 +57,12 @@ const respondWith = (body: string) => {const view = (path: string, roots: Array<string | null> = [ROOT]) =>render(<CoworkPreviewPanel roots={roots} path={path} onClose={vi.fn()} />)+const selectAction = async (name: string, checkbox = false) => {+ const user = userEvent.setup()+ await user.click(screen.getByRole('button', { name: 'common:artifactMoreActions' }))+ await user.click(screen.getByRole(checkbox ? 'menuitemcheckbox' : 'menuitem', { name }))+}+describe('CoworkPreviewPanel', () => {beforeEach(() => {convertFileSrc.mockClear()@@ -124,7 +131,7 @@ describe('CoworkPreviewPanel', () => {view('game.html')await screen.findByText('common:preview.externalRefs#1')- fireEvent.click(screen.getByLabelText('common:preview.allowNetwork'))+ await selectAction('common:preview.allowNetwork', true)await waitFor(() =>expect(screen.queryByText('common:preview.externalRefs#1')).toBeNull())@@ -193,7 +200,7 @@ describe('CoworkPreviewPanel', () => {const { unmount } = view('game.html')await screen.findByTitle('game.html')- fireEvent.click(screen.getByLabelText('common:preview.unsandboxed'))+ await selectAction('common:preview.unsandboxed', true)const frame = (await waitFor(() => {const f = screen.getByTitle('game.html') as HTMLIFrameElementexpect(f.getAttribute('src')).toBeTruthy()@@ -206,7 +213,7 @@ describe('CoworkPreviewPanel', () => {expect(previewRegisterRoot).toHaveBeenLastCalledWith(ROOT, false))- fireEvent.click(screen.getByLabelText('common:preview.allowNetwork'))+ await selectAction('common:preview.allowNetwork', true)await waitFor(() =>expect(previewRegisterRoot).toHaveBeenLastCalledWith(ROOT, true))@@ -237,7 +244,7 @@ describe('CoworkPreviewPanel', () => {view(`${folder}/game.html`, [ROOT, folder])await screen.findByTitle(`${folder}/game.html`)- fireEvent.click(screen.getByLabelText('common:preview.unsandboxed'))+ await selectAction('common:preview.unsandboxed', true)await waitFor(() =>expect(previewRegisterRoot).toHaveBeenLastCalledWith(folder, false))@@ -251,7 +258,8 @@ describe('CoworkPreviewPanel', () => {view('game.html')const frame = (await screen.findByTitle('game.html')) as HTMLIFrameElement- expect(screen.queryByLabelText('common:preview.unsandboxed')).toBeNull()+ await userEvent.click(screen.getByRole('button', { name: 'common:artifactMoreActions' }))+ expect(screen.queryByRole('menuitemcheckbox', { name: 'common:preview.unsandboxed' })).toBeNull()expect(frame.getAttribute('sandbox')).toBe('allow-scripts')expect(frame.getAttribute('src')).toBeNull()expect(previewRegisterRoot).not.toHaveBeenCalled()@@ -264,7 +272,7 @@ describe('CoworkPreviewPanel', () => {view('page.html')await screen.findByTitle('page.html')- fireEvent.click(screen.getByLabelText('common:artifactOpenExternal'))+ await selectAction('common:artifactOpenExternal')await waitFor(() =>expect(openArtifact).toHaveBeenCalledWith('/data', [ROOT], `${ROOT}/page.html`))@@ -272,14 +280,40 @@ describe('CoworkPreviewPanel', () => {expect(revealItemInDir).not.toHaveBeenCalled()openArtifact.mockRejectedValueOnce(new Error('is a link'))- fireEvent.click(screen.getByLabelText('common:artifactOpenExternal'))+ await selectAction('common:artifactOpenExternal')await waitFor(() =>expect(revealItemInDir).toHaveBeenCalledWith(`${ROOT}/page.html`))expect(openPath).not.toHaveBeenCalled()})- it('registers nothing while the sandbox is in use', async () => {+ it('keeps secondary actions in a keyboard-accessible checked menu', async () => {+ respondWith('<p>ok</p>')+ view('page.html')+ await screen.findByTitle('page.html')+ expect(screen.queryByRole('button', { name: 'common:artifactOpenExternal' })).toBeNull()+ expect(screen.getByRole('button', { name: 'common:preview.reload' })).toBeInTheDocument()+ const user = userEvent.setup()+ screen.getByRole('button', { name: 'common:artifactMoreActions' }).focus()+ await user.keyboard('{Enter}')+ const network = await screen.findByRole('menuitemcheckbox', { name: 'common:preview.allowNetwork' })+ expect(network).toHaveAttribute('aria-checked', 'false')+ expect(network).toHaveClass('pl-2', 'pr-8')+ expect(network.firstElementChild).toHaveClass('right-2', 'text-primary')+ expect(screen.getByRole('menu')).toHaveClass('w-80', 'max-w-[calc(100vw-24px)]')+ await user.click(network)+ await user.click(screen.getByRole('button', { name: 'common:artifactMoreActions' }))+ expect(screen.getByRole('menuitemcheckbox', { name: 'common:preview.allowNetwork' })).toHaveAttribute('aria-checked', 'true')+ const unsandboxed = screen.getByRole('menuitemcheckbox', { name: 'common:preview.unsandboxed' })+ expect(unsandboxed).toHaveClass('pl-2', 'pr-8')+ expect(unsandboxed.firstElementChild).toHaveClass('right-2', 'text-primary')+ const label = screen.getByText('common:preview.unsandboxed')+ expect(label).toHaveClass('min-w-0', 'whitespace-normal')+ await user.click(screen.getByRole('menuitem', { name: 'common:artifactShowInFolder' }))+ expect(revealItemInDir).toHaveBeenCalledWith(`${ROOT}/page.html`)+ })++ it('registers nothing while the sandbox is in use' , async () => {respondWith('<p>ok</p>')view('page.html')await screen.findByTitle('page.html')diff --git a/web-app/src/containers/__tests__/CoworkSidePanel.test.tsx b/web-app/src/containers/__tests__/CoworkSidePanel.test.tsxnew file mode 100644index 000000000..67614f76b--- /dev/null+++ b/web-app/src/containers/__tests__/CoworkSidePanel.test.tsx@@ -0,0 +1,119 @@+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import '@testing-library/jest-dom/vitest'+import userEvent from '@testing-library/user-event'+import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '@/components/ui/dropdown-menu'+import { CoworkSidePanel } from '../CoworkSidePanel'++const media = vi.hoisted(() => ({ phone: false }))+vi.mock('@/hooks/useMediaQuery', () => ({ useMediaQuery: () => media.phone }))+vi.mock('@/i18n/react-i18next-compat', () => ({ useTranslation: () => ({ t: (key: string) => key }) }))+vi.mock('motion/react', () => ({+ useReducedMotion: () => true,+ motion: { aside: ({ children, animate, initial: _initial, exit: _exit, transition: _transition, style, ...props }: any) => <aside {...props} style={{ ...style, width: animate.width }}>{children}</aside> },+}))+let available = 1000+beforeEach(() => {+ media.phone = false+ localStorage.clear()+ vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(() => ({ width: available, height: 600, x: 0, y: 0, top: 0, left: 0, right: available, bottom: 600, toJSON: () => ({}) }))+})+afterEach(() => { cleanup(); vi.restoreAllMocks() })+const renderPanel = (close = vi.fn()) => render(<div><button>Conversation</button><CoworkSidePanel title="Preview" onClose={close}><button>Open file</button></CoworkSidePanel></div>)++describe('CoworkSidePanel sizing and keyboard access', () => {+ it('measures the real content row through a display:contents wrapper', () => {+ // The wrapper has no box (width 0); only the row it sits in is 1000 wide.+ vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(function (this: HTMLElement) {+ const width = this.dataset.testid === 'row' ? 1000 : 0+ return { width, height: 600, x: 0, y: 0, top: 0, left: 0, right: width, bottom: 600, toJSON: () => ({}) }+ })+ render(+ <div data-testid="row" style={{ display: 'flex' }}>+ <div style={{ display: 'contents' }}>+ <CoworkSidePanel title="Preview" onClose={vi.fn()}><button>Open file</button></CoworkSidePanel>+ </div>+ </div>+ )+ expect(screen.getByRole('separator')).toHaveAttribute('aria-valuenow', '500')+ })+ it('starts at half the parent area, not half the window', () => {+ available = 1000+ renderPanel()+ expect(screen.getByRole('separator')).toHaveAttribute('aria-valuenow', '500')+ expect(screen.getByText('Preview').closest('aside')).toHaveClass('z-(--layer-panel)')+ })+ it('persists a keyboard resize ratio and resets to equal split', () => {+ available = 1000+ renderPanel()+ const divider = screen.getByRole('separator')+ fireEvent.keyDown(divider, { key: 'ArrowLeft' })+ expect(divider).toHaveAttribute('aria-valuenow', '516')+ expect(Number(localStorage.getItem('cowork:sidePanelWidthRatio'))).toBe(0.516)+ fireEvent.doubleClick(divider)+ expect(divider).toHaveAttribute('aria-valuenow', '500')+ expect(localStorage.getItem('cowork:sidePanelWidthRatio')).toBeNull()+ })+ it('uses modal overlay with Escape close when both panes cannot fit', async () => {+ available = 600+ const close = vi.fn()+ renderPanel(close)+ const dialog = screen.getByRole('dialog')+ expect(dialog).toHaveAttribute('aria-modal', 'true')+ expect(dialog).toHaveClass('absolute', 'z-(--layer-panel)')+ expect(screen.getByRole('separator')).toHaveAttribute('aria-disabled', 'true')+ await waitFor(() => expect(dialog.contains(document.activeElement)).toBe(true))+ fireEvent.keyDown(document, { key: 'Escape' })+ expect(close).toHaveBeenCalledOnce()+ })+ it('keeps a phone rail below the titlebar and below floating menus', () => {+ available = 400+ media.phone = true+ renderPanel()+ const dialog = screen.getByRole('dialog')+ expect(dialog).toHaveClass('fixed', 'bottom-0', 'z-(--layer-panel)')+ expect(dialog).not.toHaveClass('h-full', 'inset-0', 'z-50')+ expect(dialog).toHaveStyle({ top: '60px', width: '100vw' })+ })+ it('allows focus in its portalled overflow menu in overlay mode', async () => {+ available = 600+ const close = vi.fn()+ render(<div><CoworkSidePanel title="Preview" onClose={close} summary={+ <DropdownMenu>+ <DropdownMenuTrigger>More actions</DropdownMenuTrigger>+ <DropdownMenuContent><DropdownMenuItem>Reveal file</DropdownMenuItem></DropdownMenuContent>+ </DropdownMenu>+ }>Content</CoworkSidePanel></div>)+ const user = userEvent.setup()+ await user.click(screen.getByRole('button', { name: 'More actions' }))+ await user.keyboard('{ArrowDown}')+ expect(screen.getByRole('menuitem', { name: 'Reveal file' })).toHaveFocus()+ await user.keyboard('{Escape}')+ expect(close).not.toHaveBeenCalled()+ expect(screen.getByRole('button', { name: 'More actions' })).toHaveFocus()+ })+ it('keeps expand/restore width behavior and gives close the same hit area', () => {+ available = 1200+ const close = vi.fn()+ renderPanel(close)+ const expand = screen.getByRole('button', { name: 'common:expand' })+ const closeButton = screen.getByRole('button', { name: 'common:close' })+ expect(expand).toHaveAttribute('data-size', 'icon-sm')+ expect(closeButton).toHaveAttribute('data-size', 'icon-sm')+ expect(closeButton.className).toBe(expand.className)+ expect(closeButton).toHaveAttribute('type', 'button')+ fireEvent.click(expand)+ expect(screen.getByRole('separator')).toHaveAttribute('aria-valuenow', '720')+ fireEvent.click(screen.getByRole('button', { name: 'common:collapse' }))+ expect(screen.getByRole('separator')).toHaveAttribute('aria-valuenow', '600')+ fireEvent.click(closeButton)+ expect(close).toHaveBeenCalledOnce()+ })+ it('clamps a saved ratio without overwriting it', () => {+ available = 1000+ localStorage.setItem('cowork:sidePanelWidthRatio', '0.8')+ renderPanel()+ expect(screen.getByRole('separator')).toHaveAttribute('aria-valuenow', '520')+ expect(localStorage.getItem('cowork:sidePanelWidthRatio')).toBe('0.8')+ })+})diff --git a/web-app/src/containers/__tests__/HeaderPage.test.tsx b/web-app/src/containers/__tests__/HeaderPage.test.tsxnew file mode 100644index 000000000..fb855cedf--- /dev/null+++ b/web-app/src/containers/__tests__/HeaderPage.test.tsx@@ -0,0 +1,40 @@+import { beforeEach, afterEach, describe, expect, it, vi } from 'vitest'+import { fireEvent, render, screen, cleanup } from '@testing-library/react'+import '@testing-library/jest-dom/vitest'+import HeaderPage from '../HeaderPage'++const state = vi.hoisted(() => ({ open: true, left: [] as string[], right: ['minimize', 'maximize', 'close'] }))+vi.mock('@/hooks/useLeftPanel', () => ({ useLeftPanel: () => ({ open: state.open, setLeftPanel: vi.fn() }) }))+vi.mock('@/stores/titlebar-layout-store', () => ({+ useTitlebarLayout: (selector: (s: unknown) => unknown) => selector({ layout: { left: state.left, right: state.right } }),+}))+vi.mock('@/containers/DownloadManegement', () => ({ DownloadManagement: () => null }))++beforeEach(() => { state.open = true; state.left = []; state.right = ['minimize', 'maximize', 'close']; vi.stubGlobal('IS_MACOS', false) })+afterEach(() => { cleanup(); vi.unstubAllGlobals() })++describe('HeaderPage titlebar hit areas', () => {+ it('puts interactive controls above the global drag overlay without blocking empty drag space', () => {+ const click = vi.fn()+ const { container } = render(<HeaderPage><button onClick={click}>Toggle overview</button></HeaderPage>)+ const header = container.firstElementChild!+ expect(header).toHaveClass('relative', 'z-30', 'pointer-events-none', '[&_button]:pointer-events-auto')+ fireEvent.click(screen.getByRole('button', { name: 'Toggle overview' }))+ expect(click).toHaveBeenCalledOnce()+ })+ it('reserves the full caption-button area on Windows and right-button Linux layouts', () => {+ const { container } = render(<HeaderPage><button>Action</button></HeaderPage>)+ expect(container.firstElementChild).toHaveStyle({ paddingRight: '120px' })+ })+ it('does not reserve nonexistent right caption buttons on macOS', () => {+ vi.stubGlobal('IS_MACOS', true)+ const { container } = render(<HeaderPage><button>Action</button></HeaderPage>)+ expect((container.firstElementChild as HTMLElement).style.paddingRight).toBe('')+ })+ it('respects left-button Linux layouts when the sidebar is collapsed', () => {+ state.open = false; state.left = ['close', 'minimize', 'maximize']; state.right = []+ const { container } = render(<HeaderPage><button>Action</button></HeaderPage>)+ expect(container.firstElementChild).toHaveStyle({ paddingLeft: '120px' })+ expect((container.firstElementChild as HTMLElement).style.paddingRight).toBe('')+ })+})diff --git a/web-app/src/containers/analytics/PromptAnalytic.tsx b/web-app/src/containers/analytics/PromptAnalytic.tsxindex f5303f32c..b5e235751 100644--- a/web-app/src/containers/analytics/PromptAnalytic.tsx+++ b/web-app/src/containers/analytics/PromptAnalytic.tsx@@ -1,3 +1,4 @@+import { createPortal } from 'react-dom'import { IconFileTextShield } from '@tabler/icons-react'import { useTranslation } from '@/i18n/react-i18next-compat'import { AnalyticConsent } from './AnalyticConsent'@@ -10,13 +11,14 @@ import { AnalyticConsent } from './AnalyticConsent'export function PromptAnalytic() {const { t } = useTranslation()- return (- <div className="fixed bottom-4 right-4 z-50 p-4 shadow-lg bg-background w-4/5 md:w-100 border rounded-lg">+ return createPortal(+ <div className="fixed bottom-4 right-4 z-(--layer-floating) p-4 shadow-lg bg-background w-4/5 md:w-100 border rounded-lg"><div className="mb-2 flex items-center gap-2"><IconFileTextShield className="text-muted-foreground" /><h2 className="font-medium">{t('helpUsImproveJan')}</h2></div><AnalyticConsent />- </div>+ </div>,+ document.body)}diff --git a/web-app/src/containers/dialogs/AppUpdater.tsx b/web-app/src/containers/dialogs/AppUpdater.tsxindex 755667680..2f034db6d 100644--- a/web-app/src/containers/dialogs/AppUpdater.tsx+++ b/web-app/src/containers/dialogs/AppUpdater.tsx@@ -1,3 +1,4 @@+import { createPortal } from 'react-dom'import { useAppUpdater } from '@/hooks/useAppUpdater'import { IconDownload } from '@tabler/icons-react'@@ -45,10 +46,10 @@ const DialogAppUpdater = () => {return (<>- {appUpdateState.isUpdateAvailable && (+ {appUpdateState.isUpdateAvailable && createPortal(<divclassName={cn(- 'fixed z-50 bottom-3 right-3 bg-background flex items-center justify-center border rounded-lg shadow-md'+ 'fixed z-(--layer-floating) bottom-3 right-3 bg-background flex items-center justify-center border rounded-lg shadow-md')}><div className="px-2 py-4">@@ -122,7 +123,8 @@ const DialogAppUpdater = () => {</div></div></div>- </div>+ </div>,+ document.body)}</>)diff --git a/web-app/src/locales/de-DE/common.json b/web-app/src/locales/de-DE/common.jsonindex fc9046945..657de03a2 100644--- a/web-app/src/locales/de-DE/common.json+++ b/web-app/src/locales/de-DE/common.json@@ -437,7 +437,10 @@"deleteSessionTitle": "Sitzung löschen?","deleteSessionBody": "„{{title}}“ und das zugehörige Protokoll werden endgültig gelöscht. Das lässt sich nicht rückgängig machen.","sidebar": {- "more": "Mehr"+ "more": "Mehr",+ "toggle": "Seitenleiste ein- oder ausblenden",+ "navigation": "Navigation",+ "navigationDescription": "Zu Chats, Projekten, Artefakten, Skills und Einstellungen springen."},"composer": {"addControls": "Anhänge und Steuerelemente hinzufügen",@@ -491,5 +494,13 @@},"skillDestination": "Neue Skills speichern in","skillDestinationFolder": "Diesem Ordner",- "skillDestinationGlobal": "Global (jede Unterhaltung)"+ "skillDestinationGlobal": "Global (jede Unterhaltung)",+ "overview": {+ "description": "Fortschritt, Dateien und Hintergrundaufgaben dieser Unterhaltung."+ },+ "artifactsLibraryDescription": "Dateien aus all deinen Unterhaltungen an einem Ort.",+ "artifactsLibraryCount_one": "{{count}} Datei",+ "artifactsLibraryCount_other": "{{count}} Dateien",+ "artifactsLibraryFilter": "Nach Dateityp filtern",+ "artifactsLibraryReset": "Filter zurücksetzen"}diff --git a/web-app/src/locales/en/common.json b/web-app/src/locales/en/common.jsonindex b3029e473..f2387afbc 100644--- a/web-app/src/locales/en/common.json+++ b/web-app/src/locales/en/common.json@@ -815,7 +815,10 @@"agentSettings": "Agent","chatsAndTasks": "Chats and tasks","sidebar": {- "more": "More"+ "more": "More",+ "toggle": "Toggle sidebar",+ "navigation": "Navigation",+ "navigationDescription": "Jump to chats, projects, artifacts, skills and settings."},"composer": {"addControls": "Add attachments and controls",@@ -869,5 +872,23 @@},"skillDestination": "Save new skills to","skillDestinationFolder": "This folder",- "skillDestinationGlobal": "Global (every conversation)"+ "skillDestinationGlobal": "Global (every conversation)",+ "overview": {+ "title": "Conversation overview",+ "description": "Progress, files and background tasks for this conversation.",+ "resize": "Resize side panel",+ "close": "Hide conversation overview",+ "progress": "Progress",+ "files": "Files",+ "backgroundTasks": "Background tasks",+ "monitorCount_one": "{{count}} monitor",+ "monitorCount_other": "{{count}} monitors",+ "noProgress": "Steps will appear as Jan works.",+ "noFiles": "Files will appear here."+ },+ "artifactsLibraryDescription": "Files created across your conversations, all in one place.",+ "artifactsLibraryCount_one": "{{count}} file",+ "artifactsLibraryCount_other": "{{count}} files",+ "artifactsLibraryFilter": "Filter by file type",+ "artifactsLibraryReset": "Clear filters"}diff --git a/web-app/src/locales/fr/common.json b/web-app/src/locales/fr/common.jsonindex 3dbeafa45..2ed2728bb 100644--- a/web-app/src/locales/fr/common.json+++ b/web-app/src/locales/fr/common.json@@ -440,7 +440,10 @@"deleteSessionTitle": "Supprimer la session ?","deleteSessionBody": "« {{title}} » et sa transcription seront supprimées définitivement. Cette action est irréversible.","sidebar": {- "more": "Plus"+ "more": "Plus",+ "toggle": "Afficher ou masquer la barre latérale",+ "navigation": "Navigation",+ "navigationDescription": "Accéder aux discussions, projets, artefacts, compétences et paramètres."},"composer": {"addControls": "Ajouter des pièces jointes et des commandes",@@ -494,5 +497,13 @@},"skillDestination": "Enregistrer les nouvelles compétences dans","skillDestinationFolder": "Ce dossier",- "skillDestinationGlobal": "Global (toutes les conversations)"+ "skillDestinationGlobal": "Global (toutes les conversations)",+ "overview": {+ "description": "Progression, fichiers et tâches en arrière-plan de cette conversation."+ },+ "artifactsLibraryDescription": "Les fichiers créés dans vos conversations, réunis au même endroit.",+ "artifactsLibraryCount_one": "{{count}} fichier",+ "artifactsLibraryCount_other": "{{count}} fichiers",+ "artifactsLibraryFilter": "Filtrer par type de fichier",+ "artifactsLibraryReset": "Effacer les filtres"}diff --git a/web-app/src/locales/ja/common.json b/web-app/src/locales/ja/common.jsonindex 49e6bf160..5b219fa79 100644--- a/web-app/src/locales/ja/common.json+++ b/web-app/src/locales/ja/common.json@@ -554,7 +554,10 @@"deleteSessionTitle": "セッションを削除しますか?","deleteSessionBody": "「{{title}}」とそのトランスクリプトは完全に削除されます。この操作は元に戻せません。","sidebar": {- "more": "その他"+ "more": "その他",+ "toggle": "サイドバーの表示を切り替え",+ "navigation": "ナビゲーション",+ "navigationDescription": "チャット、プロジェクト、アーティファクト、スキル、設定に移動します。"},"composer": {"addControls": "添付ファイルとコントロールを追加",@@ -608,5 +611,13 @@},"skillDestination": "新しいスキルの保存先","skillDestinationFolder": "このフォルダー",- "skillDestinationGlobal": "グローバル(すべての会話)"+ "skillDestinationGlobal": "グローバル(すべての会話)",+ "overview": {+ "description": "この会話の進捗、ファイル、バックグラウンドタスク。"+ },+ "artifactsLibraryDescription": "すべての会話で作成されたファイルを一か所にまとめて表示します。",+ "artifactsLibraryCount_one": "{{count}} 件のファイル",+ "artifactsLibraryCount_other": "{{count}} 件のファイル",+ "artifactsLibraryFilter": "ファイルの種類で絞り込む",+ "artifactsLibraryReset": "フィルターをクリア"}diff --git a/web-app/src/locales/zh-CN/common.json b/web-app/src/locales/zh-CN/common.jsonindex f64600006..0076dcb03 100644--- a/web-app/src/locales/zh-CN/common.json+++ b/web-app/src/locales/zh-CN/common.json@@ -616,7 +616,10 @@"deleteSessionTitle": "删除会话?","deleteSessionBody": "“{{title}}”及其记录将被永久删除,此操作无法撤销。","sidebar": {- "more": "更多"+ "more": "更多",+ "toggle": "切换侧边栏",+ "navigation": "导航",+ "navigationDescription": "跳转到聊天、项目、产物、技能和设置。"},"composer": {"addControls": "添加附件和控件",@@ -670,5 +673,13 @@},"skillDestination": "新技能保存到","skillDestinationFolder": "此文件夹",- "skillDestinationGlobal": "全局(所有对话)"+ "skillDestinationGlobal": "全局(所有对话)",+ "overview": {+ "description": "此对话的进度、文件和后台任务。"+ },+ "artifactsLibraryDescription": "你在所有对话中创建的文件,集中在一处。",+ "artifactsLibraryCount_one": "{{count}} 个文件",+ "artifactsLibraryCount_other": "{{count}} 个文件",+ "artifactsLibraryFilter": "按文件类型筛选",+ "artifactsLibraryReset": "清除筛选"}diff --git a/web-app/src/providers/KeyboardShortcuts.tsx b/web-app/src/providers/KeyboardShortcuts.tsxindex 33f705f81..4f0a6bbd6 100644--- a/web-app/src/providers/KeyboardShortcuts.tsx+++ b/web-app/src/providers/KeyboardShortcuts.tsx@@ -1,5 +1,5 @@import { useKeyboardShortcut } from '@/hooks/useHotkeys'-import { useLeftPanel } from '@/hooks/useLeftPanel'+import { useSidebar } from '@/components/ui/sidebar'import { useSearchDialog } from '@/hooks/useSearchDialog'import { useProjectDialog } from '@/hooks/useProjectDialog'import { useRouter } from '@tanstack/react-router'@@ -11,7 +11,8 @@ import { useMessageZoom } from '@/hooks/useMessageZoom'import { TEMPORARY_CHAT_ID } from '@/constants/chat'export function KeyboardShortcutsProvider() {- const { open, setLeftPanel } = useLeftPanel()+ // The overlay on narrow windows and the docked sidebar toggle differently.+ const { toggleSidebar } = useSidebar()const { setOpen: setSearchOpen } = useSearchDialog()const { setOpen: setProjectDialogOpen } = useProjectDialog()const router = useRouter()@@ -29,7 +30,7 @@ export function KeyboardShortcutsProvider() {useKeyboardShortcut({...sidebarShortcut,callback: () => {- setLeftPanel(!open)+ toggleSidebar()},})diff --git a/web-app/src/providers/__tests__/KeyboardShortcuts.sidebar.test.tsx b/web-app/src/providers/__tests__/KeyboardShortcuts.sidebar.test.tsxnew file mode 100644index 000000000..60543a250--- /dev/null+++ b/web-app/src/providers/__tests__/KeyboardShortcuts.sidebar.test.tsx@@ -0,0 +1,120 @@+import '@testing-library/jest-dom/vitest'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'++const h = vi.hoisted(() => ({+ mobile: true,+ // Mutable so a test can customise the sidebar shortcut.+ sidebar: { key: 'b', metaKey: true, ctrlKey: false } as Record<string, unknown>,+}))++vi.mock('@/hooks/use-mobile', () => ({ useIsMobile: () => h.mobile }))+vi.mock('@/i18n/react-i18next-compat', () => ({+ useTranslation: () => ({ t: (key: string) => key }),+}))+vi.mock('@tanstack/react-router', () => ({+ useRouter: () => ({+ state: { location: { pathname: '/' } },+ navigate: vi.fn(),+ }),+}))+vi.mock('@/hooks/useSearchDialog', () => ({+ useSearchDialog: () => ({ setOpen: vi.fn() }),+}))+vi.mock('@/hooks/useProjectDialog', () => ({+ useProjectDialog: () => ({ setOpen: vi.fn() }),+}))+vi.mock('@/hooks/useMessageZoom', () => ({ useMessageZoom: () => {} }))+vi.mock('@/lib/shortcuts', () => ({+ isMac: true,+ ShortcutAction: {+ TOGGLE_SIDEBAR: 'toggleSidebar',+ NEW_CHAT: 'newChat',+ NEW_PROJECT: 'newProject',+ GO_TO_SETTINGS: 'goSettings',+ SEARCH: 'search',+ SWITCH_ASSISTANT: 'switchAssistant',+ },+ PlatformShortcuts: new Proxy(+ {},+ {+ get: (_t, action) =>+ action === 'toggleSidebar'+ ? h.sidebar+ : { key: `unused-${String(action)}`, metaKey: true },+ }+ ),+}))++import { Sidebar, SidebarProvider } from '@/components/ui/sidebar'+import { KeyboardShortcutsProvider } from '@/providers/KeyboardShortcuts'++function renderApp({ builtin }: { builtin: boolean }, onOpenChange = vi.fn()) {+ render(+ <SidebarProvider+ open+ onOpenChange={onOpenChange}+ keyboardShortcut={builtin}+ >+ <KeyboardShortcutsProvider />+ <Sidebar collapsible="offcanvas">+ <span>Nav</span>+ </Sidebar>+ </SidebarProvider>+ )+ return onOpenChange+}++const press = (init: KeyboardEventInit) =>+ fireEvent.keyDown(window, init)++beforeEach(() => {+ h.mobile = true+ h.sidebar = { key: 'b', metaKey: true, ctrlKey: false }+})+afterEach(cleanup)++describe('sidebar shortcut ownership (root wiring)', () => {+ it('one default keypress toggles the mobile overlay exactly once', () => {+ renderApp({ builtin: false })+ press({ key: 'b', metaKey: true })+ expect(screen.getByRole('dialog')).toBeInTheDocument()+ press({ key: 'b', metaKey: true })+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+ })++ it('one default keypress toggles the desktop sidebar exactly once', () => {+ h.mobile = false+ const onOpenChange = renderApp({ builtin: false })+ press({ key: 'b', metaKey: true })+ expect(onOpenChange).toHaveBeenCalledTimes(1)+ expect(onOpenChange).toHaveBeenCalledWith(false)+ })++ it('a customised shortcut works and the old default leaves no ghost handler', () => {+ h.sidebar = { key: 'k', metaKey: true, ctrlKey: false }+ for (const mobile of [true, false]) {+ h.mobile = mobile+ const onOpenChange = renderApp({ builtin: false })+ press({ key: 'b', metaKey: true })+ press({ key: 'b', ctrlKey: true })+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+ expect(onOpenChange).not.toHaveBeenCalled()++ press({ key: 'k', metaKey: true })+ if (mobile) expect(screen.getByRole('dialog')).toBeInTheDocument()+ else expect(onOpenChange).toHaveBeenCalledTimes(1)+ cleanup()+ }+ })++ it('a standalone provider keeps its built-in Cmd/Ctrl+B', () => {+ h.mobile = false+ const onOpenChange = vi.fn()+ render(<SidebarProvider open onOpenChange={onOpenChange} />)+ act(() => {+ press({ key: 'b', ctrlKey: true })+ })+ expect(onOpenChange).toHaveBeenCalledTimes(1)+ })+})diff --git a/web-app/src/routes/__tests__/artifacts.test.tsx b/web-app/src/routes/__tests__/artifacts.test.tsxindex 381a45ae4..7da8a32ba 100644--- a/web-app/src/routes/__tests__/artifacts.test.tsx+++ b/web-app/src/routes/__tests__/artifacts.test.tsx@@ -7,6 +7,8 @@ const h = vi.hoisted(() => ({select: vi.fn(),preview: vi.fn(),sessions: [] as unknown[],+ threads: {} as Record<string, unknown>,+ messages: {} as Record<string, unknown[]>,}))vi.mock('@tanstack/react-router', () => ({@@ -39,8 +41,17 @@ vi.mock('@/hooks/useCoworkSessions', () => ({vi.mock('@/hooks/useCoworkRun', () => ({useCoworkRun: { getState: () => ({ requestPreview: h.preview }) },}))+vi.mock('@/hooks/useThreads', () => ({+ useThreads: (sel: (s: { threads: unknown }) => unknown) =>+ sel({ threads: h.threads }),+}))vi.mock('@/hooks/useServiceHub', () => ({- getServiceHub: () => ({ app: () => ({ getJanDataFolder: async () => '/data' }) }),+ getServiceHub: () => ({+ app: () => ({ getJanDataFolder: async () => '/data' }),+ messages: () => ({+ fetchMessages: async (id: string) => h.messages[id] ?? [],+ }),+ }),}))vi.mock('@janhq/tauri-plugin-agent-tools-api', () => ({threadWorkspacePath: async (_d: string, id: string) => `/data/threads/${id}`,@@ -55,6 +66,8 @@ beforeEach(() => {h.navigate.mockClear()h.select.mockClear()h.preview.mockClear()+ h.threads = {}+ h.messages = {}h.sessions = [{id: 's1',@@ -92,4 +105,42 @@ describe('Artifacts page', () => {params: { sessionId: 's1' },})})++ it('lists artifacts of chat threads and opens the thread; a Cowork thread is not listed twice', async () => {+ h.sessions = []+ h.threads = {+ t1: { id: 't1', title: 'Make a page', updated: 10, metadata: {} },+ c1: { id: 'c1', title: 'Cowork', updated: 11, metadata: { mode: 'cowork' } },+ }+ h.messages = {+ t1: [+ {+ id: 'm1',+ object: 'thread.message',+ thread_id: 't1',+ role: 'assistant',+ status: 'ready',+ created_at: 1,+ completed_at: 1,+ content: [+ { type: 'text', text: { value: 'done', annotations: [] } },+ {+ type: 'tool_call',+ tool_call_id: 'w1',+ tool_name: 'write',+ input: { path: 'page.html' },+ output: 'Created page.html (2 bytes)',+ },+ ],+ },+ ],+ c1: [],+ }+ render(<Page />)+ fireEvent.click(await screen.findByText('page'))+ expect(h.navigate).toHaveBeenCalledWith({+ to: '/threads/$threadId',+ params: { threadId: 't1' },+ })+ })})diff --git a/web-app/src/routes/artifacts.tsx b/web-app/src/routes/artifacts.tsxindex f44cfa991..efb8393ed 100644--- a/web-app/src/routes/artifacts.tsx+++ b/web-app/src/routes/artifacts.tsx@@ -2,24 +2,23 @@import { createFileRoute, useNavigate } from '@tanstack/react-router'import { useEffect, useMemo, useState } from 'react'import { IconSearch } from '@tabler/icons-react'-import { ChevronsUpDown } from 'lucide-react'+import { Box, SearchX } from 'lucide-react'import HeaderPage from '@/containers/HeaderPage'import { Button } from '@/components/ui/button'import { CoworkArtifactCard } from '@/containers/CoworkArtifactCard'-import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,-} from '@/components/ui/dropdown-menu'import { route } from '@/constants/routes'import { useTranslation } from '@/i18n/react-i18next-compat'import { useCoworkSessions } from '@/hooks/useCoworkSessions'import { useCoworkRun } from '@/hooks/useCoworkRun'import { getServiceHub } from '@/hooks/useServiceHub'import { threadWorkspacePath } from '@janhq/tauri-plugin-agent-tools-api'+import { useThreads } from '@/hooks/useThreads'+import { isCoworkThread } from '@/lib/threadMode'+import { convertThreadMessagesToUIMessages } from '@/lib/messages'+import { TEMPORARY_CHAT_ID } from '@/constants/chat'import {ARTIFACT_GROUP_NAMES,+ artifactsFromParts,artifactsFromTurns,type CoworkArtifact,} from '@/lib/coworkArtifacts'@@ -30,11 +29,69 @@ export const Route = createFileRoute(route.artifacts as any)({const PAGE = 24+// Threads store seconds, Cowork sessions milliseconds (same rule as mergeHistory).+const toSeconds = (n: number) => (n > 1e12 ? n / 1000 : n)+type Row = CoworkArtifact & {+ /** Cowork session or thread id; `kind` says which. */sessionId: string+ kind: 'session' | 'thread'+ sessionTitle: string+ updated: numberroots: Array<string | null>}+/** Most recent chat threads scanned for artifacts, and how many load at once.+ * Messages live on disk, so the scan is bounded rather than reading every thread. */+const THREAD_SCAN_LIMIT = 100+const THREAD_SCAN_CONCURRENCY = 4++type ThreadArtifacts = { artifacts: CoworkArtifact[]; scratch: string | null }++/**+ * Artifacts of chat threads, read from their persisted messages. Cowork+ * threads are listed from their session turns instead. Loads the newest+ * threads first and fills in as each one resolves.+ */+function useThreadArtifacts(+ threadIds: string[]+): Record<string, ThreadArtifacts> {+ const [found, setFound] = useState<Record<string, ThreadArtifacts>>({})+ const key = threadIds.join(',')++ useEffect(() => {+ let alive = true+ const queue = key.split(',').filter(Boolean)+ const worker = async () => {+ const dataFolder = await getServiceHub().app().getJanDataFolder()+ for (let id = queue.shift(); id; id = queue.shift()) {+ try {+ const messages = await getServiceHub().messages().fetchMessages(id)+ const artifacts = convertThreadMessagesToUIMessages(+ messages ?? []+ ).flatMap((message) => artifactsFromParts(message.parts as never))+ if (artifacts.length === 0) continue+ const scratch = dataFolder+ ? await threadWorkspacePath(dataFolder, id).catch(() => null)+ : null+ if (alive)+ setFound((prev) => ({ ...prev, [id]: { artifacts, scratch } }))+ } catch {+ /* An unreadable thread simply contributes no artifacts. */+ }+ }+ }+ void Promise.all(+ Array.from({ length: THREAD_SCAN_CONCURRENCY }, worker)+ )+ return () => {+ alive = false+ }+ }, [key])++ return found+}+/*** Each session's sandbox, keyed by id.*@@ -79,6 +136,7 @@ function ArtifactsPage() {const { t } = useTranslation()const navigate = useNavigate()const sessions = useCoworkSessions((s) => s.sessions)+ const threads = useThreads((s) => s.threads)const [query, setQuery] = useState('')const [group, setGroup] = useState<CoworkArtifact['group'] | null>(null)// ponytail: a render cap with "show more" rather than paging or a virtual@@ -94,9 +152,40 @@ function ArtifactsPage() {useMemo(() => sessions.map((s) => s.id), [sessions]))- const rows = useMemo<Row[]>(+ const scanned = useMemo(() =>- sessions.flatMap((session) => {+ Object.values(threads)+ .filter((thread) => thread.id !== TEMPORARY_CHAT_ID && !isCoworkThread(thread))+ .sort((a, b) => (b.updated || 0) - (a.updated || 0))+ .slice(0, THREAD_SCAN_LIMIT),+ [threads]+ )+ const threadArtifacts = useThreadArtifacts(useMemo(() => scanned.map((t) => t.id), [scanned]))++ const rows = useMemo<Row[]>(+ () => [+ ...scanned.flatMap((thread) => {+ const hit = threadArtifacts[thread.id]+ if (!hit) return []+ const meta = thread.metadata as+ | { folder?: string; folderAccess?: 'read' | 'write' }+ | undefined+ const folder = meta?.folder ?? null+ // A writable attached folder is the workspace root; otherwise relative+ // tool paths were written into the thread's own sandbox.+ const writableFolder = meta?.folderAccess !== 'read' ? folder : null+ return hit.artifacts.map((artifact) => ({+ ...artifact,+ sessionId: thread.id,+ kind: 'thread' as const,+ sessionTitle: thread.title,+ updated: toSeconds(thread.updated || 0),+ roots: [writableFolder ?? hit.scratch, folder, hit.scratch].filter(+ (root, i, all): root is string => !!root && all.indexOf(root) === i+ ),+ }))+ }),+ ...sessions.flatMap((session) => {const sandbox = workspaces[session.id] ?? null// The attached folder is the workspace root (#8882), so it comes first:// a relative tool path resolves against it, the sandbox is the fallback.@@ -104,10 +193,14 @@ function ArtifactsPage() {return artifactsFromTurns(session.turns, root).map((artifact) => ({...artifact,sessionId: session.id,+ kind: 'session' as const,+ sessionTitle: session.title,+ updated: toSeconds(session.updated || 0),roots: [session.folder, sandbox],}))}),- [sessions, workspaces]+ ].sort((a, b) => b.updated - a.updated),+ [sessions, workspaces, scanned, threadArtifacts])const shown = useMemo(() => {@@ -117,7 +210,8 @@ function ArtifactsPage() {(!group || r.group === group) &&(!q ||r.title.toLowerCase().includes(q) ||- r.path.toLowerCase().includes(q))+ r.path.toLowerCase().includes(q) ||+ r.sessionTitle.toLowerCase().includes(q)))}, [rows, query, group])@@ -125,6 +219,10 @@ function ArtifactsPage() {useEffect(() => setLimit(PAGE), [query, group])const open = (row: Row) => {+ if (row.kind === 'thread') {+ navigate({ to: route.threadsDetail, params: { threadId: row.sessionId } })+ return+ }useCoworkSessions.getState().selectSession(row.sessionId)useCoworkRun.getState().requestPreview(row.sessionId, row.path)navigate({@@ -135,77 +233,50 @@ function ArtifactsPage() {return (<div className="flex h-svh w-full flex-col">- {/* Search in the header, dropdown filter on the right — the hub page's- layout, so this reads as part of Jan rather than its own thing. */}- <HeaderPage>- <div className="relative z-20 flex h-10 w-full items-center justify-between py-3 pr-3">- <div className="flex w-full items-center gap-2">- <IconSearch size={14} className="shrink-0 text-muted-foreground" />- <input- value={query}- onChange={(e) => setQuery(e.target.value)}- placeholder={t('common:artifactsSearch')}- className="w-full focus:outline-none"- />+ <HeaderPage />+ <main className="min-h-0 flex-1 overflow-y-auto px-5 pb-10 md:px-8">+ <div className="mx-auto w-full max-w-5xl pt-3 md:pt-5">+ <div className="mb-6 flex items-center justify-between gap-4">+ <div>+ <h1 className="text-2xl font-medium tracking-tight text-foreground">{t('common:artifacts')}</h1>+ <p className="mt-1.5 text-sm text-muted-foreground">{t('common:artifactsLibraryDescription')}</p>+ </div>+ <span className="mt-2 shrink-0 text-sm tabular-nums text-muted-foreground">{t('common:artifactsLibraryCount', { count: rows.length })}</span></div>- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button variant="outline" size="sm" className="shrink-0">- {group- ? t(`common:artifactGroup${group}`)- : t('common:artifactsAll')}- <ChevronsUpDown className="ml-2 size-4 shrink-0 text-muted-foreground" />- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent side="bottom" align="end">- <DropdownMenuItem onClick={() => setGroup(null)}>- {t('common:artifactsAll')}- </DropdownMenuItem>- {ARTIFACT_GROUP_NAMES.map((g) => (- <DropdownMenuItem key={g} onClick={() => setGroup(g)}>- {t(`common:artifactGroup${g}`)}- </DropdownMenuItem>+ <div className="mb-6 space-y-3">+ <div className="flex h-10 w-full items-center gap-2.5 rounded-xl border border-border/70 bg-background px-3 focus-within:ring-2 focus-within:ring-ring/30">+ <IconSearch size={17} className="shrink-0 text-muted-foreground" />+ <input value={query} onChange={(e) => setQuery(e.target.value)} aria-label={t('common:artifactsSearch')} placeholder={t('common:artifactsSearch')} className="h-full min-w-0 flex-1 bg-transparent text-sm outline-none" />+ </div>+ <div role="group" aria-label={t('common:artifactsLibraryFilter')} className="flex flex-wrap items-center gap-1.5">+ {[null, ...ARTIFACT_GROUP_NAMES].map((g) => (+ <button key={g ?? 'all'} type="button" aria-pressed={group === g} onClick={() => setGroup(g)}+ className={`rounded-full px-3 py-1.5 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${group === g ? 'bg-muted text-foreground font-medium' : 'text-muted-foreground hover:bg-muted hover:text-foreground'}`}>+ {g ? t(`common:artifactGroup${g}`) : t('common:artifactsAll')}+ </button>))}- </DropdownMenuContent>- </DropdownMenu>- </div>- </HeaderPage>-- <div className="h-[calc(100%-60px)] w-full overflow-y-auto p-4">- <div className="mx-auto w-full md:w-4/5 xl:w-4/6">+ </div>+ </div>{shown.length === 0 ? (- <p className="text-sm text-muted-foreground">- {/* Distinct: nothing made yet vs nothing matching the filter. */}- {rows.length === 0- ? t('common:artifactsEmpty')- : t('common:artifactsNoMatch')}- </p>+ <div className="flex min-h-64 flex-col items-center justify-center rounded-2xl border border-dashed border-border px-6 py-12 text-center">+ {rows.length === 0 ? <Box className="mb-4 size-8 text-muted-foreground/60" strokeWidth={1.4} /> : <SearchX className="mb-4 size-8 text-muted-foreground/60" strokeWidth={1.4} />}+ <p className="max-w-sm text-sm leading-6 text-muted-foreground">{rows.length === 0 ? t('common:artifactsEmpty') : t('common:artifactsNoMatch')}</p>+ {rows.length > 0 && <Button variant="ghost" size="sm" className="mt-3" onClick={() => { setQuery(''); setGroup(null) }}>{t('common:artifactsLibraryReset')}</Button>}+ </div>) : (- <div className="grid auto-rows-min gap-3 sm:grid-cols-2 lg:grid-cols-3">+ <div className="grid grid-cols-1 items-start gap-3 lg:grid-cols-2">{shown.slice(0, limit).map((row) => (- <CoworkArtifactCard- key={`${row.sessionId}:${row.path}`}- artifact={row}- roots={row.roots}- onPreview={() => open(row)}- showPath- />+ <CoworkArtifactCard key={`${row.kind}:${row.sessionId}:${row.path}`} variant="library" artifact={row} roots={row.roots} onPreview={() => open(row)} showPath />))}</div>)}{shown.length > limit && (- <div className="mt-3 flex justify-center">- <Button- variant="outline"- size="sm"- onClick={() => setLimit((n) => n + PAGE)}- >- {t('common:artifactsShowMore', { count: shown.length - limit })}- </Button>+ <div className="mt-7 flex justify-center">+ <Button variant="outline" size="sm" onClick={() => setLimit((n) => n + PAGE)}>{t('common:artifactsShowMore', { count: shown.length - limit })}</Button></div>)}</div>- </div>+ </main></div>)}diff --git a/web-app/src/routes/project/$projectId.tsx b/web-app/src/routes/project/$projectId.tsxindex ecf93df05..85d7549e6 100644--- a/web-app/src/routes/project/$projectId.tsx+++ b/web-app/src/routes/project/$projectId.tsx@@ -8,6 +8,7 @@ import { useTranslation } from '@/i18n/react-i18next-compat'import ChatInput from '@/containers/ChatInput'import HeaderPage from '@/containers/HeaderPage'+import { ConversationHeaderTitle } from '@/containers/ConversationHeaderTitle'import ThreadList from '@/containers/ThreadList'import { AvatarEmoji } from '@/containers/AvatarEmoji'@@ -92,7 +93,11 @@ function ProjectPageContent() {return (<div className="flex flex-col h-svh w-full">- <HeaderPage />+ <HeaderPage>+ <div className="flex items-center justify-between w-full">+ <ConversationHeaderTitle project={project} />+ </div>+ </HeaderPage><div className="h-full relative flex flex-col px-4 md:px-8 py-4 overflow-y-auto"><div className="mx-auto w-full md:w-4/5 xl:w-4/6">diff --git a/web-app/src/routes/threads/$threadId.tsx b/web-app/src/routes/threads/$threadId.tsxindex 5d047485a..b1ac6c881 100644--- a/web-app/src/routes/threads/$threadId.tsx+++ b/web-app/src/routes/threads/$threadId.tsx@@ -7,9 +7,10 @@ import {useRouter,useSearch,} from '@tanstack/react-router'-import { cn } from '@/lib/utils'import HeaderPage from '@/containers/HeaderPage'+import { ConversationHeaderTitle } from '@/containers/ConversationHeaderTitle'+import { ConversationColumn } from '@/components/ai-elements/conversation-column'import { useThreads } from '@/hooks/useThreads'import ChatInput from '@/containers/ChatInput'import { useShallow } from 'zustand/react/shallow'@@ -2496,7 +2497,14 @@ function ThreadDetail() {return (<div className="flex flex-col h-[calc(100dvh-(env(safe-area-inset-bottom)+env(safe-area-inset-top)))]">- <HeaderPage />+ <HeaderPage>+ <div className="flex items-center justify-between w-full pr-2">+ <ConversationHeaderTitle+ title={thread?.title}+ project={thread?.metadata?.project}+ />+ </div>+ </HeaderPage><div className="flex flex-1 flex-col h-full overflow-hidden">{/* Messages Area */}<div@@ -2508,9 +2516,7 @@ function ThreadDetail() {}><Conversation className="absolute inset-0 text-start">- <ConversationContent- className={cn('mx-auto w-full px-6 pb-4 md:w-4/5 xl:w-4/6')}- >+ <ConversationContent column className="pb-4">{chatMessages.map((message, index) => {const isLastMessage = index === chatMessages.length - 1const isFirstMessage = index === 0@@ -2662,7 +2668,7 @@ function ThreadDetail() {{/* Chat Input - Fixed at bottom. No top padding: the scroll area (andits fade) runs right up to the composer, with the resting gap keptinside the scroll content as pb-4. */}- <div className="pb-4 px-6 mx-auto w-full md:w-4/5 xl:w-4/6">+ <ConversationColumn reserveScrollGutter className="pb-4"><ChatInputmodel={threadModel}onSubmit={handleSubmit}@@ -2670,7 +2676,7 @@ function ThreadDetail() {chatStatus={effectiveStatus}toolsRunning={toolsRunning}/>- </div>+ </ConversationColumn></div></div>)diff --git a/web-app/src/routes/threads/__tests__/$threadId.test.tsx b/web-app/src/routes/threads/__tests__/$threadId.test.tsxindex 6cbcf8e61..6f48437f5 100644--- a/web-app/src/routes/threads/__tests__/$threadId.test.tsx+++ b/web-app/src/routes/threads/__tests__/$threadId.test.tsx@@ -210,6 +210,12 @@ vi.mock('@/containers/HeaderPage', () => ({default: ({ children }: any) => <div data-testid="header-page">{children}</div>,}))+vi.mock('@/containers/ConversationHeaderTitle', () => ({+ ConversationHeaderTitle: ({ title }: { title?: string }) => (+ <span data-testid="conversation-title">{title}</span>+ ),+}))+vi.mock('@/containers/ChatInput', () => ({default: ({ onSubmit, onStop, chatStatus }: any) => (<div data-testid="chat-input">diff --git a/web-app/src/stores/titlebar-layout-store.ts b/web-app/src/stores/titlebar-layout-store.tsindex 5de3f4090..2dfabe480 100644--- a/web-app/src/stores/titlebar-layout-store.ts+++ b/web-app/src/stores/titlebar-layout-store.ts@@ -1,5 +1,8 @@import { create } from 'zustand'+/** Shared height of Jan's draggable titlebar and caption-control strip. */+export const TITLEBAR_HEIGHT = 60+export type ButtonId = 'minimize' | 'maximize' | 'close'export type TitlebarLayout = { left: ButtonId[]; right: ButtonId[] }