feat(demo): add OpenMotion-based promo video pipeline alongside the existing ffmpeg one
Migrates the promo video's compositing/motion-graphics layer (title cards, margins, transitions, audio mix) to OpenMotion (Hyperframes 0.9.7), built and verified across 3 independently-gated stages: - e2e/openmotion-poc/: proof-of-concept proving real footage composites correctly with live-sourced margins and a flash-free title card - e2e/openmotion/: the full video - intro, Act I/II/III, Epilogue, outro, and the real two-device Assembly sync scene, with continuous ambient audio, rendered to e2e/openmotion/renders/full.mp4 (1920x1080, 62.8s) The existing e2e/demoVideoFull.e2e.mjs is untouched and remains the production fallback (byte-for-byte unmodified, confirmed by every stage's independent review). Real Playwright screen-recording of the actual app is preserved as the footage source throughout - OpenMotion replaces only the post-capture compositing, never the capture itself. Every protection carried forward and independently re-verified at each stage: no cursor overlay, 16:9 landscape with live-data margins, in-universe copy (zero generic 'town' references), audible background audio (~-38dB, no clipping), zero content clipping at any beat including the Assembly two-device letterboxing, and the pacing fixes already proven in the ffmpeg pipeline (no white-flash frames, graceful fade-to-black ending).
This commit is contained in:
1 parent
c177d35332
commit
eb43d1c5c0
25 files changed
+2245
No files matched your search
@@ -32,3 +32,9 @@ dist-ssr
|
||||
*.sln
|
||||
*.sw?
|
||||
.vercel
|
||||
|
||||
# OpenMotion/Hyperframes tool-generated scratch (not project source)
|
||||
e2e/openmotion*/.hyperframes/
|
||||
e2e/openmotion*/.tmp-capture/
|
||||
e2e/openmotion*/.gatecheck/
|
||||
e2e/openmotion*/.verify*/
|
||||
Binary file not shown.
+11
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* GSAP 3.15.0
|
||||
* https://gsap.com
|
||||
*
|
||||
* @license Copyright 2026, GreenSock. All rights reserved.
|
||||
* Subject to the terms at https://gsap.com/standard-license.
|
||||
* @author: Jack Doyle, jack@greensock.com
|
||||
*/
|
||||
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).window=t.window||{})}(this,function(e){"use strict";function _inheritsLoose(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function r(t){return"string"==typeof t}function s(t){return"function"==typeof t}function t(t){return"number"==typeof t}function u(t){return void 0===t}function v(t){return"object"==typeof t}function w(t){return!1!==t}function x(){return"undefined"!=typeof window}function y(t){return s(t)||r(t)}function R(t){return(i=bt(t,ht))&&Fe}function S(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")}function T(t,e){return!e&&console.warn(t)}function U(t,e){return t&&(ht[t]=e)&&i&&(i[t]=e)||ht}function V(){return 0}function ga(t){var e,r,i=t[0];if(v(i)||s(i)||(t=[t]),!(e=(i._gsap||{}).harness)){for(r=yt.length;r--&&!yt[r].targetTest(i););e=yt[r]}for(r=t.length;r--;)t[r]&&(t[r]._gsap||(t[r]._gsap=new Xt(t[r],e)))||t.splice(r,1);return t}function ha(t){return t._gsap||ga(Pt(t))[0]._gsap}function ia(t,e,r){return(r=t[e])&&s(r)?t[e]():u(r)&&t.getAttribute&&t.getAttribute(e)||r}function ja(t,e){return(t=t.split(",")).forEach(e)||t}function ka(t){return Math.round(1e5*t)/1e5||0}function la(t){return Math.round(1e7*t)/1e7||0}function ma(t,e){var r=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),"+"===r?t+i:"-"===r?t-i:"*"===r?t*i:t/i}function na(t,e){for(var r=e.length,i=0;t.indexOf(e[i])<0&&++i<r;);return i<r}function oa(){var t,e,r=pt.length,i=pt.slice(0);for(_t={},t=pt.length=0;t<r;t++)(e=i[t])&&e._lazy&&(e.render(e._lazy[0],e._lazy[1],!0)._lazy=0)}function pa(t){return!!(t._initted||t._startAt||t.add)}function qa(t,e,r,i){pt.length&&!I&&oa(),t.render(e,r,i||!!(I&&e<0&&pa(t))),pt.length&&!I&&oa()}function ra(t){var e=parseFloat(t);return(e||0===e)&&(t+"").match(ot).length<2?e:r(t)?t.trim():t}function sa(t){return t}function ta(t,e){for(var r in e)r in t||(t[r]=e[r]);return t}function wa(t,e){for(var r in e)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(t[r]=v(e[r])?wa(t[r]||(t[r]={}),e[r]):e[r]);return t}function xa(t,e){var r,i={};for(r in t)r in e||(i[r]=t[r]);return i}function ya(t){var e=t.parent||L,r=t.keyframes?function _setKeyframeDefaults(i){return function(t,e){for(var r in e)r in t||"duration"===r&&i||"ease"===r||(t[r]=e[r])}}(K(t.keyframes)):ta;if(w(t.inherit))for(;e;)r(t,e.vars.defaults),e=e.parent||e._dp;return t}function Aa(t,e,r,i,n){void 0===r&&(r="_first"),void 0===i&&(i="_last");var a,s=t[i];if(n)for(a=e[n];s&&s[n]>a;)s=s._prev;return s?(e._next=s._next,s._next=e):(e._next=t[r],t[r]=e),e._next?e._next._prev=e:t[i]=e,e._prev=s,e.parent=e._dp=t,e}function Ba(t,e,r,i){void 0===r&&(r="_first"),void 0===i&&(i="_last");var n=e._prev,a=e._next;n?n._next=a:t[r]===e&&(t[r]=a),a?a._prev=n:t[i]===e&&(t[i]=n),e._next=e._prev=e.parent=null}function Ca(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0}function Da(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var r=t;r;)r._dirty=1,r=r.parent;return t}function Fa(t,e,r,i){return t._startAt&&(I?t._startAt.revert(ft):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))}function Ha(t){return t._repeat?wt(t._tTime,t=t.duration()+t._rDelay)*t:0}function Ja(t,e){return(t-e._start)*e._ts+(0<=e._ts?0:e._dirty?e.totalDuration():e._tDur)}function Ka(t){return t._end=la(t._start+(t._tDur/Math.abs(t._ts||t._rts||q)||0))}function La(t,e){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=la(r._time-(0<t._ts?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Ka(t),r._dirty||Da(r,t)),t}function Ma(t,e){var r;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(r=Ja(t.rawTime(),e),(!e._dur||Mt(0,e.totalDuration(),r)-e._tTime>q)&&e.render(r,!0)),Da(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(r=t;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;t._zTime=-q}}function Na(e,r,i,n){return r.parent&&Ca(r),r._start=la((t(i)?i:i||e!==L?Ot(e,i,r):e._time)+r._delay),r._end=la(r._start+(r.totalDuration()/Math.abs(r.timeScale())||0)),Aa(e,r,"_first","_last",e._sort?"_start":0),xt(r)||(e._recent=r),n||Ma(e,r),e._ts<0&&La(e,e._tTime),e}function Oa(t,e){return(ht.ScrollTrigger||S("scrollTrigger",e))&&ht.ScrollTrigger.create(e,t)}function Pa(t,e,r,i,n){return Ht(t,e,n),t._initted?!r&&t._pt&&!I&&(t._dur&&!1!==t.vars.lazy||!t._dur&&t.vars.lazy)&&f!==It.frame?(pt.push(t),t._lazy=[n,i],1):void 0:1}function Ua(t,e,r,i){var n=t._repeat,a=la(e)||0,s=t._tTime/t._tDur;return s&&!i&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:la(a*(n+1)+t._rDelay*n):a,0<s&&!i&&La(t,t._tTime=t._tDur*s),t.parent&&Ka(t),r||Da(t.parent,t),t}function Va(t){return t instanceof Gt?Da(t)Line truncated
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
// STAGE-1 OpenMotion POC: trimmed real-footage capture.
|
||||
//
|
||||
// This is a faithful, SMALL subset of e2e/demoVideoFull.e2e.mjs's
|
||||
// recordMainScene() - the REAL Playwright screen-recording of the REAL
|
||||
// running app (same viewport, same 2x device scale, same recordVideo
|
||||
// mechanism). It captures ONLY the intro + Water Watch "no-false-alert"
|
||||
// beat (~10s) so the OpenMotion migration can be proven against genuine
|
||||
// app footage without re-recording the whole 70s tour.
|
||||
//
|
||||
// It does NOT import or modify demoVideoFull.e2e.mjs; that file stays the
|
||||
// intact fallback. The capture mechanism (recordMainScene) is explicitly
|
||||
// NOT being replaced by OpenMotion - OpenMotion only replaces what happens
|
||||
// AFTER raw footage is captured (compositing + title cards).
|
||||
import { chromium } from "playwright";
|
||||
import { createServer as createViteServer } from "vite";
|
||||
import ffmpegStatic from "ffmpeg-static";
|
||||
import { mkdirSync, rmSync, readdirSync, existsSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { execFileSync } from "node:child_process";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const POC_DIR = __dirname;
|
||||
const ROOT = resolve(__dirname, "..", ".."); // worktree root
|
||||
const VIDEO_TMP_DIR = resolve(POC_DIR, ".tmp-capture");
|
||||
const CLIP_OUT = resolve(POC_DIR, "assets", "clip.mp4");
|
||||
|
||||
// Same constants as recordMainScene(): a 414x896 phone pane recorded at 2x
|
||||
// device-pixel density (sharp text) -> an 828x1792 raw webm.
|
||||
const PANE = { width: 414, height: 896 };
|
||||
const RECAST_SCALE = 2;
|
||||
const MAIN_VIDEO_SIZE = { width: PANE.width * RECAST_SCALE, height: PANE.height * RECAST_SCALE };
|
||||
|
||||
const VITE_PORT = 45000 + Math.floor(Math.random() * 10000);
|
||||
const APP_URL = `http://127.0.0.1:${VITE_PORT}`;
|
||||
const FFMPEG_BIN = ffmpegStatic;
|
||||
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
async function waitFor(fn, label, timeoutMs = 20000) {
|
||||
const start = Date.now();
|
||||
let lastErr;
|
||||
while (Date.now() - start < timeoutMs) {
|
||||
try {
|
||||
const v = await fn();
|
||||
if (v) return v;
|
||||
} catch (e) {
|
||||
lastErr = e;
|
||||
}
|
||||
await sleep(150);
|
||||
}
|
||||
throw new Error(`timeout waiting for: ${label}${lastErr ? ` (last error: ${lastErr})` : ""}`);
|
||||
}
|
||||
|
||||
async function startVite() {
|
||||
const vite = await createViteServer({
|
||||
root: ROOT,
|
||||
configFile: resolve(ROOT, "vite.config.ts"),
|
||||
logLevel: "warn",
|
||||
server: { host: "127.0.0.1", port: VITE_PORT, strictPort: true },
|
||||
});
|
||||
await vite.listen();
|
||||
return vite;
|
||||
}
|
||||
|
||||
async function walletBalanceText(page) {
|
||||
return (await page.getByTestId("wallet-balance").textContent())?.trim();
|
||||
}
|
||||
async function openTile(page, label) {
|
||||
await page.getByRole("button", { name: label }).click();
|
||||
await page.locator(`[aria-label="${label}"]`).first().waitFor({ state: "visible", timeout: 10000 });
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log("=== POC capture: intro + Water Watch (real app footage) ===");
|
||||
const vite = await startVite();
|
||||
const videoDir = resolve(VIDEO_TMP_DIR, "main");
|
||||
// Wipe first - a leftover partial webm from a crashed run would corrupt
|
||||
// the capture (same hazard recordMainScene() guards against).
|
||||
rmSync(videoDir, { recursive: true, force: true });
|
||||
mkdirSync(videoDir, { recursive: true });
|
||||
|
||||
const browser = await chromium.launch({
|
||||
headless: true,
|
||||
args: ["--no-sandbox", `--force-device-scale-factor=${RECAST_SCALE}`],
|
||||
});
|
||||
const context = await browser.newContext({
|
||||
viewport: PANE,
|
||||
deviceScaleFactor: RECAST_SCALE,
|
||||
recordVideo: { dir: videoDir, size: MAIN_VIDEO_SIZE },
|
||||
});
|
||||
const page = await context.newPage();
|
||||
|
||||
try {
|
||||
// --- Cold start: real local Ed25519 identity, honest empty home ---
|
||||
await page.goto(`${APP_URL}/`, { waitUntil: "load" });
|
||||
await page.getByRole("grid", { name: "Miniapps" }).waitFor({ state: "visible" });
|
||||
await waitFor(async () => (await walletBalanceText(page)) !== "--", "identity resolves (wallet leaves '--')");
|
||||
console.log("[+] cold start: fresh identity + home grid");
|
||||
await sleep(1600);
|
||||
|
||||
// --- Admin: Load Hollow demo seed (real signed seed.* events) ---
|
||||
await page.goto(`${APP_URL}/admin`, { waitUntil: "load" });
|
||||
await page.getByRole("button", { name: "Load Hollow demo" }).click();
|
||||
await waitFor(
|
||||
async () => ((await page.getByTestId("demo-load-status").textContent()) ?? "").includes("Demo data loaded"),
|
||||
"demo seed load status",
|
||||
);
|
||||
console.log("[+] admin seed: Load Hollow demo");
|
||||
await sleep(1200);
|
||||
|
||||
await page.goto(`${APP_URL}/`, { waitUntil: "load" });
|
||||
await page.getByRole("grid", { name: "Miniapps" }).waitFor({ state: "visible" });
|
||||
await sleep(1000);
|
||||
|
||||
// --- Water Watch: GAP-8 false-alert fix shown live ---
|
||||
await openTile(page, "Water Watch");
|
||||
async function reportReading(sensorId, value) {
|
||||
await page.getByTestId("report-reading-sensor").fill(sensorId);
|
||||
await page.getByTestId("report-reading-value").fill(String(value));
|
||||
await page.getByTestId("report-reading-submit").click();
|
||||
await waitFor(
|
||||
async () => !((await page.getByTestId("report-reading-status").textContent()) ?? "").includes("Submitting..."),
|
||||
`submit ${sensorId}=${value} settles`,
|
||||
);
|
||||
}
|
||||
await sleep(900);
|
||||
await reportReading("kiosk-1", 7);
|
||||
await sleep(500);
|
||||
await reportReading("kiosk-1", 7.05);
|
||||
const stateAfterFlat = await page.getByTestId("device-monitor-status-light-pH").getAttribute("data-state");
|
||||
if (stateAfterFlat === "alert") {
|
||||
throw new Error("REGRESSION: a flat 2nd reading triggered a false alert (GAP-8 fix did not hold)");
|
||||
}
|
||||
console.log(`[+] water watch: flat 2nd reading did NOT fire a false alert (state="${stateAfterFlat}")`);
|
||||
await sleep(1600);
|
||||
|
||||
await reportReading("kiosk-1", 50);
|
||||
await waitFor(
|
||||
async () => (await page.getByTestId("device-monitor-status-light-pH").getAttribute("data-state")) === "corroborating",
|
||||
"pH channel reaches corroborating after a genuine spike",
|
||||
);
|
||||
console.log("[+] water watch: genuine spike flagged, awaiting a 2nd independent sensor");
|
||||
await sleep(1600);
|
||||
} finally {
|
||||
await context.close(); // flushes the .webm
|
||||
await browser.close();
|
||||
await vite.close();
|
||||
}
|
||||
|
||||
const webm = readdirSync(videoDir).find((f) => f.endsWith(".webm"));
|
||||
if (!webm) throw new Error(`no .webm produced in ${videoDir}`);
|
||||
const webmPath = resolve(videoDir, webm);
|
||||
|
||||
// Transcode the real webm to an H.264 mp4 (container/codec conversion of
|
||||
// the genuine footage - no fabrication) so the OpenMotion <video> element
|
||||
// can decode/seek it frame-by-frame per the Hyperframes contract.
|
||||
mkdirSync(dirname(CLIP_OUT), { recursive: true });
|
||||
if (existsSync(CLIP_OUT)) rmSync(CLIP_OUT);
|
||||
execFileSync(
|
||||
FFMPEG_BIN,
|
||||
["-y", "-i", webmPath, "-c:v", "libx264", "-pix_fmt", "yuv420p", "-an", "-movflags", "+faststart", CLIP_OUT],
|
||||
{ stdio: ["ignore", "pipe", "pipe"] },
|
||||
);
|
||||
console.log(`\nRaw webm: ${webmPath}`);
|
||||
console.log(`Clip mp4: ${CLIP_OUT}`);
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<style>
|
||||
* { margin:0; padding:0; box-sizing:border-box; }
|
||||
#root {
|
||||
position:absolute; inset:0; overflow:hidden; background:#05070d;
|
||||
font-family:-apple-system,'Helvetica Neue',Arial,sans-serif; color:#fff;
|
||||
}
|
||||
|
||||
/* ---- Real-data margins (byte-faithful to compositeLandscapeWithMargins'
|
||||
landscapeMarginBackgroundHtml: same headings, same CSS grammar,
|
||||
values pulled from HOLLOW_DEMO_FIXTURE) ---- */
|
||||
.panel { position:absolute; top:0; bottom:0; width:700px; padding:56px 44px; }
|
||||
.panel.left { left:0; }
|
||||
.panel.right { right:0; text-align:right; }
|
||||
.heading { color:#4f9dff; letter-spacing:0.16em; font-size:18px; font-weight:700; text-transform:uppercase; margin-bottom:24px; }
|
||||
.line { font-size:21px; line-height:1.6; color:#c3cde3; margin-bottom:11px; }
|
||||
|
||||
/* ---- Centered phone region: real recorded footage, scaled to 960px
|
||||
tall at the exact 414x896 pane aspect (444x960), centered over
|
||||
the 1920x1080 canvas (738px margins L/R, 60px T/B). object-fit
|
||||
keeps the UI whole - nothing cropped, same no-crop guarantee as
|
||||
the autoZoom=1.0 constraint. ---- */
|
||||
#phone {
|
||||
position:absolute; left:738px; top:60px; width:444px; height:960px;
|
||||
box-shadow:0 24px 70px rgba(0,0,0,0.55); background:#000;
|
||||
}
|
||||
#bg { width:100%; height:100%; object-fit:cover; display:block; }
|
||||
|
||||
/* ---- In-universe intro title card: a full-screen OVERLAY that starts
|
||||
fully opaque (first frame is this dark card, never white),
|
||||
reveals its kinetic typography, then fades OUT to reveal the live
|
||||
footage underneath. No page reload, no setContent swap -> no
|
||||
white-flash dead frame (the exact defect fixed in the old
|
||||
pipeline). Markup/CSS grammar reuses titleCardHtml()/
|
||||
TITLE_CARD_CSS verbatim. ---- */
|
||||
#card {
|
||||
position:absolute; inset:0; z-index:50; background:#05070d;
|
||||
display:flex; flex-direction:column; align-items:center; justify-content:center;
|
||||
text-align:center; padding:0 60px;
|
||||
}
|
||||
#glow { position:absolute; width:900px; height:900px; border-radius:50%;
|
||||
background:radial-gradient(circle, rgba(22,119,255,0.35) 0%, rgba(22,119,255,0) 70%); filter:blur(10px); }
|
||||
#eyebrow { color:#4f9dff; letter-spacing:0.4em; font-size:20px; font-weight:600; text-transform:uppercase; }
|
||||
#title { color:#f5f7ff; font-size:72px; font-weight:800; letter-spacing:-0.02em; margin-top:18px; line-height:1.05; max-width:1200px; }
|
||||
#rule { width:110px; height:4px; background:#1677FF; margin-top:26px; transform-origin:center; }
|
||||
#tagline { color:#9fb3d9; font-size:26px; font-weight:400; margin-top:26px; max-width:720px; }
|
||||
</style>
|
||||
|
||||
<div id="root" data-composition-id="promo" data-width="1920" data-height="1080" data-duration="10.5">
|
||||
<!-- muted + data-start required on a timed video; never .play()'d - the engine seeks it frame-by-frame (Hyperframes contract) -->
|
||||
<div id="phone">
|
||||
<video id="bg" src="assets/clip.mp4" data-start="0" data-media-start="0" muted playsinline></video>
|
||||
</div>
|
||||
|
||||
<div class="panel left">
|
||||
<div class="heading">The Hollow · live seed data</div>
|
||||
<div class="line">Population: 4,200</div>
|
||||
<div class="line">Power pool: 850</div>
|
||||
<div class="line">Water pool: 620</div>
|
||||
<div class="line">Food pool: 410</div>
|
||||
<div class="line">Cooling pool: 300</div>
|
||||
<div class="line">water-ph: 7.1</div>
|
||||
<div class="line">grid-frequency-hz: 59.98</div>
|
||||
<div class="line">ambient-temp-c: 21.4</div>
|
||||
</div>
|
||||
|
||||
<div class="panel right">
|
||||
<div class="heading">Wave-1 fixes, shown live</div>
|
||||
<div class="line">flat 2nd reading (7.0 -> 7.05) did NOT fire a false alert</div>
|
||||
<div class="line">real pipe-graph leak localization named a suspected origin node</div>
|
||||
<div class="line">real GDD + LP optimizer forecast (1 temp reading, 1 plot, 1 crop) -> 200.00 kg</div>
|
||||
</div>
|
||||
|
||||
<div id="card">
|
||||
<div id="glow"></div>
|
||||
<div id="eyebrow">The Hollow, tonight</div>
|
||||
<div id="title">Who do you trust when the water turns bad?</div>
|
||||
<div id="rule"></div>
|
||||
<div id="tagline">4,200 residents underground, cut off from the surface. No server. No central login.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
|
||||
// Kinetic-typography reveal (ease-OUT rises - landing motion
|
||||
// decelerates), timed to the same cadence as TITLE_CARD_CSS keyframes.
|
||||
tl.set('#card', { opacity: 1 }, 0);
|
||||
tl.fromTo('#eyebrow', { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.6, ease: 'power2.out' }, 0.15);
|
||||
tl.fromTo('#title', { opacity: 0, y: 20 }, { opacity: 1, y: 0, duration: 0.7, ease: 'power2.out' }, 0.45);
|
||||
tl.fromTo('#rule', { scaleX: 0 }, { scaleX: 1, duration: 0.6, ease: 'power3.out' }, 0.95);
|
||||
tl.fromTo('#tagline', { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.6, ease: 'power2.out' }, 1.3);
|
||||
|
||||
// Hold, then fade the card OUT faster on an ease-IN curve (leaving
|
||||
// motion accelerates) to reveal the live footage underneath. The card
|
||||
// bg is dark (#05070d) the whole time and the composite underneath is
|
||||
// dark too, so there is never a white frame at the cut.
|
||||
tl.to('#card', { opacity: 0, duration: 0.6, ease: 'power2.in' }, 2.8);
|
||||
tl.set('#card', { pointerEvents: 'none' }, 3.4);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines.promo = tl;
|
||||
</script>
|
||||
</template>
|
||||
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>The Commons · OpenMotion POC (stage 1)</title>
|
||||
<script src="assets/gsap.min.js"></script>
|
||||
<style>body{margin:0;background:#000}#main{position:relative;width:1920px;height:1080px;overflow:hidden}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main" data-composition-id="main" data-start="0" data-duration="10.5" data-width="1920" data-height="1080" data-fps="30">
|
||||
<div id="promo" class="clip"
|
||||
data-composition-id="promo"
|
||||
data-composition-src="compositions/promo.html"
|
||||
data-start="0" data-duration="10.5" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines.main = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"recordedAt": "2026-11-19T21:13:00.264Z",
|
||||
"canvas": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"clip": {
|
||||
"name": "assembly",
|
||||
"path": "assets/assembly.mp4",
|
||||
"durationS": 7.27
|
||||
},
|
||||
"beats": [
|
||||
{
|
||||
"label": "boot",
|
||||
"note": "two genuinely isolated devices (separate storage origins) open the real Assembly screen; sync is honestly off by default",
|
||||
"offsetS": 1.141
|
||||
},
|
||||
{
|
||||
"label": "connected",
|
||||
"note": "real WebRTC transport connected over a local signaling server - both devices see a live peer count",
|
||||
"offsetS": 2.008
|
||||
},
|
||||
{
|
||||
"label": "transport-proven",
|
||||
"note": "a proposal created on device A arrived on device B purely over the real WebRTC transport - B's own IndexedDB never had it",
|
||||
"offsetS": 2.766
|
||||
},
|
||||
{
|
||||
"label": "partitioned",
|
||||
"note": "both devices genuinely isolated (peer count 0, network offline, signaling blocked) - independent votes cast (A sees \"You voted Yes\", B sees \"You voted No\")",
|
||||
"offsetS": 4.148
|
||||
},
|
||||
{
|
||||
"label": "healed-reconnected",
|
||||
"note": "both devices reconnected after the partition - real WebrtcProvider re-established",
|
||||
"offsetS": 5.705
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* GSAP 3.15.0
|
||||
* https://gsap.com
|
||||
*
|
||||
* @license Copyright 2026, GreenSock. All rights reserved.
|
||||
* Subject to the terms at https://gsap.com/standard-license.
|
||||
* @author: Jack Doyle, jack@greensock.com
|
||||
*/
|
||||
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).window=t.window||{})}(this,function(e){"use strict";function _inheritsLoose(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function r(t){return"string"==typeof t}function s(t){return"function"==typeof t}function t(t){return"number"==typeof t}function u(t){return void 0===t}function v(t){return"object"==typeof t}function w(t){return!1!==t}function x(){return"undefined"!=typeof window}function y(t){return s(t)||r(t)}function R(t){return(i=bt(t,ht))&&Fe}function S(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")}function T(t,e){return!e&&console.warn(t)}function U(t,e){return t&&(ht[t]=e)&&i&&(i[t]=e)||ht}function V(){return 0}function ga(t){var e,r,i=t[0];if(v(i)||s(i)||(t=[t]),!(e=(i._gsap||{}).harness)){for(r=yt.length;r--&&!yt[r].targetTest(i););e=yt[r]}for(r=t.length;r--;)t[r]&&(t[r]._gsap||(t[r]._gsap=new Xt(t[r],e)))||t.splice(r,1);return t}function ha(t){return t._gsap||ga(Pt(t))[0]._gsap}function ia(t,e,r){return(r=t[e])&&s(r)?t[e]():u(r)&&t.getAttribute&&t.getAttribute(e)||r}function ja(t,e){return(t=t.split(",")).forEach(e)||t}function ka(t){return Math.round(1e5*t)/1e5||0}function la(t){return Math.round(1e7*t)/1e7||0}function ma(t,e){var r=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),"+"===r?t+i:"-"===r?t-i:"*"===r?t*i:t/i}function na(t,e){for(var r=e.length,i=0;t.indexOf(e[i])<0&&++i<r;);return i<r}function oa(){var t,e,r=pt.length,i=pt.slice(0);for(_t={},t=pt.length=0;t<r;t++)(e=i[t])&&e._lazy&&(e.render(e._lazy[0],e._lazy[1],!0)._lazy=0)}function pa(t){return!!(t._initted||t._startAt||t.add)}function qa(t,e,r,i){pt.length&&!I&&oa(),t.render(e,r,i||!!(I&&e<0&&pa(t))),pt.length&&!I&&oa()}function ra(t){var e=parseFloat(t);return(e||0===e)&&(t+"").match(ot).length<2?e:r(t)?t.trim():t}function sa(t){return t}function ta(t,e){for(var r in e)r in t||(t[r]=e[r]);return t}function wa(t,e){for(var r in e)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(t[r]=v(e[r])?wa(t[r]||(t[r]={}),e[r]):e[r]);return t}function xa(t,e){var r,i={};for(r in t)r in e||(i[r]=t[r]);return i}function ya(t){var e=t.parent||L,r=t.keyframes?function _setKeyframeDefaults(i){return function(t,e){for(var r in e)r in t||"duration"===r&&i||"ease"===r||(t[r]=e[r])}}(K(t.keyframes)):ta;if(w(t.inherit))for(;e;)r(t,e.vars.defaults),e=e.parent||e._dp;return t}function Aa(t,e,r,i,n){void 0===r&&(r="_first"),void 0===i&&(i="_last");var a,s=t[i];if(n)for(a=e[n];s&&s[n]>a;)s=s._prev;return s?(e._next=s._next,s._next=e):(e._next=t[r],t[r]=e),e._next?e._next._prev=e:t[i]=e,e._prev=s,e.parent=e._dp=t,e}function Ba(t,e,r,i){void 0===r&&(r="_first"),void 0===i&&(i="_last");var n=e._prev,a=e._next;n?n._next=a:t[r]===e&&(t[r]=a),a?a._prev=n:t[i]===e&&(t[i]=n),e._next=e._prev=e.parent=null}function Ca(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0}function Da(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var r=t;r;)r._dirty=1,r=r.parent;return t}function Fa(t,e,r,i){return t._startAt&&(I?t._startAt.revert(ft):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))}function Ha(t){return t._repeat?wt(t._tTime,t=t.duration()+t._rDelay)*t:0}function Ja(t,e){return(t-e._start)*e._ts+(0<=e._ts?0:e._dirty?e.totalDuration():e._tDur)}function Ka(t){return t._end=la(t._start+(t._tDur/Math.abs(t._ts||t._rts||q)||0))}function La(t,e){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=la(r._time-(0<t._ts?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Ka(t),r._dirty||Da(r,t)),t}function Ma(t,e){var r;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(r=Ja(t.rawTime(),e),(!e._dur||Mt(0,e.totalDuration(),r)-e._tTime>q)&&e.render(r,!0)),Da(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(r=t;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;t._zTime=-q}}function Na(e,r,i,n){return r.parent&&Ca(r),r._start=la((t(i)?i:i||e!==L?Ot(e,i,r):e._time)+r._delay),r._end=la(r._start+(r.totalDuration()/Math.abs(r.timeScale())||0)),Aa(e,r,"_first","_last",e._sort?"_start":0),xt(r)||(e._recent=r),n||Ma(e,r),e._ts<0&&La(e,e._tTime),e}function Oa(t,e){return(ht.ScrollTrigger||S("scrollTrigger",e))&&ht.ScrollTrigger.create(e,t)}function Pa(t,e,r,i,n){return Ht(t,e,n),t._initted?!r&&t._pt&&!I&&(t._dur&&!1!==t.vars.lazy||!t._dur&&t.vars.lazy)&&f!==It.frame?(pt.push(t),t._lazy=[n,i],1):void 0:1}function Ua(t,e,r,i){var n=t._repeat,a=la(e)||0,s=t._tTime/t._tDur;return s&&!i&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:la(a*(n+1)+t._rDelay*n):a,0<s&&!i&&La(t,t._tTime=t._tDur*s),t.parent&&Ka(t),r||Da(t.parent,t),t}function Va(t){return t instanceof Gt?Da(t)Line truncated
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,381 @@
|
||||
// STAGE-2 OpenMotion full main-tour: composition builder.
|
||||
//
|
||||
// Generates index.html + compositions/promo.html for the full Acts I-III
|
||||
// tour from (a) the per-act footage clips + durations recorded by
|
||||
// capture.mjs, (b) the REAL live seed fixture imported straight from
|
||||
// src/admin/seedEvents.ts (left margin - so the margin numbers can never
|
||||
// silently drift from what "Load Hollow demo" actually seeds), and (c) the
|
||||
// title-card copy + Wave-1 callouts exported from tour.mjs (right margin +
|
||||
// the full-screen GSAP title cards). Nothing in the composition HTML is a
|
||||
// hand-copied literal - every margin value and every card string is
|
||||
// templated from a source of truth at build time.
|
||||
//
|
||||
// Timeline model (all times in film seconds, one master GSAP timeline per
|
||||
// the proven Stage-1 mechanic):
|
||||
// - 4 <video> clips (intro, act1, act2, act3), each positioned in the
|
||||
// centered phone region with an aspect-exact box (no object-fit crop),
|
||||
// visible only within [data-start, data-start+data-duration].
|
||||
// - 4 full-screen dark title cards (intro + Act I/II/III) that crossfade
|
||||
// over the footage: ease-OUT landing in, ease-IN leaving out, dark
|
||||
// (#05070d) throughout so a cut is always dark->dark (no white flash);
|
||||
// a slow continuous glow "breath" during each hold so no card hold is
|
||||
// a run of identical frames.
|
||||
import { readFileSync, writeFileSync, mkdirSync, copyFileSync, existsSync } from "node:fs";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import ffmpegStatic from "ffmpeg-static";
|
||||
import { TITLE_CARDS, WAVE1_FIX_CALLOUTS } from "./tour.mjs";
|
||||
import { HOLLOW_DEMO_FIXTURE } from "../../src/admin/seedEvents.ts";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const OM_DIR = __dirname;
|
||||
const MANIFEST = resolve(OM_DIR, "capture-manifest.json");
|
||||
const ASSEMBLY_MANIFEST = resolve(OM_DIR, "assembly-manifest.json");
|
||||
const COMPOSITIONS_DIR = resolve(OM_DIR, "compositions");
|
||||
const ASSETS_DIR = resolve(OM_DIR, "assets");
|
||||
const FFMPEG_BIN = ffmpegStatic;
|
||||
|
||||
const CANVAS_W = 1920;
|
||||
const CANVAS_H = 1080;
|
||||
const FPS = 30;
|
||||
const PHONE_H = 960; // 60px top/bottom padding on a 1080 canvas
|
||||
|
||||
// --- transition / pacing constants (film seconds) ---
|
||||
const CARD_IN = 0.45; // opacity 0->1 (ease-out), also the cover crossfade length into a card
|
||||
const CARD_OUT = 0.6; // opacity 1->0 (ease-in), also the reveal crossfade length out of a card
|
||||
const CARD_READ = 2.6; // fully-opaque reading time between fade-in and fade-out
|
||||
const INTRO_READ = 3.0; // the opening hook card holds a touch longer before it lifts
|
||||
const OUTRO_READ = 3.0; // the closing "The Commons" statement card holds a touch longer
|
||||
const END_HOLD = 0.15; // brief full-black tail after the closing fade completes
|
||||
|
||||
// --- ambient audio (Stage 3) ---
|
||||
// The ambient pad is regenerated here with the EXACT method
|
||||
// demoVideoFull.e2e.mjs's generateAmbientTrack() uses (three sine
|
||||
// oscillators C3/E3/G3 amixed with weights 1/0.8/0.7, slow tremolo, baked
|
||||
// fade-in/out) - no copyrighted track - at the full timeline length, then
|
||||
// played through Hyperframes' native <audio> element. AMBIENT_VOLUME is the
|
||||
// single hyperframes-native loudness knob (data-volume): the raw track
|
||||
// measures mean -27.9 dB, and -10.5 dB of gain (0.30) lands the final mix at
|
||||
// ~-38 dB mean, inside the proven -37..-40 dB band, with max well below 0.
|
||||
const AMBIENT_SRC = "assets/ambient.mp3";
|
||||
const AMBIENT_VOLUME = 0.3;
|
||||
|
||||
const esc = (s) => String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||
|
||||
function marginLeftLines() {
|
||||
const f = HOLLOW_DEMO_FIXTURE;
|
||||
return [
|
||||
`Population: ${f.population.toLocaleString("en-US")}`,
|
||||
`Power pool: ${f.resources.power}`,
|
||||
`Water pool: ${f.resources.water}`,
|
||||
`Food pool: ${f.resources.food}`,
|
||||
`Cooling pool: ${f.resources.cooling}`,
|
||||
...f.baselines.map((b) => `${b.channel}: ${b.value}`),
|
||||
];
|
||||
}
|
||||
function marginRightLines() {
|
||||
return WAVE1_FIX_CALLOUTS.map((c) => c.text);
|
||||
}
|
||||
|
||||
// Build the full timeline from the measured clip durations. `assemblyDur` is
|
||||
// the duration of the pre-composited 1920x1080 Assembly two-device clip
|
||||
// (assets/assembly.mp4), which plays full-canvas after the outro card.
|
||||
function buildTimeline(clips, assemblyDur) {
|
||||
const byName = Object.fromEntries(clips.map((c) => [c.name, c]));
|
||||
const d = (n) => {
|
||||
const v = byName[n]?.durationS;
|
||||
if (!v) throw new Error(`clip ${n} missing/zero duration in manifest`);
|
||||
return v;
|
||||
};
|
||||
|
||||
const cards = [];
|
||||
const videos = []; // { fullCanvas } marks the Assembly clip (outside the phone box)
|
||||
|
||||
// Intro card: opaque from t=0 (first frame is the dark card, never white),
|
||||
// holds INTRO_READ, then crossfades out over CARD_OUT.
|
||||
const introFadeOut = INTRO_READ;
|
||||
cards.push({ id: "card-intro", key: "intro", intro: true, appear: 0, fadeOut: introFadeOut });
|
||||
// Intro clip crossfades in as the card fades out.
|
||||
const introStart = introFadeOut;
|
||||
const introEnd = introStart + d("intro");
|
||||
videos.push({ id: "vid-intro", key: "intro", start: introStart, duration: d("intro"), fullCanvas: false });
|
||||
|
||||
// Place each act/epilogue card + its following phone clip after the prev end.
|
||||
// The Epilogue is just another act in this mechanic: a card between the Act
|
||||
// III clip and the Epilogue footage clip.
|
||||
let prevEnd = introEnd;
|
||||
for (const key of ["act1", "act2", "act3", "epilogue"]) {
|
||||
const appear = prevEnd - CARD_IN; // card fully opaque exactly when prev clip hides (crossfade cover)
|
||||
const fadeOut = prevEnd + CARD_READ;
|
||||
cards.push({ id: `card-${key}`, key, intro: false, appear, fadeOut });
|
||||
const start = fadeOut; // clip crossfades in as the card fades out
|
||||
videos.push({ id: `vid-${key}`, key, start, duration: d(key), fullCanvas: false });
|
||||
prevEnd = start + d(key);
|
||||
}
|
||||
|
||||
// Outro card ("The Commons"): a terminal statement card with no phone clip
|
||||
// after it. It crossfades over the end of the Epilogue clip, holds a touch
|
||||
// longer (OUTRO_READ), then fades out to reveal the Assembly scene beneath.
|
||||
const outroAppear = prevEnd - CARD_IN;
|
||||
const outroFadeOut = prevEnd + OUTRO_READ;
|
||||
cards.push({ id: "card-outro", key: "outro", intro: false, appear: outroAppear, fadeOut: outroFadeOut });
|
||||
|
||||
// Assembly two-device clip: full-canvas (1920x1080, already composited with
|
||||
// symmetric letterbox margins). Starts as the outro card begins fading out;
|
||||
// its own baked 0.5s fade-in-from-black plus the still-opaque card above it
|
||||
// make the cut dark->dark (no white flash). Its baked 0.6s fade-out closes
|
||||
// the whole film on black - so NO separate full-frame closing fade is needed.
|
||||
const asmStart = outroFadeOut;
|
||||
videos.push({ id: "vid-assembly", key: "assembly", start: asmStart, duration: assemblyDur, fullCanvas: true });
|
||||
// The timeline ends exactly when the Assembly clip's own baked 0.6s
|
||||
// fade-to-black completes (its last frame is pure black). Ending here - not
|
||||
// END_HOLD seconds later - keeps the full-canvas Assembly layer covering the
|
||||
// margins through the final frame, so the film closes on black instead of
|
||||
// briefly flashing the margin panels back once the clip window ends.
|
||||
void END_HOLD;
|
||||
const total = Number((asmStart + assemblyDur).toFixed(3));
|
||||
|
||||
return { cards, videos, total };
|
||||
}
|
||||
|
||||
// Regenerate the ambient pad with demoVideoFull.e2e.mjs's exact
|
||||
// generateAmbientTrack() method, at the full timeline length.
|
||||
function generateAmbientTrack(outPath, durationSeconds) {
|
||||
mkdirSync(dirname(outPath), { recursive: true });
|
||||
const fadeOutStart = Math.max(0, durationSeconds - 4);
|
||||
execFileSync(
|
||||
FFMPEG_BIN,
|
||||
[
|
||||
"-y",
|
||||
"-f", "lavfi", "-i", `sine=frequency=130.81:duration=${durationSeconds}`,
|
||||
"-f", "lavfi", "-i", `sine=frequency=164.81:duration=${durationSeconds}`,
|
||||
"-f", "lavfi", "-i", `sine=frequency=196.00:duration=${durationSeconds}`,
|
||||
"-filter_complex",
|
||||
`[0][1][2]amix=inputs=3:duration=longest:weights=1 0.8 0.7[mix];` +
|
||||
`[mix]tremolo=f=0.15:d=0.3,afade=t=in:st=0:d=3,afade=t=out:st=${fadeOutStart}:d=4[out]`,
|
||||
"-map", "[out]",
|
||||
"-c:a", "libmp3lame", "-b:a", "128k",
|
||||
outPath,
|
||||
],
|
||||
{ stdio: ["ignore", "pipe", "pipe"] },
|
||||
);
|
||||
return outPath;
|
||||
}
|
||||
|
||||
function cardMarkup(id, copy, introInitiallyOpaque) {
|
||||
const style = introInitiallyOpaque ? "" : "opacity:0;";
|
||||
return ` <div class="card" id="${id}" style="${style}">
|
||||
<div class="glow"></div>
|
||||
<div class="eyebrow">${esc(copy.eyebrow)}</div>
|
||||
<div class="title">${esc(copy.title)}</div>
|
||||
<div class="rule"></div>
|
||||
<div class="tagline">${esc(copy.tagline)}</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function main() {
|
||||
const manifest = JSON.parse(readFileSync(MANIFEST, "utf8"));
|
||||
const { videoSize, clips } = manifest;
|
||||
if (!existsSync(ASSEMBLY_MANIFEST)) {
|
||||
throw new Error(`assembly manifest not found at ${ASSEMBLY_MANIFEST} - run captureAssembly.mjs first`);
|
||||
}
|
||||
const assemblyManifest = JSON.parse(readFileSync(ASSEMBLY_MANIFEST, "utf8"));
|
||||
const assemblyDur = assemblyManifest.clip?.durationS;
|
||||
if (!assemblyDur) throw new Error("assembly clip missing/zero duration in assembly-manifest.json");
|
||||
const { cards, videos, total } = buildTimeline(clips, assemblyDur);
|
||||
|
||||
// Regenerate the ambient pad at the exact timeline length (same method as
|
||||
// demoVideoFull.e2e.mjs's generateAmbientTrack()).
|
||||
generateAmbientTrack(resolve(ASSETS_DIR, "ambient.mp3"), total);
|
||||
|
||||
// Aspect-exact phone box (gap #4): width derived from the real captured
|
||||
// video dimensions so object-fit crops nothing regardless of cover/contain.
|
||||
const phoneW = Number(((PHONE_H * videoSize.width) / videoSize.height).toFixed(2));
|
||||
const phoneLeft = Number(((CANVAS_W - phoneW) / 2).toFixed(2));
|
||||
const phoneTop = (CANVAS_H - PHONE_H) / 2;
|
||||
|
||||
const leftItems = marginLeftLines().map((l) => ` <div class="line">${esc(l)}</div>`).join("\n");
|
||||
const rightItems = marginRightLines().map((l) => ` <div class="line">${esc(l)}</div>`).join("\n");
|
||||
|
||||
// Phone-box clips (intro..epilogue) live inside #phone; the Assembly clip
|
||||
// is full-canvas (already 1920x1080 with its own letterbox), so it is a
|
||||
// sibling layer above the phone/margins and below the cards.
|
||||
const phoneVideoEls = videos
|
||||
.filter((v) => !v.fullCanvas)
|
||||
.map(
|
||||
(v) =>
|
||||
` <video class="bg" id="${v.id}" src="assets/${v.key}.mp4" data-start="${v.start.toFixed(3)}" data-media-start="0" data-duration="${v.duration.toFixed(3)}" muted playsinline></video>`,
|
||||
)
|
||||
.join("\n");
|
||||
const fullVideoEls = videos
|
||||
.filter((v) => v.fullCanvas)
|
||||
.map(
|
||||
(v) =>
|
||||
` <video class="assembly" id="${v.id}" src="assets/${v.key}.mp4" data-start="${v.start.toFixed(3)}" data-media-start="0" data-duration="${v.duration.toFixed(3)}" muted playsinline></video>`,
|
||||
)
|
||||
.join("\n");
|
||||
// Continuous ambient pad under the WHOLE timeline (intro -> outro ->
|
||||
// assembly), via Hyperframes' native <audio> element + data-volume.
|
||||
const audioEl = ` <audio id="ambient" src="${AMBIENT_SRC}" data-start="0" data-media-start="0" data-duration="${total}" data-volume="${AMBIENT_VOLUME}"></audio>`;
|
||||
|
||||
const cardEls = cards
|
||||
.map((c) => cardMarkup(c.id, TITLE_CARDS[c.key], c.intro))
|
||||
.join("\n");
|
||||
|
||||
// Serialize the card timing for the in-page GSAP builder.
|
||||
const cardConfig = JSON.stringify(
|
||||
cards.map((c) => ({ id: c.id, intro: c.intro, appear: Number(c.appear.toFixed(3)), fadeOut: Number(c.fadeOut.toFixed(3)) })),
|
||||
);
|
||||
|
||||
const promoHtml = `<template>
|
||||
<style>
|
||||
* { margin:0; padding:0; box-sizing:border-box; }
|
||||
#root {
|
||||
position:absolute; inset:0; overflow:hidden; background:#05070d;
|
||||
font-family:-apple-system,'Helvetica Neue',Arial,sans-serif; color:#fff;
|
||||
}
|
||||
|
||||
/* ---- Real-data margins: left = live HOLLOW_DEMO_FIXTURE seed values,
|
||||
right = the real Wave-1 fix callouts (WAVE1_FIX_CALLOUTS). Both
|
||||
templated from source at build time, never hand-typed. ---- */
|
||||
.panel { position:absolute; top:0; bottom:0; width:700px; padding:56px 44px; }
|
||||
.panel.left { left:0; }
|
||||
.panel.right { right:0; text-align:right; }
|
||||
.heading { color:#4f9dff; letter-spacing:0.16em; font-size:18px; font-weight:700; text-transform:uppercase; margin-bottom:24px; }
|
||||
.line { font-size:21px; line-height:1.6; color:#c3cde3; margin-bottom:11px; }
|
||||
|
||||
/* ---- Centered phone region: real recorded footage at the EXACT capture
|
||||
aspect (${phoneW}x${PHONE_H}) so nothing is cropped. ---- */
|
||||
#phone {
|
||||
position:absolute; left:${phoneLeft}px; top:${phoneTop}px; width:${phoneW}px; height:${PHONE_H}px;
|
||||
box-shadow:0 24px 70px rgba(0,0,0,0.55); background:#000;
|
||||
}
|
||||
.bg { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
|
||||
|
||||
/* ---- Full-screen in-universe title cards: dark (#05070d) overlays that
|
||||
crossfade over the footage. Dark throughout -> every cut is
|
||||
dark->dark, no white flash. ---- */
|
||||
.card {
|
||||
position:absolute; inset:0; z-index:50; background:#05070d;
|
||||
display:flex; flex-direction:column; align-items:center; justify-content:center;
|
||||
text-align:center; padding:0 60px; pointer-events:none; will-change:opacity;
|
||||
}
|
||||
.glow { position:absolute; width:900px; height:900px; border-radius:50%;
|
||||
background:radial-gradient(circle, rgba(22,119,255,0.35) 0%, rgba(22,119,255,0) 70%); filter:blur(10px); }
|
||||
.eyebrow { color:#4f9dff; letter-spacing:0.4em; font-size:20px; font-weight:600; text-transform:uppercase; }
|
||||
.title { color:#f5f7ff; font-size:72px; font-weight:800; letter-spacing:-0.02em; margin-top:18px; line-height:1.05; max-width:1200px; }
|
||||
.rule { width:110px; height:4px; background:#1677FF; margin-top:26px; transform-origin:center; }
|
||||
.tagline { color:#9fb3d9; font-size:26px; font-weight:400; margin-top:26px; max-width:860px; }
|
||||
|
||||
/* ---- Assembly two-device scene: a pre-composited full-canvas 1920x1080
|
||||
clip (its own symmetric letterbox + baked fade in/out). Sits above
|
||||
the phone/margins and BELOW the cards (z<50) so the outro card
|
||||
fades out to reveal it. The renderer shows it only in its window. ---- */
|
||||
.assembly { position:absolute; inset:0; z-index:45; width:100%; height:100%; object-fit:cover; display:block; background:#000; }
|
||||
</style>
|
||||
|
||||
<div id="root" data-composition-id="promo" data-width="${CANVAS_W}" data-height="${CANVAS_H}" data-duration="${total}">
|
||||
<div id="phone">
|
||||
${phoneVideoEls}
|
||||
</div>
|
||||
|
||||
${fullVideoEls}
|
||||
${audioEl}
|
||||
|
||||
<div class="panel left">
|
||||
<div class="heading">The Hollow · live seed data</div>
|
||||
${leftItems}
|
||||
</div>
|
||||
|
||||
<div class="panel right">
|
||||
<div class="heading">Wave-1 fixes, shown live</div>
|
||||
${rightItems}
|
||||
</div>
|
||||
|
||||
${cardEls}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
const CARDS = ${cardConfig};
|
||||
|
||||
for (const c of CARDS) {
|
||||
const sel = '#' + c.id;
|
||||
const appear = c.appear; // when the card starts to appear
|
||||
const fadeOut = c.fadeOut; // when the card starts to leave
|
||||
const gone = fadeOut + ${CARD_OUT}; // when the card is fully gone
|
||||
|
||||
// Opacity: intro is opaque from its first frame; act cards crossfade in
|
||||
// (ease-OUT landing). All crossfade out (ease-IN leaving).
|
||||
if (c.intro) {
|
||||
tl.set(sel, { opacity: 1 }, appear);
|
||||
} else {
|
||||
tl.fromTo(sel, { opacity: 0 }, { opacity: 1, duration: ${CARD_IN}, ease: 'power2.out' }, appear);
|
||||
}
|
||||
tl.to(sel, { opacity: 0, duration: ${CARD_OUT}, ease: 'power2.in' }, fadeOut);
|
||||
|
||||
// Kinetic-typography reveal (ease-out rises), anchored to the card's
|
||||
// appearance. Same cadence as the Stage-1 intro card.
|
||||
tl.fromTo(sel + ' .eyebrow', { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.6, ease: 'power2.out' }, appear + 0.15);
|
||||
tl.fromTo(sel + ' .title', { opacity: 0, y: 20 }, { opacity: 1, y: 0, duration: 0.7, ease: 'power2.out' }, appear + 0.45);
|
||||
tl.fromTo(sel + ' .rule', { scaleX: 0 }, { scaleX: 1, duration: 0.6, ease: 'power3.out' }, appear + 0.95);
|
||||
tl.fromTo(sel + ' .tagline', { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.6, ease: 'power2.out' }, appear + 1.3);
|
||||
|
||||
// Slow continuous glow "breath" across the whole visible window so no
|
||||
// card hold is a run of identical frames.
|
||||
tl.fromTo(sel + ' .glow', { scale: 1, opacity: 0.9 }, { scale: 1.12, opacity: 1, duration: Math.max(0.3, gone - appear), ease: 'sine.inOut' }, appear);
|
||||
}
|
||||
|
||||
// No separate closing fade: the Assembly clip's own baked 0.6s
|
||||
// fade-out-to-black closes the whole film on black.
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines.promo = tl;
|
||||
</script>
|
||||
</template>
|
||||
`;
|
||||
|
||||
const indexHtml = `<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>The Commons · OpenMotion full main tour (stage 2)</title>
|
||||
<script src="assets/gsap.min.js"></script>
|
||||
<style>body{margin:0;background:#000}#main{position:relative;width:${CANVAS_W}px;height:${CANVAS_H}px;overflow:hidden}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main" data-composition-id="main" data-start="0" data-duration="${total}" data-width="${CANVAS_W}" data-height="${CANVAS_H}" data-fps="${FPS}">
|
||||
<div id="promo" class="clip"
|
||||
data-composition-id="promo"
|
||||
data-composition-src="compositions/promo.html"
|
||||
data-start="0" data-duration="${total}" data-track-index="0"
|
||||
data-width="${CANVAS_W}" data-height="${CANVAS_H}"></div>
|
||||
</div>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines.main = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
||||
mkdirSync(COMPOSITIONS_DIR, { recursive: true });
|
||||
mkdirSync(ASSETS_DIR, { recursive: true });
|
||||
writeFileSync(resolve(COMPOSITIONS_DIR, "promo.html"), promoHtml);
|
||||
writeFileSync(resolve(OM_DIR, "index.html"), indexHtml);
|
||||
|
||||
// gsap is tooling (not app code); reuse the Stage-1 POC's local copy.
|
||||
const gsapSrc = resolve(OM_DIR, "..", "openmotion-poc", "assets", "gsap.min.js");
|
||||
const gsapDst = resolve(ASSETS_DIR, "gsap.min.js");
|
||||
if (!existsSync(gsapDst)) copyFileSync(gsapSrc, gsapDst);
|
||||
|
||||
console.log("Composition built.");
|
||||
console.log(` total duration : ${total}s (${Math.round(total * FPS)} frames @ ${FPS}fps)`);
|
||||
console.log(` phone box : ${phoneW}x${PHONE_H} (video ${videoSize.width}x${videoSize.height}, aspect-exact)`);
|
||||
console.log(" cards :", cards.map((c) => `${c.id}[appear ${c.appear.toFixed(2)} fadeOut ${c.fadeOut.toFixed(2)}]`).join(", "));
|
||||
console.log(" videos :", videos.map((v) => `${v.key}[start ${v.start.toFixed(2)} dur ${v.duration.toFixed(2)}${v.fullCanvas ? " full" : ""}]`).join(", "));
|
||||
console.log(` ambient : ${AMBIENT_SRC} @ data-volume ${AMBIENT_VOLUME} over ${total}s`);
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,241 @@
|
||||
{
|
||||
"recordedAt": "2026-11-19T21:11:08.685Z",
|
||||
"videoSize": {
|
||||
"width": 828,
|
||||
"height": 1792
|
||||
},
|
||||
"clipFps": 30,
|
||||
"webmDurationS": 40.64,
|
||||
"marks": {
|
||||
"gridReady": 0.949,
|
||||
"introEnd": 4.074,
|
||||
"act1End": 12.658,
|
||||
"act2End": 24.556,
|
||||
"act3End": 35.075,
|
||||
"epilogueEnd": 40.026
|
||||
},
|
||||
"clips": [
|
||||
{
|
||||
"name": "intro",
|
||||
"path": "assets/intro.mp4",
|
||||
"durationS": 2.7,
|
||||
"srcStartS": 1.413557687503123,
|
||||
"srcEndS": 4.136495278069255
|
||||
},
|
||||
{
|
||||
"name": "act1",
|
||||
"path": "assets/act1.mp4",
|
||||
"durationS": 8.7,
|
||||
"srcStartS": 4.136495278069255,
|
||||
"srcEndS": 12.85217408684355
|
||||
},
|
||||
{
|
||||
"name": "act2",
|
||||
"path": "assets/act2.mp4",
|
||||
"durationS": 12.07,
|
||||
"srcStartS": 12.85217408684355,
|
||||
"srcEndS": 24.93268975166142
|
||||
},
|
||||
{
|
||||
"name": "act3",
|
||||
"path": "assets/act3.mp4",
|
||||
"durationS": 10.67,
|
||||
"srcStartS": 24.93268975166142,
|
||||
"srcEndS": 35.61305151651427
|
||||
},
|
||||
{
|
||||
"name": "epilogue",
|
||||
"path": "assets/epilogue.mp4",
|
||||
"durationS": 5,
|
||||
"srcStartS": 35.61305151651427,
|
||||
"srcEndS": 40.64000000000001
|
||||
}
|
||||
],
|
||||
"beats": [
|
||||
{
|
||||
"label": "cold-start",
|
||||
"note": "fresh local Ed25519 identity resolved, honest empty home grid + wallet",
|
||||
"offsetS": 0.949
|
||||
},
|
||||
{
|
||||
"label": "admin-seed",
|
||||
"note": "Load Hollow demo clicked - signed seed.* events appended",
|
||||
"offsetS": 2.315
|
||||
},
|
||||
{
|
||||
"label": "waterwatch-no-false-alert",
|
||||
"note": "flat 2nd reading (7.0 -> 7.05) did NOT fire a false alert - state is \"clean\", not \"alert\"",
|
||||
"offsetS": 4.851
|
||||
},
|
||||
{
|
||||
"label": "waterwatch-corroborating",
|
||||
"note": "genuine spike (7 -> 50) correctly flagged - awaiting a second independent sensor",
|
||||
"offsetS": 6.004
|
||||
},
|
||||
{
|
||||
"label": "waterwatch-alert",
|
||||
"note": "independent kiosk-2 corroborated the spike - real signed alert, Fair Share re-solve triggered",
|
||||
"offsetS": 7.069
|
||||
},
|
||||
{
|
||||
"label": "waterwatch-localization",
|
||||
"note": "real pipe-graph leak localization named a suspected origin node, with a live per-tap arrival countdown for the selected tap",
|
||||
"offsetS": 8.029
|
||||
},
|
||||
{
|
||||
"label": "fairshare-water",
|
||||
"note": "Fair Share's water tile reflects the honesty-anchor chain's re-solved CEEI allocation",
|
||||
"offsetS": 9.261
|
||||
},
|
||||
{
|
||||
"label": "tunnelsafety",
|
||||
"note": "real hazard report appended for the selected corridor segment",
|
||||
"offsetS": 10.533
|
||||
},
|
||||
{
|
||||
"label": "findfamily",
|
||||
"note": "on-device private-set-intersection search resolved - the query never left the device",
|
||||
"offsetS": 11.662
|
||||
},
|
||||
{
|
||||
"label": "farms-forecast",
|
||||
"note": "real GDD + LP optimizer forecast (1 temp reading, 1 plot, 1 crop) -> 200.00 kg",
|
||||
"offsetS": 12.902
|
||||
},
|
||||
{
|
||||
"label": "fairshare-food",
|
||||
"note": "Farms' real forecast fed Fair Share's second cross-mini-app integration edge - food tile re-solved",
|
||||
"offsetS": 14.126
|
||||
},
|
||||
{
|
||||
"label": "housing",
|
||||
"note": "Housing shows a real assigned room slot from the seeded assignment cycle, not a permanent empty state",
|
||||
"offsetS": 15.205
|
||||
},
|
||||
{
|
||||
"label": "housing-report-idle-space",
|
||||
"note": "a resident reported a real idle space through the real form - available to the next assignment cycle",
|
||||
"offsetS": 16.065
|
||||
},
|
||||
{
|
||||
"label": "housing-run-cycle",
|
||||
"note": "the resident-facing 'Run assignment cycle' button recorded a new real housing.assignment cycle against the current fairness-debt ledger",
|
||||
"offsetS": 16.767
|
||||
},
|
||||
{
|
||||
"label": "mentor",
|
||||
"note": "Mentor shows a real at-risk skill card (deduped dependents count) from the seeded skill-holder data",
|
||||
"offsetS": 17.838
|
||||
},
|
||||
{
|
||||
"label": "mentor-apprentice-match",
|
||||
"note": "rating yourself 'Again' created a real apprentice need; the real matching engine scores the mentor pool honestly",
|
||||
"offsetS": 18.662
|
||||
},
|
||||
{
|
||||
"label": "healthpost-triage",
|
||||
"note": "real WHO-IMCI classification from a full exam: \"Needs treatment\"",
|
||||
"offsetS": 20.054
|
||||
},
|
||||
{
|
||||
"label": "healthpost-send-to-clinician",
|
||||
"note": "the real 'Send to clinician' button posted a signed healthpost.referral event to the clinician queue",
|
||||
"offsetS": 21.051
|
||||
},
|
||||
{
|
||||
"label": "lightclock-manual-fallback",
|
||||
"note": "no motion sensor available - the real sensor-first/manual-fallback contract switched to the manual log form",
|
||||
"offsetS": 22.164
|
||||
},
|
||||
{
|
||||
"label": "lightclock",
|
||||
"note": "manual sleep/wake log entry added and circadian status computed",
|
||||
"offsetS": 22.26
|
||||
},
|
||||
{
|
||||
"label": "theclimb",
|
||||
"note": "real shaft/wave-demand/surface-capacity schedule fed to the min-cost-flow congestion engine",
|
||||
"offsetS": 23.562
|
||||
},
|
||||
{
|
||||
"label": "assembly-seeded",
|
||||
"note": "demo-seeded roster (Aria, Kade) and an open proposal visible cold, no manual setup",
|
||||
"offsetS": 24.64
|
||||
},
|
||||
{
|
||||
"label": "assembly-create-proposal",
|
||||
"note": "a new proposal was created through the real form",
|
||||
"offsetS": 25.357
|
||||
},
|
||||
{
|
||||
"label": "assembly-add-resident",
|
||||
"note": "a new resident was added to the roster through the real form",
|
||||
"offsetS": 26.052
|
||||
},
|
||||
{
|
||||
"label": "assembly-vote",
|
||||
"note": "a direct vote was cast on the new proposal and the status readout updated live",
|
||||
"offsetS": 26.732
|
||||
},
|
||||
{
|
||||
"label": "assembly-qv-tally",
|
||||
"note": "the QV tally is no longer stuck at zero (Wave-1 fix: QV credit granted on the real roster/proposal lifecycle)",
|
||||
"offsetS": 27.562
|
||||
},
|
||||
{
|
||||
"label": "fairdraw-commit",
|
||||
"note": "a signed commit hash was published BEFORE any reveal - \"5a6af386957ffb6d...\" - re-rolling after this point is auditable and rejected",
|
||||
"offsetS": 28.685
|
||||
},
|
||||
{
|
||||
"label": "fairdraw-reveal",
|
||||
"note": "real commit -> reveal -> verify cycle: \"Winner: You\", badge state \"verified\"",
|
||||
"offsetS": 29.687
|
||||
},
|
||||
{
|
||||
"label": "fairdraw-wallet-live",
|
||||
"note": "WalletCard balance updates live on the same route, no reload, from the real Fair Draw win",
|
||||
"offsetS": 30.639
|
||||
},
|
||||
{
|
||||
"label": "fairdraw-history-row",
|
||||
"note": "full transaction history now shows the real signed wallet.issue credit row",
|
||||
"offsetS": 31.344
|
||||
},
|
||||
{
|
||||
"label": "sky-post",
|
||||
"note": "posted to the memory wall; a fast double-click produced exactly one entry, not two (GAP-20 fix)",
|
||||
"offsetS": 32.431
|
||||
},
|
||||
{
|
||||
"label": "sky-mood-pulse",
|
||||
"note": "a real signed mood/morale pulse was posted - the shelter's honest mood is now visible, aggregated from real signed events",
|
||||
"offsetS": 33.625
|
||||
},
|
||||
{
|
||||
"label": "wallet-sig-verified",
|
||||
"note": "independent verifyEntrySignature() re-check confirms the entry's Ed25519 signature is genuine",
|
||||
"offsetS": 35.131
|
||||
},
|
||||
{
|
||||
"label": "wallet-sig-expanded",
|
||||
"note": "raw Ed25519 signature + author public key bytes are directly inspectable, not just a claimed verification",
|
||||
"offsetS": 36.115
|
||||
},
|
||||
{
|
||||
"label": "upload-form-filled",
|
||||
"note": "real manifest form filled + a real HTML file attached via the real file input",
|
||||
"offsetS": 37.22
|
||||
},
|
||||
{
|
||||
"label": "upload-success",
|
||||
"note": "the real uploadMiniapp() storage path accepted the package",
|
||||
"offsetS": 37.916
|
||||
},
|
||||
{
|
||||
"label": "upload-tile-appears",
|
||||
"note": "the uploaded mini-app now appears as a real tile on the home grid",
|
||||
"offsetS": 38.674
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
// STAGE-2 OpenMotion full main-tour: footage capture.
|
||||
//
|
||||
// Records the FULL Acts I-III tour (driven by the shared `runTour()` in
|
||||
// tour.mjs) as ONE continuous real-app Playwright recording - same
|
||||
// viewport, same 2x device scale, same recordVideo mechanism, same single
|
||||
// continuous event-log session as demoVideoFull.e2e.mjs's recordMainScene()
|
||||
// - then slices that one webm into per-act mp4 clips at the act boundaries
|
||||
// the tour marked. One continuous recording (not per-act contexts) keeps
|
||||
// the real "one identity, one signed log, seeded once" continuity and
|
||||
// means exactly ONE first-paint boot (at the very start, trimmed off the
|
||||
// intro clip and covered by the intro title card) with NO reload between
|
||||
// acts - the OpenMotion full-screen GSAP title cards replace the real
|
||||
// tour's inter-act showActTitleCard() cards entirely.
|
||||
//
|
||||
// The act title cards are deliberately NOT captured here; they are rendered
|
||||
// by the OpenMotion composition (see buildComposition.mjs). This script's
|
||||
// only job is genuine per-act app footage + a manifest of clip durations
|
||||
// and beat timings for the composition builder.
|
||||
import { chromium } from "playwright";
|
||||
import { createServer as createViteServer } from "vite";
|
||||
import ffmpegStatic from "ffmpeg-static";
|
||||
import { mkdirSync, rmSync, readdirSync, existsSync, writeFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { runTour, forceLocalIdentityWinsFairDraw } from "./tour.mjs";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const OM_DIR = __dirname;
|
||||
const ROOT = resolve(__dirname, "..", ".."); // worktree root
|
||||
const VIDEO_TMP_DIR = resolve(OM_DIR, ".tmp-capture");
|
||||
const ASSETS_DIR = resolve(OM_DIR, "assets");
|
||||
const MANIFEST_OUT = resolve(OM_DIR, "capture-manifest.json");
|
||||
|
||||
// Same constants as recordMainScene(): a 414x896 phone pane recorded at 2x
|
||||
// device-pixel density (sharp text) -> an 828x1792 raw webm.
|
||||
const PANE = { width: 414, height: 896 };
|
||||
const RECAST_SCALE = 2;
|
||||
const MAIN_VIDEO_SIZE = { width: PANE.width * RECAST_SCALE, height: PANE.height * RECAST_SCALE };
|
||||
const CLIP_FPS = 30; // CFR output so the Hyperframes <video> seek contract is clean
|
||||
|
||||
const VITE_PORT = 45000 + Math.floor(Math.random() * 10000);
|
||||
const APP_URL = `http://127.0.0.1:${VITE_PORT}`;
|
||||
const FFMPEG_BIN = ffmpegStatic;
|
||||
|
||||
// Per-act clip windows, keyed by the boundary marks runTour() records.
|
||||
// Each entry: { name, from: <startMark>, to: <endMark>, leadGuard?: seconds }.
|
||||
const CLIP_SPEC = [
|
||||
{ name: "intro", from: "gridReady", to: "introEnd", leadGuard: 0.45 }, // trim first-paint boot
|
||||
{ name: "act1", from: "introEnd", to: "act1End" },
|
||||
{ name: "act2", from: "act1End", to: "act2End" },
|
||||
{ name: "act3", from: "act2End", to: "act3End" },
|
||||
{ name: "epilogue", from: "act3End", to: "epilogueEnd" }, // Stage-3 Epilogue footage
|
||||
];
|
||||
|
||||
async function startVite() {
|
||||
const vite = await createViteServer({
|
||||
root: ROOT,
|
||||
configFile: resolve(ROOT, "vite.config.ts"),
|
||||
logLevel: "warn",
|
||||
server: { host: "127.0.0.1", port: VITE_PORT, strictPort: true },
|
||||
});
|
||||
await vite.listen();
|
||||
return vite;
|
||||
}
|
||||
|
||||
function probeDurationSeconds(videoPath) {
|
||||
try {
|
||||
execFileSync(FFMPEG_BIN, ["-i", videoPath], { stdio: ["ignore", "pipe", "pipe"] });
|
||||
return null;
|
||||
} catch (e) {
|
||||
const m = String(e.stderr ?? "").match(/Duration: (\d+):(\d+):(\d+\.\d+)/);
|
||||
if (!m) return null;
|
||||
return Number(m[1]) * 3600 + Number(m[2]) * 60 + Number(m[3]);
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log("=== STAGE-2 capture: full Acts I-III tour (real app footage) ===");
|
||||
const vite = await startVite();
|
||||
const videoDir = resolve(VIDEO_TMP_DIR, "main");
|
||||
rmSync(videoDir, { recursive: true, force: true });
|
||||
mkdirSync(videoDir, { recursive: true });
|
||||
|
||||
const browser = await chromium.launch({
|
||||
headless: true,
|
||||
args: ["--no-sandbox", `--force-device-scale-factor=${RECAST_SCALE}`],
|
||||
});
|
||||
const context = await browser.newContext({
|
||||
viewport: PANE,
|
||||
deviceScaleFactor: RECAST_SCALE,
|
||||
recordVideo: { dir: videoDir, size: MAIN_VIDEO_SIZE },
|
||||
});
|
||||
await forceLocalIdentityWinsFairDraw(context);
|
||||
|
||||
const marks = {};
|
||||
const beats = [];
|
||||
const page = await context.newPage();
|
||||
const recordStart = Date.now(); // webm t~=0 anchor (page creation)
|
||||
|
||||
const api = {
|
||||
async mark(name) {
|
||||
marks[name] = (Date.now() - recordStart) / 1000;
|
||||
console.log(`[mark] ${name} @ ${marks[name].toFixed(2)}s`);
|
||||
},
|
||||
async beat(label, note) {
|
||||
beats.push({ label, note, offsetS: (Date.now() - recordStart) / 1000 });
|
||||
console.log(`[beat +${((Date.now() - recordStart) / 1000).toFixed(1)}s] ${label}: ${note}`);
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
await runTour(page, api, APP_URL);
|
||||
} finally {
|
||||
await context.close(); // flushes the .webm
|
||||
await browser.close();
|
||||
await vite.close();
|
||||
}
|
||||
|
||||
const webm = readdirSync(videoDir).find((f) => f.endsWith(".webm"));
|
||||
if (!webm) throw new Error(`no .webm produced in ${videoDir}`);
|
||||
const webmPath = resolve(videoDir, webm);
|
||||
const webmDuration = probeDurationSeconds(webmPath);
|
||||
console.log(`\nRaw webm: ${webmPath} (duration ${webmDuration?.toFixed(2)}s)`);
|
||||
|
||||
// Linear wall-clock -> webm-time correction: recordVideo's t=0 and its
|
||||
// playback rate differ from our wall-clock marks by a small startup
|
||||
// latency + flush, so anchor the two timelines at 0 and at the final
|
||||
// mark (recorded immediately before context.close) by scaling.
|
||||
const lastMark = marks["epilogueEnd"];
|
||||
const scale = webmDuration && lastMark ? webmDuration / lastMark : 1;
|
||||
console.log(`[time] webm/wall scale = ${scale.toFixed(4)} (webm ${webmDuration?.toFixed(2)}s / wall ${lastMark?.toFixed(2)}s)`);
|
||||
const toWebm = (wall) => wall * scale;
|
||||
|
||||
mkdirSync(ASSETS_DIR, { recursive: true });
|
||||
const clips = [];
|
||||
for (const spec of CLIP_SPEC) {
|
||||
const fromWall = marks[spec.from];
|
||||
const toWall = marks[spec.to];
|
||||
if (fromWall == null || toWall == null) throw new Error(`missing mark for clip ${spec.name}: ${spec.from}/${spec.to}`);
|
||||
const start = toWebm(fromWall) + (spec.leadGuard ?? 0);
|
||||
const end = toWebm(toWall);
|
||||
const dur = Math.max(0.1, end - start);
|
||||
const outPath = resolve(ASSETS_DIR, `${spec.name}.mp4`);
|
||||
if (existsSync(outPath)) rmSync(outPath);
|
||||
// Frame-accurate re-encode to CFR 30fps h264 (muted, faststart). -ss
|
||||
// before -i is fast-seek + decode-accurate under re-encode.
|
||||
execFileSync(
|
||||
FFMPEG_BIN,
|
||||
[
|
||||
"-y", "-ss", start.toFixed(3), "-i", webmPath, "-t", dur.toFixed(3),
|
||||
"-vf", `fps=${CLIP_FPS}`, "-c:v", "libx264", "-pix_fmt", "yuv420p",
|
||||
"-an", "-movflags", "+faststart", outPath,
|
||||
],
|
||||
{ stdio: ["ignore", "pipe", "pipe"] },
|
||||
);
|
||||
const outDur = probeDurationSeconds(outPath);
|
||||
clips.push({ name: spec.name, path: `assets/${spec.name}.mp4`, durationS: outDur, srcStartS: start, srcEndS: end });
|
||||
console.log(`[clip] ${spec.name}: ${start.toFixed(2)}-${end.toFixed(2)}s -> ${outPath} (${outDur?.toFixed(2)}s)`);
|
||||
}
|
||||
|
||||
writeFileSync(
|
||||
MANIFEST_OUT,
|
||||
JSON.stringify(
|
||||
{
|
||||
recordedAt: new Date().toISOString(),
|
||||
videoSize: MAIN_VIDEO_SIZE,
|
||||
clipFps: CLIP_FPS,
|
||||
webmDurationS: webmDuration,
|
||||
marks,
|
||||
clips,
|
||||
beats,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
console.log(`\nManifest: ${MANIFEST_OUT}`);
|
||||
console.log(`Clips: ${clips.map((c) => `${c.name}=${c.durationS?.toFixed(1)}s`).join(", ")}`);
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,329 @@
|
||||
// STAGE-3 OpenMotion: Assembly two-device sync scene capture + composite.
|
||||
//
|
||||
// Records the REAL Assembly mini-app driven by TWO genuinely isolated
|
||||
// Playwright browser contexts (separate storage origins) through the real
|
||||
// "Sync with nearby devices" toggle over a real local y-webrtc signaling
|
||||
// server + real WebRTC transport: connect -> transport-proven -> partition
|
||||
// -> heal -> converged. This is the SAME real two-device interaction as
|
||||
// e2e/demoVideoFull.e2e.mjs's recordAssemblySyncScene() - ported here (not
|
||||
// imported) because demoVideoFull.e2e.mjs self-invokes main() on import and
|
||||
// is explicitly off-limits, exactly the Stage-2 rationale for runTour().
|
||||
// Nothing here is fabricated: both device streams are real app recordings.
|
||||
//
|
||||
// The two real device panes are then composited side-by-side and letterboxed
|
||||
// into one 1920x1080 clip with the SAME symmetric-margin convention the
|
||||
// fix-miniapp-gaps-and-demo-video work fixed (scale the 828x896 hstack to
|
||||
// LANDSCAPE_PHONE_HEIGHT=960 and pad to 1920x1080 centered - real margin on
|
||||
// every side, no edge clipping), plus the proven fade-in-from-black (0.5s) /
|
||||
// fade-out-to-black (0.6s) pacing so the scene lands out of the dark outro
|
||||
// card and the whole film closes on a graceful dim-to-black. The OpenMotion
|
||||
// composition then plays this clip as a full-canvas <video> after the outro
|
||||
// card, with the continuous ambient <audio> running underneath.
|
||||
import { chromium } from "playwright";
|
||||
import { createServer as createViteServer } from "vite";
|
||||
import ffmpegStatic from "ffmpeg-static";
|
||||
import { spawn, execFileSync } from "node:child_process";
|
||||
import { mkdirSync, rmSync, writeFileSync, existsSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const OM_DIR = __dirname;
|
||||
const ROOT = resolve(__dirname, "..", ".."); // worktree root
|
||||
const VIDEO_TMP_DIR = resolve(OM_DIR, ".tmp-capture");
|
||||
const ASSETS_DIR = resolve(OM_DIR, "assets");
|
||||
const MANIFEST_OUT = resolve(OM_DIR, "assembly-manifest.json");
|
||||
const FFMPEG_BIN = ffmpegStatic;
|
||||
|
||||
const PANE = { width: 414, height: 896 };
|
||||
const FINAL_W = 1920;
|
||||
const FINAL_H = 1080;
|
||||
const LANDSCAPE_PHONE_HEIGHT = 960; // 60px top/bottom padding on a 1080 canvas
|
||||
|
||||
const SIG_PORT = 44000 + Math.floor(Math.random() * 10000);
|
||||
const VITE_PORT = 45000 + Math.floor(Math.random() * 10000);
|
||||
const SIG = `ws://127.0.0.1:${SIG_PORT}`;
|
||||
const APP_URL = `http://127.0.0.1:${VITE_PORT}`;
|
||||
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
async function waitFor(fn, label, timeoutMs = 20000) {
|
||||
const start = Date.now();
|
||||
let lastErr;
|
||||
while (Date.now() - start < timeoutMs) {
|
||||
try {
|
||||
const v = await fn();
|
||||
if (v) return v;
|
||||
} catch (e) {
|
||||
lastErr = e;
|
||||
}
|
||||
await sleep(150);
|
||||
}
|
||||
throw new Error(`timeout waiting for: ${label}${lastErr ? ` (last error: ${lastErr})` : ""}`);
|
||||
}
|
||||
|
||||
function startSignaling() {
|
||||
return new Promise((resolvePromise, reject) => {
|
||||
const child = spawn("node", ["node_modules/y-webrtc/bin/server.js"], {
|
||||
cwd: ROOT,
|
||||
env: { ...process.env, PORT: String(SIG_PORT) },
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
const to = setTimeout(() => reject(new Error("signaling start timeout")), 10000);
|
||||
child.stdout.on("data", (b) => {
|
||||
if (String(b).includes("Signaling server running")) {
|
||||
clearTimeout(to);
|
||||
resolvePromise(child);
|
||||
}
|
||||
});
|
||||
child.stderr.on("data", (b) => process.stderr.write(`[sig] ${b}`));
|
||||
child.on("exit", (code) => reject(new Error(`signaling exited early: ${code}`)));
|
||||
});
|
||||
}
|
||||
|
||||
async function startVite() {
|
||||
const vite = await createViteServer({
|
||||
root: ROOT,
|
||||
configFile: resolve(ROOT, "vite.config.ts"),
|
||||
logLevel: "warn",
|
||||
server: { host: "127.0.0.1", port: VITE_PORT, strictPort: true },
|
||||
});
|
||||
await vite.listen();
|
||||
return vite;
|
||||
}
|
||||
|
||||
function probeDurationSeconds(videoPath) {
|
||||
try {
|
||||
execFileSync(FFMPEG_BIN, ["-i", videoPath], { stdio: ["ignore", "pipe", "pipe"] });
|
||||
return null;
|
||||
} catch (e) {
|
||||
const m = String(e.stderr ?? "").match(/Duration: (\d+):(\d+):(\d+\.\d+)/);
|
||||
if (!m) return null;
|
||||
return Number(m[1]) * 3600 + Number(m[2]) * 60 + Number(m[3]);
|
||||
}
|
||||
}
|
||||
|
||||
// Records the two isolated device panes through the real Assembly screen.
|
||||
async function recordAssemblySyncScene() {
|
||||
console.log("\n=== Assembly real-screen sync (two isolated devices) ===");
|
||||
const videoDirA = resolve(VIDEO_TMP_DIR, "assembly-deviceA");
|
||||
const videoDirB = resolve(VIDEO_TMP_DIR, "assembly-deviceB");
|
||||
rmSync(videoDirA, { recursive: true, force: true });
|
||||
rmSync(videoDirB, { recursive: true, force: true });
|
||||
mkdirSync(videoDirA, { recursive: true });
|
||||
mkdirSync(videoDirB, { recursive: true });
|
||||
|
||||
const sig = await startSignaling();
|
||||
const browser = await chromium.launch({ headless: true, args: ["--no-sandbox"] });
|
||||
const ctxA = await browser.newContext({ viewport: PANE, recordVideo: { dir: videoDirA, size: PANE } });
|
||||
const ctxB = await browser.newContext({ viewport: PANE, recordVideo: { dir: videoDirB, size: PANE } });
|
||||
|
||||
const sigState = { blockSig: false };
|
||||
for (const ctx of [ctxA, ctxB]) {
|
||||
await ctx.routeWebSocket(new RegExp(`127\\.0\\.0\\.1:${SIG_PORT}`), (ws) => {
|
||||
if (sigState.blockSig) {
|
||||
ws.close();
|
||||
return;
|
||||
}
|
||||
ws.connectToServer();
|
||||
});
|
||||
}
|
||||
|
||||
const pageA = await ctxA.newPage();
|
||||
const pageB = await ctxB.newPage();
|
||||
const sceneStartRef = { value: Date.now() };
|
||||
const beats = [];
|
||||
const room = `full-demo-${Math.random().toString(36).slice(2)}`;
|
||||
const ASSEMBLY_URL = `${APP_URL}/miniapp/assembly`;
|
||||
const ENGINE_MODULE_URL = `${APP_URL}/src/miniapps/assembly/useAssemblyEngine.ts`;
|
||||
const ASSEMBLY_LIB_URL = `${APP_URL}/src/lib/assembly.ts`;
|
||||
|
||||
async function beat(label, note) {
|
||||
const offsetS = (Date.now() - sceneStartRef.value) / 1000;
|
||||
beats.push({ label, note, offsetS });
|
||||
console.log(`[assembly +${offsetS.toFixed(1)}s] ${label}: ${note}`);
|
||||
}
|
||||
|
||||
async function setSyncTransportOverride(page) {
|
||||
await page.evaluate(
|
||||
async ({ moduleUrl, room, signaling }) => {
|
||||
const mod = await import(/* @vite-ignore */ moduleUrl);
|
||||
mod.setAssemblySyncTransportOverrideForTesting({
|
||||
room,
|
||||
signaling: [signaling],
|
||||
peerOpts: { config: { iceServers: [] } },
|
||||
});
|
||||
},
|
||||
{ moduleUrl: ENGINE_MODULE_URL, room, signaling: SIG },
|
||||
);
|
||||
}
|
||||
|
||||
async function readPeerCount(page) {
|
||||
const el = page.getByTestId("assembly-peer-count");
|
||||
if ((await el.count()) === 0) return 0;
|
||||
const text = (await el.textContent()) ?? "";
|
||||
const match = text.match(/Connected to (\d+)/);
|
||||
return match ? Number(match[1]) : 0;
|
||||
}
|
||||
|
||||
try {
|
||||
await pageA.goto(ASSEMBLY_URL, { waitUntil: "load" });
|
||||
await pageB.goto(ASSEMBLY_URL, { waitUntil: "load" });
|
||||
await pageA.getByTestId("assembly-sync-toggle").waitFor({ state: "visible" });
|
||||
await pageB.getByTestId("assembly-sync-toggle").waitFor({ state: "visible" });
|
||||
await setSyncTransportOverride(pageA);
|
||||
await setSyncTransportOverride(pageB);
|
||||
await beat("boot", "two genuinely isolated devices (separate storage origins) open the real Assembly screen; sync is honestly off by default");
|
||||
await sleep(650);
|
||||
|
||||
// 1. Connect through the real UI toggle.
|
||||
await pageA.getByTestId("assembly-sync-toggle").click();
|
||||
await pageB.getByTestId("assembly-sync-toggle").click();
|
||||
await waitFor(async () => (await readPeerCount(pageA)) >= 1, "device A connects");
|
||||
await waitFor(async () => (await readPeerCount(pageB)) >= 1, "device B connects");
|
||||
await beat("connected", "real WebRTC transport connected over a local signaling server - both devices see a live peer count");
|
||||
await sleep(600);
|
||||
|
||||
// 2. Prove the transport genuinely carries data: a proposal seeded on A
|
||||
// (via the real putProposal production function) arrives on B.
|
||||
await pageA.evaluate(
|
||||
async ({ engineUrl, libUrl, proposal }) => {
|
||||
const engineMod = await import(/* @vite-ignore */ engineUrl);
|
||||
const libMod = await import(/* @vite-ignore */ libUrl);
|
||||
const { assembly } = engineMod.getAssemblyEngineForTesting(engineMod.DEFAULT_ASSEMBLY_DB_NAME);
|
||||
libMod.putProposal(assembly, proposal);
|
||||
},
|
||||
{
|
||||
engineUrl: ENGINE_MODULE_URL,
|
||||
libUrl: ASSEMBLY_LIB_URL,
|
||||
proposal: {
|
||||
id: "sync-demo-prop",
|
||||
title: "Install solar lanterns on the east path",
|
||||
description: "Seeded on device A only - must arrive on device B purely over WebRTC.",
|
||||
authorId: "seed",
|
||||
createdAt: Date.now(),
|
||||
status: "open",
|
||||
},
|
||||
},
|
||||
);
|
||||
await waitFor(
|
||||
async () => (await pageB.getByTestId("assembly-proposal-sync-demo-prop").count()) > 0,
|
||||
"device B receives device A's proposal over real WebRTC",
|
||||
);
|
||||
await beat("transport-proven", "a proposal created on device A arrived on device B purely over the real WebRTC transport - B's own IndexedDB never had it");
|
||||
await sleep(750);
|
||||
|
||||
// 3. Partition: toggle sync OFF on both sides (real teardown) + block
|
||||
// signaling + go offline, as defense in depth.
|
||||
sigState.blockSig = true;
|
||||
await ctxA.setOffline(true);
|
||||
await ctxB.setOffline(true);
|
||||
await pageA.getByTestId("assembly-sync-toggle").click();
|
||||
await pageB.getByTestId("assembly-sync-toggle").click();
|
||||
await waitFor(async () => (await pageA.getByTestId("assembly-peer-count").count()) === 0, "device A's peer indicator disappears");
|
||||
await waitFor(async () => (await pageB.getByTestId("assembly-peer-count").count()) === 0, "device B's peer indicator disappears");
|
||||
|
||||
await pageA.getByTestId(`assembly-vote-yes-sync-demo-prop`).click();
|
||||
await pageB.getByTestId(`assembly-vote-no-sync-demo-prop`).click();
|
||||
await sleep(500);
|
||||
const aSeesB = await pageA.getByTestId("assembly-vote-status-sync-demo-prop").textContent();
|
||||
const bSeesA = await pageB.getByTestId("assembly-vote-status-sync-demo-prop").textContent();
|
||||
await beat(
|
||||
"partitioned",
|
||||
`both devices genuinely isolated (peer count 0, network offline, signaling blocked) - independent votes cast (A sees "${aSeesB?.trim()}", B sees "${bSeesA?.trim()}")`,
|
||||
);
|
||||
await sleep(750);
|
||||
|
||||
// 4. Heal: restore network + signaling, toggle sync back on, converge.
|
||||
sigState.blockSig = false;
|
||||
await ctxA.setOffline(false);
|
||||
await ctxB.setOffline(false);
|
||||
await pageA.getByTestId("assembly-sync-toggle").click();
|
||||
await pageB.getByTestId("assembly-sync-toggle").click();
|
||||
await waitFor(async () => (await readPeerCount(pageA)) >= 1, "device A reconnects");
|
||||
await waitFor(async () => (await readPeerCount(pageB)) >= 1, "device B reconnects");
|
||||
await sleep(600);
|
||||
await beat("healed-reconnected", "both devices reconnected after the partition - real WebrtcProvider re-established");
|
||||
await sleep(1000);
|
||||
} finally {
|
||||
await ctxA.close();
|
||||
await ctxB.close();
|
||||
await browser.close();
|
||||
sig.kill("SIGKILL");
|
||||
}
|
||||
|
||||
const videoPathA = await pageA.video().path();
|
||||
const videoPathB = await pageB.video().path();
|
||||
console.log(`Assembly recorded: deviceA=${videoPathA} deviceB=${videoPathB} (${((Date.now() - sceneStartRef.value) / 1000).toFixed(1)}s wall-clock)`);
|
||||
return { videoPathA, videoPathB, beats };
|
||||
}
|
||||
|
||||
// Composites the two real device panes side-by-side, then letterboxes the
|
||||
// 828x896 stack into the final 1920x1080 canvas with symmetric margins
|
||||
// (scale to LANDSCAPE_PHONE_HEIGHT=960, pad centered) - the F3 letterbox fix
|
||||
// - plus fade-in-from-black (0.5s) and fade-out-to-black (0.6s).
|
||||
const LEAD_TRIM = 0.8; // skip each device page's blank/white React-mount boot frames before the fade
|
||||
|
||||
function compositeSideBySide(videoPathA, videoPathB, outPath) {
|
||||
mkdirSync(dirname(outPath), { recursive: true });
|
||||
const durA = probeDurationSeconds(videoPathA);
|
||||
const durB = probeDurationSeconds(videoPathB);
|
||||
// hstack ends at the shorter input; both are trimmed by LEAD_TRIM up front.
|
||||
const dur = Math.max(0.1, Math.min(durA ?? 10, durB ?? 10) - LEAD_TRIM);
|
||||
const fadeOutStart = Math.max(0, dur - 0.6);
|
||||
// -ss before each -i trims the white boot frames so the fade-in lands on the
|
||||
// real Assembly screen (never on a bright blank mount) - the outro card
|
||||
// above and this 0.5s fade-in-from-black then make the cut dark->dark.
|
||||
const filter =
|
||||
`[0:v]scale=${PANE.width}:${PANE.height},setsar=1,fps=30[v0];` +
|
||||
`[1:v]scale=${PANE.width}:${PANE.height},setsar=1,fps=30[v1];` +
|
||||
"[v0][v1]hstack=inputs=2[stacked];" +
|
||||
`[stacked]scale=-2:${LANDSCAPE_PHONE_HEIGHT},pad=${FINAL_W}:${FINAL_H}:(ow-iw)/2:(oh-ih)/2:color=black,setsar=1,` +
|
||||
`fade=t=in:st=0:d=0.5,fade=t=out:st=${fadeOutStart.toFixed(2)}:d=0.6[v]`;
|
||||
execFileSync(FFMPEG_BIN, [
|
||||
"-y",
|
||||
"-ss", String(LEAD_TRIM), "-i", videoPathA,
|
||||
"-ss", String(LEAD_TRIM), "-i", videoPathB,
|
||||
"-filter_complex", filter, "-map", "[v]",
|
||||
"-c:v", "libx264", "-pix_fmt", "yuv420p", "-movflags", "+faststart",
|
||||
outPath,
|
||||
], { stdio: ["ignore", "pipe", "pipe"] });
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log("=== STAGE-3 capture: Assembly two-device sync scene (real app footage) ===");
|
||||
const vite = await startVite();
|
||||
let scene;
|
||||
try {
|
||||
scene = await recordAssemblySyncScene();
|
||||
} finally {
|
||||
await vite.close();
|
||||
}
|
||||
|
||||
mkdirSync(ASSETS_DIR, { recursive: true });
|
||||
const outPath = resolve(ASSETS_DIR, "assembly.mp4");
|
||||
if (existsSync(outPath)) rmSync(outPath);
|
||||
compositeSideBySide(scene.videoPathA, scene.videoPathB, outPath);
|
||||
const outDur = probeDurationSeconds(outPath);
|
||||
console.log(`[assembly] composite -> ${outPath} (${outDur?.toFixed(2)}s, 1920x1080)`);
|
||||
|
||||
writeFileSync(
|
||||
MANIFEST_OUT,
|
||||
JSON.stringify(
|
||||
{
|
||||
recordedAt: new Date().toISOString(),
|
||||
canvas: { width: FINAL_W, height: FINAL_H },
|
||||
clip: { name: "assembly", path: "assets/assembly.mp4", durationS: outDur },
|
||||
beats: scene.beats,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
console.log(`\nAssembly manifest: ${MANIFEST_OUT}`);
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<style>
|
||||
* { margin:0; padding:0; box-sizing:border-box; }
|
||||
#root {
|
||||
position:absolute; inset:0; overflow:hidden; background:#05070d;
|
||||
font-family:-apple-system,'Helvetica Neue',Arial,sans-serif; color:#fff;
|
||||
}
|
||||
|
||||
/* ---- Real-data margins: left = live HOLLOW_DEMO_FIXTURE seed values,
|
||||
right = the real Wave-1 fix callouts (WAVE1_FIX_CALLOUTS). Both
|
||||
templated from source at build time, never hand-typed. ---- */
|
||||
.panel { position:absolute; top:0; bottom:0; width:700px; padding:56px 44px; }
|
||||
.panel.left { left:0; }
|
||||
.panel.right { right:0; text-align:right; }
|
||||
.heading { color:#4f9dff; letter-spacing:0.16em; font-size:18px; font-weight:700; text-transform:uppercase; margin-bottom:24px; }
|
||||
.line { font-size:21px; line-height:1.6; color:#c3cde3; margin-bottom:11px; }
|
||||
|
||||
/* ---- Centered phone region: real recorded footage at the EXACT capture
|
||||
aspect (443.57x960) so nothing is cropped. ---- */
|
||||
#phone {
|
||||
position:absolute; left:738.22px; top:60px; width:443.57px; height:960px;
|
||||
box-shadow:0 24px 70px rgba(0,0,0,0.55); background:#000;
|
||||
}
|
||||
.bg { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
|
||||
|
||||
/* ---- Full-screen in-universe title cards: dark (#05070d) overlays that
|
||||
crossfade over the footage. Dark throughout -> every cut is
|
||||
dark->dark, no white flash. ---- */
|
||||
.card {
|
||||
position:absolute; inset:0; z-index:50; background:#05070d;
|
||||
display:flex; flex-direction:column; align-items:center; justify-content:center;
|
||||
text-align:center; padding:0 60px; pointer-events:none; will-change:opacity;
|
||||
}
|
||||
.glow { position:absolute; width:900px; height:900px; border-radius:50%;
|
||||
background:radial-gradient(circle, rgba(22,119,255,0.35) 0%, rgba(22,119,255,0) 70%); filter:blur(10px); }
|
||||
.eyebrow { color:#4f9dff; letter-spacing:0.4em; font-size:20px; font-weight:600; text-transform:uppercase; }
|
||||
.title { color:#f5f7ff; font-size:72px; font-weight:800; letter-spacing:-0.02em; margin-top:18px; line-height:1.05; max-width:1200px; }
|
||||
.rule { width:110px; height:4px; background:#1677FF; margin-top:26px; transform-origin:center; }
|
||||
.tagline { color:#9fb3d9; font-size:26px; font-weight:400; margin-top:26px; max-width:860px; }
|
||||
|
||||
/* ---- Assembly two-device scene: a pre-composited full-canvas 1920x1080
|
||||
clip (its own symmetric letterbox + baked fade in/out). Sits above
|
||||
the phone/margins and BELOW the cards (z<50) so the outro card
|
||||
fades out to reveal it. The renderer shows it only in its window. ---- */
|
||||
.assembly { position:absolute; inset:0; z-index:45; width:100%; height:100%; object-fit:cover; display:block; background:#000; }
|
||||
</style>
|
||||
|
||||
<div id="root" data-composition-id="promo" data-width="1920" data-height="1080" data-duration="62.81">
|
||||
<div id="phone">
|
||||
<video class="bg" id="vid-intro" src="assets/intro.mp4" data-start="3.000" data-media-start="0" data-duration="2.700" muted playsinline></video>
|
||||
<video class="bg" id="vid-act1" src="assets/act1.mp4" data-start="8.300" data-media-start="0" data-duration="8.700" muted playsinline></video>
|
||||
<video class="bg" id="vid-act2" src="assets/act2.mp4" data-start="19.600" data-media-start="0" data-duration="12.070" muted playsinline></video>
|
||||
<video class="bg" id="vid-act3" src="assets/act3.mp4" data-start="34.270" data-media-start="0" data-duration="10.670" muted playsinline></video>
|
||||
<video class="bg" id="vid-epilogue" src="assets/epilogue.mp4" data-start="47.540" data-media-start="0" data-duration="5.000" muted playsinline></video>
|
||||
</div>
|
||||
|
||||
<video class="assembly" id="vid-assembly" src="assets/assembly.mp4" data-start="55.540" data-media-start="0" data-duration="7.270" muted playsinline></video>
|
||||
<audio id="ambient" src="assets/ambient.mp3" data-start="0" data-media-start="0" data-duration="62.81" data-volume="0.3"></audio>
|
||||
|
||||
<div class="panel left">
|
||||
<div class="heading">The Hollow · live seed data</div>
|
||||
<div class="line">Population: 4,200</div>
|
||||
<div class="line">Power pool: 850</div>
|
||||
<div class="line">Water pool: 620</div>
|
||||
<div class="line">Food pool: 410</div>
|
||||
<div class="line">Cooling pool: 300</div>
|
||||
<div class="line">water-ph: 7.1</div>
|
||||
<div class="line">grid-frequency-hz: 59.98</div>
|
||||
<div class="line">ambient-temp-c: 21.4</div>
|
||||
</div>
|
||||
|
||||
<div class="panel right">
|
||||
<div class="heading">Wave-1 fixes, shown live</div>
|
||||
<div class="line">flat 2nd reading (7.0 -> 7.05) did NOT fire a false alert</div>
|
||||
<div class="line">real pipe-graph leak localization named a suspected origin node</div>
|
||||
<div class="line">real GDD + LP optimizer forecast (1 temp reading, 1 plot, 1 crop) -> 200.00 kg</div>
|
||||
<div class="line">the resident-facing 'Run assignment cycle' button recorded a new real housing.assignment cycle</div>
|
||||
<div class="line">the QV tally is no longer stuck at zero (Wave-1 fix: QV credit granted on the real roster/proposal lifecycle)</div>
|
||||
<div class="line">a fast double-click produced exactly one entry, not two (GAP-20 fix)</div>
|
||||
</div>
|
||||
|
||||
<div class="card" id="card-intro" style="">
|
||||
<div class="glow"></div>
|
||||
<div class="eyebrow">The Hollow, tonight</div>
|
||||
<div class="title">Who do you trust when the water turns bad?</div>
|
||||
<div class="rule"></div>
|
||||
<div class="tagline">4,200 residents underground, cut off from the surface. No server. No central login.</div>
|
||||
</div>
|
||||
<div class="card" id="card-act1" style="opacity:0;">
|
||||
<div class="glow"></div>
|
||||
<div class="eyebrow">Act I</div>
|
||||
<div class="title">A Crisis, Verified Twice</div>
|
||||
<div class="rule"></div>
|
||||
<div class="tagline">4,200 residents. No surface supply line. A bad water reading could be noise - it takes two independent sensors before the shelter trusts it.</div>
|
||||
</div>
|
||||
<div class="card" id="card-act2" style="opacity:0;">
|
||||
<div class="glow"></div>
|
||||
<div class="eyebrow">Act II</div>
|
||||
<div class="title">Keeping the Hollow Alive</div>
|
||||
<div class="rule"></div>
|
||||
<div class="tagline">Grow-light farms, floor plans, mentors, the clinic, a body clock with no sun - every decision replayable from one signed log, 4,200 floors below the surface.</div>
|
||||
</div>
|
||||
<div class="card" id="card-act3" style="opacity:0;">
|
||||
<div class="glow"></div>
|
||||
<div class="eyebrow">Act III</div>
|
||||
<div class="title">Who Decides</div>
|
||||
<div class="rule"></div>
|
||||
<div class="tagline">Quadratic votes and a commit-reveal lottery that survive a severed network, the shelter's own honest mood - decided in the open, not behind a server.</div>
|
||||
</div>
|
||||
<div class="card" id="card-epilogue" style="opacity:0;">
|
||||
<div class="glow"></div>
|
||||
<div class="eyebrow">Epilogue</div>
|
||||
<div class="title">Trust, Made Verifiable</div>
|
||||
<div class="rule"></div>
|
||||
<div class="tagline">No server underground to take on faith. Every balance checks its own signature - any resident can ship a new mini-app, no gatekeeper required.</div>
|
||||
</div>
|
||||
<div class="card" id="card-outro" style="opacity:0;">
|
||||
<div class="glow"></div>
|
||||
<div class="eyebrow">Built in 36 hours</div>
|
||||
<div class="title">The Commons</div>
|
||||
<div class="rule"></div>
|
||||
<div class="tagline">13 mini-apps for life underground. 1 wallet. Every balance a signed, replayable event - until the climb back to the surface.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
const CARDS = [{"id":"card-intro","intro":true,"appear":0,"fadeOut":3},{"id":"card-act1","intro":false,"appear":5.25,"fadeOut":8.3},{"id":"card-act2","intro":false,"appear":16.55,"fadeOut":19.6},{"id":"card-act3","intro":false,"appear":31.22,"fadeOut":34.27},{"id":"card-epilogue","intro":false,"appear":44.49,"fadeOut":47.54},{"id":"card-outro","intro":false,"appear":52.09,"fadeOut":55.54}];
|
||||
|
||||
for (const c of CARDS) {
|
||||
const sel = '#' + c.id;
|
||||
const appear = c.appear; // when the card starts to appear
|
||||
const fadeOut = c.fadeOut; // when the card starts to leave
|
||||
const gone = fadeOut + 0.6; // when the card is fully gone
|
||||
|
||||
// Opacity: intro is opaque from its first frame; act cards crossfade in
|
||||
// (ease-OUT landing). All crossfade out (ease-IN leaving).
|
||||
if (c.intro) {
|
||||
tl.set(sel, { opacity: 1 }, appear);
|
||||
} else {
|
||||
tl.fromTo(sel, { opacity: 0 }, { opacity: 1, duration: 0.45, ease: 'power2.out' }, appear);
|
||||
}
|
||||
tl.to(sel, { opacity: 0, duration: 0.6, ease: 'power2.in' }, fadeOut);
|
||||
|
||||
// Kinetic-typography reveal (ease-out rises), anchored to the card's
|
||||
// appearance. Same cadence as the Stage-1 intro card.
|
||||
tl.fromTo(sel + ' .eyebrow', { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.6, ease: 'power2.out' }, appear + 0.15);
|
||||
tl.fromTo(sel + ' .title', { opacity: 0, y: 20 }, { opacity: 1, y: 0, duration: 0.7, ease: 'power2.out' }, appear + 0.45);
|
||||
tl.fromTo(sel + ' .rule', { scaleX: 0 }, { scaleX: 1, duration: 0.6, ease: 'power3.out' }, appear + 0.95);
|
||||
tl.fromTo(sel + ' .tagline', { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.6, ease: 'power2.out' }, appear + 1.3);
|
||||
|
||||
// Slow continuous glow "breath" across the whole visible window so no
|
||||
// card hold is a run of identical frames.
|
||||
tl.fromTo(sel + ' .glow', { scale: 1, opacity: 0.9 }, { scale: 1.12, opacity: 1, duration: Math.max(0.3, gone - appear), ease: 'sine.inOut' }, appear);
|
||||
}
|
||||
|
||||
// No separate closing fade: the Assembly clip's own baked 0.6s
|
||||
// fade-out-to-black closes the whole film on black.
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines.promo = tl;
|
||||
</script>
|
||||
</template>
|
||||
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>The Commons · OpenMotion full main tour (stage 2)</title>
|
||||
<script src="assets/gsap.min.js"></script>
|
||||
<style>body{margin:0;background:#000}#main{position:relative;width:1920px;height:1080px;overflow:hidden}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main" data-composition-id="main" data-start="0" data-duration="62.81" data-width="1920" data-height="1080" data-fps="30">
|
||||
<div id="promo" class="clip"
|
||||
data-composition-id="promo"
|
||||
data-composition-src="compositions/promo.html"
|
||||
data-start="0" data-duration="62.81" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines.main = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,560 @@
|
||||
// STAGE-2 OpenMotion full main-tour: shared tour-script module.
|
||||
//
|
||||
// This is the SINGLE source of the full main-tour beat sequence for the
|
||||
// OpenMotion pipeline (`capture.mjs` drives it, `buildComposition.mjs`
|
||||
// reads its exported title-card copy + Wave-1 callouts to template the
|
||||
// composition). It drives the REAL shipped app through its REAL rendered
|
||||
// UI on ONE continuous Playwright page/context (same viewport, same 2x
|
||||
// device scale, same recordVideo mechanism, same event-log continuity as
|
||||
// `e2e/demoVideoFull.e2e.mjs`'s recordMainScene()), covering Acts I-III of
|
||||
// the real tour and stopping right before the Epilogue (Stage-2 scope).
|
||||
//
|
||||
// It does NOT import or modify demoVideoFull.e2e.mjs. That file could not
|
||||
// be reused directly: it is not an ES module with exports (its
|
||||
// recordMainScene() is a private function and the module self-invokes
|
||||
// main() on import, which would trigger a full real render), AND its
|
||||
// recordMainScene() bundles a playwright-recast motion-graphics pass +
|
||||
// act-title-cards-baked-into-the-phone-footage that the OpenMotion
|
||||
// pipeline deliberately REPLACES with GSAP compositing. So this module is
|
||||
// the clean, exportable capture core the OpenMotion pipeline owns; when
|
||||
// demoVideoFull.e2e.mjs is next edited it can `import { runTour }` from
|
||||
// here to retire its own inline copy (that edit is out of scope this
|
||||
// stage - the file is explicitly off-limits).
|
||||
//
|
||||
// The act-title-card copy below is byte-for-byte the same in-universe text
|
||||
// as demoVideoFull.e2e.mjs's intro `renderTitleCard()` + `showActTitleCard()`
|
||||
// calls; the Wave-1 callouts are the same real narration substrings its
|
||||
// `WAVE1_FIX_CALLOUTS` cites. They live here so the OpenMotion margin +
|
||||
// title cards are templated from one place, never re-typed into the HTML.
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// In-universe title-card copy (verbatim from demoVideoFull.e2e.mjs). The
|
||||
// OpenMotion composition renders these as full-screen GSAP title cards
|
||||
// between act footage segments - the OpenMotion equivalent of the real
|
||||
// tour's intro renderTitleCard() + inter-act showActTitleCard() cards.
|
||||
// ---------------------------------------------------------------------
|
||||
export const TITLE_CARDS = {
|
||||
intro: {
|
||||
eyebrow: "The Hollow, tonight",
|
||||
title: "Who do you trust when the water turns bad?",
|
||||
tagline: "4,200 residents underground, cut off from the surface. No server. No central login.",
|
||||
},
|
||||
act1: {
|
||||
eyebrow: "Act I",
|
||||
title: "A Crisis, Verified Twice",
|
||||
tagline:
|
||||
"4,200 residents. No surface supply line. A bad water reading could be noise - it takes two independent sensors before the shelter trusts it.",
|
||||
},
|
||||
act2: {
|
||||
eyebrow: "Act II",
|
||||
title: "Keeping the Hollow Alive",
|
||||
tagline:
|
||||
"Grow-light farms, floor plans, mentors, the clinic, a body clock with no sun - every decision replayable from one signed log, 4,200 floors below the surface.",
|
||||
},
|
||||
act3: {
|
||||
eyebrow: "Act III",
|
||||
title: "Who Decides",
|
||||
tagline:
|
||||
"Quadratic votes and a commit-reveal lottery that survive a severed network, the shelter's own honest mood - decided in the open, not behind a server.",
|
||||
},
|
||||
// Stage-3 Epilogue + outro cards. Byte-for-byte the same in-universe copy
|
||||
// as demoVideoFull.e2e.mjs's Epilogue showActTitleCard() call and its
|
||||
// addMotionGraphics() outro renderTitleCard() call (the "The Commons"
|
||||
// closing statement). Same card mechanic Stage 2 proved for Act I/II/III.
|
||||
epilogue: {
|
||||
eyebrow: "Epilogue",
|
||||
title: "Trust, Made Verifiable",
|
||||
tagline:
|
||||
"No server underground to take on faith. Every balance checks its own signature - any resident can ship a new mini-app, no gatekeeper required.",
|
||||
},
|
||||
outro: {
|
||||
eyebrow: "Built in 36 hours",
|
||||
title: "The Commons",
|
||||
tagline:
|
||||
"13 mini-apps for life underground. 1 wallet. Every balance a signed, replayable event - until the climb back to the surface.",
|
||||
},
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Wave-1 fix callouts (right margin). These are the exact narration
|
||||
// substrings demoVideoFull.e2e.mjs's WAVE1_FIX_CALLOUTS cites, and the
|
||||
// beat notes below reference these same constants so the on-screen margin
|
||||
// text can never drift from what the tour actually demonstrates.
|
||||
// ---------------------------------------------------------------------
|
||||
const CO_NO_FALSE_ALERT = "flat 2nd reading (7.0 -> 7.05) did NOT fire a false alert";
|
||||
const CO_LOCALIZATION = "real pipe-graph leak localization named a suspected origin node";
|
||||
const CO_FARMS = "real GDD + LP optimizer forecast (1 temp reading, 1 plot, 1 crop) -> 200.00 kg";
|
||||
const CO_HOUSING = "the resident-facing 'Run assignment cycle' button recorded a new real housing.assignment cycle";
|
||||
const CO_QV = "the QV tally is no longer stuck at zero (Wave-1 fix: QV credit granted on the real roster/proposal lifecycle)";
|
||||
const CO_SKY = "a fast double-click produced exactly one entry, not two (GAP-20 fix)";
|
||||
|
||||
export const WAVE1_FIX_CALLOUTS = [
|
||||
{ beat: "waterwatch-no-false-alert", text: CO_NO_FALSE_ALERT },
|
||||
{ beat: "waterwatch-localization", text: CO_LOCALIZATION },
|
||||
{ beat: "farms-forecast", text: CO_FARMS },
|
||||
{ beat: "housing-run-cycle", text: CO_HOUSING },
|
||||
{ beat: "assembly-qv-tally", text: CO_QV },
|
||||
{ beat: "sky-post", text: CO_SKY },
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Pacing. Real-time footage (no recast idle speed-up in this pipeline),
|
||||
// so post-action reading holds are kept modest - long enough to read a
|
||||
// settled screen, short enough to keep the tour tight.
|
||||
// ---------------------------------------------------------------------
|
||||
const SETTLE = 650; // brief settle after a quick action
|
||||
const READ = 950; // reading hold on a meaningful beat
|
||||
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
export async function waitFor(fn, label, timeoutMs = 20000) {
|
||||
const start = Date.now();
|
||||
let lastErr;
|
||||
while (Date.now() - start < timeoutMs) {
|
||||
try {
|
||||
const v = await fn();
|
||||
if (v) return v;
|
||||
} catch (e) {
|
||||
lastErr = e;
|
||||
}
|
||||
await sleep(150);
|
||||
}
|
||||
throw new Error(`timeout waiting for: ${label}${lastErr ? ` (last error: ${lastErr})` : ""}`);
|
||||
}
|
||||
|
||||
async function walletBalanceText(page) {
|
||||
return (await page.getByTestId("wallet-balance").textContent())?.trim();
|
||||
}
|
||||
async function openTile(page, label) {
|
||||
await page.getByRole("button", { name: label }).click();
|
||||
await page.locator(`[aria-label="${label}"]`).first().waitFor({ state: "visible", timeout: 10000 });
|
||||
}
|
||||
async function backHome(page) {
|
||||
await page.getByRole("link", { name: "Back to home" }).click();
|
||||
await page.getByRole("grid", { name: "Miniapps" }).waitFor({ state: "visible" });
|
||||
}
|
||||
|
||||
// Mirrors e2e/fairDrawWalletCredit.e2e.mjs FILL_FOR_YOU_WINS exactly, so
|
||||
// Fair Draw's real commit/reveal/verify cycle deterministically resolves
|
||||
// to "You" winning on camera without touching any other real logic.
|
||||
export async function forceLocalIdentityWinsFairDraw(context) {
|
||||
await context.addInitScript(() => {
|
||||
window.crypto.getRandomValues = function (arr) {
|
||||
arr.fill(0x02);
|
||||
return arr;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// Drives the full Acts I-III tour on one continuous page.
|
||||
// api.mark(name) -> record the current clip-boundary offset
|
||||
// api.beat(label, note) -> record a beat (timestamp + optional screenshot)
|
||||
// The capture owns the clock; marks delimit the per-act footage clips the
|
||||
// OpenMotion composition slices and composites.
|
||||
export async function runTour(page, api, APP_URL) {
|
||||
const { mark, beat } = api;
|
||||
|
||||
// --- Cold start: real non-custodial identity resolves, honest empty state ---
|
||||
await page.goto(`${APP_URL}/`, { waitUntil: "load" });
|
||||
await page.getByRole("grid", { name: "Miniapps" }).waitFor({ state: "visible" });
|
||||
await waitFor(async () => (await walletBalanceText(page)) !== "--", "identity resolves (wallet leaves '--')");
|
||||
// Boot/mount is complete here; the intro clip is sliced from this mark,
|
||||
// trimming the (light-canvas, not white) first-paint frames.
|
||||
await mark("gridReady");
|
||||
await beat("cold-start", "fresh local Ed25519 identity resolved, honest empty home grid + wallet");
|
||||
await sleep(READ);
|
||||
|
||||
// --- Admin: Load Hollow demo seed (real signed seed.* events) ---
|
||||
await page.goto(`${APP_URL}/admin`, { waitUntil: "load" });
|
||||
await page.getByRole("button", { name: "Load Hollow demo" }).click();
|
||||
await waitFor(
|
||||
async () => ((await page.getByTestId("demo-load-status").textContent()) ?? "").includes("Demo data loaded"),
|
||||
"demo seed load status",
|
||||
);
|
||||
await beat("admin-seed", "Load Hollow demo clicked - signed seed.* events appended");
|
||||
await sleep(READ);
|
||||
|
||||
await page.goto(`${APP_URL}/`, { waitUntil: "load" });
|
||||
await page.getByRole("grid", { name: "Miniapps" }).waitFor({ state: "visible" });
|
||||
await sleep(SETTLE);
|
||||
await mark("introEnd"); // end of intro footage / Act I title card goes here
|
||||
|
||||
// =================================================================
|
||||
// ACT I: "A Crisis, Verified Twice"
|
||||
// =================================================================
|
||||
// --- Water Watch: GAP-8 false-alert fix + genuine corroborated detection ---
|
||||
await openTile(page, "Water Watch");
|
||||
async function reportReading(sensorId, value) {
|
||||
await page.getByTestId("report-reading-sensor").fill(sensorId);
|
||||
await page.getByTestId("report-reading-value").fill(String(value));
|
||||
await page.getByTestId("report-reading-submit").click();
|
||||
await waitFor(
|
||||
async () => !((await page.getByTestId("report-reading-status").textContent()) ?? "").includes("Submitting..."),
|
||||
`submit ${sensorId}=${value} settles`,
|
||||
);
|
||||
}
|
||||
await reportReading("kiosk-1", 7);
|
||||
await sleep(300);
|
||||
await reportReading("kiosk-1", 7.05);
|
||||
const stateAfterFlat = await page.getByTestId("device-monitor-status-light-pH").getAttribute("data-state");
|
||||
if (stateAfterFlat === "alert") {
|
||||
throw new Error("REGRESSION: a flat 2nd reading triggered a false alert (GAP-8 fix did not hold)");
|
||||
}
|
||||
await beat("waterwatch-no-false-alert", `${CO_NO_FALSE_ALERT} - state is "${stateAfterFlat}", not "alert"`);
|
||||
await sleep(READ);
|
||||
|
||||
await reportReading("kiosk-1", 50);
|
||||
await waitFor(
|
||||
async () => (await page.getByTestId("device-monitor-status-light-pH").getAttribute("data-state")) === "corroborating",
|
||||
"pH channel reaches corroborating after a genuine spike",
|
||||
);
|
||||
await beat("waterwatch-corroborating", "genuine spike (7 -> 50) correctly flagged - awaiting a second independent sensor");
|
||||
await sleep(SETTLE);
|
||||
|
||||
await reportReading("kiosk-2", 7);
|
||||
await reportReading("kiosk-2", 55);
|
||||
await waitFor(
|
||||
async () => (await page.getByTestId("device-monitor-status-light-pH").getAttribute("data-state")) === "alert",
|
||||
"pH channel reaches alert once corroborated",
|
||||
);
|
||||
await beat("waterwatch-alert", "independent kiosk-2 corroborated the spike - real signed alert, Fair Share re-solve triggered");
|
||||
await sleep(READ);
|
||||
|
||||
await page.getByTestId("device-monitor-my-tap").selectOption({ index: 1 });
|
||||
await waitFor(
|
||||
async () => (await page.getByTestId("device-monitor-origin-pH").count()) > 0,
|
||||
"pipe-graph leak localization resolves a suspected origin",
|
||||
);
|
||||
await beat("waterwatch-localization", `${CO_LOCALIZATION}, with a live per-tap arrival countdown for the selected tap`);
|
||||
await sleep(READ);
|
||||
|
||||
// --- Fair Share: water allocation re-solved ---
|
||||
await backHome(page);
|
||||
await openTile(page, "Fair Share");
|
||||
await waitFor(async () => {
|
||||
const text = (await page.getByTestId("tile-water-allocation").textContent()) ?? "";
|
||||
return text.trim().length > 0 && text !== "No allocation yet";
|
||||
}, "Fair Share water tile shows a real re-solved allocation");
|
||||
await beat("fairshare-water", "Fair Share's water tile reflects the honesty-anchor chain's re-solved CEEI allocation");
|
||||
await sleep(READ);
|
||||
|
||||
// --- Tunnel Safety: real hazard report ---
|
||||
await backHome(page);
|
||||
await openTile(page, "Tunnel Safety");
|
||||
await page.getByTestId("tunnel-safety-report-submit").click();
|
||||
await waitFor(
|
||||
async () => ((await page.getByTestId("tunnel-safety-report-status-text").textContent()) ?? "").includes("Hazard reported"),
|
||||
"hazard report submitted",
|
||||
);
|
||||
await beat("tunnelsafety", "real hazard report appended for the selected corridor segment");
|
||||
await sleep(READ);
|
||||
|
||||
// --- Find Family: on-device PSI search ---
|
||||
await backHome(page);
|
||||
await openTile(page, "Find Family");
|
||||
await page.getByTestId("findfamily-search-input").fill("Ana Ramirez");
|
||||
await page.getByTestId("findfamily-search-button").click();
|
||||
await waitFor(
|
||||
async () =>
|
||||
(await page.getByTestId("findfamily-result-match").count()) > 0 ||
|
||||
(await page.getByTestId("findfamily-result-nomatch").count()) > 0,
|
||||
"PSI search resolves",
|
||||
);
|
||||
await beat("findfamily", "on-device private-set-intersection search resolved - the query never left the device");
|
||||
await sleep(READ);
|
||||
|
||||
await backHome(page);
|
||||
await mark("act1End"); // Act II title card goes here
|
||||
|
||||
// =================================================================
|
||||
// ACT II: "Keeping the Hollow Alive"
|
||||
// =================================================================
|
||||
// --- Farms -> Fair Share food edge ---
|
||||
await openTile(page, "Farms");
|
||||
await page.getByTestId("farms-temp-date").fill("2026-05-01");
|
||||
await page.getByTestId("farms-temp-tmin").fill("10");
|
||||
await page.getByTestId("farms-temp-tmax").fill("30");
|
||||
await page.getByTestId("farms-temp-add").click();
|
||||
await page.getByTestId("farms-plot-id").fill("plot-a");
|
||||
await page.getByTestId("farms-plot-area").fill("100");
|
||||
await page.getByTestId("farms-plot-add").click();
|
||||
await page.getByTestId("farms-crop-id").fill("wheat");
|
||||
await page.getByTestId("farms-crop-maturity-gdd").fill("10");
|
||||
await page.getByTestId("farms-crop-yield").fill("2");
|
||||
await page.getByTestId("farms-crop-kwh").fill("0");
|
||||
await page.getByTestId("farms-crop-add").click();
|
||||
await waitFor(
|
||||
async () => ((await page.getByTestId("farms-forecast-total").textContent()) ?? "").includes("200.00 kg"),
|
||||
"Farms LP optimizer reaches a real 200.00 kg forecast",
|
||||
);
|
||||
await beat("farms-forecast", CO_FARMS);
|
||||
await sleep(READ);
|
||||
|
||||
await backHome(page);
|
||||
await openTile(page, "Fair Share");
|
||||
await waitFor(async () => {
|
||||
const text = (await page.getByTestId("tile-food-allocation").textContent()) ?? "";
|
||||
return text.trim().length > 0 && text !== "No allocation yet" && text.trim() !== "0";
|
||||
}, "Fair Share food tile reflects the Farms forecast");
|
||||
await beat("fairshare-food", "Farms' real forecast fed Fair Share's second cross-mini-app integration edge - food tile re-solved");
|
||||
await sleep(READ);
|
||||
|
||||
// --- Housing ---
|
||||
await backHome(page);
|
||||
await openTile(page, "Housing");
|
||||
await page.getByTestId("housing-assigned-slot").waitFor({ state: "visible" });
|
||||
await beat("housing", "Housing shows a real assigned room slot from the seeded assignment cycle, not a permanent empty state");
|
||||
await sleep(SETTLE);
|
||||
|
||||
await page.getByTestId("housing-report-space-id").fill("common-room-3");
|
||||
await page.getByTestId("housing-report-location").fill("East wing, ground floor");
|
||||
await page.getByTestId("housing-report-submit").click();
|
||||
await waitFor(
|
||||
async () => ((await page.getByTestId("housing-report-status-text").textContent()) ?? "").includes("Idle space reported"),
|
||||
"idle space report submits",
|
||||
);
|
||||
await beat("housing-report-idle-space", "a resident reported a real idle space through the real form - available to the next assignment cycle");
|
||||
await sleep(SETTLE);
|
||||
|
||||
await page.getByTestId("housing-run-cycle").click();
|
||||
await waitFor(
|
||||
async () => ((await page.getByTestId("housing-run-cycle-status").textContent()) ?? "").length > 0,
|
||||
"resident-triggered assignment cycle runs",
|
||||
);
|
||||
await beat("housing-run-cycle", CO_HOUSING + " against the current fairness-debt ledger");
|
||||
await sleep(READ);
|
||||
|
||||
// --- Mentor ---
|
||||
await backHome(page);
|
||||
await openTile(page, "Mentor");
|
||||
await page.getByTestId("mentor-card-well-repair").waitFor({ state: "visible" });
|
||||
await beat("mentor", "Mentor shows a real at-risk skill card (deduped dependents count) from the seeded skill-holder data");
|
||||
await sleep(SETTLE);
|
||||
|
||||
await page.getByTestId("mentor-rate-again-well-repair").click();
|
||||
await waitFor(async () => (await page.getByTestId("mentor-matches").count()) > 0, "the apprentice-match engine reacts to the new review");
|
||||
await beat("mentor-apprentice-match", "rating yourself 'Again' created a real apprentice need; the real matching engine scores the mentor pool honestly");
|
||||
await sleep(READ);
|
||||
|
||||
// --- Health Post: WHO-IMCI triage + referral ---
|
||||
await backHome(page);
|
||||
await openTile(page, "Health Post");
|
||||
await page.getByTestId("triage-age-input").fill("24");
|
||||
await page.getByTestId("triage-hasCough-yes").click();
|
||||
await page.getByTestId("triage-breathsPerMinute-input").fill("45");
|
||||
await page.getByTestId("triage-chestIndrawing-no").click();
|
||||
await page.getByTestId("triage-stridorWhenCalm-no").click();
|
||||
await page.getByTestId("triage-hasDiarrhea-yes").click();
|
||||
await page.getByTestId("triage-durationDays-input").fill("3");
|
||||
await page.getByTestId("triage-bloodInStool-no").click();
|
||||
await page.getByTestId("triage-restlessOrIrritable-no").click();
|
||||
await page.getByTestId("triage-sunkenEyes-no").click();
|
||||
await page.getByTestId("triage-ableToDrink-select").selectOption("normal");
|
||||
await page.getByTestId("triage-skinPinch-select").selectOption("immediate");
|
||||
await page.getByTestId("triage-submit").click();
|
||||
await page.getByTestId("triage-result").waitFor({ state: "visible" });
|
||||
const urgency = (await page.getByTestId("triage-urgency").textContent())?.trim();
|
||||
await beat("healthpost-triage", `real WHO-IMCI classification from a full exam: "${urgency}"`);
|
||||
await sleep(READ);
|
||||
|
||||
await page.getByTestId("triage-send-referral").click();
|
||||
await page.getByTestId("triage-referral-sent").waitFor({ state: "visible" });
|
||||
await beat("healthpost-send-to-clinician", "the real 'Send to clinician' button posted a signed healthpost.referral event to the clinician queue");
|
||||
await sleep(READ);
|
||||
|
||||
// --- Light Clock: manual sleep/wake log (honest no-sensor fallback) ---
|
||||
await page.evaluate(() => {
|
||||
delete window.DeviceMotionEvent;
|
||||
});
|
||||
await backHome(page);
|
||||
await openTile(page, "Light Clock");
|
||||
await page.getByTestId("lightclock-enable-sensor").click();
|
||||
await page.getByTestId("lightclock-manual-hours").waitFor({ state: "visible" });
|
||||
await beat("lightclock-manual-fallback", "no motion sensor available - the real sensor-first/manual-fallback contract switched to the manual log form");
|
||||
await page.getByTestId("lightclock-manual-hours").fill("8");
|
||||
await page.getByTestId("lightclock-manual-state").selectOption("asleep");
|
||||
await page.getByTestId("lightclock-manual-add").click();
|
||||
await page.getByTestId("lightclock-manual-entries").locator("li").first().waitFor({ state: "visible" });
|
||||
await page.getByTestId("lightclock-manual-compute").click();
|
||||
await beat("lightclock", "manual sleep/wake log entry added and circadian status computed");
|
||||
await sleep(READ);
|
||||
|
||||
// --- The Climb: schedule inputs feeding the min-cost-flow engine ---
|
||||
await backHome(page);
|
||||
await openTile(page, "The Climb");
|
||||
await page.getByTestId("theclimb-shaft-id").fill("shaft-1");
|
||||
await page.getByTestId("theclimb-shaft-from").fill("D1");
|
||||
await page.getByTestId("theclimb-shaft-to").fill("surface");
|
||||
await page.getByTestId("theclimb-shaft-capacity").fill("20");
|
||||
await page.getByTestId("theclimb-shaft-travel").fill("2");
|
||||
await page.getByTestId("theclimb-shaft-add").click();
|
||||
await page.getByTestId("theclimb-demand-id").fill("wave-1");
|
||||
await page.getByTestId("theclimb-demand-sector").fill("D1");
|
||||
await page.getByTestId("theclimb-demand-ready-period").fill("0");
|
||||
await page.getByTestId("theclimb-demand-count").fill("15");
|
||||
await page.getByTestId("theclimb-demand-add").click();
|
||||
await page.getByTestId("theclimb-capacity-period").fill("0");
|
||||
await page.getByTestId("theclimb-capacity-value").fill("20");
|
||||
await page.getByTestId("theclimb-capacity-add").click();
|
||||
await beat("theclimb", "real shaft/wave-demand/surface-capacity schedule fed to the min-cost-flow congestion engine");
|
||||
await sleep(READ);
|
||||
|
||||
await backHome(page);
|
||||
await mark("act2End"); // Act III title card goes here
|
||||
|
||||
// =================================================================
|
||||
// ACT III: "Who Decides"
|
||||
// =================================================================
|
||||
// --- Assembly (single-user half): seeded roster/proposal + create/vote + QV ---
|
||||
await openTile(page, "Assembly");
|
||||
await page.getByTestId("assembly-sync-toggle").waitFor({ state: "visible" });
|
||||
await beat("assembly-seeded", "demo-seeded roster (Aria, Kade) and an open proposal visible cold, no manual setup");
|
||||
await sleep(SETTLE);
|
||||
|
||||
await page.getByTestId("assembly-create-proposal-title-input").fill("Repave the common courtyard");
|
||||
await page.getByTestId("assembly-create-proposal-description-input").fill("The paving stones have cracked and are a tripping hazard.");
|
||||
await page.getByTestId("assembly-create-proposal-submit").click();
|
||||
await page.getByText("Repave the common courtyard").waitFor({ state: "visible" });
|
||||
const proposalArticle = page.locator("article", { hasText: "Repave the common courtyard" }).first();
|
||||
const proposalId = (await proposalArticle.getAttribute("data-testid"))?.replace("assembly-proposal-", "");
|
||||
await beat("assembly-create-proposal", "a new proposal was created through the real form");
|
||||
await sleep(SETTLE);
|
||||
|
||||
await page.getByTestId("assembly-add-resident-name-input").fill("Nguyen");
|
||||
await page.getByTestId("assembly-add-resident-submit").click();
|
||||
await waitFor(
|
||||
async () => (await page.locator('[data-testid^="assembly-roster-"]', { hasText: "Nguyen" }).count()) > 0,
|
||||
"new resident appears on the roster",
|
||||
);
|
||||
await beat("assembly-add-resident", "a new resident was added to the roster through the real form");
|
||||
await sleep(SETTLE);
|
||||
|
||||
if (proposalId) {
|
||||
await page.getByTestId(`assembly-vote-yes-${proposalId}`).click();
|
||||
await waitFor(
|
||||
async () => ((await page.getByTestId(`assembly-vote-status-${proposalId}`).textContent()) ?? "").includes("You voted Yes"),
|
||||
"vote registers",
|
||||
);
|
||||
await beat("assembly-vote", "a direct vote was cast on the new proposal and the status readout updated live");
|
||||
await sleep(SETTLE);
|
||||
|
||||
await page.getByTestId(`assembly-qv-ballot-yes-${proposalId}`).click();
|
||||
await waitFor(
|
||||
async () => !((await page.getByTestId(`assembly-tally-yes-${proposalId}`).textContent()) ?? "").includes("Yes 0.00"),
|
||||
"QV tally becomes non-zero after a real weighted ballot",
|
||||
);
|
||||
await beat("assembly-qv-tally", CO_QV);
|
||||
await sleep(READ);
|
||||
}
|
||||
|
||||
// --- Fair Draw: real commit-reveal-verify -> real wallet credit ---
|
||||
await backHome(page);
|
||||
await openTile(page, "Fair Draw");
|
||||
await page.getByRole("button", { name: "Start Draw" }).click();
|
||||
await page.getByTestId("reveal-draw-commit-hash").waitFor({ state: "visible" });
|
||||
const commitHash = (await page.getByTestId("reveal-draw-commit-hash").textContent())?.trim();
|
||||
await beat("fairdraw-commit", `a signed commit hash was published BEFORE any reveal - "${commitHash?.slice(0, 16)}..." - re-rolling after this point is auditable and rejected`);
|
||||
await sleep(READ);
|
||||
|
||||
await page.getByRole("button", { name: "Reveal" }).click();
|
||||
await page.getByTestId("reveal-draw-revealed").waitFor({ state: "visible" });
|
||||
const winnerText = (await page.getByTestId("reveal-draw-winner").textContent())?.trim();
|
||||
const badgeState = await page.getByTestId("reveal-draw-badge").getAttribute("data-state");
|
||||
await beat("fairdraw-reveal", `real commit -> reveal -> verify cycle: "${winnerText}", badge state "${badgeState}"`);
|
||||
await sleep(READ);
|
||||
|
||||
await waitFor(async () => (await walletBalanceText(page)) !== undefined, "wallet balance chip present on fair-draw route");
|
||||
await beat("fairdraw-wallet-live", "WalletCard balance updates live on the same route, no reload, from the real Fair Draw win");
|
||||
await sleep(SETTLE);
|
||||
|
||||
await page.getByRole("link", { name: "Back to home" }).click();
|
||||
await page.getByTestId("history-entry").first().waitFor({ state: "visible" });
|
||||
await beat("fairdraw-history-row", "full transaction history now shows the real signed wallet.issue credit row");
|
||||
await sleep(READ);
|
||||
|
||||
// --- Sky: memory-wall post + double-click guard (GAP-20) + mood pulse ---
|
||||
// Already on home (fairdraw-history-row click landed here); no backHome.
|
||||
await openTile(page, "Sky");
|
||||
const skyMessage = "The sky over the Hollow turned amber tonight.";
|
||||
await page.getByTestId("sky-memory-input").fill(skyMessage);
|
||||
const countBefore = await page.getByTestId("sky-memory-list").locator("li").count().catch(() => 0);
|
||||
await Promise.all([
|
||||
page.getByTestId("sky-memory-submit").click(),
|
||||
page.getByTestId("sky-memory-submit").click(),
|
||||
]);
|
||||
await waitFor(
|
||||
async () => (await page.getByTestId("sky-memory-list").locator("li").count()) === countBefore + 1,
|
||||
"exactly one memory-wall entry posted despite two synchronous clicks",
|
||||
);
|
||||
await beat("sky-post", "posted to the memory wall; " + CO_SKY);
|
||||
await sleep(READ);
|
||||
|
||||
await page.getByTestId("sky-mood-select").selectOption({ index: 1 });
|
||||
await page.getByTestId("sky-mood-note").fill("Tense, but the water's clean again.");
|
||||
await page.getByTestId("sky-mood-submit").click();
|
||||
await waitFor(async () => (await page.getByTestId("sky-mood-latest").count()) > 0, "mood pulse posts and the latest-pulse readout updates");
|
||||
await beat("sky-mood-pulse", "a real signed mood/morale pulse was posted - the shelter's honest mood is now visible, aggregated from real signed events");
|
||||
await sleep(READ);
|
||||
|
||||
// Short calm end-hold on the posted mood, then close out Act III.
|
||||
await sleep(500);
|
||||
await mark("act3End"); // Epilogue title card goes here
|
||||
|
||||
// =================================================================
|
||||
// EPILOGUE: "Trust, Made Verifiable" - the headline crypto feature
|
||||
// (every wallet entry re-checks its own Ed25519 signature) plus the
|
||||
// open-platform close (any resident can ship a mini-app, no gatekeeper).
|
||||
// Same real footage + real app interaction as demoVideoFull.e2e.mjs's
|
||||
// Epilogue beats; the Epilogue title card is rendered by the OpenMotion
|
||||
// composition between the Act III clip and this clip.
|
||||
// =================================================================
|
||||
await backHome(page);
|
||||
|
||||
// --- Wallet signature verification (headline crypto feature) ---
|
||||
await page.getByTestId("history-entry").first().waitFor({ state: "visible" });
|
||||
const firstRow = page.getByTestId("history-entry").first();
|
||||
const badge = firstRow.locator('[data-testid^="history-signature-badge-"]');
|
||||
await waitFor(async () => ((await badge.textContent()) ?? "").trim() === "Verified", "signature badge resolves to Verified");
|
||||
await beat("wallet-sig-verified", "independent verifyEntrySignature() re-check confirms the entry's Ed25519 signature is genuine");
|
||||
await sleep(READ);
|
||||
|
||||
const sigToggle = firstRow.locator('[data-testid^="history-expand-toggle-"]');
|
||||
await sigToggle.click();
|
||||
const sigDetail = firstRow.locator('[data-testid^="history-signature-detail-"]');
|
||||
await sigDetail.waitFor({ state: "visible" });
|
||||
await beat("wallet-sig-expanded", "raw Ed25519 signature + author public key bytes are directly inspectable, not just a claimed verification");
|
||||
await sleep(READ);
|
||||
await sigToggle.click();
|
||||
|
||||
// --- Upload a mini-app (open platform, no gatekeeper) ---
|
||||
// Already on the home route; ShellLayout hides "Back to home" on "/", so
|
||||
// no backHome() here.
|
||||
await page.getByRole("button", { name: "+ Upload a mini-app" }).click();
|
||||
await page.getByLabel("Mini-app name").fill("Counter Widget");
|
||||
await page.getByLabel("Icon (emoji or data URI)").fill("\uD83D\uDD22");
|
||||
await page.getByLabel("Entry point").fill("index.html");
|
||||
await page.getByLabel("ledger.read").check();
|
||||
await page.setInputFiles("#upload-html-file", {
|
||||
name: "index.html",
|
||||
mimeType: "text/html",
|
||||
buffer: Buffer.from("<html><body><p>Counter Widget</p></body></html>"),
|
||||
});
|
||||
await beat("upload-form-filled", "real manifest form filled + a real HTML file attached via the real file input");
|
||||
await sleep(SETTLE);
|
||||
|
||||
await page.getByRole("button", { name: "Upload mini-app" }).click();
|
||||
await page.getByTestId("upload-success").waitFor({ state: "visible" });
|
||||
await beat("upload-success", "the real uploadMiniapp() storage path accepted the package");
|
||||
await sleep(SETTLE);
|
||||
|
||||
await page.getByRole("button", { name: "Go to home" }).click();
|
||||
await page.getByRole("button", { name: "Counter Widget" }).waitFor({ state: "visible" });
|
||||
await beat("upload-tile-appears", "the uploaded mini-app now appears as a real tile on the home grid");
|
||||
await sleep(READ);
|
||||
|
||||
// Brief calm end-hold, then close. The OpenMotion composition renders the
|
||||
// "The Commons" outro card after this clip, then the Assembly two-device
|
||||
// scene, then the closing fade-to-black.
|
||||
await sleep(400);
|
||||
await mark("epilogueEnd");
|
||||
}
|
||||
Reference in new issue
Block a user