# Inferway Studio — embedded editor dist (Studio L3b) Where the pinned ComfyUI frontend build lives, why it lives there, how to produce it, and what it costs. ## The decision **The dist is NOT in the repository.** It is fetched at build time from PyPI, sha256-verified before extraction, and written to `website/public/console/studio/editor/` — which is git-ignored. Three reasons: 1. **Size.** 970 files / ~91 MB (92,532,537 bytes) of third-party static assets does not belong in a git history, and it would be re-shipped in every clone, worktree and CI checkout. 2. **Provenance.** The wheel's sha256 is pinned in `scripts/studio-editor.lock.json` (version 1.51.10, upstream tag `v1.51.10`). Verification happens before a byte is extracted, so the dist on disk is either exactly the pinned wheel's `static/` tree or the build fails. A committed copy could silently drift. 3. **Licence handling.** The upstream component is GPL-3.0. It is shipped beside Inferway's own additions, with `LICENSE.txt` and `NOTICE.md` copied into the dist by the build — see `NOTICE.md` in this directory. **Placement.** `website/public/` is Next's static root, so the dist is served at `/console/studio/editor/**` — a prefix that only ever returns public static files (no dynamic handler, `Access-Control-Allow-Origin: *` without a credentials mode, one CSP carrying `sandbox allow-scripts`, requirement 1/2/4). The iframe `src` points at `index.html`: there is no directory index. The dist is not part of the Next route tree, so it does not enter the perf-budget gate. **Isolation** is the spike's S1hdr verdict: same origin, opaque origin in the document (response CSP `sandbox allow-scripts` + the same `sandbox` attribute on the iframe), everything interesting crossing a `postMessage` bridge. See `inferway-shim.js` for what the frame may and may not do. ## How to enable ```bash cd website INFERWAY_STUDIO_EDITOR_BUILD=1 bun run build # fetch + verify + inject + copy + verify bun run build # unchanged: the hook prints one line and exits 0 ``` The hook is `scripts/studio-editor-build.mjs`, wired as `prebuild` in `package.json`, so it runs before every `next build` (laptop, CI, Vercel). - **`INFERWAY_STUDIO_EDITOR_BUILD` unset (the default, and production today):** one line on stdout, exit 0, **no network access and no filesystem changes**. Nothing new is served under `/console/studio/editor/`. - **`INFERWAY_STUDIO_EDITOR_BUILD=1`:** runs `scripts/studio-editor-fetch.mjs` (wheel sha256 verified before extraction), injects the single `` line as the first element of `` (idempotent), copies `inferway-shim.js`, `inferway-bridge-protocol.js`, `LICENSE.txt` and `NOTICE.md`, then verifies the file count against the lock, that `index.html` still equals the upstream file once the injected line is stripped, and that **every file in the dist matches `static-files.sha256`** (one `sha256␠␠path` line per shipped file). Any failure exits non-zero and fails the build. Enabling it is a separate, later decision: it changes what is deployed, not how the site builds today. ## Licence and static file inventory - **Licence.** The upstream component is GPL-3.0: `LICENSE.comfyui-frontend-v1.51.10.txt` is the licence text of tag `v1.51.10` (35,149 bytes, sha256 `3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986`, also pinned as `license` in `scripts/studio-editor.lock.json`). The build copies it into the dist as `LICENSE.txt`, next to `NOTICE.md`, which states in English and 中文 what Inferway changed: one injected `