oriverse-engine 0.1.6 → 0.1.7
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/dist/CODEX_PROMPT.md +7 -7
- package/dist/oriverse_wgpu.d.ts +35 -35
- package/dist/oriverse_wgpu.js +170 -110
- package/dist/oriverse_wgpu_bg.wasm +0 -0
- package/dist/oriverse_wgpu_bg.wasm.d.ts +35 -35
- package/dist/shader_prewarm_manifest.json +1 -1
- package/dist/snippets/oriverse_networking_shared-e43478064e11e46c/inline0.js +32 -20
- package/dist/snippets/oriverse_networking_shared-e43478064e11e46c/inline1.js +21 -0
- package/dist/snippets/oriverse_wgpu-255445ce6d9a0851/inline0.js +32 -27
- package/dist/snippets/oriverse_wgpu-255445ce6d9a0851/inline2.js +28 -0
- package/dist/starter/AGENTS.md +2 -2
- package/dist/starter/CLAUDE.md +2 -2
- package/dist/starter/game.html +9 -7
- package/dist/templates/game_cdn.html +9 -7
- package/dist/weave_documentation.txt +353 -86
- package/package.json +1 -1
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
|
|
2
|
-
export function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
export function webRtcReadIndexedDbValue(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 = () => { const value = get.result; close(); resolve(value); };
|
|
26
|
+
get.onerror = () => { const error = get.error || new Error('indexedDB get error'); close(); reject(error); };
|
|
27
|
+
} catch (error) {
|
|
28
|
+
close();
|
|
29
|
+
reject(error);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
export function get_selected_candidate_info(stats) {
|
|
3
|
+
const reports = Array.from(stats.values());
|
|
4
|
+
const pair = reports.find(s => s.type === 'candidate-pair' && s.nominated);
|
|
5
|
+
if (!pair) return null;
|
|
6
|
+
const local = reports.find(s => s.type === 'local-candidate' && s.id === pair.localCandidateId);
|
|
7
|
+
const remote = reports.find(s => s.type === 'remote-candidate' && s.id === pair.remoteCandidateId);
|
|
8
|
+
if (!local || !remote) return null;
|
|
9
|
+
return {
|
|
10
|
+
state: pair.state || '',
|
|
11
|
+
localType: local.candidateType || '',
|
|
12
|
+
localAddr: `${local.address || local.ip || 'unknown'}:${local.port || 0}`,
|
|
13
|
+
localProtocol: local.protocol || '',
|
|
14
|
+
remoteType: remote.candidateType || '',
|
|
15
|
+
remoteAddr: `${remote.address || remote.ip || 'unknown'}:${remote.port || 0}`,
|
|
16
|
+
remoteProtocol: remote.protocol || '',
|
|
17
|
+
rttMs: pair.currentRoundTripTime != null ? pair.currentRoundTripTime * 1000 : -1,
|
|
18
|
+
txBytes: pair.bytesSent || 0,
|
|
19
|
+
rxBytes: pair.bytesReceived || 0
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
|
|
2
|
-
export function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
2
|
+
export function mcpRelayReadIndexedDbValue(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 = () => { const value = get.result; close(); resolve(value); };
|
|
26
|
+
get.onerror = () => { const error = get.error || new Error('indexedDB get error'); close(); reject(error); };
|
|
27
|
+
} catch (error) {
|
|
28
|
+
close();
|
|
29
|
+
reject(error);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
// 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 (_) {}
|
|
28
|
+
}
|
package/dist/starter/AGENTS.md
CHANGED
|
@@ -11,9 +11,9 @@ loader scripts or engine URLs.
|
|
|
11
11
|
|
|
12
12
|
## Before writing Weave, read the guide
|
|
13
13
|
|
|
14
|
-
- https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
14
|
+
- https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/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://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
16
|
+
- https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/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
|
package/dist/starter/CLAUDE.md
CHANGED
|
@@ -11,9 +11,9 @@ loader scripts or engine URLs.
|
|
|
11
11
|
|
|
12
12
|
## Before writing Weave, read the guide
|
|
13
13
|
|
|
14
|
-
- https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
14
|
+
- https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/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://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
16
|
+
- https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/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
|
package/dist/starter/game.html
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
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://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
5
|
+
The engine version is pinned in the https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/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
|
-
#particles. Market/network assets are unavailable and will hard-error.
|
|
8
|
+
#particles. Market/network assets are unavailable and will hard-error. Google Fonts
|
|
9
|
+
(font = "font.google.<Family>") load live from Google's CDN and fall back to the
|
|
10
|
+
built-in font when unreachable. -->
|
|
9
11
|
<!DOCTYPE html>
|
|
10
12
|
<html lang="en">
|
|
11
13
|
<head>
|
|
@@ -44,18 +46,18 @@ object BlueCube {
|
|
|
44
46
|
|
|
45
47
|
<!-- Shader prewarm: replays the build's pipeline manifest on a throwaway device during
|
|
46
48
|
engine download dead-time (kills the first-view compile freeze). Fail-open. -->
|
|
47
|
-
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
49
|
+
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/dist/prewarm.js"></script>
|
|
48
50
|
<!-- KTX2 texture transcoder sidecar (classic scripts; ktx_lib.wasm resolves relative to the script url). -->
|
|
49
|
-
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
50
|
-
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
51
|
+
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/dist/ktx_lib.js"></script>
|
|
52
|
+
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/dist/ktx_bridge.js"></script>
|
|
51
53
|
<script type="module">
|
|
52
|
-
import initOriverse from "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
54
|
+
import initOriverse from "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/dist/oriverse_wgpu.js";
|
|
53
55
|
const setBoot = (t) => { const b = document.getElementById('oriverse-status-banner'); if (b) b.textContent = t; };
|
|
54
56
|
(async () => {
|
|
55
57
|
try {
|
|
56
58
|
setBoot('starting engine…');
|
|
57
59
|
// Artifact build: wasm-bindgen owns a private (non-shared) memory; no COOP/COEP needed.
|
|
58
|
-
await initOriverse({ module_or_path: "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
60
|
+
await initOriverse({ module_or_path: "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/dist/oriverse_wgpu_bg.wasm" });
|
|
59
61
|
} catch (e) {
|
|
60
62
|
const msg = (e && e.stack) ? e.stack : String(e);
|
|
61
63
|
setBoot('WASM init failed:\n' + msg);
|
|
@@ -2,10 +2,12 @@
|
|
|
2
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://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
5
|
+
The engine version is pinned in the https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/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
|
-
#particles. Market/network assets are unavailable and will hard-error.
|
|
8
|
+
#particles. Market/network assets are unavailable and will hard-error. Google Fonts
|
|
9
|
+
(font = "font.google.<Family>") load live from Google's CDN and fall back to the
|
|
10
|
+
built-in font when unreachable. -->
|
|
9
11
|
<!DOCTYPE html>
|
|
10
12
|
<html lang="en">
|
|
11
13
|
<head>
|
|
@@ -44,18 +46,18 @@ object BlueCube {
|
|
|
44
46
|
|
|
45
47
|
<!-- Shader prewarm: replays the build's pipeline manifest on a throwaway device during
|
|
46
48
|
engine download dead-time (kills the first-view compile freeze). Fail-open. -->
|
|
47
|
-
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
49
|
+
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/dist/prewarm.js"></script>
|
|
48
50
|
<!-- KTX2 texture transcoder sidecar (classic scripts; ktx_lib.wasm resolves relative to the script url). -->
|
|
49
|
-
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
50
|
-
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
51
|
+
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/dist/ktx_lib.js"></script>
|
|
52
|
+
<script src="https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/dist/ktx_bridge.js"></script>
|
|
51
53
|
<script type="module">
|
|
52
|
-
import initOriverse from "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
54
|
+
import initOriverse from "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/dist/oriverse_wgpu.js";
|
|
53
55
|
const setBoot = (t) => { const b = document.getElementById('oriverse-status-banner'); if (b) b.textContent = t; };
|
|
54
56
|
(async () => {
|
|
55
57
|
try {
|
|
56
58
|
setBoot('starting engine…');
|
|
57
59
|
// Artifact build: wasm-bindgen owns a private (non-shared) memory; no COOP/COEP needed.
|
|
58
|
-
await initOriverse({ module_or_path: "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.
|
|
60
|
+
await initOriverse({ module_or_path: "https://cdn.jsdelivr.net/npm/oriverse-engine@0.1.7/dist/oriverse_wgpu_bg.wasm" });
|
|
59
61
|
} catch (e) {
|
|
60
62
|
const msg = (e && e.stack) ? e.stack : String(e);
|
|
61
63
|
setBoot('WASM init failed:\n' + msg);
|