Agent Harness
Публичная копия обвязки агентной разработки: гейты, journeys, скиллы и шаблоны. Без ключей и личных данных.
Публичная копия обвязки агентной разработки: гейты, journeys, скиллы и шаблоны. Без ключей и личных данных.
const { chromium } = require("playwright-core");
const OUT = "<HOME>/Projects/pixelfx/arena/shots";
(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 });
p.on("pageerror", (e) => console.log("ERR", e.message));
await p.goto("http://localhost:4173/arena/", { waitUntil: "networkidle" });
await p.waitForTimeout(1500);
// victory: slash the dummy down, waiting out each skill until it is free
await p.evaluate(() => window.__arena.reset());
for (let i = 0; i < 60; i++) {
const st = await p.evaluate(() => ({ phase: window.__arena.phase, ready: window.__arena.ready }));
if (st.phase !== "fight") break;
if (st.ready[0]) await p.keyboard.press("Digit1");
await p.waitForTimeout(180);
}
await p.waitForTimeout(600);
console.log("win:", JSON.stringify(await p.evaluate(() => ({ phase: window.__arena.phase, dummy: window.__arena.dummyHp }))));
await p.screenshot({ path: OUT + "/arena-win.png" });
// defeat: reset and stand still
await p.evaluate(() => window.__arena.reset());
await p.waitForTimeout(42000);
console.log("lose:", JSON.stringify(await p.evaluate(() => ({ phase: window.__arena.phase, hero: window.__arena.heroHp }))));
await p.screenshot({ path: OUT + "/arena-lose.png" });
await b.close();
})();