import { Navigate, Outlet, createFileRoute, useRouterState, } from "@tanstack/react-router" import { AgentsShell } from "@/components/agents/AgentsSidebar" import { Skeleton } from "@/components/ui/skeleton" import agentsCss from "@/styles/agents.css?url" import { AgentThreadStreamProvider } from "@/lib/agents/AgentThreadStreamProvider" import { useSession } from "@/lib/session" export const Route = createFileRoute("/agents")({ head: () => ({ links: [{ rel: "stylesheet", href: agentsCss }], }), component: AgentsLayout, }) function AgentsLayout() { const session = useSession() const pathname = useRouterState({ select: (state) => state.location.pathname, }) const [, section, threadId] = pathname.split("/") const activeThreadId = section === "agents" && threadId && threadId !== "automations" ? threadId : undefined if (session.isLoading) { return (
) } if (!session.data) return return ( ) }