Agent mode: an AI agent plays in the player's own tab, with the agent's clock or a running one
The MCP server gains a second session, --browser: the game in the player's tab, reached through the agent relay npm run dev hosts at /agent (loopback unless --host; Host and Origin checked, no token). The player turns it on in Settings → Agent API, a section only the development page has, and picks the clock: a pace of 30 s to 5 min a day that nobody can pause, or the agent's own. Headless gets the running clock too (--clock realtime --pace MS) and both get a wait tool. All of it lives in src/agent/ (development page only). The game offers HOOKS, UI.clockLocked, setSpeed() and runClock(dt), the frame's day block moved out unchanged, and nothing more: the page players get grows by under 1 KB gzipped and runs exactly as before.
This commit is contained in:
parent
2526dd458d
commit
7438fd1065
53 changed files with 1827 additions and 170 deletions
|
|
@ -23,7 +23,10 @@ function load(opts = {}) {
|
|||
if (!/getContext|Not implemented/.test(e.message)) errors.push(e.message);
|
||||
});
|
||||
const dom = new JSDOM(html, {
|
||||
url: 'https://tests.invalid/',
|
||||
// opts.url: the origin the page is "served" from. Tests that dial the agent relay pass the relay's own host, so
|
||||
// the page's WebSocket Origin matches (the relay refuses a cross-site one); everything else stays on a made-up
|
||||
// https origin nothing can reach.
|
||||
url: opts.url || 'https://tests.invalid/',
|
||||
runScripts: 'dangerously',
|
||||
pretendToBeVisual: true,
|
||||
virtualConsole: vc,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue