Spaces:
No application file
No application file
Commit ·
7af792c
1
Parent(s): 992301a
force convert submodule to normal folder
Browse filesFiles changed (49)
- support-env-frontendDeleted-1
- support-env-frontend/.gitignoreAdded+41
- support-env-frontend/README.mdAdded+36
- support-env-frontend/components.jsonAdded+25
- support-env-frontend/eslint.config.mjsAdded+18
- support-env-frontend/next.config.tsAdded+8
- support-env-frontend/package-lock.jsonAdded
- support-env-frontend/package.jsonAdded+42
- support-env-frontend/postcss.config.mjsAdded+7
- support-env-frontend/public/file.svgAdded
- support-env-frontend/public/globe.svgAdded
- support-env-frontend/public/next.svgAdded
- support-env-frontend/public/vercel.svgAdded
- support-env-frontend/public/window.svgAdded
- support-env-frontend/src/app/api/proxy/route.tsAdded+49
- support-env-frontend/src/app/baseline/page.tsxAdded+273
- support-env-frontend/src/app/favicon.icoAdded
- support-env-frontend/src/app/globals.cssAdded+130
- support-env-frontend/src/app/layout.tsxAdded+32
- support-env-frontend/src/app/page.tsxAdded+195
- support-env-frontend/src/app/playground/page.tsxAdded+173
- support-env-frontend/src/app/tasks/page.tsxAdded+229
- support-env-frontend/src/components/environment/action-panel.tsxAdded+189
- support-env-frontend/src/components/environment/grading-results.tsxAdded+99
- support-env-frontend/src/components/environment/history-panel.tsxAdded+96
- support-env-frontend/src/components/environment/reward-display.tsxAdded+100
- support-env-frontend/src/components/environment/ticket-display.tsxAdded+141
- support-env-frontend/src/components/layout/header.tsxAdded+105
- support-env-frontend/src/components/shared/loading-spinner.tsxAdded+29
- support-env-frontend/src/components/ui/alert.tsxAdded+79
- support-env-frontend/src/components/ui/avatar.tsxAdded+112
- support-env-frontend/src/components/ui/badge.tsxAdded+49
- support-env-frontend/src/components/ui/button.tsxAdded+65
- support-env-frontend/src/components/ui/card.tsxAdded+103
- support-env-frontend/src/components/ui/dialog.tsxAdded+165
- support-env-frontend/src/components/ui/dropdown-menu.tsxAdded+269
- support-env-frontend/src/components/ui/input.tsxAdded+19
- support-env-frontend/src/components/ui/progress.tsxAdded+31
- support-env-frontend/src/components/ui/scroll-area.tsxAdded+55
- support-env-frontend/src/components/ui/select.tsxAdded+192
- support-env-frontend/src/components/ui/separator.tsxAdded+28
- support-env-frontend/src/components/ui/sheet.tsxAdded+147
- support-env-frontend/src/components/ui/skeleton.tsxAdded+13
- support-env-frontend/src/components/ui/sonner.tsxAdded+49
- support-env-frontend/src/components/ui/tabs.tsxAdded+90
- support-env-frontend/src/components/ui/textarea.tsxAdded+18
- support-env-frontend/src/components/ui/tooltip.tsxAdded+57
- support-env-frontend/tailwind.config.tsAdded+99
- support-env-frontend/tsconfig.jsonAdded+34
1Subproject commit 159bf2d9110ce8bce4df74ab7321f2b7939a6ea71234567891011121314151617181920212223242526272829303132333435363738394041# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies/node_modules/.pnp.pnp.*.yarn/*!.yarn/patches!.yarn/plugins!.yarn/releases!.yarn/versions
# testing/coverage
# next.js/.next//out/
# production/build
# misc.DS_Store*.pem
# debugnpm-debug.log*yarn-debug.log*yarn-error.log*.pnpm-debug.log*
# env files (can opt-in for committing if needed).env*
# vercel.vercel
# typescript*.tsbuildinfonext-env.d.ts123456789101112131415161718192021222324252627282930313233343536This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
## Getting Started
First, run the development server:
```bashnpm run dev# oryarn dev# orpnpm dev# orbun dev```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.12345678910111213141516171819202122232425{ "$schema": "https://ui.shadcn.com/schema.json", "style": "radix-lyra", "rsc": true, "tsx": true, "tailwind": { "config": "", "css": "src/app/globals.css", "baseColor": "neutral", "cssVariables": true, "prefix": "" }, "iconLibrary": "phosphor", "rtl": false, "aliases": { "components": "@/components", "utils": "@/lib/utils", "ui": "@/components/ui", "lib": "@/lib", "hooks": "@/hooks" }, "menuColor": "default", "menuAccent": "subtle", "registries": {}}123456789101112131415161718import { defineConfig, globalIgnores } from "eslint/config";import nextVitals from "eslint-config-next/core-web-vitals";import nextTs from "eslint-config-next/typescript";
const eslintConfig = defineConfig([ ...nextVitals, ...nextTs, // Override default ignores of eslint-config-next. globalIgnores([ // Default ignores of eslint-config-next: ".next/**", "out/**", "build/**", "next-env.d.ts", ]),]);
export default eslintConfig;12345678import type { NextConfig } from "next";
const nextConfig: NextConfig = { /* config options here */ reactCompiler: true,};
export default nextConfig;123456789101112131415161718192021222324252627282930313233343536373839404142{ "name": "support-env-frontend", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "eslint" }, "dependencies": { "@phosphor-icons/react": "^2.1.10", "@tanstack/react-query": "^5.95.2", "axios": "^1.14.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "framer-motion": "^12.38.0", "lucide-react": "^1.7.0", "next": "16.2.1", "next-themes": "^0.4.6", "radix-ui": "^1.4.3", "react": "19.2.4", "react-dom": "19.2.4", "recharts": "^3.8.1", "shadcn": "^4.1.1", "sonner": "^2.0.7", "tailwind-merge": "^3.5.0", "tw-animate-css": "^1.4.0", "zustand": "^5.0.12" }, "devDependencies": { "@tailwindcss/postcss": "^4", "@types/node": "^20.19.37", "@types/react": "^19", "@types/react-dom": "^19", "babel-plugin-react-compiler": "1.0.0", "eslint": "^9", "eslint-config-next": "16.2.1", "tailwindcss": "^4", "typescript": "^5" }}1234567const config = { plugins: { "@tailwindcss/postcss": {}, },};
export default config;12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import { NextRequest, NextResponse } from 'next/server';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
export async function GET(request: NextRequest) { const { searchParams } = new URL(request.url); const path = searchParams.get('path') || ''; try { const response = await fetch(`${API_BASE_URL}/${path}`, { method: 'GET', headers: { 'Content-Type': 'application/json', }, }); const data = await response.json(); return NextResponse.json(data); } catch (error: any) { return NextResponse.json( { error: error.message || 'Proxy request failed' }, { status: 500 } ); }}
export async function POST(request: NextRequest) { const { searchParams } = new URL(request.url); const path = searchParams.get('path') || ''; const body = await request.json(); try { const response = await fetch(`${API_BASE_URL}/${path}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(body), }); const data = await response.json(); return NextResponse.json(data); } catch (error: any) { return NextResponse.json( { error: error.message || 'Proxy request failed' }, { status: 500 } ); }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273"use client";
import { useState } from "react";import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";import { Button } from "@/components/ui/button";import { Badge } from "@/components/ui/badge";import { Progress } from "@/components/ui/progress";import { Alert, AlertDescription } from "@/components/ui/alert";import { Separator } from "@/components/ui/separator";import { BarChart3, Play, Loader2, CheckCircle2, XCircle, AlertCircle, TrendingUp,} from "lucide-react";import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Cell,} from "recharts";import api from "@/lib/api";import { BaselineResponse } from "@/lib/types";import { formatScore, getDifficultyColor } from "@/lib/utils";
export default function BaselinePage() { const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState<string | null>(null); const [results, setResults] = useState<BaselineResponse | null>(null);
const runBaseline = async () => { setIsLoading(true); setError(null); try { const response = await api.runBaseline(); setResults(response); } catch (err: any) { setError(err.message || "Failed to run baseline"); } finally { setIsLoading(false); } };
const chartData = results ? [ { name: "Easy", score: results.baseline_results.easy.score, color: "#22c55e", }, { name: "Medium", score: results.baseline_results.medium.score, color: "#eab308", }, { name: "Hard", score: results.baseline_results.hard.score, color: "#ef4444", }, ] : [];
return ( <div className="space-y-6"> {/* Header */} <div className="flex items-center justify-between"> <div> <h1 className="text-3xl font-bold">Baseline Results</h1> <p className="text-muted-foreground"> Run the rule-based baseline agent against all difficulty levels </p> </div> <Button onClick={runBaseline} disabled={isLoading} className="gap-2"> {isLoading ? ( <Loader2 className="h-4 w-4 animate-spin" /> ) : ( <Play className="h-4 w-4" /> )} Run Baseline </Button> </div>
{/* Error Alert */} {error && ( <Alert variant="destructive"> <AlertCircle className="h-4 w-4" /> <AlertDescription>{error}</AlertDescription> </Alert> )}
{/* Loading State */} {isLoading && ( <Card className="py-12"> <CardContent className="text-center"> <Loader2 className="h-12 w-12 animate-spin mx-auto text-primary mb-4" /> <p className="text-lg font-medium">Running Baseline Agent...</p> <p className="text-muted-foreground"> This may take up to 60 seconds </p> </CardContent> </Card> )}
{/* Results */} {results && !isLoading && ( <div className="grid lg:grid-cols-2 gap-6"> {/* Summary Card */} <Card> <CardHeader> <CardTitle className="flex items-center gap-2"> <TrendingUp className="h-5 w-5" /> Summary </CardTitle> </CardHeader> <CardContent className="space-y-6"> {/* Average Score */} <div className="text-center p-6 bg-muted rounded-lg"> <p className="text-sm text-muted-foreground mb-2"> Average Score </p> <p className="text-5xl font-bold text-primary"> {formatScore(results.summary.average_score)} </p> </div> {/* Individual Scores */} <div className="grid grid-cols-3 gap-4"> {(["easy", "medium", "hard"] as const).map((difficulty) => { const taskResult = results.baseline_results[difficulty]; return ( <div key={difficulty} className="text-center p-4 border rounded-lg"> <Badge className={getDifficultyColor(difficulty)}> {difficulty.toUpperCase()} </Badge> <p className="text-2xl font-bold mt-2"> {formatScore(taskResult.score)} </p> <div className="flex items-center justify-center gap-1 mt-1"> {taskResult.passed ? ( <CheckCircle2 className="h-4 w-4 text-green-500" /> ) : ( <XCircle className="h-4 w-4 text-red-500" /> )} <span className="text-xs text-muted-foreground"> {taskResult.passed ? "Passed" : "Failed"} </span> </div> </div> ); })} </div> </CardContent> </Card>
{/* Chart Card */} <Card> <CardHeader> <CardTitle className="flex items-center gap-2"> <BarChart3 className="h-5 w-5" /> Score Distribution </CardTitle> </CardHeader> <CardContent> <div className="h-[300px]"> <ResponsiveContainer width="100%" height="100%"> <BarChart data={chartData} layout="vertical"> <CartesianGrid strokeDasharray="3 3" /> <XAxis type="number" domain={[0, 1]} tickFormatter={(v) => `${(v * 100).toFixed(0)}%`} /> <YAxis type="category" dataKey="name" width={80} /> <Tooltip formatter={(value) => [`${(Number(value) * 100).toFixed(1)}%`, "Score"]} /> <Bar dataKey="score" radius={[0, 4, 4, 0]}> {chartData.map((entry, index) => ( <Cell key={`cell-${index}`} fill={entry.color} /> ))} </Bar> </BarChart> </ResponsiveContainer> </div> </CardContent> </Card>
{/* Detailed Results */} {(["easy", "medium", "hard"] as const).map((difficulty) => { const taskResult = results.baseline_results[difficulty]; return ( <Card key={difficulty}> <CardHeader> <CardTitle className="flex items-center justify-between"> <span className="flex items-center gap-2"> <Badge className={getDifficultyColor(difficulty)}> {difficulty.toUpperCase()} </Badge> Task Results </span> <Badge variant={taskResult.passed ? "default" : "destructive"}> {taskResult.passed ? "PASSED" : "FAILED"} </Badge> </CardTitle> </CardHeader> <CardContent className="space-y-4"> {/* Metrics */} <div className="grid grid-cols-3 gap-4"> <div className="text-center p-3 bg-muted rounded-lg"> <p className="text-xs text-muted-foreground">Score</p> <p className="text-xl font-bold">{formatScore(taskResult.score)}</p> </div> <div className="text-center p-3 bg-muted rounded-lg"> <p className="text-xs text-muted-foreground">Total Reward</p> <p className="text-xl font-bold">{taskResult.total_reward.toFixed(2)}</p> </div> <div className="text-center p-3 bg-muted rounded-lg"> <p className="text-xs text-muted-foreground">Steps</p> <p className="text-xl font-bold">{taskResult.steps}</p> </div> </div> <Separator /> {/* Breakdown */} <div className="space-y-3"> <p className="text-sm font-medium">Score Breakdown</p> {Object.entries(taskResult.breakdown).map(([key, value]) => ( <div key={key} className="space-y-1"> <div className="flex items-center justify-between text-sm"> <span className="capitalize">{key.replace(/_/g, " ")}</span> <span className={`font-medium ${ value >= 0.8 ? 'text-green-600' : value >= 0.5 ? 'text-yellow-600' : 'text-red-600' }`}> {formatScore(value)} </span> </div> <Progress value={value * 100} className="h-1.5" /> </div> ))} </div> </CardContent> </Card> ); })} </div> )}
{/* No Results State */} {!results && !isLoading && !error && ( <Card className="py-12"> <CardContent className="text-center"> <div className="max-w-md mx-auto space-y-4"> <div className="h-16 w-16 rounded-full bg-muted flex items-center justify-center mx-auto"> <BarChart3 className="h-8 w-8 text-muted-foreground" /> </div> <h3 className="text-xl font-semibold">No Baseline Results</h3> <p className="text-muted-foreground"> Click "Run Baseline" to execute the rule-based agent against all difficulty levels. </p> </div> </CardContent> </Card> )} </div> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130@import "tailwindcss";@import "tw-animate-css";@import "shadcn/tailwind.css";
@custom-variant dark (&:is(.dark *));
@theme inline { --color-background: var(--background); --color-foreground: var(--foreground); --font-sans: var(--font-geist-sans); --font-mono: var(--font-mono); --font-heading: var(--font-mono); --color-sidebar-ring: var(--sidebar-ring); --color-sidebar-border: var(--sidebar-border); --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); --color-sidebar-accent: var(--sidebar-accent); --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); --color-sidebar-primary: var(--sidebar-primary); --color-sidebar-foreground: var(--sidebar-foreground); --color-sidebar: var(--sidebar); --color-chart-5: var(--chart-5); --color-chart-4: var(--chart-4); --color-chart-3: var(--chart-3); --color-chart-2: var(--chart-2); --color-chart-1: var(--chart-1); --color-ring: var(--ring); --color-input: var(--input); --color-border: var(--border); --color-destructive: var(--destructive); --color-accent-foreground: var(--accent-foreground); --color-accent: var(--accent); --color-muted-foreground: var(--muted-foreground); --color-muted: var(--muted); --color-secondary-foreground: var(--secondary-foreground); --color-secondary: var(--secondary); --color-primary-foreground: var(--primary-foreground); --color-primary: var(--primary); --color-popover-foreground: var(--popover-foreground); --color-popover: var(--popover); --color-card-foreground: var(--card-foreground); --color-card: var(--card); --radius-sm: calc(var(--radius) * 0.6); --radius-md: calc(var(--radius) * 0.8); --radius-lg: var(--radius); --radius-xl: calc(var(--radius) * 1.4); --radius-2xl: calc(var(--radius) * 1.8); --radius-3xl: calc(var(--radius) * 2.2); --radius-4xl: calc(var(--radius) * 2.6);}
:root { --background: oklch(1 0 0); --foreground: oklch(0.145 0 0); --card: oklch(1 0 0); --card-foreground: oklch(0.145 0 0); --popover: oklch(1 0 0); --popover-foreground: oklch(0.145 0 0); --primary: oklch(0.205 0 0); --primary-foreground: oklch(0.985 0 0); --secondary: oklch(0.97 0 0); --secondary-foreground: oklch(0.205 0 0); --muted: oklch(0.97 0 0); --muted-foreground: oklch(0.556 0 0); --accent: oklch(0.97 0 0); --accent-foreground: oklch(0.205 0 0); --destructive: oklch(0.577 0.245 27.325); --border: oklch(0.922 0 0); --input: oklch(0.922 0 0); --ring: oklch(0.708 0 0); --chart-1: oklch(0.87 0 0); --chart-2: oklch(0.556 0 0); --chart-3: oklch(0.439 0 0); --chart-4: oklch(0.371 0 0); --chart-5: oklch(0.269 0 0); --radius: 0.625rem; --sidebar: oklch(0.985 0 0); --sidebar-foreground: oklch(0.145 0 0); --sidebar-primary: oklch(0.205 0 0); --sidebar-primary-foreground: oklch(0.985 0 0); --sidebar-accent: oklch(0.97 0 0); --sidebar-accent-foreground: oklch(0.205 0 0); --sidebar-border: oklch(0.922 0 0); --sidebar-ring: oklch(0.708 0 0);}
.dark { --background: oklch(0.145 0 0); --foreground: oklch(0.985 0 0); --card: oklch(0.205 0 0); --card-foreground: oklch(0.985 0 0); --popover: oklch(0.205 0 0); --popover-foreground: oklch(0.985 0 0); --primary: oklch(0.922 0 0); --primary-foreground: oklch(0.205 0 0); --secondary: oklch(0.269 0 0); --secondary-foreground: oklch(0.985 0 0); --muted: oklch(0.269 0 0); --muted-foreground: oklch(0.708 0 0); --accent: oklch(0.269 0 0); --accent-foreground: oklch(0.985 0 0); --destructive: oklch(0.704 0.191 22.216); --border: oklch(1 0 0 / 10%); --input: oklch(1 0 0 / 15%); --ring: oklch(0.556 0 0); --chart-1: oklch(0.87 0 0); --chart-2: oklch(0.556 0 0); --chart-3: oklch(0.439 0 0); --chart-4: oklch(0.371 0 0); --chart-5: oklch(0.269 0 0); --sidebar: oklch(0.205 0 0); --sidebar-foreground: oklch(0.985 0 0); --sidebar-primary: oklch(0.488 0.243 264.376); --sidebar-primary-foreground: oklch(0.985 0 0); --sidebar-accent: oklch(0.269 0 0); --sidebar-accent-foreground: oklch(0.985 0 0); --sidebar-border: oklch(1 0 0 / 10%); --sidebar-ring: oklch(0.556 0 0);}
@layer base { * { @apply border-border outline-ring/50; } body { @apply bg-background text-foreground; } html { @apply font-mono; }}1234567891011121314151617181920212223242526272829303132import type { Metadata } from "next";import { Inter } from "next/font/google";import "./globals.css";import { Toaster } from "@/components/ui/sonner";import { Header } from "@/components/layout/header";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = { title: "SupportEnv - Customer Support RL Environment", description: "Interactive environment for training AI agents on customer support workflows",};
export default function RootLayout({ children,}: Readonly<{ children: React.ReactNode;}>) { return ( <html lang="en" suppressHydrationWarning> <body className={inter.className} suppressHydrationWarning> <div className="min-h-screen bg-background"> <Header /> <main className="container mx-auto py-6 px-4"> {children} </main> </div> <Toaster /> </body> </html> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195import Link from "next/link";import { Button } from "@/components/ui/button";import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";import { Badge } from "@/components/ui/badge";import { Headphones, PlayCircle, BarChart3, ListChecks, Zap, Target, Brain, ArrowRight, CheckCircle2,} from "lucide-react";
const features = [ { icon: Target, title: "3 Difficulty Levels", description: "Easy, Medium, and Hard tasks with progressive complexity", }, { icon: Zap, title: "Dense Rewards", description: "Step-by-step feedback for effective learning", }, { icon: Brain, title: "Real-World Tasks", description: "Actual customer support scenarios, not toys", }, { icon: BarChart3, title: "Deterministic Grading", description: "Reproducible scores from 0.0 to 1.0", },];
const actions = [ { type: "classify", description: "Categorize ticket (billing, technical, account, general)", color: "bg-blue-500", }, { type: "respond", description: "Send response to customer", color: "bg-purple-500", }, { type: "escalate", description: "Escalate to human agent", color: "bg-red-500", }, { type: "request_info", description: "Ask for more information", color: "bg-orange-500", }, { type: "resolve", description: "Mark ticket as resolved", color: "bg-green-500", },];
export default function HomePage() { return ( <div className="space-y-12"> {/* Hero Section */} <section className="text-center space-y-6 py-12"> <Badge variant="secondary" className="text-sm"> OpenEnv Compatible </Badge> <h1 className="text-4xl md:text-6xl font-bold tracking-tight"> Customer Support <br /> <span className="text-primary">RL Environment</span> </h1> <p className="text-xl text-muted-foreground max-w-2xl mx-auto"> Train AI agents to handle real customer support workflows. Classification, response generation, and escalation decisions. </p> <div className="flex items-center justify-center gap-4"> <Link href="/playground"> <Button size="lg" className="gap-2"> <PlayCircle className="h-5 w-5" /> Try Playground </Button> </Link> <Link href="/baseline"> <Button size="lg" variant="outline" className="gap-2"> <BarChart3 className="h-5 w-5" /> View Baseline </Button> </Link> </div> </section>
{/* Features Grid */} <section className="grid md:grid-cols-2 lg:grid-cols-4 gap-6"> {features.map((feature) => { const Icon = feature.icon; return ( <Card key={feature.title}> <CardHeader> <div className="h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4"> <Icon className="h-6 w-6 text-primary" /> </div> <CardTitle className="text-lg">{feature.title}</CardTitle> </CardHeader> <CardContent> <p className="text-muted-foreground">{feature.description}</p> </CardContent> </Card> ); })} </section>
{/* Action Space */} <section> <Card> <CardHeader> <CardTitle>Action Space</CardTitle> <CardDescription> Available actions an agent can take in the environment </CardDescription> </CardHeader> <CardContent> <div className="grid md:grid-cols-2 lg:grid-cols-3 gap-4"> {actions.map((action) => ( <div key={action.type} className="flex items-start gap-3 p-4 rounded-lg border" > <div className={`h-3 w-3 rounded-full mt-1.5 ${action.color}`} /> <div> <p className="font-mono font-medium">{action.type}</p> <p className="text-sm text-muted-foreground"> {action.description} </p> </div> </div> ))} </div> </CardContent> </Card> </section>
{/* Quick Start */} <section> <Card> <CardHeader> <CardTitle>Quick Start</CardTitle> <CardDescription> Get started with SupportEnv in minutes </CardDescription> </CardHeader> <CardContent className="space-y-4"> <div className="bg-muted rounded-lg p-4 font-mono text-sm overflow-x-auto"> <pre>{`# Install clientpip install git+https://huggingface.co/spaces/username/support-env
# Connect to environmentfrom support_env.client import SupportEnvfrom support_env.models import SupportAction
env = SupportEnv(base_url="https://username-support-env.hf.space")
with env.sync() as client: result = client.reset(difficulty="medium") print(f"Ticket: {result.observation.ticket_text}") action = SupportAction(action_type="classify", content="billing") result = client.step(action) print(f"Reward: {result.reward}")`}</pre> </div> </CardContent> </Card> </section>
{/* CTA */} <section className="text-center py-12"> <h2 className="text-2xl font-bold mb-4">Ready to train your agent?</h2> <Link href="/playground"> <Button size="lg" className="gap-2"> Open Playground <ArrowRight className="h-4 w-4" /> </Button> </Link> </section> </div> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173"use client";
import { useState } from "react";import { Button } from "@/components/ui/button";import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";import { Badge } from "@/components/ui/badge";import { Alert, AlertDescription } from "@/components/ui/alert";import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";import { PlayCircle, RotateCcw, Trophy, AlertCircle, Loader2,} from "lucide-react";import { useEnvironment } from "@/lib/hooks/use-environment";import { DIFFICULTY_LEVELS, DifficultyLevel } from "@/lib/types";import { getDifficultyColor } from "@/lib/utils";import { TicketDisplay } from "@/components/environment/ticket-display";import { ActionPanel } from "@/components/environment/action-panel";import { HistoryPanel } from "@/components/environment/history-panel";import { RewardDisplay } from "@/components/environment/reward-display";import { GradingResults } from "@/components/environment/grading-results";
export default function PlaygroundPage() { const [selectedDifficulty, setSelectedDifficulty] = useState<DifficultyLevel>("easy"); const { sessionId, observation, isLoading, error, totalReward, stepHistory, gradeResult, isDone, reset, step, grade, clearError, } = useEnvironment();
const handleReset = () => { clearError(); reset(selectedDifficulty); };
return ( <div className="space-y-6"> {/* Header */} <div className="flex items-center justify-between"> <div> <h1 className="text-3xl font-bold flex items-center gap-2"> <PlayCircle className="h-8 w-8" /> Playground </h1> <p className="text-muted-foreground"> Interact with the SupportEnv environment in real-time </p> </div>
<div className="flex items-center gap-3"> {/* Difficulty Selector */} <Select value={selectedDifficulty} onValueChange={(v) => setSelectedDifficulty(v as DifficultyLevel)} > <SelectTrigger className="w-[140px]"> <SelectValue placeholder="Difficulty" /> </SelectTrigger> <SelectContent> {DIFFICULTY_LEVELS.map((level) => ( <SelectItem key={level} value={level}> <Badge className={getDifficultyColor(level)}> {level.toUpperCase()} </Badge> </SelectItem> ))} </SelectContent> </Select>
{/* Reset Button */} <Button onClick={handleReset} disabled={isLoading} className="gap-2"> {isLoading && !observation ? ( <Loader2 className="h-4 w-4 animate-spin" /> ) : ( <RotateCcw className="h-4 w-4" /> )} {observation ? "Reset" : "Start"} </Button>
{/* Grade Button */} {isDone && !gradeResult && ( <Button onClick={grade} variant="secondary" disabled={isLoading} className="gap-2"> <Trophy className="h-4 w-4" /> Grade </Button> )} </div> </div>
{/* Error Alert */} {error && ( <Alert variant="destructive"> <AlertCircle className="h-4 w-4" /> <AlertDescription>{error}</AlertDescription> </Alert> )}
{/* Session Info */} {sessionId && ( <div className="flex items-center gap-4 text-sm text-muted-foreground"> <span> Session: <code className="bg-muted px-2 py-0.5 rounded">{sessionId.slice(0, 8)}...</code> </span> {isDone && ( <Badge variant="outline" className="text-amber-600 border-amber-600"> Episode Complete </Badge> )} </div> )}
{/* Main Content */} {observation ? ( <div className="grid lg:grid-cols-3 gap-6"> {/* Left Column - Ticket & Action */} <div className="lg:col-span-2 space-y-6"> <TicketDisplay observation={observation} /> <ActionPanel observation={observation} onAction={step} isLoading={isLoading} isDone={isDone} /> </div>
{/* Right Column - Rewards & History */} <div className="space-y-6"> <RewardDisplay totalReward={totalReward} stepHistory={stepHistory} stepsRemaining={observation.steps_remaining} maxSteps={observation.max_steps} /> <HistoryPanel history={observation.interaction_history} stepHistory={stepHistory} /> </div> </div> ) : ( /* No Session State */ <Card className="py-12"> <CardContent className="text-center"> <div className="max-w-md mx-auto space-y-4"> <div className="h-16 w-16 rounded-full bg-muted flex items-center justify-center mx-auto"> <PlayCircle className="h-8 w-8 text-muted-foreground" /> </div> <h3 className="text-xl font-semibold">Ready to Play</h3> <p className="text-muted-foreground"> Select a difficulty level and click "Start" to begin interacting with a customer support ticket. Take actions like classifying, responding, and resolving. </p> </div> </CardContent> </Card> )}
{/* Grading Results */} {gradeResult && <GradingResults result={gradeResult} />} </div> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229"use client";
import { useEffect, useState } from "react";import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";import { Badge } from "@/components/ui/badge";import { Skeleton } from "@/components/ui/skeleton";import { Alert, AlertDescription } from "@/components/ui/alert";import { Separator } from "@/components/ui/separator";import { ScrollArea } from "@/components/ui/scroll-area";import { ListChecks, AlertCircle, Clock, Tag, MessageSquare, AlertTriangle, HelpCircle, CheckCircle, Code,} from "lucide-react";import api from "@/lib/api";import { Task } from "@/lib/types";import { getDifficultyColor } from "@/lib/utils";
const actionIcons: Record<string, React.ComponentType<{ className?: string }>> = { classify: Tag, respond: MessageSquare, escalate: AlertTriangle, request_info: HelpCircle, resolve: CheckCircle,};
export default function TasksPage() { const [tasks, setTasks] = useState<Task[]>([]); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState<string | null>(null);
useEffect(() => { const fetchTasks = async () => { try { const response = await api.getTasks(); setTasks(response.tasks); } catch (err: any) { setError(err.message || "Failed to fetch tasks"); } finally { setIsLoading(false); } };
fetchTasks(); }, []);
if (isLoading) { return ( <div className="space-y-6"> <div> <h1 className="text-3xl font-bold">Tasks</h1> <p className="text-muted-foreground">Loading available tasks...</p> </div> <div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6"> {[1, 2, 3].map((i) => ( <Card key={i}> <CardHeader> <Skeleton className="h-6 w-32" /> <Skeleton className="h-4 w-48 mt-2" /> </CardHeader> <CardContent> <Skeleton className="h-20 w-full" /> </CardContent> </Card> ))} </div> </div> ); }
if (error) { return ( <div className="space-y-6"> <div> <h1 className="text-3xl font-bold">Tasks</h1> </div> <Alert variant="destructive"> <AlertCircle className="h-4 w-4" /> <AlertDescription>{error}</AlertDescription> </Alert> </div> ); }
return ( <div className="space-y-6"> {/* Header */} <div> <h1 className="text-3xl font-bold flex items-center gap-2"> <ListChecks className="h-8 w-8" /> Available Tasks </h1> <p className="text-muted-foreground"> {tasks.length} tasks across different difficulty levels </p> </div>
{/* Task Cards */} <div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6"> {tasks.map((task) => ( <Card key={task.task_id} className="flex flex-col"> <CardHeader> <div className="flex items-start justify-between"> <div> <CardTitle className="text-lg">{task.name}</CardTitle> <CardDescription className="font-mono text-xs mt-1"> {task.task_id} </CardDescription> </div> <Badge className={getDifficultyColor(task.difficulty)}> {task.difficulty.toUpperCase()} </Badge> </div> </CardHeader> <CardContent className="flex-1 space-y-4"> {/* Description */} <p className="text-sm text-muted-foreground"> {task.description} </p> <Separator /> {/* Max Steps */} <div className="flex items-center gap-2 text-sm"> <Clock className="h-4 w-4 text-muted-foreground" /> <span>Max Steps: <strong>{task.max_steps}</strong></span> </div> {/* Action Schema */} <div className="space-y-2"> <p className="text-sm font-medium flex items-center gap-2"> <Code className="h-4 w-4" /> Action Schema </p> <div className="bg-muted rounded-lg p-3 text-xs font-mono"> <ScrollArea className="h-[120px]"> <pre>{JSON.stringify(task.action_schema, null, 2)}</pre> </ScrollArea> </div> </div> {/* Available Actions */} <div className="space-y-2"> <p className="text-sm font-medium">Available Actions</p> <div className="flex flex-wrap gap-2"> {task.action_schema.action_type.enum.map((action) => { const Icon = actionIcons[action] || Tag; return ( <Badge key={action} variant="outline" className="gap-1"> <Icon className="h-3 w-3" /> {action} </Badge> ); })} </div> </div> </CardContent> </Card> ))} </div>
{/* Action Types Reference */} <Card> <CardHeader> <CardTitle>Action Types Reference</CardTitle> <CardDescription> Detailed description of each action type available in the environment </CardDescription> </CardHeader> <CardContent> <div className="grid md:grid-cols-2 lg:grid-cols-3 gap-4"> {[ { type: "classify", icon: Tag, description: "Categorize the ticket into billing, technical, account, or general", color: "text-blue-500", }, { type: "respond", icon: MessageSquare, description: "Send a response message to the customer", color: "text-purple-500", }, { type: "escalate", icon: AlertTriangle, description: "Escalate the ticket to a human agent with a reason", color: "text-red-500", }, { type: "request_info", icon: HelpCircle, description: "Ask the customer for additional information", color: "text-orange-500", }, { type: "resolve", icon: CheckCircle, description: "Mark the ticket as resolved with a summary", color: "text-green-500", }, ].map((action) => { const Icon = action.icon; return ( <div key={action.type} className="flex items-start gap-3 p-4 border rounded-lg"> <Icon className={`h-5 w-5 ${action.color} flex-shrink-0 mt-0.5`} /> <div> <p className="font-mono font-medium">{action.type}</p> <p className="text-sm text-muted-foreground mt-1"> {action.description} </p> </div> </div> ); })} </div> </CardContent> </Card> </div> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189"use client";
import { useState } from "react";import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";import { Button } from "@/components/ui/button";import { Textarea } from "@/components/ui/textarea";import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";import { Badge } from "@/components/ui/badge";import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";import { Send, Loader2, Tag, MessageSquare, AlertTriangle, HelpCircle, CheckCircle,} from "lucide-react";import { Observation, ActionType, CATEGORY_OPTIONS } from "@/lib/types";import { getActionColor } from "@/lib/utils";
interface ActionPanelProps { observation: Observation; onAction: (actionType: ActionType, content: string) => Promise<void>; isLoading: boolean; isDone: boolean;}
const actionConfigs = { classify: { icon: Tag, label: "Classify", description: "Categorize the ticket type", placeholder: "Select category...", isSelect: true, }, respond: { icon: MessageSquare, label: "Respond", description: "Send a response to the customer", placeholder: "Type your response to the customer...", isSelect: false, }, escalate: { icon: AlertTriangle, label: "Escalate", description: "Escalate to a human agent", placeholder: "Provide reason for escalation...", isSelect: false, }, request_info: { icon: HelpCircle, label: "Request Info", description: "Ask customer for more details", placeholder: "What information do you need?", isSelect: false, }, resolve: { icon: CheckCircle, label: "Resolve", description: "Mark the ticket as resolved", placeholder: "Provide resolution summary...", isSelect: false, },};
export function ActionPanel({ observation, onAction, isLoading, isDone }: ActionPanelProps) { const [selectedAction, setSelectedAction] = useState<ActionType>("classify"); const [content, setContent] = useState(""); const [selectedCategory, setSelectedCategory] = useState("");
const handleSubmit = async () => { const actionContent = selectedAction === "classify" ? selectedCategory : content; if (!actionContent.trim()) return; await onAction(selectedAction, actionContent); setContent(""); setSelectedCategory(""); };
const currentConfig = actionConfigs[selectedAction]; const Icon = currentConfig.icon;
const availableActions = observation.available_actions as ActionType[];
return ( <Card> <CardHeader> <CardTitle className="flex items-center gap-2"> <Icon className="h-5 w-5" /> Take Action </CardTitle> <CardDescription> Choose an action and provide the required content </CardDescription> </CardHeader> <CardContent className="space-y-4"> {/* Action Type Tabs */} <Tabs value={selectedAction} onValueChange={(v) => setSelectedAction(v as ActionType)}> <TabsList className="grid grid-cols-5"> {(Object.keys(actionConfigs) as ActionType[]).map((action) => { const config = actionConfigs[action]; const ActionIcon = config.icon; const isAvailable = availableActions.includes(action); return ( <TabsTrigger key={action} value={action} disabled={!isAvailable || isDone} className="gap-1.5 text-xs" > <ActionIcon className="h-3.5 w-3.5" /> <span className="hidden md:inline">{config.label}</span> </TabsTrigger> ); })} </TabsList>
{(Object.keys(actionConfigs) as ActionType[]).map((action) => { const config = actionConfigs[action]; return ( <TabsContent key={action} value={action} className="mt-4 space-y-4"> <div className="flex items-center gap-2"> <Badge className={getActionColor(action)}> {config.label} </Badge> <span className="text-sm text-muted-foreground"> {config.description} </span> </div>
{config.isSelect ? ( <Select value={selectedCategory} onValueChange={setSelectedCategory}> <SelectTrigger> <SelectValue placeholder={config.placeholder} /> </SelectTrigger> <SelectContent> {CATEGORY_OPTIONS.map((category) => ( <SelectItem key={category} value={category}> {category.charAt(0).toUpperCase() + category.slice(1)} </SelectItem> ))} </SelectContent> </Select> ) : ( <Textarea value={content} onChange={(e) => setContent(e.target.value)} placeholder={config.placeholder} rows={4} disabled={isDone} /> )} </TabsContent> ); })} </Tabs>
{/* Submit Button */} <div className="flex items-center justify-between"> <p className="text-sm text-muted-foreground"> Available: {availableActions.join(", ")} </p> <Button onClick={handleSubmit} disabled={ isLoading || isDone || (!content.trim() && !selectedCategory) } className="gap-2" > {isLoading ? ( <Loader2 className="h-4 w-4 animate-spin" /> ) : ( <Send className="h-4 w-4" /> )} Execute Action </Button> </div> </CardContent> </Card> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";import { Progress } from "@/components/ui/progress";import { Badge } from "@/components/ui/badge";import { Separator } from "@/components/ui/separator";import { Trophy, CheckCircle2, XCircle, Info } from "lucide-react";import { GraderResponse } from "@/lib/types";import { formatScore } from "@/lib/utils";
interface GradingResultsProps { result: GraderResponse;}
const breakdownLabels: Record<string, string> = { classification: "Classification", response_quality: "Response Quality", escalation_decision: "Escalation Decision", resolution: "Resolution", efficiency: "Efficiency",};
export function GradingResults({ result }: GradingResultsProps) { const scorePercent = result.score * 100; return ( <Card className={result.passed ? "border-green-500" : "border-red-500"}> <CardHeader className="pb-2"> <CardTitle className="text-lg flex items-center justify-between"> <span className="flex items-center gap-2"> <Trophy className="h-5 w-5 text-yellow-500" /> Grading Results </span> <Badge variant={result.passed ? "default" : "destructive"} className="gap-1"> {result.passed ? ( <CheckCircle2 className="h-3 w-3" /> ) : ( <XCircle className="h-3 w-3" /> )} {result.passed ? "PASSED" : "FAILED"} </Badge> </CardTitle> </CardHeader> <CardContent className="space-y-4"> {/* Total Score */} <div className="text-center p-4 bg-muted rounded-lg"> <p className="text-sm text-muted-foreground mb-2">Final Score</p> <p className={`text-4xl font-bold ${ result.score >= 0.8 ? 'text-green-600' : result.score >= 0.6 ? 'text-yellow-600' : 'text-red-600' }`}> {formatScore(result.score)} </p> <Progress value={scorePercent} className="h-2 mt-3" /> </div> <Separator /> {/* Breakdown */} <div className="space-y-3"> <p className="text-sm font-medium">Score Breakdown</p> {Object.entries(result.breakdown).map(([key, value]) => ( <div key={key} className="space-y-1"> <div className="flex items-center justify-between text-sm"> <span>{breakdownLabels[key] || key}</span> <span className={`font-medium ${ value >= 0.8 ? 'text-green-600' : value >= 0.5 ? 'text-yellow-600' : 'text-red-600' }`}> {formatScore(value)} </span> </div> <Progress value={value * 100} className="h-1.5" /> </div> ))} </div> {/* Feedback */} {result.feedback && ( <> <Separator /> <div className="flex gap-2 p-3 bg-blue-50 dark:bg-blue-950 rounded-lg"> <Info className="h-4 w-4 text-blue-500 flex-shrink-0 mt-0.5" /> <p className="text-sm text-blue-800 dark:text-blue-200"> {result.feedback} </p> </div> </> )} </CardContent> </Card> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";import { ScrollArea } from "@/components/ui/scroll-area";import { Badge } from "@/components/ui/badge";import { Separator } from "@/components/ui/separator";import { MessageSquare, User, Bot } from "lucide-react";import { InteractionMessage, StepHistoryItem } from "@/lib/types";import { getActionColor, timeAgo } from "@/lib/utils";
interface HistoryPanelProps { history: InteractionMessage[]; stepHistory: StepHistoryItem[];}
export function HistoryPanel({ history, stepHistory }: HistoryPanelProps) { return ( <Card> <CardHeader className="pb-2"> <CardTitle className="text-lg flex items-center gap-2"> <MessageSquare className="h-5 w-5" /> History </CardTitle> </CardHeader> <CardContent> <ScrollArea className="h-[300px] pr-4"> {stepHistory.length === 0 && history.length === 0 ? ( <p className="text-center text-muted-foreground py-8"> No actions taken yet </p> ) : ( <div className="space-y-4"> {/* Step History */} {stepHistory.map((step, idx) => ( <div key={idx} className="space-y-2"> <div className="flex items-center justify-between"> <div className="flex items-center gap-2"> <Badge variant="outline" className="text-xs"> Step {step.step} </Badge> <Badge className={getActionColor(step.action_type)}> {step.action_type} </Badge> </div> <span className="text-xs text-muted-foreground"> {timeAgo(step.timestamp)} </span> </div> <div className="pl-4 border-l-2 border-muted"> <p className="text-sm">{step.content}</p> <p className={`text-xs mt-1 ${ step.reward > 0 ? 'text-green-600' : step.reward < 0 ? 'text-red-600' : 'text-muted-foreground' }`}> Reward: {step.reward >= 0 ? '+' : ''}{step.reward.toFixed(4)} </p> </div> </div> ))} {stepHistory.length > 0 && history.length > 0 && ( <Separator /> )} {/* Interaction History */} {history.map((msg, idx) => ( <div key={idx} className="flex gap-3"> <div className={`flex-shrink-0 h-8 w-8 rounded-full flex items-center justify-center ${ msg.role === 'agent' ? 'bg-primary text-primary-foreground' : 'bg-muted' }`}> {msg.role === 'agent' ? ( <Bot className="h-4 w-4" /> ) : ( <User className="h-4 w-4" /> )} </div> <div className="flex-1"> <p className="text-xs font-medium capitalize mb-1"> {msg.role} </p> <p className="text-sm">{msg.content}</p> </div> </div> ))} </div> )} </ScrollArea> </CardContent> </Card> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";import { Progress } from "@/components/ui/progress";import { Badge } from "@/components/ui/badge";import { TrendingUp, TrendingDown, Minus, Zap } from "lucide-react";import { StepHistoryItem } from "@/lib/types";import { formatReward } from "@/lib/utils";
interface RewardDisplayProps { totalReward: number; stepHistory: StepHistoryItem[]; stepsRemaining: number; maxSteps: number;}
export function RewardDisplay({ totalReward, stepHistory, stepsRemaining, maxSteps }: RewardDisplayProps) { const { display: rewardDisplay, color: rewardColor } = formatReward(totalReward); const lastReward = stepHistory.length > 0 ? stepHistory[stepHistory.length - 1].reward : 0; const { display: lastDisplay, color: lastColor } = formatReward(lastReward); const progress = ((maxSteps - stepsRemaining) / maxSteps) * 100;
return ( <Card> <CardHeader className="pb-2"> <CardTitle className="text-lg flex items-center gap-2"> <Zap className="h-5 w-5 text-yellow-500" /> Rewards </CardTitle> </CardHeader> <CardContent className="space-y-4"> {/* Total Reward */} <div className="text-center p-4 bg-muted rounded-lg"> <p className="text-sm text-muted-foreground mb-1">Total Reward</p> <p className={`text-3xl font-bold ${rewardColor}`}> {rewardDisplay} </p> </div> {/* Last Step Reward */} {stepHistory.length > 0 && ( <div className="flex items-center justify-between p-3 border rounded-lg"> <div className="flex items-center gap-2"> {lastReward > 0 ? ( <TrendingUp className="h-4 w-4 text-green-500" /> ) : lastReward < 0 ? ( <TrendingDown className="h-4 w-4 text-red-500" /> ) : ( <Minus className="h-4 w-4 text-gray-500" /> )} <span className="text-sm">Last Step</span> </div> <span className={`font-mono font-medium ${lastColor}`}> {lastDisplay} </span> </div> )} {/* Progress */} <div className="space-y-2"> <div className="flex items-center justify-between text-sm"> <span>Episode Progress</span> <span className="font-medium"> {maxSteps - stepsRemaining} / {maxSteps} steps </span> </div> <Progress value={progress} className="h-2" /> </div> {/* Recent Rewards */} {stepHistory.length > 0 && ( <div className="space-y-2"> <p className="text-sm font-medium">Recent Rewards</p> <div className="flex flex-wrap gap-1"> {stepHistory.slice(-5).map((item, idx) => { const { color } = formatReward(item.reward); return ( <Badge key={idx} variant="outline" className={`text-xs ${color}`} > Step {item.step}: {item.reward >= 0 ? '+' : ''}{item.reward.toFixed(2)} </Badge> ); })} </div> </div> )} </CardContent> </Card> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141"use client";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";import { Badge } from "@/components/ui/badge";import { Separator } from "@/components/ui/separator";import { User, Mail, Tag, Clock, Gauge, CheckCircle2, XCircle,} from "lucide-react";import { Observation } from "@/lib/types";import { formatSentiment, getDifficultyColor } from "@/lib/utils";
interface TicketDisplayProps { observation: Observation;}
export function TicketDisplay({ observation }: TicketDisplayProps) { const sentiment = formatSentiment(observation.customer_sentiment); return ( <Card> <CardHeader> <div className="flex items-start justify-between"> <div> <CardTitle className="flex items-center gap-2"> <Mail className="h-5 w-5" /> {observation.ticket_subject} </CardTitle> <CardDescription className="flex items-center gap-4 mt-2"> <span className="flex items-center gap-1"> <User className="h-4 w-4" /> {observation.customer_name} </span> <span className="flex items-center gap-1"> <Tag className="h-4 w-4" /> {observation.ticket_id} </span> </CardDescription> </div> <div className="flex flex-col items-end gap-2"> <Badge className={getDifficultyColor(observation.task_difficulty)}> {observation.task_difficulty.toUpperCase()} </Badge> <div className="flex items-center gap-1 text-sm"> <Clock className="h-4 w-4" /> {observation.steps_remaining} / {observation.max_steps} steps </div> </div> </div> </CardHeader> <CardContent className="space-y-4"> {/* Ticket Body */} <div className="bg-muted rounded-lg p-4"> <p className="whitespace-pre-wrap">{observation.ticket_text}</p> </div> <Separator /> {/* Status Row */} <div className="grid grid-cols-2 md:grid-cols-4 gap-4"> {/* Sentiment */} <div className="space-y-1"> <p className="text-sm text-muted-foreground">Customer Sentiment</p> <div className="flex items-center gap-2"> <span className="text-2xl">{sentiment.emoji}</span> <span className={`font-medium ${sentiment.color}`}> {sentiment.label} </span> </div> </div> {/* Classification */} <div className="space-y-1"> <p className="text-sm text-muted-foreground">Classification</p> <div className="flex items-center gap-2"> {observation.is_classified ? ( <> <CheckCircle2 className="h-5 w-5 text-green-500" /> <span className="font-medium capitalize"> {observation.current_classification} </span> </> ) : ( <> <XCircle className="h-5 w-5 text-muted-foreground" /> <span className="text-muted-foreground">Not classified</span> </> )} </div> </div> {/* Escalation */} <div className="space-y-1"> <p className="text-sm text-muted-foreground">Escalated</p> <div className="flex items-center gap-2"> {observation.is_escalated ? ( <> <CheckCircle2 className="h-5 w-5 text-orange-500" /> <span className="font-medium">Yes</span> </> ) : ( <> <XCircle className="h-5 w-5 text-muted-foreground" /> <span className="text-muted-foreground">No</span> </> )} </div> </div> {/* Progress */} <div className="space-y-1"> <p className="text-sm text-muted-foreground">Progress</p> <div className="flex items-center gap-2"> <Gauge className="h-5 w-5" /> <span className="font-medium"> {Math.round(((observation.max_steps - observation.steps_remaining) / observation.max_steps) * 100)}% </span> </div> </div> </div> {/* Message */} {observation.message && ( <> <Separator /> <div className="bg-blue-50 dark:bg-blue-950 text-blue-800 dark:text-blue-200 rounded-lg p-3 text-sm"> <strong>System:</strong> {observation.message} </div> </> )} </CardContent> </Card> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105"use client";
import Link from "next/link";import { usePathname } from "next/navigation";import { cn } from "@/lib/utils";import { Button } from "@/components/ui/button";import { Headphones, PlayCircle, BarChart3, ListChecks, GitBranch, ExternalLink,} from "lucide-react";
const navItems = [ { href: "/", label: "Home", icon: Headphones, }, { href: "/playground", label: "Playground", icon: PlayCircle, }, { href: "/baseline", label: "Baseline", icon: BarChart3, }, { href: "/tasks", label: "Tasks", icon: ListChecks, },];
export function Header() { const pathname = usePathname();
return ( <header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60"> <div className="container flex h-16 items-center"> {/* Logo */} <Link href="/" className="flex items-center space-x-2 mr-8"> <div className="flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-primary-foreground"> <Headphones className="h-5 w-5" /> </div> <span className="font-bold text-xl">SupportEnv</span> </Link>
{/* Navigation */} <nav className="flex items-center space-x-1 flex-1"> {navItems.map((item) => { const Icon = item.icon; const isActive = pathname === item.href; return ( <Link key={item.href} href={item.href}> <Button variant={isActive ? "secondary" : "ghost"} size="sm" className={cn( "gap-2", isActive && "bg-secondary" )} > <Icon className="h-4 w-4" /> {item.label} </Button> </Link> ); })} </nav>
{/* External Links */} <div className="flex items-center space-x-2"> <Button variant="outline" size="sm" asChild> <a href="https://github.com/username/support-env" target="_blank" rel="noopener noreferrer" className="gap-2" > <GitBranch className="h-4 w-4" /> GitHub </a> </Button> <Button variant="outline" size="sm" asChild> <a href="https://huggingface.co/spaces/username/support-env" target="_blank" rel="noopener noreferrer" className="gap-2" > <ExternalLink className="h-4 w-4" /> HF Space </a> </Button> </div> </div> </header> );}1234567891011121314151617181920212223242526272829import { Loader2 } from "lucide-react";import { cn } from "@/lib/utils";
interface LoadingSpinnerProps { className?: string; size?: "sm" | "md" | "lg"; text?: string;}
const sizeClasses = { sm: "h-4 w-4", md: "h-8 w-8", lg: "h-12 w-12",};
export function LoadingSpinner({ className, size = "md", text }: LoadingSpinnerProps) { return ( <div className={cn("flex flex-col items-center justify-center gap-2", className)}> <Loader2 className={cn("animate-spin text-primary", sizeClasses[size])} /> {text && ( <p className="text-sm text-muted-foreground">{text}</p> )} </div> );}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879import * as React from "react"import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const alertVariants = cva( "group/alert relative grid w-full gap-0.5 rounded-none border px-2.5 py-2 text-left text-xs has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", { variants: { variant: { default: "bg-card text-card-foreground", destructive: "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current", }, }, defaultVariants: { variant: "default", }, })
function Alert({ className, variant, ...props}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) { return ( <div data-slot="alert" role="alert" className={cn(alertVariants({ variant }), className)} {...props} /> )}
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="alert-title" className={cn( "font-heading font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground", className )} {...props} /> )}
function AlertDescription({ className, ...props}: React.ComponentProps<"div">) { return ( <div data-slot="alert-description" className={cn( "text-xs/relaxed text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-2", className )} {...props} /> )}
function AlertAction({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="alert-action" className={cn( "absolute top-[calc(--spacing(1.25))] right-[calc(--spacing(1.25))]", className )} {...props} /> )}
export { Alert, AlertTitle, AlertDescription, AlertAction }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112"use client"
import * as React from "react"import { Avatar as AvatarPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function Avatar({ className, size = "default", ...props}: React.ComponentProps<typeof AvatarPrimitive.Root> & { size?: "default" | "sm" | "lg"}) { return ( <AvatarPrimitive.Root data-slot="avatar" data-size={size} className={cn( "group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", className )} {...props} /> )}
function AvatarImage({ className, ...props}: React.ComponentProps<typeof AvatarPrimitive.Image>) { return ( <AvatarPrimitive.Image data-slot="avatar-image" className={cn( "aspect-square size-full rounded-full object-cover", className )} {...props} /> )}
function AvatarFallback({ className, ...props}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) { return ( <AvatarPrimitive.Fallback data-slot="avatar-fallback" className={cn( "flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs", className )} {...props} /> )}
function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) { return ( <span data-slot="avatar-badge" className={cn( "absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none", "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden", "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2", "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", className )} {...props} /> )}
function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="avatar-group" className={cn( "group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background", className )} {...props} /> )}
function AvatarGroupCount({ className, ...props}: React.ComponentProps<"div">) { return ( <div data-slot="avatar-group-count" className={cn( "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-xs text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3", className )} {...props} /> )}
export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge,}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import * as React from "react"import { cva, type VariantProps } from "class-variance-authority"import { Slot } from "radix-ui"
import { cn } from "@/lib/utils"
const badgeVariants = cva( "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-none border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", { variants: { variant: { default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80", secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80", destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20", outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground", ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50", link: "text-primary underline-offset-4 hover:underline", }, }, defaultVariants: { variant: "default", }, })
function Badge({ className, variant = "default", asChild = false, ...props}: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) { const Comp = asChild ? Slot.Root : "span"
return ( <Comp data-slot="badge" data-variant={variant} className={cn(badgeVariants({ variant }), className)} {...props} /> )}
export { Badge, badgeVariants }1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import * as React from "react"import { cva, type VariantProps } from "class-variance-authority"import { Slot } from "radix-ui"
import { cn } from "@/lib/utils"
const buttonVariants = cva( "group/button inline-flex shrink-0 items-center justify-center rounded-none border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", { variants: { variant: { default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80", outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50", secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground", ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50", destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40", link: "text-primary underline-offset-4 hover:underline", }, size: { default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", xs: "h-6 gap-1 rounded-none px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3", sm: "h-7 gap-1 rounded-none px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5", lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3", icon: "size-8", "icon-xs": "size-6 rounded-none [&_svg:not([class*='size-'])]:size-3", "icon-sm": "size-7 rounded-none", "icon-lg": "size-9", }, }, defaultVariants: { variant: "default", size: "default", }, })
function Button({ className, variant = "default", size = "default", asChild = false, ...props}: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & { asChild?: boolean }) { const Comp = asChild ? Slot.Root : "button"
return ( <Comp data-slot="button" data-variant={variant} data-size={size} className={cn(buttonVariants({ variant, size, className }))} {...props} /> )}
export { Button, buttonVariants }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103import * as React from "react"
import { cn } from "@/lib/utils"
function Card({ className, size = "default", ...props}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) { return ( <div data-slot="card" data-size={size} className={cn( "group/card flex flex-col gap-4 overflow-hidden rounded-none bg-card py-4 text-xs/relaxed text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-2 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-none *:[img:last-child]:rounded-none", className )} {...props} /> )}
function CardHeader({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="card-header" className={cn( "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-none px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3", className )} {...props} /> )}
function CardTitle({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="card-title" className={cn( "font-heading text-sm font-medium group-data-[size=sm]/card:text-sm", className )} {...props} /> )}
function CardDescription({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="card-description" className={cn("text-xs/relaxed text-muted-foreground", className)} {...props} /> )}
function CardAction({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="card-action" className={cn( "col-start-2 row-span-2 row-start-1 self-start justify-self-end", className )} {...props} /> )}
function CardContent({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="card-content" className={cn("px-4 group-data-[size=sm]/card:px-3", className)} {...props} /> )}
function CardFooter({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="card-footer" className={cn( "flex items-center rounded-none border-t p-4 group-data-[size=sm]/card:p-3", className )} {...props} /> )}
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent,}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165"use client"
import * as React from "react"import { Dialog as DialogPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"import { Button } from "@/components/ui/button"import { XIcon } from "@phosphor-icons/react"
function Dialog({ ...props}: React.ComponentProps<typeof DialogPrimitive.Root>) { return <DialogPrimitive.Root data-slot="dialog" {...props} />}
function DialogTrigger({ ...props}: React.ComponentProps<typeof DialogPrimitive.Trigger>) { return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />}
function DialogPortal({ ...props}: React.ComponentProps<typeof DialogPrimitive.Portal>) { return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />}
function DialogClose({ ...props}: React.ComponentProps<typeof DialogPrimitive.Close>) { return <DialogPrimitive.Close data-slot="dialog-close" {...props} />}
function DialogOverlay({ className, ...props}: React.ComponentProps<typeof DialogPrimitive.Overlay>) { return ( <DialogPrimitive.Overlay data-slot="dialog-overlay" className={cn( "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className )} {...props} /> )}
function DialogContent({ className, children, showCloseButton = true, ...props}: React.ComponentProps<typeof DialogPrimitive.Content> & { showCloseButton?: boolean}) { return ( <DialogPortal> <DialogOverlay /> <DialogPrimitive.Content data-slot="dialog-content" className={cn( "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-none bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )} {...props} > {children} {showCloseButton && ( <DialogPrimitive.Close data-slot="dialog-close" asChild> <Button variant="ghost" className="absolute top-2 right-2" size="icon-sm" > <XIcon /> <span className="sr-only">Close</span> </Button> </DialogPrimitive.Close> )} </DialogPrimitive.Content> </DialogPortal> )}
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="dialog-header" className={cn("flex flex-col gap-1 text-left", className)} {...props} /> )}
function DialogFooter({ className, showCloseButton = false, children, ...props}: React.ComponentProps<"div"> & { showCloseButton?: boolean}) { return ( <div data-slot="dialog-footer" className={cn( "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className )} {...props} > {children} {showCloseButton && ( <DialogPrimitive.Close asChild> <Button variant="outline">Close</Button> </DialogPrimitive.Close> )} </div> )}
function DialogTitle({ className, ...props}: React.ComponentProps<typeof DialogPrimitive.Title>) { return ( <DialogPrimitive.Title data-slot="dialog-title" className={cn("font-heading text-sm font-medium", className)} {...props} /> )}
function DialogDescription({ className, ...props}: React.ComponentProps<typeof DialogPrimitive.Description>) { return ( <DialogPrimitive.Description data-slot="dialog-description" className={cn( "text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className )} {...props} /> )}
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger,}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269"use client"
import * as React from "react"import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"import { CheckIcon, CaretRightIcon } from "@phosphor-icons/react"
function DropdownMenu({ ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) { return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />}
function DropdownMenuPortal({ ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) { return ( <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} /> )}
function DropdownMenuTrigger({ ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) { return ( <DropdownMenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} /> )}
function DropdownMenuContent({ className, align = "start", sideOffset = 4, ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) { return ( <DropdownMenuPrimitive.Portal> <DropdownMenuPrimitive.Content data-slot="dropdown-menu-content" sideOffset={sideOffset} align={align} className={cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-none bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )} {...props} /> </DropdownMenuPrimitive.Portal> )}
function DropdownMenuGroup({ ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) { return ( <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} /> )}
function DropdownMenuItem({ className, inset, variant = "default", ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & { inset?: boolean variant?: "default" | "destructive"}) { return ( <DropdownMenuPrimitive.Item data-slot="dropdown-menu-item" data-inset={inset} data-variant={variant} className={cn( "group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-none px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", className )} {...props} /> )}
function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & { inset?: boolean}) { return ( <DropdownMenuPrimitive.CheckboxItem data-slot="dropdown-menu-checkbox-item" data-inset={inset} className={cn( "relative flex cursor-default items-center gap-2 rounded-none py-2 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className )} checked={checked} {...props} > <span className="pointer-events-none absolute right-2 flex items-center justify-center" data-slot="dropdown-menu-checkbox-item-indicator" > <DropdownMenuPrimitive.ItemIndicator> <CheckIcon /> </DropdownMenuPrimitive.ItemIndicator> </span> {children} </DropdownMenuPrimitive.CheckboxItem> )}
function DropdownMenuRadioGroup({ ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) { return ( <DropdownMenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} /> )}
function DropdownMenuRadioItem({ className, children, inset, ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & { inset?: boolean}) { return ( <DropdownMenuPrimitive.RadioItem data-slot="dropdown-menu-radio-item" data-inset={inset} className={cn( "relative flex cursor-default items-center gap-2 rounded-none py-2 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className )} {...props} > <span className="pointer-events-none absolute right-2 flex items-center justify-center" data-slot="dropdown-menu-radio-item-indicator" > <DropdownMenuPrimitive.ItemIndicator> <CheckIcon /> </DropdownMenuPrimitive.ItemIndicator> </span> {children} </DropdownMenuPrimitive.RadioItem> )}
function DropdownMenuLabel({ className, inset, ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & { inset?: boolean}) { return ( <DropdownMenuPrimitive.Label data-slot="dropdown-menu-label" data-inset={inset} className={cn( "px-2 py-2 text-xs text-muted-foreground data-inset:pl-7", className )} {...props} /> )}
function DropdownMenuSeparator({ className, ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) { return ( <DropdownMenuPrimitive.Separator data-slot="dropdown-menu-separator" className={cn("-mx-1 h-px bg-border", className)} {...props} /> )}
function DropdownMenuShortcut({ className, ...props}: React.ComponentProps<"span">) { return ( <span data-slot="dropdown-menu-shortcut" className={cn( "ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground", className )} {...props} /> )}
function DropdownMenuSub({ ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) { return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />}
function DropdownMenuSubTrigger({ className, inset, children, ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean}) { return ( <DropdownMenuPrimitive.SubTrigger data-slot="dropdown-menu-sub-trigger" data-inset={inset} className={cn( "flex cursor-default items-center gap-2 rounded-none px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className )} {...props} > {children} <CaretRightIcon className="ml-auto" /> </DropdownMenuPrimitive.SubTrigger> )}
function DropdownMenuSubContent({ className, ...props}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) { return ( <DropdownMenuPrimitive.SubContent data-slot="dropdown-menu-sub-content" className={cn("z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-none bg-popover text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )} {...props} /> )}
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent,}12345678910111213141516171819import * as React from "react"
import { cn } from "@/lib/utils"
function Input({ className, type, ...props }: React.ComponentProps<"input">) { return ( <input type={type} data-slot="input" className={cn( "h-8 w-full min-w-0 rounded-none border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className )} {...props} /> )}
export { Input }12345678910111213141516171819202122232425262728293031"use client"
import * as React from "react"import { Progress as ProgressPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function Progress({ className, value, ...props}: React.ComponentProps<typeof ProgressPrimitive.Root>) { return ( <ProgressPrimitive.Root data-slot="progress" className={cn( "relative flex h-1 w-full items-center overflow-x-hidden rounded-none bg-muted", className )} {...props} > <ProgressPrimitive.Indicator data-slot="progress-indicator" className="size-full flex-1 bg-primary transition-all" style={{ transform: `translateX(-${100 - (value || 0)}%)` }} /> </ProgressPrimitive.Root> )}
export { Progress }12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455"use client"
import * as React from "react"import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function ScrollArea({ className, children, ...props}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) { return ( <ScrollAreaPrimitive.Root data-slot="scroll-area" className={cn("relative", className)} {...props} > <ScrollAreaPrimitive.Viewport data-slot="scroll-area-viewport" className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1" > {children} </ScrollAreaPrimitive.Viewport> <ScrollBar /> <ScrollAreaPrimitive.Corner /> </ScrollAreaPrimitive.Root> )}
function ScrollBar({ className, orientation = "vertical", ...props}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) { return ( <ScrollAreaPrimitive.ScrollAreaScrollbar data-slot="scroll-area-scrollbar" data-orientation={orientation} orientation={orientation} className={cn( "flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent", className )} {...props} > <ScrollAreaPrimitive.ScrollAreaThumb data-slot="scroll-area-thumb" className="relative flex-1 rounded-none bg-border" /> </ScrollAreaPrimitive.ScrollAreaScrollbar> )}
export { ScrollArea, ScrollBar }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192"use client"
import * as React from "react"import { Select as SelectPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"import { CaretDownIcon, CheckIcon, CaretUpIcon } from "@phosphor-icons/react"
function Select({ ...props}: React.ComponentProps<typeof SelectPrimitive.Root>) { return <SelectPrimitive.Root data-slot="select" {...props} />}
function SelectGroup({ className, ...props}: React.ComponentProps<typeof SelectPrimitive.Group>) { return ( <SelectPrimitive.Group data-slot="select-group" className={cn("scroll-my-1", className)} {...props} /> )}
function SelectValue({ ...props}: React.ComponentProps<typeof SelectPrimitive.Value>) { return <SelectPrimitive.Value data-slot="select-value" {...props} />}
function SelectTrigger({ className, size = "default", children, ...props}: React.ComponentProps<typeof SelectPrimitive.Trigger> & { size?: "sm" | "default"}) { return ( <SelectPrimitive.Trigger data-slot="select-trigger" data-size={size} className={cn( "flex w-fit items-center justify-between gap-1.5 rounded-none border border-input bg-transparent py-2 pr-2 pl-2.5 text-xs whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-none *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className )} {...props} > {children} <SelectPrimitive.Icon asChild> <CaretDownIcon className="pointer-events-none size-4 text-muted-foreground" /> </SelectPrimitive.Icon> </SelectPrimitive.Trigger> )}
function SelectContent({ className, children, position = "item-aligned", align = "center", ...props}: React.ComponentProps<typeof SelectPrimitive.Content>) { return ( <SelectPrimitive.Portal> <SelectPrimitive.Content data-slot="select-content" data-align-trigger={position === "item-aligned"} className={cn("relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-none bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", position ==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className )} position={position} align={align} {...props} > <SelectScrollUpButton /> <SelectPrimitive.Viewport data-position={position} className={cn( "data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)", position === "popper" && "" )} > {children} </SelectPrimitive.Viewport> <SelectScrollDownButton /> </SelectPrimitive.Content> </SelectPrimitive.Portal> )}
function SelectLabel({ className, ...props}: React.ComponentProps<typeof SelectPrimitive.Label>) { return ( <SelectPrimitive.Label data-slot="select-label" className={cn("px-2 py-2 text-xs text-muted-foreground", className)} {...props} /> )}
function SelectItem({ className, children, ...props}: React.ComponentProps<typeof SelectPrimitive.Item>) { return ( <SelectPrimitive.Item data-slot="select-item" className={cn( "relative flex w-full cursor-default items-center gap-2 rounded-none py-2 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className )} {...props} > <span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center"> <SelectPrimitive.ItemIndicator> <CheckIcon className="pointer-events-none" /> </SelectPrimitive.ItemIndicator> </span> <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText> </SelectPrimitive.Item> )}
function SelectSeparator({ className, ...props}: React.ComponentProps<typeof SelectPrimitive.Separator>) { return ( <SelectPrimitive.Separator data-slot="select-separator" className={cn("pointer-events-none -mx-1 h-px bg-border", className)} {...props} /> )}
function SelectScrollUpButton({ className, ...props}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) { return ( <SelectPrimitive.ScrollUpButton data-slot="select-scroll-up-button" className={cn( "z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className )} {...props} > <CaretUpIcon /> </SelectPrimitive.ScrollUpButton> )}
function SelectScrollDownButton({ className, ...props}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) { return ( <SelectPrimitive.ScrollDownButton data-slot="select-scroll-down-button" className={cn( "z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className )} {...props} > <CaretDownIcon /> </SelectPrimitive.ScrollDownButton> )}
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue,}12345678910111213141516171819202122232425262728"use client"
import * as React from "react"import { Separator as SeparatorPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function Separator({ className, orientation = "horizontal", decorative = true, ...props}: React.ComponentProps<typeof SeparatorPrimitive.Root>) { return ( <SeparatorPrimitive.Root data-slot="separator" decorative={decorative} orientation={orientation} className={cn( "shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch", className )} {...props} /> )}
export { Separator }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147"use client"
import * as React from "react"import { Dialog as SheetPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"import { Button } from "@/components/ui/button"import { XIcon } from "@phosphor-icons/react"
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) { return <SheetPrimitive.Root data-slot="sheet" {...props} />}
function SheetTrigger({ ...props}: React.ComponentProps<typeof SheetPrimitive.Trigger>) { return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />}
function SheetClose({ ...props}: React.ComponentProps<typeof SheetPrimitive.Close>) { return <SheetPrimitive.Close data-slot="sheet-close" {...props} />}
function SheetPortal({ ...props}: React.ComponentProps<typeof SheetPrimitive.Portal>) { return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />}
function SheetOverlay({ className, ...props}: React.ComponentProps<typeof SheetPrimitive.Overlay>) { return ( <SheetPrimitive.Overlay data-slot="sheet-overlay" className={cn( "fixed inset-0 z-50 bg-black/10 text-xs/relaxed duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className )} {...props} /> )}
function SheetContent({ className, children, side = "right", showCloseButton = true, ...props}: React.ComponentProps<typeof SheetPrimitive.Content> & { side?: "top" | "right" | "bottom" | "left" showCloseButton?: boolean}) { return ( <SheetPortal> <SheetOverlay /> <SheetPrimitive.Content data-slot="sheet-content" data-side={side} className={cn( "fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10", className )} {...props} > {children} {showCloseButton && ( <SheetPrimitive.Close data-slot="sheet-close" asChild> <Button variant="ghost" className="absolute top-3 right-3" size="icon-sm" > <XIcon /> <span className="sr-only">Close</span> </Button> </SheetPrimitive.Close> )} </SheetPrimitive.Content> </SheetPortal> )}
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="sheet-header" className={cn("flex flex-col gap-0.5 p-4", className)} {...props} /> )}
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="sheet-footer" className={cn("mt-auto flex flex-col gap-2 p-4", className)} {...props} /> )}
function SheetTitle({ className, ...props}: React.ComponentProps<typeof SheetPrimitive.Title>) { return ( <SheetPrimitive.Title data-slot="sheet-title" className={cn( "font-heading text-sm font-medium text-foreground", className )} {...props} /> )}
function SheetDescription({ className, ...props}: React.ComponentProps<typeof SheetPrimitive.Description>) { return ( <SheetPrimitive.Description data-slot="sheet-description" className={cn("text-xs/relaxed text-muted-foreground", className)} {...props} /> )}
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription,}12345678910111213import { cn } from "@/lib/utils"
function Skeleton({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="skeleton" className={cn("animate-pulse rounded-none bg-muted", className)} {...props} /> )}
export { Skeleton }12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849"use client"
import { useTheme } from "next-themes"import { Toaster as Sonner, type ToasterProps } from "sonner"import { CheckCircleIcon, InfoIcon, WarningIcon, XCircleIcon, SpinnerIcon } from "@phosphor-icons/react"
const Toaster = ({ ...props }: ToasterProps) => { const { theme = "system" } = useTheme()
return ( <Sonner theme={theme as ToasterProps["theme"]} className="toaster group" icons={{ success: ( <CheckCircleIcon className="size-4" /> ), info: ( <InfoIcon className="size-4" /> ), warning: ( <WarningIcon className="size-4" /> ), error: ( <XCircleIcon className="size-4" /> ), loading: ( <SpinnerIcon className="size-4 animate-spin" /> ), }} style={ { "--normal-bg": "var(--popover)", "--normal-text": "var(--popover-foreground)", "--normal-border": "var(--border)", "--border-radius": "var(--radius)", } as React.CSSProperties } toastOptions={{ classNames: { toast: "cn-toast", }, }} {...props} /> )}
export { Toaster }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990"use client"
import * as React from "react"import { cva, type VariantProps } from "class-variance-authority"import { Tabs as TabsPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function Tabs({ className, orientation = "horizontal", ...props}: React.ComponentProps<typeof TabsPrimitive.Root>) { return ( <TabsPrimitive.Root data-slot="tabs" data-orientation={orientation} className={cn( "group/tabs flex gap-2 data-horizontal:flex-col", className )} {...props} /> )}
const tabsListVariants = cva( "group/tabs-list inline-flex w-fit items-center justify-center rounded-none p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none", { variants: { variant: { default: "bg-muted", line: "gap-1 bg-transparent", }, }, defaultVariants: { variant: "default", }, })
function TabsList({ className, variant = "default", ...props}: React.ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>) { return ( <TabsPrimitive.List data-slot="tabs-list" data-variant={variant} className={cn(tabsListVariants({ variant }), className)} {...props} /> )}
function TabsTrigger({ className, ...props}: React.ComponentProps<typeof TabsPrimitive.Trigger>) { return ( <TabsPrimitive.Trigger data-slot="tabs-trigger" className={cn( "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-none border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className )} {...props} /> )}
function TabsContent({ className, ...props}: React.ComponentProps<typeof TabsPrimitive.Content>) { return ( <TabsPrimitive.Content data-slot="tabs-content" className={cn("flex-1 text-xs/relaxed outline-none", className)} {...props} /> )}
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }123456789101112131415161718import * as React from "react"
import { cn } from "@/lib/utils"
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) { return ( <textarea data-slot="textarea" className={cn( "flex field-sizing-content min-h-16 w-full rounded-none border border-input bg-transparent px-2.5 py-2 text-xs transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className )} {...props} /> )}
export { Textarea }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657"use client"
import * as React from "react"import { Tooltip as TooltipPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function TooltipProvider({ delayDuration = 0, ...props}: React.ComponentProps<typeof TooltipPrimitive.Provider>) { return ( <TooltipPrimitive.Provider data-slot="tooltip-provider" delayDuration={delayDuration} {...props} /> )}
function Tooltip({ ...props}: React.ComponentProps<typeof TooltipPrimitive.Root>) { return <TooltipPrimitive.Root data-slot="tooltip" {...props} />}
function TooltipTrigger({ ...props}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) { return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />}
function TooltipContent({ className, sideOffset = 0, children, ...props}: React.ComponentProps<typeof TooltipPrimitive.Content>) { return ( <TooltipPrimitive.Portal> <TooltipPrimitive.Content data-slot="tooltip-content" sideOffset={sideOffset} className={cn( "z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-none bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-none data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )} {...props} > {children} <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-none bg-foreground fill-foreground" /> </TooltipPrimitive.Content> </TooltipPrimitive.Portal> )}
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899import type { Config } from "tailwindcss"
const config = { darkMode: "class", content: [ './pages/**/*.{ts,tsx}', './components/**/*.{ts,tsx}', './app/**/*.{ts,tsx}', './src/**/*.{ts,tsx}', ], prefix: "", theme: { container: { center: true, padding: "2rem", screens: { "2xl": "1400px", }, }, extend: { colors: { border: "hsl(var(--border))", input: "hsl(var(--input))", ring: "hsl(var(--ring))", background: "hsl(var(--background))", foreground: "hsl(var(--foreground))", primary: { DEFAULT: "hsl(var(--primary))", foreground: "hsl(var(--primary-foreground))", }, secondary: { DEFAULT: "hsl(var(--secondary))", foreground: "hsl(var(--secondary-foreground))", }, destructive: { DEFAULT: "hsl(var(--destructive))", foreground: "hsl(var(--destructive-foreground))", }, muted: { DEFAULT: "hsl(var(--muted))", foreground: "hsl(var(--muted-foreground))", }, accent: { DEFAULT: "hsl(var(--accent))", foreground: "hsl(var(--accent-foreground))", }, popover: { DEFAULT: "hsl(var(--popover))", foreground: "hsl(var(--popover-foreground))", }, card: { DEFAULT: "hsl(var(--card))", foreground: "hsl(var(--card-foreground))", }, // Custom colors for SupportEnv success: { DEFAULT: "hsl(142, 76%, 36%)", foreground: "hsl(0, 0%, 100%)", }, warning: { DEFAULT: "hsl(38, 92%, 50%)", foreground: "hsl(0, 0%, 100%)", }, sentiment: { positive: "hsl(142, 76%, 36%)", neutral: "hsl(220, 9%, 46%)", negative: "hsl(0, 84%, 60%)", } }, borderRadius: { lg: "var(--radius)", md: "calc(var(--radius) - 2px)", sm: "calc(var(--radius) - 4px)", }, keyframes: { "accordion-down": { from: { height: "0" }, to: { height: "var(--radix-accordion-content-height)" }, }, "accordion-up": { from: { height: "var(--radix-accordion-content-height)" }, to: { height: "0" }, }, "pulse-slow": { "0%, 100%": { opacity: "1" }, "50%": { opacity: "0.5" }, }, }, animation: { "accordion-down": "accordion-down 0.2s ease-out", "accordion-up": "accordion-up 0.2s ease-out", "pulse-slow": "pulse-slow 2s ease-in-out infinite", }, }, }, plugins: [],} satisfies Config
export default config12345678910111213141516171819202122232425262728293031323334{ "compilerOptions": { "target": "ES2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "react-jsx", "incremental": true, "plugins": [ { "name": "next" } ], "paths": { "@/*": ["./src/*"] } }, "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts", "**/*.mts" ], "exclude": ["node_modules"]}support-env-frontendDeleted-1
support-env-frontend/.gitignoreAdded+41
support-env-frontend/README.mdAdded+36
support-env-frontend/components.jsonAdded+25
support-env-frontend/eslint.config.mjsAdded+18
support-env-frontend/next.config.tsAdded+8
support-env-frontend/package-lock.jsonAdded
support-env-frontend/package.jsonAdded+42
support-env-frontend/postcss.config.mjsAdded+7
support-env-frontend/public/file.svgAdded
support-env-frontend/public/globe.svgAdded
support-env-frontend/public/next.svgAdded
support-env-frontend/public/vercel.svgAdded
support-env-frontend/public/window.svgAdded
support-env-frontend/src/app/api/proxy/route.tsAdded+49
support-env-frontend/src/app/baseline/page.tsxAdded+273
support-env-frontend/src/app/favicon.icoAdded
support-env-frontend/src/app/globals.cssAdded+130
support-env-frontend/src/app/layout.tsxAdded+32
support-env-frontend/src/app/page.tsxAdded+195
support-env-frontend/src/app/playground/page.tsxAdded+173
support-env-frontend/src/app/tasks/page.tsxAdded+229
support-env-frontend/src/components/environment/action-panel.tsxAdded+189
support-env-frontend/src/components/environment/grading-results.tsxAdded+99
support-env-frontend/src/components/environment/history-panel.tsxAdded+96
support-env-frontend/src/components/environment/reward-display.tsxAdded+100
support-env-frontend/src/components/environment/ticket-display.tsxAdded+141
support-env-frontend/src/components/layout/header.tsxAdded+105
support-env-frontend/src/components/shared/loading-spinner.tsxAdded+29
support-env-frontend/src/components/ui/alert.tsxAdded+79
support-env-frontend/src/components/ui/avatar.tsxAdded+112
support-env-frontend/src/components/ui/badge.tsxAdded+49
support-env-frontend/src/components/ui/button.tsxAdded+65
support-env-frontend/src/components/ui/card.tsxAdded+103
support-env-frontend/src/components/ui/dialog.tsxAdded+165
support-env-frontend/src/components/ui/dropdown-menu.tsxAdded+269
support-env-frontend/src/components/ui/input.tsxAdded+19
support-env-frontend/src/components/ui/progress.tsxAdded+31
support-env-frontend/src/components/ui/scroll-area.tsxAdded+55
support-env-frontend/src/components/ui/select.tsxAdded+192
support-env-frontend/src/components/ui/separator.tsxAdded+28
support-env-frontend/src/components/ui/sheet.tsxAdded+147
support-env-frontend/src/components/ui/skeleton.tsxAdded+13
support-env-frontend/src/components/ui/sonner.tsxAdded+49
support-env-frontend/src/components/ui/tabs.tsxAdded+90
support-env-frontend/src/components/ui/textarea.tsxAdded+18
support-env-frontend/src/components/ui/tooltip.tsxAdded+57
support-env-frontend/tailwind.config.tsAdded+99
support-env-frontend/tsconfig.jsonAdded+34