Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

1.7 KB
Raw Blame
import {mkdir} from 'node:fs/promises';import {join,resolve} from 'node:path';import {fileURLToPath,pathToFileURL} from 'node:url';import {chromium} from '../toolchain/node_modules/playwright-core/index.mjs';import {browserPath} from '../toolchain/browser.mjs';
const input=resolve(process.argv[2]??'work/experience-evidence/relay-acceptance'),out=fileURLToPath(new URL('../../../showcase/game-master/',import.meta.url));await mkdir(out,{recursive:true});const browser=await chromium.launch({executablePath:await browserPath(),headless:true});try{for(const [id,name] of [['pocket-conservatory','starter'],['signal-garden','signal-garden'],['night-ferry','night-ferry']]){const context=await browser.newContext({viewport:{width:1512,height:1080},deviceScaleFactor:1}),page=await context.newPage();await page.goto(pathToFileURL(join(input,id,'after','game.html')).href);await page.waitForFunction(()=>document.querySelector('#turn-title').textContent.length>0);for(let n=1;n<=2;n++){if(await page.locator('#curtain').isVisible())await page.locator('#reveal').click();await page.locator('#actions button').first().click();await page.waitForFunction(n=>document.querySelector('#turn-count').textContent==='Turn '+n,n);}if(id==='night-ferry'){for(let n=3;n<=12;n++){await page.locator('#actions button[data-move=draw]').click();await page.waitForFunction(n=>document.querySelector('#turn-count').textContent==='Turn '+n,n);if(await page.locator('#zones .game-piece').count()>=2)break;}}if(await page.locator('#curtain').isVisible())await page.locator('#reveal').click();await page.evaluate(()=>scrollTo(0,0));await page.screenshot({path:join(out,name+'.jpg'),type:'jpeg',quality:90,fullPage:false});await context.close();}}finally{await browser.close();}console.log(out);