umpirix/hackathons/geekroom-2026/record-bifrost-demo.mjs
caelum0x a0ea018c24 feat: integrate Bifrost AI gateway, rename submission to Umpirix
Real Bifrost (github.com/maximhq/bifrost) integration for the Geek Room
hackathon's Bifrost-by-Maxim-AI track, replacing zero prior usage:

- BENCH_LLM_GATEWAY=bifrost routes every LLM-backed call (leaderboard's
  llm row, the auto cascade, and the agent loop's judge stage) through
  Bifrost's universal OpenAI-compatible endpoint instead of the provider
  directly, via one choke point (callBifrostStructured in llm.server.ts).
- Per-call telemetry read straight from Bifrost's own response
  (extra_fields), not recomputed: SystemOneBifrostTelemetry type, a new
  Gateway badge/column on /leaderboard (LeaderboardRow.gateway).
- Real run against a local Bifrost v2.5.1 gateway + Anthropic: 93/93 gold
  calls (accuracy 0.9794), fault-injected re-run (67/93 calls, robustness
  0.621), and a real Bifrost-side fallback demo (5/5 calls served by the
  fallback model, routing_info.is_fallback: true). Full numbers in
  bifrost-run-results.json; reproduce with verify-bifrost.mjs. Committed
  leaderboard.json's llm row now carries this real Bifrost-routed run.
- README gets a "How Bifrost powers Umpirix" section; HACKATHON-SUBMISSION.md
  gets a dedicated Bifrost section + honest-limits bullet.
- Pitch deck: new slide "How Bifrost powers Umpirix", title renamed to
  Umpirix — Benchmark Arena for AI Agents (the owner's submitted project
  title), now 14 slides; re-verified against the actual committed PDF
  (not just the Marp PNG preview) and fixed one real overflow found that
  way. PPTX/PDF rebuilt.
- demo.mp4 rebuilt as a 42.9s real video (real Playwright screen recording
  of the Gateway badge + code-rendered stat cards, no AI footage); prior
  cuts kept as demo-v2-120s-narrated.mp4 / demo-v1-33s-silent.mp4.

Repo/package name intentionally left as openjev (not renamed) per the
owner's direction; Umpirix is the submission's project title.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-11 16:23:02 +03:00

75 lines
2.8 KiB
JavaScript

/**
* Real screen capture of the Bifrost-routed "llm" leaderboard row: a live
* running dev server, Playwright's Chromium, its built-in video recorder —
* no mocking, no staged screenshots. Shows the real "Gateway" badge/column
* shipped in src/routes/leaderboard.tsx for the row scored by
* hackathons/geekroom-2026/verify-bifrost.mjs (93/93 real Bifrost calls).
*
* Usage (dev server must already be running):
* BASE_URL=http://localhost:8098 node hackathons/geekroom-2026/record-bifrost-demo.mjs
*
* Writes hackathons/geekroom-2026/bifrost-demo-raw.webm.
*/
import { mkdirSync, renameSync, readdirSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { createRequire } from "node:module";
const __dirname = dirname(fileURLToPath(import.meta.url));
const BASE_URL = process.env.BASE_URL ?? "http://localhost:8098";
const OUT_DIR = join(__dirname, "_bifrost_video_tmp");
const FINAL_WEBM = join(__dirname, "bifrost-demo-raw.webm");
async function main() {
const require = createRequire(import.meta.url);
const { chromium } = require("playwright");
mkdirSync(OUT_DIR, { recursive: true });
const browser = await chromium.launch();
const context = await browser.newContext({
viewport: { width: 1280, height: 800 },
recordVideo: { dir: OUT_DIR, size: { width: 1280, height: 800 } },
});
const page = await context.newPage();
await page.goto(`${BASE_URL}/leaderboard`, { waitUntil: "networkidle" });
await page.waitForTimeout(1500);
await page.getByRole("tab", { name: "Gold suite (in-repo)" }).click();
await page.waitForTimeout(1000);
// Find the real Bifrost-routed row and scroll it into view.
const llmRow = page.getByText("LLM via Bifrost gateway", { exact: false }).first();
await llmRow.waitFor({ timeout: 15_000 });
await llmRow.scrollIntoViewIfNeeded();
await page.waitForTimeout(2000);
// Scroll the table horizontally so the trailing "Gateway" column is on camera.
const table = page.locator("table").first();
await table.evaluate((el) => {
const scroller = el.closest(".overflow-x-auto");
if (scroller) scroller.scrollLeft = scroller.scrollWidth;
});
await page.waitForTimeout(4000);
// Hold on the Bifrost explainer paragraph below the table too.
await page
.getByText("Bifrost's own per-call telemetry", { exact: false })
.scrollIntoViewIfNeeded()
.catch(() => {});
await page.waitForTimeout(3000);
await context.close();
await browser.close();
const produced = readdirSync(OUT_DIR).find((f) => f.endsWith(".webm"));
if (!produced) throw new Error(`No .webm produced in ${OUT_DIR} — recording failed.`);
renameSync(join(OUT_DIR, produced), FINAL_WEBM);
console.log(`Wrote real screen-recorded Bifrost demo: ${FINAL_WEBM}`);
}
main().catch((err) => {
console.error(err);
process.exit(1);
});