roamwright 0.61.9 → 0.61.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roamwright",
3
- "version": "0.61.9",
3
+ "version": "0.61.10",
4
4
  "description": "A procedural worldbuilding engine built on top of Three.js. Generate landscapes with rivers and changing weather, animate crowds, and explore on foot or in flight.",
5
5
  "keywords": [
6
6
  "threejs",
@@ -47,6 +47,7 @@
47
47
  "runtime",
48
48
  "tools",
49
49
  "examples",
50
+ "scripts/build.py",
50
51
  "scripts/serve.py",
51
52
  "scripts/dev-engine.py",
52
53
  "scripts/format.sh",
@@ -1,8 +1,10 @@
1
1
  // Classic inline script bundling and GLSL shader-source compaction helpers for static world builds.
2
2
  import { execFileSync } from 'node:child_process';
3
3
  import { existsSync } from 'node:fs';
4
+ import { fileURLToPath } from 'node:url';
4
5
 
5
6
  const defaultPython = () => (existsSync('.venv/bin/python') ? '.venv/bin/python' : 'python3');
7
+ const DEFAULT_SHADER_SCRIPT = fileURLToPath(new URL('./build.py', import.meta.url));
6
8
 
7
9
  /**
8
10
  * Compacts `/* glsl *\/` tagged template literals in a map of `{ [filePath]: sourceCode }`
@@ -11,10 +13,10 @@ const defaultPython = () => (existsSync('.venv/bin/python') ? '.venv/bin/python'
11
13
  * @param {Record<string, string>} sources Map of file paths to JS source text.
12
14
  * @param {object} [options]
13
15
  * @param {string} [options.python] Python executable path.
14
- * @param {string} [options.shaderScript='scripts/build.py'] Script accepting `--shader-sources`.
16
+ * @param {string} [options.shaderScript] Script accepting `--shader-sources` (defaults to `roamwright/scripts/build.py`).
15
17
  * @returns {Record<string, string>}
16
18
  */
17
- export function compactShaders(sources, { python = defaultPython(), shaderScript = 'scripts/build.py' } = {}) {
19
+ export function compactShaders(sources, { python = defaultPython(), shaderScript = DEFAULT_SHADER_SCRIPT } = {}) {
18
20
  if (!Object.keys(sources).length) return {};
19
21
  return JSON.parse(
20
22
  execFileSync(python, [shaderScript, '--shader-sources'], {
@@ -0,0 +1,404 @@
1
+ #!/usr/bin/env python3
2
+ """Build a world's page from the components under src/: index.html, and beside it app/ with its script and style sheet.
3
+
4
+ python3 scripts/build.py the page to send to visitors: script and styles minified, markup tightened
5
+ python3 scripts/build.py --dev compatible spelling of the same optimized build
6
+ python3 scripts/build.py --shader-sources read JSON {path: js} on stdin, compact /* glsl */ templates to stdout
7
+
8
+ src/manifest.yaml lists the style sheets and markup partials in the order they are joined, and optionally the bundle's
9
+ entry points (`entries`, defaulting to `src/main.js`), land modules (`lands`), value-evaluated modules (`values`), and
10
+ split-piece modules (`split`).
11
+
12
+ The script is real ES modules: the first entry imports every module, each module imports what it uses and exports what
13
+ others use, and scripts/bundle.mjs bundles them into app/main.js. Lazy dynamic imports (`await import('./x.js')`) become
14
+ hashed parts (app/part-<hash>.js), preloaded together by `preload_parts`. Additional entries become worker bundles beside
15
+ app/main.js, sharing common code in hashed parts. Three.js stays external under ../vendor/three/. Marked GLSL templates
16
+ are compacted before Rollup and Terser finalize each chunk.
17
+
18
+ Environment, all optional:
19
+ BUILD_TIME Unix timestamp for @build:updated-iso / @build:updated (default: current time)
20
+ BUILD_TZ_OFFSET Timezone offset in hours for @build:updated (default: 0)
21
+ BUILD_TZ_LABEL Timezone label suffix for @build:updated (default: UTC when offset is 0, else GMT+N)
22
+ BUILD_PRELOAD_FN Global function name emitted ahead of lazy part imports (default: preloadParts)
23
+ BUILD_BUNDLE_SCRIPT Consumer bundler entry script relative to cwd (default: scripts/bundle.mjs)
24
+ BUILD_BROWSER_SCRIPTS Consumer inline-script minifier relative to cwd (default: scripts/browser-scripts.mjs)
25
+ """
26
+
27
+ import gzip
28
+ import json
29
+ import os
30
+ import re
31
+ import shutil
32
+ import subprocess
33
+ import sys
34
+ import tempfile
35
+ from concurrent.futures import ThreadPoolExecutor
36
+ from datetime import datetime, timedelta, timezone
37
+ from pathlib import Path
38
+
39
+ ROOT = Path.cwd()
40
+ STAGE = ".app-next" # where a build is written before it takes the place of app/
41
+ SRC = ROOT / "src"
42
+ ESBUILD = ROOT / "node_modules/.bin/esbuild"
43
+ GLSL_MARKER = "/* glsl */"
44
+ GLSL_COMMENTS = re.compile(r"//[^\n]*|/\*.*?\*/", re.S)
45
+ GLSL_DIRECTIVES = re.compile(r"(^[ \t]*#(?:[^\n]*\\\n)*[^\n]*(?:\n|$))", re.M)
46
+ PART_IMPORT = re.compile(r'(\bimport\("\./(part-[0-9A-Za-z]+\.js)"\))') # an import() of a hashed bundle
47
+ PRELOAD = os.environ.get("BUILD_PRELOAD_FN", "preloadParts")
48
+ SPLIT_PREFIX = re.compile(r"^split:") # how scripts/bundle.mjs names a piece of a module split into parts
49
+ GLSL_JOINED_OPERATORS = {
50
+ "++",
51
+ "--",
52
+ "<<",
53
+ ">>",
54
+ "&&",
55
+ "||",
56
+ "^^",
57
+ "==",
58
+ "!=",
59
+ "<=",
60
+ ">=",
61
+ "+=",
62
+ "-=",
63
+ "*=",
64
+ "/=",
65
+ "%=",
66
+ "&=",
67
+ "|=",
68
+ "^=",
69
+ "//",
70
+ "/*",
71
+ "*/",
72
+ }
73
+
74
+
75
+ def load_manifest(path):
76
+ """Read a YAML mapping of section names to ordered file lists (src/manifest.yaml)."""
77
+ data, current = {}, None
78
+ for raw in Path(path).read_text(encoding="utf-8").splitlines():
79
+ line = raw.split("#", 1)[0].strip()
80
+ if not line:
81
+ continue
82
+ if line.endswith(":") and not line.startswith("- "):
83
+ current = line[:-1].strip()
84
+ data[current] = []
85
+ elif line.startswith("- ") and current is not None:
86
+ data[current].append(line[2:].strip().strip("'\""))
87
+ else:
88
+ raise ValueError(f"{path}: unsupported YAML line: {raw!r}")
89
+ return data
90
+
91
+
92
+ def join(names, src_dir=None):
93
+ base = SRC if src_dir is None else Path(src_dir)
94
+ return "".join((base / n).read_text() for n in names)
95
+
96
+
97
+ def esbuild(args, text=None, root=None):
98
+ """Run esbuild and return what it prints; None if it fails or cannot be run."""
99
+ cwd = ROOT if root is None else Path(root)
100
+ cmd = [cwd / "node_modules/.bin/esbuild", "--target=es2022", "--log-level=warning"] + args
101
+ try:
102
+ r = subprocess.run(cmd, input=text, capture_output=True, text=True, timeout=180, cwd=cwd)
103
+ except (OSError, subprocess.TimeoutExpired) as e:
104
+ print(f" esbuild could not be run ({e})", file=sys.stderr)
105
+ return None
106
+ if r.returncode != 0:
107
+ print(r.stderr, file=sys.stderr)
108
+ return None
109
+ warn = "\n".join(line for line in r.stderr.splitlines() if line.strip() and not line.startswith("npm notice"))
110
+ if warn:
111
+ print(warn, file=sys.stderr)
112
+ return r.stdout
113
+
114
+
115
+ def bundle_modules(options, bundle_script=None, root=None):
116
+ """Bundle the modules with esbuild through the consumer's scripts/bundle.mjs;
117
+ False if it fails or cannot be run. The first entry point is the page's, the others the workers'."""
118
+ cwd = ROOT if root is None else Path(root)
119
+ script = bundle_script or os.environ.get("BUILD_BUNDLE_SCRIPT", "scripts/bundle.mjs")
120
+ args = ["node", "--no-warnings", script]
121
+ try:
122
+ r = subprocess.run(args, input=json.dumps(options), capture_output=True, text=True, timeout=180, cwd=cwd)
123
+ except (OSError, subprocess.TimeoutExpired) as e:
124
+ print(f" esbuild could not be run ({e})", file=sys.stderr)
125
+ return False
126
+ warn = "\n".join(line for line in r.stderr.splitlines() if line.strip() and not line.startswith("npm notice"))
127
+ if warn:
128
+ print(warn, file=sys.stderr)
129
+ return r.returncode == 0
130
+
131
+
132
+ def compact_glsl(section, holes):
133
+ """Collapse code whitespace without joining tokens or changing splice boundaries."""
134
+
135
+ def gap(match):
136
+ start, end = match.span()
137
+ left, right = section[start - 1 : start], section[end : end + 1]
138
+ if start == 0 or end == len(section) or left in holes or right in holes:
139
+ return "\n" if "\n" in match[0] else " "
140
+ if (left.isalnum() or left in "_.") and (right.isalnum() or right in "_."):
141
+ return " "
142
+ if left + right in GLSL_JOINED_OPERATORS:
143
+ return " "
144
+ return ""
145
+
146
+ return re.sub(r"\s+", gap, section)
147
+
148
+
149
+ def minify_glsl(parts):
150
+ # Join the static spans with opaque placeholders so a directive can span an interpolation.
151
+ holes = [chr(0xE000 + i) for i in range(len(parts) - 1)]
152
+ source = parts[0].removeprefix(GLSL_MARKER)
153
+ for hole, part in zip(holes, parts[1:], strict=True):
154
+ assert all(hole not in span for span in parts)
155
+ source += hole + part
156
+ # An interpolation inside a comment must still evaluate and stay commented out.
157
+ if any(hole in match[0] for match in GLSL_COMMENTS.finditer(source) for hole in holes):
158
+ yield parts[0].removeprefix(GLSL_MARKER)
159
+ yield from parts[1:]
160
+ return
161
+ source = GLSL_COMMENTS.sub(lambda m: "\n" * m[0].count("\n") or " ", source)
162
+ sections = GLSL_DIRECTIVES.split(source)
163
+ result = "".join(
164
+ # A shader chunk can end halfway through a directive completed by Three.js.
165
+ # Preserve the right splice boundary instead of adding an end-of-line.
166
+ (section.lstrip() if not section.endswith("\n") else section.strip() + "\n")
167
+ if i % 2
168
+ else compact_glsl(section.lstrip() if i else section, holes)
169
+ for i, section in enumerate(sections)
170
+ )
171
+ for hole in holes:
172
+ if hole not in result:
173
+ raise ValueError("GLSL interpolation inside a comment")
174
+ for hole in holes:
175
+ first, result = result.split(hole, 1)
176
+ yield first
177
+ yield result
178
+
179
+
180
+ def _acorn_bin(root):
181
+ for candidate in (
182
+ root / "node_modules/.bin/acorn",
183
+ Path(__file__).resolve().parent.parent / "node_modules/.bin/acorn",
184
+ ):
185
+ if candidate.is_file():
186
+ return candidate
187
+ return root / "node_modules/.bin/acorn"
188
+
189
+
190
+ def minify_shader_literals(js, root=None):
191
+ """Rewrite only template text marked /* glsl */, using JavaScript parser offsets."""
192
+ if GLSL_MARKER not in js:
193
+ return js # most scripts hold no shader, and each parser runs in its own process: only these are parsed
194
+ cwd = ROOT if root is None else Path(root)
195
+ # Acorn gets a file, not stdin: its CLI decodes stdin chunk by chunk, so a UTF-8 character split across two pipe
196
+ # chunks became two characters and shifted every later offset by one (a build broke on some runs and not others).
197
+ with tempfile.NamedTemporaryFile("w", suffix=".js", encoding="utf-8", delete=False) as f:
198
+ f.write(js)
199
+ try:
200
+ parsed = subprocess.run(
201
+ [_acorn_bin(cwd), "--ecma2022", "--module", "--compact", f.name],
202
+ capture_output=True,
203
+ text=True,
204
+ encoding="utf-8",
205
+ timeout=180,
206
+ cwd=cwd,
207
+ check=True,
208
+ )
209
+ finally:
210
+ os.unlink(f.name)
211
+ edits = []
212
+
213
+ def visit(node):
214
+ if isinstance(node, list):
215
+ for child in node:
216
+ visit(child)
217
+ if not isinstance(node, dict):
218
+ return
219
+ if node.get("type") == "TemplateLiteral":
220
+ spans = node["quasis"]
221
+ parts = [span["value"]["cooked"] for span in spans]
222
+ if parts[0] and parts[0].startswith(GLSL_MARKER):
223
+ for span, part in zip(spans, minify_glsl(parts), strict=True):
224
+ escaped = part.replace("\\", "\\\\").replace("`", "\\`").replace("${", "\\${")
225
+ edits.append((span["start"], span["end"], escaped))
226
+ return
227
+ if node.get("type") == "Literal" and isinstance(node["value"], str) and node["value"].startswith(GLSL_MARKER):
228
+ # esbuild may emit a static template literal as a quoted string.
229
+ (part,) = minify_glsl([node["value"]])
230
+ edits.append((node["start"], node["end"], json.dumps(part)))
231
+ return
232
+ for child in node.values():
233
+ visit(child)
234
+
235
+ visit(json.loads(parsed.stdout))
236
+ # Acorn reports UTF-16 offsets, including when earlier strings contain non-BMP characters.
237
+ code = js.encode("utf-16-le")
238
+ chunks = []
239
+ end = len(code)
240
+ for start, stop, value in sorted(edits, reverse=True):
241
+ chunks.extend((code[stop * 2 : end], value.encode("utf-16-le")))
242
+ end = start * 2
243
+ chunks.append(code[:end])
244
+ result = b"".join(reversed(chunks)).decode("utf-16-le")
245
+ if GLSL_MARKER in result:
246
+ raise ValueError("A marked GLSL literal could not be minified")
247
+ return result
248
+
249
+
250
+ def imported(outputs, name, kinds=("import-statement",)):
251
+ """The output files `name` imports, at once and through what those import, by the given kinds of import: itself first."""
252
+ seen, todo = [], [name]
253
+ while todo:
254
+ n = todo.pop()
255
+ if n in seen:
256
+ continue
257
+ seen.append(n)
258
+ todo += [i["path"] for i in outputs[n]["imports"] if i["kind"] in kinds and not i.get("external")]
259
+ return seen
260
+
261
+
262
+ def write_parts(outputs, app):
263
+ """app/parts.json: for the page's script and for each module fetched when it is needed (`import()`), the files it is and
264
+ those it imports at once, so scripts/site.mjs can preload on each page what that page fetches before the world opens."""
265
+ parts = {
266
+ SPLIT_PREFIX.sub("", o["entryPoint"]).removeprefix("src/"): [Path(n).name for n in imported(outputs, name)]
267
+ for name, o in outputs.items()
268
+ if o.get("entryPoint") and name.endswith(".js")
269
+ }
270
+ (app / "parts.json").write_text(json.dumps(parts, indent=1))
271
+
272
+
273
+ def preload_parts(outputs, worker_entries=(), main_entry="main.js", root=None):
274
+ """Writes before each import() of a part in the page's scripts the files that part imports at once and that are not
275
+ loaded already where it is asked for (the page's own, the asking script's), for part-preload to ask for all
276
+ together: the browser would otherwise find them one level at a time, a round trip each. The workers' scripts are left
277
+ alone (a worker has no document to preload in)."""
278
+ cwd = ROOT if root is None else Path(root)
279
+ workers = {n for entry in worker_entries for n in imported(outputs, f"{STAGE}/{entry}", ("import-statement", "dynamic-import"))}
280
+ loaded = set(imported(outputs, f"{STAGE}/{main_entry}"))
281
+ for name in outputs:
282
+ if not name.endswith(".js") or name in workers:
283
+ continue
284
+ here = loaded.union(imported(outputs, name))
285
+
286
+ def preloaded(m, loaded_here=here):
287
+ files = [Path(n).name for n in imported(outputs, f"{STAGE}/{m[2]}")[1:] if n not in loaded_here]
288
+ return f"(globalThis.{PRELOAD}?.({json.dumps(files, separators=(',', ':'))}),{m[1]})" if files else m[1]
289
+
290
+ script = cwd / name
291
+ text = script.read_text()
292
+ rewritten = PART_IMPORT.sub(preloaded, text)
293
+ if rewritten != text:
294
+ script.write_text(rewritten)
295
+
296
+
297
+ def updated():
298
+ """When this build was made, for the title screen. Reads BUILD_TIME (Unix seconds), BUILD_TZ_OFFSET (hours, default 0),
299
+ and BUILD_TZ_LABEL (default UTC when offset is 0, else GMT+N / GMT-N)."""
300
+ try:
301
+ stamp = int(os.environ.get("BUILD_TIME") or datetime.now().timestamp())
302
+ except ValueError:
303
+ stamp = int(datetime.now().timestamp())
304
+ try:
305
+ offset_hours = float(os.environ.get("BUILD_TZ_OFFSET") or 0)
306
+ except ValueError:
307
+ offset_hours = 0.0
308
+ label = os.environ.get("BUILD_TZ_LABEL")
309
+ if not label:
310
+ label = "UTC" if offset_hours == 0 else f"GMT{offset_hours:+g}"
311
+ t = datetime.fromtimestamp(stamp, timezone(timedelta(hours=offset_hours)))
312
+ return t.isoformat(timespec="minutes"), f"{t.day} {t:%B %Y}, {t:%H:%M} {label}"
313
+
314
+
315
+ def tighten(html):
316
+ """Markup without comments or indentation. Text inside tags is left alone."""
317
+ html = re.sub(r"<!--(?!\[).*?-->", "", html, flags=re.S)
318
+ return "\n".join(ln.strip() for ln in html.splitlines() if ln.strip()) + "\n"
319
+
320
+
321
+ def swap_in(stage, app, root=None):
322
+ """Puts the new build in the place of the old in two renames, so a page loaded during a build never meets a folder half
323
+ emptied or half written (a page that did stopped at its loading screen)."""
324
+ cwd = ROOT if root is None else Path(root)
325
+ old = cwd / ".app-old"
326
+ shutil.rmtree(old, ignore_errors=True)
327
+ if app.exists():
328
+ app.rename(old)
329
+ stage.rename(app)
330
+ shutil.rmtree(old, ignore_errors=True)
331
+
332
+
333
+ def main():
334
+ if sys.argv[1:] not in ([], ["--dev"]):
335
+ sys.exit("usage: build.py [--dev]")
336
+ out, app = ROOT / "index.html", ROOT / "app"
337
+ manifest = load_manifest(SRC / "manifest.yaml")
338
+ entries = manifest.get("entries") or ["src/main.js"]
339
+ main_entry = Path(entries[0]).name
340
+ worker_entries = tuple(Path(entry).name for entry in entries[1:])
341
+ css, page = join(manifest["styles"]), (SRC / "index.html").read_text()
342
+ stage = ROOT / STAGE # the build is written here, and swapped in for app/ when it is whole
343
+ shutil.rmtree(stage, ignore_errors=True)
344
+ meta = Path(tempfile.gettempdir()) / f"roamwright-meta-{os.getpid()}.json"
345
+ bundle = {
346
+ "entryPoints": entries,
347
+ "bundle": True,
348
+ "splitting": True,
349
+ "format": "esm",
350
+ "target": "es2022",
351
+ "logLevel": "warning",
352
+ "outdir": STAGE,
353
+ "entryNames": "[name]",
354
+ "chunkNames": "part-[hash]",
355
+ "minify": True,
356
+ "metafile": str(meta),
357
+ "lands": manifest.get("lands", []),
358
+ "values": manifest.get("values", []),
359
+ "split": manifest.get("split", []),
360
+ }
361
+ if not bundle_modules(bundle):
362
+ sys.exit("build failed: the modules could not be bundled (see the messages above)")
363
+ outputs = json.loads(meta.read_text())["outputs"]
364
+ meta.unlink()
365
+ write_parts(outputs, stage)
366
+ preload_parts(outputs, worker_entries=worker_entries, main_entry=main_entry)
367
+ for name, output in outputs.items():
368
+ for dependency in output["imports"]:
369
+ if dependency.get("external") and not dependency["path"].startswith("../vendor/"):
370
+ sys.exit(f"build failed: {name} imports an unbundled dependency: {dependency['path']}")
371
+ page = page.replace("<!--@build:markup-->\n", join(manifest.get("markup", [])))
372
+ iso, when = updated()
373
+ page = page.replace("@build:updated-iso", iso).replace("@build:updated", when)
374
+ css = esbuild(["--loader=css", "--minify"], css)
375
+ if css is None:
376
+ sys.exit("build failed: could not minify the style sheet")
377
+ browser_scripts = os.environ.get("BUILD_BROWSER_SCRIPTS", "scripts/browser-scripts.mjs")
378
+ page = subprocess.run(["node", browser_scripts], input=page, capture_output=True, text=True, cwd=ROOT, check=True).stdout
379
+ page = tighten(page)
380
+ (stage / "app.css").write_text(css)
381
+ swap_in(stage, app)
382
+ out.write_text(page)
383
+ first = [app / f for f in json.loads((app / "parts.json").read_text())[main_entry]] # what the page loads at start
384
+ engine = json.loads((app / "roamwright.json").read_text())
385
+ vendor = ROOT / "vendor"
386
+ scripts = [*first, vendor / "three/three.module.min.js", *(vendor / path for path in engine["preload"])]
387
+ raw = sum(f.stat().st_size for f in scripts)
388
+ packed = sum(len(gzip.compress(f.read_bytes(), 9)) for f in scripts)
389
+ later = len(list(app.glob("*.js"))) - len(first)
390
+ print(
391
+ f"index.html and app/ minified shared startup {len(scripts)} JS files ({len(first)} game), "
392
+ f"{raw / 1024:.0f} KiB ({packed / 1024:.0f} KiB gzipped), and {later} game parts fetched when needed"
393
+ f" from {len(list(SRC.rglob('*.js')))} modules, {len(manifest['styles'])} style sheets "
394
+ f"and {len(manifest.get('markup', []))} markup partials"
395
+ )
396
+
397
+
398
+ if __name__ == "__main__":
399
+ if sys.argv[1:] == ["--shader-sources"]:
400
+ sources = json.load(sys.stdin)
401
+ with ThreadPoolExecutor() as pool:
402
+ json.dump(dict(zip(sources, pool.map(minify_shader_literals, sources.values()), strict=True)), sys.stdout)
403
+ else:
404
+ main()
package/tools/README.md CHANGED
@@ -37,6 +37,17 @@ const { renewShaders, renewalFlags, saltFor } = require('roamwright/tools/shader
37
37
  | `scene-audit-beat.cjs` | Scene visibility audit pure helpers (`parseAuditArgs`, `beatTimes`, `stillName`, `flagsOfBeat`, `flagsOfScene`) and page-side cast projection, frustum submission, triangle delta, and readPixels delta probes (`beginBeatInPage`, `endBeatInPage`). |
38
38
  | `scene-audit-sheet.cjs` | Audit contact sheet renderer (`drawAuditSheetInPage`, `writeAuditSheets`), console row/summary formatters (`formatAuditRow`, `printAuditSummary`), and atomic `audit.json` writer (`saveAuditReport`). |
39
39
  | `scene-audit.cjs` | Full-catalog scene visibility audit runner (`runSceneAudit`): plays scenes across lands with automatic crash/hang recovery (`within`, `Stopped`, `TimedOut`) and writes per-land contact sheets and `audit.json`. |
40
+ | `scene-lint.cjs` | Offline scene-script physical plausibility and pacing linter (`lintScene`, `lintCatalog`, `formatLintReport`, `parseSceneLintArgs`): checks walking/riding speeds, slide moves, hand reach, strike run-ins, empty carries, actor overlaps, mid-scene hour shifts, camera distance/speed, caption reading rate, and late cues. |
41
+ | `motion-lab.cjs` | Synthetic figure-motion bench (`createStandardScenarios`, `parseMotionLabArgs`, `runMotionLab`): steps walks, runs, turns, bows, handovers, combat, and poses through the scene director at fixed frames and writes labelled contact sheets. |
42
+ | `viewport-check.cjs` | Live desktop, phone, and tablet viewport synchronization check (`runViewportCheck`): verifies WebGL drawing buffer, scene texture, camera aspect, canvas bounds, and HUD across DPR caps, quality presets, and tablet CSS width changes. |
43
+ | `set-cost.cjs` | Streamed lazy-set frame-hold audit (`runSetCost`, `parseSetCostArgs`, `formatSetCostReport`): raises declared sets in turn and fails any set that holds a frame over the budget. |
44
+ | `travel-free.cjs` | Lazy-scene travel check (`runTravelFree`): verifies approaching scene markers loads no scene scripts early, while walking onto a marker starts its scene on demand. |
45
+ | `service-worker-check.cjs` | Published-layout service-worker checks (`runServiceWorkerCheck`, `runServiceWorkerSetsCheck`): verifies SW takeover, cached repeat visits, offline reload, and lazy scene-set offline retention across published builds. |
46
+ | `build-freshness.cjs` | Published-layout update checks (`runFreshnessCheck`, `runRenewalCheck`): verifies newer `version.json` notifications in-world, title-screen reloads, and in-place renewal preserving visitor coordinates. |
47
+ | `bake-publish.cjs` | Published-layout IndexedDB terrain-bake persistence check (`runBakePublishCheck`, `resolveServeScript`): switches served build fixtures on one origin and asserts cached bakes survive unrelated publishes and rebuild on terrain changes. |
48
+ | `speed-guard.sh` | Generic desktop performance guard wrapper (`GUARD_*` config variables): holds all 3 turns on an idle remote Mac for fixed views, dispatches local moving flights (`m1`), or runs both (`shared`). |
49
+ | `look-guard.sh` | Generic photo-statistics look guard wrapper (`LOOK_*` config variables): runs a world's look-guard capture script and compares against its YAML baseline or a second build URL. |
50
+ | `phone-guard.py` | Generic iOS Simulator phone performance guard runner (`read_baseline`, `parse_standing_log`, `parse_flown_log`, `format_baseline`): measures standing and flown routes against a YAML baseline via the world's simulator wrapper. |
40
51
  | `remote-runner.sh` | Generic headless runner scheduling tools across a remote Mac (3 concurrent look turns, or all 3 held for a quiet measurement) and the local Mac (`RUNNER_*` config variables). |
41
52
  | `turns.sh`, `servers.sh` | Remote turn-lock helpers (`SWEEP`, `COUNT`) and per-slot Python HTTP server lifecycle manager (`use`, `done`, `clean`, `stop`, `sweep`) used by `remote-runner.sh` and world guards. |
42
53
  | `ios-sim.sh` | Drives Chromium in the iOS Simulator for a built world page, captures PNG stills, and reads the page's diagnostic log from WebKit localStorage SQLite (`SIM_*` config variables). |