Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
refactor(frontend): unify the whole codebase on function declarations
Sergey Kozyrenkodea9e38107c3
diff --git a/frontend/src/app.tsx b/frontend/src/app.tsxindex 9782dce9..6de09926 100644--- a/frontend/src/app.tsx+++ b/frontend/src/app.tsx@@ -48,62 +48,74 @@ const SettingsPrompts = lazy(() => import('@/pages/settings/settings-prompts'));const SettingsProvider = lazy(() => import('@/pages/settings/settings-provider'));const SettingsProviders = lazy(() => import('@/pages/settings/settings-providers'));-// Root layout for the data router. Everything that previously sat between-// `<BrowserRouter>` and `<Routes>` (providers, Suspense) lives here so it has-// access to router hooks (`useNavigate`, `useLocation`, ...) while still being-// rendered under the data router. This is what enables `useBlocker` and other-// data-router-only features inside our pages.-const RootLayout = () => (- <UserProvider>- <FavoritesProvider>- <TemplatesProvider>- <ResourcesProvider>- <Suspense fallback={<PageLoader />}>- <Outlet />- </Suspense>- </ResourcesProvider>- </TemplatesProvider>- </FavoritesProvider>- </UserProvider>-);+function FlowWithProvider() {+ return (+ <FlowProvider>+ <Flow />+ </FlowProvider>+ );+}-const ProtectedAppLayout = () => (- <ProtectedRoute>- <SystemSettingsProvider>- <ProvidersProvider>- <SidebarFlowsProvider>- <AppLayout />- </SidebarFlowsProvider>- </ProvidersProvider>- </SystemSettingsProvider>- </ProtectedRoute>-);+function KnowledgesLayout() {+ return (+ <KnowledgesProvider>+ <Outlet />+ </KnowledgesProvider>+ );+}-const ProtectedReportLayout = () => (- <ProtectedRoute>- <SystemSettingsProvider>- <FlowReport />- </SystemSettingsProvider>- </ProtectedRoute>-);+function ProtectedAppLayout() {+ return (+ <ProtectedRoute>+ <SystemSettingsProvider>+ <ProvidersProvider>+ <SidebarFlowsProvider>+ <AppLayout />+ </SidebarFlowsProvider>+ </ProvidersProvider>+ </SystemSettingsProvider>+ </ProtectedRoute>+ );+}-const PublicLoginLayout = () => (- <PublicRoute>- <Login />- </PublicRoute>-);+function ProtectedReportLayout() {+ return (+ <ProtectedRoute>+ <SystemSettingsProvider>+ <FlowReport />+ </SystemSettingsProvider>+ </ProtectedRoute>+ );+}-const FlowWithProvider = () => (- <FlowProvider>- <Flow />- </FlowProvider>-);+function PublicLoginLayout() {+ return (+ <PublicRoute>+ <Login />+ </PublicRoute>+ );+}-const KnowledgesLayout = () => (- <KnowledgesProvider>- <Outlet />- </KnowledgesProvider>-);+// Root layout for the data router. Everything that previously sat between+// `<BrowserRouter>` and `<Routes>` (providers, Suspense) lives here so it has+// access to router hooks (`useNavigate`, `useLocation`, ...) while still being+// rendered under the data router. This is what enables `useBlocker` and other+// data-router-only features inside our pages.+function RootLayout() {+ return (+ <UserProvider>+ <FavoritesProvider>+ <TemplatesProvider>+ <ResourcesProvider>+ <Suspense fallback={<PageLoader />}>+ <Outlet />+ </Suspense>+ </ResourcesProvider>+ </TemplatesProvider>+ </FavoritesProvider>+ </UserProvider>+ );+}const router = createBrowserRouter(createRoutesFromElements(@@ -236,13 +248,15 @@ const router = createBrowserRouter(),);-const App = () => (- <ApolloProvider client={client}>- <ThemeProvider>- <Toaster />- <RouterProvider router={router} />- </ThemeProvider>- </ApolloProvider>-);+function App() {+ return (+ <ApolloProvider client={client}>+ <ThemeProvider>+ <Toaster />+ <RouterProvider router={router} />+ </ThemeProvider>+ </ApolloProvider>+ );+}export default App;diff --git a/frontend/src/components/dashboard/chart-card.tsx b/frontend/src/components/dashboard/chart-card.tsxindex c44b79db..03e38304 100644--- a/frontend/src/components/dashboard/chart-card.tsx+++ b/frontend/src/components/dashboard/chart-card.tsx@@ -5,7 +5,7 @@ import { ResponsiveContainer } from 'recharts';import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';-export const ChartCard = ({+export function ChartCard({children,className,description,@@ -21,36 +21,38 @@ export const ChartCard = ({height?: number;loading?: boolean;title: ReactNode;-}) => (- <Card className={className}>- <CardHeader>- <CardTitle>{title}</CardTitle>- {description && <CardDescription>{description}</CardDescription>}- </CardHeader>- <CardContent>- {loading ? (- <div- className="flex items-center justify-center"- style={{ height }}- >- <Loader2 className="text-muted-foreground size-6 animate-spin" />- </div>- ) : empty ? (- <div- className="flex flex-col items-center justify-center gap-2"- style={{ height }}- >- <BarChart2 className="text-muted-foreground/30 size-10" />- <p className="text-muted-foreground text-sm">No data for this period</p>- </div>- ) : (- <ResponsiveContainer- height={height}- width="100%"- >- {children}- </ResponsiveContainer>- )}- </CardContent>- </Card>-);+}) {+ return (+ <Card className={className}>+ <CardHeader>+ <CardTitle>{title}</CardTitle>+ {description && <CardDescription>{description}</CardDescription>}+ </CardHeader>+ <CardContent>+ {loading ? (+ <div+ className="flex items-center justify-center"+ style={{ height }}+ >+ <Loader2 className="text-muted-foreground size-6 animate-spin" />+ </div>+ ) : empty ? (+ <div+ className="flex flex-col items-center justify-center gap-2"+ style={{ height }}+ >+ <BarChart2 className="text-muted-foreground/30 size-10" />+ <p className="text-muted-foreground text-sm">No data for this period</p>+ </div>+ ) : (+ <ResponsiveContainer+ height={height}+ width="100%"+ >+ {children}+ </ResponsiveContainer>+ )}+ </CardContent>+ </Card>+ );+}diff --git a/frontend/src/components/dashboard/chart-tooltip.tsx b/frontend/src/components/dashboard/chart-tooltip.tsxindex b9ae3b2b..0c511ccc 100644--- a/frontend/src/components/dashboard/chart-tooltip.tsx+++ b/frontend/src/components/dashboard/chart-tooltip.tsx@@ -8,7 +8,7 @@ export type ChartTooltipPayloadEntry = {value: number;};-export const ChartTooltip = ({+export function ChartTooltip({active,formatter,label,@@ -24,7 +24,7 @@ export const ChartTooltip = ({onFirstActive?: () => void;payload?: Array<ChartTooltipPayloadEntry>;sessionKey?: number;-}) => {+}) {// Store in ref to avoid stale closures in effectsconst onFirstActiveRef = useRef(onFirstActive);useEffect(() => {@@ -72,4 +72,4 @@ export const ChartTooltip = ({))}</div>);-};+}diff --git a/frontend/src/components/dashboard/metric-card.tsx b/frontend/src/components/dashboard/metric-card.tsxindex 38269afa..a1260856 100644--- a/frontend/src/components/dashboard/metric-card.tsx+++ b/frontend/src/components/dashboard/metric-card.tsx@@ -3,7 +3,7 @@ import type { ReactNode } from 'react';import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';import { Skeleton } from '@/components/ui/skeleton';-export const MetricCard = ({+export function MetricCard({className,description,icon,@@ -17,20 +17,24 @@ export const MetricCard = ({loading?: boolean;title: ReactNode;value: ReactNode;-}) => (- <Card className={className}>- <CardHeader className="flex flex-row items-center justify-between pb-2">- <CardTitle className="text-sm font-medium">{loading ? <Skeleton className="h-5 w-24" /> : title}</CardTitle>- {loading ? <Skeleton className="size-4 shrink-0 rounded" /> : icon}- </CardHeader>- <CardContent className="flex flex-col gap-1">- {loading ? <Skeleton className="h-8 w-24" /> : <div className="text-2xl font-bold">{value}</div>}- {description &&- (loading ? (- <Skeleton className="mt-1 h-3 w-32" />- ) : (- <p className="text-muted-foreground text-xs">{description}</p>- ))}- </CardContent>- </Card>-);+}) {+ return (+ <Card className={className}>+ <CardHeader className="flex flex-row items-center justify-between pb-2">+ <CardTitle className="text-sm font-medium">+ {loading ? <Skeleton className="h-5 w-24" /> : title}+ </CardTitle>+ {loading ? <Skeleton className="size-4 shrink-0 rounded" /> : icon}+ </CardHeader>+ <CardContent className="flex flex-col gap-1">+ {loading ? <Skeleton className="h-8 w-24" /> : <div className="text-2xl font-bold">{value}</div>}+ {description &&+ (loading ? (+ <Skeleton className="mt-1 h-3 w-32" />+ ) : (+ <p className="text-muted-foreground text-xs">{description}</p>+ ))}+ </CardContent>+ </Card>+ );+}diff --git a/frontend/src/components/icons/anthropic.tsx b/frontend/src/components/icons/anthropic.tsxindex 2caea6d7..6f860a09 100644--- a/frontend/src/components/icons/anthropic.tsx+++ b/frontend/src/components/icons/anthropic.tsx@@ -4,7 +4,7 @@ interface AnthropicProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const Anthropic = ({ className, ...props }: AnthropicProps) => {+function Anthropic({ className, ...props }: AnthropicProps) {return (<svgclassName={cn(className)}@@ -17,6 +17,6 @@ const Anthropic = ({ className, ...props }: AnthropicProps) => {<path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z" /></svg>);-};+}export default Anthropic;diff --git a/frontend/src/components/icons/bedrock.tsx b/frontend/src/components/icons/bedrock.tsxindex 754231b3..26f32d96 100644--- a/frontend/src/components/icons/bedrock.tsx+++ b/frontend/src/components/icons/bedrock.tsx@@ -4,7 +4,7 @@ interface BedrockProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const Bedrock = ({ className, ...props }: BedrockProps) => {+function Bedrock({ className, ...props }: BedrockProps) {return (<svgclassName={cn(className)}@@ -21,6 +21,6 @@ const Bedrock = ({ className, ...props }: BedrockProps) => {/></svg>);-};+}export default Bedrock;diff --git a/frontend/src/components/icons/custom.tsx b/frontend/src/components/icons/custom.tsxindex 04b824bf..f26cc4ce 100644--- a/frontend/src/components/icons/custom.tsx+++ b/frontend/src/components/icons/custom.tsx@@ -4,7 +4,7 @@ interface CustomProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const Custom = ({ className, ...props }: CustomProps) => {+function Custom({ className, ...props }: CustomProps) {return (<svgclassName={cn(className)}@@ -21,6 +21,6 @@ const Custom = ({ className, ...props }: CustomProps) => {/></svg>);-};+}export default Custom;diff --git a/frontend/src/components/icons/deepseek.tsx b/frontend/src/components/icons/deepseek.tsxindex a076f03b..9ea24609 100644--- a/frontend/src/components/icons/deepseek.tsx+++ b/frontend/src/components/icons/deepseek.tsx@@ -4,7 +4,7 @@ interface DeepSeekProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const DeepSeek = ({ className, ...props }: DeepSeekProps) => {+function DeepSeek({ className, ...props }: DeepSeekProps) {return (<svgclassName={cn(className)}@@ -20,6 +20,6 @@ const DeepSeek = ({ className, ...props }: DeepSeekProps) => {</g></svg>);-};+}export default DeepSeek;diff --git a/frontend/src/components/icons/flow-status-badge.tsx b/frontend/src/components/icons/flow-status-badge.tsxindex 8e39ad88..9bb4295b 100644--- a/frontend/src/components/icons/flow-status-badge.tsx+++ b/frontend/src/components/icons/flow-status-badge.tsx@@ -10,15 +10,17 @@ const STATUS_LABELS: Record<StatusType, string> = {[StatusType.Waiting]: 'Waiting',};-export const FlowStatusBadge = ({ className, status }: { className?: string; status: StatusType }) => (- <Badge- className={className}- variant="outline"- >- <FlowStatusIcon- className="size-3"- status={status}- />- {STATUS_LABELS[status]}- </Badge>-);+export function FlowStatusBadge({ className, status }: { className?: string; status: StatusType }) {+ return (+ <Badge+ className={className}+ variant="outline"+ >+ <FlowStatusIcon+ className="size-3"+ status={status}+ />+ {STATUS_LABELS[status]}+ </Badge>+ );+}diff --git a/frontend/src/components/icons/flow-status-icon.tsx b/frontend/src/components/icons/flow-status-icon.tsxindex 5a6c0c97..09527710 100644--- a/frontend/src/components/icons/flow-status-icon.tsx+++ b/frontend/src/components/icons/flow-status-icon.tsx@@ -21,7 +21,7 @@ const statusIcons: Record<StatusType, { className: string; icon: LucideIcon }> =};const defaultIcon = { className: 'text-muted-foreground', icon: CircleOff };-export const FlowStatusIcon = ({ className = 'size-4', status, tooltip }: FlowStatusIconProps) => {+export function FlowStatusIcon({ className = 'size-4', status, tooltip }: FlowStatusIconProps) {if (!status) {return null;}@@ -39,4 +39,4 @@ export const FlowStatusIcon = ({ className = 'size-4', status, tooltip }: FlowSt<TooltipContent>{tooltip}</TooltipContent></Tooltip>);-};+}diff --git a/frontend/src/components/icons/gemini.tsx b/frontend/src/components/icons/gemini.tsxindex b6172ebb..a30d414b 100644--- a/frontend/src/components/icons/gemini.tsx+++ b/frontend/src/components/icons/gemini.tsx@@ -4,7 +4,7 @@ interface GeminiProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const Gemini = ({ className, ...props }: GeminiProps) => {+function Gemini({ className, ...props }: GeminiProps) {return (<svgclassName={cn(className)}@@ -17,6 +17,6 @@ const Gemini = ({ className, ...props }: GeminiProps) => {<path d="M16 8.016A8.522 8.522 0 008.016 16h-.032A8.521 8.521 0 000 8.016v-.032A8.521 8.521 0 007.984 0h.032A8.522 8.522 0 0016 7.984v.032z" /></svg>);-};+}export default Gemini;diff --git a/frontend/src/components/icons/github.tsx b/frontend/src/components/icons/github.tsxindex 27991cdd..55a2edb3 100644--- a/frontend/src/components/icons/github.tsx+++ b/frontend/src/components/icons/github.tsx@@ -4,7 +4,7 @@ interface GithubProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const Github = ({ className, ...props }: GithubProps) => {+function Github({ className, ...props }: GithubProps) {return (<svgclassName={cn(className)}@@ -16,6 +16,6 @@ const Github = ({ className, ...props }: GithubProps) => {<path d="M256 32C132.3 32 32 134.9 32 261.7c0 101.5 64.2 187.5 153.2 217.9a17.56 17.56 0 003.8.4c8.3 0 11.5-6.1 11.5-11.4 0-5.5-.2-19.9-.3-39.1a102.4 102.4 0 01-22.6 2.7c-43.1 0-52.9-33.5-52.9-33.5-10.2-26.5-24.9-33.6-24.9-33.6-19.5-13.7-.1-14.1 1.4-14.1h.1c22.5 2 34.3 23.8 34.3 23.8 11.2 19.6 26.2 25.1 39.6 25.1a63 63 0 0025.6-6c2-14.8 7.8-24.9 14.2-30.7-49.7-5.8-102-25.5-102-113.5 0-25.1 8.7-45.6 23-61.6-2.3-5.8-10-29.2 2.2-60.8a18.64 18.64 0 015-.5c8.1 0 26.4 3.1 56.6 24.1a208.21 208.21 0 01112.2 0c30.2-21 48.5-24.1 56.6-24.1a18.64 18.64 0 015 .5c12.2 31.6 4.5 55 2.2 60.8 14.3 16.1 23 36.6 23 61.6 0 88.2-52.4 107.6-102.3 113.3 8 7.1 15.2 21.1 15.2 42.5 0 30.7-.3 55.5-.3 63 0 5.4 3.1 11.5 11.4 11.5a19.35 19.35 0 004-.4C415.9 449.2 480 363.1 480 261.7 480 134.9 379.7 32 256 32z" /></svg>);-};+}export default Github;diff --git a/frontend/src/components/icons/glm.tsx b/frontend/src/components/icons/glm.tsxindex f0001b8b..f6105237 100644--- a/frontend/src/components/icons/glm.tsx+++ b/frontend/src/components/icons/glm.tsx@@ -4,7 +4,7 @@ interface GLMProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const GLM = ({ className, ...props }: GLMProps) => {+function GLM({ className, ...props }: GLMProps) {return (<svgclassName={cn(className)}@@ -17,6 +17,6 @@ const GLM = ({ className, ...props }: GLMProps) => {<path d="M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z" /></svg>);-};+}export default GLM;diff --git a/frontend/src/components/icons/google.tsx b/frontend/src/components/icons/google.tsxindex fda2356e..8b59c8db 100644--- a/frontend/src/components/icons/google.tsx+++ b/frontend/src/components/icons/google.tsx@@ -4,7 +4,7 @@ interface GoogleProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const Google = ({ className, ...props }: GoogleProps) => {+function Google({ className, ...props }: GoogleProps) {return (<svgclassName={cn(className)}@@ -16,6 +16,6 @@ const Google = ({ className, ...props }: GoogleProps) => {<path d="M473.16 221.48l-2.26-9.59H262.46v88.22H387c-12.93 61.4-72.93 93.72-121.94 93.72-35.66 0-73.25-15-98.13-39.11a140.08 140.08 0 01-41.8-98.88c0-37.16 16.7-74.33 41-98.78s61-38.13 97.49-38.13c41.79 0 71.74 22.19 82.94 32.31l62.69-62.36C390.86 72.72 340.34 32 261.6 32c-60.75 0-119 23.27-161.58 65.71C58 139.5 36.25 199.93 36.25 256s20.58 113.48 61.3 155.6c43.51 44.92 105.13 68.4 168.58 68.4 57.73 0 112.45-22.62 151.45-63.66 38.34-40.4 58.17-96.3 58.17-154.9 0-24.67-2.48-39.32-2.59-39.96z" /></svg>);-};+}export default Google;diff --git a/frontend/src/components/icons/kimi.tsx b/frontend/src/components/icons/kimi.tsxindex 72b8882e..d1810b07 100644--- a/frontend/src/components/icons/kimi.tsx+++ b/frontend/src/components/icons/kimi.tsx@@ -4,7 +4,7 @@ interface KimiProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const Kimi = ({ className, ...props }: KimiProps) => {+function Kimi({ className, ...props }: KimiProps) {return (<svgclassName={cn(className)}@@ -19,6 +19,6 @@ const Kimi = ({ className, ...props }: KimiProps) => {</g></svg>);-};+}export default Kimi;diff --git a/frontend/src/components/icons/logo.tsx b/frontend/src/components/icons/logo.tsxindex a4affe7b..ef7e25cf 100644--- a/frontend/src/components/icons/logo.tsx+++ b/frontend/src/components/icons/logo.tsx@@ -4,7 +4,7 @@ interface LogoProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const Logo = ({ className, ...props }: LogoProps) => {+function Logo({ className, ...props }: LogoProps) {return (<svgclassName={cn(className)}@@ -62,6 +62,6 @@ const Logo = ({ className, ...props }: LogoProps) => {<path d="M62.6376 74.5946C63.4358 71.9794 64.8135 69.6169 66.621 67.6569L41.7766 53.3129C41.3861 54.5729 40.8502 55.8094 40.1628 57C39.4754 58.1906 38.6726 59.273 37.7766 60.2411L62.6376 74.5946Z" /></svg>);-};+}export default Logo;diff --git a/frontend/src/components/icons/ollama.tsx b/frontend/src/components/icons/ollama.tsxindex a27bcb34..ed9c73d9 100644--- a/frontend/src/components/icons/ollama.tsx+++ b/frontend/src/components/icons/ollama.tsx@@ -4,7 +4,7 @@ interface OllamaProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const Ollama = ({ className, ...props }: OllamaProps) => {+function Ollama({ className, ...props }: OllamaProps) {return (<svgclassName={cn(className)}@@ -17,6 +17,6 @@ const Ollama = ({ className, ...props }: OllamaProps) => {<path d="M7.905 1.09c.216.085.411.225.588.41.295.306.544.744.734 1.263.191.522.315 1.1.362 1.68a5.054 5.054 0 012.049-.636l.051-.004c.87-.07 1.73.087 2.48.474.101.053.2.11.297.17.05-.569.172-1.134.36-1.644.19-.52.439-.957.733-1.264a1.67 1.67 0 01.589-.41c.257-.1.53-.118.796-.042.401.114.745.368 1.016.737.248.337.434.769.561 1.287.23.934.27 2.163.115 3.645l.053.04.026.019c.757.576 1.284 1.397 1.563 2.35.435 1.487.216 3.155-.534 4.088l-.018.021.002.003c.417.762.67 1.567.724 2.4l.002.03c.064 1.065-.2 2.137-.814 3.19l-.007.01.01.024c.472 1.157.62 2.322.438 3.486l-.006.039a.651.651 0 01-.747.536.648.648 0 01-.54-.742c.167-1.033.01-2.069-.48-3.123a.643.643 0 01.04-.617l.004-.006c.604-.924.854-1.83.8-2.72-.046-.779-.325-1.544-.8-2.273a.644.644 0 01.18-.886l.009-.006c.243-.159.467-.565.58-1.12a4.229 4.229 0 00-.095-1.974c-.205-.7-.58-1.284-1.105-1.683-.595-.454-1.383-.673-2.38-.61a.653.653 0 01-.632-.371c-.314-.665-.772-1.141-1.343-1.436a3.288 3.288 0 00-1.772-.332c-1.245.099-2.343.801-2.67 1.686a.652.652 0 01-.61.425c-1.067.002-1.893.252-2.497.703-.522.39-.878.935-1.066 1.588a4.07 4.07 0 00-.068 1.886c.112.558.331 1.02.582 1.269l.008.007c.212.207.257.53.109.785-.36.622-.629 1.549-.673 2.44-.05 1.018.186 1.902.719 2.536l.016.019a.643.643 0 01.095.69c-.576 1.236-.753 2.252-.562 3.052a.652.652 0 01-1.269.298c-.243-1.018-.078-2.184.473-3.498l.014-.035-.008-.012a4.339 4.339 0 01-.598-1.309l-.005-.019a5.764 5.764 0 01-.177-1.785c.044-.91.278-1.842.622-2.59l.012-.026-.002-.002c-.293-.418-.51-.953-.63-1.545l-.005-.024a5.352 5.352 0 01.093-2.49c.262-.915.777-1.701 1.536-2.269.06-.045.123-.09.186-.132-.159-1.493-.119-2.73.112-3.67.127-.518.314-.95.562-1.287.27-.368.614-.622 1.015-.737.266-.076.54-.059.797.042zm4.116 9.09c.936 0 1.8.313 2.446.855.63.527 1.005 1.235 1.005 1.94 0 .888-.406 1.58-1.133 2.022-.62.375-1.451.557-2.403.557-1.009 0-1.871-.259-2.493-.734-.617-.47-.963-1.13-.963-1.845 0-.707.398-1.417 1.056-1.946.668-.537 1.55-.849 2.485-.849zm0 .896a3.07 3.07 0 00-1.916.65c-.461.37-.722.835-.722 1.25 0 .428.21.829.61 1.134.455.347 1.124.548 1.943.548.799 0 1.473-.147 1.932-.426.463-.28.7-.686.7-1.257 0-.423-.246-.89-.683-1.256-.484-.405-1.14-.643-1.864-.643zm.662 1.21l.004.004c.12.151.095.37-.056.49l-.292.23v.446a.375.375 0 01-.376.373.375.375 0 01-.376-.373v-.46l-.271-.218a.347.347 0 01-.052-.49.353.353 0 01.494-.051l.215.172.22-.174a.353.353 0 01.49.051zm-5.04-1.919c.478 0 .867.39.867.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zm8.706 0c.48 0 .868.39.868.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zM7.44 2.3l-.003.002a.659.659 0 00-.285.238l-.005.006c-.138.189-.258.467-.348.832-.17.692-.216 1.631-.124 2.782.43-.128.899-.208 1.404-.237l.01-.001.019-.034c.046-.082.095-.161.148-.239.123-.771.022-1.692-.253-2.444-.134-.364-.297-.65-.453-.813a.628.628 0 00-.107-.09L7.44 2.3zm9.174.04l-.002.001a.628.628 0 00-.107.09c-.156.163-.32.45-.453.814-.29.794-.387 1.776-.23 2.572l.058.097.008.014h.03a5.184 5.184 0 011.466.212c.086-1.124.038-2.043-.128-2.722-.09-.365-.21-.643-.349-.832l-.004-.006a.659.659 0 00-.285-.239h-.004z" /></svg>);-};+}export default Ollama;diff --git a/frontend/src/components/icons/open-ai.tsx b/frontend/src/components/icons/open-ai.tsxindex 0b4d5a31..0f2b0c7c 100644--- a/frontend/src/components/icons/open-ai.tsx+++ b/frontend/src/components/icons/open-ai.tsx@@ -4,7 +4,7 @@ interface OpenAiProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const OpenAi = ({ className, ...props }: OpenAiProps) => {+function OpenAi({ className, ...props }: OpenAiProps) {return (<svgclassName={cn(className)}@@ -17,6 +17,6 @@ const OpenAi = ({ className, ...props }: OpenAiProps) => {<path d="M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z" /></svg>);-};+}export default OpenAi;diff --git a/frontend/src/components/icons/provider-icon.tsx b/frontend/src/components/icons/provider-icon.tsxindex 311e7aa2..4648a095 100644--- a/frontend/src/components/icons/provider-icon.tsx+++ b/frontend/src/components/icons/provider-icon.tsx@@ -42,7 +42,7 @@ const providerIcons: Record<ProviderType, ProviderIconConfig> = {};const defaultProviderIcon: ProviderIconConfig = { className: 'text-blue-500', icon: Custom };-export const ProviderIcon = ({ className = 'size-4', provider, tooltip }: ProviderIconProps) => {+export function ProviderIcon({ className = 'size-4', provider, tooltip }: ProviderIconProps) {if (!provider?.type) {return null;}@@ -60,4 +60,4 @@ export const ProviderIcon = ({ className = 'size-4', provider, tooltip }: Provid<TooltipContent>{tooltip}</TooltipContent></Tooltip>);-};+}diff --git a/frontend/src/components/icons/qwen.tsx b/frontend/src/components/icons/qwen.tsxindex 7e46b873..f486f55a 100644--- a/frontend/src/components/icons/qwen.tsx+++ b/frontend/src/components/icons/qwen.tsx@@ -4,7 +4,7 @@ interface QwenProps extends React.SVGProps<SVGSVGElement> {className?: string;}-const Qwen = ({ className, ...props }: QwenProps) => {+function Qwen({ className, ...props }: QwenProps) {return (<svgclassName={cn(className)}@@ -17,6 +17,6 @@ const Qwen = ({ className, ...props }: QwenProps) => {<path d="M12.604 1.34c.393.69.784 1.382 1.174 2.075a.18.18 0 00.157.091h5.552c.174 0 .322.11.446.327l1.454 2.57c.19.337.24.478.024.837-.26.43-.513.864-.76 1.3l-.367.658c-.106.196-.223.28-.04.512l2.652 4.637c.172.301.111.494-.043.77-.437.785-.882 1.564-1.335 2.34-.159.272-.352.375-.68.37-.777-.016-1.552-.01-2.327.016a.099.099 0 00-.081.05 575.097 575.097 0 01-2.705 4.74c-.169.293-.38.363-.725.364-.997.003-2.002.004-3.017.002a.537.537 0 01-.465-.271l-1.335-2.323a.09.09 0 00-.083-.049H4.982c-.285.03-.553-.001-.805-.092l-1.603-2.77a.543.543 0 01-.002-.54l1.207-2.12a.198.198 0 000-.197 550.951 550.951 0 01-1.875-3.272l-.79-1.395c-.16-.31-.173-.496.095-.965.465-.813.927-1.625 1.387-2.436.132-.234.304-.334.584-.335a338.3 338.3 0 012.589-.001.124.124 0 00.107-.063l2.806-4.895a.488.488 0 01.422-.246c.524-.001 1.053 0 1.583-.006L11.704 1c.341-.003.724.032.9.34zm-3.432.403a.06.06 0 00-.052.03L6.254 6.788a.157.157 0 01-.135.078H3.253c-.056 0-.07.025-.041.074l5.81 10.156c.025.042.013.062-.034.063l-2.795.015a.218.218 0 00-.2.116l-1.32 2.31c-.044.078-.021.118.068.118l5.716.008c.046 0 .08.02.104.061l1.403 2.454c.046.081.092.082.139 0l5.006-8.76.783-1.382a.055.055 0 01.096 0l1.424 2.53a.122.122 0 00.107.062l2.763-.02a.04.04 0 00.035-.02.041.041 0 000-.04l-2.9-5.086a.108.108 0 010-.113l.293-.507 1.12-1.977c.024-.041.012-.062-.035-.062H9.2c-.059 0-.073-.026-.043-.077l1.434-2.505a.107.107 0 000-.114L9.225 1.774a.06.06 0 00-.053-.031zm6.29 8.02c.046 0 .058.02.034.06l-.832 1.465-2.613 4.585a.056.056 0 01-.05.029.058.058 0 01-.05-.029L8.498 9.841c-.02-.034-.01-.052.028-.054l.216-.012 6.722-.012z" /></svg>);-};+}export default Qwen;diff --git a/frontend/src/components/layouts/app-layout.tsx b/frontend/src/components/layouts/app-layout.tsxindex 503f21ac..d50f33f2 100644--- a/frontend/src/components/layouts/app-layout.tsx+++ b/frontend/src/components/layouts/app-layout.tsx@@ -1,7 +1,7 @@import { Outlet } from 'react-router-dom';-const AppLayout = () => {+function AppLayout() {return <Outlet />;-};+}export default AppLayout;diff --git a/frontend/src/components/layouts/flows-layout.tsx b/frontend/src/components/layouts/flows-layout.tsxindex 8addfd4b..0fcbe437 100644--- a/frontend/src/components/layouts/flows-layout.tsx+++ b/frontend/src/components/layouts/flows-layout.tsx@@ -2,12 +2,12 @@ import { Outlet } from 'react-router-dom';import { FlowsProvider } from '@/providers/flows-provider';-const FlowsLayout = () => {+function FlowsLayout() {return (<FlowsProvider><Outlet /></FlowsProvider>);-};+}export default FlowsLayout;diff --git a/frontend/src/components/layouts/main-layout.tsx b/frontend/src/components/layouts/main-layout.tsxindex e624d36a..2f3dc72e 100644--- a/frontend/src/components/layouts/main-layout.tsx+++ b/frontend/src/components/layouts/main-layout.tsx@@ -3,7 +3,7 @@ import { Outlet } from 'react-router-dom';import { MainSidebar } from '@/components/layouts/main-sidebar';import { SidebarInset, SidebarProvider } from '@/components/ui/sidebar';-const MainLayout = () => {+function MainLayout() {return (<SidebarProvider><MainSidebar />@@ -12,6 +12,6 @@ const MainLayout = () => {</SidebarInset></SidebarProvider>);-};+}export default MainLayout;diff --git a/frontend/src/components/layouts/main-sidebar.tsx b/frontend/src/components/layouts/main-sidebar.tsxindex d2dfab79..579ffb45 100644--- a/frontend/src/components/layouts/main-sidebar.tsx+++ b/frontend/src/components/layouts/main-sidebar.tsx@@ -63,35 +63,7 @@ interface FlowMenuItemProps {onToggleFavorite: (flowId: string) => void;}-const FlowMenuItem = ({ activeFlowId, flow, isFavorite, onToggleFavorite }: FlowMenuItemProps) => {- return (- <SidebarMenuItem>- <SidebarMenuButton- asChild- isActive={activeFlowId === Number(flow.id)}- >- <Link to={`/flows/${flow.id}`}>- <span className="-mx-2 w-8 shrink-0 text-center text-xs group-data-[state=expanded]:hidden">- {flow.id}- </span>- <span className="text-muted-foreground bg-background dark:bg-muted -my-0.5 -ml-0.5 h-5 min-w-5 shrink-0 rounded-md px-px py-0.5 text-center text-xs group-data-[state=collapsed]:hidden">- {flow.id}- </span>- <span className="truncate">{flow.title}</span>- </Link>- </SidebarMenuButton>- <SidebarMenuAction- className="data-[state=open]:bg-accent rounded-sm"- onClick={() => onToggleFavorite(flow.id)}- showOnHover- >- <Star className={isFavorite ? 'fill-yellow-500 stroke-yellow-500' : ''} />- </SidebarMenuAction>- </SidebarMenuItem>- );-};--export const MainSidebar = () => {+export function MainSidebar() {const [isPasswordModalOpen, setIsPasswordModalOpen] = useState(false);const isDashboardActive = useMatch('/dashboard');const isFlowsActive = useMatch('/flows/*');@@ -426,4 +398,32 @@ export const MainSidebar = () => {</Dialog></Sidebar>);-};+}++function FlowMenuItem({ activeFlowId, flow, isFavorite, onToggleFavorite }: FlowMenuItemProps) {+ return (+ <SidebarMenuItem>+ <SidebarMenuButton+ asChild+ isActive={activeFlowId === Number(flow.id)}+ >+ <Link to={`/flows/${flow.id}`}>+ <span className="-mx-2 w-8 shrink-0 text-center text-xs group-data-[state=expanded]:hidden">+ {flow.id}+ </span>+ <span className="text-muted-foreground bg-background dark:bg-muted -my-0.5 -ml-0.5 h-5 min-w-5 shrink-0 rounded-md px-px py-0.5 text-center text-xs group-data-[state=collapsed]:hidden">+ {flow.id}+ </span>+ <span className="truncate">{flow.title}</span>+ </Link>+ </SidebarMenuButton>+ <SidebarMenuAction+ className="data-[state=open]:bg-accent rounded-sm"+ onClick={() => onToggleFavorite(flow.id)}+ showOnHover+ >+ <Star className={isFavorite ? 'fill-yellow-500 stroke-yellow-500' : ''} />+ </SidebarMenuAction>+ </SidebarMenuItem>+ );+}diff --git a/frontend/src/components/layouts/settings-layout.tsx b/frontend/src/components/layouts/settings-layout.tsxindex 99ea0a26..f4742216 100644--- a/frontend/src/components/layouts/settings-layout.tsx+++ b/frontend/src/components/layouts/settings-layout.tsx@@ -53,29 +53,8 @@ const menuItems: readonly MenuItem[] = [},] as const;-// Individual menu item component to properly use hooks-const SettingsSidebarMenuItem = ({ item }: SettingsSidebarMenuItemProps) => {- const location = useLocation();- // Check if current path starts with item path (for nested routes)- const isActive = location.pathname.startsWith(item.path);-- return (- <SidebarMenuItem>- <SidebarMenuButton- asChild- isActive={isActive}- >- <NavLink to={item.path}>- {item.icon}- {item.title}- </NavLink>- </SidebarMenuButton>- </SidebarMenuItem>- );-};-// Settings header component-const SettingsHeader = () => {+function SettingsHeader() {const location = useLocation();const params = useParams();@@ -120,10 +99,28 @@ const SettingsHeader = () => {<h1 className="text-lg font-semibold">{title}</h1></header>);-};+}++// Settings layout component+function SettingsLayout() {+ return (+ <SidebarProvider>+ <div className="flex h-screen w-full overflow-hidden">+ <SettingsSidebar />+ <SidebarInset className="flex flex-1 flex-col">+ <SettingsHeader />+ {/* Content area for nested routes */}+ <main className="min-h-0 flex-1 overflow-auto p-4">+ <Outlet />+ </main>+ </SidebarInset>+ </div>+ </SidebarProvider>+ );+}// Settings sidebar component-const SettingsSidebar = () => {+function SettingsSidebar() {return (<Sidebar collapsible="icon"><SidebarHeader>@@ -162,24 +159,27 @@ const SettingsSidebar = () => {</SidebarFooter></Sidebar>);-};+}++// Individual menu item component to properly use hooks+function SettingsSidebarMenuItem({ item }: SettingsSidebarMenuItemProps) {+ const location = useLocation();+ // Check if current path starts with item path (for nested routes)+ const isActive = location.pathname.startsWith(item.path);-// Settings layout component-const SettingsLayout = () => {return (- <SidebarProvider>- <div className="flex h-screen w-full overflow-hidden">- <SettingsSidebar />- <SidebarInset className="flex flex-1 flex-col">- <SettingsHeader />- {/* Content area for nested routes */}- <main className="min-h-0 flex-1 overflow-auto p-4">- <Outlet />- </main>- </SidebarInset>- </div>- </SidebarProvider>+ <SidebarMenuItem>+ <SidebarMenuButton+ asChild+ isActive={isActive}+ >+ <NavLink to={item.path}>+ {item.icon}+ {item.title}+ </NavLink>+ </SidebarMenuButton>+ </SidebarMenuItem>);-};+}export default SettingsLayout;diff --git a/frontend/src/components/routes/protected-route.tsx b/frontend/src/components/routes/protected-route.tsxindex d147da0c..5d64ee94 100644--- a/frontend/src/components/routes/protected-route.tsx+++ b/frontend/src/components/routes/protected-route.tsx@@ -4,7 +4,7 @@ import { Navigate, useLocation } from 'react-router-dom';import { getReturnUrlParam } from '@/lib/utils/auth';import { useUser } from '@/providers/user-provider';-const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {+function ProtectedRoute({ children }: { children: React.ReactNode }) {const location = useLocation();const { isAuthenticated, isLoading } = useUser();@@ -25,6 +25,6 @@ const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {}return children;-};+}export default ProtectedRoute;diff --git a/frontend/src/components/routes/public-route.tsx b/frontend/src/components/routes/public-route.tsxindex b5b3c132..e9fa02bf 100644--- a/frontend/src/components/routes/public-route.tsx+++ b/frontend/src/components/routes/public-route.tsx@@ -4,7 +4,7 @@ import { Navigate, useSearchParams } from 'react-router-dom';import { getSafeReturnUrl } from '@/lib/utils/auth';import { useUser } from '@/providers/user-provider';-const PublicRoute = ({ children }: { children: React.ReactNode }) => {+function PublicRoute({ children }: { children: React.ReactNode }) {const [searchParams] = useSearchParams();const { authInfo, isAuthenticated, isLoading } = useUser();@@ -41,6 +41,6 @@ const PublicRoute = ({ children }: { children: React.ReactNode }) => {}return children;-};+}export default PublicRoute;diff --git a/frontend/src/components/shared/confirmation-dialog.tsx b/frontend/src/components/shared/confirmation-dialog.tsxindex f86c9d20..da12862a 100644--- a/frontend/src/components/shared/confirmation-dialog.tsx+++ b/frontend/src/components/shared/confirmation-dialog.tsx@@ -33,7 +33,7 @@ interface ConfirmationDialogProps {title?: string;}-const ConfirmationDialog = ({+function ConfirmationDialog({cancelIcon,cancelText = 'Cancel',cancelVariant = 'outline',@@ -47,7 +47,7 @@ const ConfirmationDialog = ({itemName = 'this',itemType = 'item',title = 'Confirm Action',-}: ConfirmationDialogProps) => {+}: ConfirmationDialogProps) {const [isProcessing, setIsProcessing] = useState(false);const defaultDescription = description || (@@ -129,6 +129,6 @@ const ConfirmationDialog = ({</DialogContent></Dialog>);-};+}export default ConfirmationDialog;diff --git a/frontend/src/components/shared/detail-navigation/detail-navigation-buttons.tsx b/frontend/src/components/shared/detail-navigation/detail-navigation-buttons.tsxindex 1fa6abb2..40bcfc70 100644--- a/frontend/src/components/shared/detail-navigation/detail-navigation-buttons.tsx+++ b/frontend/src/components/shared/detail-navigation/detail-navigation-buttons.tsx@@ -27,11 +27,11 @@ interface DetailNavigationButtonsProps<T extends { id: string }> {* dropdown row (`size="sm"`) — same a11y contract, same tooltips, same* keyboard semantics in both places.*/-export const DetailNavigationButtons = <T extends { id: string }>({+export function DetailNavigationButtons<T extends { id: string }>({controller,sheetTitle,size = 'default',-}: DetailNavigationButtonsProps<T>) => {+}: DetailNavigationButtonsProps<T>) {const lowerTitle = sheetTitle.toLowerCase();const isSm = size === 'sm';const sideButtonSize = isSm ? 'size-7' : 'size-8';@@ -88,4 +88,4 @@ export const DetailNavigationButtons = <T extends { id: string }>({</Tooltip></div>);-};+}diff --git a/frontend/src/components/shared/detail-navigation/detail-navigation-sheet.tsx b/frontend/src/components/shared/detail-navigation/detail-navigation-sheet.tsxindex 49c176cc..fb6de70d 100644--- a/frontend/src/components/shared/detail-navigation/detail-navigation-sheet.tsx+++ b/frontend/src/components/shared/detail-navigation/detail-navigation-sheet.tsx@@ -25,12 +25,12 @@ interface DetailNavigationSheetProps<T extends { id: string }> {* Initial focus on open targets the current entry (if it's part of the* filtered subset) so users land oriented inside their own context.*/-export const DetailNavigationSheet = <T extends { id: string }>({+export function DetailNavigationSheet<T extends { id: string }>({controller,renderItem,sheetIcon,sheetTitle,-}: DetailNavigationSheetProps<T>) => {+}: DetailNavigationSheetProps<T>) {// Destructure at the top so existing `useMemo` / `useEffect` deps below// read individual fields rather than the controller object — keeps the// identity story the same as before the refactor.@@ -307,4 +307,4 @@ export const DetailNavigationSheet = <T extends { id: string }>({</SheetContent></Sheet>);-};+}diff --git a/frontend/src/components/shared/detail-navigation/detail-navigation-toolbar.tsx b/frontend/src/components/shared/detail-navigation/detail-navigation-toolbar.tsxindex 77d516dd..8514e39d 100644--- a/frontend/src/components/shared/detail-navigation/detail-navigation-toolbar.tsx+++ b/frontend/src/components/shared/detail-navigation/detail-navigation-toolbar.tsx@@ -22,12 +22,12 @@ export interface DetailNavigationToolbarProps<T extends { id: string }> {* Renders `null` when the controller reports `itemsEmpty` — saves the user* from a momentary "–/0" flash while the parent provider's data is in flight.*/-export const DetailNavigationToolbar = <T extends { id: string }>({+export function DetailNavigationToolbar<T extends { id: string }>({controller,renderItem,sheetIcon,sheetTitle,-}: DetailNavigationToolbarProps<T>) => {+}: DetailNavigationToolbarProps<T>) {if (controller.itemsEmpty) {return null;}@@ -46,4 +46,4 @@ export const DetailNavigationToolbar = <T extends { id: string }>({/></>);-};+}diff --git a/frontend/src/components/shared/detail-navigation/use-detail-navigation.ts b/frontend/src/components/shared/detail-navigation/use-detail-navigation.tsindex fd50f2fd..b05becd6 100644--- a/frontend/src/components/shared/detail-navigation/use-detail-navigation.ts+++ b/frontend/src/components/shared/detail-navigation/use-detail-navigation.ts@@ -150,7 +150,7 @@ const defaultGetId = (item: { id: string }): string => item.id;* version at fire time — but it forfeits `useNavigation`'s internal* memoization on `getSearchableText`.*/-export const useDetailNavigation = <T extends { id: string }>({+export function useDetailNavigation<T extends { id: string }>({currentId,defaultOpen,getHref,@@ -162,7 +162,7 @@ export const useDetailNavigation = <T extends { id: string }>({open,parentPath,sortFn,-}: UseDetailNavigationOptions<T>): DetailNavigationController<T> => {+}: UseDetailNavigationOptions<T>): DetailNavigationController<T> {const navigate = useNavigate();const [searchParams] = useSearchParams();@@ -320,4 +320,4 @@ export const useDetailNavigation = <T extends { id: string }>({total,],);-};+}diff --git a/frontend/src/components/shared/detail-navigation/use-navigation.ts b/frontend/src/components/shared/detail-navigation/use-navigation.tsindex 3c46bcbc..fe455012 100644--- a/frontend/src/components/shared/detail-navigation/use-navigation.ts+++ b/frontend/src/components/shared/detail-navigation/use-navigation.ts@@ -130,16 +130,16 @@ type UseNavigationResult<T> = NavigationResult<T>;* keystroke, and `getSearchableText` is naturally module-scoped at the* feature level (see `use-flow-detail-navigation` etc.).*/-export const useNavigation = <T>({+export function useNavigation<T>({currentId,getId,getSearchableText,items,query,sortFn,-}: UseNavigationOptions<T>): UseNavigationResult<T> => {+}: UseNavigationOptions<T>): UseNavigationResult<T> {return useMemo(() => computeNavigation({ currentId, getId, getSearchableText, items, query, sortFn }),[currentId, getId, getSearchableText, items, query, sortFn],);-};+}diff --git a/frontend/src/components/shared/file-manager/file-manager-bulk-actions-bar.tsx b/frontend/src/components/shared/file-manager/file-manager-bulk-actions-bar.tsxindex f9b202fc..212e17e7 100644--- a/frontend/src/components/shared/file-manager/file-manager-bulk-actions-bar.tsx+++ b/frontend/src/components/shared/file-manager/file-manager-bulk-actions-bar.tsx@@ -16,6 +16,12 @@ import type { FileManagerBulkAction, FileManagerLabels, FileNode } from './file-import { dedupeOverlappingPaths, formatFileSize, pluralizeItemsEnglish } from './file-manager-utils';+interface BulkActionButtonProps {+ action: FileManagerBulkAction;+ isDisabled: boolean;+ onClick: (action: FileManagerBulkAction) => void;+}+interface FileManagerBulkActionsBarProps {actions: readonly FileManagerBulkAction[];files: FileNode[];@@ -44,14 +50,14 @@ interface ResolvedAction {* a directory never ships together with one of its descendants — the* caller deletes / moves / etc. only the parent.*/-export const FileManagerBulkActionsBar = ({+export function FileManagerBulkActionsBar({actions,files,labels,onClearSelection,selectedPaths,selectionTotalBytes,-}: FileManagerBulkActionsBarProps) => {+}: FileManagerBulkActionsBarProps) {const [pendingAction, setPendingAction] = useState<FileManagerBulkAction | null>(null);// Resolve the deduped FileNode[] once per render — every action callback,@@ -207,12 +213,6 @@ export const FileManagerBulkActionsBar = ({)}</>);-};--interface BulkActionButtonProps {- action: FileManagerBulkAction;- isDisabled: boolean;- onClick: (action: FileManagerBulkAction) => void;}/**@@ -220,7 +220,7 @@ interface BulkActionButtonProps {* variant (no `label` text on narrow screens) can be added later without bloating* the parent's JSX.*/-const BulkActionButton = ({ action, isDisabled, onClick }: BulkActionButtonProps) => {+function BulkActionButton({ action, isDisabled, onClick }: BulkActionButtonProps) {const Icon = action.icon as ComponentType<{ className?: string }> | undefined;const button = (<Button@@ -248,4 +248,4 @@ const BulkActionButton = ({ action, isDisabled, onClick }: BulkActionButtonProps<TooltipContent>{action.label}</TooltipContent></Tooltip>);-};+}diff --git a/frontend/src/components/shared/file-manager/file-manager-highlighted-name.tsx b/frontend/src/components/shared/file-manager/file-manager-highlighted-name.tsxindex bbc375d3..8f83acf2 100644--- a/frontend/src/components/shared/file-manager/file-manager-highlighted-name.tsx+++ b/frontend/src/components/shared/file-manager/file-manager-highlighted-name.tsx@@ -8,7 +8,7 @@ interface FileManagerHighlightedNameProps {query?: string;}-export const FileManagerHighlightedName = ({ className, name, query }: FileManagerHighlightedNameProps) => {+export function FileManagerHighlightedName({ className, name, query }: FileManagerHighlightedNameProps) {if (!query?.trim()) {return <span className={cn('truncate', className)}>{name}</span>;}@@ -43,4 +43,4 @@ export const FileManagerHighlightedName = ({ className, name, query }: FileManag}return <span className={cn('truncate', className)}>{segments}</span>;-};+}diff --git a/frontend/src/components/shared/file-manager/file-manager-row.tsx b/frontend/src/components/shared/file-manager/file-manager-row.tsxindex 75c45995..64f6041f 100644--- a/frontend/src/components/shared/file-manager/file-manager-row.tsx+++ b/frontend/src/components/shared/file-manager/file-manager-row.tsx@@ -157,7 +157,7 @@ const buildVisibleActions = (): FileManagerAction[] =>actions.filter((action) => (file.isDir ? action.appliesToDirs === true : action.appliesToFiles !== false));-const FileManagerRowImpl = ({+function FileManagerRowImpl({actions,activeRowPath,dirCheckboxState,@@ -170,7 +170,7 @@ const FileManagerRowImpl = ({isSelected,posInSet,setSize,-}: FileManagerRowProps) => {+}: FileManagerRowProps) {const {formatModified = defaultFormatModified,gridTemplate,@@ -529,7 +529,7 @@ const FileManagerRowImpl = ({<ContextMenuContent>{contextItems}</ContextMenuContent></ContextMenu>);-};+}FileManagerRowImpl.displayName = 'FileManagerRow';diff --git a/frontend/src/components/shared/file-manager/file-manager-skeleton.tsx b/frontend/src/components/shared/file-manager/file-manager-skeleton.tsxindex 584e1785..013286e2 100644--- a/frontend/src/components/shared/file-manager/file-manager-skeleton.tsx+++ b/frontend/src/components/shared/file-manager/file-manager-skeleton.tsx@@ -30,11 +30,11 @@ interface FileManagerSkeletonProps {isCheckboxVisible?: boolean;}-export const FileManagerSkeleton = ({+export function FileManagerSkeleton({columns,hasActions = false,isCheckboxVisible = false,-}: FileManagerSkeletonProps) => {+}: FileManagerSkeletonProps) {const isSizeVisible = columns?.isSizeVisible ?? true;const isModifiedVisible = columns?.isModifiedVisible ?? true;const gridTemplate = buildFileManagerGridTemplate(isSizeVisible, isModifiedVisible, hasActions);@@ -118,4 +118,4 @@ export const FileManagerSkeleton = ({</div></div>);-};+}diff --git a/frontend/src/components/shared/file-manager/file-manager-tree-node.tsx b/frontend/src/components/shared/file-manager/file-manager-tree-node.tsxindex 2ff565af..d6465790 100644--- a/frontend/src/components/shared/file-manager/file-manager-tree-node.tsx+++ b/frontend/src/components/shared/file-manager/file-manager-tree-node.tsx@@ -32,7 +32,7 @@ interface FileManagerTreeNodeProps {* recursion into a component (instead of an inline `renderNode` function) keeps* `FileManager` lean and gives React DevTools a real boundary to inspect.*/-export const FileManagerTreeNode = ({+export function FileManagerTreeNode({actions,activeRowPath,bindNodeDnd,@@ -45,7 +45,7 @@ export const FileManagerTreeNode = ({posInSet,selectedPaths,setSize,-}: FileManagerTreeNodeProps) => {+}: FileManagerTreeNodeProps) {const isExpanded = expandedPaths.has(node.path);const isSelected = selectedPaths.has(node.path);const renderChildren = node.isDir && isExpanded && node.children.length > 0;@@ -95,4 +95,4 @@ export const FileManagerTreeNode = ({))}</>);-};+}diff --git a/frontend/src/components/shared/file-manager/file-manager.tsx b/frontend/src/components/shared/file-manager/file-manager.tsxindex 7615db5c..bfc700bd 100644--- a/frontend/src/components/shared/file-manager/file-manager.tsx+++ b/frontend/src/components/shared/file-manager/file-manager.tsx@@ -111,7 +111,7 @@ const renderEmptyAreaItems = (items: readonly FileManagerEmptyAreaAction[]): Reareturn nodes;};-export const FileManager = ({+export function FileManager({actions,bulkActions,className,@@ -135,7 +135,7 @@ export const FileManager = ({search,sorting: controlledSorting,sortStorageKey,-}: FileManagerProps) => {+}: FileManagerProps) {const effectiveBulkActions = bulkActions ?? EMPTY_BULK_ACTIONS;const hasBulkActions = effectiveBulkActions.length > 0;const isCheckboxVisible = enableSelection ?? hasBulkActions;@@ -581,4 +581,4 @@ export const FileManager = ({)}</div>);-};+}diff --git a/frontend/src/components/shared/file-manager/use-file-manager-data.ts b/frontend/src/components/shared/file-manager/use-file-manager-data.tsindex c6b64272..3da7a01a 100644--- a/frontend/src/components/shared/file-manager/use-file-manager-data.ts+++ b/frontend/src/components/shared/file-manager/use-file-manager-data.ts@@ -92,7 +92,7 @@ interface UseFileManagerDataResult {* Computing it inside would force a circular dependency between the data hook* and the expansion hook. The host derives it with a single `useMemo`.*/-export const useFileManagerData = ({+export function useFileManagerData({columns,files,hasActions,@@ -100,7 +100,7 @@ export const useFileManagerData = ({rootGroups,searchQuery,sorting,-}: UseFileManagerDataArgs): UseFileManagerDataResult => {+}: UseFileManagerDataArgs): UseFileManagerDataResult {const isSizeVisible = columns?.isSizeVisible ?? true;const isModifiedVisible = columns?.isModifiedVisible ?? true;@@ -164,4 +164,4 @@ export const useFileManagerData = ({trimmedSearch,visibleTree,};-};+}diff --git a/frontend/src/components/shared/file-manager/use-file-manager-dnd.ts b/frontend/src/components/shared/file-manager/use-file-manager-dnd.tsindex 5b32c9f3..356f0da8 100644--- a/frontend/src/components/shared/file-manager/use-file-manager-dnd.ts+++ b/frontend/src/components/shared/file-manager/use-file-manager-dnd.ts@@ -207,13 +207,13 @@ const resolveDropTargetDir = (* `dragenter` / a child file's `dragenter` write to the same counter, so moving* the cursor between them keeps the highlight stable.*/-export const useFileManagerDnd = ({+export function useFileManagerDnd({findNode,onClearSelection,onExternalFileDrop,onMoveItems,selectedPaths,-}: UseFileManagerDndParams): UseFileManagerDndResult => {+}: UseFileManagerDndParams): UseFileManagerDndResult {// `isEnabled` keeps its legacy meaning ("internal move DnD is on") so// existing consumers (e.g. row `draggable` flag, container root-drop// wiring) keep working unchanged. External-file drops live on a separate@@ -728,4 +728,4 @@ export const useFileManagerDnd = ({},isEnabled,};-};+}diff --git a/frontend/src/components/shared/file-manager/use-file-manager-expansion.ts b/frontend/src/components/shared/file-manager/use-file-manager-expansion.tsindex 0002c2f6..34d90ed2 100644--- a/frontend/src/components/shared/file-manager/use-file-manager-expansion.ts+++ b/frontend/src/components/shared/file-manager/use-file-manager-expansion.ts@@ -36,11 +36,11 @@ interface UseFileManagerExpansionArgs {* 1) `rootGroups[].defaultOpen` — initial group expansion,* 2) on-search auto-expansion of every directory inside the filtered tree.*/-export const useFileManagerExpansion = ({+export function useFileManagerExpansion({isFiltering,normalizedRootGroups,visibleTree,-}: UseFileManagerExpansionArgs): UseFileManagerExpansion => {+}: UseFileManagerExpansionArgs): UseFileManagerExpansion {const [overrides, setOverrides] = useState<Map<string, boolean>>(() => new Map());const expandedPaths = useMemo(() => {@@ -98,4 +98,4 @@ export const useFileManagerExpansion = ({}, []);return { expandedPaths, setExpansion, toggleExpand };-};+}diff --git a/frontend/src/components/shared/file-manager/use-file-manager-keyboard.ts b/frontend/src/components/shared/file-manager/use-file-manager-keyboard.tsindex 48eff556..276d7cec 100644--- a/frontend/src/components/shared/file-manager/use-file-manager-keyboard.ts+++ b/frontend/src/components/shared/file-manager/use-file-manager-keyboard.ts@@ -36,7 +36,7 @@ interface UseFileManagerKeyboardNavigationArgs {* for directories, Space → toggle the row's checkbox (only when checkboxes are shown),* Ctrl/Cmd+A → select all, Escape → clear selection.*/-export const useFileManagerKeyboardNavigation = ({+export function useFileManagerKeyboardNavigation({expandedPaths,flatVisible,focusRow,@@ -50,8 +50,8 @@ export const useFileManagerKeyboardNavigation = ({onToggleSelection,resolvedActiveRow,visibleTree,-}: UseFileManagerKeyboardNavigationArgs) =>- useCallback(+}: UseFileManagerKeyboardNavigationArgs) {+ return useCallback((event: ReactKeyboardEvent<HTMLDivElement>) => {if (event.key === 'Escape') {onClearSelection();@@ -189,3 +189,4 @@ export const useFileManagerKeyboardNavigation = ({visibleTree,],);+}diff --git a/frontend/src/components/shared/file-manager/use-file-manager-selection.ts b/frontend/src/components/shared/file-manager/use-file-manager-selection.tsindex ccf94cc0..5c605d0f 100644--- a/frontend/src/components/shared/file-manager/use-file-manager-selection.ts+++ b/frontend/src/components/shared/file-manager/use-file-manager-selection.ts@@ -72,11 +72,11 @@ interface UseFileManagerSelectionArgs {* latest-ref pointers needed to keep the callbacks reference-stable across* expand/collapse and tree-shape changes.*/-export const useFileManagerSelection = ({+export function useFileManagerSelection({allSelectablePaths,dirSubtreePaths,flatVisible,-}: UseFileManagerSelectionArgs): UseFileManagerSelection => {+}: UseFileManagerSelectionArgs): UseFileManagerSelection {const [rawSelectedPaths, setRawSelectedPaths] = useState<Set<string>>(() => new Set());const lastClickedRef = useRef<null | string>(null);@@ -188,4 +188,4 @@ export const useFileManagerSelection = ({setSelection,toggleSelectAll,};-};+}diff --git a/frontend/src/components/shared/file-manager/use-file-manager-sorting.ts b/frontend/src/components/shared/file-manager/use-file-manager-sorting.tsindex 41bdaea8..63286fba 100644--- a/frontend/src/components/shared/file-manager/use-file-manager-sorting.ts+++ b/frontend/src/components/shared/file-manager/use-file-manager-sorting.ts@@ -50,12 +50,12 @@ interface UseFileManagerSortingResult {* 3. **Controlled** — `controlledSorting` is set. The hook reflects that* value verbatim and fires `onSortingChange` on user interaction.*/-export const useFileManagerSorting = ({+export function useFileManagerSorting({controlledSorting,initialSorting = null,onSortingChange,sortStorageKey,-}: UseFileManagerSortingArgs): UseFileManagerSortingResult => {+}: UseFileManagerSortingArgs): UseFileManagerSortingResult {const isControlled = controlledSorting !== undefined;// `localStorage` access is guarded inside `loadFileManagerSorting`, so the@@ -115,7 +115,7 @@ export const useFileManagerSorting = ({}, []);return { sorting, toggleSort };-};+}/** Pure reducer for the header three-state cycle. Exported for unit tests. */export const computeNextSort = (current: FileManagerSortState, column: FileManagerSortColumn): FileManagerSortState => {diff --git a/frontend/src/components/shared/inline-edit/inline-edit-input.tsx b/frontend/src/components/shared/inline-edit/inline-edit-input.tsxindex bee5a60f..656efbad 100644--- a/frontend/src/components/shared/inline-edit/inline-edit-input.tsx+++ b/frontend/src/components/shared/inline-edit/inline-edit-input.tsx@@ -53,7 +53,7 @@ interface InlineEditInputProps {* not from React state, which avoids a re-render per keystroke for a value* that's only relevant once.*/-export const InlineEditInput = ({+export function InlineEditInput({autoFocus = false,busy = false,className,@@ -63,7 +63,7 @@ export const InlineEditInput = ({onCancel,onSave,placeholder,-}: InlineEditInputProps) => {+}: InlineEditInputProps) {const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {if (event.key === 'Enter') {event.preventDefault();@@ -110,4 +110,4 @@ export const InlineEditInput = ({</InputGroupAddon></InputGroup>);-};+}diff --git a/frontend/src/components/shared/inline-edit/use-inline-edit.ts b/frontend/src/components/shared/inline-edit/use-inline-edit.tsindex c3a051b9..6e176cb3 100644--- a/frontend/src/components/shared/inline-edit/use-inline-edit.ts+++ b/frontend/src/components/shared/inline-edit/use-inline-edit.ts@@ -44,9 +44,9 @@ interface UseInlineEditResult<TElement extends HTMLElement = HTMLInputElement> {* Pass the entity id as `resetKey` so navigation between items closes any* stale editor automatically.*/-export const useInlineEdit = <TElement extends HTMLElement = HTMLInputElement>({+export function useInlineEdit<TElement extends HTMLElement = HTMLInputElement>({resetKey,-}: UseInlineEditOptions = {}): UseInlineEditResult<TElement> => {+}: UseInlineEditOptions = {}): UseInlineEditResult<TElement> {const [isEditing, setIsEditing] = useState(false);const inputRef = useRef<null | TElement>(null);@@ -109,4 +109,4 @@ export const useInlineEdit = <TElement extends HTMLElement = HTMLInputElement>({);return { handleDropdownCloseAutoFocus, inputRef, isEditing, startEdit, stopEdit };-};+}diff --git a/frontend/src/components/shared/markdown.tsx b/frontend/src/components/shared/markdown.tsxindex 8d37a41f..3589f605 100644--- a/frontend/src/components/shared/markdown.tsx+++ b/frontend/src/components/shared/markdown.tsx@@ -96,7 +96,7 @@ const escapeRegExp = (string: string): string => {return string.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&');};-const Markdown = ({ children, className, searchValue }: MarkdownProps) => {+function Markdown({ children, className, searchValue }: MarkdownProps) {// Memoize the escaped search value to avoid recalculating regexconst processedSearch = useMemo(() => {const trimmedSearch = searchValue?.trim();@@ -281,6 +281,6 @@ const Markdown = ({ children, className, searchValue }: MarkdownProps) => {</ReactMarkdown></div>);-};+}export default Markdown;diff --git a/frontend/src/components/shared/monaco-terminal.tsx b/frontend/src/components/shared/monaco-terminal.tsxindex 967fa577..7eb26822 100644--- a/frontend/src/components/shared/monaco-terminal.tsx+++ b/frontend/src/components/shared/monaco-terminal.tsx@@ -267,12 +267,12 @@ const parseLogsWithCache = (logs: string[]): ParsedLine[] => {* Provides a read-only code viewer with search functionality, theme support, and ANSI color rendering.* Compatible with the existing Terminal component API.*/-const MonacoTerminal = ({+function MonacoTerminal({className,logs,ref,searchValue,-}: MonacoTerminalProps & { ref?: React.RefObject<MonacoTerminalRef | null> }) => {+}: MonacoTerminalProps & { ref?: React.RefObject<MonacoTerminalRef | null> }) {const editorRef = useRef<monaco.editor.IStandaloneCodeEditor | null>(null);const monacoRef = useRef<Monaco | null>(null);const { theme } = useTheme();@@ -567,6 +567,6 @@ const MonacoTerminal = ({/></div>);-};+}export default MonacoTerminal;diff --git a/frontend/src/components/shared/overwrite/overwrite-buttons.tsx b/frontend/src/components/shared/overwrite/overwrite-buttons.tsxindex 09f3f09e..b0b92885 100644--- a/frontend/src/components/shared/overwrite/overwrite-buttons.tsx+++ b/frontend/src/components/shared/overwrite/overwrite-buttons.tsx@@ -47,7 +47,7 @@ interface OverwriteButtonsProps {* The component owns the spinner / icon swap, so callers don't repeat that* boilerplate in five different dialogs.*/-export const OverwriteButtons = ({+export function OverwriteButtons({isDisabled,isProcessing,onOverwrite,@@ -56,7 +56,7 @@ export const OverwriteButtons = ({primaryIcon: PrimaryIcon,primaryLabel,primaryType = 'button',-}: OverwriteButtonsProps) => {+}: OverwriteButtonsProps) {const disabled = isDisabled || isProcessing;return (@@ -80,4 +80,4 @@ export const OverwriteButtons = ({</Button></>);-};+}diff --git a/frontend/src/components/shared/overwrite/overwrite-dialog.tsx b/frontend/src/components/shared/overwrite/overwrite-dialog.tsxindex 0706e3da..ab91f4e6 100644--- a/frontend/src/components/shared/overwrite/overwrite-dialog.tsx+++ b/frontend/src/components/shared/overwrite/overwrite-dialog.tsx@@ -57,29 +57,31 @@ const buildDefaultConfirmText = (count: number): string => (count > 1 ? 'Replace* file-manager UX and keeps the user from being prompted N times for the* same destination directory.*/-export const OverwriteDialog = ({+export function OverwriteDialog({confirmText,conflicts,description,onCancel,onReplaceAll,title = 'Replace existing item?',-}: OverwriteDialogProps) => (- <ConfirmationDialog- cancelText="Cancel"- confirmIcon={<Replace />}- confirmText={confirmText ?? buildDefaultConfirmText(conflicts.length)}- confirmVariant="destructive"- description={description ?? buildDefaultDescription(conflicts)}- handleConfirm={async () => {- await onReplaceAll();- }}- handleOpenChange={(nextOpen) => {- if (!nextOpen) {- onCancel();- }- }}- isOpen={conflicts.length > 0}- title={title}- />-);+}: OverwriteDialogProps) {+ return (+ <ConfirmationDialog+ cancelText="Cancel"+ confirmIcon={<Replace />}+ confirmText={confirmText ?? buildDefaultConfirmText(conflicts.length)}+ confirmVariant="destructive"+ description={description ?? buildDefaultDescription(conflicts)}+ handleConfirm={async () => {+ await onReplaceAll();+ }}+ handleOpenChange={(nextOpen) => {+ if (!nextOpen) {+ onCancel();+ }+ }}+ isOpen={conflicts.length > 0}+ title={title}+ />+ );+}diff --git a/frontend/src/components/shared/overwrite/use-overwrite.ts b/frontend/src/components/shared/overwrite/use-overwrite.tsindex 3f1ad8f8..8c9b0b98 100644--- a/frontend/src/components/shared/overwrite/use-overwrite.ts+++ b/frontend/src/components/shared/overwrite/use-overwrite.ts@@ -95,7 +95,7 @@ interface UseOverwriteResult<TPlan> {* to wrap them in `useCallback`. This keeps the hook ergonomic at the call* site without sacrificing reference stability for the returned actions.*/-export const useOverwrite = <TPlan>(options: UseOverwriteOptions<TPlan>): UseOverwriteResult<TPlan> => {+export function useOverwrite<TPlan>(options: UseOverwriteOptions<TPlan>): UseOverwriteResult<TPlan> {const [conflicts, setConflicts] = useState<OverwriteConflict[]>([]);const [pendingPlan, setPendingPlan] = useState<null | TPlan>(null);@@ -189,4 +189,4 @@ export const useOverwrite = <TPlan>(options: UseOverwriteOptions<TPlan>): UseOveprimaryExecute,resetConflicts,};-};+}diff --git a/frontend/src/components/shared/page-loader.tsx b/frontend/src/components/shared/page-loader.tsxindex 14cac4a5..a8f4345b 100644--- a/frontend/src/components/shared/page-loader.tsx+++ b/frontend/src/components/shared/page-loader.tsx@@ -1,9 +1,9 @@-const PageLoader = () => {+function PageLoader() {return (<div className="grid h-screen w-full place-items-center"><p>Loading...</p></div>);-};+}export default PageLoader;diff --git a/frontend/src/components/shared/page-title.tsx b/frontend/src/components/shared/page-title.tsxindex 49ba4a05..e6bcf761 100644--- a/frontend/src/components/shared/page-title.tsx+++ b/frontend/src/components/shared/page-title.tsx@@ -15,6 +15,6 @@ interface PageTitleProps {* the browser tab, history, and shareable links reflect the actual page —* instead of the static "PentAGI" coming from index.html.*/-export const PageTitle = ({ children }: PageTitleProps) => (- <title>{children ? `${children} — ${APP_NAME}` : APP_NAME}</title>-);+export function PageTitle({ children }: PageTitleProps) {+ return <title>{children ? `${children} — ${APP_NAME}` : APP_NAME}</title>;+}diff --git a/frontend/src/components/shared/terminal/terminal.tsx b/frontend/src/components/shared/terminal/terminal.tsxindex 1284a1a2..5ec710f4 100644--- a/frontend/src/components/shared/terminal/terminal.tsx+++ b/frontend/src/components/shared/terminal/terminal.tsx@@ -18,12 +18,12 @@ interface TerminalRef {findPrevious: () => void;}-const Terminal = ({+function Terminal({className,logs,ref,searchValue,-}: TerminalProps & { ref?: React.RefObject<null | TerminalRef> }) => {+}: TerminalProps & { ref?: React.RefObject<null | TerminalRef> }) {const { theme } = useTheme();const { clear, containerRef, isReady, scrollToBottom, searchAddon, write } = useXterm({ theme });const { findNext, findPrevious } = useTerminalSearch(searchAddon, isReady, searchValue, theme);@@ -84,7 +84,7 @@ const Terminal = ({style={{ contain: 'strict' }}/>);-};+}export type { TerminalRef };export default Terminal;diff --git a/frontend/src/components/shared/unsaved-changes/unsaved-changes-dialog.tsx b/frontend/src/components/shared/unsaved-changes/unsaved-changes-dialog.tsxindex 97c0916c..472d0b31 100644--- a/frontend/src/components/shared/unsaved-changes/unsaved-changes-dialog.tsx+++ b/frontend/src/components/shared/unsaved-changes/unsaved-changes-dialog.tsx@@ -30,7 +30,7 @@ export interface UnsavedChangesDialogProps {title?: string;}-const UnsavedChangesDialog = ({+function UnsavedChangesDialog({canSave,description = 'You have unsaved changes on this page. Would you like to save them before leaving?',discardText = 'Discard',@@ -43,56 +43,58 @@ const UnsavedChangesDialog = ({saveIcon = <Save />,saveText = 'Save',title = 'Unsaved changes',-}: UnsavedChangesDialogProps) => (- <Dialog- onOpenChange={handleOpenChange}- open={isOpen}- >- <DialogContent- className="sm:max-w-md"- onEscapeKeyDown={(event) => {- if (isSavingFromDialog) {- event.preventDefault();- }- }}- onInteractOutside={(event) => {- if (isSavingFromDialog) {- event.preventDefault();- }- }}+}: UnsavedChangesDialogProps) {+ return (+ <Dialog+ onOpenChange={handleOpenChange}+ open={isOpen}>- <DialogHeader>- <DialogTitle>{title}</DialogTitle>- <DialogDescription>{description}</DialogDescription>- </DialogHeader>- <DialogFooter className="flex-col-reverse gap-2 sm:flex-row sm:justify-end">- <Button- disabled={isSavingFromDialog}- onClick={handleCancel}- variant="outline"- >- Cancel- </Button>- <Button- disabled={isSavingFromDialog}- onClick={handleDiscard}- variant="destructive"- >- {discardText}- </Button>- <Button- disabled={isSavingFromDialog || !canSave}- onClick={() => {- void handleSaveAndLeave();- }}- variant="default"- >- {isSavingFromDialog ? <Spinner variant="circle" /> : saveIcon}- {saveText}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>-);+ <DialogContent+ className="sm:max-w-md"+ onEscapeKeyDown={(event) => {+ if (isSavingFromDialog) {+ event.preventDefault();+ }+ }}+ onInteractOutside={(event) => {+ if (isSavingFromDialog) {+ event.preventDefault();+ }+ }}+ >+ <DialogHeader>+ <DialogTitle>{title}</DialogTitle>+ <DialogDescription>{description}</DialogDescription>+ </DialogHeader>+ <DialogFooter className="flex-col-reverse gap-2 sm:flex-row sm:justify-end">+ <Button+ disabled={isSavingFromDialog}+ onClick={handleCancel}+ variant="outline"+ >+ Cancel+ </Button>+ <Button+ disabled={isSavingFromDialog}+ onClick={handleDiscard}+ variant="destructive"+ >+ {discardText}+ </Button>+ <Button+ disabled={isSavingFromDialog || !canSave}+ onClick={() => {+ void handleSaveAndLeave();+ }}+ variant="default"+ >+ {isSavingFromDialog ? <Spinner variant="circle" /> : saveIcon}+ {saveText}+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+}export { UnsavedChangesDialog };diff --git a/frontend/src/components/shared/unsaved-changes/use-unsaved-changes-guard.ts b/frontend/src/components/shared/unsaved-changes/use-unsaved-changes-guard.tsindex 0e12394e..c1ad065e 100644--- a/frontend/src/components/shared/unsaved-changes/use-unsaved-changes-guard.ts+++ b/frontend/src/components/shared/unsaved-changes/use-unsaved-changes-guard.ts@@ -34,11 +34,11 @@ export interface UseUnsavedChangesGuardArgs {* Designed to be UI-agnostic: pair with `<UnsavedChangesDialog>` (or any* custom dialog) by wiring the returned handlers.*/-export const useUnsavedChangesGuard = ({+export function useUnsavedChangesGuard({isDirty,isFormValid,onSave,-}: UseUnsavedChangesGuardArgs): UnsavedChangesGuard => {+}: UseUnsavedChangesGuardArgs): UnsavedChangesGuard {const allowNextRef = useRef(false);const isDirtyRef = useRef(isDirty);@@ -138,4 +138,4 @@ export const useUnsavedChangesGuard = ({isSavingFromDialog,skipNextBlock,};-};+}diff --git a/frontend/src/components/ui/autocomplete.tsx b/frontend/src/components/ui/autocomplete.tsxindex b233da17..ce82af89 100644--- a/frontend/src/components/ui/autocomplete.tsx+++ b/frontend/src/components/ui/autocomplete.tsx@@ -15,35 +15,16 @@ import { Popover, PopoverAnchor } from '@/components/ui/popover';import { useLatestRef } from '@/hooks/use-latest-ref';import { cn } from '@/lib/utils';-/**- * Radix-style controllable state. When `controlled` is `undefined` the hook- * owns the state; otherwise the parent does and we forward updates via- * `onChange`. `onChange` always fires so fully-controlled consumers can- * observe every set (e.g. for logging).- *- * Mirrors `@radix-ui/react-use-controllable-state` without pulling in the- * dependency for a couple of state slots.- */-const useControllable = <T,>(controlled: T | undefined, defaultValue: T, onChange?: (value: T) => void) => {- const [internal, setInternal] = React.useState<T>(defaultValue);- const isControlled = controlled !== undefined;- const value = isControlled ? (controlled as T) : internal;-- const onChangeRef = useLatestRef(onChange);-- const set = React.useCallback(- (next: T) => {- if (!isControlled) {- setInternal(next);- }-- onChangeRef.current?.(next);- },- [isControlled, onChangeRef],- );-- return [value, set] as const;-};+interface AutocompleteContextValue {+ commit: (value: string) => void;+ inputId: string;+ inputRef: React.RefObject<HTMLInputElement | null>;+ inputValue: string;+ open: boolean;+ openOnFocus: boolean;+ setInputValue: (value: string) => void;+ setOpen: (open: boolean) => void;+}/*** Free-text input with a popover dropdown of substring-filtered suggestions.@@ -71,20 +52,39 @@ const useControllable = <T,>(controlled: T | undefined, defaultValue: T, onChang* </Autocomplete>*/-interface AutocompleteContextValue {- commit: (value: string) => void;- inputId: string;- inputRef: React.RefObject<HTMLInputElement | null>;- inputValue: string;- open: boolean;- openOnFocus: boolean;- setInputValue: (value: string) => void;- setOpen: (open: boolean) => void;+/**+ * Radix-style controllable state. When `controlled` is `undefined` the hook+ * owns the state; otherwise the parent does and we forward updates via+ * `onChange`. `onChange` always fires so fully-controlled consumers can+ * observe every set (e.g. for logging).+ *+ * Mirrors `@radix-ui/react-use-controllable-state` without pulling in the+ * dependency for a couple of state slots.+ */+function useControllable<T>(controlled: T | undefined, defaultValue: T, onChange?: (value: T) => void) {+ const [internal, setInternal] = React.useState<T>(defaultValue);+ const isControlled = controlled !== undefined;+ const value = isControlled ? (controlled as T) : internal;++ const onChangeRef = useLatestRef(onChange);++ const set = React.useCallback(+ (next: T) => {+ if (!isControlled) {+ setInternal(next);+ }++ onChangeRef.current?.(next);+ },+ [isControlled, onChangeRef],+ );++ return [value, set] as const;}const AutocompleteContext = React.createContext<AutocompleteContextValue | null>(null);-const useAutocompleteContext = (): AutocompleteContextValue => {+function useAutocompleteContext(): AutocompleteContextValue {const ctx = React.useContext(AutocompleteContext);if (!ctx) {@@ -92,7 +92,7 @@ const useAutocompleteContext = (): AutocompleteContextValue => {}return ctx;-};+}// Case-insensitive substring matcher used as the default. cmdk ships// `command-score` (fuzzy/subsequence), which is great for command palettesdiff --git a/frontend/src/components/ui/data-table.tsx b/frontend/src/components/ui/data-table.tsxindex 7cd86b37..4add875a 100644--- a/frontend/src/components/ui/data-table.tsx+++ b/frontend/src/components/ui/data-table.tsx@@ -164,82 +164,6 @@ const FILTER_DEBOUNCE_MS = 150;// boundary, which is the only entry point users have here.const FILTER_MAX_LENGTH = 200;-/**- * Search input for the table's global filter. Keystrokes update an internal- * `localValue` state synchronously so the input feels instant; the debounced- * mirror is what we propagate upstream via `onQueryChange`. The previous- * design committed every keystroke straight into `useTableQueryFilter`, which- * synchronously walked the router and re-rendered the entire route subtree —- * with the Flows page that ran ~250 ms per keystroke, so consecutive- * keypresses queued behind the in-flight reconciliation and showed up as- * input-delay INP. Debouncing the commit drops the upstream cascade rate- * from per-keystroke to once per typing pause.- *- * External `query` changes (X button, programmatic clear, URL back-button,- * route swap) are reconciled into `localValue` through the sync effect: we- * skip when the incoming value matches what we last emitted, so our own- * round-trip through the parent doesn't fight with active typing.- */-const DataTableFilter = ({ onQueryChange, placeholder, query }: DataTableFilterProps) => {- const [localValue, setLocalValue] = useState(query);- const debouncedValue = useDebouncedValue(localValue, FILTER_DEBOUNCE_MS);- const lastEmittedReference = useRef(query);- // Generated per-instance so pages with multiple DataTables (e.g.- // /settings/prompts) don't end up with duplicate `id` attributes — that- // breaks `getElementById`, a11y semantics, and any test selector that- // relies on the input id.- const fieldId = useId();-- useEffect(() => {- if (query !== lastEmittedReference.current) {- setLocalValue(query);- lastEmittedReference.current = query;- }- }, [query]);-- useEffect(() => {- if (debouncedValue !== lastEmittedReference.current) {- lastEmittedReference.current = debouncedValue;- onQueryChange(debouncedValue);- }- }, [debouncedValue, onQueryChange]);-- const handleClear = useCallback(() => {- setLocalValue('');- lastEmittedReference.current = '';- onQueryChange('');- }, [onQueryChange]);-- return (- <InputGroup className="max-w-sm">- <InputGroupAddon>- <Search />- </InputGroupAddon>- <InputGroupInput- aria-label={placeholder}- autoComplete="off"- id={fieldId}- maxLength={FILTER_MAX_LENGTH}- name={fieldId}- onChange={(event) => setLocalValue(event.target.value)}- placeholder={placeholder}- type="text"- value={localValue}- />- {localValue ? (- <InputGroupAddon align="inline-end">- <InputGroupButton- onClick={handleClear}- type="button"- >- <X />- </InputGroupButton>- </InputGroupAddon>- ) : null}- </InputGroup>- );-};-interface DataTableColumnHeaderProps<TData, TValue> {/** TanStack column. Sorting state and the cycle action both target it. */column: Column<TData, TValue>;@@ -958,4 +882,80 @@ function DataTableColumnHeader<TData, TValue = unknown>({ column, title }: DataT);}+/**+ * Search input for the table's global filter. Keystrokes update an internal+ * `localValue` state synchronously so the input feels instant; the debounced+ * mirror is what we propagate upstream via `onQueryChange`. The previous+ * design committed every keystroke straight into `useTableQueryFilter`, which+ * synchronously walked the router and re-rendered the entire route subtree —+ * with the Flows page that ran ~250 ms per keystroke, so consecutive+ * keypresses queued behind the in-flight reconciliation and showed up as+ * input-delay INP. Debouncing the commit drops the upstream cascade rate+ * from per-keystroke to once per typing pause.+ *+ * External `query` changes (X button, programmatic clear, URL back-button,+ * route swap) are reconciled into `localValue` through the sync effect: we+ * skip when the incoming value matches what we last emitted, so our own+ * round-trip through the parent doesn't fight with active typing.+ */+function DataTableFilter({ onQueryChange, placeholder, query }: DataTableFilterProps) {+ const [localValue, setLocalValue] = useState(query);+ const debouncedValue = useDebouncedValue(localValue, FILTER_DEBOUNCE_MS);+ const lastEmittedReference = useRef(query);+ // Generated per-instance so pages with multiple DataTables (e.g.+ // /settings/prompts) don't end up with duplicate `id` attributes — that+ // breaks `getElementById`, a11y semantics, and any test selector that+ // relies on the input id.+ const fieldId = useId();++ useEffect(() => {+ if (query !== lastEmittedReference.current) {+ setLocalValue(query);+ lastEmittedReference.current = query;+ }+ }, [query]);++ useEffect(() => {+ if (debouncedValue !== lastEmittedReference.current) {+ lastEmittedReference.current = debouncedValue;+ onQueryChange(debouncedValue);+ }+ }, [debouncedValue, onQueryChange]);++ const handleClear = useCallback(() => {+ setLocalValue('');+ lastEmittedReference.current = '';+ onQueryChange('');+ }, [onQueryChange]);++ return (+ <InputGroup className="max-w-sm">+ <InputGroupAddon>+ <Search />+ </InputGroupAddon>+ <InputGroupInput+ aria-label={placeholder}+ autoComplete="off"+ id={fieldId}+ maxLength={FILTER_MAX_LENGTH}+ name={fieldId}+ onChange={(event) => setLocalValue(event.target.value)}+ placeholder={placeholder}+ type="text"+ value={localValue}+ />+ {localValue ? (+ <InputGroupAddon align="inline-end">+ <InputGroupButton+ onClick={handleClear}+ type="button"+ >+ <X />+ </InputGroupButton>+ </InputGroupAddon>+ ) : null}+ </InputGroup>+ );+}+export { DataTable, DataTableColumnHeader };diff --git a/frontend/src/components/ui/file-drop-zone.tsx b/frontend/src/components/ui/file-drop-zone.tsxindex bbd3b41c..27e48535 100644--- a/frontend/src/components/ui/file-drop-zone.tsx+++ b/frontend/src/components/ui/file-drop-zone.tsx@@ -29,7 +29,7 @@ export interface FileDropZoneProps {* The button uses `onBrowse` to open the file picker (typically wired to* `useResourcesUpload().openFilePicker`).*/-export const FileDropZone = ({+export function FileDropZone({actionLabel = 'Browse files',className,description = 'or click the button to choose files from your computer',@@ -38,33 +38,35 @@ export const FileDropZone = ({isUploading = false,onBrowse,title = 'Drag and drop your files',-}: FileDropZoneProps) => (- <div- className={cn(- 'bg-card flex flex-col items-center justify-center rounded-md border-2 border-dashed px-6 py-12 text-center transition-all duration-200',- isDragging- ? 'border-foreground bg-muted/50'- : 'border-muted-foreground/25 hover:border-muted-foreground/40',- className,- )}- >- <UploadCloudIcon+}: FileDropZoneProps) {+ return (+ <divclassName={cn(- 'text-muted-foreground mb-3 size-10 transition-transform duration-200',- isDragging && 'text-foreground scale-110',+ 'bg-card flex flex-col items-center justify-center rounded-md border-2 border-dashed px-6 py-12 text-center transition-all duration-200',+ isDragging+ ? 'border-foreground bg-muted/50'+ : 'border-muted-foreground/25 hover:border-muted-foreground/40',+ className,)}- />- <span className="text-sm font-medium">{isDragging ? 'Drop files here' : title}</span>- <span className="text-muted-foreground mt-1 max-w-md text-xs">{description}</span>- <Button- className="mt-4 h-7 text-xs"- disabled={isUploading}- onClick={onBrowse}- size="sm"- variant="outline">- {actionLabel}- </Button>- {hint && <span className="text-muted-foreground mt-3 text-xs">{hint}</span>}- </div>-);+ <UploadCloudIcon+ className={cn(+ 'text-muted-foreground mb-3 size-10 transition-transform duration-200',+ isDragging && 'text-foreground scale-110',+ )}+ />+ <span className="text-sm font-medium">{isDragging ? 'Drop files here' : title}</span>+ <span className="text-muted-foreground mt-1 max-w-md text-xs">{description}</span>+ <Button+ className="mt-4 h-7 text-xs"+ disabled={isUploading}+ onClick={onBrowse}+ size="sm"+ variant="outline"+ >+ {actionLabel}+ </Button>+ {hint && <span className="text-muted-foreground mt-3 text-xs">{hint}</span>}+ </div>+ );+}diff --git a/frontend/src/components/ui/form.tsx b/frontend/src/components/ui/form.tsxindex 62197e65..216342ac 100644--- a/frontend/src/components/ui/form.tsx+++ b/frontend/src/components/ui/form.tsx@@ -24,20 +24,22 @@ type FormFieldContextValue<const FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);-const FormField = <+type FormItemContextValue = {+ id: string;+};++function FormField<TFieldValues extends FieldValues = FieldValues,TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,->({- ...props-}: ControllerProps<TFieldValues, TName>) => {+>({ ...props }: ControllerProps<TFieldValues, TName>) {return (<FormFieldContext.Provider value={{ name: props.name }}><Controller {...props} /></FormFieldContext.Provider>);-};+}-const useFormField = () => {+function useFormField() {const fieldContext = React.useContext(FormFieldContext);const itemContext = React.useContext(FormItemContext);const { formState, getFieldState } = useFormContext();@@ -58,11 +60,7 @@ const useFormField = () => {name: fieldContext.name,...fieldState,};-};--type FormItemContextValue = {- id: string;-};+}const FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);diff --git a/frontend/src/components/ui/resizable.tsx b/frontend/src/components/ui/resizable.tsxindex 726d343c..40526dc7 100644--- a/frontend/src/components/ui/resizable.tsx+++ b/frontend/src/components/ui/resizable.tsx@@ -3,35 +3,39 @@ import { Group, Panel, Separator } from 'react-resizable-panels';import { cn } from '@/lib/utils';-const ResizablePanelGroup = ({ className, ...props }: React.ComponentProps<typeof Group>) => (- <Group- className={cn('flex h-full w-full data-[panel-group-direction=vertical]:flex-col', className)}- {...props}- />-);+function ResizablePanelGroup({ className, ...props }: React.ComponentProps<typeof Group>) {+ return (+ <Group+ className={cn('flex h-full w-full data-[panel-group-direction=vertical]:flex-col', className)}+ {...props}+ />+ );+}const ResizablePanel = Panel;-const ResizableHandle = ({+function ResizableHandle({className,withHandle,...props}: React.ComponentProps<typeof Separator> & {withHandle?: boolean;-}) => (- <Separator- className={cn(- 'bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90',- className,- )}- {...props}- >- {withHandle && (- <div className="bg-border z-10 flex h-4 w-3 items-center justify-center rounded-sm border">- <DragHandleDots2Icon className="h-2.5 w-2.5" />- </div>- )}- </Separator>-);+}) {+ return (+ <Separator+ className={cn(+ 'bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90',+ className,+ )}+ {...props}+ >+ {withHandle && (+ <div className="bg-border z-10 flex h-4 w-3 items-center justify-center rounded-sm border">+ <DragHandleDots2Icon className="h-2.5 w-2.5" />+ </div>+ )}+ </Separator>+ );+}export { ResizableHandle, ResizablePanel, ResizablePanelGroup };diff --git a/frontend/src/components/ui/sidebar.tsx b/frontend/src/components/ui/sidebar.tsxindex af032b3d..335ed4e7 100644--- a/frontend/src/components/ui/sidebar.tsx+++ b/frontend/src/components/ui/sidebar.tsx@@ -33,7 +33,7 @@ type SidebarContext = {const SidebarContext = React.createContext<null | SidebarContext>(null);-const useSidebar = () => {+function useSidebar() {const context = React.useContext(SidebarContext);if (!context) {@@ -41,7 +41,7 @@ const useSidebar = () => {}return context;-};+}// Helper function to read sidebar state from cookiesconst getSidebarState = (): boolean | undefined => {diff --git a/frontend/src/components/ui/sonner.tsx b/frontend/src/components/ui/sonner.tsxindex 52dfb1e1..2023aa39 100644--- a/frontend/src/components/ui/sonner.tsx+++ b/frontend/src/components/ui/sonner.tsx@@ -5,7 +5,7 @@ import { Toaster as Sonner, type ToasterProps } from 'sonner';import { useTheme } from '@/hooks/use-theme';-const Toaster = ({ ...props }: ToasterProps) => {+function Toaster({ ...props }: ToasterProps) {const { theme } = useTheme();return (@@ -33,6 +33,6 @@ const Toaster = ({ ...props }: ToasterProps) => {{...props}/>);-};+}export { Toaster };diff --git a/frontend/src/components/ui/spinner.tsx b/frontend/src/components/ui/spinner.tsxindex 658aa23f..1f99cf0d 100644--- a/frontend/src/components/ui/spinner.tsx+++ b/frontend/src/components/ui/spinner.tsx@@ -2,50 +2,135 @@ import { LoaderCircleIcon, LoaderIcon, LoaderPinwheelIcon, type LucideProps } frimport { cn } from '@/lib/utils';+export type SpinnerProps = LucideProps & {+ variant?: 'bars' | 'circle' | 'circle-filled' | 'default' | 'ellipsis' | 'infinite' | 'pinwheel' | 'ring-3';+};+type SpinnerVariantProps = Omit<SpinnerProps, 'variant'>;-const Default = ({ className, ...props }: SpinnerVariantProps) => (- <LoaderIcon- className={cn('animate-spin', className)}- {...props}- />-);+export function Spinner({ variant, ...props }: SpinnerProps) {+ switch (variant) {+ case 'bars':+ return <Bars {...props} />;+ case 'circle':+ return <Circle {...props} />;+ case 'circle-filled':+ return <CircleFilled {...props} />;+ case 'ellipsis':+ return <Ellipsis {...props} />;+ case 'infinite':+ return <Infinite {...props} />;+ case 'pinwheel':+ return <Pinwheel {...props} />;+ case 'ring-3':+ return <Ring {...props} />;+ default:+ return <Default {...props} />;+ }+}-const Circle = ({ className, ...props }: SpinnerVariantProps) => (- <LoaderCircleIcon- className={cn('animate-spin', className)}- {...props}- />-);+function Bars({ size = 24, ...props }: SpinnerVariantProps) {+ return (+ <svg+ height={size}+ viewBox="0 0 24 24"+ width={size}+ xmlns="http://www.w3.org/2000/svg"+ {...props}+ >+ <title>Loading...</title>+ <style>{`+ .spinner-bar {+ animation: spinner-bars-animation .8s linear infinite;+ animation-delay: -.8s;+ }+ .spinner-bars-2 {+ animation-delay: -.65s;+ }+ .spinner-bars-3 {+ animation-delay: -0.5s;+ }+ @keyframes spinner-bars-animation {+ 0% {+ y: 1px;+ height: 22px;+ }+ 93.75% {+ y: 5px;+ height: 14px;+ opacity: 0.2;+ }+ }+ `}</style>+ <rect+ className="spinner-bar"+ fill="currentColor"+ height="22"+ width="6"+ x="1"+ y="1"+ />+ <rect+ className="spinner-bar spinner-bars-2"+ fill="currentColor"+ height="22"+ width="6"+ x="9"+ y="1"+ />+ <rect+ className="spinner-bar spinner-bars-3"+ fill="currentColor"+ height="22"+ width="6"+ x="17"+ y="1"+ />+ </svg>+ );+}-const Pinwheel = ({ className, ...props }: SpinnerVariantProps) => (- <LoaderPinwheelIcon- className={cn('animate-spin', className)}- {...props}- />-);+function Circle({ className, ...props }: SpinnerVariantProps) {+ return (+ <LoaderCircleIcon+ className={cn('animate-spin', className)}+ {...props}+ />+ );+}-const CircleFilled = ({ className, size = 24, ...props }: SpinnerVariantProps) => (- <div- className="relative"- style={{ height: size, width: size }}- >- <div className="absolute inset-0 rotate-180">+function CircleFilled({ className, size = 24, ...props }: SpinnerVariantProps) {+ return (+ <div+ className="relative"+ style={{ height: size, width: size }}+ >+ <div className="absolute inset-0 rotate-180">+ <LoaderCircleIcon+ className={cn('animate-spin', className, 'text-foreground opacity-20')}+ size={size}+ {...props}+ />+ </div><LoaderCircleIcon- className={cn('animate-spin', className, 'text-foreground opacity-20')}+ className={cn('relative animate-spin', className)}size={size}{...props}/></div>- <LoaderCircleIcon- className={cn('relative animate-spin', className)}- size={size}+ );+}++function Default({ className, ...props }: SpinnerVariantProps) {+ return (+ <LoaderIcon+ className={cn('animate-spin', className)}{...props}/>- </div>-);+ );+}-const Ellipsis = ({ size = 24, ...props }: SpinnerVariantProps) => {+function Ellipsis({ size = 24, ...props }: SpinnerVariantProps) {return (<svgheight={size}@@ -104,192 +189,121 @@ const Ellipsis = ({ size = 24, ...props }: SpinnerVariantProps) => {</circle></svg>);-};+}-const Ring = ({ size = 24, ...props }: SpinnerVariantProps) => (- <svg- height={size}- stroke="currentColor"- viewBox="0 0 44 44"- width={size}- xmlns="http://www.w3.org/2000/svg"- {...props}- >- <title>Loading...</title>- <g- fill="none"- fillRule="evenodd"- strokeWidth="2"+function Infinite({ size = 24, ...props }: SpinnerVariantProps) {+ return (+ <svg+ height={size}+ preserveAspectRatio="xMidYMid"+ viewBox="0 0 100 100"+ width={size}+ xmlns="http://www.w3.org/2000/svg"+ {...props}>- <circle- cx="22"- cy="22"- r="1"- >- <animate- attributeName="r"- begin="0s"- calcMode="spline"- dur="1.8s"- keySplines="0.165, 0.84, 0.44, 1"- keyTimes="0; 1"- repeatCount="indefinite"- values="1; 20"- />- <animate- attributeName="stroke-opacity"- begin="0s"- calcMode="spline"- dur="1.8s"- keySplines="0.3, 0.61, 0.355, 1"- keyTimes="0; 1"- repeatCount="indefinite"- values="1; 0"- />- </circle>- <circle- cx="22"- cy="22"- r="1"+ <title>Loading...</title>+ <path+ d="M24.3 30C11.4 30 5 43.3 5 50s6.4 20 19.3 20c19.3 0 32.1-40 51.4-40 C88.6 30 95 43.3 95 50s-6.4 20-19.3 20C56.4 70 43.6 30 24.3 30z"+ fill="none"+ stroke="currentColor"+ strokeDasharray="205.271142578125 51.317785644531256"+ strokeLinecap="round"+ strokeWidth="10"+ style={{+ transform: 'scale(0.8)',+ transformOrigin: '50px 50px',+ }}><animate- attributeName="r"- begin="-0.9s"- calcMode="spline"- dur="1.8s"- keySplines="0.165, 0.84, 0.44, 1"- keyTimes="0; 1"- repeatCount="indefinite"- values="1; 20"- />- <animate- attributeName="stroke-opacity"- begin="-0.9s"- calcMode="spline"- dur="1.8s"- keySplines="0.3, 0.61, 0.355, 1"- keyTimes="0; 1"+ attributeName="stroke-dashoffset"+ dur="2s"+ keyTimes="0;1"repeatCount="indefinite"- values="1; 0"+ values="0;256.58892822265625"/>- </circle>- </g>- </svg>-);+ </path>+ </svg>+ );+}-const Bars = ({ size = 24, ...props }: SpinnerVariantProps) => (- <svg- height={size}- viewBox="0 0 24 24"- width={size}- xmlns="http://www.w3.org/2000/svg"- {...props}- >- <title>Loading...</title>- <style>{`- .spinner-bar {- animation: spinner-bars-animation .8s linear infinite;- animation-delay: -.8s;- }- .spinner-bars-2 {- animation-delay: -.65s;- }- .spinner-bars-3 {- animation-delay: -0.5s;- }- @keyframes spinner-bars-animation {- 0% {- y: 1px;- height: 22px;- }- 93.75% {- y: 5px;- height: 14px;- opacity: 0.2;- }- }- `}</style>- <rect- className="spinner-bar"- fill="currentColor"- height="22"- width="6"- x="1"- y="1"- />- <rect- className="spinner-bar spinner-bars-2"- fill="currentColor"- height="22"- width="6"- x="9"- y="1"- />- <rect- className="spinner-bar spinner-bars-3"- fill="currentColor"- height="22"- width="6"- x="17"- y="1"+function Pinwheel({ className, ...props }: SpinnerVariantProps) {+ return (+ <LoaderPinwheelIcon+ className={cn('animate-spin', className)}+ {...props}/>- </svg>-);+ );+}-const Infinite = ({ size = 24, ...props }: SpinnerVariantProps) => (- <svg- height={size}- preserveAspectRatio="xMidYMid"- viewBox="0 0 100 100"- width={size}- xmlns="http://www.w3.org/2000/svg"- {...props}- >- <title>Loading...</title>- <path- d="M24.3 30C11.4 30 5 43.3 5 50s6.4 20 19.3 20c19.3 0 32.1-40 51.4-40 C88.6 30 95 43.3 95 50s-6.4 20-19.3 20C56.4 70 43.6 30 24.3 30z"- fill="none"+function Ring({ size = 24, ...props }: SpinnerVariantProps) {+ return (+ <svg+ height={size}stroke="currentColor"- strokeDasharray="205.271142578125 51.317785644531256"- strokeLinecap="round"- strokeWidth="10"- style={{- transform: 'scale(0.8)',- transformOrigin: '50px 50px',- }}+ viewBox="0 0 44 44"+ width={size}+ xmlns="http://www.w3.org/2000/svg"+ {...props}>- <animate- attributeName="stroke-dashoffset"- dur="2s"- keyTimes="0;1"- repeatCount="indefinite"- values="0;256.58892822265625"- />- </path>- </svg>-);--export type SpinnerProps = LucideProps & {- variant?: 'bars' | 'circle' | 'circle-filled' | 'default' | 'ellipsis' | 'infinite' | 'pinwheel' | 'ring-3';-};--export const Spinner = ({ variant, ...props }: SpinnerProps) => {- switch (variant) {- case 'bars':- return <Bars {...props} />;- case 'circle':- return <Circle {...props} />;- case 'circle-filled':- return <CircleFilled {...props} />;- case 'ellipsis':- return <Ellipsis {...props} />;- case 'infinite':- return <Infinite {...props} />;- case 'pinwheel':- return <Pinwheel {...props} />;- case 'ring-3':- return <Ring {...props} />;- default:- return <Default {...props} />;- }-};+ <title>Loading...</title>+ <g+ fill="none"+ fillRule="evenodd"+ strokeWidth="2"+ >+ <circle+ cx="22"+ cy="22"+ r="1"+ >+ <animate+ attributeName="r"+ begin="0s"+ calcMode="spline"+ dur="1.8s"+ keySplines="0.165, 0.84, 0.44, 1"+ keyTimes="0; 1"+ repeatCount="indefinite"+ values="1; 20"+ />+ <animate+ attributeName="stroke-opacity"+ begin="0s"+ calcMode="spline"+ dur="1.8s"+ keySplines="0.3, 0.61, 0.355, 1"+ keyTimes="0; 1"+ repeatCount="indefinite"+ values="1; 0"+ />+ </circle>+ <circle+ cx="22"+ cy="22"+ r="1"+ >+ <animate+ attributeName="r"+ begin="-0.9s"+ calcMode="spline"+ dur="1.8s"+ keySplines="0.165, 0.84, 0.44, 1"+ keyTimes="0; 1"+ repeatCount="indefinite"+ values="1; 20"+ />+ <animate+ attributeName="stroke-opacity"+ begin="-0.9s"+ calcMode="spline"+ dur="1.8s"+ keySplines="0.3, 0.61, 0.355, 1"+ keyTimes="0; 1"+ repeatCount="indefinite"+ values="1; 0"+ />+ </circle>+ </g>+ </svg>+ );+}diff --git a/frontend/src/components/ui/textarea.tsx b/frontend/src/components/ui/textarea.tsxindex 438aa09b..59bf1735 100644--- a/frontend/src/components/ui/textarea.tsx+++ b/frontend/src/components/ui/textarea.tsx@@ -3,45 +3,6 @@ import { useImperativeHandle } from 'react';import { cn } from '@/lib/utils';-interface UseTextareaProps {- maxHeight?: number;- minHeight?: number;- textareaRef: React.MutableRefObject<HTMLTextAreaElement | null>;- triggerAutoSize: string;-}--const useTextarea = ({- maxHeight = Number.MAX_SAFE_INTEGER,- minHeight = 0,- textareaRef,- triggerAutoSize,-}: UseTextareaProps) => {- const initRef = React.useRef(true);-- React.useEffect(() => {- const offsetBorder = 0;- const textareaElement = textareaRef.current;-- if (!textareaElement) {- return;- }-- if (initRef.current) {- textareaElement.style.minHeight = `${minHeight + offsetBorder}px`;-- if (maxHeight > minHeight) {- textareaElement.style.maxHeight = `${maxHeight}px`;- }-- initRef.current = false;- }-- textareaElement.style.height = `${minHeight + offsetBorder}px`;- const scrollHeight = textareaElement.scrollHeight;- textareaElement.style.height = scrollHeight > maxHeight ? `${maxHeight}px` : `${scrollHeight + offsetBorder}px`;- }, [triggerAutoSize, maxHeight, minHeight, textareaRef]);-};-type TextareaProps = React.ComponentProps<'textarea'> & {maxHeight?: number;minHeight?: number;@@ -53,6 +14,13 @@ type TextareaRef = {textarea: HTMLTextAreaElement;};+interface UseTextareaProps {+ maxHeight?: number;+ minHeight?: number;+ textareaRef: React.MutableRefObject<HTMLTextAreaElement | null>;+ triggerAutoSize: string;+}+function Textarea({className,maxHeight = 118,@@ -101,4 +69,36 @@ function Textarea({);}+function useTextarea({+ maxHeight = Number.MAX_SAFE_INTEGER,+ minHeight = 0,+ textareaRef,+ triggerAutoSize,+}: UseTextareaProps) {+ const initRef = React.useRef(true);++ React.useEffect(() => {+ const offsetBorder = 0;+ const textareaElement = textareaRef.current;++ if (!textareaElement) {+ return;+ }++ if (initRef.current) {+ textareaElement.style.minHeight = `${minHeight + offsetBorder}px`;++ if (maxHeight > minHeight) {+ textareaElement.style.maxHeight = `${maxHeight}px`;+ }++ initRef.current = false;+ }++ textareaElement.style.height = `${minHeight + offsetBorder}px`;+ const scrollHeight = textareaElement.scrollHeight;+ textareaElement.style.height = scrollHeight > maxHeight ? `${maxHeight}px` : `${scrollHeight + offsetBorder}px`;+ }, [triggerAutoSize, maxHeight, minHeight, textareaRef]);+}+export { Textarea };diff --git a/frontend/src/features/authentication/login-form.tsx b/frontend/src/features/authentication/login-form.tsxindex c257c83a..98e6ac96 100644--- a/frontend/src/features/authentication/login-form.tsx+++ b/frontend/src/features/authentication/login-form.tsx@@ -60,7 +60,7 @@ interface LoginFormProps {returnUrl?: string;}-const LoginForm = ({ providers, returnUrl = '/flows/new' }: LoginFormProps) => {+function LoginForm({ providers, returnUrl = '/flows/new' }: LoginFormProps) {const form = useForm<z.infer<typeof formSchema>>({defaultValues: {mail: '',@@ -262,6 +262,6 @@ const LoginForm = ({ providers, returnUrl = '/flows/new' }: LoginFormProps) => {</form></Form>);-};+}export default LoginForm;diff --git a/frontend/src/features/flows/agents/flow-agent-icon.tsx b/frontend/src/features/flows/agents/flow-agent-icon.tsxindex 52332b7e..a3cea3b8 100644--- a/frontend/src/features/flows/agents/flow-agent-icon.tsx+++ b/frontend/src/features/flows/agents/flow-agent-icon.tsx@@ -48,7 +48,7 @@ const icons: Record<AgentType, LucideIcon> = {};const defaultIcon = HelpCircle;-const FlowAgentIcon = ({ className, type, tooltip = type }: FlowAgentIconProps) => {+function FlowAgentIcon({ className, type, tooltip = type }: FlowAgentIconProps) {const Icon = type ? icons[type] || defaultIcon : defaultIcon;const iconElement = <Icon className={cn('size-3 shrink-0', className)} />;@@ -62,6 +62,6 @@ const FlowAgentIcon = ({ className, type, tooltip = type }: FlowAgentIconProps)<TooltipContent>{formatName(tooltip)}</TooltipContent></Tooltip>);-};+}export default FlowAgentIcon;diff --git a/frontend/src/features/flows/agents/flow-agent.tsx b/frontend/src/features/flows/agents/flow-agent.tsxindex 47d89f56..f0e97764 100644--- a/frontend/src/features/flows/agents/flow-agent.tsx+++ b/frontend/src/features/flows/agents/flow-agent.tsx@@ -26,7 +26,7 @@ const containsSearchValue = (text: null | string | undefined, searchValue: strinreturn text.toLowerCase().includes(searchValue.toLowerCase().trim());};-const FlowAgent = ({ log, searchValue = '' }: FlowAgentProps) => {+function FlowAgent({ log, searchValue = '' }: FlowAgentProps) {const { createdAt, executor, initiator, result, subtaskId, task, taskId } = log;// Memoize search checks to avoid recalculating on every render@@ -147,6 +147,6 @@ const FlowAgent = ({ log, searchValue = '' }: FlowAgentProps) => {</div></div>);-};+}export default memo(FlowAgent);diff --git a/frontend/src/features/flows/agents/flow-agents.tsx b/frontend/src/features/flows/agents/flow-agents.tsxindex f94b9ecb..0216b367 100644--- a/frontend/src/features/flows/agents/flow-agents.tsx+++ b/frontend/src/features/flows/agents/flow-agents.tsx@@ -25,7 +25,7 @@ const searchFormSchema = z.object({search: z.string(),});-const FlowAgents = () => {+function FlowAgents() {const { flowData, flowId } = useFlow();const logs = useMemo(() => flowData?.agentLogs ?? [], [flowData?.agentLogs]);@@ -265,6 +265,6 @@ const FlowAgents = () => {)}</div>);-};+}export default FlowAgents;diff --git a/frontend/src/features/flows/dashboard/flow-dashboard-overview.tsx b/frontend/src/features/flows/dashboard/flow-dashboard-overview.tsxindex d70e09a7..b090e50a 100644--- a/frontend/src/features/flows/dashboard/flow-dashboard-overview.tsx+++ b/frontend/src/features/flows/dashboard/flow-dashboard-overview.tsx@@ -19,28 +19,7 @@ import {} from '@/graphql/types';import { formatCost, formatDuration, formatNumber, formatTokenCount } from '@/lib/utils/format';-const UsageStatsRow = ({ label, stats }: { label: string; stats: UsageStatsFragmentFragment }) => (- <TableRow>- <TableCell className="font-medium">{label}</TableCell>- <TableCell className="text-right">{formatTokenCount(stats.totalUsageIn)}</TableCell>- <TableCell className="text-right">{formatTokenCount(stats.totalUsageOut)}</TableCell>- <TableCell className="text-right">{formatTokenCount(stats.totalUsageCacheIn)}</TableCell>- <TableCell className="text-right">{formatTokenCount(stats.totalUsageCacheOut)}</TableCell>- <TableCell className="text-right">{formatCost(stats.totalUsageCostIn)}</TableCell>- <TableCell className="text-right">{formatCost(stats.totalUsageCostOut)}</TableCell>- <TableCell className="text-right font-semibold">- {formatCost(stats.totalUsageCostIn + stats.totalUsageCostOut)}- </TableCell>- </TableRow>-);--const LoadingTable = () => (- <div className="flex items-center justify-center py-8">- <Loader2 className="text-muted-foreground size-6 animate-spin" />- </div>-);--export const FlowDashboardOverview = ({ flowId }: { flowId: string }) => {+export function FlowDashboardOverview({ flowId }: { flowId: string }) {const { data: usageData, loading: usageLoading } = useUsageStatsByFlowQuery({variables: { flowId },});@@ -316,4 +295,29 @@ export const FlowDashboardOverview = ({ flowId }: { flowId: string }) => {)}</div>);-};+}++function LoadingTable() {+ return (+ <div className="flex items-center justify-center py-8">+ <Loader2 className="text-muted-foreground size-6 animate-spin" />+ </div>+ );+}++function UsageStatsRow({ label, stats }: { label: string; stats: UsageStatsFragmentFragment }) {+ return (+ <TableRow>+ <TableCell className="font-medium">{label}</TableCell>+ <TableCell className="text-right">{formatTokenCount(stats.totalUsageIn)}</TableCell>+ <TableCell className="text-right">{formatTokenCount(stats.totalUsageOut)}</TableCell>+ <TableCell className="text-right">{formatTokenCount(stats.totalUsageCacheIn)}</TableCell>+ <TableCell className="text-right">{formatTokenCount(stats.totalUsageCacheOut)}</TableCell>+ <TableCell className="text-right">{formatCost(stats.totalUsageCostIn)}</TableCell>+ <TableCell className="text-right">{formatCost(stats.totalUsageCostOut)}</TableCell>+ <TableCell className="text-right font-semibold">+ {formatCost(stats.totalUsageCostIn + stats.totalUsageCostOut)}+ </TableCell>+ </TableRow>+ );+}diff --git a/frontend/src/features/flows/dashboard/flow-dashboard.tsx b/frontend/src/features/flows/dashboard/flow-dashboard.tsxindex 561bc4d0..3f181b6e 100644--- a/frontend/src/features/flows/dashboard/flow-dashboard.tsx+++ b/frontend/src/features/flows/dashboard/flow-dashboard.tsx@@ -2,7 +2,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';import { FlowDashboardOverview } from '@/features/flows/dashboard/flow-dashboard-overview';import { useFlow } from '@/providers/flow-provider';-const FlowDashboard = () => {+function FlowDashboard() {const { flowId } = useFlow();if (!flowId) {@@ -24,6 +24,6 @@ const FlowDashboard = () => {</TabsContent></Tabs>);-};+}export default FlowDashboard;diff --git a/frontend/src/features/flows/files/flow-files-attach-resources-dialog.tsx b/frontend/src/features/flows/files/flow-files-attach-resources-dialog.tsxindex 941b806c..d0cc5899 100644--- a/frontend/src/features/flows/files/flow-files-attach-resources-dialog.tsx+++ b/frontend/src/features/flows/files/flow-files-attach-resources-dialog.tsx@@ -46,12 +46,42 @@ interface FlowFilesAttachResourcesDialogProps {const EMPTY_SELECTION: ReadonlySet<string> = new Set();-const FlowFilesAttachResourcesDialogBody = ({+export function FlowFilesAttachResourcesDialog({+ cachedFiles,+ flowId,+ isOpen,+ onClose,+ onSuccess,+}: FlowFilesAttachResourcesDialogProps) {+ const handleDialogOpenChange = (nextOpen: boolean) => {+ if (!nextOpen) {+ onClose();+ }+ };++ return (+ <Dialog+ onOpenChange={handleDialogOpenChange}+ open={isOpen}+ >+ {isOpen && (+ <FlowFilesAttachResourcesDialogBody+ cachedFiles={cachedFiles}+ flowId={flowId}+ onClose={onClose}+ onSuccess={onSuccess}+ />+ )}+ </Dialog>+ );+}++function FlowFilesAttachResourcesDialogBody({cachedFiles,flowId,onClose,onSuccess,-}: Omit<FlowFilesAttachResourcesDialogProps, 'isOpen'>) => {+}: Omit<FlowFilesAttachResourcesDialogProps, 'isOpen'>) {const { error: resourcesError, isInitialLoading: isResourcesLoading, resources } = useResources();const { attach, isAttaching } = useFlowFilesAttachResources({ flowId });@@ -271,36 +301,6 @@ const FlowFilesAttachResourcesDialogBody = ({/></>);-};--export const FlowFilesAttachResourcesDialog = ({- cachedFiles,- flowId,- isOpen,- onClose,- onSuccess,-}: FlowFilesAttachResourcesDialogProps) => {- const handleDialogOpenChange = (nextOpen: boolean) => {- if (!nextOpen) {- onClose();- }- };-- return (- <Dialog- onOpenChange={handleDialogOpenChange}- open={isOpen}- >- {isOpen && (- <FlowFilesAttachResourcesDialogBody- cachedFiles={cachedFiles}- flowId={flowId}- onClose={onClose}- onSuccess={onSuccess}- />- )}- </Dialog>- );-};+}export type { FlowFilesAttachResourcesDialogProps };diff --git a/frontend/src/features/flows/files/flow-files-promote-dialog.tsx b/frontend/src/features/flows/files/flow-files-promote-dialog.tsxindex 7c1f2c1e..cd4e336d 100644--- a/frontend/src/features/flows/files/flow-files-promote-dialog.tsx+++ b/frontend/src/features/flows/files/flow-files-promote-dialog.tsx@@ -107,7 +107,34 @@ const buildPromotePlan = (targets: computeTargets(files, values.destination),});-const FlowFilesPromoteDialogForm = ({ files, flowId, onClose }: FlowFilesPromoteDialogFormProps) => {+export function FlowFilesPromoteDialog({ files, flowId, onClose }: FlowFilesPromoteDialogProps) {+ const handleDialogOpenChange = (nextOpen: boolean) => {+ if (!nextOpen) {+ onClose();+ }+ };++ // Narrow to a non-empty tuple so the inner form can index `files[0]` without+ // optional-chain noise. The Dialog only mounts when this guard passes.+ const nonEmptyFiles = files && files.length > 0 ? (files as [FileNode, ...FileNode[]]) : null;++ return (+ <Dialog+ onOpenChange={handleDialogOpenChange}+ open={!!nonEmptyFiles}+ >+ {nonEmptyFiles && (+ <FlowFilesPromoteDialogForm+ files={nonEmptyFiles}+ flowId={flowId}+ onClose={onClose}+ />+ )}+ </Dialog>+ );+}++function FlowFilesPromoteDialogForm({ files, flowId, onClose }: FlowFilesPromoteDialogFormProps) {const { isPromoting, promote } = useFlowFilesPromote({ flowId });const { resources } = useResources();const isMulti = files.length > 1;@@ -257,31 +284,4 @@ const FlowFilesPromoteDialogForm = ({ files, flowId, onClose }: FlowFilesPromote/></>);-};--export const FlowFilesPromoteDialog = ({ files, flowId, onClose }: FlowFilesPromoteDialogProps) => {- const handleDialogOpenChange = (nextOpen: boolean) => {- if (!nextOpen) {- onClose();- }- };-- // Narrow to a non-empty tuple so the inner form can index `files[0]` without- // optional-chain noise. The Dialog only mounts when this guard passes.- const nonEmptyFiles = files && files.length > 0 ? (files as [FileNode, ...FileNode[]]) : null;-- return (- <Dialog- onOpenChange={handleDialogOpenChange}- open={!!nonEmptyFiles}- >- {nonEmptyFiles && (- <FlowFilesPromoteDialogForm- files={nonEmptyFiles}- flowId={flowId}- onClose={onClose}- />- )}- </Dialog>- );-};+}diff --git a/frontend/src/features/flows/files/flow-files-pull-dialog.tsx b/frontend/src/features/flows/files/flow-files-pull-dialog.tsxindex 744bbc90..1002c8ac 100644--- a/frontend/src/features/flows/files/flow-files-pull-dialog.tsx+++ b/frontend/src/features/flows/files/flow-files-pull-dialog.tsx@@ -90,6 +90,30 @@ const getParentContainerPath = (path: string): string => {return path.slice(0, idx);};+export function FlowFilesPullDialog({ cachedFiles, flowId, isOpen, onClose, onSuccess }: FlowFilesPullDialogProps) {+ const handleDialogOpenChange = (nextOpen: boolean) => {+ if (!nextOpen) {+ onClose();+ }+ };++ return (+ <Dialog+ onOpenChange={handleDialogOpenChange}+ open={isOpen}+ >+ {isOpen && (+ <FlowFilesPullDialogForm+ cachedFiles={cachedFiles}+ flowId={flowId}+ onClose={onClose}+ onSuccess={onSuccess}+ />+ )}+ </Dialog>+ );+}+/*** Inner component holding the live browser state. Mounted only while the dialog* is open so closing it discards every transient field without an imperative reset.@@ -98,7 +122,7 @@ const getParentContainerPath = (path: string): string => {* fallback) is delegated to {@link useOverwrite}; this component only* owns the listing browser UI and the per-action plan derivation.*/-const FlowFilesPullDialogForm = ({ cachedFiles, flowId, onClose, onSuccess }: FlowFilesPullDialogFormProps) => {+function FlowFilesPullDialogForm({ cachedFiles, flowId, onClose, onSuccess }: FlowFilesPullDialogFormProps) {const [currentPath, setCurrentPath] = useState<string>(CONTAINER_DEFAULT_PATH);const [pathInputValue, setPathInputValue] = useState<string>(CONTAINER_DEFAULT_PATH);const [selectedPaths, setSelectedPaths] = useState<ReadonlySet<string>>(() => new Set<string>());@@ -451,28 +475,4 @@ const FlowFilesPullDialogForm = ({ cachedFiles, flowId, onClose, onSuccess }: Fl/></>);-};--export const FlowFilesPullDialog = ({ cachedFiles, flowId, isOpen, onClose, onSuccess }: FlowFilesPullDialogProps) => {- const handleDialogOpenChange = (nextOpen: boolean) => {- if (!nextOpen) {- onClose();- }- };-- return (- <Dialog- onOpenChange={handleDialogOpenChange}- open={isOpen}- >- {isOpen && (- <FlowFilesPullDialogForm- cachedFiles={cachedFiles}- flowId={flowId}- onClose={onClose}- onSuccess={onSuccess}- />- )}- </Dialog>- );-};+}diff --git a/frontend/src/features/flows/files/flow-files.tsx b/frontend/src/features/flows/files/flow-files.tsxindex cb7f6185..5a640980 100644--- a/frontend/src/features/flows/files/flow-files.tsx+++ b/frontend/src/features/flows/files/flow-files.tsx@@ -37,7 +37,7 @@ import { useFlowFilesRealtime } from './use-flow-files-realtime';import { useFlowFilesSearch } from './use-flow-files-search';import { useFlowFilesUpload } from './use-flow-files-upload';-const FlowFiles = () => {+function FlowFiles() {const { flowId, flowStatus } = useFlow();const [isPullDialogOpen, setIsPullDialogOpen] = useState(false);const [isAttachResourcesDialogOpen, setIsAttachResourcesDialogOpen] = useState(false);@@ -367,6 +367,6 @@ const FlowFiles = () => {/></div>);-};+}export default FlowFiles;diff --git a/frontend/src/features/flows/files/use-flow-container-files.ts b/frontend/src/features/flows/files/use-flow-container-files.tsindex ee283e81..a38b3ace 100644--- a/frontend/src/features/flows/files/use-flow-container-files.ts+++ b/frontend/src/features/flows/files/use-flow-container-files.ts@@ -44,7 +44,7 @@ interface UseFlowContainerFilesResult {* When `flowId` is `null` or `paths` is empty, the hook idles: no request* is issued, `files` stays an empty array, `isLoading` stays `false`.*/-export const useFlowContainerFiles = ({ flowId, paths }: UseFlowContainerFilesParams): UseFlowContainerFilesResult => {+export function useFlowContainerFiles({ flowId, paths }: UseFlowContainerFilesParams): UseFlowContainerFilesResult {const [files, setFiles] = useState<FileNode[]>([]);const [isLoading, setIsLoading] = useState(false);const [error, setError] = useState<Error | null>(null);@@ -120,4 +120,4 @@ export const useFlowContainerFiles = ({ flowId, paths }: UseFlowContainerFilesPaisLoading,refetch: fetchListing,};-};+}diff --git a/frontend/src/features/flows/files/use-flow-files-attach-resources.ts b/frontend/src/features/flows/files/use-flow-files-attach-resources.tsindex f276e491..e9ebd446 100644--- a/frontend/src/features/flows/files/use-flow-files-attach-resources.ts+++ b/frontend/src/features/flows/files/use-flow-files-attach-resources.ts@@ -32,10 +32,10 @@ interface UseFlowFilesAttachResourcesResult {* so callers can branch between success, a 409 conflict that warrants a user* prompt, and any other failure (already toasted).*/-export const useFlowFilesAttachResources = ({+export function useFlowFilesAttachResources({flowId,onSuccess,-}: UseFlowFilesAttachResourcesParams): UseFlowFilesAttachResourcesResult => {+}: UseFlowFilesAttachResourcesParams): UseFlowFilesAttachResourcesResult {const [isAttaching, setIsAttaching] = useState(false);const attach = useCallback(@@ -97,4 +97,4 @@ export const useFlowFilesAttachResources = ({attach,isAttaching,};-};+}diff --git a/frontend/src/features/flows/files/use-flow-files-data.ts b/frontend/src/features/flows/files/use-flow-files-data.tsindex 86fbdc2e..72b37c3d 100644--- a/frontend/src/features/flows/files/use-flow-files-data.ts+++ b/frontend/src/features/flows/files/use-flow-files-data.ts@@ -26,7 +26,7 @@ const FLOW_FILES_ERROR_TOAST_ID = 'flow-files-error';* it stays `true` only while the very first response is in flight (no cached data* yet), so subsequent background `refetch` calls do not flash the skeleton.*/-export const useFlowFilesData = ({ flowId }: UseFlowFilesDataParams): UseFlowFilesDataResult => {+export function useFlowFilesData({ flowId }: UseFlowFilesDataParams): UseFlowFilesDataResult {const flowFilesVariables = useMemo(() => ({ flowId: flowId ?? '' }), [flowId]);const {@@ -63,4 +63,4 @@ export const useFlowFilesData = ({ flowId }: UseFlowFilesDataParams): UseFlowFilisLoading,refetchFiles,};-};+}diff --git a/frontend/src/features/flows/files/use-flow-files-delete.ts b/frontend/src/features/flows/files/use-flow-files-delete.tsindex 898c161f..d482ab1d 100644--- a/frontend/src/features/flows/files/use-flow-files-delete.ts+++ b/frontend/src/features/flows/files/use-flow-files-delete.ts@@ -54,7 +54,7 @@ const deleteFlowFilesRequest = (flowId: string, paths: readonly string[]) =>* No imperative refetch is performed: the GraphQL `flowFileDeleted` subscription* is wired into the Apollo cache and removes the deleted entries automatically.*/-export const useFlowFilesDelete = ({ flowId, onAfterDelete }: UseFlowFilesDeleteParams): UseFlowFilesDeleteResult => {+export function useFlowFilesDelete({ flowId, onAfterDelete }: UseFlowFilesDeleteParams): UseFlowFilesDeleteResult {const [fileToDelete, setFileToDelete] = useState<FileNode | null>(null);const requestDelete = useCallback((file: FileNode) => {@@ -113,4 +113,4 @@ export const useFlowFilesDelete = ({ flowId, onAfterDelete }: UseFlowFilesDeletefileToDelete,requestDelete,};-};+}diff --git a/frontend/src/features/flows/files/use-flow-files-promote.ts b/frontend/src/features/flows/files/use-flow-files-promote.tsindex 32ccacbb..8940468a 100644--- a/frontend/src/features/flows/files/use-flow-files-promote.ts+++ b/frontend/src/features/flows/files/use-flow-files-promote.ts@@ -52,7 +52,7 @@ interface UseFlowFilesPromoteResult {* Wraps the "promote flow file → user resource" REST call (`POST /files/to-resources`)* with toast notifications and a loading flag.*/-export const useFlowFilesPromote = ({ flowId }: UseFlowFilesPromoteParams): UseFlowFilesPromoteResult => {+export function useFlowFilesPromote({ flowId }: UseFlowFilesPromoteParams): UseFlowFilesPromoteResult {const [isPromoting, setIsPromoting] = useState(false);const promote = useCallback(@@ -103,4 +103,4 @@ export const useFlowFilesPromote = ({ flowId }: UseFlowFilesPromoteParams): UseFisPromoting,promote,};-};+}diff --git a/frontend/src/features/flows/files/use-flow-files-pull.ts b/frontend/src/features/flows/files/use-flow-files-pull.tsindex 5ddf32f9..e8dfd331 100644--- a/frontend/src/features/flows/files/use-flow-files-pull.ts+++ b/frontend/src/features/flows/files/use-flow-files-pull.ts@@ -30,7 +30,7 @@ interface UseFlowFilesPullResult {* always sends the array as `paths` in the body (single-path callers just pass* a 1-element array), matching the wire shape the rest of our file APIs use.*/-export const useFlowFilesPull = ({ flowId, onSuccess }: UseFlowFilesPullParams): UseFlowFilesPullResult => {+export function useFlowFilesPull({ flowId, onSuccess }: UseFlowFilesPullParams): UseFlowFilesPullResult {const [isPulling, setIsPulling] = useState(false);const pull = useCallback(@@ -85,4 +85,4 @@ export const useFlowFilesPull = ({ flowId, onSuccess }: UseFlowFilesPullParams):isPulling,pull,};-};+}diff --git a/frontend/src/features/flows/files/use-flow-files-realtime.ts b/frontend/src/features/flows/files/use-flow-files-realtime.tsindex 3702c9cc..5235f7de 100644--- a/frontend/src/features/flows/files/use-flow-files-realtime.ts+++ b/frontend/src/features/flows/files/use-flow-files-realtime.ts@@ -21,11 +21,11 @@ interface UseFlowFilesRealtimeParams {* call so the parent component does not need to repeat the same `skip`/`variables` pair* three times.*/-export const useFlowFilesRealtime = ({ flowId, isPaused }: UseFlowFilesRealtimeParams): void => {+export function useFlowFilesRealtime({ flowId, isPaused }: UseFlowFilesRealtimeParams): void {const variables = useMemo(() => ({ flowId: flowId ?? '' }), [flowId]);const isSkipped = isPaused || !flowId;useFlowFileAddedSubscription({ skip: isSkipped, variables });useFlowFileUpdatedSubscription({ skip: isSkipped, variables });useFlowFileDeletedSubscription({ skip: isSkipped, variables });-};+}diff --git a/frontend/src/features/flows/files/use-flow-files-search.ts b/frontend/src/features/flows/files/use-flow-files-search.tsindex 113f293d..b92520bf 100644--- a/frontend/src/features/flows/files/use-flow-files-search.ts+++ b/frontend/src/features/flows/files/use-flow-files-search.ts@@ -27,7 +27,7 @@ interface UseFlowFilesSearchResult {* remount the subtree (via `key={flowId}` on the surrounding component) when the* flow changes, which clears form state without an imperative effect.*/-export const useFlowFilesSearch = (): UseFlowFilesSearchResult => {+export function useFlowFilesSearch(): UseFlowFilesSearchResult {const form = useForm<FlowFilesSearchFormValues>({defaultValues: { search: '' },resolver: zodResolver(flowFilesSearchFormSchema),@@ -46,4 +46,4 @@ export const useFlowFilesSearch = (): UseFlowFilesSearchResult => {rawQuery,resetSearch,};-};+}diff --git a/frontend/src/features/flows/files/use-flow-files-upload.ts b/frontend/src/features/flows/files/use-flow-files-upload.tsindex dec6a79a..334f1be9 100644--- a/frontend/src/features/flows/files/use-flow-files-upload.ts+++ b/frontend/src/features/flows/files/use-flow-files-upload.ts@@ -55,7 +55,7 @@ const buildUploadSuccessMessage = (uploadedCount: number, firstFileName?: string* is wired into the Apollo cache (see `lib/apollo.ts`) and appends the newly* uploaded entries automatically.*/-export const useFlowFilesUpload = ({ flowId }: UseFlowFilesUploadParams): UseFlowFilesUploadResult => {+export function useFlowFilesUpload({ flowId }: UseFlowFilesUploadParams): UseFlowFilesUploadResult {const inputRef = useRef<HTMLInputElement | null>(null);const [isUploading, setIsUploading] = useState(false);const [fileInputKey, setFileInputKey] = useState(0);@@ -134,4 +134,4 @@ export const useFlowFilesUpload = ({ flowId }: UseFlowFilesUploadParams): UseFloopenFilePicker,uploadFiles,};-};+}diff --git a/frontend/src/features/flows/flow-central-tabs.tsx b/frontend/src/features/flows/flow-central-tabs.tsxindex 848d3d29..f32a350d 100644--- a/frontend/src/features/flows/flow-central-tabs.tsx+++ b/frontend/src/features/flows/flow-central-tabs.tsx@@ -5,7 +5,7 @@ import FlowAssistantMessages from '@/features/flows/messages/flow-assistant-messimport FlowAutomationMessages from '@/features/flows/messages/flow-automation-messages';import { useFlowTabDetection } from '@/hooks/use-flow-tab-detection';-const FlowCentralTabs = () => {+function FlowCentralTabs() {const { handleTabChange, resolvedTab } = useFlowTabDetection();return (@@ -45,6 +45,6 @@ const FlowCentralTabs = () => {</TabsContent></Tabs>);-};+}export default FlowCentralTabs;diff --git a/frontend/src/features/flows/flow-form.tsx b/frontend/src/features/flows/flow-form.tsxindex 410b88f4..f52d0414 100644--- a/frontend/src/features/flows/flow-form.tsx+++ b/frontend/src/features/flows/flow-form.tsx@@ -70,7 +70,7 @@ export interface FlowFormProps {export type FlowFormValues = z.infer<typeof formSchema>;-export const FlowForm = ({+export function FlowForm({defaultValues,isCanceling,isDisabled,@@ -81,7 +81,7 @@ export const FlowForm = ({onSubmit,placeholder = 'Describe what you would like PentAGI to test...',type,-}: FlowFormProps) => {+}: FlowFormProps) {const { providers, setSelectedProvider } = useProviders();const { templates } = useTemplates();const { resources } = useResources();@@ -813,4 +813,4 @@ export const FlowForm = ({/></Form>);-};+}diff --git a/frontend/src/features/flows/flow-tabs.tsx b/frontend/src/features/flows/flow-tabs.tsxindex 6d911b0a..e910d559 100644--- a/frontend/src/features/flows/flow-tabs.tsx+++ b/frontend/src/features/flows/flow-tabs.tsx@@ -19,7 +19,7 @@ interface FlowTabsProps {onTabChange: (tab: string) => void;}-const FlowTabs = ({ activeTab, onTabChange }: FlowTabsProps) => {+function FlowTabs({ activeTab, onTabChange }: FlowTabsProps) {const { isDesktop } = useBreakpoint();const previousActiveTabRef = useRef<string>(activeTab);@@ -134,6 +134,6 @@ const FlowTabs = ({ activeTab, onTabChange }: FlowTabsProps) => {</TabsContent></Tabs>);-};+}export default FlowTabs;diff --git a/frontend/src/features/flows/flow-tasks-dropdown.tsx b/frontend/src/features/flows/flow-tasks-dropdown.tsxindex 98bac981..cf338273 100644--- a/frontend/src/features/flows/flow-tasks-dropdown.tsx+++ b/frontend/src/features/flows/flow-tasks-dropdown.tsx@@ -26,7 +26,7 @@ interface FlowTasksDropdownProps {value?: FlowTasksDropdownValue;}-const FlowTasksDropdown = ({ disabled, onChange, value }: FlowTasksDropdownProps) => {+function FlowTasksDropdown({ disabled, onChange, value }: FlowTasksDropdownProps) {const { flowData } = useFlow();const tasks = useMemo(() => flowData?.tasks ?? [], [flowData?.tasks]);const [isOpen, setIsOpen] = useState(false);@@ -225,6 +225,6 @@ const FlowTasksDropdown = ({ disabled, onChange, value }: FlowTasksDropdownProps</PopoverContent></Popover>);-};+}export default FlowTasksDropdown;diff --git a/frontend/src/features/flows/messages/flow-assistant-messages.tsx b/frontend/src/features/flows/messages/flow-assistant-messages.tsxindex 8cfd9032..c21ebab6 100644--- a/frontend/src/features/flows/messages/flow-assistant-messages.tsx+++ b/frontend/src/features/flows/messages/flow-assistant-messages.tsx@@ -40,7 +40,11 @@ interface AssistantsDropdownProps {selectedAssistantId: null | string;}-const AssistantsDropdown = ({+interface FlowAssistantMessagesProps {+ className?: string;+}++function AssistantsDropdown({assistants,isAssistantCreating,isDisabled,@@ -49,7 +53,7 @@ const AssistantsDropdown = ({onAssistantSelect,providers,selectedAssistantId,-}: AssistantsDropdownProps) => {+}: AssistantsDropdownProps) {const [isOpen, setIsOpen] = useState(false);const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);const [currentAssistant, setCurrentAssistant] = useState<AssistantFragmentFragment | null>(null);@@ -272,17 +276,13 @@ const AssistantsDropdown = ({/></>);-};--interface FlowAssistantMessagesProps {- className?: string;}const searchFormSchema = z.object({search: z.string(),});-const FlowAssistantMessages = ({ className }: FlowAssistantMessagesProps) => {+function FlowAssistantMessages({ className }: FlowAssistantMessagesProps) {const { providers } = useProviders();const {@@ -685,6 +685,6 @@ const FlowAssistantMessages = ({ className }: FlowAssistantMessagesProps) => {</div></div>);-};+}export default FlowAssistantMessages;diff --git a/frontend/src/features/flows/messages/flow-automation-messages.tsx b/frontend/src/features/flows/messages/flow-automation-messages.tsxindex 800ccc21..56713aad 100644--- a/frontend/src/features/flows/messages/flow-automation-messages.tsx+++ b/frontend/src/features/flows/messages/flow-automation-messages.tsx@@ -32,7 +32,7 @@ const searchFormSchema = z.object({search: z.string(),});-const FlowAutomationMessages = ({ className }: FlowAutomationMessagesProps) => {+function FlowAutomationMessages({ className }: FlowAutomationMessagesProps) {const { flowData, flowId, flowStatus, stopAutomation, submitAutomationMessage } = useFlow();const logs = useMemo(() => flowData?.messageLogs ?? [], [flowData?.messageLogs]);@@ -347,6 +347,6 @@ const FlowAutomationMessages = ({ className }: FlowAutomationMessagesProps) => {</div></div>);-};+}export default FlowAutomationMessages;diff --git a/frontend/src/features/flows/messages/flow-message-type-icon.tsx b/frontend/src/features/flows/messages/flow-message-type-icon.tsxindex cf310900..b74c9c17 100644--- a/frontend/src/features/flows/messages/flow-message-type-icon.tsx+++ b/frontend/src/features/flows/messages/flow-message-type-icon.tsx@@ -40,7 +40,7 @@ const messageTypeIcons: Record<MessageLogType, LucideIcon> = {};const defaultIcon = Brain;-const FlowMessageTypeIcon = ({ className, type, tooltip = type }: MessageTypeIconProps) => {+function FlowMessageTypeIcon({ className, type, tooltip = type }: MessageTypeIconProps) {const Icon = type ? messageTypeIcons[type] || defaultIcon : defaultIcon;const iconElement = <Icon className={cn('size-3 shrink-0', className)} />;@@ -54,6 +54,6 @@ const FlowMessageTypeIcon = ({ className, type, tooltip = type }: MessageTypeIco<TooltipContent>{formatName(tooltip)}</TooltipContent></Tooltip>);-};+}export default FlowMessageTypeIcon;diff --git a/frontend/src/features/flows/messages/flow-message.tsx b/frontend/src/features/flows/messages/flow-message.tsxindex 73dd3e5f..c18c8920 100644--- a/frontend/src/features/flows/messages/flow-message.tsx+++ b/frontend/src/features/flows/messages/flow-message.tsx@@ -27,7 +27,7 @@ const containsSearchValue = (text: null | string | undefined, searchValue: strinreturn text.toLowerCase().includes(searchValue.toLowerCase().trim());};-const FlowMessage = ({ log, searchValue = '' }: FlowMessageProps) => {+function FlowMessage({ log, searchValue = '' }: FlowMessageProps) {const { createdAt, message, result, resultFormat = ResultFormat.Plain, thinking, type } = log;const isReportMessage = type === MessageLogType.Report;@@ -223,6 +223,6 @@ const FlowMessage = ({ log, searchValue = '' }: FlowMessageProps) => {</div></div>);-};+}export default memo(FlowMessage);diff --git a/frontend/src/features/flows/screenshots/flow-screenshot.tsx b/frontend/src/features/flows/screenshots/flow-screenshot.tsxindex d0f811a9..30949c84 100644--- a/frontend/src/features/flows/screenshots/flow-screenshot.tsx+++ b/frontend/src/features/flows/screenshots/flow-screenshot.tsx@@ -14,7 +14,7 @@ interface FlowScreenshotProps {screenshot: ScreenshotFragmentFragment;}-const FlowScreenshot = ({ screenshot }: FlowScreenshotProps) => {+function FlowScreenshot({ screenshot }: FlowScreenshotProps) {const [isExpanded, setIsExpanded] = useState(false);const [isVisible, setIsVisible] = useState(false);const imageRef = useRef<HTMLDivElement>(null);@@ -94,6 +94,6 @@ const FlowScreenshot = ({ screenshot }: FlowScreenshotProps) => {</div></div>);-};+}export default memo(FlowScreenshot);diff --git a/frontend/src/features/flows/screenshots/flow-screenshots.tsx b/frontend/src/features/flows/screenshots/flow-screenshots.tsxindex 12f5e1f3..1c5e251a 100644--- a/frontend/src/features/flows/screenshots/flow-screenshots.tsx+++ b/frontend/src/features/flows/screenshots/flow-screenshots.tsx@@ -18,7 +18,7 @@ const searchFormSchema = z.object({search: z.string(),});-const FlowScreenshots = () => {+function FlowScreenshots() {const { flowData, flowId } = useFlow();const screenshots = useMemo(() => flowData?.screenshots ?? [], [flowData?.screenshots]);@@ -171,6 +171,6 @@ const FlowScreenshots = () => {)}</div>);-};+}export default FlowScreenshots;diff --git a/frontend/src/features/flows/tasks/flow-subtask.tsx b/frontend/src/features/flows/tasks/flow-subtask.tsxindex 703b5b52..02f07fbe 100644--- a/frontend/src/features/flows/tasks/flow-subtask.tsx+++ b/frontend/src/features/flows/tasks/flow-subtask.tsx@@ -22,7 +22,7 @@ const containsSearchValue = (text: null | string | undefined, searchValue: strinreturn text.toLowerCase().includes(searchValue.toLowerCase().trim());};-const FlowSubtask = ({ searchValue = '', subtask }: FlowSubtaskProps) => {+function FlowSubtask({ searchValue = '', subtask }: FlowSubtaskProps) {const { description, id, result, status, title } = subtask;const [isDetailsVisible, setIsDetailsVisible] = useState(false);const hasDetails = description || result;@@ -132,6 +132,6 @@ const FlowSubtask = ({ searchValue = '', subtask }: FlowSubtaskProps) => {<div className="absolute top-0 left-[calc((--spacing(2.5))-0.5px)] h-full border-l group-last:hidden"></div></div>);-};+}export default memo(FlowSubtask);diff --git a/frontend/src/features/flows/tasks/flow-task-status-icon.tsx b/frontend/src/features/flows/tasks/flow-task-status-icon.tsxindex b809aec2..63dfa9af 100644--- a/frontend/src/features/flows/tasks/flow-task-status-icon.tsx+++ b/frontend/src/features/flows/tasks/flow-task-status-icon.tsx@@ -22,7 +22,7 @@ const statusIcons: Record<StatusType, { className: string; icon: LucideIcon }> =};const defaultIcon = { className: 'text-muted-foreground', icon: CircleDashed };-const FlowTaskStatusIcon = ({ className, status, tooltip }: FlowTaskStatusIconProps) => {+function FlowTaskStatusIcon({ className, status, tooltip }: FlowTaskStatusIconProps) {const { className: defaultClassName, icon: Icon } = status ? statusIcons[status] || defaultIcon : defaultIcon;const iconElement = (<Icon className={cn('size-4 shrink-0', defaultClassName, tooltip && 'cursor-pointer', className)} />@@ -38,6 +38,6 @@ const FlowTaskStatusIcon = ({ className, status, tooltip }: FlowTaskStatusIconPr<TooltipContent>{formatName(tooltip)}</TooltipContent></Tooltip>);-};+}export default FlowTaskStatusIcon;diff --git a/frontend/src/features/flows/tasks/flow-task.tsx b/frontend/src/features/flows/tasks/flow-task.tsxindex 88675ae2..f1546e70 100644--- a/frontend/src/features/flows/tasks/flow-task.tsx+++ b/frontend/src/features/flows/tasks/flow-task.tsx@@ -24,7 +24,7 @@ const containsSearchValue = (text: null | string | undefined, searchValue: strinreturn text.toLowerCase().includes(searchValue.toLowerCase().trim());};-const FlowTask = ({ searchValue = '', task }: FlowTaskProps) => {+function FlowTask({ searchValue = '', task }: FlowTaskProps) {const { id, result, status, subtasks, title } = task;const [isDetailsVisible, setIsDetailsVisible] = useState(false);@@ -151,6 +151,6 @@ const FlowTask = ({ searchValue = '', task }: FlowTaskProps) => {)}</div>);-};+}export default memo(FlowTask);diff --git a/frontend/src/features/flows/tasks/flow-tasks.tsx b/frontend/src/features/flows/tasks/flow-tasks.tsxindex ab297091..60402554 100644--- a/frontend/src/features/flows/tasks/flow-tasks.tsx+++ b/frontend/src/features/flows/tasks/flow-tasks.tsx@@ -27,7 +27,7 @@ const containsSearchValue = (text: null | string | undefined, searchValue: strinreturn text.toLowerCase().includes(searchValue.toLowerCase().trim());};-const FlowTasks = () => {+function FlowTasks() {const { flowData, flowId } = useFlow();const tasks = useMemo(() => flowData?.tasks ?? [], [flowData?.tasks]);@@ -190,6 +190,6 @@ const FlowTasks = () => {)}</div>);-};+}export default FlowTasks;diff --git a/frontend/src/features/flows/terminal/flow-terminal.tsx b/frontend/src/features/flows/terminal/flow-terminal.tsxindex 43710e64..821049f5 100644--- a/frontend/src/features/flows/terminal/flow-terminal.tsx+++ b/frontend/src/features/flows/terminal/flow-terminal.tsx@@ -26,7 +26,7 @@ const searchFormSchema = z.object({search: z.string(),});-const FlowTerminal = () => {+function FlowTerminal() {const { flowData, flowId } = useFlow();const terminalLogs = useMemo(() => flowData?.terminalLogs ?? [], [flowData?.terminalLogs]);@@ -256,6 +256,6 @@ const FlowTerminal = () => {)}</div>);-};+}export default FlowTerminal;diff --git a/frontend/src/features/flows/tools/flow-tool.tsx b/frontend/src/features/flows/tools/flow-tool.tsxindex 2a4c6c50..78f38b4d 100644--- a/frontend/src/features/flows/tools/flow-tool.tsx+++ b/frontend/src/features/flows/tools/flow-tool.tsx@@ -23,7 +23,7 @@ const containsSearchValue = (text: null | string | undefined, searchValue: strinreturn text.toLowerCase().includes(searchValue.toLowerCase().trim());};-const FlowTool = ({ log, searchValue = '' }: FlowToolProps) => {+function FlowTool({ log, searchValue = '' }: FlowToolProps) {const { createdAt, engine, executor, initiator, query, result, subtaskId, taskId } = log;// Memoize search checks to avoid recalculating on every render@@ -148,6 +148,6 @@ const FlowTool = ({ log, searchValue = '' }: FlowToolProps) => {</div></div>);-};+}export default memo(FlowTool);diff --git a/frontend/src/features/flows/tools/flow-tools.tsx b/frontend/src/features/flows/tools/flow-tools.tsxindex 1f58eee5..80234f7f 100644--- a/frontend/src/features/flows/tools/flow-tools.tsx+++ b/frontend/src/features/flows/tools/flow-tools.tsx@@ -25,7 +25,7 @@ const searchFormSchema = z.object({search: z.string(),});-const FlowTools = () => {+function FlowTools() {const { flowData, flowId } = useFlow();const logs = useMemo(() => flowData?.searchLogs ?? [], [flowData?.searchLogs]);@@ -268,6 +268,6 @@ const FlowTools = () => {)}</div>);-};+}export default FlowTools;diff --git a/frontend/src/features/flows/use-flow-detail-navigation.ts b/frontend/src/features/flows/use-flow-detail-navigation.tsindex 3b0cd1c7..b88f2f5d 100644--- a/frontend/src/features/flows/use-flow-detail-navigation.ts+++ b/frontend/src/features/flows/use-flow-detail-navigation.ts@@ -15,7 +15,7 @@ const getHref = (item: Flow) => `/flows/${item.id}`;* Pass `null` instead of an id while the page is in a non-viewing state* (e.g. `/flows/new`) so the controller reports an unmatched current item.*/-export const useFlowDetailNavigation = (currentId: null | string | undefined) => {+export function useFlowDetailNavigation(currentId: null | string | undefined) {const { flows } = useFlows();return useDetailNavigation<Flow>({@@ -26,4 +26,4 @@ export const useFlowDetailNavigation = (currentId: null | string | undefined) =>getSearchableText,items: flows,});-};+}diff --git a/frontend/src/features/flows/vector-stores/flow-vector-store-action-icon.tsx b/frontend/src/features/flows/vector-stores/flow-vector-store-action-icon.tsxindex bb4f5ade..111aeb2f 100644--- a/frontend/src/features/flows/vector-stores/flow-vector-store-action-icon.tsx+++ b/frontend/src/features/flows/vector-stores/flow-vector-store-action-icon.tsx@@ -19,7 +19,7 @@ const icons: Record<VectorStoreAction, LucideIcon> = {};const defaultIcon = HardDrive;-const FlowVectorStoreActionIcon = ({ action, className, tooltip = action }: FlowVectorStoreActionIconProps) => {+function FlowVectorStoreActionIcon({ action, className, tooltip = action }: FlowVectorStoreActionIconProps) {const Icon = action ? icons[action] || defaultIcon : defaultIcon;const iconElement = <Icon className={cn('size-3 shrink-0', tooltip && 'cursor-pointer', className)} />;@@ -33,6 +33,6 @@ const FlowVectorStoreActionIcon = ({ action, className, tooltip = action }: Flow<TooltipContent>{formatName(tooltip)}</TooltipContent></Tooltip>);-};+}export default FlowVectorStoreActionIcon;diff --git a/frontend/src/features/flows/vector-stores/flow-vector-store.tsx b/frontend/src/features/flows/vector-stores/flow-vector-store.tsxindex b3d5d1d4..5a81acb4 100644--- a/frontend/src/features/flows/vector-stores/flow-vector-store.tsx+++ b/frontend/src/features/flows/vector-stores/flow-vector-store.tsx@@ -67,7 +67,7 @@ const containsSearchValue = (text: null | string | undefined, searchValue: strinreturn text.toLowerCase().includes(searchValue.toLowerCase().trim());};-const FlowVectorStore = ({ log, searchValue = '' }: FlowVectorStoreProps) => {+function FlowVectorStore({ log, searchValue = '' }: FlowVectorStoreProps) {const { action, createdAt, executor, initiator, query, result, subtaskId, taskId } = log;// Memoize search checks to avoid recalculating on every render@@ -189,6 +189,6 @@ const FlowVectorStore = ({ log, searchValue = '' }: FlowVectorStoreProps) => {</div></div>);-};+}export default memo(FlowVectorStore);diff --git a/frontend/src/features/flows/vector-stores/flow-vector-stores.tsx b/frontend/src/features/flows/vector-stores/flow-vector-stores.tsxindex 8fd72cf5..1fddf4d5 100644--- a/frontend/src/features/flows/vector-stores/flow-vector-stores.tsx+++ b/frontend/src/features/flows/vector-stores/flow-vector-stores.tsx@@ -25,7 +25,7 @@ const searchFormSchema = z.object({search: z.string(),});-const FlowVectorStores = () => {+function FlowVectorStores() {const { flowData, flowId } = useFlow();const logs = useMemo(() => flowData?.vectorStoreLogs ?? [], [flowData?.vectorStoreLogs]);@@ -268,6 +268,6 @@ const FlowVectorStores = () => {)}</div>);-};+}export default FlowVectorStores;diff --git a/frontend/src/features/knowledges/knowledge-form-controls.tsx b/frontend/src/features/knowledges/knowledge-form-controls.tsxindex 417b805b..9e52a31a 100644--- a/frontend/src/features/knowledges/knowledge-form-controls.tsx+++ b/frontend/src/features/knowledges/knowledge-form-controls.tsx@@ -68,13 +68,52 @@ const LANGUAGES = ['yaml',] as const;+interface KnowledgeContentFieldProps {+ control: Control<FormValues>;+ /** When `true`, the editor stretches to fill its parent (desktop split view). */+ fillParent?: boolean;+ isSaving: boolean;+ showLabel?: boolean;+}+interface KnowledgeMetaFieldsProps {control: Control<FormValues>;isNew: boolean;isSaving: boolean;}-export const KnowledgeMetaFields = ({ control, isNew, isSaving }: KnowledgeMetaFieldsProps) => {+export function KnowledgeContentField({+ control,+ fillParent = false,+ isSaving,+ showLabel = false,+}: KnowledgeContentFieldProps) {+ return (+ <FormField+ control={control}+ name="content"+ render={({ field }) => (+ <FormItem className={fillParent ? 'flex min-h-0 flex-1 flex-col' : undefined}>+ {showLabel ? <FormLabel>Content</FormLabel> : null}+ <FormControl>+ <MarkdownEditor+ className={fillParent ? 'min-h-0 flex-1' : 'min-h-[280px]'}+ contentClassName={fillParent ? undefined : 'min-h-[240px]'}+ disabled={isSaving}+ onBlur={field.onBlur}+ onChange={field.onChange}+ placeholder="Knowledge content (will be embedded into the vector store)"+ value={field.value}+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ );+}++export function KnowledgeMetaFields({ control, isNew, isSaving }: KnowledgeMetaFieldsProps) {// Targeted subscription: only this component re-renders when docType changes,// not the whole form. The full-form `useWatch` from the original code// re-rendered on every keystroke in the markdown editor.@@ -305,41 +344,4 @@ export const KnowledgeMetaFields = ({ control, isNew, isSaving }: KnowledgeMetaF/></div>);-};--interface KnowledgeContentFieldProps {- control: Control<FormValues>;- /** When `true`, the editor stretches to fill its parent (desktop split view). */- fillParent?: boolean;- isSaving: boolean;- showLabel?: boolean;}--export const KnowledgeContentField = ({- control,- fillParent = false,- isSaving,- showLabel = false,-}: KnowledgeContentFieldProps) => (- <FormField- control={control}- name="content"- render={({ field }) => (- <FormItem className={fillParent ? 'flex min-h-0 flex-1 flex-col' : undefined}>- {showLabel ? <FormLabel>Content</FormLabel> : null}- <FormControl>- <MarkdownEditor- className={fillParent ? 'min-h-0 flex-1' : 'min-h-[280px]'}- contentClassName={fillParent ? undefined : 'min-h-[240px]'}- disabled={isSaving}- onBlur={field.onBlur}- onChange={field.onChange}- placeholder="Knowledge content (will be embedded into the vector store)"- value={field.value}- />- </FormControl>- <FormMessage />- </FormItem>- )}- />-);diff --git a/frontend/src/features/knowledges/knowledge-form-layout.tsx b/frontend/src/features/knowledges/knowledge-form-layout.tsxindex 9f9a1fe6..f241c8a1 100644--- a/frontend/src/features/knowledges/knowledge-form-layout.tsx+++ b/frontend/src/features/knowledges/knowledge-form-layout.tsx@@ -12,112 +12,118 @@ import type { FormValues } from './knowledge-form';import { KnowledgeContentField, KnowledgeMetaFields } from './knowledge-form-controls';-interface KnowledgeIntroBlockProps {+interface KnowledgeFormLayoutProps {+ control: Control<FormValues>;isNew: boolean;+ isSaving: boolean;knowledge?: KnowledgeDocumentFragmentFragment | null;}-const KnowledgeIntroBlock = ({ isNew, knowledge }: KnowledgeIntroBlockProps) => (- <div className="flex flex-col gap-4">- <div className="text-center">- <h1 className="text-2xl font-semibold">- {isNew ? 'Create a new knowledge document' : 'Edit knowledge document'}- </h1>- <p className="text-muted-foreground mt-2">- {isNew- ? 'Add an entry to the vector knowledge base'- : 'Edits to content or metadata will trigger re-embedding'}- </p>- </div>-- {!isNew && knowledge ? (- <div className="text-muted-foreground flex flex-wrap items-center gap-2 text-xs">- <Badge variant={knowledge.manual ? 'secondary' : 'outline'}>- {knowledge.manual ? 'manual' : 'agent'}- </Badge>- {knowledge.flowId ? <Badge variant="outline">flow #{knowledge.flowId}</Badge> : null}- {knowledge.taskId ? <Badge variant="outline">task #{knowledge.taskId}</Badge> : null}- {knowledge.subtaskId ? <Badge variant="outline">subtask #{knowledge.subtaskId}</Badge> : null}- <span>·</span>- <span>- chunk {knowledge.partSize} of {knowledge.totalSize}- </span>- </div>- ) : null}- </div>-);--interface KnowledgeFormLayoutProps {- control: Control<FormValues>;+interface KnowledgeIntroBlockProps {isNew: boolean;- isSaving: boolean;knowledge?: KnowledgeDocumentFragmentFragment | null;}-export const KnowledgeFormLayoutDesktop = ({ control, isNew, isSaving, knowledge }: KnowledgeFormLayoutProps) => (- <div className="flex min-h-0 w-full max-w-full flex-1 overflow-hidden">- <ResizablePanelGroup- className="w-full"- direction="horizontal"- >- <ResizablePanel- defaultSize={45}- minSize={30}+export function KnowledgeFormLayoutDesktop({ control, isNew, isSaving, knowledge }: KnowledgeFormLayoutProps) {+ return (+ <div className="flex min-h-0 w-full max-w-full flex-1 overflow-hidden">+ <ResizablePanelGroup+ className="w-full"+ direction="horizontal">- <div className="h-full min-h-0 overflow-y-auto">- <Card className="mx-auto min-h-full w-full max-w-2xl rounded-none border-0">- <CardContent className="flex flex-col gap-6 py-6">- <KnowledgeIntroBlock- isNew={isNew}- knowledge={knowledge}- />- <KnowledgeMetaFields- control={control}- isNew={isNew}- isSaving={isSaving}- />- </CardContent>- </Card>- </div>- </ResizablePanel>- <ResizableHandle withHandle>- <GripVertical className="size-4" />- </ResizableHandle>- <ResizablePanel- defaultSize={55}- minSize={30}- >- <div className="flex h-full min-h-0 flex-col overflow-hidden p-4">+ <ResizablePanel+ defaultSize={45}+ minSize={30}+ >+ <div className="h-full min-h-0 overflow-y-auto">+ <Card className="mx-auto min-h-full w-full max-w-2xl rounded-none border-0">+ <CardContent className="flex flex-col gap-6 py-6">+ <KnowledgeIntroBlock+ isNew={isNew}+ knowledge={knowledge}+ />+ <KnowledgeMetaFields+ control={control}+ isNew={isNew}+ isSaving={isSaving}+ />+ </CardContent>+ </Card>+ </div>+ </ResizablePanel>+ <ResizableHandle withHandle>+ <GripVertical className="size-4" />+ </ResizableHandle>+ <ResizablePanel+ defaultSize={55}+ minSize={30}+ >+ <div className="flex h-full min-h-0 flex-col overflow-hidden p-4">+ <KnowledgeContentField+ control={control}+ fillParent+ isSaving={isSaving}+ />+ </div>+ </ResizablePanel>+ </ResizablePanelGroup>+ </div>+ );+}++export function KnowledgeFormLayoutMobile({ control, isNew, isSaving, knowledge }: KnowledgeFormLayoutProps) {+ return (+ <div className="flex min-w-0 flex-1 items-start justify-center p-4">+ <Card className="w-full max-w-3xl">+ <CardContent className="flex flex-col gap-6 pt-6">+ <KnowledgeIntroBlock+ isNew={isNew}+ knowledge={knowledge}+ />+ <KnowledgeMetaFields+ control={control}+ isNew={isNew}+ isSaving={isSaving}+ /><KnowledgeContentFieldcontrol={control}- fillParentisSaving={isSaving}+ showLabel/>- </div>- </ResizablePanel>- </ResizablePanelGroup>- </div>-);+ </CardContent>+ </Card>+ </div>+ );+}++function KnowledgeIntroBlock({ isNew, knowledge }: KnowledgeIntroBlockProps) {+ return (+ <div className="flex flex-col gap-4">+ <div className="text-center">+ <h1 className="text-2xl font-semibold">+ {isNew ? 'Create a new knowledge document' : 'Edit knowledge document'}+ </h1>+ <p className="text-muted-foreground mt-2">+ {isNew+ ? 'Add an entry to the vector knowledge base'+ : 'Edits to content or metadata will trigger re-embedding'}+ </p>+ </div>-export const KnowledgeFormLayoutMobile = ({ control, isNew, isSaving, knowledge }: KnowledgeFormLayoutProps) => (- <div className="flex min-w-0 flex-1 items-start justify-center p-4">- <Card className="w-full max-w-3xl">- <CardContent className="flex flex-col gap-6 pt-6">- <KnowledgeIntroBlock- isNew={isNew}- knowledge={knowledge}- />- <KnowledgeMetaFields- control={control}- isNew={isNew}- isSaving={isSaving}- />- <KnowledgeContentField- control={control}- isSaving={isSaving}- showLabel- />- </CardContent>- </Card>- </div>-);+ {!isNew && knowledge ? (+ <div className="text-muted-foreground flex flex-wrap items-center gap-2 text-xs">+ <Badge variant={knowledge.manual ? 'secondary' : 'outline'}>+ {knowledge.manual ? 'manual' : 'agent'}+ </Badge>+ {knowledge.flowId ? <Badge variant="outline">flow #{knowledge.flowId}</Badge> : null}+ {knowledge.taskId ? <Badge variant="outline">task #{knowledge.taskId}</Badge> : null}+ {knowledge.subtaskId ? <Badge variant="outline">subtask #{knowledge.subtaskId}</Badge> : null}+ <span>·</span>+ <span>+ chunk {knowledge.partSize} of {knowledge.totalSize}+ </span>+ </div>+ ) : null}+ </div>+ );+}diff --git a/frontend/src/features/knowledges/knowledge-form.tsx b/frontend/src/features/knowledges/knowledge-form.tsxindex 145d75aa..abf4cb96 100644--- a/frontend/src/features/knowledges/knowledge-form.tsx+++ b/frontend/src/features/knowledges/knowledge-form.tsx@@ -195,7 +195,7 @@ interface KnowledgeFormProps {onSubmit: (values: FormValues, dirtyFields: DirtyFlags) => Promise<SubmitResult>;}-export const KnowledgeForm = ({ initialValues, isNew, knowledge, onSubmit }: KnowledgeFormProps) => {+export function KnowledgeForm({ initialValues, isNew, knowledge, onSubmit }: KnowledgeFormProps) {const navigate = useNavigate();const { isDesktop } = useBreakpoint();const [isSaving, setIsSaving] = useState(false);@@ -432,4 +432,4 @@ export const KnowledgeForm = ({ initialValues, isNew, knowledge, onSubmit }: Kno/></>);-};+}diff --git a/frontend/src/features/knowledges/knowledge-header.tsx b/frontend/src/features/knowledges/knowledge-header.tsxindex c438682e..7b65f537 100644--- a/frontend/src/features/knowledges/knowledge-header.tsx+++ b/frontend/src/features/knowledges/knowledge-header.tsx@@ -67,7 +67,7 @@ const renderKnowledgeItem = (item: Knowledge, isCurrent: boolean): ReactNode =></>);-export const KnowledgeHeader = ({+export function KnowledgeHeader({canAnonymize = false,isAnonymizeDisabled = false,isAnonymizing = false,@@ -76,7 +76,7 @@ export const KnowledgeHeader = ({onAnonymize,onBeforeNavigateAway,saveButton,-}: KnowledgeHeaderProps) => {+}: KnowledgeHeaderProps) {const navigate = useNavigate();const { isMobile } = useBreakpoint();const { deleteKnowledge, updateKnowledge } = useKnowledges();@@ -327,4 +327,4 @@ export const KnowledgeHeader = ({/></>);-};+}diff --git a/frontend/src/features/knowledges/knowledge-layout.tsx b/frontend/src/features/knowledges/knowledge-layout.tsxindex 7dca602a..1902c41f 100644--- a/frontend/src/features/knowledges/knowledge-layout.tsx+++ b/frontend/src/features/knowledges/knowledge-layout.tsx@@ -20,13 +20,15 @@ interface KnowledgeLayoutProps {* renders the header inline because the form must be the parent of every* input.*/-export const KnowledgeLayout = ({ children, className, isNew, knowledge, saveButton }: KnowledgeLayoutProps) => (- <div className={cn('flex min-h-[100dvh] flex-col', className)}>- <KnowledgeHeader- isNew={isNew}- knowledge={knowledge}- saveButton={saveButton}- />- {children}- </div>-);+export function KnowledgeLayout({ children, className, isNew, knowledge, saveButton }: KnowledgeLayoutProps) {+ return (+ <div className={cn('flex min-h-[100dvh] flex-col', className)}>+ <KnowledgeHeader+ isNew={isNew}+ knowledge={knowledge}+ saveButton={saveButton}+ />+ {children}+ </div>+ );+}diff --git a/frontend/src/features/knowledges/use-knowledge-detail-navigation.ts b/frontend/src/features/knowledges/use-knowledge-detail-navigation.tsindex 1497d5da..38241a6f 100644--- a/frontend/src/features/knowledges/use-knowledge-detail-navigation.ts+++ b/frontend/src/features/knowledges/use-knowledge-detail-navigation.ts@@ -11,7 +11,7 @@ const getHref = (item: Knowledge) => `/knowledges/${item.id}`;* filters on `question` and the header shows the same, so `getLabel`* doubles as the default searchable text.*/-export const useKnowledgeDetailNavigation = (currentId: null | string | undefined) => {+export function useKnowledgeDetailNavigation(currentId: null | string | undefined) {const { knowledges } = useKnowledges();return useDetailNavigation<Knowledge>({@@ -20,4 +20,4 @@ export const useKnowledgeDetailNavigation = (currentId: null | string | undefinegetLabel,items: knowledges,});-};+}diff --git a/frontend/src/features/resources/resources-copy-dialog.tsx b/frontend/src/features/resources/resources-copy-dialog.tsxindex 5c0ebdde..5b2a5205 100644--- a/frontend/src/features/resources/resources-copy-dialog.tsx+++ b/frontend/src/features/resources/resources-copy-dialog.tsx@@ -109,7 +109,33 @@ const buildCopyPlan = (files: readonly [FileNode, ...FileNode[]], values: Resourtargets: computeTargets(files, values.destination),});-const ResourcesCopyDialogForm = ({ files, onClose }: ResourcesCopyDialogFormProps) => {+export function ResourcesCopyDialog({ files, onClose }: ResourcesCopyDialogProps) {+ const handleDialogOpenChange = (nextOpen: boolean) => {+ if (!nextOpen) {+ onClose();+ }+ };++ // Narrow to a non-empty tuple so the inner form can index `files[0]` without+ // optional-chain noise. The Dialog only mounts when this guard passes.+ const nonEmptyFiles = files && files.length > 0 ? (files as [FileNode, ...FileNode[]]) : null;++ return (+ <Dialog+ onOpenChange={handleDialogOpenChange}+ open={!!nonEmptyFiles}+ >+ {nonEmptyFiles && (+ <ResourcesCopyDialogForm+ files={nonEmptyFiles}+ onClose={onClose}+ />+ )}+ </Dialog>+ );+}++function ResourcesCopyDialogForm({ files, onClose }: ResourcesCopyDialogFormProps) {const { copy, isCopying } = useResourcesCopy();const { resources } = useResources();const isMulti = files.length > 1;@@ -248,30 +274,4 @@ const ResourcesCopyDialogForm = ({ files, onClose }: ResourcesCopyDialogFormProp/></>);-};--export const ResourcesCopyDialog = ({ files, onClose }: ResourcesCopyDialogProps) => {- const handleDialogOpenChange = (nextOpen: boolean) => {- if (!nextOpen) {- onClose();- }- };-- // Narrow to a non-empty tuple so the inner form can index `files[0]` without- // optional-chain noise. The Dialog only mounts when this guard passes.- const nonEmptyFiles = files && files.length > 0 ? (files as [FileNode, ...FileNode[]]) : null;-- return (- <Dialog- onOpenChange={handleDialogOpenChange}- open={!!nonEmptyFiles}- >- {nonEmptyFiles && (- <ResourcesCopyDialogForm- files={nonEmptyFiles}- onClose={onClose}- />- )}- </Dialog>- );-};+}diff --git a/frontend/src/features/resources/resources-mkdir-dialog.tsx b/frontend/src/features/resources/resources-mkdir-dialog.tsxindex 88c04ca9..71c82ff0 100644--- a/frontend/src/features/resources/resources-mkdir-dialog.tsx+++ b/frontend/src/features/resources/resources-mkdir-dialog.tsx@@ -25,7 +25,29 @@ interface ResourcesMkdirDialogProps {const buildDefaultPath = (defaultParentPath: string): string =>defaultParentPath ? `${defaultParentPath.replace(/\/+$/u, '')}/new-folder` : 'new-folder';-const ResourcesMkdirDialogForm = ({ defaultParentPath, onClose }: ResourcesMkdirDialogFormProps) => {+export function ResourcesMkdirDialog({ defaultParentPath = '', isOpen, onClose }: ResourcesMkdirDialogProps) {+ const handleDialogOpenChange = (nextOpen: boolean) => {+ if (!nextOpen) {+ onClose();+ }+ };++ return (+ <Dialog+ onOpenChange={handleDialogOpenChange}+ open={isOpen}+ >+ {isOpen && (+ <ResourcesMkdirDialogForm+ defaultParentPath={defaultParentPath}+ onClose={onClose}+ />+ )}+ </Dialog>+ );+}++function ResourcesMkdirDialogForm({ defaultParentPath, onClose }: ResourcesMkdirDialogFormProps) {const { isCreating, mkdir } = useResourcesMkdir();const form = useForm<ResourcesMkdirFormValues>({@@ -110,26 +132,4 @@ const ResourcesMkdirDialogForm = ({ defaultParentPath, onClose }: ResourcesMkdir</Form></DialogContent>);-};--export const ResourcesMkdirDialog = ({ defaultParentPath = '', isOpen, onClose }: ResourcesMkdirDialogProps) => {- const handleDialogOpenChange = (nextOpen: boolean) => {- if (!nextOpen) {- onClose();- }- };-- return (- <Dialog- onOpenChange={handleDialogOpenChange}- open={isOpen}- >- {isOpen && (- <ResourcesMkdirDialogForm- defaultParentPath={defaultParentPath}- onClose={onClose}- />- )}- </Dialog>- );-};+}diff --git a/frontend/src/features/resources/resources-move-dialog.tsx b/frontend/src/features/resources/resources-move-dialog.tsxindex 186c3735..d59ee0c1 100644--- a/frontend/src/features/resources/resources-move-dialog.tsx+++ b/frontend/src/features/resources/resources-move-dialog.tsx@@ -97,7 +97,33 @@ const buildMovePlan = (files: readonly [FileNode, ...FileNode[]], values: Resourtargets: computeTargets(files, values.destination),});-const ResourcesMoveDialogForm = ({ files, onClose }: ResourcesMoveDialogFormProps) => {+export function ResourcesMoveDialog({ files, onClose }: ResourcesMoveDialogProps) {+ const handleDialogOpenChange = (nextOpen: boolean) => {+ if (!nextOpen) {+ onClose();+ }+ };++ // Narrow to a non-empty tuple so the inner form can index `files[0]` without+ // optional-chain noise. The Dialog only mounts when this guard passes.+ const nonEmptyFiles = files && files.length > 0 ? (files as [FileNode, ...FileNode[]]) : null;++ return (+ <Dialog+ onOpenChange={handleDialogOpenChange}+ open={!!nonEmptyFiles}+ >+ {nonEmptyFiles && (+ <ResourcesMoveDialogForm+ files={nonEmptyFiles}+ onClose={onClose}+ />+ )}+ </Dialog>+ );+}++function ResourcesMoveDialogForm({ files, onClose }: ResourcesMoveDialogFormProps) {const { isMoving, move } = useResourcesMove();const { resources } = useResources();const isMulti = files.length > 1;@@ -253,30 +279,4 @@ const ResourcesMoveDialogForm = ({ files, onClose }: ResourcesMoveDialogFormProp/></>);-};--export const ResourcesMoveDialog = ({ files, onClose }: ResourcesMoveDialogProps) => {- const handleDialogOpenChange = (nextOpen: boolean) => {- if (!nextOpen) {- onClose();- }- };-- // Narrow to a non-empty tuple so the inner form can index `files[0]` without- // optional-chain noise. The Dialog only mounts when this guard passes.- const nonEmptyFiles = files && files.length > 0 ? (files as [FileNode, ...FileNode[]]) : null;-- return (- <Dialog- onOpenChange={handleDialogOpenChange}- open={!!nonEmptyFiles}- >- {nonEmptyFiles && (- <ResourcesMoveDialogForm- files={nonEmptyFiles}- onClose={onClose}- />- )}- </Dialog>- );-};+}diff --git a/frontend/src/features/resources/use-resources-copy.ts b/frontend/src/features/resources/use-resources-copy.tsindex f8d69e6c..ade868aa 100644--- a/frontend/src/features/resources/use-resources-copy.ts+++ b/frontend/src/features/resources/use-resources-copy.ts@@ -44,7 +44,7 @@ interface UseResourcesCopyResult {}/** Wraps `POST /resources/copy` for single and batch copy operations. */-export const useResourcesCopy = (): UseResourcesCopyResult => {+export function useResourcesCopy(): UseResourcesCopyResult {const [isCopying, setIsCopying] = useState(false);const copy = useCallback(@@ -91,4 +91,4 @@ export const useResourcesCopy = (): UseResourcesCopyResult => {copy,isCopying,};-};+}diff --git a/frontend/src/features/resources/use-resources-delete.ts b/frontend/src/features/resources/use-resources-delete.tsindex c713f60a..aa9bb231 100644--- a/frontend/src/features/resources/use-resources-delete.ts+++ b/frontend/src/features/resources/use-resources-delete.ts@@ -45,7 +45,7 @@ const deleteResourcesRequest = (paths: readonly string[]) =>* No imperative refetch is performed: the GraphQL `resourceDeleted` subscription* is wired into the Apollo cache and removes the deleted entries automatically.*/-export const useResourcesDelete = ({ onAfterDelete }: UseResourcesDeleteParams = {}): UseResourcesDeleteResult => {+export function useResourcesDelete({ onAfterDelete }: UseResourcesDeleteParams = {}): UseResourcesDeleteResult {const [fileToDelete, setFileToDelete] = useState<FileNode | null>(null);const requestDelete = useCallback((file: FileNode) => {@@ -101,4 +101,4 @@ export const useResourcesDelete = ({ onAfterDelete }: UseResourcesDeleteParams =fileToDelete,requestDelete,};-};+}diff --git a/frontend/src/features/resources/use-resources-mkdir.ts b/frontend/src/features/resources/use-resources-mkdir.tsindex 7cd36d11..3023349e 100644--- a/frontend/src/features/resources/use-resources-mkdir.ts+++ b/frontend/src/features/resources/use-resources-mkdir.ts@@ -27,7 +27,7 @@ interface UseResourcesMkdirResult {}/** Wraps `POST /resources/mkdir` (idempotent — returns existing dir on hit). */-export const useResourcesMkdir = (): UseResourcesMkdirResult => {+export function useResourcesMkdir(): UseResourcesMkdirResult {const [isCreating, setIsCreating] = useState(false);const mkdir = useCallback(async ({ path }: ResourcesMkdirFormValues): Promise<boolean> => {@@ -54,4 +54,4 @@ export const useResourcesMkdir = (): UseResourcesMkdirResult => {isCreating,mkdir,};-};+}diff --git a/frontend/src/features/resources/use-resources-move.ts b/frontend/src/features/resources/use-resources-move.tsindex 9b44fb04..8e537733 100644--- a/frontend/src/features/resources/use-resources-move.ts+++ b/frontend/src/features/resources/use-resources-move.ts@@ -44,7 +44,7 @@ interface UseResourcesMoveResult {}/** Wraps `PUT /resources/move` for rename / move / batch-move operations. */-export const useResourcesMove = (): UseResourcesMoveResult => {+export function useResourcesMove(): UseResourcesMoveResult {const [isMoving, setIsMoving] = useState(false);const move = useCallback(@@ -95,4 +95,4 @@ export const useResourcesMove = (): UseResourcesMoveResult => {isMoving,move,};-};+}diff --git a/frontend/src/features/resources/use-resources-realtime.ts b/frontend/src/features/resources/use-resources-realtime.tsindex 9bb164eb..f12fd809 100644--- a/frontend/src/features/resources/use-resources-realtime.ts+++ b/frontend/src/features/resources/use-resources-realtime.ts@@ -18,8 +18,8 @@ interface UseResourcesRealtimeParams {* The Apollo subscription-cache link in `lib/apollo.ts` writes incoming entries* straight into the `resources` query cache, so callers don't need extra refetch.*/-export const useResourcesRealtime = ({ isPaused }: UseResourcesRealtimeParams): void => {+export function useResourcesRealtime({ isPaused }: UseResourcesRealtimeParams): void {useResourceAddedSubscription({ skip: isPaused });useResourceUpdatedSubscription({ skip: isPaused });useResourceDeletedSubscription({ skip: isPaused });-};+}diff --git a/frontend/src/features/resources/use-resources-search.ts b/frontend/src/features/resources/use-resources-search.tsindex e714d5ba..bee824c8 100644--- a/frontend/src/features/resources/use-resources-search.ts+++ b/frontend/src/features/resources/use-resources-search.ts@@ -22,7 +22,7 @@ interface UseResourcesSearchResult {* reset — leaving the default would also work (deleting a non-existent* param is a no-op), but the explicit setting documents intent.*/-export const useResourcesSearch = (): UseResourcesSearchResult => {+export function useResourcesSearch(): UseResourcesSearchResult {const { debouncedFilter, filter, resetFilter, setFilter } = useTableState({clearPageOnFilterChange: false,debounceMs: SEARCH_DEBOUNCE_MS,@@ -34,4 +34,4 @@ export const useResourcesSearch = (): UseResourcesSearchResult => {resetSearch: resetFilter,setQuery: setFilter,};-};+}diff --git a/frontend/src/features/resources/use-resources-upload.ts b/frontend/src/features/resources/use-resources-upload.tsindex ca580813..54045312 100644--- a/frontend/src/features/resources/use-resources-upload.ts+++ b/frontend/src/features/resources/use-resources-upload.ts@@ -82,10 +82,10 @@ const buildUploadSuccessMessage = (uploadedCount: number, dir?: string) => {* each upload so the consumer can remount the hidden `<input>` and clear it* declaratively.*/-export const useResourcesUpload = ({+export function useResourcesUpload({defaultDir,onSuccess,-}: UseResourcesUploadParams = {}): UseResourcesUploadResult => {+}: UseResourcesUploadParams = {}): UseResourcesUploadResult {const inputRef = useRef<HTMLInputElement | null>(null);const [isUploading, setIsUploading] = useState(false);const [fileInputKey, setFileInputKey] = useState(0);@@ -217,4 +217,4 @@ export const useResourcesUpload = ({openFilePickerForDir,uploadFiles,};-};+}diff --git a/frontend/src/features/templates/use-template-detail-navigation.ts b/frontend/src/features/templates/use-template-detail-navigation.tsindex 9e93c193..26ef3369 100644--- a/frontend/src/features/templates/use-template-detail-navigation.ts+++ b/frontend/src/features/templates/use-template-detail-navigation.ts@@ -13,7 +13,7 @@ const getHref = (item: Template) => `/templates/${item.id}`;* doubles as the default searchable text (no explicit `getSearchableText`* needed).*/-export const useTemplateDetailNavigation = (currentId: null | string | undefined) => {+export function useTemplateDetailNavigation(currentId: null | string | undefined) {const { templates } = useTemplates();return useDetailNavigation<Template>({@@ -23,4 +23,4 @@ export const useTemplateDetailNavigation = (currentId: null | string | undefinedgetLabel,items: templates,});-};+}diff --git a/frontend/src/hooks/use-auto-scroll.ts b/frontend/src/hooks/use-auto-scroll.tsindex d9459514..73bb59df 100644--- a/frontend/src/hooks/use-auto-scroll.ts+++ b/frontend/src/hooks/use-auto-scroll.ts@@ -9,10 +9,10 @@ interface ScrollTracker {resetKey: null | string | undefined;}-export const useAutoScroll = <T extends IdentifiableItem>(+export function useAutoScroll<T extends IdentifiableItem>(items: T[] | undefined,resetKey: null | string | undefined,-) => {+) {const containerElementRef = useRef<HTMLDivElement | null>(null);const endRef = useRef<HTMLDivElement>(null);@@ -124,4 +124,4 @@ export const useAutoScroll = <T extends IdentifiableItem>(isScrolledToBottom,scrollToEnd,} as const;-};+}diff --git a/frontend/src/hooks/use-breakpoint.ts b/frontend/src/hooks/use-breakpoint.tsindex 2b4e05dc..ce887ea6 100644--- a/frontend/src/hooks/use-breakpoint.ts+++ b/frontend/src/hooks/use-breakpoint.ts@@ -24,7 +24,7 @@ const getBreakpoint = (width: number): BreakpointName => {return breakpoint?.name ?? BreakpointName.desktop;};-export const useBreakpoint = () => {+export function useBreakpoint() {const [breakpoint, setBreakpoint] = useState<BreakpointName>(() => {if (typeof window === 'undefined') {return BreakpointName.desktop;@@ -71,4 +71,4 @@ export const useBreakpoint = () => {isMobile: breakpoint === BreakpointName.mobile,isTablet: breakpoint === BreakpointName.tablet,};-};+}diff --git a/frontend/src/hooks/use-debounced-value.ts b/frontend/src/hooks/use-debounced-value.tsindex 0d58edae..dcd3a924 100644--- a/frontend/src/hooks/use-debounced-value.ts+++ b/frontend/src/hooks/use-debounced-value.ts@@ -7,7 +7,7 @@ import { useEffect, useState } from 'react';* cancels the previous one. When the component unmounts, the pending timer is cleared,* so callers do not need to manage cancellation themselves.*/-export const useDebouncedValue = <Value>(value: Value, delayMs: number): Value => {+export function useDebouncedValue<Value>(value: Value, delayMs: number): Value {const [debouncedValue, setDebouncedValue] = useState<Value>(value);useEffect(() => {@@ -21,4 +21,4 @@ export const useDebouncedValue = <Value>(value: Value, delayMs: number): Value =}, [value, delayMs]);return debouncedValue;-};+}diff --git a/frontend/src/hooks/use-files-drag-and-drop.ts b/frontend/src/hooks/use-files-drag-and-drop.tsindex 7e37bad2..3cde7d96 100644--- a/frontend/src/hooks/use-files-drag-and-drop.ts+++ b/frontend/src/hooks/use-files-drag-and-drop.ts@@ -39,10 +39,10 @@ const isFileDragEvent = (event: React.DragEvent<HTMLDivElement>): boolean =>* to remount the subtree (via `key={...}` on the surrounding component) which discards* both the counter and the `isDragging` state.*/-export const useFilesDragAndDrop = ({+export function useFilesDragAndDrop({canAcceptDrop,onDrop,-}: UseFilesDragAndDropParams): UseFilesDragAndDropResult => {+}: UseFilesDragAndDropParams): UseFilesDragAndDropResult {const dragCounterRef = useRef(0);const [isDragging, setIsDragging] = useState(false);@@ -128,4 +128,4 @@ export const useFilesDragAndDrop = ({},isDragging,};-};+}diff --git a/frontend/src/hooks/use-latest-ref.ts b/frontend/src/hooks/use-latest-ref.tsindex 53c4794c..4732a817 100644--- a/frontend/src/hooks/use-latest-ref.ts+++ b/frontend/src/hooks/use-latest-ref.ts@@ -27,7 +27,7 @@ import { type RefObject, useEffect, useRef } from 'react';* Reading the ref during render breaks React's snapshot guarantee (the ref may* be updated by a concurrent render before the current one commits).*/-export const useLatestRef = <T>(value: T): RefObject<T> => {+export function useLatestRef<T>(value: T): RefObject<T> {const ref = useRef(value);useEffect(() => {@@ -35,4 +35,4 @@ export const useLatestRef = <T>(value: T): RefObject<T> => {}, [value]);return ref;-};+}diff --git a/frontend/src/hooks/use-page-storage-keys.ts b/frontend/src/hooks/use-page-storage-keys.tsindex f57c0fe7..2909f52d 100644--- a/frontend/src/hooks/use-page-storage-keys.ts+++ b/frontend/src/hooks/use-page-storage-keys.ts@@ -46,7 +46,7 @@ interface UsePageStorageKeysOptions {* `sorting_4_`, `filter_4_`, `page_4_` slots are migrated into the unified* key on first mount (see `migrateLegacyTableState`).*/-export const usePageStorageKeys = (options: UsePageStorageKeysOptions = {}): PageStorageKeys => {+export function usePageStorageKeys(options: UsePageStorageKeysOptions = {}): PageStorageKeys {const { pathname: livePathname } = useLocation();const { pathname: override, useTopLevel = false } = options;@@ -60,4 +60,4 @@ export const usePageStorageKeys = (options: UsePageStorageKeysOptions = {}): PagviewOptions: getViewOptionsStorageKey(effective),};}, [livePathname, override, useTopLevel]);-};+}diff --git a/frontend/src/hooks/use-table-query-filter.ts b/frontend/src/hooks/use-table-query-filter.tsindex dd8ab459..dc93ee1d 100644--- a/frontend/src/hooks/use-table-query-filter.ts+++ b/frontend/src/hooks/use-table-query-filter.ts@@ -36,13 +36,13 @@ interface UseTableQueryFilterReaderResult {* atomic multi-field updates that the previous split design couldn't do* race-free.*/-export const useTableQueryFilterReader = ({+export function useTableQueryFilterReader({debounceMs = 200,paramName = URL_PARAMS.QUERY,-}: UseTableQueryFilterReaderOptions = {}): UseTableQueryFilterReaderResult => {+}: UseTableQueryFilterReaderOptions = {}): UseTableQueryFilterReaderResult {const [searchParams] = useSearchParams();const filter = searchParams.get(paramName) ?? '';const debouncedFilter = useDebouncedValue(filter, debounceMs);return useMemo(() => ({ debouncedFilter, filter }), [debouncedFilter, filter]);-};+}diff --git a/frontend/src/hooks/use-table-state.ts b/frontend/src/hooks/use-table-state.tsindex b3f55a80..3507963e 100644--- a/frontend/src/hooks/use-table-state.ts+++ b/frontend/src/hooks/use-table-state.ts@@ -80,7 +80,7 @@ interface UseTableStateResult {* mutating it) should keep using `useTableQueryFilterReader` — no shared* URL writes, no race.*/-export const useTableState = (options: UseTableStateOptions = {}): UseTableStateResult => {+export function useTableState(options: UseTableStateOptions = {}): UseTableStateResult {const {clearPageOnFilterChange = true,debounceMs = 200,@@ -320,4 +320,4 @@ export const useTableState = (options: UseTableStateOptions = {}): UseTableState}),[debouncedFilter, filter, pageIndex, resetFilter, setFilter, setPage, update],);-};+}diff --git a/frontend/src/hooks/use-theme.ts b/frontend/src/hooks/use-theme.tsindex 88742ea0..fb9032a4 100644--- a/frontend/src/hooks/use-theme.ts+++ b/frontend/src/hooks/use-theme.ts@@ -2,7 +2,7 @@ import { useContext } from 'react';import { ThemeProviderContext } from '@/providers/theme-provider';-export const useTheme = () => {+export function useTheme() {const context = useContext(ThemeProviderContext);if (context === undefined) {@@ -10,4 +10,4 @@ export const useTheme = () => {}return context;-};+}diff --git a/frontend/src/lib/report/report-pdf.tsx b/frontend/src/lib/report/report-pdf.tsxindex b0f3dba3..74f06b3d 100644--- a/frontend/src/lib/report/report-pdf.tsx+++ b/frontend/src/lib/report/report-pdf.tsx@@ -607,7 +607,7 @@ const renderPDFContent = (parsed: ParsedContent[]) => {};// PDF Document component-const PDFReportDocument = ({ content }: { content: string }) => {+function PDFReportDocument({ content }: { content: string }) {const parsed = parseMarkdownTokens(content);const elements = renderPDFContent(parsed);@@ -621,7 +621,7 @@ const PDFReportDocument = ({ content }: { content: string }) => {</Page></Document>);-};+}// Main function to generate PDF from markdownexport const generatePDFFromMarkdownNew = async (content: string, fileName: string): Promise<void> => {diff --git a/frontend/src/pages/dashboard/dashboard-analytics.tsx b/frontend/src/pages/dashboard/dashboard-analytics.tsxindex 1852385d..68c7da2a 100644--- a/frontend/src/pages/dashboard/dashboard-analytics.tsx+++ b/frontend/src/pages/dashboard/dashboard-analytics.tsx@@ -37,38 +37,27 @@ const formatDateLabel = (dateString: string): string => {const axisTickStyle = { fill: 'var(--color-muted-foreground)', fontSize: 12 };-// Disables tooltip animation on chart entry and re-enables it only after the-// tooltip has rendered at the correct position for the first time in the session.-// This prevents the tooltip from flying from (0,0) to the cursor on entry,-// while keeping smooth follow animation for all subsequent movements.-const useChartTooltipAnimation = () => {- const [isAnimationActive, setIsAnimationActive] = useState(false);- const [sessionKey, setSessionKey] = useState(0);- const rafRef = useRef<number | undefined>(undefined);-- const onMouseEnter = () => {- cancelAnimationFrame(rafRef.current!);- setIsAnimationActive(false);- setSessionKey((k) => k + 1);- };-- const onMouseLeave = () => {- cancelAnimationFrame(rafRef.current!);- setIsAnimationActive(false);- };-- // Called by ChartTooltip the first time it becomes visible in this session.- // One rAF ensures the tooltip has painted at its initial position before- // animation is re-enabled for subsequent cursor movements.- const onFirstActive = () => {- cancelAnimationFrame(rafRef.current!);- rafRef.current = requestAnimationFrame(() => setIsAnimationActive(true));- };-- return { isAnimationActive, onFirstActive, onMouseEnter, onMouseLeave, sessionKey };+type FlowExecution = {+ flowId: string;+ flowTitle: string;+ tasks: Array<{+ subtasks: Array<{+ subtaskId: string;+ subtaskTitle: string;+ totalDurationSeconds: number;+ totalToolcallsCount: number;+ }>;+ taskId: string;+ taskTitle: string;+ totalDurationSeconds: number;+ totalToolcallsCount: number;+ }>;+ totalAssistantsCount: number;+ totalDurationSeconds: number;+ totalToolcallsCount: number;};-export const DashboardAnalytics = ({ period }: { period: UsageStatsPeriod }) => {+export function DashboardAnalytics({ period }: { period: UsageStatsPeriod }) {const { data: usageByPeriodData, loading: usageByPeriodLoading } = useUsageStatsByPeriodQuery({variables: { period },});@@ -372,29 +361,9 @@ export const DashboardAnalytics = ({ period }: { period: UsageStatsPeriod }) =></Card></div>);-};--type FlowExecution = {- flowId: string;- flowTitle: string;- tasks: Array<{- subtasks: Array<{- subtaskId: string;- subtaskTitle: string;- totalDurationSeconds: number;- totalToolcallsCount: number;- }>;- taskId: string;- taskTitle: string;- totalDurationSeconds: number;- totalToolcallsCount: number;- }>;- totalAssistantsCount: number;- totalDurationSeconds: number;- totalToolcallsCount: number;-};+}-const FlowExecutionItem = ({ flow, flowMeta }: { flow: FlowExecution; flowMeta?: FlowFragmentFragment }) => {+function FlowExecutionItem({ flow, flowMeta }: { flow: FlowExecution; flowMeta?: FlowFragmentFragment }) {const [isOpen, setIsOpen] = useState(false);const taskCount = flow.tasks.length;const subtaskCount = flow.tasks.reduce((sum, task) => sum + task.subtasks.length, 0);@@ -442,9 +411,9 @@ const FlowExecutionItem = ({ flow, flowMeta }: { flow: FlowExecution; flowMeta?:</CollapsibleContent></Collapsible>);-};+}-const TaskExecutionItem = ({ task }: { task: FlowExecution['tasks'][number] }) => {+function TaskExecutionItem({ task }: { task: FlowExecution['tasks'][number] }) {const [isOpen, setIsOpen] = useState(false);const hasSubtasks = task.subtasks.length > 0;@@ -502,4 +471,35 @@ const TaskExecutionItem = ({ task }: { task: FlowExecution['tasks'][number] }) =)}</Collapsible>);-};+}++// Disables tooltip animation on chart entry and re-enables it only after the+// tooltip has rendered at the correct position for the first time in the session.+// This prevents the tooltip from flying from (0,0) to the cursor on entry,+// while keeping smooth follow animation for all subsequent movements.+function useChartTooltipAnimation() {+ const [isAnimationActive, setIsAnimationActive] = useState(false);+ const [sessionKey, setSessionKey] = useState(0);+ const rafRef = useRef<number | undefined>(undefined);++ const onMouseEnter = () => {+ cancelAnimationFrame(rafRef.current!);+ setIsAnimationActive(false);+ setSessionKey((k) => k + 1);+ };++ const onMouseLeave = () => {+ cancelAnimationFrame(rafRef.current!);+ setIsAnimationActive(false);+ };++ // Called by ChartTooltip the first time it becomes visible in this session.+ // One rAF ensures the tooltip has painted at its initial position before+ // animation is re-enabled for subsequent cursor movements.+ const onFirstActive = () => {+ cancelAnimationFrame(rafRef.current!);+ rafRef.current = requestAnimationFrame(() => setIsAnimationActive(true));+ };++ return { isAnimationActive, onFirstActive, onMouseEnter, onMouseLeave, sessionKey };+}diff --git a/frontend/src/pages/dashboard/dashboard-overview.tsx b/frontend/src/pages/dashboard/dashboard-overview.tsxindex 2d9027ba..0086eef7 100644--- a/frontend/src/pages/dashboard/dashboard-overview.tsx+++ b/frontend/src/pages/dashboard/dashboard-overview.tsx@@ -17,54 +17,7 @@ import {} from '@/graphql/types';import { formatCost, formatDuration, formatNumber, formatTokenCount } from '@/lib/utils/format';-const UsageStatsRow = ({ label, stats }: { label: string; stats: UsageStatsFragmentFragment }) => (- <TableRow>- <TableCell className="font-medium">{label}</TableCell>- <TableCell className="text-right">{formatTokenCount(stats.totalUsageIn)}</TableCell>- <TableCell className="text-right">{formatTokenCount(stats.totalUsageOut)}</TableCell>- <TableCell className="text-right">{formatTokenCount(stats.totalUsageCacheIn)}</TableCell>- <TableCell className="text-right">{formatTokenCount(stats.totalUsageCacheOut)}</TableCell>- <TableCell className="text-right">{formatCost(stats.totalUsageCostIn)}</TableCell>- <TableCell className="text-right">{formatCost(stats.totalUsageCostOut)}</TableCell>- <TableCell className="text-right font-semibold">- {formatCost(stats.totalUsageCostIn + stats.totalUsageCostOut)}- </TableCell>- </TableRow>-);--const UsageStatsTable = ({ rows }: { rows: Array<{ label: string; stats: UsageStatsFragmentFragment }> }) => (- <Table>- <TableHeader>- <TableRow>- <TableHead className="whitespace-nowrap">Name</TableHead>- <TableHead className="text-right whitespace-nowrap">Tokens In</TableHead>- <TableHead className="text-right whitespace-nowrap">Tokens Out</TableHead>- <TableHead className="text-right whitespace-nowrap">Cache In</TableHead>- <TableHead className="text-right whitespace-nowrap">Cache Out</TableHead>- <TableHead className="text-right whitespace-nowrap">Cost In</TableHead>- <TableHead className="text-right whitespace-nowrap">Cost Out</TableHead>- <TableHead className="text-right whitespace-nowrap">Total Cost</TableHead>- </TableRow>- </TableHeader>- <TableBody>- {rows.map((row) => (- <UsageStatsRow- key={row.label}- label={row.label}- stats={row.stats}- />- ))}- </TableBody>- </Table>-);--const LoadingTable = () => (- <div className="flex items-center justify-center py-8">- <Loader2 className="text-muted-foreground size-6 animate-spin" />- </div>-);--export const DashboardOverview = () => {+export function DashboardOverview() {const { data: usageTotalData, loading: usageTotalLoading } = useUsageStatsTotalQuery();const { data: usageByProviderData, loading: usageByProviderLoading } = useUsageStatsByProviderQuery();const { data: usageByModelData, loading: usageByModelLoading } = useUsageStatsByModelQuery();@@ -204,4 +157,57 @@ export const DashboardOverview = () => {</Card></div>);-};+}++function LoadingTable() {+ return (+ <div className="flex items-center justify-center py-8">+ <Loader2 className="text-muted-foreground size-6 animate-spin" />+ </div>+ );+}++function UsageStatsRow({ label, stats }: { label: string; stats: UsageStatsFragmentFragment }) {+ return (+ <TableRow>+ <TableCell className="font-medium">{label}</TableCell>+ <TableCell className="text-right">{formatTokenCount(stats.totalUsageIn)}</TableCell>+ <TableCell className="text-right">{formatTokenCount(stats.totalUsageOut)}</TableCell>+ <TableCell className="text-right">{formatTokenCount(stats.totalUsageCacheIn)}</TableCell>+ <TableCell className="text-right">{formatTokenCount(stats.totalUsageCacheOut)}</TableCell>+ <TableCell className="text-right">{formatCost(stats.totalUsageCostIn)}</TableCell>+ <TableCell className="text-right">{formatCost(stats.totalUsageCostOut)}</TableCell>+ <TableCell className="text-right font-semibold">+ {formatCost(stats.totalUsageCostIn + stats.totalUsageCostOut)}+ </TableCell>+ </TableRow>+ );+}++function UsageStatsTable({ rows }: { rows: Array<{ label: string; stats: UsageStatsFragmentFragment }> }) {+ return (+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead className="whitespace-nowrap">Name</TableHead>+ <TableHead className="text-right whitespace-nowrap">Tokens In</TableHead>+ <TableHead className="text-right whitespace-nowrap">Tokens Out</TableHead>+ <TableHead className="text-right whitespace-nowrap">Cache In</TableHead>+ <TableHead className="text-right whitespace-nowrap">Cache Out</TableHead>+ <TableHead className="text-right whitespace-nowrap">Cost In</TableHead>+ <TableHead className="text-right whitespace-nowrap">Cost Out</TableHead>+ <TableHead className="text-right whitespace-nowrap">Total Cost</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {rows.map((row) => (+ <UsageStatsRow+ key={row.label}+ label={row.label}+ stats={row.stats}+ />+ ))}+ </TableBody>+ </Table>+ );+}diff --git a/frontend/src/pages/dashboard/dashboard.tsx b/frontend/src/pages/dashboard/dashboard.tsxindex a1710173..97c2e136 100644--- a/frontend/src/pages/dashboard/dashboard.tsx+++ b/frontend/src/pages/dashboard/dashboard.tsx@@ -41,7 +41,7 @@ const savePeriod = (storageKey: string, value: UsageStatsPeriod): void => {}};-const Dashboard = () => {+function Dashboard() {const { period: periodStorageKey } = usePageStorageKeys();const [activeTab, setActiveTab] = useState('analytics');const [period, setPeriod] = useState<UsageStatsPeriod>(() => loadPeriod(periodStorageKey));@@ -115,6 +115,6 @@ const Dashboard = () => {</div></>);-};+}export default Dashboard;diff --git a/frontend/src/pages/flows/flow-report.tsx b/frontend/src/pages/flows/flow-report.tsxindex c9959047..217c4108 100644--- a/frontend/src/pages/flows/flow-report.tsx+++ b/frontend/src/pages/flows/flow-report.tsx@@ -11,7 +11,7 @@ import { generateFileName, generatePDFFromMarkdown, generateReport } from '@/libtype PdfPhase = 'done' | 'error' | 'idle';type ReportState = 'content' | 'error' | 'generating' | 'loading';-const FlowReport = () => {+function FlowReport() {const { flowId } = useParams<{ flowId: string }>();const [searchParams] = useSearchParams();const download = searchParams.has('download');@@ -148,6 +148,6 @@ const FlowReport = () => {</div></div>);-};+}export default FlowReport;diff --git a/frontend/src/pages/flows/flow.tsx b/frontend/src/pages/flows/flow.tsxindex 699db07e..3f4b6c9b 100644--- a/frontend/src/pages/flows/flow.tsx+++ b/frontend/src/pages/flows/flow.tsx@@ -73,122 +73,7 @@ const renderFlowItem = (item: FlowItem, isCurrent: boolean): ReactNode => (</>);-const FlowReportDropdown = () => {- const { flowData, flowId } = useFlow();- const flow = flowData?.flow;- const tasks = flowData?.tasks ?? [];-- // Check if flow is available for report generation- const isReportDisabled = !flow || !flowId;-- // Report export handlers- const handleCopyToClipboard = async () => {- if (isReportDisabled) {- return;- }-- const reportContent = generateReport(tasks, flow);- const success = await copyToClipboard(reportContent);-- if (success) {- toast.success('Report copied to clipboard');- } else {- Log.error('Failed to copy report to clipboard');- toast.error('Failed to copy report to clipboard');- }- };-- const handleDownloadMD = () => {- if (isReportDisabled || !flow) {- return;- }-- try {- // Generate report content- const reportContent = generateReport(tasks, flow);-- // Generate file name- const baseFileName = generateFileName(flow);- const fileName = `${baseFileName}.md`;-- // Download file- downloadTextFile(reportContent, fileName, 'text/markdown; charset=UTF-8');- } catch (error) {- Log.error('Failed to download markdown report:', error);- }- };-- const handleDownloadPDF = () => {- if (isReportDisabled || !flow || !flowId) {- return;- }-- // Open new tab (not popup) with report page and download flag- const url = `/flows/${flowId}/report?download=true&silent=true`;- window.open(url, '_blank');- };-- const handleOpenWebView = () => {- if (isReportDisabled || !flowId) {- return;- }-- // Open new tab with report page for web viewing- const url = `/flows/${flowId}/report`;- window.open(url, '_blank');- };-- return (- <DropdownMenu>- <DropdownMenuTrigger asChild>- <HeaderButton- className="shrink-0"- disabled={isReportDisabled}- endIcon={<ChevronDown className="opacity-50" />}- icon={<NotepadText />}- label="Report"- variant="ghost"- />- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem- className="flex items-center gap-2"- disabled={isReportDisabled}- onClick={handleOpenWebView}- >- <ExternalLink className="size-4" />- Open web view- </DropdownMenuItem>- <DropdownMenuItem- className="flex items-center gap-2"- disabled={isReportDisabled}- onClick={handleCopyToClipboard}- >- <Copy className="size-4" />- Copy to clipboard- </DropdownMenuItem>- <DropdownMenuItem- className="flex items-center gap-2"- disabled={isReportDisabled}- onClick={handleDownloadMD}- >- <Download className="size-4" />- Download MD- </DropdownMenuItem>- <DropdownMenuItem- className="flex items-center gap-2"- disabled={isReportDisabled}- onClick={handleDownloadPDF}- >- <Download className="size-4" />- Download PDF- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- );-};--const Flow = () => {+function Flow() {const { isDesktop, isMobile } = useBreakpoint();const navigate = useNavigate();@@ -533,6 +418,121 @@ const Flow = () => {/></>);-};+}++function FlowReportDropdown() {+ const { flowData, flowId } = useFlow();+ const flow = flowData?.flow;+ const tasks = flowData?.tasks ?? [];++ // Check if flow is available for report generation+ const isReportDisabled = !flow || !flowId;++ // Report export handlers+ const handleCopyToClipboard = async () => {+ if (isReportDisabled) {+ return;+ }++ const reportContent = generateReport(tasks, flow);+ const success = await copyToClipboard(reportContent);++ if (success) {+ toast.success('Report copied to clipboard');+ } else {+ Log.error('Failed to copy report to clipboard');+ toast.error('Failed to copy report to clipboard');+ }+ };++ const handleDownloadMD = () => {+ if (isReportDisabled || !flow) {+ return;+ }++ try {+ // Generate report content+ const reportContent = generateReport(tasks, flow);++ // Generate file name+ const baseFileName = generateFileName(flow);+ const fileName = `${baseFileName}.md`;++ // Download file+ downloadTextFile(reportContent, fileName, 'text/markdown; charset=UTF-8');+ } catch (error) {+ Log.error('Failed to download markdown report:', error);+ }+ };++ const handleDownloadPDF = () => {+ if (isReportDisabled || !flow || !flowId) {+ return;+ }++ // Open new tab (not popup) with report page and download flag+ const url = `/flows/${flowId}/report?download=true&silent=true`;+ window.open(url, '_blank');+ };++ const handleOpenWebView = () => {+ if (isReportDisabled || !flowId) {+ return;+ }++ // Open new tab with report page for web viewing+ const url = `/flows/${flowId}/report`;+ window.open(url, '_blank');+ };++ return (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <HeaderButton+ className="shrink-0"+ disabled={isReportDisabled}+ endIcon={<ChevronDown className="opacity-50" />}+ icon={<NotepadText />}+ label="Report"+ variant="ghost"+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem+ className="flex items-center gap-2"+ disabled={isReportDisabled}+ onClick={handleOpenWebView}+ >+ <ExternalLink className="size-4" />+ Open web view+ </DropdownMenuItem>+ <DropdownMenuItem+ className="flex items-center gap-2"+ disabled={isReportDisabled}+ onClick={handleCopyToClipboard}+ >+ <Copy className="size-4" />+ Copy to clipboard+ </DropdownMenuItem>+ <DropdownMenuItem+ className="flex items-center gap-2"+ disabled={isReportDisabled}+ onClick={handleDownloadMD}+ >+ <Download className="size-4" />+ Download MD+ </DropdownMenuItem>+ <DropdownMenuItem+ className="flex items-center gap-2"+ disabled={isReportDisabled}+ onClick={handleDownloadPDF}+ >+ <Download className="size-4" />+ Download PDF+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ );+}export default Flow;diff --git a/frontend/src/pages/flows/flows.tsx b/frontend/src/pages/flows/flows.tsxindex 73536976..600865fc 100644--- a/frontend/src/pages/flows/flows.tsx+++ b/frontend/src/pages/flows/flows.tsx@@ -79,7 +79,7 @@ const formatFullDateTime = (dateString: string) => {return format(date, 'd MMM yyyy, HH:mm:ss', { locale: enUS });};-const Flows = () => {+function Flows() {const navigate = useNavigate();const location = useLocation();const { deleteFlow, finishFlow, flows, isLoading } = useFlows();@@ -697,6 +697,6 @@ const Flows = () => {</div></>);-};+}export default Flows;diff --git a/frontend/src/pages/flows/new-flow.tsx b/frontend/src/pages/flows/new-flow.tsxindex f4e9a587..5777c51a 100644--- a/frontend/src/pages/flows/new-flow.tsx+++ b/frontend/src/pages/flows/new-flow.tsx@@ -12,7 +12,7 @@ import { useFlows } from '@/providers/flows-provider';import { useProviders } from '@/providers/providers-provider';import { useSystemSettings } from '@/providers/system-settings-provider';-const NewFlow = () => {+function NewFlow() {const navigate = useNavigate();const { selectedProvider } = useProviders();@@ -110,6 +110,6 @@ const NewFlow = () => {</div></>);-};+}export default NewFlow;diff --git a/frontend/src/pages/knowledges/knowledge.tsx b/frontend/src/pages/knowledges/knowledge.tsxindex cbc9328f..32cbabe6 100644--- a/frontend/src/pages/knowledges/knowledge.tsx+++ b/frontend/src/pages/knowledges/knowledge.tsx@@ -19,7 +19,7 @@ import { KnowledgeLayout } from '@/features/knowledges/knowledge-layout';import { useKnowledgeDocumentQuery } from '@/graphql/types';import { useKnowledges } from '@/providers/knowledges-provider';-const Knowledge = () => {+function Knowledge() {const navigate = useNavigate();const { knowledgeId } = useParams<{ knowledgeId?: string }>();const { createKnowledge, updateKnowledge } = useKnowledges();@@ -118,6 +118,6 @@ const Knowledge = () => {/></>);-};+}export default Knowledge;diff --git a/frontend/src/pages/knowledges/knowledges.tsx b/frontend/src/pages/knowledges/knowledges.tsxindex f7a2a58a..d829c361 100644--- a/frontend/src/pages/knowledges/knowledges.tsx+++ b/frontend/src/pages/knowledges/knowledges.tsx@@ -53,7 +53,7 @@ const docTypeSubtype = (k: Knowledge): null | string => {return null;};-const Knowledges = () => {+function Knowledges() {const navigate = useNavigate();const location = useLocation();const { deleteKnowledge, isLoading, knowledges, updateKnowledge } = useKnowledges();@@ -464,6 +464,6 @@ const Knowledges = () => {</div></>);-};+}export default Knowledges;diff --git a/frontend/src/pages/login.tsx b/frontend/src/pages/login.tsxindex 663553fc..337fa1f3 100644--- a/frontend/src/pages/login.tsx+++ b/frontend/src/pages/login.tsx@@ -7,7 +7,7 @@ import LoginForm from '@/features/authentication/login-form';import { getSafeReturnUrl } from '@/lib/utils/auth';import { useUser } from '@/providers/user-provider';-const Login = () => {+function Login() {const [searchParams] = useSearchParams();const location = useLocation();const { authInfo, isLoading } = useUser();@@ -36,6 +36,6 @@ const Login = () => {</div></div>);-};+}export default Login;diff --git a/frontend/src/pages/oauth-result.tsx b/frontend/src/pages/oauth-result.tsxindex 7c21929c..7248c56d 100644--- a/frontend/src/pages/oauth-result.tsx+++ b/frontend/src/pages/oauth-result.tsx@@ -3,7 +3,7 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'react';import Logo from '@/components/icons/logo';import { PageTitle } from '@/components/shared/page-title';-const OAuthResult = () => {+function OAuthResult() {const [statusMessage, setStatusMessage] = useState('Authentication in progress...');const messageRef = useRef(statusMessage);const prevMessageRef = useRef(statusMessage);@@ -116,6 +116,6 @@ const OAuthResult = () => {<div className="fixed bottom-4 text-sm text-white">{statusMessage}</div></div>);-};+}export default OAuthResult;diff --git a/frontend/src/pages/resources/resources.tsx b/frontend/src/pages/resources/resources.tsxindex 1dbde77b..00a049bb 100644--- a/frontend/src/pages/resources/resources.tsx+++ b/frontend/src/pages/resources/resources.tsx@@ -98,7 +98,7 @@ const seedViewOptions = (storageKey: string): ResourcesViewOptions => {};};-const Resources = () => {+function Resources() {const { isInitialLoading, resources } = useResources();const search = useResourcesSearch();@@ -594,6 +594,6 @@ const Resources = () => {</div></>);-};+}export default Resources;diff --git a/frontend/src/pages/settings/settings-api-tokens.tsx b/frontend/src/pages/settings/settings-api-tokens.tsxindex f87186aa..0b046b1b 100644--- a/frontend/src/pages/settings/settings-api-tokens.tsx+++ b/frontend/src/pages/settings/settings-api-tokens.tsx@@ -139,7 +139,7 @@ const copyToClipboard = async (text: string): Promise<boolean> => {}};-const SettingsAPITokensHeader = ({ onCreateClick }: { onCreateClick: () => void }) => {+function SettingsAPITokensHeader({ onCreateClick }: { onCreateClick: () => void }) {return (<div className="flex items-center justify-between gap-4"><div className="flex min-w-0 flex-1 flex-col gap-2">@@ -176,7 +176,7 @@ const SettingsAPITokensHeader = ({ onCreateClick }: { onCreateClick: () => void</Button></div>);-};+}const createNewTokenPlaceholder: APIToken = {createdAt: new Date().toISOString(),@@ -190,7 +190,7 @@ const createNewTokenPlaceholder: APIToken = {userId: '0',};-const SettingsAPITokens = () => {+function SettingsAPITokens() {const { data, error, loading: isLoading } = useApiTokensQuery();const [createAPIToken, { error: createError, loading: isCreateLoading }] = useCreateApiTokenMutation();const [updateAPIToken, { error: updateError, loading: isUpdateLoading }] = useUpdateApiTokenMutation();@@ -889,6 +889,6 @@ const SettingsAPITokens = () => {/></div>);-};+}export default SettingsAPITokens;diff --git a/frontend/src/pages/settings/settings-prompt.tsx b/frontend/src/pages/settings/settings-prompt.tsxindex 01dde56e..0be6c081 100644--- a/frontend/src/pages/settings/settings-prompt.tsx+++ b/frontend/src/pages/settings/settings-prompt.tsx@@ -12,7 +12,6 @@ import {Wrench,XCircle,} from 'lucide-react';-import * as React from 'react';import { useCallback, useEffect, useMemo, useRef, useState } from 'react';import ReactDiffViewer from 'react-diff-viewer-continued';import { useController, useForm, useFormState } from 'react-hook-form';@@ -71,14 +70,7 @@ type HumanFormData = z.infer<typeof humanFormSchema>;type SystemFormData = z.infer<typeof systemFormSchema>;-const FormTextareaItem: React.FC<FormTextareaItemProps> = ({- className,- control,- disabled,- label,- name,- placeholder,-}) => {+function FormTextareaItem({ className, control, disabled, label, name, placeholder }: FormTextareaItemProps) {const { field, fieldState } = useController({control,defaultValue: '',@@ -100,7 +92,7 @@ const FormTextareaItem: React.FC<FormTextareaItemProps> = ({{fieldState.error && <FormMessage>{fieldState.error.message}</FormMessage>}</FormItem>);-};+}// Helper function to format display nameconst formatName = (key: string): string => {@@ -136,40 +128,7 @@ interface VariablesProps {variables: string[];}-const Variables: React.FC<VariablesProps> = ({ currentTemplate, onVariableClick, variables }) => {- if (variables.length === 0) {- return null;- }-- const usedVariables = getUsedVariables(currentTemplate);-- return (- <div className="bg-muted/50 mb-4 rounded-md border p-3">- <h4 className="text-muted-foreground mb-2 text-sm font-medium">Available Variables:</h4>- <div className="flex flex-wrap gap-1">- {variables.map((variable) => {- const isUsed = usedVariables.has(variable);-- return (- <code- className={`cursor-pointer rounded border px-2 py-1 font-mono text-xs transition-colors ${- isUsed- ? 'border-green-300 bg-green-100 text-green-800 hover:bg-green-200'- : 'bg-background text-foreground hover:bg-accent'- }`}- key={variable}- onClick={() => onVariableClick(variable)}- >- {`{{.${variable}}}`}- </code>- );- })}- </div>- </div>- );-};--const SettingsPrompt = () => {+function SettingsPrompt() {const { promptId } = useParams<{ promptId: string }>();const navigate = useNavigate();@@ -1074,6 +1033,39 @@ const SettingsPrompt = () => {</Dialog></div>);-};+}++function Variables({ currentTemplate, onVariableClick, variables }: VariablesProps) {+ if (variables.length === 0) {+ return null;+ }++ const usedVariables = getUsedVariables(currentTemplate);++ return (+ <div className="bg-muted/50 mb-4 rounded-md border p-3">+ <h4 className="text-muted-foreground mb-2 text-sm font-medium">Available Variables:</h4>+ <div className="flex flex-wrap gap-1">+ {variables.map((variable) => {+ const isUsed = usedVariables.has(variable);++ return (+ <code+ className={`cursor-pointer rounded border px-2 py-1 font-mono text-xs transition-colors ${+ isUsed+ ? 'border-green-300 bg-green-100 text-green-800 hover:bg-green-200'+ : 'bg-background text-foreground hover:bg-accent'+ }`}+ key={variable}+ onClick={() => onVariableClick(variable)}+ >+ {`{{.${variable}}}`}+ </code>+ );+ })}+ </div>+ </div>+ );+}export default SettingsPrompt;diff --git a/frontend/src/pages/settings/settings-prompts.tsx b/frontend/src/pages/settings/settings-prompts.tsxindex 0255d4aa..3ac12788 100644--- a/frontend/src/pages/settings/settings-prompts.tsx+++ b/frontend/src/pages/settings/settings-prompts.tsx@@ -59,15 +59,7 @@ type ToolPromptTableData = {template: string;};-const SettingsPromptsHeader = () => {- return (- <div className="flex items-center justify-between">- <p className="text-muted-foreground">Manage system and custom prompt templates</p>- </div>- );-};--const SettingsPrompts = () => {+function SettingsPrompts() {const { data, error, loading: isLoading } = useSettingsPromptsQuery();const [deletePrompt, { loading: isDeleteLoading }] = useDeletePromptMutation();const navigate = useNavigate();@@ -919,6 +911,14 @@ const SettingsPrompts = () => {/></Fragment>);-};+}++function SettingsPromptsHeader() {+ return (+ <div className="flex items-center justify-between">+ <p className="text-muted-foreground">Manage system and custom prompt templates</p>+ </div>+ );+}export default SettingsPrompts;diff --git a/frontend/src/pages/settings/settings-provider.tsx b/frontend/src/pages/settings/settings-provider.tsxindex bbe88718..9c023999 100644--- a/frontend/src/pages/settings/settings-provider.tsx+++ b/frontend/src/pages/settings/settings-provider.tsx@@ -64,6 +64,13 @@ interface ControllerProps {name: string;}+interface FormComboboxItemProps extends BaseFieldProps, BaseInputProps {+ allowCustom?: boolean;+ contentClass?: string;+ description?: string;+ options: string[];+}+interface FormInputNumberItemProps extends BaseFieldProps, NumberInputProps {description?: string;valueType?: 'float' | 'integer';@@ -73,6 +80,20 @@ interface FormInputStringItemProps extends BaseFieldProps, BaseInputProps {description?: string;}+interface FormModelComboboxItemProps extends BaseFieldProps, BaseInputProps {+ allowCustom?: boolean;+ contentClass?: string;+ description?: string;+ onOptionSelect?: (option: ModelOption) => void;+ options: ModelOption[];+}++interface ModelOption {+ name: string;+ price?: null | { cacheRead: number; cacheWrite: number; input: number; output: number };+ thinking?: boolean;+}+interface NumberInputProps extends BaseInputProps {max?: string;min?: string;@@ -81,102 +102,7 @@ interface NumberInputProps extends BaseInputProps {type Provider = ProviderConfigFragmentFragment;-const FormInputStringItem: React.FC<FormInputStringItemProps> = ({- control,- description,- disabled,- label,- name,- placeholder,-}) => {- const { field, fieldState } = useController({- control,- defaultValue: undefined,- disabled,- name,- });-- const inputProps = { placeholder };-- return (- <FormItem>- <FormLabel>{label}</FormLabel>- <FormControl>- <Input- {...field}- {...inputProps}- value={field.value ?? ''}- />- </FormControl>- {description && <FormDescription>{description}</FormDescription>}- {fieldState.error && <FormMessage>{fieldState.error.message}</FormMessage>}- </FormItem>- );-};--const FormInputNumberItem: React.FC<FormInputNumberItemProps> = ({- control,- description,- disabled,- label,- max,- min,- name,- placeholder,- step,- valueType = 'float',-}) => {- const { field, fieldState } = useController({- control,- defaultValue: undefined,- disabled,- name,- });-- const parseValue = (value: string) => {- if (value === '') {- return null;- }-- return valueType === 'float' ? Number.parseFloat(value) : Number.parseInt(value);- };-- const inputProps = {- max,- min,- placeholder,- step,- type: 'number' as const,- };-- return (- <FormItem>- <FormLabel>{label}</FormLabel>- <FormControl>- <Input- {...field}- {...inputProps}- onChange={(event) => {- const { value } = event.target;- field.onChange(parseValue(value));- }}- value={field.value ?? ''}- />- </FormControl>- {description && <FormDescription>{description}</FormDescription>}- {fieldState.error && <FormMessage>{fieldState.error.message}</FormMessage>}- </FormItem>- );-};--interface FormComboboxItemProps extends BaseFieldProps, BaseInputProps {- allowCustom?: boolean;- contentClass?: string;- description?: string;- options: string[];-}--const FormComboboxItem: React.FC<FormComboboxItemProps> = ({+function FormComboboxItem({allowCustom = true,contentClass,control,@@ -186,7 +112,7 @@ const FormComboboxItem: React.FC<FormComboboxItemProps> = ({name,options,placeholder,-}) => {+}: FormComboboxItemProps) {const { field, fieldState } = useController({control,defaultValue: undefined,@@ -285,23 +211,90 @@ const FormComboboxItem: React.FC<FormComboboxItemProps> = ({{fieldState.error && <FormMessage>{fieldState.error.message}</FormMessage>}</FormItem>);-};+}-interface FormModelComboboxItemProps extends BaseFieldProps, BaseInputProps {- allowCustom?: boolean;- contentClass?: string;- description?: string;- onOptionSelect?: (option: ModelOption) => void;- options: ModelOption[];+function FormInputNumberItem({+ control,+ description,+ disabled,+ label,+ max,+ min,+ name,+ placeholder,+ step,+ valueType = 'float',+}: FormInputNumberItemProps) {+ const { field, fieldState } = useController({+ control,+ defaultValue: undefined,+ disabled,+ name,+ });++ const parseValue = (value: string) => {+ if (value === '') {+ return null;+ }++ return valueType === 'float' ? Number.parseFloat(value) : Number.parseInt(value);+ };++ const inputProps = {+ max,+ min,+ placeholder,+ step,+ type: 'number' as const,+ };++ return (+ <FormItem>+ <FormLabel>{label}</FormLabel>+ <FormControl>+ <Input+ {...field}+ {...inputProps}+ onChange={(event) => {+ const { value } = event.target;+ field.onChange(parseValue(value));+ }}+ value={field.value ?? ''}+ />+ </FormControl>+ {description && <FormDescription>{description}</FormDescription>}+ {fieldState.error && <FormMessage>{fieldState.error.message}</FormMessage>}+ </FormItem>+ );}-interface ModelOption {- name: string;- price?: null | { cacheRead: number; cacheWrite: number; input: number; output: number };- thinking?: boolean;+function FormInputStringItem({ control, description, disabled, label, name, placeholder }: FormInputStringItemProps) {+ const { field, fieldState } = useController({+ control,+ defaultValue: undefined,+ disabled,+ name,+ });++ const inputProps = { placeholder };++ return (+ <FormItem>+ <FormLabel>{label}</FormLabel>+ <FormControl>+ <Input+ {...field}+ {...inputProps}+ value={field.value ?? ''}+ />+ </FormControl>+ {description && <FormDescription>{description}</FormDescription>}+ {fieldState.error && <FormMessage>{fieldState.error.message}</FormMessage>}+ </FormItem>+ );}-const FormModelComboboxItem: React.FC<FormModelComboboxItemProps> = ({+function FormModelComboboxItem({allowCustom = true,contentClass,control,@@ -312,7 +305,7 @@ const FormModelComboboxItem: React.FC<FormModelComboboxItemProps> = ({onOptionSelect,options,placeholder,-}) => {+}: FormModelComboboxItemProps) {const { field, fieldState } = useController({control,defaultValue: undefined,@@ -465,7 +458,7 @@ const FormModelComboboxItem: React.FC<FormModelComboboxItemProps> = ({{fieldState.error && <FormMessage>{fieldState.error.message}</FormMessage>}</FormItem>);-};+}// Define agent configuration schemaconst agentConfigSchema = z@@ -668,7 +661,7 @@ interface TestResultsDialogProps {}// Component to render test results dialog-const TestResultsDialog = ({ handleOpenChange, isOpen, results }: TestResultsDialogProps) => {+function TestResultsDialog({ handleOpenChange, isOpen, results }: TestResultsDialogProps) {if (!results) {return null;}@@ -791,7 +784,7 @@ const TestResultsDialog = ({ handleOpenChange, isOpen, results }: TestResultsDia</DialogContent></Dialog>);-};+}// Static mapping of agent keys to GraphQL enum typesconst agentTypesMap: Record<string, AgentConfigType> = {@@ -824,7 +817,7 @@ const extractAgentTypes = (agents: unknown): null | string[] => {return types.length > 0 ? types : null;};-const SettingsProvider = () => {+function SettingsProvider() {const { providerId } = useParams<{ providerId: string }>();const navigate = useNavigate();const [searchParams, setSearchParams] = useSearchParams();@@ -1850,6 +1843,6 @@ const SettingsProvider = () => {/></>);-};+}export default SettingsProvider;diff --git a/frontend/src/pages/settings/settings-providers.tsx b/frontend/src/pages/settings/settings-providers.tsxindex 8f3de4a0..f47f92f2 100644--- a/frontend/src/pages/settings/settings-providers.tsx+++ b/frontend/src/pages/settings/settings-providers.tsx@@ -80,53 +80,7 @@ const formatFullDateTime = (dateString: string) => {return format(date, 'd MMM yyyy, HH:mm:ss', { locale: enUS });};-const SettingsProvidersHeader = () => {- const navigate = useNavigate();-- const handleProviderCreate = (providerType: string) => {- navigate(`/settings/providers/new?type=${providerType}`);- };-- return (- <div className="flex items-center justify-between gap-4">- <p className="text-muted-foreground min-w-0 flex-1 truncate">Manage language model providers</p>-- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button- className="shrink-0"- variant="secondary"- >- Create Provider- <ChevronDown className="size-4" />- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent- align="end"- style={{- width: 'var(--radix-dropdown-menu-trigger-width)',- }}- >- {providerTypes.map(({ label, type }) => {- const Icon = providerIcons[type];-- return (- <DropdownMenuItem- key={type}- onClick={() => handleProviderCreate(type)}- >- {Icon && <Icon className="size-4" />}- {label}- </DropdownMenuItem>- );- })}- </DropdownMenuContent>- </DropdownMenu>- </div>- );-};--const SettingsProviders = () => {+function SettingsProviders() {const { data, error, loading: isLoading } = useSettingsProvidersQuery();const [deleteProvider, { error: deleteError, loading: isDeleteLoading }] = useDeleteProviderMutation();const [deleteErrorMessage, setDeleteErrorMessage] = useState<null | string>(null);@@ -524,6 +478,52 @@ const SettingsProviders = () => {/></div>);-};+}++function SettingsProvidersHeader() {+ const navigate = useNavigate();++ const handleProviderCreate = (providerType: string) => {+ navigate(`/settings/providers/new?type=${providerType}`);+ };++ return (+ <div className="flex items-center justify-between gap-4">+ <p className="text-muted-foreground min-w-0 flex-1 truncate">Manage language model providers</p>++ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ className="shrink-0"+ variant="secondary"+ >+ Create Provider+ <ChevronDown className="size-4" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ align="end"+ style={{+ width: 'var(--radix-dropdown-menu-trigger-width)',+ }}+ >+ {providerTypes.map(({ label, type }) => {+ const Icon = providerIcons[type];++ return (+ <DropdownMenuItem+ key={type}+ onClick={() => handleProviderCreate(type)}+ >+ {Icon && <Icon className="size-4" />}+ {label}+ </DropdownMenuItem>+ );+ })}+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ );+}export default SettingsProviders;diff --git a/frontend/src/pages/templates/template.tsx b/frontend/src/pages/templates/template.tsxindex a01a6b63..cbe34df1 100644--- a/frontend/src/pages/templates/template.tsx+++ b/frontend/src/pages/templates/template.tsx@@ -241,7 +241,7 @@ const renderTemplateItem = (item: Template, isCurrent: boolean): ReactNode => (<span className={isCurrent ? 'truncate font-medium' : 'truncate'}>{item.title}</span>);-const Template = () => {+function Template() {const navigate = useNavigate();const { templateId } = useParams<{ templateId?: string }>();const { createTemplate, deleteTemplate, updateTemplate } = useTemplates();@@ -802,6 +802,6 @@ const Template = () => {/></>);-};+}export default Template;diff --git a/frontend/src/pages/templates/templates.tsx b/frontend/src/pages/templates/templates.tsxindex 456ca02c..c67863f3 100644--- a/frontend/src/pages/templates/templates.tsx+++ b/frontend/src/pages/templates/templates.tsx@@ -27,7 +27,7 @@ import { useTableState } from '@/hooks/use-table-state';import { mergeHrefWithSearchParams } from '@/lib/url-params';import { type Template, useTemplates } from '@/providers/templates-provider';-const Templates = () => {+function Templates() {const navigate = useNavigate();const location = useLocation();const { deleteTemplate, templates, updateTemplate } = useTemplates();@@ -327,6 +327,6 @@ const Templates = () => {</div></>);-};+}export default Templates;diff --git a/frontend/src/providers/favorites-provider.tsx b/frontend/src/providers/favorites-provider.tsxindex 808665b4..b0dd7545 100644--- a/frontend/src/providers/favorites-provider.tsx+++ b/frontend/src/providers/favorites-provider.tsx@@ -27,7 +27,7 @@ const FavoritesContext = createContext<FavoritesContextValue | undefined>(undeficonst FAVORITES_STORAGE_KEY = 'favorites';-export const FavoritesProvider = ({ children }: FavoritesProviderProps) => {+export function FavoritesProvider({ children }: FavoritesProviderProps) {const { authInfo, isAuthenticated } = useUser();// Only fetch user preferences if user is authenticated and not a guest@@ -209,9 +209,9 @@ export const FavoritesProvider = ({ children }: FavoritesProviderProps) => {);return <FavoritesContext.Provider value={value}>{children}</FavoritesContext.Provider>;-};+}-export const useFavorites = () => {+export function useFavorites() {const context = useContext(FavoritesContext);if (context === undefined) {@@ -219,4 +219,4 @@ export const useFavorites = () => {}return context;-};+}diff --git a/frontend/src/providers/flow-provider.tsx b/frontend/src/providers/flow-provider.tsxindex 0957e63b..e1e2b27f 100644--- a/frontend/src/providers/flow-provider.tsx+++ b/frontend/src/providers/flow-provider.tsx@@ -61,7 +61,7 @@ interface FlowProviderProps {children: React.ReactNode;}-export const FlowProvider = ({ children }: FlowProviderProps) => {+export function FlowProvider({ children }: FlowProviderProps) {const { flowId } = useParams();const [selectedAssistantIds, setSelectedAssistantIds] = useState<Record<string, null | string>>({});@@ -413,9 +413,9 @@ export const FlowProvider = ({ children }: FlowProviderProps) => {);return <FlowContext.Provider value={value}>{children}</FlowContext.Provider>;-};+}-export const useFlow = () => {+export function useFlow() {const context = useContext(FlowContext);if (context === undefined) {@@ -423,4 +423,4 @@ export const useFlow = () => {}return context;-};+}diff --git a/frontend/src/providers/flows-provider.tsx b/frontend/src/providers/flows-provider.tsxindex fe790883..0ad36d4d 100644--- a/frontend/src/providers/flows-provider.tsx+++ b/frontend/src/providers/flows-provider.tsx@@ -36,7 +36,7 @@ interface FlowsProviderProps {children: React.ReactNode;}-export const FlowsProvider = ({ children }: FlowsProviderProps) => {+export function FlowsProvider({ children }: FlowsProviderProps) {// Query for flows listconst {data: flowsData,@@ -243,9 +243,9 @@ export const FlowsProvider = ({ children }: FlowsProviderProps) => {);return <FlowsContext.Provider value={value}>{children}</FlowsContext.Provider>;-};+}-export const useFlows = () => {+export function useFlows() {const context = useContext(FlowsContext);if (context === undefined) {@@ -253,4 +253,4 @@ export const useFlows = () => {}return context;-};+}diff --git a/frontend/src/providers/knowledges-provider.tsx b/frontend/src/providers/knowledges-provider.tsxindex 1b02a53d..c3a52e05 100644--- a/frontend/src/providers/knowledges-provider.tsx+++ b/frontend/src/providers/knowledges-provider.tsx@@ -41,7 +41,7 @@ interface KnowledgesProviderProps {const KnowledgesContext = createContext<KnowledgesContextValue | undefined>(undefined);-export const KnowledgesProvider = ({ children }: KnowledgesProviderProps) => {+export function KnowledgesProvider({ children }: KnowledgesProviderProps) {const { authInfo, isAuthenticated } = useUser();const shouldFetch = Boolean(authInfo && authInfo.type !== 'guest' && isAuthenticated());@@ -131,9 +131,9 @@ export const KnowledgesProvider = ({ children }: KnowledgesProviderProps) => {);return <KnowledgesContext.Provider value={value}>{children}</KnowledgesContext.Provider>;-};+}-export const useKnowledges = () => {+export function useKnowledges() {const context = useContext(KnowledgesContext);if (context === undefined) {@@ -141,4 +141,4 @@ export const useKnowledges = () => {}return context;-};+}diff --git a/frontend/src/providers/providers-provider.tsx b/frontend/src/providers/providers-provider.tsxindex bbc72d14..7e1d012f 100644--- a/frontend/src/providers/providers-provider.tsx+++ b/frontend/src/providers/providers-provider.tsx@@ -20,7 +20,7 @@ interface ProvidersProviderProps {children: React.ReactNode;}-export const ProvidersProvider = ({ children }: ProvidersProviderProps) => {+export function ProvidersProvider({ children }: ProvidersProviderProps) {const { isAuthenticated } = useUser();const { data: providersData } = useProvidersQuery({@@ -72,9 +72,9 @@ export const ProvidersProvider = ({ children }: ProvidersProviderProps) => {};return <ProvidersContext.Provider value={value}>{children}</ProvidersContext.Provider>;-};+}-export const useProviders = () => {+export function useProviders() {const context = useContext(ProvidersContext);if (context === undefined) {@@ -82,4 +82,4 @@ export const useProviders = () => {}return context;-};+}diff --git a/frontend/src/providers/resources-provider.tsx b/frontend/src/providers/resources-provider.tsxindex d9363582..5c893d7d 100644--- a/frontend/src/providers/resources-provider.tsx+++ b/frontend/src/providers/resources-provider.tsx@@ -46,7 +46,7 @@ const RESOURCES_ERROR_TOAST_ID = 'resources-error';* once we no longer need the snake_case → camelCase conversion that REST* requires (see `restResourceEntryToFragment`).*/-export const ResourcesProvider = ({ children }: ResourcesProviderProps) => {+export function ResourcesProvider({ children }: ResourcesProviderProps) {const { authInfo, isAuthenticated } = useUser();const shouldFetchResources = Boolean(authInfo && authInfo.type !== 'guest' && isAuthenticated());@@ -159,9 +159,9 @@ export const ResourcesProvider = ({ children }: ResourcesProviderProps) => {);return <ResourcesContext.Provider value={value}>{children}</ResourcesContext.Provider>;-};+}-export const useResources = () => {+export function useResources() {const context = useContext(ResourcesContext);if (context === undefined) {@@ -169,4 +169,4 @@ export const useResources = () => {}return context;-};+}diff --git a/frontend/src/providers/sidebar-flows-provider.tsx b/frontend/src/providers/sidebar-flows-provider.tsxindex aac12cf0..b3815e7d 100644--- a/frontend/src/providers/sidebar-flows-provider.tsx+++ b/frontend/src/providers/sidebar-flows-provider.tsx@@ -16,7 +16,7 @@ interface SidebarFlowsProviderProps {children: ReactNode;}-export const SidebarFlowsProvider = ({ children }: SidebarFlowsProviderProps) => {+export function SidebarFlowsProvider({ children }: SidebarFlowsProviderProps) {// Single query for sidebar flows with cache-first policy// Subscriptions are handled by FlowsProvider in FlowsLayoutconst { data: flowsData } = useFlowsQuery({@@ -34,9 +34,9 @@ export const SidebarFlowsProvider = ({ children }: SidebarFlowsProviderProps) =>);return <SidebarFlowsContext.Provider value={value}>{children}</SidebarFlowsContext.Provider>;-};+}-export const useSidebarFlows = () => {+export function useSidebarFlows() {const context = useContext(SidebarFlowsContext);if (context === undefined) {@@ -44,4 +44,4 @@ export const useSidebarFlows = () => {}return context;-};+}diff --git a/frontend/src/providers/system-settings-provider.tsx b/frontend/src/providers/system-settings-provider.tsxindex da131546..5db2579c 100644--- a/frontend/src/providers/system-settings-provider.tsx+++ b/frontend/src/providers/system-settings-provider.tsx@@ -14,7 +14,7 @@ interface SettingsContextType {const SystemSettingsContext = createContext<SettingsContextType | undefined>(undefined);-export const SystemSettingsProvider = ({ children }: { children: ReactNode }) => {+export function SystemSettingsProvider({ children }: { children: ReactNode }) {const { isAuthenticated } = useUser();// Load settings via GraphQL query only when user is authenticated@@ -32,9 +32,9 @@ export const SystemSettingsProvider = ({ children }: { children: ReactNode }) =>{children}</SystemSettingsContext>);-};+}-export const useSystemSettings = () => {+export function useSystemSettings() {const context = use(SystemSettingsContext);if (context === undefined) {@@ -42,4 +42,4 @@ export const useSystemSettings = () => {}return context;-};+}diff --git a/frontend/src/providers/templates-provider.tsx b/frontend/src/providers/templates-provider.tsxindex 7c1ececf..ee4aa7fc 100644--- a/frontend/src/providers/templates-provider.tsx+++ b/frontend/src/providers/templates-provider.tsx@@ -37,7 +37,7 @@ interface TemplatesProviderProps {const TemplatesContext = createContext<TemplatesContextValue | undefined>(undefined);-export const TemplatesProvider = ({ children }: TemplatesProviderProps) => {+export function TemplatesProvider({ children }: TemplatesProviderProps) {const { authInfo, isAuthenticated } = useUser();const shouldFetchTemplates = Boolean(authInfo && authInfo.type !== 'guest' && isAuthenticated());@@ -167,9 +167,9 @@ export const TemplatesProvider = ({ children }: TemplatesProviderProps) => {);return <TemplatesContext.Provider value={value}>{children}</TemplatesContext.Provider>;-};+}-export const useTemplates = () => {+export function useTemplates() {const context = useContext(TemplatesContext);if (context === undefined) {@@ -177,4 +177,4 @@ export const useTemplates = () => {}return context;-};+}diff --git a/frontend/src/providers/theme-provider.tsx b/frontend/src/providers/theme-provider.tsxindex b970300b..548e3c84 100644--- a/frontend/src/providers/theme-provider.tsx+++ b/frontend/src/providers/theme-provider.tsx@@ -24,12 +24,12 @@ const initialState: ThemeProviderState = {export const ThemeProviderContext = createContext<ThemeProviderState>(initialState);-export const ThemeProvider = ({+export function ThemeProvider({children,defaultTheme = 'system',storageKey = 'theme',...props-}: ThemeProviderProps) => {+}: ThemeProviderProps) {const [theme, setTheme] = useState<Theme>(() => {const storedTheme = localStorage.getItem(storageKey);@@ -80,4 +80,4 @@ export const ThemeProvider = ({{children}</ThemeProviderContext.Provider>);-};+}diff --git a/frontend/src/providers/user-provider.tsx b/frontend/src/providers/user-provider.tsxindex 73d3bcda..ee6df25b 100644--- a/frontend/src/providers/user-provider.tsx+++ b/frontend/src/providers/user-provider.tsx@@ -39,7 +39,7 @@ const UserContext = createContext<undefined | UserContextType>(undefined);export const AUTH_STORAGE_KEY = 'auth';-export const UserProvider = ({ children }: { children: ReactNode }) => {+export function UserProvider({ children }: { children: ReactNode }) {const navigate = useNavigate();const location = useLocation();const [authInfo, setAuthInfo] = useState<AuthInfo | null>(null);@@ -396,9 +396,9 @@ export const UserProvider = ({ children }: { children: ReactNode }) => {{children}</UserContext>);-};+}-export const useUser = () => {+export function useUser() {const context = use(UserContext);if (context === undefined) {@@ -406,4 +406,4 @@ export const useUser = () => {}return context;-};+}