3D engine that AI agents drive
Merge remote-tracking branch 'origin/main' into merged/fix-top-tool-errors
Nguyen Xuan An4e0a478e0b74
diff --cc CHANGELOG.mdindex 080de177,09f80180..84d2c8bb--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -2,10 -2,7 +2,11 @@@## Unreleased+- Fix the next agent tool errors (part of issue #66). `scene_review` and `scene_look` with `labels` on an imported asset failed with "needs the mesh code" because asset creation loaded the on-demand scene modules only for mesh edits; it now always does, and a test walks every preview path in a fresh process. `geometries` and `materials` are optional in a recipe. A failed `scene_create` says no scene was created and to call it again. `scene_inspect` on an asset accepts a source-node ID that holds one part and names the parts of one that holds several.++- Fix the most common agent tool errors (part of issue #66). `scene_look` and `scene_review` with `labels` on an imported asset threw `Cannot read properties of undefined (reading 'map')` (an asset recipe has no materials list, and asset mesh reports are keyed by part ID); an engine fault now reaches the agent as one advice message and goes to stderr. A node that names a geometry and no material gets an explicit `default` material instead of an error. `sessionId` is optional on every tool and defaults to the active scene (189,159 to 188,872 schema bytes); an ID that names another scene is still rejected. `scene_apply` names the fix when `set-node` fields are wrapped in `node`. The bench look harness loads the on-demand scene modules, so motion recipes get a look score.++ - Rename the project from 67.js to 67js, with no dot, and the GitHub repository to `anxuanng/67js`. The npm package `@codepawlhq/67js`, the site domain and the Worker name stay.- Add a recipe timeline, job audio and an encoder choice (part of issue #60, first slice). A recipe `timeline` lists named shots played in order over the motion clock, each with a `duration`, an optional `motionStart`, a partial `camera` on top of the sampled one and a `dip` through black; `set-timeline` edits it. `settings.timeline: { start }` renders it as an image, stills or video: one clock drives the shot, the motion and the renderer, so a seek to any time gives the same frame as inside a video. `settings.audio: { file, offset }` mixes one `.wav`, `.mp3`, `.ogg` or `.flac` from the new `--audio <folder>` option into a video, checks that it covers the video, decodes both streams afterwards and reports `metrics.sync` (a gap over 50 ms fails the job); `settings.encoder` is `cpu` or `nvenc`. File names are plain names without paths, drives or protocols, files must be regular and at most 32 MiB, and ffmpeg gets `-protocol_whitelist file`; nothing else comes from the agent. Video jobs can last 60 s (was 30), still capped at 900 frames, so a 60 s video runs at 15 fps. Measured through MCP on SwiftShader (`npm run smoke:film-timeline`): 9 PNG seeks across three shots and a dip match 8 stills byte for byte, and a 60 s, 900 frame video with sound rendered in 58 s (84 s on a loaded machine) at 128 x 128 with the click in the decoded audio on the decoded cut frame (offset 0.1 ms, streams 20 ms apart). Tool schemas stay inside their budgets (the timeline is a record reference; fields are in `scene_capabilities` `filmTimeline`). Left out: resumable long renders, several audio tracks, gain, markers inside a shot, animation events, crossfades and timelines for imported assets. The video sequence editor stays a non-goal.- Decide on WebGPU (part of issue #56, no engine change): wait, WebGL2 stays the only backend. Headless Chrome 156 has a WebGPU adapter on the RTX 3060 with no flags, but none under the MCP `cpu` flags (`--use-angle=swiftshader`); the SwiftShader Vulkan adapter needs `--use-webgpu-adapter=swiftshader`. With three.js as a proxy on 3 bench scenes, WebGPU frames were 2.6 to 4.4 times WebGL on the GPU and 1.4 to 3.0 times on SwiftShader, and first frames were slower. Browser support, shader rewrite size (about 1,400 GLSL lines and 450 call sites) and bundle cost are in `docs/webgpu-decision.md`.- Add recipe particles and hair (part of issue #63, no new tool). A `particles` section holds seeded emitter systems (point, box, sphere or disc; gravity, drag, wind, a landing floor, size over life) and hair systems that grow strands from a surface node, loaded on demand with the new `particles` module (`src/particles.js`, `src/hair.js`). Each particle is a closed-form function of its seed, index and time, so a seek never replays: the same time gives the same particles, a seek backwards repeats them and a seeded system gives identical bytes (`npm run smoke:agent-particles` checks PNG bytes through the MCP preview, including a second session). Counts are bounded to 4 systems, 2000 particles each, 4000 in total and 100000 drawn vertices. New `set-particles` operation and a `particles` report in `scene_inspect`; the schema takes one record reference, so the tool schemas stay within the total budget and the fields live in `scene_capabilities`. Cloth and particles now share validation helpers (`src/agent-recipe-checks.js`). Left out: particle collisions and bounce, rotation, colour and alpha, hair collision and combing. The smoke, fire and liquid decision (no browser solver, with measured grid costs) is in `docs/physics.md`.