@usemosio/cli-linux-x64 1.0.0-next.1 → 1.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.md +22 -0
- package/apps/studio/dist/assets/Workspace-Dr-hVeFd.js +34 -0
- package/apps/studio/dist/assets/{agent-panel-CqJuv5Sn.js → agent-panel-DMrVed-J.js} +5 -5
- package/apps/studio/dist/assets/{boundary-bK2S8z05.js → boundary-DL9veUlN.js} +1 -1
- package/apps/studio/dist/assets/{feedback-BqzXUdVd.js → feedback-x6ZumR_x.js} +1 -1
- package/apps/studio/dist/assets/index-C6juWzGV.js +1984 -0
- package/apps/studio/dist/assets/index-CjDBKmB_.css +2 -0
- package/apps/studio/dist/assets/inspector3d-sqergHSP.js +1 -0
- package/apps/studio/dist/index.html +4 -3
- package/apps/studio/dist-host/studio-host.mjs +262 -3
- package/bin/mosio +0 -0
- package/bin/mosio-agent +0 -0
- package/crates/mosio/src/adapters/mosio-three.js +112 -8
- package/crates/mosio/src/adapters/room-env-pmrem.json +1 -0
- package/crates/mosio/src/runtime.js +205 -6
- package/fixtures/camera-inspect/mosio.json +56 -0
- package/fixtures/camera-inspect/scenes/behind.html +22 -0
- package/fixtures/camera-inspect/scenes/cut.html +18 -0
- package/fixtures/camera-inspect/scenes/edges.html +18 -0
- package/fixtures/camera-inspect/scenes/good.html +23 -0
- package/fixtures/camera-inspect/scenes/read.html +22 -0
- package/fixtures/camera-inspect/scenes/shake.html +23 -0
- package/fixtures/camera-inspect/scenes/speed.html +18 -0
- package/fixtures/camera-inspect-vertical/mosio.json +31 -0
- package/fixtures/camera-inspect-vertical/scenes/good.html +20 -0
- package/fixtures/camera-inspect-vertical/scenes/safe.html +18 -0
- package/fixtures/cloudrun-gpu/audio/music.wav +0 -0
- package/fixtures/cloudrun-gpu/audio/vo.wav +0 -0
- package/fixtures/cloudrun-gpu/mosio.json +18 -0
- package/fixtures/cloudrun-gpu/scenes/cube.html +25 -0
- package/fixtures/direct-seek/mosio.json +4 -0
- package/fixtures/direct-seek/scenes/clock.html +9 -0
- package/fixtures/direct-seek/scenes/meta.html +11 -0
- package/fixtures/direct-seek/scenes/pure.html +11 -0
- package/fixtures/direct-seek/scenes/slow.html +11 -0
- package/fixtures/direct-seek-media/mosio.json +6 -0
- package/fixtures/direct-seek-media/scenes/pure.html +11 -0
- package/fixtures/gl-readback/mosio.json +16 -0
- package/fixtures/gl-readback/scenes/compositor.html +23 -0
- package/fixtures/gl-readback/scenes/readback.html +23 -0
- package/fixtures/inspect-physics/expect.json +18 -0
- package/fixtures/inspect-physics/mosio.json +29 -0
- package/fixtures/inspect-physics/scenes/calm.html +46 -0
- package/fixtures/inspect-physics/scenes/physics.html +47 -0
- package/package.json +1 -1
- package/primitives/README.md +23 -2
- package/primitives/example/shared/mosio-prims.js +349 -1
- package/primitives/impact-burst/golden/f030.png +0 -0
- package/primitives/impact-burst/golden/f032.png +0 -0
- package/primitives/impact-burst/golden/f036.png +0 -0
- package/primitives/impact-burst/impact-burst.js +51 -0
- package/primitives/impact-burst/primitive.json +130 -0
- package/primitives/impact-burst/scene.html +24 -0
- package/primitives/stick-figure/golden/f030.png +0 -0
- package/primitives/stick-figure/golden/f092.png +0 -0
- package/primitives/stick-figure/golden/f140.png +0 -0
- package/primitives/stick-figure/primitive.json +179 -0
- package/primitives/stick-figure/scene.html +40 -0
- package/primitives/stick-figure/stick-figure.js +297 -0
- package/primitives/zoom-through/primitive.json +7 -2
- package/primitives/zoom-through/zoom-through.js +6 -5
- package/scripts/3d-acceptance.sh +8 -1
- package/scripts/3d-attach-bench.mjs +119 -0
- package/scripts/3d-bake-room-env.mjs +74 -0
- package/scripts/3d-e2b-job.sh +1 -0
- package/scripts/3d-gen-heavy-fixture.py +65 -0
- package/scripts/3d-trace-summary.py +14 -0
- package/scripts/acceptance/camera-inspect.sh +49 -0
- package/scripts/acceptance/direct-seek.sh +68 -0
- package/scripts/acceptance/export.sh +5 -3
- package/scripts/acceptance/frames.sh +7 -2
- package/scripts/acceptance/hardening.sh +37 -6
- package/scripts/acceptance/hub.sh +208 -0
- package/scripts/acceptance/inspect.sh +21 -2
- package/scripts/acceptance/revisions-git.sh +137 -0
- package/scripts/acceptance/revisions-sync.sh +323 -0
- package/scripts/acceptance/revisions.sh +118 -4
- package/scripts/acceptance/segcache.sh +100 -0
- package/scripts/acceptance/split.sh +78 -0
- package/scripts/bootstrap.sh +20 -1
- package/scripts/check-error-codes.py +9 -1
- package/scripts/check-file-size.sh +45 -0
- package/scripts/ci.sh +4 -4
- package/scripts/dedupe-report.sh +47 -0
- package/scripts/e2b/template/provision.sh +1 -1
- package/scripts/fastpath/cdp.mjs +25 -0
- package/scripts/fastpath/dbg.mjs +11 -0
- package/scripts/fastpath/e2b.mjs +40 -0
- package/scripts/fastpath/features/gen.py +109 -0
- package/scripts/fastpath/features/mosio.json +100 -0
- package/scripts/fastpath/features/scenes/backdrop.html +11 -0
- package/scripts/fastpath/features/scenes/blend.html +11 -0
- package/scripts/fastpath/features/scenes/canvas2d.html +11 -0
- package/scripts/fastpath/features/scenes/filter.html +11 -0
- package/scripts/fastpath/features/scenes/gradient.html +11 -0
- package/scripts/fastpath/features/scenes/iframe.html +11 -0
- package/scripts/fastpath/features/scenes/image.html +11 -0
- package/scripts/fastpath/features/scenes/svg.html +11 -0
- package/scripts/fastpath/features/scenes/text.html +11 -0
- package/scripts/fastpath/features/scenes/typo.html +11 -0
- package/scripts/fastpath/features/scenes/video.html +11 -0
- package/scripts/fastpath/features/scenes/video2.html +11 -0
- package/scripts/fastpath/features-xfade/mosio.json +49 -0
- package/scripts/fastpath/features-xfade/scenes/image.html +11 -0
- package/scripts/fastpath/features-xfade/scenes/video.html +11 -0
- package/scripts/fastpath/fixtures/gen_layout.py +80 -0
- package/scripts/fastpath/fixtures/l12-no-reset/assets/img/photo-1015.jpg +0 -0
- package/scripts/fastpath/fixtures/l12-no-reset/mosio.json +34 -0
- package/scripts/fastpath/fixtures/l12-no-reset/scenes/main.html +20 -0
- package/scripts/fastpath/fp.mjs +91 -0
- package/scripts/fastpath/inpage.js +68 -0
- package/scripts/fastpath/recipes.py +49 -0
- package/scripts/fastpath/sandbox.sh +68 -0
- package/scripts/fastpath/sandbox10.sh +57 -0
- package/scripts/fastpath/sandbox11.sh +18 -0
- package/scripts/fastpath/sandbox12.sh +30 -0
- package/scripts/fastpath/sandbox13.sh +16 -0
- package/scripts/fastpath/sandbox14.sh +28 -0
- package/scripts/fastpath/sandbox15.sh +36 -0
- package/scripts/fastpath/sandbox16.sh +60 -0
- package/scripts/fastpath/sandbox17.sh +34 -0
- package/scripts/fastpath/sandbox18.sh +59 -0
- package/scripts/fastpath/sandbox19.sh +67 -0
- package/scripts/fastpath/sandbox2.sh +41 -0
- package/scripts/fastpath/sandbox20.sh +34 -0
- package/scripts/fastpath/sandbox21.sh +22 -0
- package/scripts/fastpath/sandbox22.sh +22 -0
- package/scripts/fastpath/sandbox23.sh +21 -0
- package/scripts/fastpath/sandbox3.sh +151 -0
- package/scripts/fastpath/sandbox4.sh +161 -0
- package/scripts/fastpath/sandbox5.sh +69 -0
- package/scripts/fastpath/sandbox6.sh +85 -0
- package/scripts/fastpath/sandbox7.sh +81 -0
- package/scripts/fastpath/sandbox8.sh +62 -0
- package/scripts/fastpath/sandbox9.sh +130 -0
- package/scripts/fastpath/srv.mjs +15 -0
- package/scripts/fastpath/www/probe.html +1 -0
- package/scripts/gen-media-fixtures.sh +1 -0
- package/scripts/gl-readback-check.sh +26 -0
- package/scripts/hpbench/make-bench-fixtures.sh +43 -0
- package/scripts/hpbench/render-cgroup.sh +56 -0
- package/scripts/install.sh +2 -1
- package/scripts/npm-clean-install-proof-win.sh +64 -0
- package/scripts/platform-smoke.sh +80 -0
- package/scripts/prim.mjs +31 -13
- package/scripts/user-journey.sh +68 -0
- package/skills/mosio-3d/SKILL.md +31 -3
- package/skills/mosio-brief/SKILL.md +80 -0
- package/skills/mosio-brief/references/brief.md +141 -0
- package/skills/mosio-brief/references/copy.md +99 -0
- package/skills/mosio-brief/references/narration.md +61 -0
- package/skills/mosio-brief/references/storyboard.md +98 -0
- package/skills/mosio-collab/SKILL.md +104 -0
- package/skills/mosio-collab/references/hub.md +62 -0
- package/skills/mosio-engine/SKILL.md +44 -13
- package/skills/mosio-engine/references/camera.md +12 -2
- package/skills/mosio-engine/references/character.md +88 -0
- package/skills/mosio-engine/references/checks.md +11 -4
- package/skills/mosio-engine/references/delivery.md +29 -2
- package/skills/mosio-engine/references/kit-primitives.md +8 -4
- package/skills/mosio-engine/references/layout.md +8 -0
- package/skills/mosio-engine/references/plan.md +3 -1
- package/skills/mosio-engine/references/project.md +15 -3
- package/skills/mosio-engine/references/publish.md +79 -0
- package/skills/mosio-engine/references/registry.md +27 -15
- package/skills/mosio-engine/references/timeline.md +19 -1
- package/skills/mosio-engine/references/timing.md +2 -1
- package/skills/mosio-import/SKILL.md +1 -1
- package/skills/mosio-import/references/from-hyperframes.md +1 -1
- package/skills/mosio-import/references/from-remotion.md +1 -1
- package/skills/mosio-media/SKILL.md +16 -4
- package/skills/mosio-media/references/audio.md +29 -11
- package/skills/mosio-media/references/captions.md +26 -5
- package/skills/mosio-media/references/editing.md +70 -0
- package/skills/mosio-media/references/footage.md +40 -8
- package/skills/mosio-media/references/voice.md +52 -7
- package/skills/mosio-replicate/references/mosio.md +1 -1
- package/toolchain.lock.json +151 -4
- package/apps/studio/dist/assets/Workspace-KSOFeEgc.js +0 -32
- package/apps/studio/dist/assets/index-B-uuTqe9.js +0 -1785
- package/apps/studio/dist/assets/index-CajSh04l.css +0 -2
- package/apps/studio/dist/assets/inspector3d-vDz97X99.js +0 -1
|
@@ -550,6 +550,10 @@ var RevisionInfo = obj({
|
|
|
550
550
|
name: z.string().optional()
|
|
551
551
|
}),
|
|
552
552
|
head: z.boolean(),
|
|
553
|
+
/** the user requests that led to this revision (`mosio commit --prompt`); absent on older revisions. Experimental. */
|
|
554
|
+
prompt: z.array(z.string()).optional(),
|
|
555
|
+
/** the model that made the change (`mosio commit --model`); absent on older revisions. Experimental. */
|
|
556
|
+
model: z.string().optional(),
|
|
553
557
|
/** mutation results only: working-tree token right after the write, taken under the write lock */
|
|
554
558
|
tree: z.string().nullable().optional()
|
|
555
559
|
});
|
|
@@ -2223,6 +2227,8 @@ function revisionsFromCoreLog(entries, head) {
|
|
|
2223
2227
|
parent: e.parent ?? null,
|
|
2224
2228
|
message: e.message,
|
|
2225
2229
|
created_unix: e.created_unix,
|
|
2230
|
+
...e.prompt?.length ? { prompt: e.prompt } : {},
|
|
2231
|
+
...e.model ? { model: e.model } : {},
|
|
2226
2232
|
status: e.id === head ? "working" : "historical",
|
|
2227
2233
|
status_source: "runtime",
|
|
2228
2234
|
author: e.author ? {
|
|
@@ -5306,6 +5312,130 @@ function agentMain(NONCE) {
|
|
|
5306
5312
|
});
|
|
5307
5313
|
}
|
|
5308
5314
|
const M = () => window.__mosio;
|
|
5315
|
+
const C = () => window;
|
|
5316
|
+
/** the camera rig, measured on the unfilmed stage (the transform is put back after) */
|
|
5317
|
+
function camera(until, step) {
|
|
5318
|
+
const m = C().__mosio, rig = m && m._cameraRig, CAM = m && m._camera;
|
|
5319
|
+
if (!rig || !CAM) return null;
|
|
5320
|
+
const { plan, env } = rig;
|
|
5321
|
+
const body = document.body, keep = body.style.transform;
|
|
5322
|
+
body.style.transform = "none";
|
|
5323
|
+
try {
|
|
5324
|
+
const boxOf = (ids) => {
|
|
5325
|
+
if (!Array.isArray(ids) || !ids.length) return null;
|
|
5326
|
+
let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
|
|
5327
|
+
for (const id of ids) {
|
|
5328
|
+
const r = id === "stage" ? {
|
|
5329
|
+
x: 0,
|
|
5330
|
+
y: 0,
|
|
5331
|
+
w: plan.SW,
|
|
5332
|
+
h: plan.SH
|
|
5333
|
+
} : env.rect(String(id));
|
|
5334
|
+
x0 = Math.min(x0, r.x);
|
|
5335
|
+
y0 = Math.min(y0, r.y);
|
|
5336
|
+
x1 = Math.max(x1, r.x + r.w);
|
|
5337
|
+
y1 = Math.max(y1, r.y + r.h);
|
|
5338
|
+
}
|
|
5339
|
+
return {
|
|
5340
|
+
ids: ids.map(String),
|
|
5341
|
+
box: {
|
|
5342
|
+
x: x0,
|
|
5343
|
+
y: y0,
|
|
5344
|
+
w: x1 - x0,
|
|
5345
|
+
h: y1 - y0
|
|
5346
|
+
}
|
|
5347
|
+
};
|
|
5348
|
+
};
|
|
5349
|
+
let error = null;
|
|
5350
|
+
const shots = plan.shots.map((sh) => {
|
|
5351
|
+
const stops = [];
|
|
5352
|
+
try {
|
|
5353
|
+
if (Array.isArray(sh.stops)) {
|
|
5354
|
+
const starts = sh.starts, move = sh.move, hold = sh.hold, auto = sh.holdAuto;
|
|
5355
|
+
sh.stops.forEach((ids, k) => {
|
|
5356
|
+
const b = boxOf(ids);
|
|
5357
|
+
if (b) stops.push(Object.assign(b, {
|
|
5358
|
+
start: starts[k],
|
|
5359
|
+
move: move[k],
|
|
5360
|
+
hold: hold[k],
|
|
5361
|
+
holdAuto: auto[k]
|
|
5362
|
+
}));
|
|
5363
|
+
});
|
|
5364
|
+
} else for (const k of [
|
|
5365
|
+
"from",
|
|
5366
|
+
"via",
|
|
5367
|
+
"to"
|
|
5368
|
+
]) {
|
|
5369
|
+
const v = sh[k];
|
|
5370
|
+
if (k === "via" && Array.isArray(v)) v.forEach((ids) => {
|
|
5371
|
+
const b = boxOf(ids);
|
|
5372
|
+
if (b) stops.push(b);
|
|
5373
|
+
});
|
|
5374
|
+
else {
|
|
5375
|
+
const b = boxOf(v);
|
|
5376
|
+
if (b) stops.push(b);
|
|
5377
|
+
}
|
|
5378
|
+
}
|
|
5379
|
+
} catch (e) {
|
|
5380
|
+
error = error || {
|
|
5381
|
+
code: String(e.code || "E_CAMERA_BAD_SHOT"),
|
|
5382
|
+
message: String(e.message || e)
|
|
5383
|
+
};
|
|
5384
|
+
}
|
|
5385
|
+
return {
|
|
5386
|
+
index: sh.index,
|
|
5387
|
+
kind: sh.kind,
|
|
5388
|
+
at: sh.at,
|
|
5389
|
+
dur: Number.isFinite(sh.dur) ? sh.dur : 0,
|
|
5390
|
+
stops
|
|
5391
|
+
};
|
|
5392
|
+
});
|
|
5393
|
+
const path = [];
|
|
5394
|
+
const span = Math.max(plan.end, until > 0 ? until : 0);
|
|
5395
|
+
const dt = Math.max(step > 0 ? step : 1 / 30, span / 2e3);
|
|
5396
|
+
try {
|
|
5397
|
+
for (let t = 0; t <= span + 1e-9; t += dt) {
|
|
5398
|
+
const st = CAM.solve(plan, env, t).state;
|
|
5399
|
+
path.push({
|
|
5400
|
+
t,
|
|
5401
|
+
cx: st.cx,
|
|
5402
|
+
cy: st.cy,
|
|
5403
|
+
z: st.z
|
|
5404
|
+
});
|
|
5405
|
+
}
|
|
5406
|
+
} catch (e) {
|
|
5407
|
+
error = error || {
|
|
5408
|
+
code: String(e.code || "E_CAMERA_BAD_SHOT"),
|
|
5409
|
+
message: String(e.message || e)
|
|
5410
|
+
};
|
|
5411
|
+
}
|
|
5412
|
+
const elements = Array.from(document.querySelectorAll("[data-mosio-id]")).slice(0, 500).map((el) => {
|
|
5413
|
+
const r = el.getBoundingClientRect();
|
|
5414
|
+
return {
|
|
5415
|
+
id: el.getAttribute("data-mosio-id"),
|
|
5416
|
+
box: {
|
|
5417
|
+
x: r.left,
|
|
5418
|
+
y: r.top,
|
|
5419
|
+
w: r.width,
|
|
5420
|
+
h: r.height
|
|
5421
|
+
}
|
|
5422
|
+
};
|
|
5423
|
+
});
|
|
5424
|
+
return {
|
|
5425
|
+
W: plan.W,
|
|
5426
|
+
H: plan.H,
|
|
5427
|
+
SW: plan.SW,
|
|
5428
|
+
SH: plan.SH,
|
|
5429
|
+
end: plan.end,
|
|
5430
|
+
shots,
|
|
5431
|
+
path,
|
|
5432
|
+
elements,
|
|
5433
|
+
error
|
|
5434
|
+
};
|
|
5435
|
+
} finally {
|
|
5436
|
+
body.style.transform = keep;
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5309
5439
|
async function onCmd(e) {
|
|
5310
5440
|
const d = e.data || {};
|
|
5311
5441
|
const id = d.id;
|
|
@@ -5338,6 +5468,15 @@ function agentMain(NONCE) {
|
|
|
5338
5468
|
if (JSON.stringify(result ?? null).length > 2e6) throw new Error("E_PREVIEW_LIMIT: inspect3d reply exceeds 2 MB");
|
|
5339
5469
|
break;
|
|
5340
5470
|
}
|
|
5471
|
+
case "camera":
|
|
5472
|
+
result = camera(Number(d.until) || 0, Number(d.step) || 0);
|
|
5473
|
+
break;
|
|
5474
|
+
case "cameraBypass": {
|
|
5475
|
+
const m = C().__mosio;
|
|
5476
|
+
if (m && typeof m._cameraBypass === "function") m._cameraBypass(d.on === true);
|
|
5477
|
+
result = null;
|
|
5478
|
+
break;
|
|
5479
|
+
}
|
|
5341
5480
|
case "ping":
|
|
5342
5481
|
result = { pong: true };
|
|
5343
5482
|
break;
|
|
@@ -5400,7 +5539,8 @@ function injectPreviewScripts(html, o) {
|
|
|
5400
5539
|
seed: o.seed,
|
|
5401
5540
|
timeoutMs: o.timeoutMs,
|
|
5402
5541
|
...size,
|
|
5403
|
-
timing: o.timing ?? {}
|
|
5542
|
+
timing: o.timing ?? {},
|
|
5543
|
+
...o.texMax ? { texMax: o.texMax } : {}
|
|
5404
5544
|
})};`);
|
|
5405
5545
|
const tags = (o.csp ? `<meta http-equiv="Content-Security-Policy" content="${o.csp.replace(/"/g, """)}">` : "") + (o.baseHref ? `<base href="${o.baseHref.replace(/"/g, """)}">` : "") + `<script>${cfg}<\/script><script>${scriptSafe(o.runtimeJs)}<\/script><script>${scriptSafe(previewAgentSource(o.nonce))}<\/script>`;
|
|
5406
5546
|
const head = /<head(\s[^>]*)?>/i.exec(html);
|
|
@@ -6206,6 +6346,12 @@ function videoGeometry(m, id) {
|
|
|
6206
6346
|
}).fps
|
|
6207
6347
|
};
|
|
6208
6348
|
}
|
|
6349
|
+
/** `mosio_texmax`: a whole number of pixels in 64..8192, else off (an out-of-range or malformed value is ignored, never an error) */
|
|
6350
|
+
function texMaxParam(v) {
|
|
6351
|
+
if (v === null || !/^\d{2,4}$/.test(v)) return void 0;
|
|
6352
|
+
const n = Number(v);
|
|
6353
|
+
return n >= 64 && n <= 8192 ? n : void 0;
|
|
6354
|
+
}
|
|
6209
6355
|
var PreviewOrigin = class {
|
|
6210
6356
|
o;
|
|
6211
6357
|
server = null;
|
|
@@ -6320,7 +6466,8 @@ var PreviewOrigin = class {
|
|
|
6320
6466
|
height: v.height,
|
|
6321
6467
|
timeoutMs: this.o.timeoutMs,
|
|
6322
6468
|
nonce,
|
|
6323
|
-
timing
|
|
6469
|
+
timing,
|
|
6470
|
+
texMax: texMaxParam(url.searchParams.get("mosio_texmax"))
|
|
6324
6471
|
});
|
|
6325
6472
|
} catch (e) {
|
|
6326
6473
|
res.writeHead(400, security).end(String(e.message));
|
|
@@ -6376,7 +6523,10 @@ async function startBridge(o) {
|
|
|
6376
6523
|
const token = o.token ?? crypto.randomUUID().replace(/-/g, "");
|
|
6377
6524
|
const runtimeJs = await readFile(o.runtimeJsPath, "utf8");
|
|
6378
6525
|
const embeddedLibs = /* @__PURE__ */ new Map();
|
|
6379
|
-
for (const [pub, src] of Object.entries(o.embeddedLibs ?? {
|
|
6526
|
+
for (const [pub, src] of Object.entries(o.embeddedLibs ?? {
|
|
6527
|
+
"mosio-three@0.1.0/mosio-three.js": join(dirname(o.runtimeJsPath), "adapters/mosio-three.js"),
|
|
6528
|
+
"mosio-three@0.1.0/room-env-pmrem.json": join(dirname(o.runtimeJsPath), "adapters/room-env-pmrem.json")
|
|
6529
|
+
})) try {
|
|
6380
6530
|
embeddedLibs.set(pub, await readFile(src, "utf8"));
|
|
6381
6531
|
} catch (e) {
|
|
6382
6532
|
if (o.embeddedLibs) throw e;
|
|
@@ -6824,6 +6974,33 @@ function validAgentHostUrl(v) {
|
|
|
6824
6974
|
return "not a valid URL";
|
|
6825
6975
|
}
|
|
6826
6976
|
}
|
|
6977
|
+
// src/state/merge.ts
|
|
6978
|
+
var MERGE_TARGET_RE = /^[A-Za-z0-9][A-Za-z0-9._/@{}-]{0,127}$/;
|
|
6979
|
+
var MAX_RESOLUTION_JSON = 65536;
|
|
6980
|
+
/** the value of `--resolve KEY=<value>` */
|
|
6981
|
+
function resolveValue(choice) {
|
|
6982
|
+
if (choice === "ours" || choice === "theirs") return choice;
|
|
6983
|
+
return choice.json;
|
|
6984
|
+
}
|
|
6985
|
+
/** the `KEY=ours|theirs|<json>` argument of one conflict */
|
|
6986
|
+
function resolveArg(key, choice) {
|
|
6987
|
+
return `${key}=${resolveValue(choice)}`;
|
|
6988
|
+
}
|
|
6989
|
+
/** why a resolution cannot be sent (null: fine). The Core still has the last word. */
|
|
6990
|
+
function checkResolution(r) {
|
|
6991
|
+
if (!r || typeof r !== "object") return "a resolution must be an object";
|
|
6992
|
+
const { key, choice } = r;
|
|
6993
|
+
if (typeof key !== "string" || !key.includes("#") || key.length > 1024 || /[\0\r\n]/.test(key)) return "a resolution needs the conflict's key";
|
|
6994
|
+
if (choice === "ours" || choice === "theirs") return null;
|
|
6995
|
+
const j = choice?.json;
|
|
6996
|
+
if (typeof j !== "string" || j.length > 65536) return `${key}: the value must be JSON text of at most ${MAX_RESOLUTION_JSON} characters`;
|
|
6997
|
+
try {
|
|
6998
|
+
JSON.parse(j);
|
|
6999
|
+
} catch {
|
|
7000
|
+
return `${key}: the value is not valid JSON`;
|
|
7001
|
+
}
|
|
7002
|
+
return null;
|
|
7003
|
+
}
|
|
6827
7004
|
// server/scaffold.ts
|
|
6828
7005
|
/**
|
|
6829
7006
|
* New-video scaffolding for the Studio host. Nothing here is a second implementation: primitives are
|
|
@@ -7536,6 +7713,79 @@ var StudioHost = class {
|
|
|
7536
7713
|
await this.settingsStore.update(patch);
|
|
7537
7714
|
return this.settings();
|
|
7538
7715
|
}
|
|
7716
|
+
async openDir(projectId) {
|
|
7717
|
+
if (typeof projectId !== "string" || !this.bridges.has(projectId)) throw new HostError("E_NOT_OPEN", "the project is not open in this Studio", 409);
|
|
7718
|
+
return projectId;
|
|
7719
|
+
}
|
|
7720
|
+
/** one Core call; a Core error keeps its code (E_TAKE_DIRTY, E_MERGE_RESOLVE, ...) and loses the host's paths */
|
|
7721
|
+
async core(args) {
|
|
7722
|
+
try {
|
|
7723
|
+
return await runCli({
|
|
7724
|
+
bin: await this.coreBin(),
|
|
7725
|
+
lock: this.o.lock
|
|
7726
|
+
}, args, { timeoutMs: 12e4 }).result;
|
|
7727
|
+
} catch (e) {
|
|
7728
|
+
const m = e instanceof Error ? e.message : String(e);
|
|
7729
|
+
const code = e.code;
|
|
7730
|
+
const c = typeof code === "string" ? code : /^([EW]_[A-Z0-9_]+):/.exec(m)?.[1] ?? "E_HOST";
|
|
7731
|
+
const status = /^E_(TAKE_DIRTY|REVISION_CONFLICT)$/.test(c) ? 409 : /^E_(MERGE_RESOLVE|MERGE_UNRELATED|MERGE_NO_REVISION)$/.test(c) ? 400 : 500;
|
|
7732
|
+
throw new HostError(c, m.replace(/^[EW]_[A-Z0-9_]+:\s*/, "").replace(/(?:\/[^\s:'"`]+){2,}/g, "<path>").slice(0, 600), status);
|
|
7733
|
+
}
|
|
7734
|
+
}
|
|
7735
|
+
/** the project's takes (`mosio take list`), the current one marked */
|
|
7736
|
+
async takes(projectId) {
|
|
7737
|
+
const dir = await this.openDir(projectId);
|
|
7738
|
+
const r = await this.core([
|
|
7739
|
+
"take",
|
|
7740
|
+
"list",
|
|
7741
|
+
"--",
|
|
7742
|
+
dir
|
|
7743
|
+
]);
|
|
7744
|
+
return {
|
|
7745
|
+
current: typeof r.current === "string" ? r.current : null,
|
|
7746
|
+
takes: Array.isArray(r.takes) ? r.takes : []
|
|
7747
|
+
};
|
|
7748
|
+
}
|
|
7749
|
+
mergeArgs(dir, target, resolutions, dryRun, message) {
|
|
7750
|
+
if (typeof target !== "string" || !MERGE_TARGET_RE.test(target)) throw new HostError("E_BAD_REQUEST", "target: the name of a take (letters, digits, . _ - /)");
|
|
7751
|
+
return [
|
|
7752
|
+
"merge",
|
|
7753
|
+
...dryRun ? ["--dry-run"] : ["--author=human:studio", ...message ? [`--message=${message}`] : []],
|
|
7754
|
+
...resolutions.map((r) => `--resolve=${resolveArg(r.key, r.choice)}`),
|
|
7755
|
+
"--",
|
|
7756
|
+
dir,
|
|
7757
|
+
target
|
|
7758
|
+
];
|
|
7759
|
+
}
|
|
7760
|
+
resolutionsOf(raw) {
|
|
7761
|
+
if (raw === void 0) return [];
|
|
7762
|
+
if (!Array.isArray(raw) || raw.length > 500) throw new HostError("E_BAD_REQUEST", `resolutions: a list of at most 500`);
|
|
7763
|
+
for (const r of raw) {
|
|
7764
|
+
const bad = checkResolution(r);
|
|
7765
|
+
if (bad) throw new HostError("E_BAD_REQUEST", `resolutions: ${bad}`);
|
|
7766
|
+
}
|
|
7767
|
+
return raw;
|
|
7768
|
+
}
|
|
7769
|
+
/** what merging `target` into the current take would do (`mosio merge --dry-run`): nothing is written */
|
|
7770
|
+
async mergePreview(projectId, target, resolutions) {
|
|
7771
|
+
const dir = await this.openDir(projectId);
|
|
7772
|
+
return await this.core(this.mergeArgs(dir, target, this.resolutionsOf(resolutions), true));
|
|
7773
|
+
}
|
|
7774
|
+
/**
|
|
7775
|
+
* Merge `target` into the current take with the person's answers. A merge that still has conflicts writes nothing (the
|
|
7776
|
+
* Core is all or nothing); it is answered with the conflict document, as `--dry-run` prints it, so the view can show them.
|
|
7777
|
+
*/
|
|
7778
|
+
async mergeApply(projectId, target, resolutions, message) {
|
|
7779
|
+
const dir = await this.openDir(projectId);
|
|
7780
|
+
const rs = this.resolutionsOf(resolutions);
|
|
7781
|
+
const msg = typeof message === "string" && message.trim() && message.length <= 200 && !/[\0\r\n]/.test(message) ? message.trim() : void 0;
|
|
7782
|
+
try {
|
|
7783
|
+
return await this.core(this.mergeArgs(dir, target, rs, false, msg));
|
|
7784
|
+
} catch (e) {
|
|
7785
|
+
if (e instanceof HostError && e.code === "E_MERGE_CONFLICT") return await this.core(this.mergeArgs(dir, target, rs, true));
|
|
7786
|
+
throw e;
|
|
7787
|
+
}
|
|
7788
|
+
}
|
|
7539
7789
|
primitives() {
|
|
7540
7790
|
return listPrimitives(this.repo);
|
|
7541
7791
|
}
|
|
@@ -7946,6 +8196,15 @@ async function startHostServer(o) {
|
|
|
7946
8196
|
const b = await readJson(req);
|
|
7947
8197
|
return send(res, 200, await o.host.addScene(String(b.projectId ?? ""), String(b.primitive ?? ""), b.id === void 0 ? void 0 : String(b.id)));
|
|
7948
8198
|
}
|
|
8199
|
+
if (req.method === "GET" && path === "takes") return send(res, 200, await o.host.takes(query.get("project")));
|
|
8200
|
+
if (req.method === "POST" && path === "merge-preview") {
|
|
8201
|
+
const b = await readJson(req, 524288);
|
|
8202
|
+
return send(res, 200, await o.host.mergePreview(b.projectId, b.target, b.resolutions));
|
|
8203
|
+
}
|
|
8204
|
+
if (req.method === "POST" && path === "merge-apply") {
|
|
8205
|
+
const b = await readJson(req, 524288);
|
|
8206
|
+
return send(res, 200, await o.host.mergeApply(b.projectId, b.target, b.resolutions, b.message));
|
|
8207
|
+
}
|
|
7949
8208
|
if (req.method === "POST" && path === "focus") return send(res, 200, await o.host.setFocus(await readJson(req, FOCUS_MAX_BYTES)));
|
|
7950
8209
|
if (req.method === "GET" && path === "agent") return send(res, 200, await o.host.agentPresence(query.get("project") ?? ""));
|
|
7951
8210
|
if (req.method === "GET" && path === "info") return send(res, 200, await o.host.info());
|
package/bin/mosio
CHANGED
|
Binary file
|
package/bin/mosio-agent
CHANGED
|
Binary file
|
|
@@ -51,8 +51,79 @@ function liveHost() {
|
|
|
51
51
|
random: Math.random,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
+
// timing marks (performance.mark only: no effect on pixels or state); the first-attach bench reads the mosio3d:* ones
|
|
55
|
+
const mk = (n) => { try { performance.mark("mosio3d:" + n); } catch (_) { /* no performance timeline */ } };
|
|
56
|
+
mk("module");
|
|
54
57
|
const host = () => window.__mosio || (window.__mosioLive ||= liveHost());
|
|
55
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Opt-in preview speed-up (`__MOSIO_CFG.texMax`, set by a preview origin that was asked for it; never by a render):
|
|
61
|
+
* an image larger than `max` on its long side is resampled (high quality, off the main thread) before it is uploaded.
|
|
62
|
+
* This changes pixels, so renders never set it.
|
|
63
|
+
*/
|
|
64
|
+
async function capTexture(tex, max) {
|
|
65
|
+
const img = tex.image, w = img && img.width, h = img && img.height;
|
|
66
|
+
if (!w || !h || typeof ImageBitmap === "undefined" || !(img instanceof ImageBitmap) || Math.max(w, h) <= max) return;
|
|
67
|
+
const k = max / Math.max(w, h);
|
|
68
|
+
try {
|
|
69
|
+
const bm = await createImageBitmap(img, { resizeWidth: Math.max(1, Math.round(w * k)), resizeHeight: Math.max(1, Math.round(h * k)), resizeQuality: "high", premultiplyAlpha: "none", colorSpaceConversion: "none" });
|
|
70
|
+
tex.source.data = bm;
|
|
71
|
+
img.close();
|
|
72
|
+
} catch (_) { /* keep the full-size image */ }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ---------------------------------------------------------------- baked RoomEnvironment PMREM (software GPU only)
|
|
76
|
+
// RoomEnvironment through PMREMGenerator costs ~0.9 s on the software GPU (SwiftShader) at every page load, for the same
|
|
77
|
+
// result each time. For that exact setup (three revision, Chromium major, 256 px, sigma 0.04, SwiftShader) the filtered
|
|
78
|
+
// cube is shipped as room-env-pmrem.json (scripts/3d-bake-room-env.mjs writes it, and --verify proves it still equals what
|
|
79
|
+
// the live path computes) and uploaded instead. Anything else (a real GPU, another three or Chromium, a missing file, any
|
|
80
|
+
// failure before the first GL call) takes the live path, so pixels are the same either way.
|
|
81
|
+
const ROOM_ENV_URL = new URL("./room-env-pmrem.json", import.meta.url);
|
|
82
|
+
async function bakedRoomEnv(THREE, renderer) {
|
|
83
|
+
if (window.__mosio3dNoBake) return null;
|
|
84
|
+
const gl = renderer.getContext();
|
|
85
|
+
const dbg = gl.getExtension("WEBGL_debug_renderer_info");
|
|
86
|
+
if (!/swiftshader/i.test(String(dbg ? gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL) : ""))) return null;
|
|
87
|
+
let meta, bytes;
|
|
88
|
+
try {
|
|
89
|
+
const r = await fetch(ROOM_ENV_URL);
|
|
90
|
+
if (!r.ok) return null;
|
|
91
|
+
const j = await r.json();
|
|
92
|
+
meta = j.meta;
|
|
93
|
+
const raw = Uint8Array.from(atob(j.data), (c) => c.charCodeAt(0));
|
|
94
|
+
bytes = new Uint8Array(await new Response(new Blob([raw]).stream().pipeThrough(new DecompressionStream("deflate-raw"))).arrayBuffer());
|
|
95
|
+
} catch (_) { return null; }
|
|
96
|
+
const chrome = (/Chrome\/(\d+)/.exec(navigator.userAgent) || [])[1];
|
|
97
|
+
if (!meta || meta.three !== THREE.REVISION || meta.chrome !== chrome || meta.size !== 256 || meta.sigma !== 0.04 || !renderer.initRenderTarget || !renderer.state || !renderer.properties) return null;
|
|
98
|
+
const gen = new THREE.PMREMGenerator(renderer);
|
|
99
|
+
let rt;
|
|
100
|
+
try { gen._setSize(meta.size); rt = gen._allocateTarget(); } catch (_) { gen.dispose(); return null; }
|
|
101
|
+
gen.dispose();
|
|
102
|
+
const lods = rt.texture.mipmaps.length;
|
|
103
|
+
let need = 0;
|
|
104
|
+
for (let l = 0; l < lods; l++) need += 6 * (meta.size >> l) * (meta.size >> l) * 8;
|
|
105
|
+
if (lods !== meta.lods || bytes.length !== need) { rt.dispose(); return null; }
|
|
106
|
+
renderer.initRenderTarget(rt);
|
|
107
|
+
const tex = renderer.properties.get(rt.texture).__webglTexture;
|
|
108
|
+
if (!tex) { rt.dispose(); return null; }
|
|
109
|
+
const st = renderer.state;
|
|
110
|
+
st.activeTexture(gl.TEXTURE0);
|
|
111
|
+
st.bindTexture(gl.TEXTURE_CUBE_MAP, tex);
|
|
112
|
+
st.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
113
|
+
st.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
114
|
+
st.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
|
|
115
|
+
let off = 0;
|
|
116
|
+
for (let l = 0; l < lods; l++) {
|
|
117
|
+
const w = meta.size >> l, n = w * w * 4;
|
|
118
|
+
for (let f = 0; f < 6; f++) {
|
|
119
|
+
gl.texSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, l, 0, 0, w, w, gl.RGBA, gl.HALF_FLOAT, new Uint16Array(bytes.buffer, bytes.byteOffset + off, n));
|
|
120
|
+
off += n * 2;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
st.unbindTexture();
|
|
124
|
+
return rt;
|
|
125
|
+
}
|
|
126
|
+
|
|
56
127
|
// ---------------------------------------------------------------- deterministic RNG (mulberry32, state is a number)
|
|
57
128
|
export function rng(seed) {
|
|
58
129
|
let s = seed >>> 0;
|
|
@@ -82,6 +153,7 @@ export const span = (t, a, b, e = smooth) => e((t - a) / Math.max(1e-9, b - a));
|
|
|
82
153
|
|
|
83
154
|
// ---------------------------------------------------------------- stage
|
|
84
155
|
export async function createStage(opts = {}) {
|
|
156
|
+
mk("createStage");
|
|
85
157
|
const H = host();
|
|
86
158
|
const THREE = opts.THREE || THREE_BASE;
|
|
87
159
|
const backend = opts.backend || "webgl";
|
|
@@ -159,7 +231,7 @@ export async function createStage(opts = {}) {
|
|
|
159
231
|
if ((window.__MOSIO_CFG || {}).gpu && backend === "webgl") {
|
|
160
232
|
const gl = renderer.getContext(), dbg = gl.getExtension("WEBGL_debug_renderer_info");
|
|
161
233
|
const name = String(dbg ? gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL) : gl.getParameter(gl.RENDERER));
|
|
162
|
-
if (/swiftshader|llvmpipe|lavapipe|software/i.test(name)) { setupHandle.done(); failCode("E_GPU_FALLBACK", `GPU profile, but WebGL renders with "${name}"`); return new Promise(() => {}); }
|
|
234
|
+
if (/swiftshader|llvmpipe|lavapipe|software|microsoft basic/i.test(name)) { setupHandle.done(); failCode("E_GPU_FALLBACK", `GPU profile, but WebGL renders with "${name}"`); return new Promise(() => {}); }
|
|
163
235
|
}
|
|
164
236
|
// a lost context draws nothing: fail the frame instead of capturing a blank canvas
|
|
165
237
|
canvas.addEventListener("webglcontextlost", () => H.fail("E_GPU_CONTEXT_LOST", "WebGL context lost"));
|
|
@@ -174,6 +246,7 @@ export async function createStage(opts = {}) {
|
|
|
174
246
|
gl.deleteTexture = (t) => { live.delete(t); return del(t); };
|
|
175
247
|
stage.glTextures = live;
|
|
176
248
|
}
|
|
249
|
+
mk("renderer");
|
|
177
250
|
renderer.setPixelRatio(opts.pixelRatio || window.devicePixelRatio || 1);
|
|
178
251
|
renderer.setSize(width, height, false);
|
|
179
252
|
renderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
@@ -212,11 +285,28 @@ export async function createStage(opts = {}) {
|
|
|
212
285
|
const addon = async (path) => (loaderCache[path] ||= import(`three/addons/${path}`));
|
|
213
286
|
const load = {};
|
|
214
287
|
load.gltf = async (url, o = {}) => {
|
|
288
|
+
mk("gltf:start");
|
|
215
289
|
const { GLTFLoader } = await addon("loaders/GLTFLoader.js");
|
|
216
290
|
// GLTFLoader only logs a failed texture and continues without it: report it as a typed failure instead
|
|
217
291
|
const manager = new THREE.LoadingManager();
|
|
218
292
|
manager.onError = (u) => H.fail("E_ASSET_MISSING", `${url} references ${String(u).replace(location.origin, "")}, which could not be loaded`);
|
|
219
293
|
const loader = new GLTFLoader(manager);
|
|
294
|
+
// Opt-in fast preview (see capTexture): each material's images are resized as soon as that material is complete,
|
|
295
|
+
// so the resizes overlap the other images' decoding, and uploaded right away. Without texMax nothing is registered.
|
|
296
|
+
const texMax = Math.floor(+(window.__MOSIO_CFG || {}).texMax) || 0;
|
|
297
|
+
if (texMax && backend === "webgl") {
|
|
298
|
+
loader.register((parser) => {
|
|
299
|
+
const loadMaterial = parser.loadMaterial.bind(parser);
|
|
300
|
+
parser.loadMaterial = (i) => loadMaterial(i).then(async (mat) => {
|
|
301
|
+
const texs = [];
|
|
302
|
+
for (const k of Object.keys(mat)) if (mat[k] && mat[k].isTexture) texs.push(mat[k]);
|
|
303
|
+
await Promise.all(texs.map((t) => capTexture(t, texMax)));
|
|
304
|
+
for (const t of texs) { try { renderer.initTexture(t); } catch (_) { /* the later pass retries */ } }
|
|
305
|
+
return mat;
|
|
306
|
+
});
|
|
307
|
+
return { name: "MOSIO_texmax" };
|
|
308
|
+
});
|
|
309
|
+
}
|
|
220
310
|
if (o.draco) {
|
|
221
311
|
const { DRACOLoader } = await addon("loaders/DRACOLoader.js");
|
|
222
312
|
const d = new DRACOLoader();
|
|
@@ -234,10 +324,12 @@ export async function createStage(opts = {}) {
|
|
|
234
324
|
loader.setKTX2Loader(k);
|
|
235
325
|
stage.ktx2 = k;
|
|
236
326
|
}
|
|
327
|
+
mk("gltf:fetch:" + url.split("/").pop());
|
|
237
328
|
const gltf = await new Promise((res, rej) => loader.load(url, res, undefined, rej)).catch((e) => {
|
|
238
329
|
const msg = String((e && (e.message || e.target?.status)) || e);
|
|
239
330
|
throw failCode(/404|Not Found|Failed to fetch|BlockedByClient/i.test(msg) ? "E_ASSET_MISSING" : "E_ASSET_DECODE", `${url}: ${msg}`);
|
|
240
331
|
});
|
|
332
|
+
mk("gltf:loaded:" + url.split("/").pop());
|
|
241
333
|
if (o.ids !== false) ctx.bindIds(gltf.scene, o.prefix);
|
|
242
334
|
gltf.scene.traverse((m) => {
|
|
243
335
|
if (m.isMesh) { m.castShadow = o.castShadow ?? true; m.receiveShadow = o.receiveShadow ?? true; }
|
|
@@ -265,17 +357,23 @@ export async function createStage(opts = {}) {
|
|
|
265
357
|
ctx.load = load;
|
|
266
358
|
/** Procedural studio environment (RoomEnvironment through PMREM): image-based lighting without an HDR file. */
|
|
267
359
|
ctx.roomEnvironment = async (intensity = 1) => {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
360
|
+
mk("env:start");
|
|
361
|
+
let rt = backend === "webgl" ? await bakedRoomEnv(THREE, renderer) : null;
|
|
362
|
+
stage.roomEnvBaked = !!rt;
|
|
363
|
+
if (!rt) {
|
|
364
|
+
const { RoomEnvironment } = await addon("environments/RoomEnvironment.js");
|
|
365
|
+
const pmrem = new THREE.PMREMGenerator(renderer);
|
|
366
|
+
const room = new RoomEnvironment();
|
|
367
|
+
rt = pmrem.fromScene(room, 0.04);
|
|
368
|
+
pmrem.dispose();
|
|
369
|
+
room.dispose?.();
|
|
370
|
+
room.traverse?.((o) => { o.geometry?.dispose(); [].concat(o.material || []).forEach((m) => m.dispose()); });
|
|
371
|
+
}
|
|
272
372
|
const env = rt.texture;
|
|
273
|
-
pmrem.dispose();
|
|
274
|
-
room.dispose?.();
|
|
275
|
-
room.traverse?.((o) => { o.geometry?.dispose(); [].concat(o.material || []).forEach((m) => m.dispose()); });
|
|
276
373
|
(stage.targets ||= []).push(rt);
|
|
277
374
|
scene.environment = env;
|
|
278
375
|
scene.environmentIntensity = intensity;
|
|
376
|
+
mk("env:end");
|
|
279
377
|
stage.textures.add(env);
|
|
280
378
|
return env;
|
|
281
379
|
};
|
|
@@ -475,12 +573,16 @@ export async function createStage(opts = {}) {
|
|
|
475
573
|
|
|
476
574
|
// ---- setup, then hand control to Mosio's clock
|
|
477
575
|
try {
|
|
576
|
+
mk("setup:start");
|
|
478
577
|
if (opts.setup) await opts.setup(ctx);
|
|
578
|
+
mk("setup:end");
|
|
479
579
|
// Precompile programs now. Not compileAsync on WebGL: it polls with setTimeout, and Mosio's timers are virtual
|
|
480
580
|
// (they advance only on seek), so it would wait forever inside the setup handle.
|
|
481
581
|
// Not compileAsync on WebGPU either: its createRenderPipelineAsync path failed on Chromium 158's SwiftShader adapter
|
|
482
582
|
// with "OperationError: Instance dropped in popErrorScope" (RUN VERIFIED); the synchronous pipeline path works.
|
|
483
583
|
if (backend === "webgl") renderer.compile(scene, camera);
|
|
584
|
+
mk("compile:end");
|
|
585
|
+
mk("textures:begin");
|
|
484
586
|
for (const tex of stage.textures) { try { renderer.initTexture?.(tex); } catch (_) { /* optional */ } }
|
|
485
587
|
} catch (e) {
|
|
486
588
|
if (!/^E_/.test(String(e && e.message))) H.fail("E_SCENE_SCRIPT_ERROR", String(e && e.stack || e));
|
|
@@ -491,8 +593,10 @@ export async function createStage(opts = {}) {
|
|
|
491
593
|
// an override for an id the scene never bound is a typed failure, not a silent no-op
|
|
492
594
|
const unknown = Object.keys(stage.overrides || {}).filter((id) => !stage.objects.has(id));
|
|
493
595
|
if (unknown.length) { setupHandle.done(); failCode("E_OVERRIDES3D_UNKNOWN_ID", `data-mosio3d-overrides names objects this scene does not bind: ${unknown.slice(0, 5).join(", ")}`); return new Promise(() => {}); }
|
|
596
|
+
mk("textures:end");
|
|
494
597
|
H.onSeek((t, frame) => renderAt(t, frame));
|
|
495
598
|
setupHandle.done();
|
|
599
|
+
mk("ready");
|
|
496
600
|
|
|
497
601
|
// ---- inspection surface (mosio inspect3d)
|
|
498
602
|
stage.inspect = (o = {}) => inspect(stage, ctx, camera, lastStats, o);
|