The player: mounting the twin in a page

this page as plaintext

starlab-player.js mounts the reference simulation in a page: a player over a world’s files and its record, the figure.world[data-world] blocks, a recording scrubbed, a tape played and held to its checkpoints, a sealed record from /play/<sha>. One module instance a URL a page.

Exports

MATS

MATS

The materials by id, each [name, colour]: the engine’s materials.rs names them (the reference’s view page holds the two tables to each other); a slot absent here is free in the engine too.

starburn/crates/starlab-wasm/web/starlab-player.js:16

PAL

PAL

The palette the view draws with: [r, g, b] per material id from MATS’ colours; magenta marks an id with no material (a bug made visible), and air (0) is null, drawn as nothing.

starburn/crates/starlab-wasm/web/starlab-player.js:25

ALPHA

ALPHA

The opacity per material id, 1 unless set below: water, ice, steam, smoke, glass and the like let the cells behind them show.

starburn/crates/starlab-wasm/web/starlab-player.js:28

FILES

FILES

A world’s files, in the order sl_world_open takes them: the meta, the grid, and the sidecars a world may lack (air, flux, biomes, geo), each given as bytes or left empty.

starburn/crates/starlab-wasm/web/starlab-player.js:32

LABEL

LABEL

The caption under a live player: what it is and what it is not (renderer 4 is the desktop’s).

starburn/crates/starlab-wasm/web/starlab-player.js:34

REPLAY_LABEL

REPLAY_LABEL

The caption under a replay of a recorded cart.

starburn/crates/starlab-wasm/web/starlab-player.js:36

loadModule

loadModule(url)

The wasm module, instantiated once per URL and shared by every player on the page.

starburn/crates/starlab-wasm/web/starlab-player.js:40

mountPlayer

mountPlayer(root, opts)

Mount a player. opts.files: name → URL (fetched) or Uint8Array; opts.record: the cart’s record.json (its payload.replay is the witness); opts.wasm: the module’s URL; opts.name: shown; opts.autoplay; opts.live (the record’s budget verdict, shown as a word); opts.stepsPerFrame.

option type
wasm URL the module (one instance a URL a page)
files {name: URL Uint8Array}
record record.json the cart’s record; its payload.replay is the witness
name string shown
autoplay boolean
live string the record’s budget verdict, shown as a word
stepsPerFrame int
width px the canvas (960 by default)
height px the canvas (540 by default)
onDraw function called after each draw

starburn/crates/starlab-wasm/web/starlab-player.js:65

mountBlocks

mountBlocks(selector = "figure.world[data-world]")

Mount every <figure class="world" data-world="…"> on the page: the block’s markup, the player on demand (a click on its control) or at once when the record says live. data-world is JSON: {name, wasm, files, record, live}.

starburn/crates/starlab-wasm/web/starlab-player.js:160

mountReplay

mountReplay(root, opts)

A starlab.replay/1 cart (M4 of the cartridge program): the recording scrubbed, never stepped — for a world too large to run in a page. opts.files: name → URL or bytes (replay.lua and the frames it names); opts.wasm. The module reads replay.lua as JSON (sl_lua_json); each frame is fetched when first shown, decoded by the module (sl_grid_decode) and hashed back (sl_words_hash): the frame on screen says whether it hashes to the digest the recording names. Returns { show(i), play, pause, index, frame, frames, digestOk, dims, close }.

starburn/crates/starlab-wasm/web/starlab-player.js:198

mountRecord

mountRecord(fig, opts)

/play/ (M4 of the cartridge program): the player alone on one sealed cart, the one URL an essay, a StarBoard card or an embed carries. The record’s sha comes from the path (/play/<sha>; the host rewrites it to the page), from ?r=<sha>, or from the hash; the page fetches <opts.carts><sha>/record.json, names the content files from the record’s subject and mounts the player on them (the witness is the record’s). opts.words are the page’s own lines: missing (no record named), reading, kind (a cart this player does not open). Returns the player.

starburn/crates/starlab-wasm/web/starlab-player.js:294

TAPE_KIND

TAPE_KIND

The tape format this player replays (docs/formats/world-tape.md): a cart whose kind is another is refused by name.

starburn/crates/starlab-wasm/web/starlab-player.js:371

TAPE_LABEL

TAPE_LABEL

The caption under a tape’s replay.

starburn/crates/starlab-wasm/web/starlab-player.js:373

readTape

readTape(ex, tapeBytes)

A tape.lua read by the module and checked as the reference checks it. -> {name, first, last, ops, cps, claimed, salt, mask, reasons}: reasons is empty for a well-formed tape; unread is set when the file is no Lua data.

starburn/crates/starlab-wasm/web/starlab-player.js:380

openTapeWorld

openTapeWorld(ex, files, v)

The tape’s world opened on the module with the tape’s options: -> {h} or {refused: […]} in the reference’s words. files: name → bytes (meta.lua and grid.png required; the sidecars the save captured when present).

starburn/crates/starlab-wasm/web/starlab-player.js:425

applyTapeOp

applyTapeOp(ex, h, op)

One op through the module’s C ABI (the twin’s own spawn path). -> null, or the reason it was refused.

starburn/crates/starlab-wasm/web/starlab-player.js:444

mountTape

mountTape(root, opts)

Mount a tape: the world drawn in 3-D while the page plays the tape on the reference sim, a row per checkpoint (the tape’s digest beside the one the module printed), the verdict in the reference’s words, and the record’s own witness beside it when the cart has one. opts.files: name → URL (fetched; a missing one is absent) or Uint8Array (tape.lua, meta.lua, grid.png and the sidecars the save captured); opts.wasm; opts.record: the cart’s record.json; opts.autoplay (default true); opts.stepsPerFrame (default 1: the run at its own pace; “to the end” plays the rest at once). Returns {done: Promise, play, pause, finish, frame, fingerprint, verdict, close}, or the refusal itself when the tape cannot be played.

starburn/crates/starlab-wasm/web/starlab-player.js:519

The work on this page: the commits of the last 30 days on its sources, the work open against them, its checks

  • starburn 87e5ac4 techno, the day after: a tempo that is a RATIO of steps (any beats a minute), a lane's ACCENT and ARRANGEMENT, the tempo and the lanes in the snapshot and the record; ABI id 3aa530db (2026-11-12, the tower)
  • starburn ec01144 techno T1: the lanes, rhythms that strike the sound plane on the world's tempo (both sim lanes, a saved world, a tape op, the reference and the browser twin); ★ the ABI id moves f9de7f70 -> d9103976; ★ T0's stated tempi corrected (the sim clock is 60 a second, not 33) (2026-11-12, the tower)

  • starburn fc074fc tape: one reader. The parser, its refusals and the applier are the core's tape module; the command and the browser module call it, and the two JavaScript walkers hold no checks of their own (dev loop S2; 2026-11-11, the tower)
  • starburn acbe7d0 wasm: the browser twin reads the tape's sound ops and holds sound_hash; a sound tape over a grid that is not whole lattice cells is refused (waves V2b; 2026-11-11, the tower)

  • starburn 0610b88 starlab-wasm web: words above the eleven exports that had none (view.js, starlab-player.js) (2026-11-09)
  • starburn cfcdc0f starlab-wasm web: every demo of api.json pins its digest at rest (2026-11-09)

  • starburn 35f5c51 starlab-wasm: api.json, the web engine's protocol table; words on the eleven undocumented exports; the web names material 14 as the engine does (D1 of the reference lane, 2026-11-05)

  • starburn 2fa75d9 starlab-wasm/web: mountTape, the world tape played on the worlds page's player (the replay program's R7, 2026-10-30)

  • starburn 52161e9 starlab.replay/1, the recording (M4 of the cartridge program): world::write_replay_dir (the cells every K steps as frames/<frame>.png with replay.lua naming each frame's digest) and write_lua_canon (canon_lua's text byte for byte, held to three conformance goldens); starlab-replay record; the wasm module reads Lua data as JSON, decodes a grid PNG and hashes words (sl_lua_json, sl_grid_decode, sl_words_hash); the player's mountReplay scrubs a recording and hashes every frame back, mountRecord routes a replay record to it; the derived crate re-split
  • starburn fb9f0d0 starlab-player: mountRecord — the player alone on one sealed cart for /play/<record> (M4 of the cartridge program)
  • starburn 558be21 starlab-player.js: a page's block mounts once; the 3-D view and a block's start fail aloud in the slot, never as an uncaught exception
  • starburn 724186d starlab-wasm/web: the player as one module (starlab-player.js + its stylesheet) — mount on an element with a world's files and the cart's record: the 3-D view, play/step, the fingerprint, and the replay check against the record's witness ("replayed ×2" when the page's digest at the witness's frame equals the record's); mountBlocks for a page's figure.world blocks; the dev page rebuilt on it with a record check and a ?world=&check= deep link; web-sim.sh stages the exported showcase carts with their records

The work record as of , from the fold on tower.

Nothing open against these sources.

  • FAILlint/web-reference 12 Nov on tower

Generated by tools/reference_pages.py from starburn/crates/starlab-wasm/web/starlab-player.js, web/api.json; the twin bfaad079a7ce (434093 bytes). The words are a draft.