Compare commits

...

5 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
856ab6c721 Address code review feedback: optimize theme provider
Co-authored-by: howardjohn <623453+howardjohn@users.noreply.github.com>
2026-02-16 00:52:40 +00:00
copilot-swe-agent[bot]
3ba3520502 Fix linting errors and build successfully
Co-authored-by: howardjohn <623453+howardjohn@users.noreply.github.com>
2026-02-16 00:51:34 +00:00
copilot-swe-agent[bot]
6c708133e2 Clean up Next.js configuration files
Co-authored-by: howardjohn <623453+howardjohn@users.noreply.github.com>
2026-02-16 00:49:35 +00:00
copilot-swe-agent[bot]
845d103d78 Replace Next.js with Vite + React Router
Co-authored-by: howardjohn <623453+howardjohn@users.noreply.github.com>
2026-02-16 00:48:34 +00:00
copilot-swe-agent[bot]
e32afeda5d Initial plan 2026-02-16 00:39:29 +00:00
67 changed files with 2116 additions and 3910 deletions

View File

@ -1,21 +0,0 @@
{
"extends": [
"next/core-web-vitals",
"next/typescript",
"prettier"
],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": ["error", {
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"
}],
"semi": "off",
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-empty-object-type": "off"
}
}

42
ui/.gitignore vendored
View File

@ -1,41 +1,27 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
# Dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# Production
/out
# next.js
/.next/
/out/
# production
/build
# misc
# Misc
.DS_Store
*.pem
# debug
# Local env files
.env*
# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files (can opt-in for committing if needed)
.env*
# Build artifacts
dist
.vite
*.local
# vercel
.vercel
# typescript
# TypeScript
*.tsbuildinfo
next-env.d.ts

View File

@ -1,6 +1,6 @@
# agentgateway UI
The agentgateway UI is a web-based interface for managing an agentgateway.
The agentgateway UI is a web-based interface for managing an agentgateway, built with React and Vite.
## Development
@ -9,4 +9,12 @@ npm install
npm run dev
```
Make sure agentgateway is running as well. The UI must run on port 3000.
Make sure agentgateway is running as well.
## Building
```bash
npm run build
```
The built files will be output to the `out/` directory, which is embedded in the agentgateway binary.

46
ui/eslint.config.js Normal file
View File

@ -0,0 +1,46 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import prettier from 'eslint-plugin-prettier'
import eslintConfigPrettier from 'eslint-config-prettier'
export default tseslint.config(
{ ignores: ['out', 'node_modules'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended, eslintConfigPrettier],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
prettier,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'prettier/prettier': [
'error',
{
semi: true,
singleQuote: false,
tabWidth: 2,
trailingComma: 'es5',
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_' },
],
'@typescript-eslint/no-empty-object-type': 'off',
},
},
)

13
ui/index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/ui/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Agentgateway Dashboard</title>
</head>
<body class="h-full flex flex-col antialiased">
<div id="root" class="h-full flex flex-col"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

View File

@ -1,9 +0,0 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "export",
basePath: "/ui",
trailingSlash: true,
};
export default nextConfig;

5291
ui/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,12 +4,12 @@
"private": false,
"description": "UI for agentgateway",
"main": "index.js",
"type": "module",
"scripts": {
"dev": "next dev --turbopack",
"build": "npm run lint -- --fix && next build",
"start": "next start",
"lint": "next lint",
"prepublishOnly": "npm run build"
"dev": "vite",
"build": "npm run lint && tsc && vite build",
"preview": "vite preview",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives"
},
"dependencies": {
"@a2a-js/sdk": "^0.3.8",
@ -38,11 +38,10 @@
"js-yaml": "^4.1.1",
"lucide-react": "^0.487.0",
"monaco-editor": "^0.55.1",
"next": "^15.5.9",
"next-themes": "^0.4.6",
"postcss": "^8.5.3",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router-dom": "^7.1.3",
"sonner": "^2.0.3",
"tailwind-merge": "^3.2.0",
"tw-animate-css": "^1.2.5",
@ -54,12 +53,17 @@
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9",
"eslint-config-next": "15.3.6",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.16",
"globals": "^17.3.0",
"tailwindcss": "^4.1.3",
"typescript": "^5"
"typescript": "^5",
"typescript-eslint": "^8.55.0",
"vite": "^6.0.11"
},
"files": [
"bin/",

View File

@ -1,5 +1,5 @@
const config = {
plugins: ["@tailwindcss/postcss"],
export default {
plugins: {
'@tailwindcss/postcss': {},
},
};
export default config;

60
ui/src/App.tsx Normal file
View File

@ -0,0 +1,60 @@
import { Routes, Route } from "react-router-dom";
import { ThemeProvider } from "@/components/theme-provider";
import { LoadingWrapper } from "@/components/loading-wrapper";
import { Toaster } from "@/components/ui/sonner";
import { ServerProvider } from "@/lib/server-context";
import { SidebarProvider } from "@/components/ui/sidebar";
import { SidebarWrapper } from "@/components/sidebar-wrapper";
import { WizardProvider } from "@/lib/wizard-context";
import { ConfigErrorWrapper } from "@/components/config-error-wrapper";
import { XdsModeNotification } from "@/components/xds-mode-notification";
// Import pages
import Home from "@/app/page";
import Backends from "@/app/backends/page";
import Cel from "@/app/cel/page";
import Listeners from "@/app/listeners/page";
import Playground from "@/app/playground/page";
import Policies from "@/app/policies/page";
import RoutesPage from "@/app/routes/page";
function App() {
return (
<ServerProvider>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
storageKey="agentgateway-theme"
>
<XdsModeNotification />
<LoadingWrapper>
<WizardProvider>
<ConfigErrorWrapper>
<SidebarProvider>
<div className="flex min-h-screen w-full">
<SidebarWrapper />
<main className="flex-1 overflow-auto">
<Routes>
<Route path="/" element={<Home />} />
<Route path="/backends" element={<Backends />} />
<Route path="/cel" element={<Cel />} />
<Route path="/listeners" element={<Listeners />} />
<Route path="/playground" element={<Playground />} />
<Route path="/policies" element={<Policies />} />
<Route path="/routes" element={<RoutesPage />} />
</Routes>
</main>
</div>
</SidebarProvider>
<Toaster richColors />
</ConfigErrorWrapper>
</WizardProvider>
</LoadingWrapper>
</ThemeProvider>
</ServerProvider>
);
}
export default App;

View File

@ -1,5 +1,3 @@
"use client";
import { BackendConfig } from "@/components/backend-config";
import { useServer } from "@/lib/server-context";
import { Alert, AlertDescription } from "@/components/ui/alert";

View File

@ -1,8 +1,5 @@
"use client";
import React, { useCallback, useEffect, useRef, useState } from "react";
import dynamic from "next/dynamic";
import { useTheme } from "next-themes";
import React, { useCallback, useEffect, useRef, useState, lazy, Suspense } from "react";
import { useTheme } from "@/hooks/use-theme";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";
@ -12,7 +9,7 @@ import yaml from "js-yaml";
import { API_URL } from "@/lib/api";
// dynamic import OUTSIDE component to avoid remount on every render
const MonacoEditor = dynamic(() => import("@monaco-editor/react"), { ssr: false });
const MonacoEditor = lazy(() => import("@monaco-editor/react"));
type TemplateKey = "empty" | "http";
@ -227,17 +224,19 @@ export default function CELPlayground(): React.JSX.Element {
<label className="block text-sm font-medium mb-2">Expression</label>
<Card>
<CardContent className="p-4">
<MonacoEditor
height="250px"
defaultLanguage="javascript"
language="javascript"
theme={editorTheme}
value={expression}
onChange={(v) => setExpression(v ?? "")}
loading={<Skeleton className="h-32" />}
onMount={handleEditorMount}
options={{ minimap: { enabled: false }, lineNumbers: "off", wordWrap: "on" }}
/>
<Suspense fallback={<Skeleton className="h-32" />}>
<MonacoEditor
height="250px"
defaultLanguage="javascript"
language="javascript"
theme={editorTheme}
value={expression}
onChange={(v) => setExpression(v ?? "")}
loading={<Skeleton className="h-32" />}
onMount={handleEditorMount}
options={{ minimap: { enabled: false }, lineNumbers: "off", wordWrap: "on" }}
/>
</Suspense>
<div className="flex gap-2 mt-3 flex-wrap">
{EXAMPLES.map((ex, idx) => (
@ -279,20 +278,22 @@ export default function CELPlayground(): React.JSX.Element {
</pre>
</div>
) : resultValue !== null ? (
<MonacoEditor
height="250px"
defaultLanguage="json"
language="json"
theme={editorTheme}
value={JSON.stringify(resultValue, null, 2)}
loading={<Skeleton className="h-[250px]" />}
options={{
minimap: { enabled: false },
lineNumbers: "off",
readOnly: true,
wordWrap: "on",
}}
/>
<Suspense fallback={<Skeleton className="h-[250px]" />}>
<MonacoEditor
height="250px"
defaultLanguage="json"
language="json"
theme={editorTheme}
value={JSON.stringify(resultValue, null, 2)}
loading={<Skeleton className="h-[250px]" />}
options={{
minimap: { enabled: false },
lineNumbers: "off",
readOnly: true,
wordWrap: "on",
}}
/>
</Suspense>
) : (
<div className="h-[250px] flex items-center justify-center text-sm text-muted-foreground">
Press Evaluate or Ctrl+Enter to run
@ -318,17 +319,19 @@ export default function CELPlayground(): React.JSX.Element {
</div>
<Card>
<CardContent className="p-4">
<MonacoEditor
height="705px"
defaultLanguage="yaml"
language="yaml"
theme={editorTheme}
value={inputData}
onChange={(v) => setInputData(v ?? "")}
loading={<Skeleton className="h-48" />}
onMount={handleEditorMount}
options={{ minimap: { enabled: false }, lineNumbers: "off", wordWrap: "on" }}
/>
<Suspense fallback={<Skeleton className="h-48" />}>
<MonacoEditor
height="705px"
defaultLanguage="yaml"
language="yaml"
theme={editorTheme}
value={inputData}
onChange={(v) => setInputData(v ?? "")}
loading={<Skeleton className="h-48" />}
onMount={handleEditorMount}
options={{ minimap: { enabled: false }, lineNumbers: "off", wordWrap: "on" }}
/>
</Suspense>
</CardContent>
</Card>
</section>

View File

@ -7,6 +7,20 @@
@tailwind components;
@tailwind utilities;
/* Font faces */
@layer base {
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
}
code, pre {
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
'Liberation Mono', monospace;
}
}
@layer base {
:root {
--background: 0 0% 100%;

View File

@ -1,69 +0,0 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { ThemeProvider } from "@/components/theme-provider";
import { LoadingWrapper } from "@/components/loading-wrapper";
import { Toaster } from "@/components/ui/sonner";
import { ServerProvider } from "@/lib/server-context";
import { SidebarProvider } from "@/components/ui/sidebar";
import { SidebarWrapper } from "@/components/sidebar-wrapper";
import { WizardProvider } from "@/lib/wizard-context";
import { ConfigErrorWrapper } from "@/components/config-error-wrapper";
import { XdsModeNotification } from "@/components/xds-mode-notification";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Agentgateway Dashboard",
description: "Agentgateway Dashboard",
icons: {
icon: "/ui/favicon.svg",
},
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en" className="h-full" suppressHydrationWarning>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased h-full flex flex-col`}
>
<ServerProvider>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
storageKey="agentgateway-theme"
>
<XdsModeNotification />
<LoadingWrapper>
<WizardProvider>
<ConfigErrorWrapper>
<SidebarProvider>
<div className="flex min-h-screen w-full">
<SidebarWrapper />
<main className="flex-1 overflow-auto">{children}</main>
</div>
</SidebarProvider>
<Toaster richColors />
</ConfigErrorWrapper>
</WizardProvider>
</LoadingWrapper>
</ThemeProvider>
</ServerProvider>
</body>
</html>
);
}

View File

@ -1,5 +1,3 @@
"use client";
import { ListenerConfig } from "@/components/listener-config";
import { useServer } from "@/lib/server-context";
import { Alert, AlertDescription } from "@/components/ui/alert";

View File

@ -1,5 +1,3 @@
"use client";
import { useState, useEffect } from "react";
import { SetupWizard } from "@/components/setup-wizard";
import { useLoading } from "@/lib/loading-context";
@ -27,7 +25,7 @@ import {
Database,
} from "lucide-react";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import Link from "next/link";
import { Link } from "react-router-dom";
import { LoadingState } from "@/components/loading-state";
import { useXdsMode } from "@/hooks/use-xds-mode";
@ -228,7 +226,7 @@ export default function Home() {
</Button>
) : (
<Button asChild>
<Link href="/listeners">
<Link to="/listeners">
<Plus className="h-4 w-4 mr-2" />
Create First Listener
</Link>
@ -274,7 +272,7 @@ export default function Home() {
</CardDescription>
<CardTitle className="text-3xl font-semibold mt-2">{binds?.length || 0}</CardTitle>
<Link
href="/listeners"
to="/listeners"
className="mt-3 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1 w-fit"
>
Manage binds
@ -291,7 +289,7 @@ export default function Home() {
</CardDescription>
<CardTitle className="text-3xl font-semibold mt-2">{getTotalListeners()}</CardTitle>
<Link
href="/listeners"
to="/listeners"
className="mt-3 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1 w-fit"
>
View listeners
@ -308,7 +306,7 @@ export default function Home() {
</CardDescription>
<CardTitle className="text-3xl font-semibold mt-2">{getTotalRoutes()}</CardTitle>
<Link
href="/routes"
to="/routes"
className="mt-3 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1 w-fit"
>
Manage routes
@ -325,7 +323,7 @@ export default function Home() {
</CardDescription>
<CardTitle className="text-3xl font-semibold mt-2">{getTotalBackends()}</CardTitle>
<Link
href="/backends"
to="/backends"
className="mt-3 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1 w-fit"
>
View backends
@ -427,7 +425,7 @@ export default function Home() {
</Button>
) : (
<Button asChild variant="outline" className="w-full justify-start">
<Link href="/listeners">
<Link to="/listeners">
<Plus className="h-4 w-4 mr-2" />
Add Listener
</Link>
@ -444,7 +442,7 @@ export default function Home() {
</Button>
) : (
<Button asChild variant="outline" className="w-full justify-start">
<Link href="/routes">
<Link to="/routes">
<Route className="h-4 w-4 mr-2" />
Create Route
</Link>
@ -461,14 +459,14 @@ export default function Home() {
</Button>
) : (
<Button asChild variant="outline" className="w-full justify-start">
<Link href="/policies">
<Link to="/policies">
<Shield className="h-4 w-4 mr-2" />
Configure Policy
</Link>
</Button>
)}
<Button asChild variant="outline" className="w-full justify-start">
<Link href="/playground">
<Link to="/playground">
<Code className="h-4 w-4 mr-2" />
Test Routes
</Link>

View File

@ -1,5 +1,3 @@
"use client";
import { useState, useEffect, useCallback } from "react";
import { Client as McpClient } from "@modelcontextprotocol/sdk/client/index.js";
import { SSEClientTransport as McpSseTransport } from "@modelcontextprotocol/sdk/client/sse.js";
@ -505,7 +503,7 @@ export default function PlaygroundPage() {
headers: async () => ({
Authorization: `Bearer ${connectionState.authToken}`,
}),
shouldRetryWithHeaders: async (req: RequestInit, res: Response) => {
shouldRetryWithHeaders: async (_req: RequestInit, res: Response) => {
// Retry with auth headers on 401 or 403 responses
if (res.status === 401 || res.status === 403) {
return {

View File

@ -1,5 +1,3 @@
"use client";
import { PolicyConfig } from "@/components/policy-config";
import { useServer } from "@/lib/server-context";
import { Alert, AlertDescription } from "@/components/ui/alert";

View File

@ -1,5 +1,3 @@
"use client";
import { RouteConfig } from "@/components/route-config";
import { useServer } from "@/lib/server-context";
import { Alert, AlertDescription } from "@/components/ui/alert";

View File

@ -1,5 +1,3 @@
"use client";
import { useState } from "react";
import {
Sidebar,
@ -37,7 +35,7 @@ import {
Route,
Calculator,
} from "lucide-react";
import { useRouter, usePathname } from "next/navigation";
import { useNavigate, useLocation } from "react-router-dom";
import { useWizard } from "@/lib/wizard-context";
import { toast } from "sonner";
import { useServer } from "@/lib/server-context";
@ -49,8 +47,9 @@ interface AppSidebarProps {
export function AppSidebar({ setActiveView }: AppSidebarProps) {
const [showRestartDialog, setShowRestartDialog] = useState(false);
const router = useRouter();
const pathname = usePathname();
const navigate = useNavigate();
const location = useLocation();
const pathname = location.pathname;
const { restartWizard, isRestartingWizard } = useWizard();
const { listeners } = useServer();
@ -90,7 +89,7 @@ export function AppSidebar({ setActiveView }: AppSidebarProps) {
};
const navigateTo = (path: string) => {
router.push(path);
navigate(path);
setActiveView(path.split("/").pop() || "home");
};

View File

@ -1,5 +1,3 @@
"use client";
import { useEffect } from "react";
import { Button } from "@/components/ui/button";
import { Plus, Target } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import React from "react";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";

View File

@ -1,5 +1,3 @@
"use client";
import { useServer } from "@/lib/server-context";
import { ConfigError } from "@/components/config-error";

View File

@ -1,5 +1,3 @@
"use client";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { AlertTriangle } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import { useState } from "react";
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input";

View File

@ -1,5 +1,3 @@
"use client";
import { useState, useEffect, MouseEvent } from "react";
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input";

View File

@ -1,5 +1,3 @@
"use client";
import { useMemo, useState } from "react";
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input";

View File

@ -1,5 +1,3 @@
"use client";
import { useCallback, useEffect, useState } from "react";
import { toast } from "sonner";
import { Label } from "@/components/ui/label";
@ -17,7 +15,7 @@ import {
ChevronRight,
ExternalLink,
} from "lucide-react";
import Link from "next/link";
import { Link } from "react-router-dom";
import {
fetchBinds,
createBind,
@ -596,7 +594,7 @@ export function ListenerConfig({
<TableCell>
<div className="flex items-center space-x-2">
<Link
href="/policies"
to="/policies"
className="flex items-center underline space-x-1 hover:text-primary"
>
<span className="text-sm">View Policies</span>

View File

@ -1,5 +1,3 @@
"use client";
import { AgentgatewayLogo } from "@/components/agentgateway-logo";
import { motion } from "framer-motion";

View File

@ -1,5 +1,3 @@
"use client";
import { ReactNode } from "react";
import { LoadingProvider } from "@/lib/loading-context";

View File

@ -1,5 +1,3 @@
"use client";
import React, { useState } from "react";
import { Tool as McpTool } from "@modelcontextprotocol/sdk/types.js";
import type { AgentSkill } from "@a2a-js/sdk";

View File

@ -1,5 +1,3 @@
"use client";
import { Tool as McpTool } from "@modelcontextprotocol/sdk/types.js";
import type { AgentSkill, AgentCard } from "@a2a-js/sdk";
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";

View File

@ -1,5 +1,3 @@
"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
interface ResponseDisplayProps {

View File

@ -1,5 +1,3 @@
"use client";
import { useCallback, useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";

View File

@ -1,5 +1,3 @@
"use client";
import { useEffect } from "react";
import { Button } from "@/components/ui/button";
import { Plus, Route } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import { useState } from "react";
import { LocalConfig } from "@/lib/types";
import { WelcomeStep } from "./WelcomeStep";

View File

@ -75,7 +75,7 @@ export const A2ATargetForm = forwardRef<{ submitForm: () => Promise<void> }, A2A
} else if (parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:") {
finalPortNumber = parsedUrl.protocol === "https:" ? 443 : 80;
} else {
toast.error(`Port is required for protocol \"${parsedUrl.protocol}\" or use http/https.`);
toast.error(`Port is required for protocol "${parsedUrl.protocol}" or use http/https.`);
isValidationError = true;
return;
}

View File

@ -1,5 +1,3 @@
"use client";
import { useState, useEffect } from "react";
import { AppSidebar } from "@/components/app-sidebar";
import { useServer } from "@/lib/server-context";

View File

@ -1,5 +1,3 @@
"use client";
import { TargetType, TargetWithType } from "@/lib/types";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";

View File

@ -1,11 +1,117 @@
"use client";
import * as React from "react";
import { ThemeProvider as NextThemesProvider } from "next-themes";
type Theme = "dark" | "light" | "system";
interface ThemeProviderProps {
children: React.ReactNode;
attribute?: string;
defaultTheme?: Theme;
enableSystem?: boolean;
disableTransitionOnChange?: boolean;
storageKey?: string;
}
interface ThemeProviderState {
theme: Theme;
setTheme: (theme: Theme) => void;
resolvedTheme?: "dark" | "light";
}
const ThemeProviderContext = React.createContext<ThemeProviderState | undefined>(undefined);
export function ThemeProvider({
children,
attribute = "class",
defaultTheme = "system",
enableSystem = true,
disableTransitionOnChange = false,
storageKey = "theme",
...props
}: React.ComponentProps<typeof NextThemesProvider>) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
}: ThemeProviderProps) {
const [theme, setThemeState] = React.useState<Theme>(defaultTheme);
const [resolvedTheme, setResolvedTheme] = React.useState<"dark" | "light">();
React.useEffect(() => {
// Load theme from localStorage
const stored = localStorage.getItem(storageKey);
if (stored) {
setThemeState(stored as Theme);
}
}, [storageKey]);
React.useEffect(() => {
const root = window.document.documentElement;
if (disableTransitionOnChange) {
root.classList.add("no-transition");
}
root.classList.remove("light", "dark");
let resolved: "dark" | "light";
if (theme === "system" && enableSystem) {
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light";
resolved = systemTheme;
} else {
resolved = theme === "dark" ? "dark" : "light";
}
if (attribute === "class") {
root.classList.add(resolved);
} else {
root.setAttribute(attribute, resolved);
}
setResolvedTheme(resolved);
if (disableTransitionOnChange) {
requestAnimationFrame(() => {
root.classList.remove("no-transition");
});
}
}, [theme, attribute, enableSystem, disableTransitionOnChange]);
const setTheme = React.useCallback(
(newTheme: Theme) => {
localStorage.setItem(storageKey, newTheme);
setThemeState(newTheme);
},
[storageKey]
);
const value = React.useMemo(
() => ({
theme,
setTheme,
resolvedTheme,
}),
[theme, setTheme, resolvedTheme]
);
return (
<ThemeProviderContext.Provider {...props} value={value}>
{children}
</ThemeProviderContext.Provider>
);
}
export const useTheme = () => {
const context = React.useContext(ThemeProviderContext);
if (context === undefined) {
throw new Error("useTheme must be used within a ThemeProvider");
}
// Memoize systemTheme to avoid repeated window.matchMedia calls
const systemTheme = React.useMemo(
() => (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"),
[]
);
return {
...context,
systemTheme,
};
};

View File

@ -1,8 +1,5 @@
"use client";
import * as React from "react";
import { Moon, Sun } from "lucide-react";
import { useTheme } from "next-themes";
import { useTheme } from "@/hooks/use-theme";
import { Button } from "@/components/ui/button";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as AccordionPrimitive from "@radix-ui/react-accordion";
import { ChevronDownIcon } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
import { Check } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import { Command as CommandPrimitive } from "cmdk";
import { SearchIcon } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { XIcon } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
import { Check, ChevronRight, Circle } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as LabelPrimitive from "@radix-ui/react-label";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as PopoverPrimitive from "@radix-ui/react-popover";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
import { CircleIcon } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as SelectPrimitive from "@radix-ui/react-select";
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as SeparatorPrimitive from "@radix-ui/react-separator";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as SheetPrimitive from "@radix-ui/react-dialog";
import { XIcon } from "lucide-react";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { VariantProps, cva } from "class-variance-authority";

View File

@ -1,6 +1,4 @@
"use client";
import { useTheme } from "next-themes";
import { useTheme } from "@/hooks/use-theme";
import { Toaster as Sonner, ToasterProps } from "sonner";
const Toaster = ({ ...props }: ToasterProps) => {

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import { cn } from "@/lib/utils";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as TabsPrimitive from "@radix-ui/react-tabs";

View File

@ -1,5 +1,3 @@
"use client";
import * as React from "react";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";

View File

@ -1,5 +1,3 @@
"use client";
import { useXdsMode } from "@/hooks/use-xds-mode";
export function XdsModeNotification() {

View File

@ -0,0 +1,3 @@
import { useTheme as useThemeContext } from "@/components/theme-provider";
export const useTheme = useThemeContext;

View File

@ -1,5 +1,3 @@
"use client";
import { createContext, useContext, useState, ReactNode, useEffect } from "react";
interface LoadingContextType {

View File

@ -1,5 +1,3 @@
"use client";
import React, { createContext, useContext, useState, useEffect } from "react";
import { Config, Target, RBACConfig, Listener, TargetWithType, Bind } from "@/lib/types";
import { fetchBinds, fetchMcpTargets, fetchA2aTargets } from "@/lib/api";

View File

@ -1,6 +1,4 @@
"use client";
import React, { createContext, useContext, useState, ReactNode, useEffect } from "react";
import { createContext, useContext, useState, ReactNode, useEffect } from "react";
import { useServer } from "@/lib/server-context";
import { useLoading } from "@/lib/loading-context";
import { deleteEverything } from "@/lib/api";

13
ui/src/main.tsx Normal file
View File

@ -0,0 +1,13 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
import App from "./App";
import "./app/globals.css";
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<BrowserRouter basename="/ui">
<App />
</BrowserRouter>
</React.StrictMode>
);

6
ui/src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/// <reference types="vite/client" />
declare module "*.css" {
const content: string;
export default content;
}

View File

@ -1,27 +1,33 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
/* Bundler mode */
"moduleResolution": "bundler",
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true,
"allowJs": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": ["src"],
"exclude": ["node_modules"]
}

18
ui/vite.config.ts Normal file
View File

@ -0,0 +1,18 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
base: "/ui/",
build: {
outDir: "out",
emptyOutDir: true,
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
});