Editor SDK & storage backends
Two complementary pieces: the editor-sdk (EditorClient) lets code/agents drive the editor
programmatically, and the editorβs storage backends let it run browser-first (persisting
projects without a server). The transcript below lists both API surfaces, captured live.
# transcript pending capture β run: node site/media/capture-cli.mjs site/media/capture-cli.mjs -
List the EditorClient API.
import { EditorClient } from '@vgai/editor-sdk';const editor = new EditorClient(); // talks to a running editorawait editor.openScene('scenes/level1.vscn.json');await editor.play();The transcript shows the full method surface:
play/stop/pause/step,select/selectAll/focusEntity,openScene/createProject/openProject, view + gizmo setters, andgetState/waitForStatefor synchronizing. This is the programmatic mirror of thevgaiCLI. -
List the storage backends.
The editor persists projects through a pluggable backend (
getStorageBackend/setStorageBackend):- OpfsStorage β Origin-Private File System (browser-first default).
- FsaStorage β the File-System-Access API (a real local folder). The
picked folder is remembered across reloads (
restorePersistedProjectRoot) so browser-first authoring on disk survives a refresh. - MemStorage β in-memory (tests / ephemeral).
- HttpStorage β a server/dev backend.
This is what lets the same editor run as a static browser app and against a dev server.
Recap
New functionality
- Listed the EditorClient programmatic API
- Listed the editor storage backends
New concepts & skills
- editor-sdk EditorClient = programmatic editor control (mirror of the vgai CLI)
- storage is pluggable: OPFS / FSA / Mem / HTTP via get/setStorageBackend
- browser backends make the editor browser-first (no server needed)
Next lesson β Hot-reload in the browser