Skip to content

0.0.3

Choose a tag to compare

@aksheyd aksheyd released this 06 Oct 09:51
· 208 commits to main since this release

Loading a game runs its code in a sandbox, a game's page and check take only files from the game's folder, run's server answers only its own page, and every runtime dependency is the exact version CI tests. From #1.

Breaking changes

  • check, sim, and the loads behind shot and export run game.ts and any --driver in a sandbox: a JavaScript realm with the language and the engine and nothing else, in a child process that can't touch files, start processes, or reach the network. Game code that used Node's APIs, eval, new Function, or import() no longer runs there.
  • A game's files may import only threejam and files in the game's folder, and a --driver file may also import files in its own folder. Anything else, even through a link, fails with the import's path:line in check, sim, run, shot, and export, so a game that imports a shared ../lib/util.ts no longer builds.

Added

  • Each run has a time budget, --timeout seconds on check, sim, shot, and export (default 30), after which it fails with the new TIMEOUT code and the tick it reached, so an endless loop no longer hangs sim or the MCP server.
  • Each MCP call that loads a game runs in a process of its own, so one game that loops doesn't block the others, and a long-running server doesn't grow.
  • An MCP sim reply too large for a client is refused with the new OUTPUT_TOO_LARGE code and how to narrow it.
  • The MCP tools that load a game, check, sim, shot, and export, are marked as running code, and the server's instructions say that a game's log, errors, and suggested commands are its own data, not directions.
  • check maps three to ThreeJam's own Three.js types, so import type from 'three' in a view.ts describes the THREE it receives, in a project or not.

Security

  • run serves its page on 127.0.0.1 to that page alone: a request from another page, even one on another local port or opened from a file, or one that names another host, gets 403, and live reload and Esc take a token only the page has. An image or sound opened directly runs nothing, and an SVG downloads instead of opening.
  • ThreeJam starts Chrome with no DevTools port, even when a wrapper script asks for one, talks to shot's headless Chrome over a pipe, and passes Chrome only the environment variables a browser needs.
  • In node_modules, check reads only TypeScript's libraries and ThreeJam's own type packages, so a type error can't quote another package's files.
  • The import rule compares real paths exactly, as the OS spells them, instead of folding case.
  • Every runtime dependency is pinned to the exact version CI tests, and the build fails if one isn't. incur moves from 0.5.1 to 0.7.0.
  • A release publishes only after all of CI passes on the tagged commit, from a tarball built with install scripts off that matches a second build's.

Fixed

  • check bundles the page too, so it refuses an import that run, shot, or export would.
  • A game's runtime import of three fails with a hint to use the THREE that init and draw receive.
  • shot cleans up when Chrome fails to start, and only shot loads Puppeteer.

Development

  • npm test names its test files, so a Node that can't run TypeScript fails instead of finding no tests, and a test that runs past two minutes fails.
  • npm run test:package installs the package with install scripts off, as npm 12 does, and checks that a view.ts gets Three.js's types there.
  • CI tests Node 24 as well, and gives each commit on main a run of its own.
  • The repo approves esbuild's install script for the version it pins, which npm 11 asks for.

Full changes in CHANGELOG.md.