import "@/index.css" import { DialogProvider } from "@opencode/ui/context/dialog" import { FileComponentProvider } from "@opencode/ui/context/file" import { Font } from "@opencode/ui/font" import { ThemeProvider } from "@opencode/ui/theme/context" import { MetaProvider } from "@solidjs/meta" import { type BaseRouterProps, Router, useLocation } from "@solidjs/router" import { QueryClient, QueryClientProvider } from "@tanstack/solid-query" import { type Component, createRenderEffect, ErrorBoundary, type JSX, type ParentProps, Show } from "solid-js" import { Dynamic } from "solid-js/web" import { CommandProvider } from "@/shell/commands/command" import { DesktopCommands } from "@/shell/commands/desktop" import { GlobalProvider } from "@/runtime/server/runtime" import { HighlightsProvider } from "@/shell/updates/highlights" import { LanguageProvider, UiI18nBridge, type Locale } from "@/runtime/i18n/language" import { ServerConnection, ServersProvider } from "@/runtime/server/registry" import { SettingsProvider } from "@/settings/model" import { TabsProvider } from "@/shell/tabs/tabs" import { WslServersProvider } from "@/servers/wsl/context" import { SshProvider } from "@/servers/ssh/context" import { SshRestore } from "@/servers/ssh/restore" import { ErrorPage } from "@/shell/errors/error" import { AppRoutes, File, preloadRoute } from "@/shell/routes/routes" export { preloadRoute } declare global { interface Window { api?: { setTitlebar?: (theme: { mode: "light" | "dark"; scheme?: "system" | "light" | "dark" }) => Promise exportDebugLogs?: () => Promise } } } function QueryProvider(props: ParentProps) { const client = new QueryClient({ defaultOptions: { queries: { refetchOnReconnect: false, refetchOnWindowFocus: false, refetchOnMount: false, }, }, }) return {props.children} } function BodyTypography() { createRenderEffect(() => { if (typeof document === "undefined") return document.body.classList.remove("text-12-regular") document.body.classList.add("font-(family-name:--font-family-text)", "text-[13px]", "font-[440]") }) return null } export function AppBaseProviders( props: ParentProps<{ locale?: Locale onNativeTranslations?: Parameters[0]["onNativeTranslations"] onThemeApplied?: (mode: "light" | "dark", scheme: "system" | "light" | "dark") => void }>, ) { return ( { void window.api?.setTitlebar?.({ mode, scheme }) props.onThemeApplied?.(mode, scheme) }} > { void import("@sentry/solid").then(({ captureException }) => captureException(error)) return }} > {props.children} ) } export function AppInterface(props: { children?: JSX.Element defaultServer?: ServerConnection.Key canonicalLocalServer?: ServerConnection.Key servers?: Array router?: Component }) { // The visual layout lives in the router root so it remains mounted across // route changes. Draft and session routes override only their server-bound data // providers beneath it. const Root = (rootProps: ParentProps) => { const location = useLocation() // Pairing saves credentials before mounting any server connections or health checks. return ( <> {props.children} {rootProps.children} ) } return ( ) }