Efradeca commited on
Commit
2a770e2
·
verified ·
1 Parent(s): 09c3f4b

chore: deploy private lightloom build

Browse files
app.py CHANGED
@@ -144,7 +144,7 @@ def health() -> dict[str, Any]:
144
  "privacy_mode": os.getenv("LIGHTLOOM_PRIVACY_MODE", "1") == "1",
145
  "cpu_count": os.cpu_count(),
146
  "director_backend": CONFIG.director_backend,
147
- "build": "corridor-1",
148
  }
149
 
150
 
 
144
  "privacy_mode": os.getenv("LIGHTLOOM_PRIVACY_MODE", "1") == "1",
145
  "cpu_count": os.cpu_count(),
146
  "director_backend": CONFIG.director_backend,
147
+ "build": "corridor-2",
148
  }
149
 
150
 
frontend/css/immersive.css ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Lightloom · immersive.css — the full-bleed corridor shell.
2
+ The 3D world fills the screen; everything else floats over it as light chrome.
3
+ Uses tokens.css variables where present, with safe fallbacks. */
4
+
5
+ :root {
6
+ --ink: #f1ead9;
7
+ --ink-soft: rgba(241, 234, 217, 0.72);
8
+ --gold: #e7b75a;
9
+ --atmo: #07080c;
10
+ --glass: rgba(12, 13, 18, 0.46);
11
+ --glass-line: rgba(241, 234, 217, 0.16);
12
+ --font-display: "Fraunces", Georgia, "Times New Roman", serif;
13
+ --font-ui: "Inter", system-ui, -apple-system, sans-serif;
14
+ }
15
+
16
+ * { box-sizing: border-box; }
17
+ /* The HTML `hidden` attribute must win over our display:grid/flex rules below. */
18
+ [hidden] { display: none !important; }
19
+ html, body { height: 100%; margin: 0; background: var(--atmo); color: var(--ink); font-family: var(--font-ui); overflow: hidden; }
20
+
21
+ /* ---- the world ---- */
22
+ #world-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; }
23
+ #world-veil {
24
+ position: fixed; inset: 0; z-index: 1; pointer-events: none;
25
+ background:
26
+ radial-gradient(120% 90% at 50% 42%, transparent 52%, rgba(0, 0, 0, 0.55) 100%),
27
+ linear-gradient(to bottom, rgba(0, 0, 0, 0.28), transparent 22% 70%, rgba(0, 0, 0, 0.42));
28
+ }
29
+
30
+ /* ---- top HUD ---- */
31
+ .hud {
32
+ position: fixed; top: 0; left: 0; right: 0; z-index: 6;
33
+ display: flex; align-items: center; justify-content: space-between; gap: 16px;
34
+ padding: 14px clamp(16px, 3vw, 34px);
35
+ pointer-events: none;
36
+ }
37
+ .hud__brand { font-family: var(--font-ui); font-weight: 700; letter-spacing: 0.22em; font-size: 13px; color: var(--ink); opacity: 0.92; }
38
+ .hud__count { font-size: 12px; letter-spacing: 0.14em; color: var(--ink-soft); min-width: 64px; text-align: right; text-transform: uppercase; }
39
+ .orchestra { display: flex; gap: 8px; }
40
+ .orch {
41
+ display: inline-flex; align-items: center; gap: 7px;
42
+ font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
43
+ color: rgba(241, 234, 217, 0.4);
44
+ padding: 5px 11px; border-radius: 999px;
45
+ background: var(--glass); border: 1px solid transparent;
46
+ backdrop-filter: blur(7px); transition: color 0.3s, border-color 0.3s, background 0.3s;
47
+ }
48
+ .orch i { width: 6px; height: 6px; border-radius: 50%; background: rgba(241, 234, 217, 0.3); transition: background 0.3s, box-shadow 0.3s; }
49
+ .orch.is-active { color: var(--ink); border-color: var(--glass-line); }
50
+ .orch.is-active i { background: var(--gold); box-shadow: 0 0 10px var(--gold); animation: orchPulse 1.1s ease-in-out infinite; }
51
+ @keyframes orchPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
52
+
53
+ /* ---- intro ---- */
54
+ .intro {
55
+ position: fixed; inset: 0; z-index: 5;
56
+ display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
57
+ text-align: center; padding: 24px;
58
+ transition: opacity 0.7s ease, transform 0.7s ease; pointer-events: auto;
59
+ }
60
+ .intro.is-gone { opacity: 0; transform: scale(1.04); pointer-events: none; }
61
+ .intro__title {
62
+ font-family: var(--font-display); font-weight: 600; font-size: clamp(44px, 8vw, 104px);
63
+ letter-spacing: 0.01em; margin: 0; line-height: 1;
64
+ text-shadow: 0 2px 30px rgba(0, 0, 0, 0.6);
65
+ }
66
+ .intro__tag { font-family: var(--font-display); font-style: italic; font-size: clamp(16px, 2.4vw, 24px); color: var(--ink-soft); margin: 0; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8); }
67
+
68
+ /* the hero mic */
69
+ .mic {
70
+ position: relative; width: 128px; height: 128px; margin-top: 8px;
71
+ border-radius: 50%; border: 0; cursor: pointer;
72
+ background: radial-gradient(circle at 50% 40%, rgba(231, 183, 90, 0.22), rgba(12, 13, 18, 0.5));
73
+ display: grid; place-items: center; transition: transform 0.25s ease;
74
+ }
75
+ .mic:hover { transform: scale(1.06); }
76
+ .mic__dot { font-size: 44px; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6)); }
77
+ .mic__ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(231, 183, 90, 0.55); animation: micRing 2.6s ease-out infinite; }
78
+ .mic__ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(231, 183, 90, 0.35); animation: micRing 2.6s ease-out infinite 1.3s; }
79
+ @keyframes micRing { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }
80
+ .mic.is-recording { background: radial-gradient(circle at 50% 40%, rgba(224, 96, 86, 0.32), rgba(12, 13, 18, 0.55)); }
81
+ .mic.is-recording .mic__ring { border-color: rgba(224, 96, 86, 0.7); animation-duration: 1.1s; }
82
+ .mic__hint { font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; max-width: 30ch; }
83
+
84
+ .intro__alt { display: flex; gap: 20px; margin-top: 6px; }
85
+ .ghost { background: none; border: 0; color: var(--ink-soft); font-size: 13px; cursor: pointer; border-bottom: 1px dotted rgba(241, 234, 217, 0.35); padding: 2px 0; transition: color 0.2s; }
86
+ .ghost:hover { color: var(--ink); }
87
+
88
+ .composer { display: flex; flex-direction: column; gap: 10px; width: min(620px, 90vw); margin-top: 6px; }
89
+ .composer__text {
90
+ width: 100%; resize: vertical; border-radius: 14px; padding: 14px 16px;
91
+ background: var(--glass); border: 1px solid var(--glass-line); color: var(--ink);
92
+ font-family: var(--font-display); font-size: 16px; line-height: 1.5; backdrop-filter: blur(8px);
93
+ }
94
+ .composer__text:focus { outline: none; border-color: rgba(231, 183, 90, 0.5); }
95
+ .begin {
96
+ align-self: center; padding: 11px 26px; border-radius: 999px; cursor: pointer;
97
+ background: linear-gradient(180deg, var(--gold), #c8932f); color: #1a1206; border: 0;
98
+ font-weight: 600; letter-spacing: 0.03em; box-shadow: 0 6px 20px rgba(231, 183, 90, 0.25);
99
+ transition: transform 0.2s; font-size: 15px;
100
+ }
101
+ .begin:hover { transform: translateY(-1px); }
102
+
103
+ /* ---- floating transcript ---- */
104
+ .transcript {
105
+ position: fixed; left: 50%; bottom: 13%; transform: translateX(-50%) translateY(8px);
106
+ z-index: 5; max-width: min(70ch, 86vw); text-align: center; pointer-events: none;
107
+ font-family: var(--font-display); font-style: italic; font-size: clamp(17px, 2.3vw, 27px);
108
+ color: var(--ink); line-height: 1.35; opacity: 0;
109
+ text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 2px 16px rgba(0, 0, 0, 0.8);
110
+ transition: opacity 0.55s ease, transform 0.55s ease;
111
+ }
112
+ .transcript.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
113
+
114
+ /* ---- status line ---- */
115
+ .status {
116
+ position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
117
+ z-index: 6; font-size: 13px; color: var(--ink-soft); pointer-events: none;
118
+ background: var(--glass); padding: 7px 16px; border-radius: 999px; border: 1px solid var(--glass-line);
119
+ backdrop-filter: blur(7px); opacity: 0; transition: opacity 0.4s; white-space: nowrap;
120
+ }
121
+ .status.is-on { opacity: 1; }
122
+
123
+ /* ---- bottom controls ---- */
124
+ .controls { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 7; display: flex; gap: 10px; }
125
+ .ctl {
126
+ width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 17px;
127
+ background: var(--glass); border: 1px solid var(--glass-line); color: var(--ink);
128
+ display: grid; place-items: center; backdrop-filter: blur(8px); transition: transform 0.15s, border-color 0.2s, background 0.2s;
129
+ }
130
+ .ctl:hover { transform: translateY(-2px); border-color: rgba(231, 183, 90, 0.5); }
131
+ .ctl--lang { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
132
+ .ctl.is-active { border-color: var(--gold); color: var(--gold); }
133
+ .ctl.is-recording { background: radial-gradient(circle, rgba(224, 96, 86, 0.4), var(--glass)); border-color: rgba(224, 96, 86, 0.7); }
134
+
135
+ /* ---- showcase badge ---- */
136
+ .showcase-badge {
137
+ position: fixed; top: 54px; left: 50%; transform: translateX(-50%); z-index: 7;
138
+ font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--ink);
139
+ background: var(--glass); border: 1px solid var(--glass-line); border-radius: 999px;
140
+ padding: 6px 15px; backdrop-filter: blur(7px); pointer-events: none; white-space: nowrap;
141
+ }
142
+
143
+ /* ---- about overlay ---- */
144
+ .about { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; background: rgba(4, 5, 8, 0.7); backdrop-filter: blur(4px); padding: 24px; }
145
+ .about__panel { position: relative; max-width: 560px; background: rgba(14, 15, 20, 0.96); border: 1px solid var(--glass-line); border-radius: 18px; padding: 30px 32px; }
146
+ .about__panel h2 { font-family: var(--font-display); font-size: 30px; margin: 0 0 12px; }
147
+ .about__lead { font-size: 15px; line-height: 1.6; color: var(--ink-soft); margin: 0 0 14px; }
148
+ .about__lead b { color: var(--ink); font-weight: 600; }
149
+ .about__note { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); margin: 0; }
150
+ .about__close { position: absolute; top: 14px; right: 16px; background: none; border: 0; color: var(--ink-soft); font-size: 18px; cursor: pointer; }
151
+
152
+ body.reduced-motion .mic__ring, body.reduced-motion .orch.is-active i { animation: none; }
153
+ @media (max-width: 640px) {
154
+ .orchestra { display: none; }
155
+ .mic { width: 104px; height: 104px; }
156
+ .transcript { bottom: 16%; }
157
+ }
frontend/index.html CHANGED
@@ -1,495 +1,127 @@
1
- <!doctype html>
2
- <!--
3
- Lightloom — "La Sala"
4
- An intimate 1900s projection room, served framework-free by gradio.Server.
5
- No build step, no npm, no frameworks. Vanilla ES modules + WebGL2.
6
-
7
- Load order (contract): tokens.css, then stage.css, then ES module scripts in
8
- dependency order (api -> stage-gl -> slate -> subtitles -> hud -> stage), stage.js last.
9
- All UI strings carry data-es / data-en; #lang-toggle / #lang-pill swap them.
10
- Default language is English (en) — the hackathon is judged in English; ES is a toggle.
11
- -->
12
- <html lang="en" data-lang="en">
13
- <head>
14
- <meta charset="utf-8" />
15
- <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
16
- <meta name="color-scheme" content="dark" />
17
- <meta name="theme-color" content="#0A0A0C" />
18
- <title>Lightloom — La Sala</title>
19
- <meta
20
- name="description"
21
- content="Speak, and watch your story become film. Lightloom is a celluloid-era projection room inhabited by an artisan AI — five tiny local models shoot your movie as you narrate."
22
- />
23
-
24
- <!-- Design tokens first, then the projection-room look. Same-origin frontend assets. -->
25
- <link rel="stylesheet" href="/frontend/css/tokens.css" />
26
- <link rel="stylesheet" href="/frontend/css/stage.css" />
27
-
28
- <!--
29
- Three.js via ESM import map (no build step, no npm). stage3d.js does
30
- `import * as THREE from "three";` and resolves through this map. VENDORED
31
- LOCALLY (frontend/vendor/three.module.js, MIT) so the Space stays 100%
32
- self-contained at runtime (R3 / Off-the-Grid — no external CDN call). If the
33
- module fails to load, stage3d.js never runs and the WebGL2 renderer in
34
- stage-gl.js stays as the graceful fallback.
35
- -->
36
- <script type="importmap">
37
- {
38
- "imports": {
39
- "three": "/frontend/vendor/three.module.js"
40
- }
41
- }
42
- </script>
43
- </head>
44
-
45
- <body>
46
- <!--
47
- #app is the root. Each direct .screen child is a full-bleed projection-room
48
- "screen"; exactly one carries .is-active at a time (toggled from JS).
49
- Film grain + vignette are global overlays painted by CSS over everything.
50
- -->
51
- <div id="app" data-screen="lobby">
52
- <!-- ====================================================================
53
- S0 · LOBBY — the dim canvas + a volumetric amber projector beam (CSS)
54
- ===================================================================== -->
55
- <section id="lobby" class="screen is-active" aria-label="Lobby">
56
- <!-- Volumetric projector beam: pure CSS cone of amber light, diagonal. -->
57
- <div class="beam" aria-hidden="true">
58
- <span class="beam__cone"></span>
59
- <span class="beam__dust"></span>
60
- <span class="beam__lamp"></span>
61
- </div>
62
-
63
- <header class="lobby__top">
64
- <span class="brandmark" aria-hidden="true">
65
- <span class="brandmark__dot"></span>LIGHTLOOM
66
- </span>
67
- <!-- Language pill: cycles narration language (also drives copy swap). -->
68
- <button
69
- id="lang-pill"
70
- class="pill pill--lang"
71
- type="button"
72
- aria-label="Idioma / Language"
73
- title="El modelo de voz no autodetecta idioma."
74
- >
75
- <span class="pill__flag" aria-hidden="true">🌐</span>
76
- <span class="pill__lang" data-current-lang>EN</span>
77
- </button>
78
- </header>
79
-
80
- <div class="lobby__center">
81
- <h1 class="title">
82
- <span class="title__word">Light</span><span class="title__word title__word--amber">loom</span>
83
- </h1>
84
- <p class="tagline">
85
- <span data-es>Habla, y mira tu historia volverse cine.</span>
86
- <span data-en hidden>Speak, and watch your story become film.</span>
87
- </p>
88
-
89
- <!-- Two doors: Narrate-live & Recital. -->
90
- <div class="doors">
91
- <button id="btn-narrate" class="door" type="button">
92
- <span class="door__icon" aria-hidden="true">🎙️</span>
93
- <span class="door__title">
94
- <span data-es>Narrar en vivo</span>
95
- <span data-en hidden>Narrate live</span>
96
- </span>
97
- <span class="door__sub">
98
- <span data-es>Tu voz dirige el rodaje, beat a beat.</span>
99
- <span data-en hidden>Your voice directs the shoot, beat by beat.</span>
100
- </span>
101
- </button>
102
-
103
- <button id="btn-recital" class="door" type="button">
104
- <span class="door__icon" aria-hidden="true">📜</span>
105
- <span class="door__title">
106
- <span data-es>Modo recital</span>
107
- <span data-en hidden>Recital mode</span>
108
- </span>
109
- <span class="door__sub">
110
- <span data-es>Pega un poema y míralo proyectado.</span>
111
- <span data-en hidden>Paste a poem and watch it projected.</span>
112
- </span>
113
- </button>
114
- </div>
115
-
116
- <!-- Recital composer: revealed by #btn-recital, precharged with an
117
- original narration (copyright-clean) that drives clear cut/continuity. -->
118
- <div id="recital-pane" class="recital" hidden>
119
- <label class="recital__label" for="recital-text">
120
- <span data-es>Tu texto · dominio público</span>
121
- <span data-en hidden>Your text · original</span>
122
- </label>
123
- <textarea
124
- id="recital-text"
125
- class="recital__text"
126
- spellcheck="false"
127
- rows="6"
128
- aria-label="Recital text"
129
- >An old lighthouse keeper counted the waves at the edge of the world.
130
-
131
- Every night he climbed the spiral stairs, counting each step like a prayer.
132
-
133
- But far away, a market woke under orange awnings and warm morning light.
134
-
135
- Years later, the same road lay buried under snow and silence.</textarea>
136
- <p class="recital__cite">
137
- <span data-es>«El faro» · narración original de Lightloom</span>
138
- <span data-en hidden>"The Lighthouse" · original Lightloom narration</span>
139
- </p>
140
- <div class="recital__actions">
141
- <button id="btn-recital-go" class="pill pill--rec" type="button">
142
- <span class="pill__icon" aria-hidden="true">🎬</span>
143
- <span data-es>Rodar</span>
144
- <span data-en hidden>Roll</span>
145
- </button>
146
- </div>
147
- </div>
148
-
149
- <!-- Discreet showcase link. -->
150
- <button id="btn-showcase" class="ghostlink" type="button">
151
- 🎞️
152
- <span data-es>Ver películas de muestra</span>
153
- <span data-en hidden>Watch sample films</span>
154
- </button>
155
- </div>
156
-
157
- <!-- Transparency footer: live param ledger, must match /health. -->
158
- <footer class="lobby__foot">
159
- <span class="foot__ledger">
160
- <span data-es>7 modelos diminutos · </span><span data-en hidden>7 tiny models · </span>
161
- <strong id="ledger-total">10.73B</strong>&nbsp;/&nbsp;32B
162
- <span data-es> · 100% dentro de este Space</span>
163
- <span data-en hidden> · 100% inside this Space</span>
164
- </span>
165
- <span class="foot__links">
166
- <a href="/health" target="_blank" rel="noopener">/health</a>
167
- <span class="foot__sep">·</span>
168
- <button id="btn-about" class="linklike" type="button">
169
- <span data-es>Acerca de</span>
170
- <span data-en hidden>About</span>
171
- </button>
172
- </span>
173
- </footer>
174
- </section>
175
-
176
- <!-- ====================================================================
177
- S1 · EL SET — the live shoot. 2.39:1 letterbox, HUD in the black bars.
178
- ===================================================================== -->
179
- <section id="set" class="screen" aria-label="El Set">
180
- <!-- #stage is the letterbox wrapper; the WebGL canvas fills it. -->
181
- <div id="stage" class="stage" data-aspect="film">
182
- <canvas id="stage-canvas" class="stage__canvas"></canvas>
183
-
184
- <!-- Black-bar HUD (top): brand + scene/shot counter + GPU budget. -->
185
- <div class="hud hud--top">
186
- <span id="hud-title" class="hud__title">LIGHTLOOM</span>
187
- <span id="hud-counter" class="hud__counter" aria-live="polite">
188
- <span data-es>ESCENA 01 · PLANO 00</span>
189
- <span data-en hidden>SCENE 01 · SHOT 00</span>
190
- </span>
191
- </div>
192
-
193
- <!-- Black-bar HUD (bottom-left): discreet GPU budget ledger. -->
194
- <div id="hud-budget" class="hud hud--budget" aria-live="polite">
195
- <span class="hud__rec" aria-hidden="true"></span>
196
- <span class="hud__budget-label">🎬 GPU</span>
197
- <span class="hud__budget-val" data-budget>—</span>
198
- </div>
199
-
200
- <!-- Subtitles sit over the lower screen, AA-contrast. -->
201
- <div id="subtitles" class="subtitles" aria-live="polite" aria-atomic="true"></div>
202
-
203
- <!-- Micro-stage bar: the pipeline lighting up, never a spinner. -->
204
- <div id="stage-bar" class="stage-bar" role="status" aria-label="Etapa del pipeline">
205
- <span class="stage-bar__chip" data-stage="OYENDO">
206
- <span data-es>OYENDO</span><span data-en hidden>HEARING</span>
207
- </span>
208
- <span class="stage-bar__chip" data-stage="TRADUCIENDO">
209
- <span data-es>TRADUCIENDO</span><span data-en hidden>TRANSLATING</span>
210
- </span>
211
- <span class="stage-bar__chip" data-stage="DIRIGIENDO">
212
- <span data-es>DIRIGIENDO</span><span data-en hidden>DIRECTING</span>
213
- </span>
214
- <span class="stage-bar__chip" data-stage="PINTANDO">
215
- <span data-es>PINTANDO</span><span data-en hidden>PAINTING</span>
216
- </span>
217
- <span class="stage-bar__chip" data-stage="REVELANDO">
218
- <span data-es>REVELANDO</span><span data-en hidden>REVEALING</span>
219
- </span>
220
- </div>
221
- </div>
222
-
223
- <!-- THE SLATE IS THE HERO: a film clapperboard the judge reads in <5s.
224
- On mobile this becomes a bottom sheet (see stage.css). -->
225
- <aside id="slate" class="slate" aria-label="La claqueta del Director">
226
- <div class="slate__hinge" aria-hidden="true"></div>
227
- <div class="slate__sticks" aria-hidden="true">
228
- <span></span><span></span><span></span><span></span><span></span>
229
- </div>
230
-
231
- <header class="slate__head">
232
- <span class="slate__label">
233
- <span data-es>LA CLAQUETA</span><span data-en hidden>THE SLATE</span>
234
- </span>
235
- <span class="slate__shot" data-slate-shot>PLANO 00</span>
236
- </header>
237
-
238
- <!-- The decision chip: CUT (red) vs CONTINUITY (amber). Flips on change. -->
239
- <div class="slate__decision">
240
- <span class="decision-chip" data-decision="continuity" data-slate-decision>
241
- <span class="decision-chip__face decision-chip__face--front">
242
- <span data-es>CONTINUIDAD</span><span data-en hidden>CONTINUITY</span>
243
- </span>
244
- <span class="decision-chip__face decision-chip__face--back">
245
- <span data-es>CORTE</span><span data-en hidden>CUT</span>
246
- </span>
247
- </span>
248
- </div>
249
-
250
- <!-- Director read-out rows. -->
251
- <dl class="slate__grid">
252
- <div class="slate__row">
253
- <dt><span data-es>PLANO</span><span data-en hidden>SCALE</span></dt>
254
- <dd data-slate-scale>—</dd>
255
- </div>
256
- <div class="slate__row">
257
- <dt><span data-es>CÁMARA</span><span data-en hidden>CAMERA</span></dt>
258
- <dd data-slate-move>—</dd>
259
- </div>
260
- <div class="slate__row">
261
- <dt><span data-es>TRANSICIÓN</span><span data-en hidden>TRANSITION</span></dt>
262
- <dd data-slate-transition>—</dd>
263
- </div>
264
- <div class="slate__row slate__row--wide">
265
- <dt><span data-es>LUZ</span><span data-en hidden>LIGHT</span></dt>
266
- <dd data-slate-lighting>—</dd>
267
- </div>
268
- </dl>
269
-
270
- <!-- Three palette swatches from shot.palette. -->
271
- <div class="slate__palette" data-slate-palette aria-label="Paleta">
272
- <span class="swatch"></span><span class="swatch"></span><span class="swatch"></span>
273
- </div>
274
-
275
- <!-- Translated line (gray, small) — pipeline transparency for non-EN. -->
276
- <p class="slate__translation" data-slate-translation hidden></p>
277
- </aside>
278
-
279
- <!-- Bottom control rail (pills). -->
280
- <div class="controls">
281
- <button id="ctl-cut" class="pill pill--rec" type="button">
282
- <span class="pill__icon" aria-hidden="true">⏹</span>
283
- <span data-es>Cortar y ver la película</span>
284
- <span data-en hidden>Cut &amp; watch</span>
285
- </button>
286
- <button id="ctl-bed" class="pill" type="button" aria-pressed="true">
287
- <span class="pill__icon" aria-hidden="true">🔊</span>
288
- <span data-es>Banda sonora</span>
289
- <span data-en hidden>Soundbed</span>
290
- </button>
291
- <button id="ctl-reduce-motion" class="pill" type="button" aria-pressed="false">
292
- <span class="pill__icon" aria-hidden="true">♿</span>
293
- <span data-es>Reducir movimiento</span>
294
- <span data-en hidden>Reduce motion</span>
295
- </button>
296
- <button id="lang-toggle" class="pill pill--lang" type="button" aria-label="Idioma / Language">
297
- <span class="pill__flag" aria-hidden="true">🌐</span>
298
- <span class="pill__lang" data-current-lang>EN</span>
299
- </button>
300
- </div>
301
- </section>
302
-
303
- <!-- ====================================================================
304
- S2 · TEATRO — replay + export. Red curtain opens onto the film.
305
- ===================================================================== -->
306
- <section id="theater" class="screen" aria-label="Teatro">
307
- <div class="curtain" aria-hidden="true">
308
- <span class="curtain__half curtain__half--left"></span>
309
- <span class="curtain__half curtain__half--right"></span>
310
- </div>
311
-
312
- <div class="theater__inner">
313
- <div class="theater__screen">
314
- <div class="theater__placeholder" data-theater-placeholder>
315
- <span data-es>Tu película aparecerá aquí.</span>
316
- <span data-en hidden>Your film will appear here.</span>
317
- </div>
318
- </div>
319
-
320
- <div class="theater__transport">
321
- <button class="pill" type="button" data-theater="play">
322
- <span class="pill__icon" aria-hidden="true">▶</span>
323
- <span data-es>Reproducir</span><span data-en hidden>Play</span>
324
- </button>
325
- <button class="pill" type="button" data-theater="download">
326
- <span class="pill__icon" aria-hidden="true">⬇</span>
327
- <span data-es>Descargar película (MP4)</span><span data-en hidden>Download film (MP4)</span>
328
- </button>
329
- <button class="pill" type="button" data-theater="storyboard">
330
- <span class="pill__icon" aria-hidden="true">🖼</span>
331
- <span data-es>Storyboard</span><span data-en hidden>Storyboard</span>
332
- </button>
333
- <button class="pill" type="button" data-theater="again">
334
- <span class="pill__icon" aria-hidden="true">🔁</span>
335
- <span data-es>Rodar otra</span><span data-en hidden>Shoot another</span>
336
- </button>
337
- </div>
338
- <p class="theater__note">
339
- <span data-es>Export a 12 fps con fundidos si RIFE está cortado (honestidad).</span>
340
- <span data-en hidden>Exports at 12 fps with dissolves if RIFE is cut (honesty).</span>
341
- </p>
342
- </div>
343
- </section>
344
-
345
- <!-- ====================================================================
346
- S3 · SHOWCASE — pre-rendered films grid (each visibly stamped).
347
- ===================================================================== -->
348
- <section id="showcase" class="screen" aria-label="Showcase">
349
- <div id="showcase-banner" class="showcase__banner" hidden>
350
- <span data-es
351
- >La sala está llena ahora mismo (cuota de GPU del Space agotada). Mira funciones
352
- pasadas o vuelve en un rato — todo lo que ves aquí se generó con esta misma app.</span
353
- >
354
- <span data-en hidden
355
- >The theater is full right now (Space GPU quota spent). Watch past screenings or
356
- come back later — everything here was generated with this same app.</span
357
- >
358
- </div>
359
-
360
- <header class="showcase__head">
361
- <h2 class="screen__heading">
362
- <span data-es>Funciones de muestra</span><span data-en hidden>Sample screenings</span>
363
- </h2>
364
- <button class="ghostlink" type="button" data-go="lobby">
365
- ← <span data-es>Volver al lobby</span><span data-en hidden>Back to lobby</span>
366
- </button>
367
- </header>
368
-
369
- <div id="showcase-grid" class="showcase__grid" data-showcase-grid>
370
- <!-- Cards are injected by stage.js / showcase logic; we ship a graceful
371
- static fallback so the screen is never empty for a judge. -->
372
- <article class="film-card">
373
- <div class="film-card__thumb"></div>
374
- <span class="film-card__stamp">
375
- <span data-es>PRE-RENDERIZADA</span><span data-en hidden>PRE-RENDERED</span>
376
- </span>
377
- <h3 class="film-card__title">Rima XXI</h3>
378
- <p class="film-card__src">Bécquer · 1871 · <span data-es>dominio público</span
379
- ><span data-en hidden>public domain</span></p>
380
- </article>
381
- <article class="film-card">
382
- <div class="film-card__thumb"></div>
383
- <span class="film-card__stamp">
384
- <span data-es>PRE-RENDERIZADA</span><span data-en hidden>PRE-RENDERED</span>
385
- </span>
386
- <h3 class="film-card__title">Sonnet 18</h3>
387
- <p class="film-card__src">Shakespeare · 1609 · <span data-es>dominio público</span
388
- ><span data-en hidden>public domain</span></p>
389
- </article>
390
- <article class="film-card">
391
- <div class="film-card__thumb"></div>
392
- <span class="film-card__stamp">
393
- <span data-es>PRE-RENDERIZADA</span><span data-en hidden>PRE-RENDERED</span>
394
- </span>
395
- <h3 class="film-card__title">The Lighthouse</h3>
396
- <p class="film-card__src"><span data-es>recital golden</span
397
- ><span data-en hidden>golden recital</span></p>
398
- </article>
399
- </div>
400
- </section>
401
-
402
- <!-- ====================================================================
403
- S4 · ACERCA DE — overlay: the orchestra + honesty ledger.
404
- ===================================================================== -->
405
- <section id="about" class="screen screen--overlay" aria-label="Acerca de" role="dialog" aria-modal="true">
406
- <div class="about__panel">
407
- <header class="about__head">
408
- <h2 class="screen__heading">
409
- <span data-es>La orquesta</span><span data-en hidden>The orchestra</span>
410
- </h2>
411
- <button id="btn-about-close" class="pill pill--icon" type="button" aria-label="Cerrar">✕</button>
412
- </header>
413
-
414
- <p class="about__intro">
415
- <span data-es
416
- >Siete modelos diminutos tocando juntos, todos dentro de este Space. La suma de
417
- parámetros se reporta en vivo y debe coincidir con <a href="/health" target="_blank"
418
- rel="noopener">/health</a
419
- >.</span
420
- >
421
- <span data-en hidden
422
- >Seven tiny models playing together, all inside this Space. The parameter total is
423
- reported live and must match <a href="/health" target="_blank" rel="noopener"
424
- >/health</a
425
- >.</span
426
- >
427
- </p>
428
-
429
- <table class="about__table">
430
- <thead>
431
- <tr>
432
- <th><span data-es>Modelo</span><span data-en hidden>Model</span></th>
433
- <th><span data-es>Rol</span><span data-en hidden>Role</span></th>
434
- <th><span data-es>Params</span><span data-en hidden>Params</span></th>
435
- <th><span data-es>Licencia</span><span data-en hidden>License</span></th>
436
- </tr>
437
- </thead>
438
- <tbody data-orchestra-rows>
439
- <!-- Rows hydrated from /health by hud.js; honest static fallback below. -->
440
- <tr><td>Cohere Transcribe</td><td>🎙️ Listen (ASR)</td><td>2.0B</td><td>Apache-2.0</td></tr>
441
- <tr><td>MiniCPM5-1B</td><td>🎬 Director</td><td>1.0B</td><td>Apache-2.0</td></tr>
442
- <tr><td>FLUX.2 Klein</td><td>🖌️ Paint</td><td>4.0B</td><td>Apache-2.0</td></tr>
443
- <tr><td>Depth Anything V2</td><td>🗺️ Depth · 3D</td><td>0.03B</td><td>Apache-2.0</td></tr>
444
- <tr><td>Tiny Aya</td><td>🌐 Translate</td><td>3.35B</td><td>CC-BY-NC-4.0</td></tr>
445
- </tbody>
446
- <tfoot>
447
- <tr>
448
- <td colspan="2"><strong><span data-es>Suma runtime</span><span data-en hidden>Runtime total</span></strong></td>
449
- <td colspan="2"><strong id="about-total">10.73B / 32B</strong></td>
450
- </tr>
451
- </tfoot>
452
- </table>
453
-
454
- <p class="about__engine">
455
- <span data-es>Motor: </span><span data-en hidden>Engine: </span>
456
- <strong>gradio.Server + ZeroGPU</strong> ·
457
- <a href="/health" target="_blank" rel="noopener">/health</a>
458
- </p>
459
- </div>
460
- </section>
461
- </div>
462
-
463
- <!-- Soft-error toast (amber): "el plano se veló; seguimos". -->
464
- <div id="toast" class="toast" role="alert" aria-live="assertive" hidden></div>
465
-
466
- <!-- Global post-FX overlays painted by CSS over every screen. -->
467
- <div class="fx fx--grain" aria-hidden="true"></div>
468
- <div class="fx fx--vignette" aria-hidden="true"></div>
469
-
470
- <!--
471
- ES modules in dependency order (contract). stage.js wires everything and
472
- must load last. type="module" => deferred + strict by default. Each module
473
- attaches its surface to window.LL (api, stage, slate, subtitles, hud,
474
- controller). Same-origin /frontend paths.
475
- -->
476
- <script type="module" src="/frontend/js/api.js"></script>
477
- <!-- Voice input (LL.recorder): mic -> 16 kHz WAV -> Cohere Transcribe -> recital. -->
478
- <script type="module" src="/frontend/js/recorder.js"></script>
479
- <!--
480
- stage-gl.js (LL.stage): a WebGL2 beat renderer kept ONLY as a passive
481
- fallback — it never grabs #stage-canvas unless the controller calls
482
- LL.stage.init, which it no longer does (the immersive world owns the stage).
483
- The retired true-3D beat renderer (stage3d.js) is intentionally NOT loaded:
484
- it grabbed the canvas' WebGL context at import and would block LL.pano.
485
- -->
486
- <script type="module" src="/frontend/js/stage-gl.js"></script>
487
- <!-- The immersive PANORAMA world (LL.pano): an equirectangular sphere the camera
488
- lives inside — the "Voice Scroll in 3D" experience. It owns #stage-canvas. -->
489
- <script type="module" src="/frontend/js/stage-pano.js"></script>
490
- <script type="module" src="/frontend/js/slate.js"></script>
491
- <script type="module" src="/frontend/js/subtitles.js"></script>
492
- <script type="module" src="/frontend/js/hud.js"></script>
493
- <script type="module" src="/frontend/js/stage.js"></script>
494
- </body>
495
- </html>
 
1
+ <!doctype html>
2
+ <!--
3
+ Lightloom — "speak, and your world unrolls ahead of you."
4
+ A full-bleed immersive 3D corridor: each phrase you narrate becomes a vivid,
5
+ depth-displaced scene the camera flies forward through. Served framework-free by
6
+ gradio.Server. No build step, no npm. Vanilla ES modules + WebGL (Three.js).
7
+ English-default; ES is a toggle. The world IS the interface.
8
+ -->
9
+ <html lang="en" data-lang="en">
10
+ <head>
11
+ <meta charset="utf-8" />
12
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
13
+ <meta name="color-scheme" content="dark" />
14
+ <meta name="theme-color" content="#07080c" />
15
+ <title>Lightloom — speak your world into being</title>
16
+ <meta
17
+ name="description"
18
+ content="Speak, and your world unrolls ahead of you. Lightloom turns your voice into an endless, explorable 3D world — tiny local models listen, direct, paint and give depth to every scene in real time."
19
+ />
20
+ <link rel="stylesheet" href="/frontend/css/tokens.css" />
21
+ <link rel="stylesheet" href="/frontend/css/immersive.css" />
22
+ <script type="importmap">
23
+ { "imports": { "three": "/frontend/vendor/three.module.js" } }
24
+ </script>
25
+ </head>
26
+
27
+ <body>
28
+ <!-- The world: a full-bleed 3D corridor that is always behind everything. -->
29
+ <canvas id="world-canvas" aria-hidden="true"></canvas>
30
+ <div id="world-veil" aria-hidden="true"></div>
31
+
32
+ <!-- Top HUD: brand + the live orchestra (which tiny model is working now) + counter. -->
33
+ <header id="hud" class="hud">
34
+ <span class="hud__brand">LIGHTLOOM</span>
35
+ <nav class="orchestra" aria-label="Model orchestra">
36
+ <span class="orch" id="orch-asr"><i></i>Voice</span>
37
+ <span class="orch" id="orch-director"><i></i>Director</span>
38
+ <span class="orch" id="orch-painter"><i></i>Painter</span>
39
+ <span class="orch" id="orch-depth"><i></i>Depth</span>
40
+ </nav>
41
+ <span class="hud__count" id="scene-count" aria-live="polite"></span>
42
+ </header>
43
+
44
+ <!-- Intro: the world is already drifting behind this; a pulsing mic is the hero. -->
45
+ <section id="intro" class="intro">
46
+ <h1 class="intro__title">Lightloom</h1>
47
+ <p class="intro__tag">
48
+ <span data-en>Speak, and your world unrolls ahead of you.</span>
49
+ <span data-es hidden>Habla, y tu mundo se desenrolla ante ti.</span>
50
+ </p>
51
+
52
+ <button id="mic-btn" class="mic" type="button" aria-label="Hold the mic and speak your story">
53
+ <span class="mic__ring"></span>
54
+ <span class="mic__dot">🎙</span>
55
+ </button>
56
+ <p class="mic__hint" id="mic-hint">
57
+ <span data-en>Tap, speak your story, tap again — and watch it become a world.</span>
58
+ <span data-es hidden>Toca, cuenta tu historia, toca de nuevo — y mírala volverse mundo.</span>
59
+ </p>
60
+
61
+ <div class="intro__alt">
62
+ <button id="type-toggle" class="ghost" type="button">
63
+ <span data-en>or type a story</span><span data-es hidden>o escribe una historia</span>
64
+ </button>
65
+ <button id="showcase-btn" class="ghost" type="button">
66
+ <span data-en>watch the showcase</span><span data-es hidden>ver el showcase</span>
67
+ </button>
68
+ </div>
69
+
70
+ <div id="composer" class="composer" hidden>
71
+ <textarea
72
+ id="story-text"
73
+ class="composer__text"
74
+ rows="3"
75
+ spellcheck="false"
76
+ placeholder="An old lighthouse keeper counted the waves at the edge of the world. Far away, a market woke under orange awnings. A child ran through a garden of impossible glowing flowers."
77
+ >An old lighthouse keeper counted the waves at the edge of the world. Far away, a market woke under orange awnings and warm morning light. A child ran through a garden of impossible glowing flowers. Then snow buried the quiet road in silence.</textarea>
78
+ <button id="begin-btn" class="begin" type="button">
79
+ <span data-en>Begin the world</span><span data-es hidden>Comenzar el mundo</span>
80
+ </button>
81
+ </div>
82
+ </section>
83
+
84
+ <!-- Floating transcript: the words that are becoming the world. -->
85
+ <div id="transcript" class="transcript" aria-live="polite"></div>
86
+
87
+ <!-- Status line (warming / listening / quota), unobtrusive. -->
88
+ <div id="status" class="status" role="status" aria-live="polite"></div>
89
+
90
+ <!-- Bottom controls (appear once a world is live). -->
91
+ <div id="controls" class="controls" hidden>
92
+ <button id="mic-mini" class="ctl" type="button" title="Speak more" aria-label="Speak more">🎙</button>
93
+ <button id="stop-btn" class="ctl" type="button" title="New world" aria-label="New world">⟲</button>
94
+ <button id="rm-btn" class="ctl" type="button" title="Reduce motion" aria-label="Reduce motion">♿</button>
95
+ <button id="lang-btn" class="ctl ctl--lang" type="button" title="Language">EN</button>
96
+ <button id="about-btn" class="ctl" type="button" title="About" aria-label="About">ⓘ</button>
97
+ </div>
98
+
99
+ <!-- About overlay: the orchestra + honest ledger. -->
100
+ <section id="about" class="about" hidden role="dialog" aria-modal="true" aria-label="About Lightloom">
101
+ <div class="about__panel">
102
+ <button id="about-close" class="about__close" type="button" aria-label="Close">✕</button>
103
+ <h2>Lightloom</h2>
104
+ <p class="about__lead" data-en>
105
+ You speak; tiny <b>local</b> models turn your words into an endless, explorable 3D world.
106
+ Cohere <b>Transcribe</b> hears you, an OpenBMB <b>MiniCPM</b> director shapes each scene,
107
+ <b>FLUX.2 klein</b> paints it, <b>Depth-Anything</b> gives it real relief — and the camera
108
+ flies forward through the world you are speaking into being. Zero cloud APIs.
109
+ </p>
110
+ <p class="about__lead" data-es hidden>
111
+ Tú hablas; modelos <b>locales</b> diminutos convierten tus palabras en un mundo 3D infinito y
112
+ explorable. Cohere <b>Transcribe</b> te escucha, un director <b>MiniCPM</b> de OpenBMB moldea
113
+ cada escena, <b>FLUX.2 klein</b> la pinta, <b>Depth-Anything</b> le da relieve real — y la
114
+ cámara vuela por el mundo que hablas. Cero APIs en la nube.
115
+ </p>
116
+ <p class="about__note" id="about-ledger">— / 32B parameters · all local · Off the Grid</p>
117
+ </div>
118
+ </section>
119
+
120
+ <!-- ES modules in dependency order. The corridor controller wires everything. -->
121
+ <script type="module" src="/frontend/js/api.js"></script>
122
+ <script type="module" src="/frontend/js/recorder.js"></script>
123
+ <script type="module" src="/frontend/js/stage-corridor.js"></script>
124
+ <script type="module" src="/frontend/js/subtitles.js"></script>
125
+ <script type="module" src="/frontend/js/controller.js"></script>
126
+ </body>
127
+ </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/js/api.js CHANGED
@@ -73,6 +73,21 @@ const api = {
73
  return this._streamEndpoint("/panorama", text, lang, onEvent);
74
  },
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  /**
77
  * Transcribe a base64 WAV (the narrator's mic audio) via Cohere Transcribe.
78
  * Resolves with {text, error}. Used by LL.recorder; the transcript then drives
 
73
  return this._streamEndpoint("/panorama", text, lang, onEvent);
74
  },
75
 
76
+ /**
77
+ * Submit a narration and stream the INFINITE 3D CORRIDOR — one vivid forward
78
+ * scene per phrase ("warming"->per scene: "directing"->"painting"->"scene"->
79
+ * "depth"-> ... ->"done"). Each scene streams in as it is painted so the world
80
+ * grows ahead of the camera. Drives LL.corridor in the controller.
81
+ *
82
+ * @param {string} text the spoken/typed story
83
+ * @param {string} lang ISO code ("en"/"es"); default "en"
84
+ * @param {(event:object)=>void} onEvent called once per SSE stage event
85
+ * @returns {Promise<{session:?string, done:boolean, cancelled:boolean}>}
86
+ */
87
+ async streamWorld(text, lang = "en", onEvent) {
88
+ return this._streamEndpoint("/world", text, lang, onEvent);
89
+ },
90
+
91
  /**
92
  * Transcribe a base64 WAV (the narrator's mic audio) via Cohere Transcribe.
93
  * Resolves with {text, error}. Used by LL.recorder; the transcript then drives
frontend/js/controller.js ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // frontend/js/controller.js — Lightloom · the CORRIDOR controller (LL.controller)
2
+ //
3
+ // The world IS the interface. Voice (or typed text) -> LL.api.streamWorld -> each
4
+ // vivid scene streams into LL.corridor as it is painted, and the camera flies
5
+ // forward through the world growing ahead of you. A discreet HUD lights up the
6
+ // tiny model working right now (Voice / Director / Painter / Depth).
7
+ //
8
+ // Vanilla ES module. Reuses LL.api, LL.recorder, LL.corridor.
9
+
10
+ import "./api.js";
11
+ import "./recorder.js";
12
+ import "./stage-corridor.js";
13
+
14
+ const LL = (window.LL = window.LL || {});
15
+
16
+ const COPY = {
17
+ warming: { en: "Warming the projector — the first scene takes a few seconds…", es: "Encendiendo el proyector — la primera escena tarda unos segundos…" },
18
+ listening: { en: "Listening… speak your story, tap the mic to finish.", es: "Te escucho… cuenta tu historia, toca el micro para terminar." },
19
+ transcribing: { en: "Hearing your words…", es: "Escuchando tus palabras…" },
20
+ micDenied: { en: "No mic — type your story instead.", es: "Sin micrófono — escribe tu historia." },
21
+ noSpeech: { en: "I didn't catch that. Try again, or type it.", es: "No te escuché. Inténtalo de nuevo, o escríbelo." },
22
+ empty: { en: "Say or type a story first.", es: "Di o escribe una historia primero." },
23
+ quota: { en: "The world ran out of GPU for today — watch the showcase.", es: "Se acabó la GPU de hoy — mira el showcase." },
24
+ building: { en: "Painting your world…", es: "Pintando tu mundo…" },
25
+ };
26
+ const t = (p, l) => (p && p[l]) || (p && p.en) || "";
27
+
28
+ const controller = {
29
+ lang: "en",
30
+ reducedMotion: false,
31
+ running: false,
32
+ _scenes: new Map(), // index -> { image, depth, caption }
33
+ _count: 0,
34
+ _statusTimer: null,
35
+
36
+ init() {
37
+ this._restore();
38
+ const canvas = document.getElementById("world-canvas");
39
+ if (canvas && LL.corridor) {
40
+ try { LL.corridor.init(canvas); } catch (e) { console.error("corridor init", e); }
41
+ // the caption tracks whichever scene the camera is actually looking at
42
+ LL.corridor.onFocus = (meta) => this._transcript(meta && meta.caption);
43
+ }
44
+ this._initRecorder();
45
+ this._wire();
46
+ this._applyLang(this.lang);
47
+ return this;
48
+ },
49
+
50
+ _wire() {
51
+ on("mic-btn", "click", () => this._mic());
52
+ on("mic-mini", "click", () => this._mic());
53
+ on("type-toggle", "click", () => this._toggleComposer());
54
+ on("begin-btn", "click", () => {
55
+ const ta = document.getElementById("story-text");
56
+ this.startWorld(ta ? ta.value : "");
57
+ });
58
+ on("showcase-btn", "click", () => this.playShowcase());
59
+ on("stop-btn", "click", () => this.reset());
60
+ on("rm-btn", "click", () => this.setReducedMotion(!this.reducedMotion));
61
+ on("lang-btn", "click", () => this.setLang(this.lang === "en" ? "es" : "en"));
62
+ on("about-btn", "click", () => this._about(true));
63
+ on("about-close", "click", () => this._about(false));
64
+ const mq = window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)");
65
+ if (mq && mq.matches) this.setReducedMotion(true, true);
66
+ },
67
+
68
+ _initRecorder() {
69
+ if (!LL.recorder || typeof LL.recorder.init !== "function") return;
70
+ LL.recorder.init({
71
+ getLang: () => this.lang,
72
+ onState: (s) => {
73
+ this._orch("asr", s === "recording" || s === "transcribing");
74
+ const mic = document.getElementById("mic-btn");
75
+ const mini = document.getElementById("mic-mini");
76
+ if (mic) mic.classList.toggle("is-recording", s === "recording");
77
+ if (mini) mini.classList.toggle("is-recording", s === "recording");
78
+ if (s === "recording") this._status(t(COPY.listening, this.lang), 0);
79
+ else if (s === "transcribing") this._status(t(COPY.transcribing, this.lang), 0);
80
+ else this._status("");
81
+ },
82
+ onTranscript: (text, error) => {
83
+ const clean = (text || "").trim();
84
+ if (clean) this.startWorld(clean);
85
+ else {
86
+ const denied = error === "mic_denied" || error === "unsupported";
87
+ this._status(t(denied ? COPY.micDenied : COPY.noSpeech, this.lang), 3600);
88
+ if (denied) this._toggleComposer(true);
89
+ }
90
+ },
91
+ });
92
+ },
93
+
94
+ _mic() {
95
+ if (LL.recorder && LL.recorder.supported && typeof LL.recorder.toggle === "function") {
96
+ LL.recorder.toggle();
97
+ } else {
98
+ this._toggleComposer(true);
99
+ this._status(t(COPY.micDenied, this.lang), 3000);
100
+ }
101
+ },
102
+
103
+ _toggleComposer(force) {
104
+ const c = document.getElementById("composer");
105
+ if (!c) return;
106
+ const show = force === true ? true : c.hidden;
107
+ c.hidden = !show;
108
+ if (show) { const ta = document.getElementById("story-text"); if (ta) ta.focus(); }
109
+ },
110
+
111
+ // ---- the experience: stream a world ----
112
+ async startWorld(text) {
113
+ if (this.running) return;
114
+ const story = (text || "").trim();
115
+ if (!story) { this._status(t(COPY.empty, this.lang), 3000); this._toggleComposer(true); return; }
116
+ if (LL.recorder && LL.recorder.cancel) LL.recorder.cancel();
117
+
118
+ this.running = true;
119
+ this._scenes.clear();
120
+ this._count = 0;
121
+ if (LL.corridor && LL.corridor.reset) LL.corridor.reset();
122
+ this._enterWorld();
123
+ this._status(t(COPY.warming, this.lang), 0);
124
+
125
+ try {
126
+ await LL.api.streamWorld(story, this.lang, (ev) => this._onEvent(ev));
127
+ } catch (err) {
128
+ console.error("[controller] streamWorld threw", err);
129
+ } finally {
130
+ this.running = false;
131
+ this._orchAllOff();
132
+ this._status("");
133
+ }
134
+ },
135
+
136
+ _onEvent(ev) {
137
+ if (!ev || typeof ev !== "object") return;
138
+ switch (ev.stage) {
139
+ case "warming":
140
+ this._status(t(COPY.warming, this.lang), 0);
141
+ break;
142
+ case "directing":
143
+ this._orch("director", true);
144
+ this._status(t(COPY.building, this.lang), 0);
145
+ break;
146
+ case "painting":
147
+ this._orch("painter", true);
148
+ break;
149
+ case "scene":
150
+ this._stash(ev.index, { image: absUrl(ev.image), caption: ev.caption });
151
+ this._tryAdd(ev.index);
152
+ this._count = Math.max(this._count, (ev.index || 0) + 1);
153
+ this._setCount();
154
+ break;
155
+ case "depth":
156
+ this._orch("depth", true);
157
+ this._stash(ev.index, { depth: absUrl(ev.depth) });
158
+ this._tryAdd(ev.index);
159
+ break;
160
+ case "scene_error":
161
+ this._tryAdd(ev.index, true); // add with whatever we have
162
+ break;
163
+ case "done":
164
+ this._orchAllOff();
165
+ this._status("");
166
+ break;
167
+ case "quota_exceeded":
168
+ this._status(t(COPY.quota, this.lang), 6000);
169
+ break;
170
+ case "error":
171
+ this._status((ev.error || "error").slice(0, 80), 5000);
172
+ break;
173
+ }
174
+ },
175
+
176
+ _stash(i, patch) {
177
+ if (typeof i !== "number") return;
178
+ this._scenes.set(i, Object.assign(this._scenes.get(i) || {}, patch));
179
+ },
180
+
181
+ _tryAdd(i, force) {
182
+ const s = this._scenes.get(i);
183
+ if (!s || s._added || !s.image) return;
184
+ if (!s.depth && !force) return; // brief wait for depth (it arrives ~instantly)
185
+ s._added = true;
186
+ if (LL.corridor && typeof LL.corridor.addScene === "function") {
187
+ LL.corridor.addScene({ imageUrl: s.image, depthUrl: s.depth || null, meta: { caption: s.caption } });
188
+ }
189
+ },
190
+
191
+ // ---- showcase (pre-rendered corridor journey, GPU-free) ----
192
+ async playShowcase() {
193
+ if (this.running) return;
194
+ let manifest = [];
195
+ try {
196
+ const r = await fetch("/frontend/assets/corridor/manifest.json", { cache: "no-store" });
197
+ if (r.ok) manifest = (await r.json()).filter((m) => m && m.image);
198
+ } catch (_) {}
199
+ if (!manifest.length) { this.startWorld(document.getElementById("story-text")?.value || ""); return; }
200
+ this.running = true;
201
+ if (LL.corridor && LL.corridor.reset) LL.corridor.reset();
202
+ this._enterWorld();
203
+ this._badge(this.lang === "es" ? "✦ SHOWCASE · pre-renderizado con esta app" : "✦ SHOWCASE · pre-rendered with this app");
204
+ this._showcaseStop = false;
205
+ try {
206
+ while (!this._showcaseStop) {
207
+ for (const m of manifest) {
208
+ if (this._showcaseStop) break;
209
+ if (LL.corridor) LL.corridor.addScene({ imageUrl: absUrl(m.image), depthUrl: m.depth ? absUrl(m.depth) : null, meta: { caption: m.caption } });
210
+ this._count++; this._setCount();
211
+ await sleep(this.reducedMotion ? 3200 : 5200);
212
+ }
213
+ if (this.reducedMotion) break;
214
+ }
215
+ } finally { this.running = false; }
216
+ },
217
+
218
+ // ---- screen / chrome ----
219
+ _enterWorld() {
220
+ const intro = document.getElementById("intro");
221
+ if (intro) intro.classList.add("is-gone");
222
+ const ctl = document.getElementById("controls");
223
+ if (ctl) ctl.hidden = false;
224
+ document.body.classList.add("in-world");
225
+ },
226
+
227
+ reset() {
228
+ this._showcaseStop = true;
229
+ if (LL.api && LL.api.cancel) LL.api.cancel();
230
+ if (LL.recorder && LL.recorder.cancel) LL.recorder.cancel();
231
+ this.running = false;
232
+ this._badge("");
233
+ this._orchAllOff();
234
+ this._setCount(true);
235
+ this._transcript("");
236
+ if (LL.corridor && LL.corridor.reset) LL.corridor.reset();
237
+ const intro = document.getElementById("intro");
238
+ if (intro) intro.classList.remove("is-gone");
239
+ const ctl = document.getElementById("controls");
240
+ if (ctl) ctl.hidden = true;
241
+ document.body.classList.remove("in-world");
242
+ },
243
+
244
+ _orch(name, on) {
245
+ const el = document.getElementById("orch-" + name);
246
+ if (el) el.classList.toggle("is-active", !!on);
247
+ // only one painter/depth/director lit at a time for a clean read
248
+ if (on) for (const k of ["asr", "director", "painter", "depth"]) {
249
+ if (k !== name) { const o = document.getElementById("orch-" + k); if (o) o.classList.remove("is-active"); }
250
+ }
251
+ },
252
+ _orchAllOff() { for (const k of ["asr", "director", "painter", "depth"]) this._orch(k, false); },
253
+
254
+ _setCount(clear) {
255
+ const el = document.getElementById("scene-count");
256
+ if (!el) return;
257
+ el.textContent = clear || !this._count ? "" : (this.lang === "es" ? "escena " : "scene ") + this._count;
258
+ },
259
+
260
+ _transcript(text) {
261
+ const el = document.getElementById("transcript");
262
+ if (!el) return;
263
+ const s = (text == null ? "" : String(text)).trim();
264
+ if (!s) { el.classList.remove("is-on"); return; }
265
+ el.textContent = s;
266
+ el.classList.remove("is-on"); void el.offsetWidth; el.classList.add("is-on");
267
+ },
268
+
269
+ _status(text, ms = 3000) {
270
+ const el = document.getElementById("status");
271
+ if (!el) return;
272
+ if (this._statusTimer) { clearTimeout(this._statusTimer); this._statusTimer = null; }
273
+ const s = (text || "").trim();
274
+ el.textContent = s;
275
+ el.classList.toggle("is-on", !!s);
276
+ if (s && ms > 0) this._statusTimer = setTimeout(() => el.classList.remove("is-on"), ms);
277
+ },
278
+
279
+ _badge(text) {
280
+ let el = document.getElementById("ll-badge");
281
+ if (!text) { if (el) el.hidden = true; return; }
282
+ if (!el) {
283
+ el = document.createElement("div"); el.id = "ll-badge"; el.className = "showcase-badge";
284
+ document.body.appendChild(el);
285
+ }
286
+ el.textContent = text; el.hidden = false;
287
+ },
288
+
289
+ _about(show) {
290
+ const el = document.getElementById("about");
291
+ if (el) el.hidden = !show;
292
+ },
293
+
294
+ setReducedMotion(on, fromOS) {
295
+ this.reducedMotion = !!on;
296
+ document.body.classList.toggle("reduced-motion", this.reducedMotion);
297
+ const b = document.getElementById("rm-btn");
298
+ if (b) b.classList.toggle("is-active", this.reducedMotion);
299
+ if (LL.corridor && LL.corridor.setReducedMotion) LL.corridor.setReducedMotion(this.reducedMotion);
300
+ if (!fromOS) try { localStorage.setItem("ll.rm", this.reducedMotion ? "1" : "0"); } catch (_) {}
301
+ },
302
+
303
+ setLang(lang) {
304
+ this.lang = lang === "es" ? "es" : "en";
305
+ try { localStorage.setItem("ll.lang", this.lang); } catch (_) {}
306
+ this._applyLang(this.lang);
307
+ },
308
+
309
+ _applyLang(lang) {
310
+ document.documentElement.setAttribute("lang", lang);
311
+ document.querySelectorAll("[data-en],[data-es]").forEach((n) => {
312
+ if (n.hasAttribute("data-en") && !n.hasAttribute("data-es")) n.hidden = lang !== "en";
313
+ else if (n.hasAttribute("data-es") && !n.hasAttribute("data-en")) n.hidden = lang !== "es";
314
+ });
315
+ const lb = document.getElementById("lang-btn");
316
+ if (lb) lb.textContent = lang.toUpperCase();
317
+ this._setCount();
318
+ },
319
+
320
+ _restore() {
321
+ try {
322
+ const l = localStorage.getItem("ll.lang");
323
+ this.lang = l === "es" ? "es" : (l === "en" ? "en" : ((navigator.language || "en").toLowerCase().startsWith("es") ? "es" : "en"));
324
+ } catch (_) { this.lang = "en"; }
325
+ try { if (localStorage.getItem("ll.rm") === "1") this.reducedMotion = true; } catch (_) {}
326
+ },
327
+ };
328
+
329
+ function on(id, evt, fn) { const el = document.getElementById(id); if (el) el.addEventListener(evt, fn); }
330
+ function sleep(ms) { return new Promise((r) => setTimeout(r, ms)); }
331
+ function absUrl(u) { if (!u) return u; try { return new URL(u, window.location.origin).href; } catch (_) { return u; } }
332
+
333
+ LL.controller = controller;
334
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", () => controller.init(), { once: true });
335
+ else controller.init();
336
+
337
+ export default controller;
frontend/js/stage-corridor.js CHANGED
@@ -23,7 +23,8 @@ window.LL = window.LL || {};
23
  const Corridor = (() => {
24
  let renderer = null, scene = null, camera = null, canvas = null;
25
  let raf = 0, t0 = 0, lastT = 0, ok = false, reduced = false;
26
- const panels = []; // { mesh, z, born } in arrival order
 
27
  let frontZ = 0; // z of the most recently added panel (grows negative)
28
  let camZ = 0, targetZ = 0; // camera travel along -Z
29
  const loader = new THREE.TextureLoader();
@@ -134,7 +135,10 @@ const Corridor = (() => {
134
  (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches);
135
  }
136
 
137
- async function addScene({ imageUrl, depthUrl } = {}) {
 
 
 
138
  if (!ok) return null;
139
  const [tex, depthTex] = await Promise.all([loadTex(imageUrl), loadTex(depthUrl)]);
140
  if (!tex) return null;
@@ -156,15 +160,15 @@ const Corridor = (() => {
156
  mesh.position.z = frontZ;
157
  mesh.renderOrder = -frontZ; // draw far panels first (painter's order for blending)
158
  scene.add(mesh);
159
- panels.push({ mesh, z: frontZ, born: performance.now() });
160
  targetZ = frontZ + APPROACH; // travel to just in front of the newest scene
161
- return { index: panels.length - 1 };
162
  }
163
 
164
  function reset() {
165
  for (const p of panels) { scene.remove(p.mesh); p.mesh.material.dispose(); }
166
  panels.length = 0;
167
- frontZ = 0; camZ = 0; targetZ = 0;
168
  if (camera) camera.position.set(0, 0, 0);
169
  }
170
 
@@ -205,6 +209,17 @@ const Corridor = (() => {
205
  scene.remove(p.mesh); p.mesh.material.dispose(); panels.splice(i, 1);
206
  }
207
  }
 
 
 
 
 
 
 
 
 
 
 
208
  renderer.render(scene, camera);
209
  }
210
 
@@ -228,6 +243,7 @@ const Corridor = (() => {
228
 
229
  return {
230
  init, addScene, reset, dispose, setReducedMotion,
 
231
  get ready() { return ok; },
232
  get count() { return panels.length; },
233
  };
 
23
  const Corridor = (() => {
24
  let renderer = null, scene = null, camera = null, canvas = null;
25
  let raf = 0, t0 = 0, lastT = 0, ok = false, reduced = false;
26
+ const panels = []; // { mesh, z, born, id, meta } in arrival order
27
+ let sceneSeq = 0; // stable id per scene (panels are recycled, so indices shift)
28
  let frontZ = 0; // z of the most recently added panel (grows negative)
29
  let camZ = 0, targetZ = 0; // camera travel along -Z
30
  const loader = new THREE.TextureLoader();
 
135
  (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches);
136
  }
137
 
138
+ let onFocus = null; // (meta, index) => void — fires when a scene flies into focus
139
+ let focusKey = -1;
140
+
141
+ async function addScene({ imageUrl, depthUrl, meta } = {}) {
142
  if (!ok) return null;
143
  const [tex, depthTex] = await Promise.all([loadTex(imageUrl), loadTex(depthUrl)]);
144
  if (!tex) return null;
 
160
  mesh.position.z = frontZ;
161
  mesh.renderOrder = -frontZ; // draw far panels first (painter's order for blending)
162
  scene.add(mesh);
163
+ panels.push({ mesh, z: frontZ, born: performance.now(), id: ++sceneSeq, meta: meta || null });
164
  targetZ = frontZ + APPROACH; // travel to just in front of the newest scene
165
+ return { id: sceneSeq };
166
  }
167
 
168
  function reset() {
169
  for (const p of panels) { scene.remove(p.mesh); p.mesh.material.dispose(); }
170
  panels.length = 0;
171
+ frontZ = 0; camZ = 0; targetZ = 0; focusKey = -1;
172
  if (camera) camera.position.set(0, 0, 0);
173
  }
174
 
 
209
  scene.remove(p.mesh); p.mesh.material.dispose(); panels.splice(i, 1);
210
  }
211
  }
212
+ // Focus = the most-visible scene; notify when it changes so the caption tracks
213
+ // the scene the camera is actually looking at (not the one just streamed in).
214
+ let best = null, bestOp = 0.5;
215
+ for (const p of panels) {
216
+ const op = p.mesh.material.uniforms.uOpacity.value;
217
+ if (op > bestOp) { bestOp = op; best = p; }
218
+ }
219
+ if (best && best.id !== focusKey) {
220
+ focusKey = best.id;
221
+ if (onFocus && best.meta) { try { onFocus(best.meta, best.id); } catch (_) {} }
222
+ }
223
  renderer.render(scene, camera);
224
  }
225
 
 
243
 
244
  return {
245
  init, addScene, reset, dispose, setReducedMotion,
246
+ set onFocus(fn) { onFocus = typeof fn === "function" ? fn : null; },
247
  get ready() { return ok; },
248
  get count() { return panels.length; },
249
  };
scripts/shoot-corridor.cjs CHANGED
@@ -17,9 +17,9 @@ const TEST_HTML = `<!doctype html><html><head>
17
  import "/frontend/js/stage-corridor.js";
18
  const SC = window.LL.corridor;
19
  SC.init(document.getElementById('c'));
20
- const worlds = [0,1,2,0,1].map(i => ({
21
- imageUrl: '/shots/corr/scene-'+i+'.png',
22
- depthUrl: '/shots/corr/scene-'+i+'-depth.png',
23
  }));
24
  window.__added = 0;
25
  (async () => {
 
17
  import "/frontend/js/stage-corridor.js";
18
  const SC = window.LL.corridor;
19
  SC.init(document.getElementById('c'));
20
+ const worlds = [0,1,2,3].map(i => ({
21
+ imageUrl: '/shots/world/w-'+i+'.webp',
22
+ depthUrl: '/shots/world/w-'+i+'-depth.png',
23
  }));
24
  window.__added = 0;
25
  (async () => {
scripts/shoot-immersive.cjs ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Validate the new immersive frontend: the intro (hero mic), then a stubbed
2
+ // streamWorld feeding the 4 real generated scenes into the corridor while the HUD
3
+ // orchestra lights up. Usage: node scripts/shoot-immersive.cjs
4
+ const { chromium } = require("playwright");
5
+ const http = require("http");
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ const ROOT = process.cwd();
9
+ const PORT = 8806;
10
+ const CT = { ".html": "text/html", ".js": "application/javascript", ".css": "text/css", ".woff2": "font/woff2", ".webp": "image/webp", ".png": "image/png", ".svg": "image/svg+xml" };
11
+
12
+ const server = http.createServer((req, res) => {
13
+ let p = decodeURIComponent(req.url.split("?")[0]);
14
+ if (p === "/") p = "/frontend/index.html";
15
+ if (p.startsWith("/shots/")) p = "/.shots/" + p.slice(7);
16
+ const file = path.join(ROOT, p);
17
+ fs.readFile(file, (e, d) => { if (e) { res.writeHead(404); res.end("nf"); } else { res.writeHead(200, { "content-type": CT[path.extname(file)] || "application/octet-stream" }); res.end(d); } });
18
+ });
19
+
20
+ (async () => {
21
+ const SHOTS = path.join(ROOT, ".shots"); fs.mkdirSync(SHOTS, { recursive: true });
22
+ const shot = (n) => path.join(SHOTS, n);
23
+ await new Promise((r) => server.listen(PORT, r));
24
+ const browser = await chromium.launch({ args: ["--use-gl=angle", "--use-angle=swiftshader", "--ignore-gpu-blocklist", "--enable-webgl"] });
25
+ const page = await browser.newPage({ viewport: { width: 1680, height: 900 } });
26
+ const errs = []; page.on("pageerror", (e) => errs.push("PE:" + e.message.slice(0, 200)));
27
+ page.on("console", (m) => { if (m.type() === "error") errs.push(m.text().slice(0, 200)); });
28
+
29
+ await page.goto(`http://localhost:${PORT}/frontend/index.html`, { waitUntil: "networkidle", timeout: 25000 }).catch((e) => errs.push("goto:" + e.message));
30
+ await page.waitForTimeout(1400);
31
+ await page.screenshot({ path: shot("imm-intro.png") });
32
+
33
+ // Stub streamWorld to feed the 4 real scenes, then start a world.
34
+ const started = await page.evaluate(async () => {
35
+ const LL = window.LL;
36
+ if (!LL || !LL.controller) return { ok: false, why: "no controller" };
37
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
38
+ const captions = ["A lighthouse keeper watched the waves at the edge of the world.", "Far away, a market woke under orange awnings.", "A child ran through a garden of impossible glowing flowers.", "Then snow buried the quiet road in silence."];
39
+ LL.api.streamWorld = async (text, lang, onEvent) => {
40
+ onEvent({ stage: "warming", scenes: 4 });
41
+ await sleep(120);
42
+ for (let i = 0; i < 4; i++) {
43
+ onEvent({ stage: "directing", index: i, text: captions[i] });
44
+ await sleep(120);
45
+ onEvent({ stage: "painting", index: i });
46
+ await sleep(120);
47
+ onEvent({ stage: "scene", index: i, image: "/shots/world/w-" + i + ".webp", caption: captions[i] });
48
+ onEvent({ stage: "depth", index: i, depth: "/shots/world/w-" + i + "-depth.png" });
49
+ await sleep(2600);
50
+ }
51
+ onEvent({ stage: "done", session: "imm", count: 4 });
52
+ return { session: "imm", done: true, cancelled: false };
53
+ };
54
+ LL.controller.startWorld("An old lighthouse keeper counted the waves...");
55
+ return { ok: true };
56
+ }).catch((e) => ({ ok: false, why: String(e).slice(0, 160) }));
57
+
58
+ await page.waitForTimeout(700);
59
+ await page.evaluate(() => window.dispatchEvent(new Event("resize")));
60
+ const caps = [1800, 4600, 7600, 10600];
61
+ let prev = 0;
62
+ for (let i = 0; i < caps.length; i++) { await page.waitForTimeout(caps[i] - prev); prev = caps[i]; await page.screenshot({ path: shot("imm-world-" + i + ".png") }); }
63
+
64
+ const st = await page.evaluate(() => ({ corridorReady: window.LL.corridor && window.LL.corridor.ready, count: window.LL.corridor && window.LL.corridor.count, inWorld: document.body.classList.contains("in-world") }));
65
+ console.log("STARTED:", JSON.stringify(started), "STATE:", JSON.stringify(st));
66
+ console.log("JS_ERRORS:", JSON.stringify(errs.slice(0, 10)));
67
+ await browser.close(); server.close();
68
+ })().catch((e) => { console.error("ERR:", e.message); process.exit(1); });