Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110// The route tree, shared by the server and the browser. Each side builds its// own router instance from it: the server a per-request memory-history router// (see router.server.ts), the browser a singleton (see router.client.ts).import { createRootRoute, createRoute, createRouter, redirect, type RouterHistory,} from "@octanejs/tanstack-router";
/** Key under which the server middleware stores the loaded router in request state. */export const ROUTER_STATE_KEY = "tanstack.router";
const rootRoute = createRootRoute().lazy(() => import("./routes/RootLayout.lazy.tsx").then((module) => module.Route),);
const indexRoute = createRoute({ getParentRoute: () => rootRoute, path: "/",}).lazy(() => import("./routes/Home.lazy.tsx").then((module) => module.Route));
const conversationRoute = createRoute({ getParentRoute: () => rootRoute, path: "conversations/$id",}).lazy(() => import("./routes/Conversation.lazy.tsx").then((module) => module.Route),);const tasksRoute = createRoute({ getParentRoute: () => rootRoute, path: "tasks",}).lazy(() => import("./routes/Tasks.lazy.tsx").then((module) => module.Route));const taskRoute = createRoute({ getParentRoute: () => rootRoute, path: "tasks/$id",}).lazy(() => import("./routes/Tasks.lazy.tsx").then((module) => module.TaskRoute),);// Preserve the old personal-agent entry point without retaining starter content.const agentsRoute = createRoute({ getParentRoute: () => rootRoute, path: "agents", beforeLoad: () => { throw redirect({ to: "/" }); },});
const settingsRoute = createRoute({ getParentRoute: () => rootRoute, path: "settings", beforeLoad: ({ location }) => { if ( location.hash.replace(/^#/, "") === "extensions-settings" || new URLSearchParams(location.searchStr).has("mcpAuth") ) { throw redirect({ href: `/extensions${location.searchStr}#mcp-settings`, replace: true, }); } },}).lazy(() => import("./routes/Settings.lazy.tsx").then((module) => module.Route),);const extensionsRoute = createRoute({ getParentRoute: () => rootRoute, path: "extensions",}).lazy(() => import("./routes/Extensions.lazy.tsx").then((module) => module.Route),);
const routeTree = rootRoute.addChildren([ indexRoute, conversationRoute, tasksRoute, taskRoute, agentsRoute, settingsRoute, extensionsRoute,]);
export interface RouterEnv { /** Memory history on the server; omitted in the browser (browser history). */ history?: RouterHistory; /** Use the non-reactive server store factory. */ isServer?: boolean; /** Request origin. Required on the server, where router-core would otherwise read `window`. */ origin?: string;}
export function createAppRouter(env: RouterEnv = {}) { return createRouter({ routeTree, history: env.history, isServer: env.isServer, origin: env.origin, defaultPreload: "intent", scrollRestoration: true, });}
export type AppRouter = ReturnType<typeof createAppRouter>;
declare module "@octanejs/tanstack-router" { interface Register { router: AppRouter; }}