Agent Harness
Публичная копия обвязки агентной разработки: гейты, journeys, скиллы и шаблоны. Без ключей и личных данных.
Публичная копия обвязки агентной разработки: гейты, journeys, скиллы и шаблоны. Без ключей и личных данных.
const { chromium } = require("playwright-core");
const OUT = "<HOME>/Projects/pixelfx/arena/shots";
(async () => {
const b = await chromium.launch({ args: ["--force-device-scale-factor=1"] });
const p = await b.newPage({ viewport: { width: 1280, height: 720 } });
const errs = [];
p.on("pageerror", (e) => errs.push(e.message));
p.on("console", (m) => m.type() === "error" && errs.push(m.text()));
await p.goto("http://localhost:5173/arena/", { waitUntil: "networkidle" });
await p.waitForTimeout(900);
// kill the dummy with bolts, waiting out each cooldown
for (let i = 0; i < 12; i++) {
const st = await p.evaluate(() => ({ phase: window.__arena.phase, locked: window.__arena.locked, ready: window.__arena.ready }));
if (st.phase !== "fight") break;
if (!st.locked) await p.evaluate(() => window.__arena.cast(3));
await p.waitForTimeout(700);
}
await p.waitForTimeout(300);
const win = await p.evaluate(() => ({ phase: window.__arena.phase, dummy: window.__arena.dummyHp }));
console.log("win:", JSON.stringify(win));
await p.screenshot({ path: OUT + "/arena-win.png" });
// lose: stand still and let the dummy work
await p.evaluate(() => window.__arena.reset());
await p.waitForTimeout(45000);
const lose = await p.evaluate(() => ({ phase: window.__arena.phase, hero: window.__arena.heroHp, fps: window.__arena.fps }));
console.log("lose:", JSON.stringify(lose));
await p.screenshot({ path: OUT + "/arena-lose.png" });
console.log("errors:", errs.length ? errs.join(" | ") : "(none)");
await b.close();
})();