Browser bridge
Overview
When the editor is open, agents can drive the live canvas through window.voxie. This is separate from the HTTP Agent API: the bridge mutates the current session in the browser.
Wait for hydration with await window.voxie.whenReady() (or check window.voxie.ready) before issuing commands.
API surface
await window.voxie.whenReady()
// Replace the open scene from declarative ops (undoable)
window.voxie.applyOps([
{ op: 'shape.box', from: [0, 0, 0], to: [3, 3, 3] },
])
// Load a full ProjectJSON (undoable; preserves local scene id)
window.voxie.loadProject(project)
// Export current ProjectJSON
const project = window.voxie.exportProject()
// Quick stats
const stats = window.voxie.getStats()
// Hide or show the work-area grid and box outline
window.voxie.setGridVisible(false)
window.voxie.setBoxVisible(false)Ops match the Ops reference. applyOps compiles ops into a new project and replaces the current scene (it does not patch the existing voxel volume in place).
Code Lab (experimental)
Code Lab is a Premium sandboxed JavaScript runner for tech users. Sign in with an active Premium subscription — the Code control appears in the Studio toolbar. You can also deep-link with https://voxie.studio/studio?labs=1 to open the panel immediately.
User code runs in an opaque iframe + disposable Worker. Inside the sandbox, window.voxie is an async proxy — you must await every call. The parent only accepts whitelisted RPC (applyOps, loadProject, exportProject, getStats, setGridVisible, setBoxVisible, setAnimations, setTriggers). Sandbox code cannot read cookies, local storage, or mint account API tokens.
// Inside Code Lab
await window.voxie.setGridVisible(false)
await window.voxie.setBoxVisible(false)
const before = await window.voxie.getStats()
console.log(before)
await window.voxie.applyOps([
{ op: 'color.set', hex: '#3b82f6' },
{ op: 'shape.box', from: [0, 0, 0], to: [4, 2, 4] },
])
return await window.voxie.getStats()Limits & safety
- Max 80,000 voxels and 5 MB per project load / ops compile.
- Shape coordinates are capped (±512) and oversized boxes/spheres are rejected before iteration.
- Successful bridge / Code Lab scene replaces are undoable and keep the local scene id.
- Work-area size follows Free/Premium entitlements (cloud/co-create scenes still use the owner Premium max).
- Mutating bridge / Code Lab calls are blocked while live collaboration is connected (reads via
exportProject/getStatsremain available).
Agent loader
Scenes created via the HTTP API can be opened with an agent loader URL of the form /studio?agent=<id>&token=<read-token>. The editor fetches the scene and hydrates the canvas.