Agent Harness
Публичная копия обвязки агентной разработки: гейты, journeys, скиллы и шаблоны. Без ключей и личных данных.
Публичная копия обвязки агентной разработки: гейты, journeys, скиллы и шаблоны. Без ключей и личных данных.
const { chromium } = require("playwright-core");
(async () => {
const b = await chromium.launch({ channel: "chrome", args: ["--force-device-scale-factor=1"] });
const p = await b.newPage({ viewport: { width: 1280, height: 720 }, deviceScaleFactor: 1 });
const logs = [];
p.on("console", (m) => logs.push(`${m.type()}: ${m.text()}`));
p.on("pageerror", (e) => logs.push(`pageerror: ${e.message}`));
p.on("response", (r) => r.status() >= 400 && logs.push(`http ${r.status()} ${r.url()}`));
p.on("request", (r) => { const u = new URL(r.url()); if (!/^(localhost|127\.0\.0\.1)$/.test(u.hostname)) logs.push(`external ${r.url()}`); });
await p.addInitScript(() => { window.__frames = []; let prev = 0; const t = (x) => { if (prev) window.__frames.push(x - prev); prev = x; requestAnimationFrame(t); }; requestAnimationFrame(t); });
await p.goto("http://localhost:4173/arena/", { waitUntil: "networkidle" });
await p.waitForTimeout(2500);
for (const k of ["Digit1", "Digit3", "Digit4", "Digit2", "Digit5"]) { await p.keyboard.press(k); await p.waitForTimeout(1500); await p.evaluate(() => window.__arena.reset()); await p.waitForTimeout(200); }
const r = await p.evaluate(() => { const f = window.__frames.slice().sort((a,b)=>a-b); const at = (q) => f[Math.floor(f.length*q)]; return { frames: f.length, fpsP50: +(1000/at(0.5)).toFixed(1), fpsP95: +(1000/at(0.95)).toFixed(1), max: +f[f.length-1].toFixed(1), canvas: (() => { const c = document.getElementById("game"); return [c.width, c.height, c.style.width, c.style.height]; })() }; });
console.log("production build:", JSON.stringify(r));
await p.goto("http://localhost:4173/arena/library.html", { waitUntil: "networkidle" });
await p.waitForTimeout(2500);
console.log("library tiles:", await p.evaluate(() => document.querySelectorAll(".tile").length));
await p.click(".tile");
await p.waitForTimeout(800);
console.log("dialog:", await p.evaluate(() => document.getElementById("detail").open));
console.log("console:", logs.length ? logs.join(" | ") : "(clean)");
await b.close();
})();