The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Make TrueForge UI mobile-friendly (#897)
Govinda Vashishtha7555c4024312
diff --git a/.changeset/mobile-app-navigation.md b/.changeset/mobile-app-navigation.mdnew file mode 100644index 000000000..6b36d1b38--- /dev/null+++ b/.changeset/mobile-app-navigation.md@@ -0,0 +1,5 @@+---+'@truefoundry/trueforge-ui': patch+---++Make the sidebar layout mobile-friendly with a Claude-style nav drawer, show a desktop-only notice for Build Agent, Sessions, Schedules, and Environments on small screens, keep user message actions visible on touch (hover-only from `md` up), and show the Agents listing as cards on small screens.diff --git a/packages/trueforge-ui/src/atoms/AgentsLibrary.tsx b/packages/trueforge-ui/src/atoms/AgentsLibrary.tsxindex 38693a7d0..6f46cefc2 100644--- a/packages/trueforge-ui/src/atoms/AgentsLibrary.tsx+++ b/packages/trueforge-ui/src/atoms/AgentsLibrary.tsx@@ -1,6 +1,6 @@'use client';-import { useCallback, useEffect, useRef, useState } from 'react';+import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';import { useResourcePermissions } from '../hooks/useResourcePermissions.js';import { useSessionShareSearch } from '../hooks/useSessionShareSearch.js';@@ -16,7 +16,10 @@ import { replaceScheduleShareSearch } from '../utils/scheduleShareUrl.js';import { AgentOverflowMenu } from './AgentOverflowMenu.js';import { CreatedByCell } from './CreatedByCell.js';import { EmptyScreen, EmptyScreenQueryHighlight } from './EmptyScreen.js';+import { cn } from './lib/cn.js';+import { isMobileNavDrawerOpen } from './lib/isMobileNavDrawerOpen.js';import { mountName } from './lib/mountName.js';+import { useIsMobile } from './lib/useIsMobile.js';import { useSearchAgentsList } from './lib/useSearchAgentsList.js';import { PageHeader } from './PageHeader.js';import { Button } from './primitives/Button.js';@@ -39,6 +42,8 @@ const AGENTS_PAGE_SIZE_OPTIONS = [10, 25] as const;export type AgentsLibraryProps = {onSelectAgent?: (agentName: string) => void;+ /** Leading chrome for the page header (e.g. mobile nav hamburger). */+ headerStart?: ReactNode;};export type AgentScheduleSummary = {@@ -63,6 +68,8 @@ export type AgentLibraryRowProps = {onTry: () => void;onEdit: () => void;onManageSchedules?: () => void;+ /** `card` is the mobile stacked layout; desktop keeps the table `row`. */+ variant?: 'row' | 'card';};/** Short label for model fqns like `provider/gpt-4.1` → `gpt-4.1`. */@@ -75,22 +82,27 @@ function AgentSchedulesEmptyState({agentName,onOpen,disabled,+ alwaysShowAdd = false,}: {agentName: string;onOpen?: () => void;disabled: boolean;+ /** Touch has no hover — show the add button instead of the `-` placeholder. */+ alwaysShowAdd?: boolean;}) {return (<>- <span aria-hidden className="text-text-secondary text-sm md:group-hover:hidden">- -- </span>+ {alwaysShowAdd ? null : (+ <span aria-hidden className="text-text-secondary text-sm md:group-hover:hidden">+ -+ </span>+ )}<Button.Ghosttype="button"size="small"disabled={disabled}aria-label={`Add schedule for ${agentName}`}- className="hidden md:group-hover:inline-flex"+ className={alwaysShowAdd ? 'inline-flex' : 'hidden md:group-hover:inline-flex'}onClick={onOpen}><Icon name="plus" className="size-3.5 shrink-0" />@@ -100,6 +112,161 @@ function AgentSchedulesEmptyState({);}+function AgentNameContent({+ name,+ description,+ onOpen,+ descriptionMode = 'tooltip',+}: {+ name: string;+ description: string | null;+ onOpen?: () => void;+ descriptionMode?: 'tooltip' | 'clamp';+}) {+ const nameNode =+ onOpen == null ? (+ <span className="block truncate">{name}</span>+ ) : (+ <button+ type="button"+ className="block max-w-full cursor-pointer text-left"+ aria-label={`Open ${name}`}+ onClick={onOpen}+ >+ <span className="block truncate">{name}</span>+ </button>+ );++ if (description == null) {+ return <>{nameNode}</>;+ }++ if (descriptionMode === 'clamp') {+ return (+ <>+ {nameNode}+ <span className="text-text-secondary line-clamp-2 text-xs font-normal">{description}</span>+ </>+ );+ }++ return (+ <>+ {nameNode}+ <Tooltip+ content={description}+ className="max-w-sm whitespace-normal text-left"+ triggerClassName="block min-w-0 w-full max-w-full"+ >+ <span className="text-text-secondary block truncate text-xs font-normal">{description}</span>+ </Tooltip>+ </>+ );+}++function AgentConfigurationChips({+ agentName,+ modelLabel,+ modelTitle,+ skillsCount,+ skillsTitle,+ mcpCount,+ connectorsTitle,+ className,+}: {+ agentName: string;+ modelLabel: string | null;+ modelTitle: string;+ skillsCount: number;+ skillsTitle: string;+ mcpCount: number;+ connectorsTitle: string;+ className?: string;+}) {+ const hasConfiguration = modelLabel != null || skillsCount > 0 || mcpCount > 0;+ if (!hasConfiguration) {+ return (+ <span className="text-text-secondary text-sm" aria-label={`Configuration unavailable for ${agentName}`}>+ —+ </span>+ );+ }+ return (+ <div className={cn('text-text-secondary flex min-w-0 items-center gap-2', className)}>+ {modelLabel != null ? (+ <Tooltip content={modelTitle}>+ <span+ className="bg-secondary-bg text-text-secondary inline-flex max-w-[10rem] items-center gap-1 truncate rounded-full px-2 py-0.5 text-xs font-medium"+ aria-label={modelTitle}+ >+ <Icon name="cpu" className="size-3.5 shrink-0" />+ <span className="truncate">{modelLabel}</span>+ </span>+ </Tooltip>+ ) : null}+ {skillsCount > 0 ? (+ <Tooltip content={skillsTitle}>+ <span className="inline-flex items-center gap-1 text-xs" aria-label={`Skills: ${skillsTitle}`}>+ <Icon name="lightbulb" className="size-3.5 shrink-0" />+ {skillsCount}+ </span>+ </Tooltip>+ ) : null}+ {mcpCount > 0 ? (+ <Tooltip content={connectorsTitle}>+ <span className="inline-flex items-center gap-1 text-xs" aria-label={`Connectors: ${connectorsTitle}`}>+ <Icon name="plug" className="size-3.5 shrink-0" />+ {mcpCount}+ </span>+ </Tooltip>+ ) : null}+ </div>+ );+}++function AgentSchedulesContent({+ scheduleSummary,+ agentName,+ onOpenSchedules,+ onCreateSchedule,+ canUseAgent,+ alwaysShowAdd = false,+}: {+ scheduleSummary: AgentScheduleSummary | null | undefined;+ agentName: string;+ onOpenSchedules?: () => void;+ onCreateSchedule?: () => void;+ canUseAgent: boolean;+ alwaysShowAdd?: boolean;+}) {+ if (scheduleSummary === undefined) return null;+ if (scheduleSummary != null && scheduleSummary.count > 0) {+ return (+ <AgentSchedulesBadge+ summary={scheduleSummary}+ agentName={agentName}+ onOpen={onOpenSchedules}+ disabled={!canUseAgent}+ />+ );+ }+ if (scheduleSummary != null) {+ return (+ <AgentSchedulesEmptyState+ agentName={agentName}+ onOpen={onCreateSchedule}+ disabled={!canUseAgent}+ alwaysShowAdd={alwaysShowAdd}+ />+ );+ }+ return (+ <span className="text-text-secondary text-sm" aria-label={`Schedule count unavailable for ${agentName}`}>+ —+ </span>+ );+}+function scheduleNamesTooltip(names: readonly string[]) {return (<span className="flex flex-col text-left">@@ -174,6 +341,7 @@ export function AgentLibraryRow({onTry,onEdit,onManageSchedules,+ variant = 'row',}: AgentLibraryRowProps) {const PermissionGuard = useSlot('PermissionGuard');const spec = agent.agentSpec;@@ -188,75 +356,96 @@ export function AgentLibraryRow({const modelTitle = modelName ?? '';const connectorsTitle = mcpNames.length ? mcpNames.join(', ') : `${mcpCount} connectors`;const skillsTitle = skillNames.length ? skillNames.join(', ') : `${skillsCount} skills`;- const hasConfiguration = modelLabel != null || skillsCount > 0 || mcpCount > 0;const hasNoSchedules = scheduleSummary != null && scheduleSummary.count === 0;const storedDescription = agent.description?.trim() || null;// Create falls back to name when description is missing; don't echo it under the title.const description = storedDescription != null && storedDescription !== agent.name ? storedDescription : null;+ const overflowMenu = (+ <AgentOverflowMenu+ agentName={agent.name}+ {...(storedDescription != null ? { description: storedDescription } : {})}+ {...(spec != null ? { agentSpec: spec } : {})}+ canMutate={canMutate}+ canUse={canUseAgent}+ canManage={canManageAgent}+ canDelete={canDeleteAgent}+ canManageSchedules={canManageSchedules}+ onEdit={onEdit}+ {...(onManageSchedules != null ? { onManageSchedules } : {})}+ />+ );++ const tryButton = (+ <PermissionGuard allowed={canUseAgent}>+ <Button.Secondary type="button" aria-label={`Try agent ${agent.name}`} size="large" onClick={onTry}>+ <Icon name="play" className="size-3.5" />+ Try+ </Button.Secondary>+ </PermissionGuard>+ );++ const configurationChips = (+ <AgentConfigurationChips+ agentName={agent.name}+ modelLabel={modelLabel}+ modelTitle={modelTitle}+ skillsCount={skillsCount}+ skillsTitle={skillsTitle}+ mcpCount={mcpCount}+ connectorsTitle={connectorsTitle}+ />+ );++ if (variant === 'card') {+ return (+ <li className="flex flex-col gap-3 rounded-xl border border-border bg-card-bg p-3">+ <div className="flex items-start gap-2">+ <div className="text-text-primary min-w-0 flex-1 font-medium">+ <AgentNameContent+ name={agent.name}+ description={description}+ {...(onOpen != null ? { onOpen } : {})}+ descriptionMode="clamp"+ />+ </div>+ {overflowMenu}+ </div>+ <AgentConfigurationChips+ agentName={agent.name}+ modelLabel={modelLabel}+ modelTitle={modelTitle}+ skillsCount={skillsCount}+ skillsTitle={skillsTitle}+ mcpCount={mcpCount}+ connectorsTitle={connectorsTitle}+ className="flex-wrap"+ />+ {showCreatedBy ? <CreatedByCell subject={agent.createdBySubject} /> : null}+ <div className="flex items-center justify-between gap-2">+ <div className="min-w-0">+ <AgentSchedulesContent+ scheduleSummary={scheduleSummary}+ agentName={agent.name}+ {...(onOpenSchedules != null ? { onOpenSchedules } : {})}+ {...(onCreateSchedule != null ? { onCreateSchedule } : {})}+ canUseAgent={canUseAgent}+ alwaysShowAdd+ />+ </div>+ {tryButton}+ </div>+ </li>+ );+ }+return (<TableRow className={hasNoSchedules ? 'group' : undefined}>{/* Fixed width so truncate works; 24rem = 1.5× the prior min-w-64 name column. */}<TableCell className="text-text-primary w-96 max-w-96 font-medium">- {onOpen == null ? (- <span className="block truncate">{agent.name}</span>- ) : (- <button- type="button"- className="block max-w-full cursor-pointer text-left"- aria-label={`Open ${agent.name}`}- onClick={onOpen}- >- <span className="block truncate">{agent.name}</span>- </button>- )}- {description ? (- <Tooltip- content={description}- className="max-w-sm whitespace-normal text-left"- triggerClassName="block min-w-0 w-full max-w-full"- >- <span className="text-text-secondary block truncate text-xs font-normal">{description}</span>- </Tooltip>- ) : null}- </TableCell>- <TableCell>- {hasConfiguration ? (- <div className="text-text-secondary flex min-w-0 items-center gap-2">- {modelLabel != null ? (- <Tooltip content={modelTitle}>- <span- className="bg-secondary-bg text-text-secondary inline-flex max-w-[10rem] items-center gap-1 truncate rounded-full px-2 py-0.5 text-xs font-medium"- aria-label={modelTitle}- >- <Icon name="cpu" className="size-3.5 shrink-0" />- <span className="truncate">{modelLabel}</span>- </span>- </Tooltip>- ) : null}- {skillsCount > 0 ? (- <Tooltip content={skillsTitle}>- <span className="inline-flex items-center gap-1 text-xs" aria-label={`Skills: ${skillsTitle}`}>- <Icon name="lightbulb" className="size-3.5 shrink-0" />- {skillsCount}- </span>- </Tooltip>- ) : null}- {mcpCount > 0 ? (- <Tooltip content={connectorsTitle}>- <span className="inline-flex items-center gap-1 text-xs" aria-label={`Connectors: ${connectorsTitle}`}>- <Icon name="plug" className="size-3.5 shrink-0" />- {mcpCount}- </span>- </Tooltip>- ) : null}- </div>- ) : (- <span className="text-text-secondary text-sm" aria-label={`Configuration unavailable for ${agent.name}`}>- —- </span>- )}+ <AgentNameContent name={agent.name} description={description} {...(onOpen != null ? { onOpen } : {})} /></TableCell>+ <TableCell>{configurationChips}</TableCell>{showCreatedBy ? (<TableCell><CreatedByCell subject={agent.createdBySubject} />@@ -264,42 +453,19 @@ export function AgentLibraryRow({) : null}{scheduleSummary !== undefined ? (<TableCell>- {scheduleSummary != null && scheduleSummary.count > 0 ? (- <AgentSchedulesBadge- summary={scheduleSummary}- agentName={agent.name}- onOpen={onOpenSchedules}- disabled={!canUseAgent}- />- ) : scheduleSummary != null ? (- <AgentSchedulesEmptyState agentName={agent.name} onOpen={onCreateSchedule} disabled={!canUseAgent} />- ) : (- <span className="text-text-secondary text-sm" aria-label={`Schedule count unavailable for ${agent.name}`}>- —- </span>- )}+ <AgentSchedulesContent+ scheduleSummary={scheduleSummary}+ agentName={agent.name}+ {...(onOpenSchedules != null ? { onOpenSchedules } : {})}+ {...(onCreateSchedule != null ? { onCreateSchedule } : {})}+ canUseAgent={canUseAgent}+ /></TableCell>) : null}<TableCell className="w-px"><div className="flex items-center justify-end gap-1.5">- <PermissionGuard allowed={canUseAgent}>- <Button.Secondary type="button" aria-label={`Try agent ${agent.name}`} size="large" onClick={onTry}>- <Icon name="play" className="size-3.5" />- Try- </Button.Secondary>- </PermissionGuard>- <AgentOverflowMenu- agentName={agent.name}- {...(storedDescription != null ? { description: storedDescription } : {})}- {...(spec != null ? { agentSpec: spec } : {})}- canMutate={canMutate}- canUse={canUseAgent}- canManage={canManageAgent}- canDelete={canDeleteAgent}- canManageSchedules={canManageSchedules}- onEdit={onEdit}- {...(onManageSchedules != null ? { onManageSchedules } : {})}- />+ {tryButton}+ {overflowMenu}</div></TableCell></TableRow>@@ -348,8 +514,9 @@ async function listAllSchedulesForAgents({return rows;}-export function AgentsLibrary({ onSelectAgent }: AgentsLibraryProps) {+export function AgentsLibrary({ onSelectAgent, headerStart }: AgentsLibraryProps) {const shell = useShellMode();+ const isMobile = useIsMobile();const { updateShareSearch } = useSessionShareSearch();const sessionsServer = useOptionalAgentSessionsServer();const scheduleServer = useOptionalScheduleServer();@@ -395,6 +562,8 @@ export function AgentsLibrary({ onSelectAgent }: AgentsLibraryProps) {if (!open) return;const onKeyDown = (event: KeyboardEvent) => {if (event.key !== 'Escape') return;+ // Let the mobile nav drawer consume Escape when it is open on top.+ if (isMobileNavDrawerOpen()) return;event.stopImmediatePropagation();closeLibrary();};@@ -480,10 +649,76 @@ export function AgentsLibrary({ onSelectAgent }: AgentsLibraryProps) {if (!open) return null;+ const renderAgent = (agent: AgentLibraryEntry, variant: 'row' | 'card') => {+ const agentSpec = agent.agentSpec;+ const agentId = agent.agentId;+ const id = libraryAgentId(agent);+ const summary = showSchedulesColumn+ ? (scheduleByAgent?.get(id) ??+ scheduleByAgent?.get(agent.name) ??+ (scheduleByAgent == null ? null : { count: 0, pausedCount: 0, activeNames: [], pausedNames: [] }))+ : undefined;+ return (+ <SlottedAgentLibraryRow+ key={id}+ agent={agent}+ canMutate={canMutate}+ canUseAgent={allows(id, 'USE')}+ canManageAgent={allows(id, 'MANAGE')}+ canDeleteAgent={allows(id, 'DELETE')}+ canManageSchedules={canOpenAgentSchedules}+ showCreatedBy={showCreatedByColumn}+ variant={variant}+ {...(summary !== undefined ? { scheduleSummary: summary } : {})}+ {...(canOpenAgentSchedules && agentId != null+ ? {+ onOpenSchedules: () => openSchedulesForAgent({ agentId }),+ onCreateSchedule: () => openSchedulesForAgent({ agentId, isNew: true }),+ onManageSchedules: () => openSchedulesForAgent({ agentId }),+ }+ : {})}+ {...(canOpenAgentDetails && agentId != null+ ? {+ onOpen: () => {+ updateShareSearch({+ agentId,+ tab: 'overview',+ sessionId: null,+ view: null,+ timeRange: null,+ });+ shell.openLibraryAgent(agentId);+ },+ }+ : {})}+ onTry={() => {+ if (allows(id, 'USE')) handleTry(agent);+ }}+ onEdit={() => {+ if (agentSpec != null && allows(id, 'MANAGE')) handleEdit(agent, agentSpec);+ }}+ />+ );+ };++ const pagination = (+ <TableTokenPagination+ pageSize={pageSize}+ rowCount={agents.length}+ canPrev={canPrev}+ canNext={canNext}+ onPrev={goPrev}+ onNext={goNext}+ pageSizeOptions={AGENTS_PAGE_SIZE_OPTIONS}+ onPageSizeChange={setPageSize}+ />+ );+return (<div className="flex h-full min-h-0 w-full flex-col bg-primary-bg"><PageHeadertitle="Agents"+ start={headerStart}end={<div className="w-56 shrink-0"><SearchInput query={query} setQuery={setQuery} placeholder="Search agents" />@@ -502,7 +737,7 @@ export function AgentsLibrary({ onSelectAgent }: AgentsLibraryProps) {{isInitialLoading ? (<div className="flex flex-col gap-2 p-1" role="status" aria-label="Loading agents">{Array.from({ length: 6 }, (_, i) => (- <Skeleton key={i} className="h-11 w-full rounded-md" />+ <Skeleton key={i} className={cn('w-full rounded-md', isMobile ? 'h-32' : 'h-11')} />))}</div>) : error ? (@@ -548,6 +783,13 @@ export function AgentsLibrary({ onSelectAgent }: AgentsLibraryProps) {/></div></div>+ ) : isMobile ? (+ <div className="flex flex-col gap-3">+ <ul aria-label="Agents" className="flex flex-col gap-3">+ {agents.map(agent => renderAgent(agent, 'card'))}+ </ul>+ <div className="overflow-hidden rounded-lg border border-border">{pagination}</div>+ </div>) : (<div className="overflow-hidden rounded-lg border border-border"><Table>@@ -562,71 +804,9 @@ export function AgentsLibrary({ onSelectAgent }: AgentsLibraryProps) {</TableHead></TableRow></TableHeader>- <TableBody>- {agents.map(agent => {- const agentSpec = agent.agentSpec;- const agentId = agent.agentId;- const id = libraryAgentId(agent);- const summary = showSchedulesColumn- ? (scheduleByAgent?.get(id) ??- scheduleByAgent?.get(agent.name) ??- (scheduleByAgent == null- ? null- : { count: 0, pausedCount: 0, activeNames: [], pausedNames: [] }))- : undefined;- return (- <SlottedAgentLibraryRow- key={id}- agent={agent}- canMutate={canMutate}- canUseAgent={allows(id, 'USE')}- canManageAgent={allows(id, 'MANAGE')}- canDeleteAgent={allows(id, 'DELETE')}- canManageSchedules={canOpenAgentSchedules}- showCreatedBy={showCreatedByColumn}- {...(summary !== undefined ? { scheduleSummary: summary } : {})}- {...(canOpenAgentSchedules && agentId != null- ? {- onOpenSchedules: () => openSchedulesForAgent({ agentId }),- onCreateSchedule: () => openSchedulesForAgent({ agentId, isNew: true }),- onManageSchedules: () => openSchedulesForAgent({ agentId }),- }- : {})}- {...(canOpenAgentDetails && agentId != null- ? {- onOpen: () => {- updateShareSearch({- agentId,- tab: 'overview',- sessionId: null,- view: null,- timeRange: null,- });- shell.openLibraryAgent(agentId);- },- }- : {})}- onTry={() => {- if (allows(id, 'USE')) handleTry(agent);- }}- onEdit={() => {- if (agentSpec != null && allows(id, 'MANAGE')) handleEdit(agent, agentSpec);- }}- />- );- })}- </TableBody>+ <TableBody>{agents.map(agent => renderAgent(agent, 'row'))}</TableBody></Table>- <TableTokenPagination- pageSize={pageSize}- rowCount={agents.length}- canPrev={canPrev}- canNext={canNext}- onPrev={goPrev}- onNext={goNext}- pageSizeOptions={AGENTS_PAGE_SIZE_OPTIONS}- onPageSizeChange={setPageSize}- />+ {pagination}</div>)}</div>diff --git a/packages/trueforge-ui/src/atoms/AgentsLibraryButton.tsx b/packages/trueforge-ui/src/atoms/AgentsLibraryButton.tsxindex d52f1366b..9a2248aaa 100644--- a/packages/trueforge-ui/src/atoms/AgentsLibraryButton.tsx+++ b/packages/trueforge-ui/src/atoms/AgentsLibraryButton.tsx@@ -72,7 +72,9 @@ export function AgentsLibraryButton({ className, compact = false }: AgentsLibrar<><span className="truncate">Agents- {countLabel != null ? <span className="text-text-secondary"> ({countLabel})</span> : null}+ {countLabel != null ? (+ <span className={cn(!libraryOpen && 'text-text-secondary')}> ({countLabel})</span>+ ) : null}</span><Icon name="chevron-right" className="ml-auto size-3.5 shrink-0 opacity-60" /></>diff --git a/packages/trueforge-ui/src/atoms/DesktopOnlyNotice.tsx b/packages/trueforge-ui/src/atoms/DesktopOnlyNotice.tsxnew file mode 100644index 000000000..c83138eaf--- /dev/null+++ b/packages/trueforge-ui/src/atoms/DesktopOnlyNotice.tsx@@ -0,0 +1,13 @@+'use client';++import { EmptyScreen } from './EmptyScreen.js';++/** Informational empty state for surfaces that are not available below the `md` breakpoint. */+export function DesktopOnlyNotice() {+ return (+ <EmptyScreen+ title="Best viewed on desktop"+ description="This page works best on a larger screen. Open the same link on a desktop browser to continue."+ />+ );+}diff --git a/packages/trueforge-ui/src/atoms/ShellActions.tsx b/packages/trueforge-ui/src/atoms/ShellActions.tsxindex 1890184e4..99594fffc 100644--- a/packages/trueforge-ui/src/atoms/ShellActions.tsx+++ b/packages/trueforge-ui/src/atoms/ShellActions.tsx@@ -9,7 +9,16 @@ import { useTheme } from '../theme/ThemeProvider.js';import { auiButtonClass, sidebarRailButtonClassName } from './lib/buttonClasses.js';import { cn } from './lib/cn.js';-export function ShellActions({ className, labeled = false }: { className?: string; labeled?: boolean }) {+export function ShellActions({+ className,+ labeled = false,+ onAction,+}: {+ className?: string;+ labeled?: boolean;+ /** Fired after Docs, theme, or Settings is activated — e.g. close a mobile drawer. */+ onAction?: () => void;+}) {const shell = useOptionalShellMode();const catalog = useOptionalCatalogServer();const capabilities = useServerCapabilities();@@ -40,6 +49,7 @@ export function ShellActions({ className, labeled = false }: { className?: strinsize: labeled ? undefined : 'icon',className: cn(hoverClass, labeled && sidebarRailButtonClassName),})}+ onClick={() => onAction?.()}><Icon name="book-open" size={labeled ? 14 : undefined} />{labeled ? <span className="text-center">Docs</span> : null}@@ -53,7 +63,10 @@ export function ShellActions({ className, labeled = false }: { className?: strinsize: labeled ? undefined : 'icon',className: cn(hoverClass, labeled && sidebarRailButtonClassName),})}- onClick={() => setTheme(isDark ? 'light' : 'dark')}+ onClick={() => {+ setTheme(isDark ? 'light' : 'dark');+ onAction?.();+ }}><Icon name={isDark ? 'sun' : 'moon'} size={labeled ? 14 : undefined} />{labeled ? <span className="text-center">{themeLabel}</span> : null}@@ -75,7 +88,10 @@ export function ShellActions({ className, labeled = false }: { className?: strin'bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text',),})}- onClick={() => shell.setSettingsOpen(true)}+ onClick={() => {+ shell.setSettingsOpen(true);+ onAction?.();+ }}><Icon name="settings" size={labeled ? 14 : undefined} />{labeled ? <span className="text-center">Settings</span> : null}diff --git a/packages/trueforge-ui/src/atoms/UserMessageBubble.tsx b/packages/trueforge-ui/src/atoms/UserMessageBubble.tsxindex eeb32276f..fcc822569 100644--- a/packages/trueforge-ui/src/atoms/UserMessageBubble.tsx+++ b/packages/trueforge-ui/src/atoms/UserMessageBubble.tsx@@ -28,7 +28,13 @@ export function UserMessageBubble({ text, attachments, editAction, className }:</div>) : null}{editAction && (- <div className="flex max-w-[min(80%,100%)] justify-end opacity-0 transition-opacity group-hover/user-message:opacity-100 focus-within:opacity-100">+ <div+ className={cn(+ 'flex max-w-[min(80%,100%)] justify-end transition-opacity',+ // Touch has no hover — keep actions visible below `md`; desktop still reveals on hover.+ 'md:opacity-0 md:group-hover/user-message:opacity-100 md:focus-within:opacity-100',+ )}+ >{editAction}</div>)}diff --git a/packages/trueforge-ui/src/atoms/agent-details/AgentDetailsPage.tsx b/packages/trueforge-ui/src/atoms/agent-details/AgentDetailsPage.tsxindex 042222efc..a3ba1f2e9 100644--- a/packages/trueforge-ui/src/atoms/agent-details/AgentDetailsPage.tsx+++ b/packages/trueforge-ui/src/atoms/agent-details/AgentDetailsPage.tsx@@ -12,6 +12,9 @@ import { isMetricsChromeEnabled, isSchedulesChromeEnabled } from '../../server/simport type { AgentDetail, CodeSnippet } from '../../server/types.js';import { useSlot } from '../../theme/SlotsProvider.js';import { defaultMetricsTimeRange, libraryAgentTabFromSearch } from '../../utils/sessionShareUrl.js';+import { DesktopOnlyNotice } from '../DesktopOnlyNotice.js';+import { isMobileNavDrawerOpen } from '../lib/isMobileNavDrawerOpen.js';+import { useIsMobile } from '../lib/useIsMobile.js';import { Skeleton } from '../primitives/Skeleton.js';import type { AgentDetailsPageProps } from './types.js';@@ -20,6 +23,7 @@ export function AgentDetailsPage({ agentId }: AgentDetailsPageProps) {const metricsServer = useOptionalAgentMetricsServer();const scheduleServer = useOptionalScheduleServer();const shell = useShellMode();+ const isMobile = useIsMobile();const share = useSessionShareSearch();const { updateShareSearch } = share;const requestedTab = libraryAgentTabFromSearch(share, agentId);@@ -58,6 +62,8 @@ export function AgentDetailsPage({ agentId }: AgentDetailsPageProps) {useEffect(() => {const onKeyDown = (event: KeyboardEvent) => {if (event.key !== 'Escape') return;+ // Let the mobile nav drawer consume Escape when it is open on top.+ if (isMobileNavDrawerOpen()) return;event.stopImmediatePropagation();goBack();};@@ -125,9 +131,9 @@ export function AgentDetailsPage({ agentId }: AgentDetailsPageProps) {} else if (activeTab === 'overview') {content = <AgentOverview detail={detail} />;} else if (activeTab === 'sessions') {- content = <AgentSessions agentId={agentId} />;+ content = isMobile ? <DesktopOnlyNotice /> : <AgentSessions agentId={agentId} />;} else if (activeTab === 'schedules') {- content = <SchedulesPage agentId={agentId} />;+ content = isMobile ? <DesktopOnlyNotice /> : <SchedulesPage agentId={agentId} />;} else if (activeTab === 'metrics') {content = (<AgentMetricsdiff --git a/packages/trueforge-ui/src/atoms/lib/isMobileNavDrawerOpen.ts b/packages/trueforge-ui/src/atoms/lib/isMobileNavDrawerOpen.tsnew file mode 100644index 000000000..c0fa8c672--- /dev/null+++ b/packages/trueforge-ui/src/atoms/lib/isMobileNavDrawerOpen.ts@@ -0,0 +1,4 @@+/** True when the SidebarLayout mobile nav dialog is mounted. */+export function isMobileNavDrawerOpen(): boolean {+ return typeof document !== 'undefined' && document.querySelector('[role="dialog"][aria-label="Navigation"]') != null;+}diff --git a/packages/trueforge-ui/src/containers/SettingsBuilder/ConnectorSettings.tsx b/packages/trueforge-ui/src/containers/SettingsBuilder/ConnectorSettings.tsxindex 00df6a50b..ebd2a9d30 100644--- a/packages/trueforge-ui/src/containers/SettingsBuilder/ConnectorSettings.tsx+++ b/packages/trueforge-ui/src/containers/SettingsBuilder/ConnectorSettings.tsx@@ -493,14 +493,15 @@ const ConnectorSettings = () => {</p>) : null}- <div className="mt-4 flex-1 overflow-y-hidden">- <div className="flex h-full flex-col gap-3">- <div className="flex gap-2">- <div className="flex-1">+ <div className="mt-4 min-h-0 min-w-0 flex-1 overflow-y-hidden">+ <div className="flex h-full min-w-0 flex-col gap-3">+ <div className="flex min-w-0 flex-col gap-2 sm:flex-row">+ <div className="min-w-0 flex-1"><SearchInput query={query} setQuery={setQuery} placeholder="Search connectors" /></div><Button.Secondarytype="button"+ className="shrink-0"onClick={() => {setFormError(null);setEditingConnector(null);diff --git a/packages/trueforge-ui/src/containers/SettingsBuilder/ModelSettings.tsx b/packages/trueforge-ui/src/containers/SettingsBuilder/ModelSettings.tsxindex d4edd65d3..85ec5f35a 100644--- a/packages/trueforge-ui/src/containers/SettingsBuilder/ModelSettings.tsx+++ b/packages/trueforge-ui/src/containers/SettingsBuilder/ModelSettings.tsx@@ -322,14 +322,15 @@ const ModelSettings = () => {</p>) : null}- <div className="mt-4 flex-1 overflow-y-hidden">- <div className="flex h-full flex-col gap-3">- <div className="flex gap-2">- <div className="flex-1">+ <div className="mt-4 min-h-0 min-w-0 flex-1 overflow-y-hidden">+ <div className="flex h-full min-w-0 flex-col gap-3">+ <div className="flex min-w-0 flex-col gap-2 sm:flex-row">+ <div className="min-w-0 flex-1"><SearchInput query={query} setQuery={setQuery} placeholder="Search providers and models" /></div><Button.Secondarytype="button"+ className="shrink-0 sm:self-auto"onClick={() => {setFormError(null);setCustomProviderToEdit(null);@@ -508,7 +509,7 @@ const ModelSettings = () => {<Icon name="cpu" className="size-4.5" />)}</span>- <div className="min-w-0">+ <div className="min-w-0 flex-1 overflow-hidden"><h5 className="truncate text-base font-medium text-text-primary">{provider.name}</h5><p className="truncate text-sm text-text-secondary">{provider.models.map(model => model.name).join(' · ')}diff --git a/packages/trueforge-ui/src/containers/SettingsBuilder/index.tsx b/packages/trueforge-ui/src/containers/SettingsBuilder/index.tsxindex cdb23c64f..b16dbd05e 100644--- a/packages/trueforge-ui/src/containers/SettingsBuilder/index.tsx+++ b/packages/trueforge-ui/src/containers/SettingsBuilder/index.tsx@@ -1,11 +1,13 @@'use client';-import { lazy, Suspense, useCallback, useEffect, useMemo } from 'react';+import { lazy, Suspense, useCallback, useEffect, useMemo, type ReactNode } from 'react';import { useDraftCatalog } from '@/atoms/draft/DraftCatalogProvider.js';import { auiButtonClass } from '@/atoms/lib/buttonClasses.js';import { cn } from '@/atoms/lib/cn.js';import { useCompactLayout } from '@/atoms/lib/CompactLayoutContext.js';+import { isMobileNavDrawerOpen } from '@/atoms/lib/isMobileNavDrawerOpen.js';+import { useIsMobile } from '@/atoms/lib/useIsMobile.js';import { PageHeader } from '@/atoms/PageHeader.js';import { Spinner } from '@/atoms/primitives/Spinner.js';import { Icon } from '@/icons/Icon.js';@@ -28,13 +30,16 @@ function SettingsSectionFallback() {);}-const TruefoundrySettingsBuilder = () => {+const TruefoundrySettingsBuilder = ({ headerStart }: { headerStart?: ReactNode } = {}) => {const { settingsOpen, settingsSection: section, setSettingsOpen } = useShellMode();const catalog = useOptionalCatalogServer();const refreshServerCapabilities = useOptionalRefreshServerCapabilities();const { refresh: refreshDraftCatalog } = useDraftCatalog();// dock/widget panels are ~mobile width even on a wide viewport — keep Settings stacked.- const compact = useCompactLayout();+ // SidebarLayout mobile is not under CompactLayoutProvider, so treat it the same.+ const compactLayout = useCompactLayout();+ const isMobile = useIsMobile();+ const compact = compactLayout || isMobile;const hasSkills = catalog?.skillCatalog != null;const hasSandbox = catalog?.sandboxCatalog != null;const hasWebSearch = catalog?.webSearchCatalog != null;@@ -68,6 +73,8 @@ const TruefoundrySettingsBuilder = () => {if (!settingsOpen) return;const onKeyDown = (event: KeyboardEvent) => {if (event.key !== 'Escape') return;+ // Let the mobile nav drawer consume Escape when it is open on top.+ if (isMobileNavDrawerOpen()) return;event.stopImmediatePropagation();closeSettings();};@@ -106,28 +113,32 @@ const TruefoundrySettingsBuilder = () => {if (!settingsOpen || !catalog) return null;return (- <div className="flex h-full min-h-0 w-full flex-col bg-primary-bg">+ <div className="flex h-full min-h-0 w-full min-w-0 flex-col overflow-x-hidden bg-primary-bg"><PageHeadertitle="Settings"start={- <button- type="button"- aria-label="Back"- title="Back"- className={auiButtonClass({ variant: 'ghost', size: 'icon' })}- onClick={closeSettings}- >- <Icon name="arrow-left" />- </button>+ headerStart ?? (+ <button+ type="button"+ aria-label="Back"+ title="Back"+ className={auiButtonClass({ variant: 'ghost', size: 'icon' })}+ onClick={closeSettings}+ >+ <Icon name="arrow-left" />+ </button>+ )}/>- <div className={cn('flex min-h-0 flex-1 flex-col', !compact && 'md:flex-row')}>+ <div className={cn('flex min-h-0 min-w-0 flex-1 flex-col', !compact && 'md:flex-row')}><navaria-label="Settings sections"className={cn(- 'flex w-full gap-1 border-b border-border bg-secondary-bg/40 p-2',- compact ? 'min-w-0' : 'justify-center md:w-48 md:flex-col md:justify-start md:border-b-0 md:border-r',+ 'flex w-full min-w-0 gap-1 border-b border-border bg-secondary-bg/40 p-2',+ compact+ ? 'overflow-x-auto'+ : 'justify-center md:w-48 md:flex-col md:justify-start md:border-b-0 md:border-r',)}>{sections.map(item => (@@ -155,8 +166,8 @@ const TruefoundrySettingsBuilder = () => {))}</nav>- <section className="flex flex-col h-full flex-1 overflow-y-hidden px-6 py-4">- <div className="w-full max-w-210 h-full min-h-0 flex flex-col mx-auto">+ <section className="flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden overflow-y-hidden px-4 py-4 sm:px-6">+ <div className="mx-auto flex h-full min-h-0 w-full min-w-0 max-w-210 flex-col"><Suspense fallback={<SettingsSectionFallback />}>{section === 'models' ? <ModelSettings /> : null}{section === 'connectors' ? <ConnectorSettings /> : null}diff --git a/packages/trueforge-ui/src/containers/ThreadListContainer.tsx b/packages/trueforge-ui/src/containers/ThreadListContainer.tsxindex 52f757333..55402e2be 100644--- a/packages/trueforge-ui/src/containers/ThreadListContainer.tsx+++ b/packages/trueforge-ui/src/containers/ThreadListContainer.tsx@@ -42,8 +42,11 @@ import { useToasterOptional } from './ToasterContainer.js';export type ThreadListContainerProps = {/** Called after New chat or selecting a row — used by stack/drawer chrome. */onThreadOpen?: () => void;- /** `recent-history` hides navigation and lists only persisted sessions. */- variant?: 'default' | 'recent-history';+ /**+ * `recent-history` hides navigation and lists only persisted sessions.+ * `mobile-drawer` shows New Chat + Agents Library, then persisted sessions (no Sessions/Schedules).+ */+ variant?: 'default' | 'recent-history' | 'mobile-drawer';};const actionItemClass =@@ -314,6 +317,10 @@ function useThreadListIndicesByRecency(variant: NonNullable<ThreadListContainerP}, [threadIds, threadItems, variant]);}+function isPersistedHistoryVariant(variant: NonNullable<ThreadListContainerProps['variant']>): boolean {+ return variant === 'recent-history' || variant === 'mobile-drawer';+}+function ThreadListItemsByRecency({indices,onThreadOpen,@@ -424,7 +431,8 @@ export function ThreadListContainer({ onThreadOpen, variant = 'default' }: Threaconst showNewChat = shell?.isNewChatEnabled !== false;const isIdle = shell?.mode.status === 'idle';- const isRecentHistory = variant === 'recent-history';+ const isPersistedHistory = isPersistedHistoryVariant(variant);+ const isMobileDrawer = variant === 'mobile-drawer';const canRenameSession = typeof server?.renameSession === 'function';const canDeleteSession = typeof server?.deleteSession === 'function';const remoteSessionIds = useMemo(@@ -489,11 +497,11 @@ export function ThreadListContainer({ onThreadOpen, variant = 'default' }: Threalet listBody: ReactNode;if (isIdle) {- listBody = <ThreadListEmptyState message={isRecentHistory ? 'No recent chats' : undefined} />;+ listBody = <ThreadListEmptyState message={isPersistedHistory ? 'No recent chats' : undefined} />;} else if (isLoading) {listBody = <ThreadListRowSkeleton />;} else if (indices.length === 0) {- listBody = <ThreadListEmptyState message={isRecentHistory ? 'No recent chats' : undefined} />;+ listBody = <ThreadListEmptyState message={isPersistedHistory ? 'No recent chats' : undefined} />;} else {listBody = (<ThreadListPrimitive.Root className="flex min-h-0 flex-col gap-0.5">@@ -509,21 +517,31 @@ export function ThreadListContainer({ onThreadOpen, variant = 'default' }: Threa);}- return (- <ThreadListShell- header={- isRecentHistory ? null : (- <div className="flex flex-col gap-1">- {showNewChat ? <ThreadListNewButton onClick={handleNewChat} /> : null}- <AgentsLibraryButton />+ const header =+ variant === 'recent-history' ? null : (+ <div className="flex flex-col gap-1">+ {showNewChat ? <ThreadListNewButton onClick={handleNewChat} /> : null}+ <div+ className="contents"+ onClick={() => {+ if (isMobileDrawer) onThreadOpen?.();+ }}+ >+ <AgentsLibraryButton />+ </div>+ {isMobileDrawer ? null : (+ <><SessionsBrowserButton /><SchedulesButton /><EnvironmentsButton />- </div>- )- }- >- <RecentChatsSection viewportRef={viewportRef} hideScrollbar={isRecentHistory}>+ </>+ )}+ </div>+ );++ return (+ <ThreadListShell header={header}>+ <RecentChatsSection viewportRef={viewportRef} hideScrollbar={isPersistedHistory}>{listBody}{!isIdle && hasMore ? <div className="h-4 shrink-0" aria-hidden /> : null}</RecentChatsSection>diff --git a/packages/trueforge-ui/src/icons/IconRegistry.tsx b/packages/trueforge-ui/src/icons/IconRegistry.tsxindex ff525e89b..50757cb24 100644--- a/packages/trueforge-ui/src/icons/IconRegistry.tsx+++ b/packages/trueforge-ui/src/icons/IconRegistry.tsx@@ -48,6 +48,7 @@ import {Minimize2,Monitor,Moon,+ PanelLeft,PanelLeftClose,PanelLeftOpen,Paperclip,@@ -162,6 +163,7 @@ const defaults: Record<string, IconEntry> = {copy: Copy,'dollar-sign': DollarSign,bars: Menu,+ 'panel-left': PanelLeft,'panel-left-close': PanelLeftClose,'panel-left-open': PanelLeftOpen,plus: Plus,diff --git a/packages/trueforge-ui/src/layouts/DrawerLayout.tsx b/packages/trueforge-ui/src/layouts/DrawerLayout.tsxindex 779397a0d..c3931f647 100644--- a/packages/trueforge-ui/src/layouts/DrawerLayout.tsx+++ b/packages/trueforge-ui/src/layouts/DrawerLayout.tsx@@ -3,6 +3,7 @@import { lazy, Suspense, useRef } from 'react';import { useAui } from '../assistant-ui.js';+import { DesktopOnlyNotice } from '../atoms/DesktopOnlyNotice.js';import { NamedAgentHeaderLabel } from '../atoms/NamedAgentHeaderLabel.js';import { PageHeader } from '../atoms/PageHeader.js';import { ShellActions } from '../atoms/ShellActions.js';@@ -46,8 +47,10 @@ export function DrawerLayout({ className }: { className?: string }) {const environmentsOpen = shell?.environmentsOpen === true;const overlayOpen = settingsOpen || libraryOpen || sessionsOpen || schedulesOpen || environmentsOpen;const chatChromeActionsVisible = useChatChromeActionsVisible();- const showAgentConfig =- shell != null && shellIsCreateAgent(shell.mode) && !overlayOpen && (!isMobile || shell.agentConfigOpen);+ const isCreateAgent = shell != null && shellIsCreateAgent(shell.mode);+ const showDesktopOnlyNotice =+ isMobile && (sessionsOpen || schedulesOpen || environmentsOpen || (isCreateAgent && !settingsOpen && !libraryOpen));+ const showAgentConfig = isCreateAgent && !overlayOpen && !isMobile;const showNewActions = shell?.isNewChatEnabled !== false;const handleNewChat = () => {@@ -71,6 +74,18 @@ export function DrawerLayout({ className }: { className?: string }) {}};+ const handleBackToChat = () => {+ shell?.setLibraryOpen(false);+ shell?.setSchedulesOpen(false);+ shell?.setSessionsOpen(false);+ shell?.setEnvironmentsOpen(false);+ // Only exit create-agent when leaving the mobile Build Agent notice — not when+ // dismissing Agents/Schedules over an in-progress desktop builder.+ if (showDesktopOnlyNotice && isCreateAgent) shell?.openDraft();+ };++ const showBackToChat = showDesktopOnlyNotice || libraryOpen || schedulesOpen || environmentsOpen;+return (<div className={cn('relative flex h-full min-h-0 w-full bg-primary-bg', className)}>{showAgentConfig ? (@@ -79,7 +94,7 @@ export function DrawerLayout({ className }: { className?: string }) {aria-label="Agent Config"className="absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:w-88 md:max-w-none md:shrink-0 md:shadow-none">- <AgentConfigDrawerContainer showClose={isMobile} />+ <AgentConfigDrawerContainer /></aside>) : null}@@ -88,26 +103,22 @@ export function DrawerLayout({ className }: { className?: string }) {<PageHeaderclassName="bg-topbar-bg"title={- !overlayOpen ? (- <NamedAgentHeaderLabel />- ) : libraryOpen || schedulesOpen || environmentsOpen ? (+ showBackToChat ? (<buttontype="button"className={auiButtonClass({ variant: 'ghost', size: 'small' })}- onClick={() => {- shell?.setLibraryOpen(false);- shell?.setSchedulesOpen(false);- shell?.setEnvironmentsOpen(false);- }}+ onClick={handleBackToChat}><Icon name="arrow-left" />Back to chat</button>+ ) : !overlayOpen ? (+ <NamedAgentHeaderLabel />) : null}end={<>- {!overlayOpen ? (+ {!overlayOpen && !showDesktopOnlyNotice ? (<><ShareChatButton /><ClearChatButton />@@ -116,7 +127,7 @@ export function DrawerLayout({ className }: { className?: string }) {) : null}<ShellActions key="shell-actions" /><UserAvatar />- {!overlayOpen ? (+ {!overlayOpen && !showDesktopOnlyNotice ? (<>{showNewActions && !chatChromeActionsVisible ? (<button@@ -129,7 +140,7 @@ export function DrawerLayout({ className }: { className?: string }) {<Icon name="square-pen" /></button>) : null}- {showNewActions && shell?.isComposerEnabled ? (+ {showNewActions && shell?.isComposerEnabled && !isMobile ? (<buttontype="button"aria-label="New Agent"@@ -162,6 +173,8 @@ export function DrawerLayout({ className }: { className?: string }) {><TruefoundrySettingsBuilder /></Suspense>+ ) : showDesktopOnlyNotice ? (+ <DesktopOnlyNotice />) : sessionsOpen ? (<SessionsPage />) : libraryOpen && shell?.libraryAgentId != null ? (diff --git a/packages/trueforge-ui/src/layouts/SidebarLayout.tsx b/packages/trueforge-ui/src/layouts/SidebarLayout.tsxindex 386d5a9ef..cc85aad4c 100644--- a/packages/trueforge-ui/src/layouts/SidebarLayout.tsx+++ b/packages/trueforge-ui/src/layouts/SidebarLayout.tsx@@ -12,6 +12,7 @@ import {} from 'react';import { useAui } from '../assistant-ui.js';+import { DesktopOnlyNotice } from '../atoms/DesktopOnlyNotice.js';import { auiButtonClass, sidebarRailButtonClassName } from '../atoms/lib/buttonClasses.js';import { cn } from '../atoms/lib/cn.js';import { useIsMobile } from '../atoms/lib/useIsMobile.js';@@ -26,7 +27,7 @@ import { FilePreviewProvider, useFilePreview } from '../filePreview/FilePreviewCimport { useChatHeaderContentVisible } from '../hooks/useChatChromeActionsVisible.js';import { Icon } from '../icons/Icon.js';import { shellIsCreateAgent, useOptionalShellMode, type ShellMode } from '../server/ShellModeContext.js';-import { resolveBrandChrome } from '../theme/brand.js';+import { resolveBrandChrome, useBrandName } from '../theme/brand.js';import { useSlot } from '../theme/SlotsProvider.js';import { useBrand } from '../theme/ThemeProvider.js';@@ -39,7 +40,9 @@ const EnvironmentsPage = lazy(() =>);const brandLogoClassName = 'h-5 w-5 max-w-40 shrink-0 object-contain';+const brandLogoExpandedClassName = 'h-5 max-w-40 shrink-0 object-contain';const railWidthClassName = 'w-20';+const mobileDrawerWidthClassName = 'w-80';const railActionButtonClassName = cn(sidebarRailButtonClassName, 'text-sidebar-text');@@ -148,14 +151,12 @@ function SidebarNav(): ReactNode {);}-/** Shared desktop + mobile icon+label rail (brand, nav, footer actions). */+/** Desktop icon+label rail (brand, nav, footer actions). */function SidebarRail({- onNavigate,className,railRef,...dialogProps}: {- onNavigate?: () => void;className?: string;railRef?: Ref<HTMLElement>;} & Omit<ComponentPropsWithoutRef<'aside'>, 'children' | 'className'>): ReactNode {@@ -172,12 +173,6 @@ function SidebarRail({'flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar-bg',className,)}- onClick={event => {- if (onNavigate == null) return;- const target = event.target;- if (!(target instanceof Element)) return;- if (target.closest('button') != null) onNavigate();- }}{...dialogProps}><div className="flex h-14 w-full shrink-0 items-center justify-center text-text-primary">@@ -192,6 +187,53 @@ function SidebarRail({);}+/** Claude-style mobile side drawer: branding, New Chat + Agents, history, footer actions. */+function MobileNavDrawer({ drawerRef, onClose }: { drawerRef: Ref<HTMLElement>; onClose: () => void }): ReactNode {+ const brand = useBrand();+ const chrome = resolveBrandChrome(brand);+ const brandName = useBrandName();+ const BrandLogo = useSlot('BrandLogo');+ const UserAvatar = useSlot('UserAvatar');++ return (+ <aside+ ref={drawerRef}+ role="dialog"+ aria-label="Navigation"+ tabIndex={-1}+ className={cn(+ mobileDrawerWidthClassName,+ 'absolute inset-y-0 left-0 z-10 flex min-h-0 flex-col border-r border-border bg-sidebar-bg shadow-lg outline-none md:hidden',+ )}+ >+ <div className="flex h-14 w-full shrink-0 items-center gap-2 border-b border-border px-3 text-text-primary">+ <BrandLogo variant={chrome.expandedVariant} className={brandLogoExpandedClassName} />+ {chrome.showTitle && brandName != null ? (+ <span className="min-w-0 flex-1 truncate text-sm font-semibold">{brandName}</span>+ ) : (+ <span className="min-w-0 flex-1" />+ )}+ <button+ type="button"+ aria-label="Close navigation"+ className={auiButtonClass({ variant: 'ghost', size: 'icon' })}+ onClick={onClose}+ >+ <Icon name="xmark" />+ </button>+ </div>+ <div className="min-h-0 flex-1">+ <ThreadListContainer variant="mobile-drawer" onThreadOpen={onClose} />+ </div>+ <footer className="flex shrink-0 items-center justify-around gap-1 border-t border-border p-2 text-sidebar-text">+ {/* `contents` lets Docs / Theme / Settings share this row with the avatar. */}+ <ShellActions labeled onAction={onClose} className="contents" />+ <UserAvatar labeled />+ </footer>+ </aside>+ );+}+export function SidebarLayout({ className }: { className?: string }) {const shell = useOptionalShellMode();const isMobile = useIsMobile();@@ -210,22 +252,44 @@ export function SidebarLayout({ className }: { className?: string }) {const isIdle = shell?.mode.status === 'idle';const settingsOpen = shell?.settingsOpen === true;const libraryOpen = shell?.libraryOpen === true;+ const libraryListOpen = libraryOpen && shell?.libraryAgentId == null;const sessionsOpen = shell?.sessionsOpen === true;const schedulesOpen = shell?.schedulesOpen === true;const environmentsOpen = shell?.environmentsOpen === true;const overlayOpen = settingsOpen || libraryOpen || sessionsOpen || schedulesOpen || environmentsOpen;- const showAgentConfig =- shell != null && shellIsCreateAgent(shell.mode) && !overlayOpen && (!isMobile || shell.agentConfigOpen);+ const isCreateAgent = shell != null && shellIsCreateAgent(shell.mode);+ // Build Agent, Sessions, Schedules, and Environments are desktop-only; keep the URL and show a notice.+ const showDesktopOnlyNotice =+ isMobile && (sessionsOpen || schedulesOpen || environmentsOpen || (isCreateAgent && !settingsOpen && !libraryOpen));+ const showAgentConfig = isCreateAgent && !overlayOpen && !isMobile;const showRecentHistory = isRecentHistoryVisible({ overlayOpen, mode: shell?.mode });const hasChatHeaderContent = useChatHeaderContentVisible();+ // Agents / Settings own a page header — put the hamburger there instead of a second top bar.+ const inlineMobileNav = isMobile && (settingsOpen || libraryListOpen);+ const closeMobileNav = () => setMobileNavOpen(false);+ const mobileNavButton = (+ <button+ ref={menuBtnRef}+ type="button"+ aria-label="Navigation"+ aria-expanded={mobileNavOpen}+ className={cn(auiButtonClass({ variant: 'ghost', size: 'icon' }), 'md:hidden')}+ onClick={() => setMobileNavOpen(true)}+ >+ <Icon name="panel-left" />+ </button>+ );useEffect(() => {if (!mobileNavOpen) return;const onKeyDown = (event: KeyboardEvent) => {- if (event.key === 'Escape') setMobileNavOpen(false);+ if (event.key !== 'Escape') return;+ // Capture + stop so Settings / Agents / Agent Details Escape handlers do not steal this.+ event.stopImmediatePropagation();+ setMobileNavOpen(false);};- window.addEventListener('keydown', onKeyDown);- return () => window.removeEventListener('keydown', onKeyDown);+ window.addEventListener('keydown', onKeyDown, true);+ return () => window.removeEventListener('keydown', onKeyDown, true);}, [mobileNavOpen]);useEffect(() => {@@ -253,47 +317,36 @@ export function SidebarLayout({ className }: { className?: string }) {aria-label="Agent Config"className="absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:max-w-140 md:flex-1 md:shadow-none 2xl:max-w-150">- <AgentConfigDrawerContainer showClose={isMobile} />+ <AgentConfigDrawerContainer /></aside>) : null}<div className="flex min-h-0 min-w-0 flex-1 flex-col bg-primary-bg">{/* Desktop keeps shell chrome in the rail footer (always mounted, includingwhen visually hidden on small screens so host action-slot state persists).- Mobile reaches theme/settings via the nav drawer rail. */}- <PageHeader- className={cn(- 'bg-topbar-bg',- // Desktop: hide when settings/idle or the thread header has nothing to show- // (empty untitled draft). Mobile still needs the menu button.- // Builder mode keeps New Agent and its actions beside the persistent config.- (overlayOpen || isIdle || !hasChatHeaderContent) && 'md:hidden',- )}- start={- !overlayOpen ? (- <button- ref={menuBtnRef}- type="button"- aria-label="Navigation"- aria-expanded={mobileNavOpen}- className={cn(auiButtonClass({ variant: 'ghost', size: 'icon' }), 'md:hidden')}- onClick={() => setMobileNavOpen(true)}- >- <Icon name="bars" />- </button>- ) : null- }- title={!overlayOpen ? <NamedAgentHeaderLabel /> : null}- end={- !overlayOpen ? (- <>- <ShareChatButton />- <ClearChatButton />- <SaveAgentButton />- </>- ) : null- }- />+ Mobile reaches theme/settings via the nav drawer. */}+ {inlineMobileNav ? null : (+ <PageHeader+ className={cn(+ 'bg-topbar-bg',+ // Desktop: hide when settings/idle or the thread header has nothing to show+ // (empty untitled draft). Mobile still needs the menu button.+ // Builder mode keeps New Agent and its actions beside the persistent config.+ (overlayOpen || isIdle || !hasChatHeaderContent || showDesktopOnlyNotice) && 'md:hidden',+ )}+ start={mobileNavButton}+ title={!overlayOpen && !showDesktopOnlyNotice ? <NamedAgentHeaderLabel /> : null}+ end={+ !overlayOpen && !showDesktopOnlyNotice ? (+ <>+ <ShareChatButton />+ <ClearChatButton />+ <SaveAgentButton />+ </>+ ) : null+ }+ />+ )}<FilePreviewProvider><div className="flex min-h-0 min-w-0 flex-1">@@ -314,14 +367,19 @@ export function SidebarLayout({ className }: { className?: string }) {</div>}>- <TruefoundrySettingsBuilder />+ <TruefoundrySettingsBuilder {...(inlineMobileNav ? { headerStart: mobileNavButton } : {})} /></Suspense>+ ) : showDesktopOnlyNotice ? (+ <DesktopOnlyNotice />) : sessionsOpen ? (<SessionsPage />) : libraryOpen && shell?.libraryAgentId != null ? (<AgentDetailsPage key={shell.libraryAgentId} agentId={shell.libraryAgentId} />) : libraryOpen ? (- <AgentsLibrary onSelectAgent={() => setMobileNavOpen(false)} />+ <AgentsLibrary+ onSelectAgent={closeMobileNav}+ {...(inlineMobileNav ? { headerStart: mobileNavButton } : {})}+ />) : schedulesOpen ? (<Suspensefallback={@@ -364,23 +422,15 @@ export function SidebarLayout({ className }: { className?: string }) {</FilePreviewProvider></div>- {/* Mobile: same narrow rail as desktop */}{mobileNavOpen ? (<><buttontype="button"- aria-label="Close navigation"+ aria-label="Close navigation backdrop"className="absolute inset-0 z-[9] cursor-pointer bg-[var(--overlay)] md:hidden"- onClick={() => setMobileNavOpen(false)}- />- <SidebarRail- railRef={dialogRef}- role="dialog"- aria-label="Navigation"- tabIndex={-1}- onNavigate={() => setMobileNavOpen(false)}- className="absolute inset-y-0 left-0 z-10 shadow-lg outline-none md:hidden"+ onClick={closeMobileNav}/>+ <MobileNavDrawer drawerRef={dialogRef} onClose={closeMobileNav} /></>) : null}</div>diff --git a/packages/trueforge-ui/src/theme/presets/index.ts b/packages/trueforge-ui/src/theme/presets/index.tsindex 49500bf82..f1980963b 100644--- a/packages/trueforge-ui/src/theme/presets/index.ts+++ b/packages/trueforge-ui/src/theme/presets/index.ts@@ -7,7 +7,7 @@ export type PresetTokens = {const trueforge: PresetTokens = {light: {- sidebarBg: '#EEF2FF1A',+ sidebarBg: '#FDFEFF', // indigo-50 10% opacitysidebarText: '#3E5680',topbarBg: '#FFFFFF',primaryBg: '#FFFFFF',diff --git a/packages/trueforge-ui/test/atoms/AgentDetailsPage.test.tsx b/packages/trueforge-ui/test/atoms/AgentDetailsPage.test.tsxindex bd998a7a5..bb76284c0 100644--- a/packages/trueforge-ui/test/atoms/AgentDetailsPage.test.tsx+++ b/packages/trueforge-ui/test/atoms/AgentDetailsPage.test.tsx@@ -76,6 +76,27 @@ beforeAll(() => {};});+function mobileMatchMedia(query: string): MediaQueryList {+ return {+ matches: query === '(max-width: 767px)',+ media: query,+ onchange: null,+ addEventListener: vi.fn(),+ removeEventListener: vi.fn(),+ addListener: vi.fn(),+ removeListener: vi.fn(),+ dispatchEvent: vi.fn(() => true),+ };+}++function withMobileViewport(run: () => Promise<void> | void) {+ const originalMatchMedia = window.matchMedia;+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: mobileMatchMedia });+ return Promise.resolve(run()).finally(() => {+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: originalMatchMedia });+ });+}+const detail: AgentDetail = {agentId: 'agent-1',name: 'release-notes-writer',@@ -351,6 +372,62 @@ describe('AgentDetailsPage', () => {expect(new URL(window.location.href).searchParams.get('agent')).toBeNull();});+ it('shows a desktop-only notice for Sessions and Schedules tabs on mobile', async () => {+ await withMobileViewport(async () => {+ const { listSessions } = renderPage({+ schedules: createMockScheduleServer(),+ overrides: {+ AgentSessions: () => <div>Sessions mounted</div>,+ SchedulesPage: () => <div>Schedules mounted</div>,+ },+ });++ await screen.findByText('release-notes-writer');+ fireEvent.click(screen.getByRole('tab', { name: 'Sessions' }));+ expect(await screen.findByRole('heading', { name: 'Best viewed on desktop' })).toBeInTheDocument();+ expect(screen.queryByText('Sessions mounted')).not.toBeInTheDocument();+ expect(listSessions).not.toHaveBeenCalled();++ fireEvent.click(screen.getByRole('tab', { name: 'Schedules' }));+ expect(screen.getByRole('heading', { name: 'Best viewed on desktop' })).toBeInTheDocument();+ expect(screen.queryByText('Schedules mounted')).not.toBeInTheDocument();+ });+ });++ it('shows a desktop-only notice for a deep-linked Sessions tab on mobile', async () => {+ await withMobileViewport(async () => {+ window.history.replaceState(null, '', '/library/agent-1?tab=sessions&agentId=agent-1');+ const { listSessions } = renderPage({+ initialEntries: ['/library/agent-1?tab=sessions&agentId=agent-1'],+ overrides: {+ AgentSessions: () => <div>Sessions mounted</div>,+ },+ });++ expect(await screen.findByRole('tab', { name: 'Sessions' })).toHaveAttribute('aria-selected', 'true');+ expect(screen.getByRole('heading', { name: 'Best viewed on desktop' })).toBeInTheDocument();+ expect(screen.queryByText('Sessions mounted')).not.toBeInTheDocument();+ expect(listSessions).not.toHaveBeenCalled();+ });+ });++ it('shows a desktop-only notice for a deep-linked Schedules tab on mobile', async () => {+ await withMobileViewport(async () => {+ window.history.replaceState(null, '', '/library/agent-1?tab=schedules&agentId=agent-1');+ renderPage({+ initialEntries: ['/library/agent-1?tab=schedules&agentId=agent-1'],+ schedules: createMockScheduleServer(),+ overrides: {+ SchedulesPage: () => <div>Schedules mounted</div>,+ },+ });++ expect(await screen.findByRole('tab', { name: 'Schedules' })).toHaveAttribute('aria-selected', 'true');+ expect(screen.getByRole('heading', { name: 'Best viewed on desktop' })).toBeInTheDocument();+ expect(screen.queryByText('Schedules mounted')).not.toBeInTheDocument();+ });+ });+it('opens the create schedule drawer after redirecting from + Schedule', async () => {window.history.replaceState(null, '', '/library/agent-1?agentId=agent-1&tab=schedules&isNew=true');renderPage({diff --git a/packages/trueforge-ui/test/atoms/AgentsLibrary.test.tsx b/packages/trueforge-ui/test/atoms/AgentsLibrary.test.tsxindex d1c411746..973f6deb9 100644--- a/packages/trueforge-ui/test/atoms/AgentsLibrary.test.tsx+++ b/packages/trueforge-ui/test/atoms/AgentsLibrary.test.tsx@@ -32,6 +32,27 @@ afterEach(() => {window.history.replaceState(null, '', '/');});+function mobileMatchMedia(query: string): MediaQueryList {+ return {+ matches: query === '(max-width: 767px)',+ media: query,+ onchange: null,+ addEventListener: vi.fn(),+ removeEventListener: vi.fn(),+ addListener: vi.fn(),+ removeListener: vi.fn(),+ dispatchEvent: vi.fn(() => true),+ };+}++function withMobileViewport(run: () => Promise<void> | void) {+ const originalMatchMedia = window.matchMedia;+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: mobileMatchMedia });+ return Promise.resolve(run()).finally(() => {+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: originalMatchMedia });+ });+}+function mockServer(agents: Array<{name: string;@@ -173,6 +194,53 @@ describe('AgentsLibrary', () => {});});+ it('renders agents as cards on mobile instead of a table', async () => {+ await withMobileViewport(async () => {+ const server = createMockAgentUIServer({+ searchAgents: vi.fn(async () => ({+ data: [+ {+ name: 'alpha-agent',+ agentId: 'alpha-agent',+ description: 'Alpha handles triage.',+ agentSpec: {+ model: { name: 'openai/gpt-4.1' },+ skills: [{ id: 's1', name: 'Skill' }],+ mcpServers: [{ id: 'm1', name: 'Connector' }],+ },+ },+ ],+ })),+ sessions: createMockAgentSessionsServer(),+ schedules: createMockScheduleServer(),+ });++ renderLibrary(<LibraryHarness />, { server });+ fireEvent.click(screen.getByRole('button', { name: 'Open library' }));++ await waitFor(() => {+ expect(screen.getByRole('button', { name: 'Try agent alpha-agent' })).toBeInTheDocument();+ });++ expect(screen.queryByRole('table')).not.toBeInTheDocument();+ expect(screen.queryByRole('columnheader')).not.toBeInTheDocument();++ const cards = screen.getAllByRole('listitem');+ expect(cards).toHaveLength(1);+ const card = cards[0]!;+ expect(within(card).getByRole('button', { name: 'Open alpha-agent' })).toBeInTheDocument();+ expect(within(card).getByRole('button', { name: 'Try agent alpha-agent' })).toBeInTheDocument();+ expect(within(card).getByLabelText('openai/gpt-4.1')).toBeInTheDocument();+ expect(within(card).getByLabelText(/Skills:/)).toBeInTheDocument();+ expect(within(card).getByLabelText(/Connectors:/)).toBeInTheDocument();+ expect(within(card).getByText('Alpha handles triage.')).toHaveClass('line-clamp-2');++ const addSchedule = await within(card).findByRole('button', { name: 'Add schedule for alpha-agent' });+ expect(addSchedule).toBeVisible();+ expect(addSchedule).toHaveClass('inline-flex');+ });+ });+it('truncates long descriptions without hiding Try, and skips name-echo descriptions', async () => {const longDescription = `${'Lorem ipsum dolor sit amet, '.repeat(20)}consectetur.`;const server = mockServer([diff --git a/packages/trueforge-ui/test/atoms/UserMessageBubble.test.tsx b/packages/trueforge-ui/test/atoms/UserMessageBubble.test.tsxindex f56d8b4bf..dcd191927 100644--- a/packages/trueforge-ui/test/atoms/UserMessageBubble.test.tsx+++ b/packages/trueforge-ui/test/atoms/UserMessageBubble.test.tsx@@ -21,7 +21,9 @@ describe('UserMessageBubble', () => {expect(content).toHaveTextContent('First line Second line');expect(content).toHaveStyle({ borderRadius: 'var(--composer-radius, 1.5rem)' });expect(screen.getByRole('link', { name: 'brief.pdf' })).toHaveAttribute('href', '/brief.pdf');- expect(screen.getByRole('button', { name: 'Edit message' })).toBeInTheDocument();+ const editAction = screen.getByRole('button', { name: 'Edit message' }).parentElement;+ expect(editAction).toHaveClass('md:opacity-0');+ expect(editAction).toHaveClass('md:group-hover/user-message:opacity-100');});it('omits optional attachment and edit-action content', () => {diff --git a/packages/trueforge-ui/test/containers/TrueForgeUI.test.tsx b/packages/trueforge-ui/test/containers/TrueForgeUI.test.tsxindex 6564a6d5f..6a401d3da 100644--- a/packages/trueforge-ui/test/containers/TrueForgeUI.test.tsx+++ b/packages/trueforge-ui/test/containers/TrueForgeUI.test.tsx@@ -415,7 +415,7 @@ describe('StackChatPanel', () => {});describe('SidebarLayout', () => {- it('lets mobile builders close and reopen Agent Config', () => {+ it('shows a desktop-only notice for Build Agent on mobile', () => {const originalMatchMedia = window.matchMedia;Object.defineProperty(window, 'matchMedia', { configurable: true, value: mobileMatchMedia });@@ -436,41 +436,153 @@ describe('SidebarLayout', () => {</SlotsProvider>,);+ // Desktop rail is CSS-hidden but still mounted; click Build Agent from there.fireEvent.click(screen.getByRole('button', { name: 'Start new agent' }));- expect(screen.getByRole('dialog', { name: 'Agent Config' })).toBeInTheDocument();-- fireEvent.click(screen.getByRole('button', { name: 'Close agent config' }));+ expect(screen.getByRole('heading', { name: 'Best viewed on desktop' })).toBeInTheDocument();expect(screen.queryByRole('dialog', { name: 'Agent Config' })).not.toBeInTheDocument();-- fireEvent.click(screen.getByRole('button', { name: 'Agent config' }));- expect(screen.getByRole('dialog', { name: 'Agent Config' })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Navigation' })).toBeInTheDocument();} finally {Object.defineProperty(window, 'matchMedia', { configurable: true, value: originalMatchMedia });}});- it('shows the app brand in the mobile navigation drawer', () => {+ it('opens a Claude-style mobile navigation drawer with history and footer actions', async () => {render(<SlotsProvider theme={{ brand: { mode: 'icon-title', name: 'Acme', icon: { src: '/acme.svg' } } }}>- <ShellModeProvider>- <RuntimeHarness messages={[]}>- <div className="h-96">- <SidebarLayout />- </div>- </RuntimeHarness>- </ShellModeProvider>+ <ServerProvider server={mockServer(stubCatalog)}>+ <ShellModeProvider agentConfig={{ mode: 'AgentLibraryWithComposer' }}>+ <RuntimeHarness messages={[]}>+ <div className="h-96">+ <SidebarLayout />+ </div>+ </RuntimeHarness>+ </ShellModeProvider>+ </ServerProvider></SlotsProvider>,);fireEvent.click(screen.getByRole('button', { name: 'Navigation' }));const drawer = screen.getByRole('dialog', { name: 'Navigation' });- expect(drawer).toHaveClass('w-20');+ expect(drawer).toHaveClass('w-80');expect(within(drawer).getByAltText('Acme')).toHaveAttribute('src', '/acme.svg');- expect(within(drawer).queryByText('Acme')).not.toBeInTheDocument();+ expect(within(drawer).getByText('Acme')).toBeInTheDocument();+ expect(within(drawer).getByRole('button', { name: 'Close navigation' })).toBeInTheDocument();expect(within(drawer).getByRole('button', { name: 'Start new chat' })).toBeInTheDocument();- expect(within(drawer).getByRole('button', { name: 'Start new agent' })).toBeInTheDocument();- expect(within(drawer).queryByText('No threads yet')).not.toBeInTheDocument();+ expect(within(drawer).queryByRole('button', { name: 'Start new agent' })).not.toBeInTheDocument();+ expect(within(drawer).queryByRole('button', { name: 'Sessions' })).not.toBeInTheDocument();+ expect(within(drawer).queryByRole('button', { name: 'Schedules' })).not.toBeInTheDocument();+ expect(within(drawer).getByRole('button', { name: /^Agents/ })).toBeInTheDocument();+ expect(within(drawer).getByText('Chat History')).toBeInTheDocument();+ expect(within(drawer).getByRole('link', { name: 'Documentation' })).toBeInTheDocument();+ expect(within(drawer).getByRole('button', { name: /Switch to (light|dark) theme/ })).toBeInTheDocument();+ expect(await within(drawer).findByRole('button', { name: 'Settings' })).toBeInTheDocument();++ fireEvent.click(within(drawer).getByRole('button', { name: 'Close navigation' }));+ expect(screen.queryByRole('dialog', { name: 'Navigation' })).not.toBeInTheDocument();+ });++ it('closes the mobile drawer on Escape, backdrop click, and New Chat', () => {+ render(+ <SlotsProvider>+ <ServerProvider server={mockServer(stubCatalog)}>+ <ShellModeProvider>+ <RuntimeHarness messages={[]}>+ <div className="h-96">+ <SidebarLayout />+ </div>+ </RuntimeHarness>+ </ShellModeProvider>+ </ServerProvider>+ </SlotsProvider>,+ );++ const menu = screen.getByRole('button', { name: 'Navigation' });+ fireEvent.click(menu);+ expect(screen.getByRole('dialog', { name: 'Navigation' })).toBeInTheDocument();++ fireEvent.keyDown(window, { key: 'Escape' });+ expect(screen.queryByRole('dialog', { name: 'Navigation' })).not.toBeInTheDocument();+ expect(menu).toHaveFocus();++ fireEvent.click(menu);+ fireEvent.click(screen.getByRole('button', { name: 'Close navigation backdrop' }));+ expect(screen.queryByRole('dialog', { name: 'Navigation' })).not.toBeInTheDocument();++ fireEvent.click(menu);+ fireEvent.click(+ within(screen.getByRole('dialog', { name: 'Navigation' })).getByRole('button', { name: 'Start new chat' }),+ );+ expect(screen.queryByRole('dialog', { name: 'Navigation' })).not.toBeInTheDocument();+ });++ it('closes the mobile drawer on Escape without dismissing Settings underneath', async () => {+ const originalMatchMedia = window.matchMedia;+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: mobileMatchMedia });++ try {+ render(+ <SlotsProvider>+ <ServerProvider server={mockServer(stubCatalog)}>+ <ShellModeProvider agentConfig={{ mode: 'AgentLibraryWithComposer' }}>+ <RuntimeHarness messages={[]}>+ <div className="h-96">+ <SidebarLayout />+ </div>+ </RuntimeHarness>+ </ShellModeProvider>+ </ServerProvider>+ </SlotsProvider>,+ );++ fireEvent.click(await screen.findByRole('button', { name: 'Settings' }));+ expect(await screen.findByRole('heading', { name: 'Settings' })).toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Navigation' }));+ expect(screen.getByRole('dialog', { name: 'Navigation' })).toBeInTheDocument();++ fireEvent.keyDown(window, { key: 'Escape' });+ expect(screen.queryByRole('dialog', { name: 'Navigation' })).not.toBeInTheDocument();+ expect(screen.getByRole('heading', { name: 'Settings' })).toBeInTheDocument();+ } finally {+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: originalMatchMedia });+ }+ });++ it('inlines the hamburger into Settings and Agents headers on mobile', async () => {+ const originalMatchMedia = window.matchMedia;+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: mobileMatchMedia });++ try {+ render(+ <SlotsProvider>+ <ServerProvider server={mockServer(stubCatalog)}>+ <ShellModeProvider agentConfig={{ mode: 'AgentLibraryWithComposer' }}>+ <RuntimeHarness messages={[]}>+ <div className="h-96">+ <SidebarLayout />+ </div>+ </RuntimeHarness>+ </ShellModeProvider>+ </ServerProvider>+ </SlotsProvider>,+ );++ fireEvent.click(await screen.findByRole('button', { name: 'Settings' }));+ const settingsHeading = await screen.findByRole('heading', { name: 'Settings' });+ const settingsNav = screen.getByRole('button', { name: 'Navigation' });+ expect(settingsHeading.previousElementSibling).toBe(settingsNav);+ expect(screen.queryByRole('button', { name: 'Back' })).not.toBeInTheDocument();++ fireEvent.click(settingsNav);+ fireEvent.click(+ within(screen.getByRole('dialog', { name: 'Navigation' })).getByRole('button', { name: /^Agents/ }),+ );+ const agentsHeading = await screen.findByRole('heading', { name: 'Agents' });+ expect(agentsHeading.previousElementSibling).toBe(screen.getByRole('button', { name: 'Navigation' }));+ } finally {+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: originalMatchMedia });+ }});it('shows the default icon mark in the permanent rail', () => {@@ -771,6 +883,111 @@ describe('DrawerLayout a11y', () => {expect(screen.getByRole('button', { name: 'New Chat' })).toBeInTheDocument();expect(screen.getByRole('button', { name: 'New Agent' })).toBeInTheDocument();});++ it('shows Back to chat on the mobile desktop-only notice', () => {+ const originalMatchMedia = window.matchMedia;+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: mobileMatchMedia });++ const server = createMockAgentUIServer({+ schedules: {+ listSchedules: vi.fn(async () => ({ data: [] })),+ getSchedule: vi.fn(),+ createSchedule: vi.fn(),+ updateSchedule: vi.fn(),+ deleteSchedule: vi.fn(),+ listScheduleRuns: vi.fn(async () => []),+ createScheduleRun: vi.fn(),+ },+ });++ function OpenSchedules() {+ const shell = useShellMode();+ return (+ <button type="button" onClick={() => shell.setSchedulesOpen(true)}>+ Open schedules+ </button>+ );+ }++ try {+ render(+ <SlotsProvider>+ <ServerProvider server={server}>+ <ShellModeProvider agentConfig={{ mode: 'AgentLibraryWithComposer' }}>+ <RuntimeHarness messages={[]}>+ <OpenSchedules />+ <div className="h-96">+ <DrawerLayout />+ </div>+ </RuntimeHarness>+ </ShellModeProvider>+ </ServerProvider>+ </SlotsProvider>,+ );++ fireEvent.click(screen.getByRole('button', { name: 'Open schedules' }));+ expect(screen.getByRole('heading', { name: 'Best viewed on desktop' })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: /Back to chat/i })).toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: /Back to chat/i }));+ expect(screen.queryByRole('heading', { name: 'Best viewed on desktop' })).not.toBeInTheDocument();+ } finally {+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: originalMatchMedia });+ }+ });++ it('keeps the agent builder open when Back to chat dismisses Schedules on desktop', async () => {+ const server = createMockAgentUIServer({+ schedules: {+ listSchedules: vi.fn(async () => ({ data: [] })),+ getSchedule: vi.fn(),+ createSchedule: vi.fn(),+ updateSchedule: vi.fn(),+ deleteSchedule: vi.fn(),+ listScheduleRuns: vi.fn(async () => []),+ createScheduleRun: vi.fn(),+ },+ });++ function OpenSchedules() {+ const shell = useShellMode();+ return (+ <button type="button" onClick={() => shell.setSchedulesOpen(true)}>+ Open schedules+ </button>+ );+ }++ render(+ <SlotsProvider>+ <ServerProvider server={server}>+ <ShellModeProvider agentConfig={{ mode: 'AgentLibraryWithComposer' }}>+ <AgentConfigInstructionsProvider>+ <RuntimeHarness messages={[]}>+ <OpenSchedules />+ <div className="h-96">+ <DrawerLayout />+ </div>+ </RuntimeHarness>+ </AgentConfigInstructionsProvider>+ </ShellModeProvider>+ </ServerProvider>+ </SlotsProvider>,+ );++ fireEvent.click(screen.getByRole('button', { name: 'New Agent' }));+ expect(await screen.findByRole('dialog', { name: 'Agent Config' })).toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Open schedules' }));+ expect(await screen.findByRole('heading', { name: 'Agent Schedules' })).toBeInTheDocument();+ expect(screen.queryByRole('dialog', { name: 'Agent Config' })).not.toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: /Back to chat/i }));+ await waitFor(() => {+ expect(screen.queryByRole('heading', { name: 'Agent Schedules' })).not.toBeInTheDocument();+ });+ expect(screen.getByRole('dialog', { name: 'Agent Config' })).toBeInTheDocument();+ });});describe('layout slot overrides', () => {diff --git a/packages/trueforge-ui/test/routing/withRouter.integration.test.tsx b/packages/trueforge-ui/test/routing/withRouter.integration.test.tsxindex d8f1f4325..ed28d9924 100644--- a/packages/trueforge-ui/test/routing/withRouter.integration.test.tsx+++ b/packages/trueforge-ui/test/routing/withRouter.integration.test.tsx@@ -4,7 +4,11 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react';import { useState } from 'react';import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest';-import { createMockAgentSessionsServer, createMockAgentUIServer } from '../server/mockServer.js';+import {+ createMockAgentSessionsServer,+ createMockAgentUIServer,+ createMockScheduleServer,+} from '../server/mockServer.js';/** Thread list driven by the test: a local draft plus one remote session row. */const threadState = {@@ -63,6 +67,27 @@ import { TrueForgeUI } from '@/containers/TrueForgeUI.js';import { useShellMode } from '@/server/ShellModeContext.js';import { DEFAULT_SESSION_TIME_WINDOW_MS } from '@/utils/sessionShareUrl.js';+function mobileMatchMedia(query: string): MediaQueryList {+ return {+ matches: query === '(max-width: 767px)',+ media: query,+ onchange: null,+ addEventListener: vi.fn(),+ removeEventListener: vi.fn(),+ addListener: vi.fn(),+ removeListener: vi.fn(),+ dispatchEvent: vi.fn(() => true),+ };+}++function withMobileViewport(run: () => Promise<void> | void) {+ const originalMatchMedia = window.matchMedia;+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: mobileMatchMedia });+ return Promise.resolve(run()).finally(() => {+ Object.defineProperty(window, 'matchMedia', { configurable: true, value: originalMatchMedia });+ });+}+beforeAll(() => {HTMLDialogElement.prototype.showModal = function showModal() {this.setAttribute('open', '');@@ -320,4 +345,73 @@ describe('withRouter end to end', () => {expect(params.get('s_ets')).toBeNull();});});++ it('shows a desktop-only notice for restricted routes on mobile without redirecting', async () => {+ await withMobileViewport(async () => {+ for (const path of ['/sessions', '/schedules', '/build-agent', '/sessions/share/session-2'] as const) {+ window.history.replaceState(null, '', path);+ const view = render(+ <TrueForgeUI+ server={createMockAgentUIServer({+ sessions: createMockAgentSessionsServer(),+ schedules: createMockScheduleServer(),+ })}+ agentConfig={{ mode: 'AgentLibraryWithComposer' }}+ withRouter+ layout="sidebar"+ />,+ );++ expect(await screen.findByRole('heading', { name: 'Best viewed on desktop' })).toBeInTheDocument();+ expect(window.location.pathname).toBe(path);+ expect(screen.queryByRole('heading', { name: 'Agent Sessions' })).not.toBeInTheDocument();+ expect(screen.queryByRole('heading', { name: 'Agent Schedules' })).not.toBeInTheDocument();+ expect(screen.queryByRole('dialog', { name: 'Agent Config' })).not.toBeInTheDocument();+ view.unmount();+ }+ });+ });++ it('still opens /sessions/:id as a chat on mobile', async () => {+ await withMobileViewport(async () => {+ window.history.replaceState(null, '', '/sessions/session-2');+ render(+ <TrueForgeUI+ server={createMockAgentUIServer({+ getSession: async ({ sessionId }) => ({+ id: sessionId,+ title: 'Session',+ isMutable: true,+ createdAt: '2026-01-01T00:00:00Z',+ updatedAt: '2026-01-01T00:00:00Z',+ }),+ })}+ agentConfig={{ mode: 'AgentLibraryWithComposer' }}+ withRouter+ layout={() => <ShellProbe />}+ />,+ );++ await waitFor(() => {+ expect(screen.getByTestId('pending')).toHaveTextContent('session-2');+ });+ expect(window.location.pathname).toBe('/sessions/session-2');+ expect(screen.queryByRole('heading', { name: 'Best viewed on desktop' })).not.toBeInTheDocument();+ });+ });++ it('keeps desktop sessions and schedules surfaces available above the mobile breakpoint', async () => {+ window.history.replaceState(null, '', '/sessions');+ render(+ <TrueForgeUI+ server={createMockAgentUIServer({ sessions: createMockAgentSessionsServer() })}+ agentConfig={{ mode: 'AgentLibraryWithComposer' }}+ withRouter+ layout="sidebar"+ />,+ );++ expect(await screen.findByRole('heading', { name: 'Agent Sessions' })).toBeInTheDocument();+ expect(screen.queryByRole('heading', { name: 'Best viewed on desktop' })).not.toBeInTheDocument();+ });});