oriverse-engine 0.1.3 → 0.1.5

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.
Binary file
@@ -2,9 +2,14 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const bootOriverseArtifact: (a: number, b: number) => any;
5
- export const sim_worker_init: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
5
+ export const sim_worker_init: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => void;
6
6
  export const sim_worker_start_ticker: (a: number) => [number, number];
7
7
  export const start_wasm_oriverse: () => void;
8
+ export const live_sim_log_objects_entry: (a: number, b: number, c: number, d: number) => [number, number];
9
+ export const live_sim_log_simcalls_entry: (a: number, b: number, c: number, d: number) => [number, number];
10
+ export const materialize_source_entry: (a: number, b: number, c: number, d: number) => [number, number];
11
+ export const text_playtest_entry: (a: number, b: number, c: number, d: number) => [number, number];
12
+ export const ui_inspect_entry: (a: number, b: number, c: number, d: number) => [number, number];
8
13
  export const validate_world_entry: (a: number, b: number, c: number) => [number, number];
9
14
  export const validate_world_shared_entry: (a: number, b: number, c: number) => [number, number];
10
15
  export const worker_attach_read_dc: (a: any) => void;
@@ -12,56 +17,57 @@ export const worker_attach_write_dc: (a: any, b: any) => void;
12
17
  export const worker_init: (a: number, b: number) => void;
13
18
  export const worker_init_write: (a: number, b: number, c: number, d: number) => void;
14
19
  export const init_market_client_message_bridge: (a: any) => [number, number];
15
- export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
16
20
  export const __wbg_intounderlyingsink_free: (a: number, b: number) => void;
21
+ export const intounderlyingsink_abort: (a: number, b: any) => any;
22
+ export const intounderlyingsink_close: (a: number) => any;
23
+ export const intounderlyingsink_write: (a: number, b: any) => any;
24
+ export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
17
25
  export const __wbg_intounderlyingsource_free: (a: number, b: number) => void;
18
26
  export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
19
27
  export const intounderlyingbytesource_cancel: (a: number) => void;
20
28
  export const intounderlyingbytesource_pull: (a: number, b: any) => any;
21
29
  export const intounderlyingbytesource_start: (a: number, b: any) => void;
22
30
  export const intounderlyingbytesource_type: (a: number) => number;
23
- export const intounderlyingsink_abort: (a: number, b: any) => any;
24
- export const intounderlyingsink_close: (a: number) => any;
25
- export const intounderlyingsink_write: (a: number, b: any) => any;
26
31
  export const intounderlyingsource_cancel: (a: number) => void;
27
32
  export const intounderlyingsource_pull: (a: number, b: any) => any;
28
- export const wasm_bindgen__closure__destroy__h16dcef86690f8892: (a: number, b: number) => void;
29
- export const wasm_bindgen__closure__destroy__h0def89a02ad24e25: (a: number, b: number) => void;
30
- export const wasm_bindgen__closure__destroy__hf04f1b52029392cb: (a: number, b: number) => void;
31
- export const wasm_bindgen__closure__destroy__h8d68c0c402e150fa: (a: number, b: number) => void;
32
- export const wasm_bindgen__closure__destroy__h08b6962c9c4a8461: (a: number, b: number) => void;
33
- export const wasm_bindgen__closure__destroy__h22ca06dde759e186: (a: number, b: number) => void;
34
- export const wasm_bindgen__closure__destroy__h2fa417b22e371ac0: (a: number, b: number) => void;
35
- export const wasm_bindgen__closure__destroy__h497a5311ffee252b: (a: number, b: number) => void;
36
- export const wasm_bindgen__closure__destroy__h83f8bfe43e51586e: (a: number, b: number) => void;
37
- export const wasm_bindgen__closure__destroy__h10eef66b5be2507e: (a: number, b: number) => void;
38
- export const wasm_bindgen__convert__closures_____invoke__hac271129345e7e86: (a: number, b: number, c: number, d: number, e: number) => void;
39
- export const wasm_bindgen__convert__closures_____invoke__h4374361ee1621ef3: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
40
- export const wasm_bindgen__convert__closures_____invoke__haaac04ac4b28b1dc: (a: number, b: number, c: any, d: any) => void;
41
- export const wasm_bindgen__convert__closures_____invoke__h6d3b5d34c5205706: (a: number, b: number, c: number, d: number) => void;
42
- export const wasm_bindgen__convert__closures_____invoke__h9fd153286ed41e9c: (a: number, b: number, c: any, d: any) => void;
43
- export const wasm_bindgen__convert__closures_____invoke__h1425c1d15e69fe66: (a: number, b: number, c: any) => [number, number];
44
- export const wasm_bindgen__convert__closures_____invoke__h65f53cb9c5fcb430: (a: number, b: number, c: any, d: any) => void;
45
- export const wasm_bindgen__convert__closures_____invoke__h4f46b7e32e5cc5de: (a: number, b: number, c: any) => void;
46
- export const wasm_bindgen__convert__closures_____invoke__h1352e4fb5458c013: (a: number, b: number, c: any) => void;
47
- export const wasm_bindgen__convert__closures_____invoke__h1352e4fb5458c013_5: (a: number, b: number, c: any) => void;
48
- export const wasm_bindgen__convert__closures_____invoke__h1352e4fb5458c013_6: (a: number, b: number, c: any) => void;
49
- export const wasm_bindgen__convert__closures_____invoke__h1352e4fb5458c013_7: (a: number, b: number, c: any) => void;
50
- export const wasm_bindgen__convert__closures_____invoke__h195f08c6c1eced42: (a: number, b: number, c: any) => void;
51
- export const wasm_bindgen__convert__closures_____invoke__h3803a1e8b18ffddc: (a: number, b: number, c: any) => void;
52
- export const wasm_bindgen__convert__closures_____invoke__h27c0605e3bdfefc1: (a: number, b: number, c: any) => void;
53
- export const wasm_bindgen__convert__closures_____invoke__h27c0605e3bdfefc1_14: (a: number, b: number, c: any) => void;
54
- export const wasm_bindgen__convert__closures_____invoke__h27c0605e3bdfefc1_15: (a: number, b: number, c: any) => void;
55
- export const wasm_bindgen__convert__closures_____invoke__h27c0605e3bdfefc1_16: (a: number, b: number, c: any) => void;
56
- export const wasm_bindgen__convert__closures_____invoke__h27c0605e3bdfefc1_17: (a: number, b: number, c: any) => void;
57
- export const wasm_bindgen__convert__closures_____invoke__h27c0605e3bdfefc1_18: (a: number, b: number, c: any) => void;
58
- export const wasm_bindgen__convert__closures_____invoke__h27c0605e3bdfefc1_19: (a: number, b: number, c: any) => void;
59
- export const wasm_bindgen__convert__closures_____invoke__h27c0605e3bdfefc1_20: (a: number, b: number, c: any) => void;
60
- export const wasm_bindgen__convert__closures_____invoke__ha87a485729c1bc45: (a: number, b: number, c: number) => void;
61
- export const wasm_bindgen__convert__closures_____invoke__h5fae2a5a8b174cd2: (a: number, b: number, c: any) => void;
62
- export const wasm_bindgen__convert__closures_____invoke__hbc8eaa61aedbf990: (a: number, b: number) => void;
63
- export const wasm_bindgen__convert__closures_____invoke__h916e8c5bf71a8454: (a: number, b: number) => void;
64
- export const wasm_bindgen__convert__closures_____invoke__hcba5ad8b0d96cf50: (a: number, b: number) => void;
33
+ export const wasm_bindgen__closure__destroy__h175ea9953c111419: (a: number, b: number) => void;
34
+ export const wasm_bindgen__closure__destroy__h89c85bd0b07be596: (a: number, b: number) => void;
35
+ export const wasm_bindgen__closure__destroy__hd809ba2104dce3be: (a: number, b: number) => void;
36
+ export const wasm_bindgen__closure__destroy__h788eb94be5c10650: (a: number, b: number) => void;
37
+ export const wasm_bindgen__closure__destroy__h41503ab709c8af95: (a: number, b: number) => void;
38
+ export const wasm_bindgen__closure__destroy__h401c85a5dc4f689e: (a: number, b: number) => void;
39
+ export const wasm_bindgen__closure__destroy__h2504b00990fec809: (a: number, b: number) => void;
40
+ export const wasm_bindgen__closure__destroy__h6f1d7755af5a834d: (a: number, b: number) => void;
41
+ export const wasm_bindgen__closure__destroy__h780a4b6abdc124b2: (a: number, b: number) => void;
42
+ export const wasm_bindgen__closure__destroy__h08502510f6f722ca: (a: number, b: number) => void;
43
+ export const wasm_bindgen__convert__closures_____invoke__hee217a849ef8cb8a: (a: number, b: number, c: number, d: number, e: number) => void;
44
+ export const wasm_bindgen__convert__closures_____invoke__hb8ca66f61e41cce5: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
45
+ export const wasm_bindgen__convert__closures_____invoke__h5403ccc7e321a332: (a: number, b: number, c: any, d: any) => void;
46
+ export const wasm_bindgen__convert__closures_____invoke__hb11eab9190fa9385: (a: number, b: number, c: number, d: number) => void;
47
+ export const wasm_bindgen__convert__closures_____invoke__h81d27409c27c1959: (a: number, b: number, c: any, d: any) => void;
48
+ export const wasm_bindgen__convert__closures_____invoke__hc8bca67d3586a92f: (a: number, b: number, c: any) => [number, number];
49
+ export const wasm_bindgen__convert__closures_____invoke__h4e1d18a25cb702b7: (a: number, b: number, c: any, d: any) => void;
50
+ export const wasm_bindgen__convert__closures_____invoke__h3406abafb95730ac: (a: number, b: number, c: any) => void;
51
+ export const wasm_bindgen__convert__closures_____invoke__h3406abafb95730ac_2: (a: number, b: number, c: any) => void;
52
+ export const wasm_bindgen__convert__closures_____invoke__h3406abafb95730ac_3: (a: number, b: number, c: any) => void;
53
+ export const wasm_bindgen__convert__closures_____invoke__h3406abafb95730ac_4: (a: number, b: number, c: any) => void;
54
+ export const wasm_bindgen__convert__closures_____invoke__h549f7ddd74327602: (a: number, b: number, c: any) => void;
55
+ export const wasm_bindgen__convert__closures_____invoke__hb901e6d890fc7df6: (a: number, b: number, c: any) => void;
56
+ export const wasm_bindgen__convert__closures_____invoke__h47a1f4e9ed4c9186: (a: number, b: number, c: any) => void;
57
+ export const wasm_bindgen__convert__closures_____invoke__h47a1f4e9ed4c9186_11: (a: number, b: number, c: any) => void;
58
+ export const wasm_bindgen__convert__closures_____invoke__h47a1f4e9ed4c9186_12: (a: number, b: number, c: any) => void;
59
+ export const wasm_bindgen__convert__closures_____invoke__h47a1f4e9ed4c9186_13: (a: number, b: number, c: any) => void;
60
+ export const wasm_bindgen__convert__closures_____invoke__h47a1f4e9ed4c9186_14: (a: number, b: number, c: any) => void;
61
+ export const wasm_bindgen__convert__closures_____invoke__h47a1f4e9ed4c9186_15: (a: number, b: number, c: any) => void;
62
+ export const wasm_bindgen__convert__closures_____invoke__h47a1f4e9ed4c9186_16: (a: number, b: number, c: any) => void;
63
+ export const wasm_bindgen__convert__closures_____invoke__h47a1f4e9ed4c9186_17: (a: number, b: number, c: any) => void;
64
+ export const wasm_bindgen__convert__closures_____invoke__h164dda84a5e68923: (a: number, b: number, c: number) => void;
65
+ export const wasm_bindgen__convert__closures_____invoke__h8be819b8043379a0: (a: number, b: number, c: any) => void;
66
+ export const wasm_bindgen__convert__closures_____invoke__h172a54633ef89cf5: (a: number, b: number, c: any) => void;
67
+ export const wasm_bindgen__convert__closures_____invoke__h172a54633ef89cf5_24: (a: number, b: number, c: any) => void;
68
+ export const wasm_bindgen__convert__closures_____invoke__hbfcfb7f057cbec16: (a: number, b: number) => void;
69
+ export const wasm_bindgen__convert__closures_____invoke__h22f7f8bf18d68a3c: (a: number, b: number) => void;
70
+ export const wasm_bindgen__convert__closures_____invoke__hcb86fb251f5bd754: (a: number, b: number) => void;
65
71
  export const __wbindgen_malloc: (a: number, b: number) => number;
66
72
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
67
73
  export const __wbindgen_export: WebAssembly.Table;
@@ -0,0 +1,72 @@
1
+ // Oriverse shader prewarm (engine-dist sidecar): replays this build's captured pipeline
2
+ // manifest (shader_prewarm_manifest.json, generated per release by
3
+ // scripts/generate_shader_prewarm_manifest.py) on a throwaway device so the engine's
4
+ // ~175 sync pipeline creates hit the browser's shader cache instead of serially compiling
5
+ // ~10s cold on the device timeline (the first-view freeze;
6
+ // docs/wasm_pipeline_freeze_handover.md). Load as a CLASSIC script tag from the same
7
+ // directory as the engine wasm; the manifest URL derives from this script's own src, so
8
+ // host pages stay version-agnostic. Fail-open at every step - absent manifest, fetch
9
+ // error, or replay failure all leave the engine on today's cold path. The engine's
10
+ // await_shader_prewarm_gate (lib.rs) bounds its create burst on `state`; keep that
11
+ // contract and the __mod/__bgl/__layout/'__auto' markers in sync with
12
+ // scripts/wasm_shader_hooks.py and the [pre_shader] block in web_package/index.html.
13
+ window.__ORI_SHADER_PREWARM = (() => {
14
+ const flag = { state: 'absent' };
15
+ if (!('gpu' in navigator) || !document.currentScript || !document.currentScript.src) return flag;
16
+ // iOS/iPadOS: a second GPUDevice during boot on the most memory-constrained platform
17
+ // for a Dawn-specific cache benefit - keep off until measured there.
18
+ if (/iPad|iPhone|iPod/.test(navigator.userAgent)
19
+ || (/Mac/.test(navigator.platform) && navigator.maxTouchPoints > 1)) return flag;
20
+ const manifestUrl = new URL('shader_prewarm_manifest.json', document.currentScript.src).href;
21
+ flag.state = 'running';
22
+ flag.promise = (async () => {
23
+ const t0 = performance.now();
24
+ const resp = await fetch(manifestUrl, { priority: 'low' });
25
+ if (!resp.ok) { flag.state = 'absent'; console.log('[pre_shader] no manifest (http ' + resp.status + ')'); return; }
26
+ const man = await resp.json();
27
+ const tFetch = performance.now();
28
+ const ad = await navigator.gpu.requestAdapter({ powerPreference: 'high-performance' });
29
+ let device = null;
30
+ try { device = await ad.requestDevice(man.device || undefined); }
31
+ catch (e) { device = await ad.requestDevice(); }
32
+ // Scope the whole replay: this device may run at DEFAULT limits (16 sampled
33
+ // textures/stage), so a manifest layout can validly overflow here. The sync
34
+ // createBindGroupLayout/createPipelineLayout errors would otherwise surface as
35
+ // uncapturederror - on slow loads the engine's error tap is installed by then and
36
+ // treated one as a fatal boot error (07Aug26 first-contact crash). Async pipeline
37
+ // rejects are already handled by allSettled.
38
+ try { device.pushErrorScope('validation'); device.pushErrorScope('internal'); } catch (e) {}
39
+ const mods = man.modules.map((m) => device.createShaderModule({ label: m.label, code: m.code }));
40
+ let bgls = [];
41
+ let layouts = [];
42
+ // Explicit layout fidelity is mandatory: 'auto' changes bind remapping -> different
43
+ // generated HLSL -> cache miss for every render pipeline (probe-verified).
44
+ const deser = (d) => {
45
+ if (d === '__auto') return 'auto';
46
+ if (d === null || typeof d !== 'object') return d;
47
+ if (Array.isArray(d)) return d.map(deser);
48
+ if ('__mod' in d) return mods[d.__mod];
49
+ if ('__bgl' in d) return bgls[d.__bgl];
50
+ if ('__layout' in d) return layouts[d.__layout];
51
+ const o = {};
52
+ for (const k in d) o[k] = deser(d[k]);
53
+ return o;
54
+ };
55
+ bgls = (man.bgls || []).map((b) => device.createBindGroupLayout(deser(b)));
56
+ layouts = (man.layouts || []).map((l) => device.createPipelineLayout(deser(l)));
57
+ const results = await Promise.allSettled(man.pipelines.map((p) => {
58
+ const desc = deser(p.desc);
59
+ return p.kind === 'compute' ? device.createComputePipelineAsync(desc) : device.createRenderPipelineAsync(desc);
60
+ }));
61
+ try {
62
+ device.popErrorScope().then((e) => e && console.log('[pre_shader] scoped:', e.message)).catch(() => {});
63
+ device.popErrorScope().then((e) => e && console.log('[pre_shader] scoped:', e.message)).catch(() => {});
64
+ } catch (e) {}
65
+ try { device.destroy(); } catch (e) {}
66
+ const ok = results.filter((r) => r.status === 'fulfilled').length;
67
+ flag.state = 'done';
68
+ console.log('[pre_shader] replayed ' + ok + '/' + results.length
69
+ + ' fetch ' + Math.round(tFetch - t0) + 'ms compile ' + Math.round(performance.now() - tFetch) + 'ms');
70
+ })().catch((e) => { flag.state = 'failed'; console.warn('[pre_shader] failed:', e); });
71
+ return flag;
72
+ })();
@@ -0,0 +1,41 @@
1
+
2
+ export function marketClientReadIndexedDbValue(dbName, storeName, key) {
3
+ return new Promise((resolve, reject) => {
4
+ const open = indexedDB.open(dbName);
5
+ open.onupgradeneeded = () => {
6
+ try {
7
+ const db = open.result;
8
+ if (!db.objectStoreNames.contains(storeName)) db.createObjectStore(storeName);
9
+ } catch (error) {
10
+ reject(error);
11
+ }
12
+ };
13
+ open.onerror = () => reject(open.error || new Error('indexedDB open error'));
14
+ open.onblocked = () => reject(new Error('indexedDB open blocked'));
15
+ open.onsuccess = () => {
16
+ const db = open.result;
17
+ const close = () => { try { db.close(); } catch (_) {} };
18
+ try {
19
+ if (!db.objectStoreNames.contains(storeName)) {
20
+ close();
21
+ resolve(undefined);
22
+ return;
23
+ }
24
+ const get = db.transaction(storeName, 'readonly').objectStore(storeName).get(key);
25
+ get.onsuccess = () => {
26
+ const value = get.result;
27
+ close();
28
+ resolve(value);
29
+ };
30
+ get.onerror = () => {
31
+ const error = get.error || new Error('indexedDB get error');
32
+ close();
33
+ reject(error);
34
+ };
35
+ } catch (error) {
36
+ close();
37
+ reject(error);
38
+ }
39
+ };
40
+ });
41
+ }
@@ -1,22 +1,60 @@
1
1
 
2
- export function __ori_install_webgpu_error_tap(sink) {
3
- try {
4
- if (typeof GPUAdapter === 'undefined' || GPUAdapter.prototype.__ori_err_tap) return;
5
- GPUAdapter.prototype.__ori_err_tap = true;
6
- const orig = GPUAdapter.prototype.requestDevice;
7
- GPUAdapter.prototype.requestDevice = async function(desc) {
8
- const device = await orig.call(this, desc);
9
- try { window.__ori_gpu_device = device; } catch (_) {}
10
- try {
11
- device.addEventListener('uncapturederror', function(event) {
12
- const e = event.error;
13
- const name = (e && e.constructor && e.constructor.name) || 'GPUError';
14
- const msg = (e && e.message) || '';
15
- try { sink(name, msg); } catch (_) {}
16
- try { console.error('[raw_webgpu_uncaptured]', name, msg); } catch (_) {}
17
- });
18
- } catch (_) {}
19
- return device;
20
- };
21
- } catch (_) {}
2
+ export function observeDevicePixels(canvas, onSize) {
3
+ const hasDPCB = (() => {
4
+ try { return 'devicePixelContentBoxSize' in ResizeObserverEntry.prototype; } catch { return false; }
5
+ })();
6
+
7
+ // Compute current CSS and device-pixel sizes and call onSize(dpW, dpH, effectiveDpr)
8
+ function fireNow() {
9
+ let cssW, cssH, dpW, dpH;
10
+ if (hasDPCB && canvas.__lastROEntry) {
11
+ const e = canvas.__lastROEntry;
12
+ dpW = e.devicePixelContentBoxSize[0].inlineSize;
13
+ dpH = e.devicePixelContentBoxSize[0].blockSize;
14
+ cssW = e.contentBoxSize[0].inlineSize;
15
+ cssH = e.contentBoxSize[0].blockSize;
16
+ } else {
17
+ const rect = canvas.getBoundingClientRect();
18
+ const dpr = window.devicePixelRatio || 1;
19
+ cssW = rect.width; cssH = rect.height;
20
+ dpW = Math.max(1, Math.round(cssW * dpr));
21
+ dpH = Math.max(1, Math.round(cssH * dpr));
22
+ }
23
+ const dprEff = cssW > 0 ? (dpW / cssW) : (window.devicePixelRatio || 1);
24
+ onSize(dpW >>> 0, dpH >>> 0, dprEff);
25
+ }
26
+
27
+ const ro = new ResizeObserver(entries => {
28
+ // Save the last entry for precise device-pixel info.
29
+ canvas.__lastROEntry = entries[0];
30
+ fireNow();
31
+ });
32
+
33
+ try { ro.observe(canvas, { box: 'device-pixel-content-box' }); }
34
+ catch { ro.observe(canvas); }
35
+
36
+ // DPR changes (zoom / moving across monitors) don't always reflow. Listen explicitly.
37
+ let mq = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);
38
+ const onMQ = () => {
39
+ // Force a non-layout-janking "poke" to trigger RO in some browsers.
40
+ const t = canvas.style.transform;
41
+ canvas.style.transform = 'translateZ(0)'; canvas.style.transform = t;
42
+ fireNow();
43
+ // Re-arm listener for the new DPR.
44
+ mq.removeEventListener?.('change', onMQ);
45
+ mq = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);
46
+ mq.addEventListener?.('change', onMQ);
47
+ };
48
+ mq.addEventListener?.('change', onMQ);
49
+ window.addEventListener('pageshow', onMQ);
50
+
51
+ // Fire once now so we start sized correctly.
52
+ Promise.resolve().then(fireNow);
53
+
54
+ // Return disposer
55
+ return () => {
56
+ try { ro.disconnect(); } catch {}
57
+ try { mq.removeEventListener?.('change', onMQ); } catch {}
58
+ try { window.removeEventListener('pageshow', onMQ); } catch {}
59
+ };
22
60
  }
@@ -1,60 +1,28 @@
1
1
 
2
- export function observeDevicePixels(canvas, onSize) {
3
- const hasDPCB = (() => {
4
- try { return 'devicePixelContentBoxSize' in ResizeObserverEntry.prototype; } catch { return false; }
5
- })();
6
-
7
- // Compute current CSS and device-pixel sizes and call onSize(dpW, dpH, effectiveDpr)
8
- function fireNow() {
9
- let cssW, cssH, dpW, dpH;
10
- if (hasDPCB && canvas.__lastROEntry) {
11
- const e = canvas.__lastROEntry;
12
- dpW = e.devicePixelContentBoxSize[0].inlineSize;
13
- dpH = e.devicePixelContentBoxSize[0].blockSize;
14
- cssW = e.contentBoxSize[0].inlineSize;
15
- cssH = e.contentBoxSize[0].blockSize;
16
- } else {
17
- const rect = canvas.getBoundingClientRect();
18
- const dpr = window.devicePixelRatio || 1;
19
- cssW = rect.width; cssH = rect.height;
20
- dpW = Math.max(1, Math.round(cssW * dpr));
21
- dpH = Math.max(1, Math.round(cssH * dpr));
22
- }
23
- const dprEff = cssW > 0 ? (dpW / cssW) : (window.devicePixelRatio || 1);
24
- onSize(dpW >>> 0, dpH >>> 0, dprEff);
25
- }
26
-
27
- const ro = new ResizeObserver(entries => {
28
- // Save the last entry for precise device-pixel info.
29
- canvas.__lastROEntry = entries[0];
30
- fireNow();
31
- });
32
-
33
- try { ro.observe(canvas, { box: 'device-pixel-content-box' }); }
34
- catch { ro.observe(canvas); }
35
-
36
- // DPR changes (zoom / moving across monitors) don't always reflow. Listen explicitly.
37
- let mq = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);
38
- const onMQ = () => {
39
- // Force a non-layout-janking "poke" to trigger RO in some browsers.
40
- const t = canvas.style.transform;
41
- canvas.style.transform = 'translateZ(0)'; canvas.style.transform = t;
42
- fireNow();
43
- // Re-arm listener for the new DPR.
44
- mq.removeEventListener?.('change', onMQ);
45
- mq = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);
46
- mq.addEventListener?.('change', onMQ);
47
- };
48
- mq.addEventListener?.('change', onMQ);
49
- window.addEventListener('pageshow', onMQ);
50
-
51
- // Fire once now so we start sized correctly.
52
- Promise.resolve().then(fireNow);
53
-
54
- // Return disposer
55
- return () => {
56
- try { ro.disconnect(); } catch {}
57
- try { mq.removeEventListener?.('change', onMQ); } catch {}
58
- try { window.removeEventListener('pageshow', onMQ); } catch {}
59
- };
2
+ export function __ori_install_webgpu_error_tap(sink) {
3
+ try {
4
+ if (typeof GPUAdapter === 'undefined' || GPUAdapter.prototype.__ori_err_tap) return;
5
+ GPUAdapter.prototype.__ori_err_tap = true;
6
+ const orig = GPUAdapter.prototype.requestDevice;
7
+ GPUAdapter.prototype.requestDevice = async function(desc) {
8
+ const device = await orig.call(this, desc);
9
+ // Only the engine's own device (wgpu_base::APP_DEVICE_LABEL) may escalate to the
10
+ // fatal path. Foreign devices — the index.html [pre_shader] throwaway runs at
11
+ // DEFAULT limits and its replay errors are fail-open by contract — still log
12
+ // through the sink for ring/field visibility (07Aug26 first-contact crash: a
13
+ // throwaway-device validation error killed a healthy boot).
14
+ const isApp = !!(desc && desc.label === 'oriverse-app-device');
15
+ if (isApp) { try { window.__ori_gpu_device = device; } catch (_) {} }
16
+ try {
17
+ device.addEventListener('uncapturederror', function(event) {
18
+ const e = event.error;
19
+ const name = (e && e.constructor && e.constructor.name) || 'GPUError';
20
+ const msg = (e && e.message) || '';
21
+ try { sink(name, msg, isApp); } catch (_) {}
22
+ try { console.error(isApp ? '[raw_webgpu_uncaptured]' : '[raw_webgpu_uncaptured_foreign]', name, msg); } catch (_) {}
23
+ });
24
+ } catch (_) {}
25
+ return device;
26
+ };
27
+ } catch (_) {}
60
28
  }
@@ -11,9 +11,9 @@ loader scripts or engine URLs.
11
11
 
12
12
  ## Before writing Weave, read the guide
13
13
 
14
- - https://unpkg.com/oriverse-engine@0.1.3/dist/GAME_AUTHORING.md — authoring patterns + 3 complete tested
14
+ - https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/GAME_AUTHORING.md — authoring patterns + 3 complete tested
15
15
  example games (coin collector, dodge blocks, target range) to pattern-match from.
16
- - https://unpkg.com/oriverse-engine@0.1.3/dist/weave_documentation.txt — full language + API reference.
16
+ - https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/weave_documentation.txt — full language + API reference.
17
17
 
18
18
  Key constraints: content must be fully procedural (primitive models `"cube"`,
19
19
  `"sphere"`, ..., `#mesh`, `#texture` — no market/network assets); units are cm with Z
@@ -11,9 +11,9 @@ loader scripts or engine URLs.
11
11
 
12
12
  ## Before writing Weave, read the guide
13
13
 
14
- - https://unpkg.com/oriverse-engine@0.1.3/dist/GAME_AUTHORING.md — authoring patterns + 3 complete tested
14
+ - https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/GAME_AUTHORING.md — authoring patterns + 3 complete tested
15
15
  example games (coin collector, dodge blocks, target range) to pattern-match from.
16
- - https://unpkg.com/oriverse-engine@0.1.3/dist/weave_documentation.txt — full language + API reference.
16
+ - https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/weave_documentation.txt — full language + API reference.
17
17
 
18
18
  Key constraints: content must be fully procedural (primitive models `"cube"`,
19
19
  `"sphere"`, ..., `#mesh`, `#texture` — no market/network assets); units are cm with Z
@@ -1,8 +1,8 @@
1
1
  <!-- game_cdn.html — Oriverse artifact game loading the engine from a CDN (three.js-style).
2
- This single small file IS the whole game: engine js/wasm come from unpkg, your game is
2
+ This single small file IS the whole game: engine js/wasm come from the npm CDN, your game is
3
3
  the inline Weave source below. Serve from any static host (no COOP/COEP headers) or a
4
4
  plain `python -m http.server`; open in a WebGPU browser (Chrome/Edge).
5
- The engine version is pinned in the https://unpkg.com/oriverse-engine@0.1.3/dist urls below (injected from
5
+ The engine version is pinned in the https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist urls below (injected from
6
6
  npm_package/package.json at packaging time) — bump the @version with engine releases.
7
7
  Content must be fully procedural: primitives ("cube", "sphere", ...), #mesh, #texture,
8
8
  #particles. Market/network assets are unavailable and will hard-error. -->
@@ -18,7 +18,7 @@
18
18
  </style>
19
19
  </head>
20
20
  <body>
21
- <div id="oriverse-status-banner" style="position:fixed;left:0;right:0;top:0;z-index:9999;background:rgba(0,0,0,0.85);color:#fff;font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.4;padding:10px 12px;white-space:pre-wrap;pointer-events:none;">Oriverse: fetching engine from CDN...</div>
21
+ <div id="oriverse-status-banner" style="position:fixed;left:0;right:0;top:0;z-index:9999;background:rgba(0,0,0,0.85);color:#fff;font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.4;padding:10px 12px;white-space:pre-wrap;pointer-events:none;">Oriverse: downloading engine…</div>
22
22
 
23
23
  <!-- ==== EDIT YOUR GAME HERE: inline Weave world source (read by the engine at boot). ==== -->
24
24
  <script type="text/weave" id="oriverse-weave">
@@ -42,17 +42,20 @@ object BlueCube {
42
42
  }
43
43
  </script>
44
44
 
45
+ <!-- Shader prewarm: replays the build's pipeline manifest on a throwaway device during
46
+ engine download dead-time (kills the first-view compile freeze). Fail-open. -->
47
+ <script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/prewarm.js"></script>
45
48
  <!-- KTX2 texture transcoder sidecar (classic scripts; ktx_lib.wasm resolves relative to the script url). -->
46
- <script src="https://unpkg.com/oriverse-engine@0.1.3/dist/ktx_lib.js"></script>
47
- <script src="https://unpkg.com/oriverse-engine@0.1.3/dist/ktx_bridge.js"></script>
49
+ <script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/ktx_lib.js"></script>
50
+ <script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/ktx_bridge.js"></script>
48
51
  <script type="module">
49
- import initOriverse from "https://unpkg.com/oriverse-engine@0.1.3/dist/oriverse_wgpu.js";
52
+ import initOriverse from "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/oriverse_wgpu.js";
50
53
  const setBoot = (t) => { const b = document.getElementById('oriverse-status-banner'); if (b) b.textContent = t; };
51
54
  (async () => {
52
55
  try {
53
- setBoot('instantiating wasm...');
56
+ setBoot('starting engine…');
54
57
  // Artifact build: wasm-bindgen owns a private (non-shared) memory; no COOP/COEP needed.
55
- await initOriverse({ module_or_path: "https://unpkg.com/oriverse-engine@0.1.3/dist/oriverse_wgpu_bg.wasm" });
58
+ await initOriverse({ module_or_path: "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/oriverse_wgpu_bg.wasm" });
56
59
  } catch (e) {
57
60
  const msg = (e && e.stack) ? e.stack : String(e);
58
61
  setBoot('WASM init failed:\n' + msg);
@@ -17,7 +17,7 @@
17
17
  </style>
18
18
  </head>
19
19
  <body>
20
- <div id="oriverse-status-banner" style="position:fixed;left:0;right:0;top:0;z-index:9999;background:rgba(0,0,0,0.85);color:#fff;font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.4;padding:10px 12px;white-space:pre-wrap;pointer-events:none;">Oriverse: instantiating wasm...</div>
20
+ <div id="oriverse-status-banner" style="position:fixed;left:0;right:0;top:0;z-index:9999;background:rgba(0,0,0,0.85);color:#fff;font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.4;padding:10px 12px;white-space:pre-wrap;pointer-events:none;">Oriverse: starting engine…</div>
21
21
 
22
22
  <!-- Inline Weave world source (read by the engine at boot).
23
23
  Injected at packaging time from default_world.weave (single source, compile-tested natively). -->
@@ -42,6 +42,9 @@ object BlueCube {
42
42
  }
43
43
  </script>
44
44
 
45
+ <!-- Shader prewarm: replays the build's pipeline manifest on a throwaway device during
46
+ boot (kills the first-view compile freeze). Fail-open when the manifest is absent. -->
47
+ <script src="prewarm.js"></script>
45
48
  <script src="ktx_lib.js"></script>
46
49
  <script src="ktx_bridge.js"></script>
47
50
  <script type="module">
@@ -49,7 +52,7 @@ object BlueCube {
49
52
  const setBoot = (t) => { const b = document.getElementById('oriverse-status-banner'); if (b) b.textContent = t; };
50
53
  (async () => {
51
54
  try {
52
- setBoot('instantiating wasm...');
55
+ setBoot('starting engine…');
53
56
  // Artifact build: wasm-bindgen owns a private (non-shared) memory; no COOP/COEP needed.
54
57
  await initOriverse({ module_or_path: './oriverse_wgpu_bg.wasm' });
55
58
  } catch (e) {
@@ -1,8 +1,8 @@
1
1
  <!-- game_cdn.html — Oriverse artifact game loading the engine from a CDN (three.js-style).
2
- This single small file IS the whole game: engine js/wasm come from unpkg, your game is
2
+ This single small file IS the whole game: engine js/wasm come from the npm CDN, your game is
3
3
  the inline Weave source below. Serve from any static host (no COOP/COEP headers) or a
4
4
  plain `python -m http.server`; open in a WebGPU browser (Chrome/Edge).
5
- The engine version is pinned in the https://unpkg.com/oriverse-engine@0.1.3/dist urls below (injected from
5
+ The engine version is pinned in the https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist urls below (injected from
6
6
  npm_package/package.json at packaging time) — bump the @version with engine releases.
7
7
  Content must be fully procedural: primitives ("cube", "sphere", ...), #mesh, #texture,
8
8
  #particles. Market/network assets are unavailable and will hard-error. -->
@@ -18,7 +18,7 @@
18
18
  </style>
19
19
  </head>
20
20
  <body>
21
- <div id="oriverse-status-banner" style="position:fixed;left:0;right:0;top:0;z-index:9999;background:rgba(0,0,0,0.85);color:#fff;font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.4;padding:10px 12px;white-space:pre-wrap;pointer-events:none;">Oriverse: fetching engine from CDN...</div>
21
+ <div id="oriverse-status-banner" style="position:fixed;left:0;right:0;top:0;z-index:9999;background:rgba(0,0,0,0.85);color:#fff;font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.4;padding:10px 12px;white-space:pre-wrap;pointer-events:none;">Oriverse: downloading engine…</div>
22
22
 
23
23
  <!-- ==== EDIT YOUR GAME HERE: inline Weave world source (read by the engine at boot). ==== -->
24
24
  <script type="text/weave" id="oriverse-weave">
@@ -42,17 +42,20 @@ object BlueCube {
42
42
  }
43
43
  </script>
44
44
 
45
+ <!-- Shader prewarm: replays the build's pipeline manifest on a throwaway device during
46
+ engine download dead-time (kills the first-view compile freeze). Fail-open. -->
47
+ <script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/prewarm.js"></script>
45
48
  <!-- KTX2 texture transcoder sidecar (classic scripts; ktx_lib.wasm resolves relative to the script url). -->
46
- <script src="https://unpkg.com/oriverse-engine@0.1.3/dist/ktx_lib.js"></script>
47
- <script src="https://unpkg.com/oriverse-engine@0.1.3/dist/ktx_bridge.js"></script>
49
+ <script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/ktx_lib.js"></script>
50
+ <script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/ktx_bridge.js"></script>
48
51
  <script type="module">
49
- import initOriverse from "https://unpkg.com/oriverse-engine@0.1.3/dist/oriverse_wgpu.js";
52
+ import initOriverse from "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/oriverse_wgpu.js";
50
53
  const setBoot = (t) => { const b = document.getElementById('oriverse-status-banner'); if (b) b.textContent = t; };
51
54
  (async () => {
52
55
  try {
53
- setBoot('instantiating wasm...');
56
+ setBoot('starting engine…');
54
57
  // Artifact build: wasm-bindgen owns a private (non-shared) memory; no COOP/COEP needed.
55
- await initOriverse({ module_or_path: "https://unpkg.com/oriverse-engine@0.1.3/dist/oriverse_wgpu_bg.wasm" });
58
+ await initOriverse({ module_or_path: "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.5/dist/oriverse_wgpu_bg.wasm" });
56
59
  } catch (e) {
57
60
  const msg = (e && e.stack) ? e.stack : String(e);
58
61
  setBoot('WASM init failed:\n' + msg);