Skip to content

Commit 6b9ed89

Browse files
committed
More progress
1 parent 9466f05 commit 6b9ed89

File tree

21 files changed

+554
-196
lines changed

21 files changed

+554
-196
lines changed

benchmark/apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"react-hook-form": "^7.54.2",
2828
"tailwind-merge": "^3.0.2",
2929
"tailwindcss-animate": "^1.0.7",
30+
"uuid": "^11.1.0",
3031
"zod": "^3.24.2"
3132
},
3233
"devDependencies": {

benchmark/apps/web/src/app/api/runs/[id]/stream/route.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { NextRequest } from "next/server"
2+
import { v4 as uuidv4 } from "uuid"
23

34
import { findRun } from "@benchmark/db"
45
import { IpcClient } from "@benchmark/ipc"
@@ -9,9 +10,10 @@ export const dynamic = "force-dynamic"
910

1011
export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
1112
const { id } = await params
13+
const requestId = uuidv4()
1214
const stream = new SSEStream()
1315
const run = await findRun(Number(id))
14-
const client = new IpcClient(`/tmp/benchmark-${run.id}.sock`, () => {})
16+
const client = new IpcClient(run.socketPath, () => {})
1517

1618
const write = async (data: string | object) => {
1719
const success = await stream.write(data)
@@ -21,12 +23,13 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
2123
}
2224
}
2325

26+
console.log(`[stream#${requestId}] connect`)
2427
client.on("connect", () => write("connect"))
2528
client.on("disconnect", () => write("disconnect"))
2629
client.on("message", write)
2730

2831
request.signal.addEventListener("abort", () => {
29-
console.log(`abort`)
32+
console.log(`[stream#${requestId}] abort`)
3033
client.disconnect()
3134
stream.close().catch(() => {})
3235
})

benchmark/apps/web/src/app/globals.css

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,6 @@
44

55
@custom-variant dark (&:is(.dark *));
66

7-
@theme inline {
8-
--color-background: var(--background);
9-
--color-foreground: var(--foreground);
10-
--font-sans: var(--font-geist-sans);
11-
--font-mono: var(--font-geist-mono);
12-
--color-sidebar-ring: var(--sidebar-ring);
13-
--color-sidebar-border: var(--sidebar-border);
14-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
15-
--color-sidebar-accent: var(--sidebar-accent);
16-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
17-
--color-sidebar-primary: var(--sidebar-primary);
18-
--color-sidebar-foreground: var(--sidebar-foreground);
19-
--color-sidebar: var(--sidebar);
20-
--color-chart-5: var(--chart-5);
21-
--color-chart-4: var(--chart-4);
22-
--color-chart-3: var(--chart-3);
23-
--color-chart-2: var(--chart-2);
24-
--color-chart-1: var(--chart-1);
25-
--color-ring: var(--ring);
26-
--color-input: var(--input);
27-
--color-border: var(--border);
28-
--color-destructive: var(--destructive);
29-
--color-accent-foreground: var(--accent-foreground);
30-
--color-accent: var(--accent);
31-
--color-muted-foreground: var(--muted-foreground);
32-
--color-muted: var(--muted);
33-
--color-secondary-foreground: var(--secondary-foreground);
34-
--color-secondary: var(--secondary);
35-
--color-primary-foreground: var(--primary-foreground);
36-
--color-primary: var(--primary);
37-
--color-popover-foreground: var(--popover-foreground);
38-
--color-popover: var(--popover);
39-
--color-card-foreground: var(--card-foreground);
40-
--color-card: var(--card);
41-
--radius-sm: calc(var(--radius) - 4px);
42-
--radius-md: calc(var(--radius) - 2px);
43-
--radius-lg: var(--radius);
44-
--radius-xl: calc(var(--radius) + 4px);
45-
}
46-
477
:root {
488
--radius: 0.625rem;
499
--background: oklch(1 0 0);
@@ -80,24 +40,24 @@
8040
}
8141

8242
.dark {
83-
--background: oklch(0.145 0 0);
84-
--foreground: oklch(0.985 0 0);
43+
--background: oklch(23.66% 0.0198 271.79);
44+
--foreground: oklch(75.15% 0.0477 278.41);
8545
--card: oklch(0.205 0 0);
8646
--card-foreground: oklch(0.985 0 0);
87-
--popover: oklch(0.205 0 0);
47+
--popover: var(--primary);
8848
--popover-foreground: oklch(0.985 0 0);
89-
--primary: oklch(0.922 0 0);
90-
--primary-foreground: oklch(0.205 0 0);
49+
--primary: oklch(29.33% 0.0295 276.18);
50+
--primary-foreground: var(--accent);
9151
--secondary: oklch(0.269 0 0);
9252
--secondary-foreground: oklch(0.985 0 0);
93-
--muted: oklch(0.269 0 0);
94-
--muted-foreground: oklch(0.708 0 0);
95-
--accent: oklch(0.269 0 0);
96-
--accent-foreground: oklch(0.985 0 0);
97-
--destructive: oklch(0.704 0.191 22.216);
98-
--border: oklch(1 0 0 / 10%);
99-
--input: oklch(1 0 0 / 15%);
100-
--ring: oklch(0.556 0 0);
53+
--muted: oklch(28.27% 0.0207 273.06);
54+
--muted-foreground: oklch(75.15% 0.0477 278.41);
55+
--accent: oklch(70.21% 0.1813 328.71);
56+
--accent-foreground: rgba(0, 0, 0, 0.5);
57+
--destructive: oklch(72.14% 0.1616 15.49);
58+
--border: oklch(29.33% 0.0295 276.18);
59+
--input: var(--primary);
60+
--ring: oklch(83.63% 0.1259 176.52);
10161
--chart-1: oklch(0.488 0.243 264.376);
10262
--chart-2: oklch(0.696 0.17 162.48);
10363
--chart-3: oklch(0.769 0.188 70.08);
@@ -113,10 +73,52 @@
11373
--sidebar-ring: oklch(0.556 0 0);
11474
}
11575

76+
@theme inline {
77+
--color-background: var(--background);
78+
--color-foreground: var(--foreground);
79+
--color-sidebar-ring: var(--sidebar-ring);
80+
--color-sidebar-border: var(--sidebar-border);
81+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
82+
--color-sidebar-accent: var(--sidebar-accent);
83+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
84+
--color-sidebar-primary: var(--sidebar-primary);
85+
--color-sidebar-foreground: var(--sidebar-foreground);
86+
--color-sidebar: var(--sidebar);
87+
--color-chart-5: var(--chart-5);
88+
--color-chart-4: var(--chart-4);
89+
--color-chart-3: var(--chart-3);
90+
--color-chart-2: var(--chart-2);
91+
--color-chart-1: var(--chart-1);
92+
--color-ring: var(--ring);
93+
--color-input: var(--input);
94+
--color-border: var(--border);
95+
--color-destructive: var(--destructive);
96+
--color-accent-foreground: var(--accent-foreground);
97+
--color-accent: var(--accent);
98+
--color-muted-foreground: var(--muted-foreground);
99+
--color-muted: var(--muted);
100+
--color-secondary-foreground: var(--secondary-foreground);
101+
--color-secondary: var(--secondary);
102+
--color-primary-foreground: var(--primary-foreground);
103+
--color-primary: var(--primary);
104+
--color-popover-foreground: var(--popover-foreground);
105+
--color-popover: var(--popover);
106+
--color-card-foreground: var(--card-foreground);
107+
--color-card: var(--card);
108+
--radius-sm: calc(var(--radius) - 4px);
109+
--radius-md: calc(var(--radius) - 2px);
110+
--radius-lg: var(--radius);
111+
--radius-xl: calc(var(--radius) + 4px);
112+
}
113+
116114
@layer base {
117115
* {
118116
@apply border-border outline-ring/50;
119117
}
118+
html,
119+
body {
120+
height: 100%;
121+
}
120122
body {
121123
@apply bg-background text-foreground;
122124
}
Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,56 @@
1+
"use client"
2+
3+
import { useRouter } from "next/navigation"
4+
import { Rocket } from "lucide-react"
5+
16
import { getRuns } from "@benchmark/db"
27

3-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui"
8+
import { Button, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui"
49
import { formatCurrency, formatDuration } from "@/lib"
510

6-
export const dynamic = "force-dynamic"
11+
type Run = Awaited<ReturnType<typeof getRuns>>[number]
712

8-
export async function Home() {
9-
const runs = await getRuns()
13+
export function Home({ runs }: { runs: Run[] }) {
14+
const router = useRouter()
1015

1116
return (
12-
<div className="mx-auto my-20 w-3xl">
13-
<Table className="border">
14-
<TableHeader>
15-
<TableRow>
16-
<TableHead>ID</TableHead>
17-
<TableHead>Model</TableHead>
18-
<TableHead>Timestamp</TableHead>
19-
<TableHead>Passed</TableHead>
20-
<TableHead>Failed</TableHead>
21-
<TableHead>% Correct</TableHead>
22-
<TableHead>Cost</TableHead>
23-
<TableHead>Duration</TableHead>
24-
</TableRow>
25-
</TableHeader>
26-
<TableBody>
27-
{runs.map((run) => (
28-
<TableRow key={run.id}>
29-
<TableCell>{run.id}</TableCell>
30-
<TableCell>{run.model}</TableCell>
31-
<TableCell>{new Date(run.createdAt).toLocaleString()}</TableCell>
32-
<TableCell>{run.passed}</TableCell>
33-
<TableCell>{run.failed}</TableCell>
34-
<TableCell>{(run.rate * 100).toFixed(1)}%</TableCell>
35-
<TableCell>{formatCurrency(run.cost)}</TableCell>
36-
<TableCell>{formatDuration(run.duration)}</TableCell>
17+
<>
18+
<div className="max-w-4xl px-12 mx-auto py-24">
19+
<Table className="border">
20+
<TableHeader>
21+
<TableRow>
22+
<TableHead>ID</TableHead>
23+
<TableHead>Model</TableHead>
24+
<TableHead>Timestamp</TableHead>
25+
<TableHead>Passed</TableHead>
26+
<TableHead>Failed</TableHead>
27+
<TableHead>% Correct</TableHead>
28+
<TableHead>Cost</TableHead>
29+
<TableHead>Duration</TableHead>
3730
</TableRow>
38-
))}
39-
</TableBody>
40-
</Table>
41-
</div>
31+
</TableHeader>
32+
<TableBody>
33+
{runs.map((run) => (
34+
<TableRow key={run.id}>
35+
<TableCell>{run.id}</TableCell>
36+
<TableCell>{run.model}</TableCell>
37+
<TableCell>{new Date(run.createdAt).toLocaleString()}</TableCell>
38+
<TableCell>{run.passed}</TableCell>
39+
<TableCell>{run.failed}</TableCell>
40+
<TableCell>{(run.rate * 100).toFixed(1)}%</TableCell>
41+
<TableCell>{formatCurrency(run.cost)}</TableCell>
42+
<TableCell>{formatDuration(run.duration)}</TableCell>
43+
</TableRow>
44+
))}
45+
</TableBody>
46+
</Table>
47+
</div>
48+
<Button
49+
variant="default"
50+
className="absolute top-5 right-5 size-12 rounded-full"
51+
onClick={() => router.push("/runs/new")}>
52+
<Rocket className="size-6" />
53+
</Button>
54+
</>
4255
)
4356
}

benchmark/apps/web/src/app/layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { ThemeProvider, ReactQueryProvider } from "@/components/providers"
55

66
import "./globals.css"
77

8-
const geistSans = Geist({ variable: "--font-geist-sans", subsets: ["latin"] })
9-
const geistMono = Geist_Mono({ variable: "--font-geist-mono", subsets: ["latin"] })
8+
const fontSans = Geist({ variable: "--font-sans", subsets: ["latin"] })
9+
const fontMono = Geist_Mono({ variable: "--font-mono", subsets: ["latin"] })
1010

1111
export const metadata: Metadata = {
1212
title: "Roo Code Benchmarks",
@@ -19,7 +19,7 @@ export default function RootLayout({
1919
}>) {
2020
return (
2121
<html lang="en">
22-
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
22+
<body className={`${fontSans.variable} ${fontMono.variable} font-sans antialiased`}>
2323
<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
2424
<ReactQueryProvider>{children}</ReactQueryProvider>
2525
</ThemeProvider>
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
import { getRuns } from "@benchmark/db"
2+
13
import { Home } from "./home"
24

5+
export const dynamic = "force-dynamic"
6+
37
export default async function Page() {
4-
return <Home />
8+
const runs = await getRuns()
9+
console.log(runs)
10+
11+
return <Home runs={runs} />
512
}

benchmark/apps/web/src/app/runs/[id]/show-run.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export function ShowRun({ run }: { run: Run }) {
1010
const url = `/api/runs/${run.id}/stream`
1111
const onMessage = useCallback(({ data }: MessageEvent) => console.log(data), [])
1212
const status = useEventSource({ url, onMessage })
13+
1314
return (
1415
<div>
1516
Show Run: {run.id} | {status}
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
"use server"
22

3+
import { spawn } from "child_process"
34
import { revalidatePath } from "next/cache"
45

56
import * as db from "@benchmark/db"
67

78
export async function createRun(data: db.InsertRun) {
89
const run = await db.createRun(data)
910
revalidatePath("/runs")
10-
return run
11+
12+
try {
13+
const process = spawn(
14+
"pnpm",
15+
["--filter", "@benchmark/cli", "dev", "run", "all", "--runId", run.id.toString()],
16+
{
17+
detached: true,
18+
stdio: "ignore",
19+
},
20+
)
21+
22+
process.unref()
23+
return process.pid
24+
} catch (_) {
25+
return undefined
26+
}
1127
}

0 commit comments

Comments
 (0)