@crowdedkingdoms/crowdyjs 17.13.0-dev.1 → 18.0.0-dev.1
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/MIGRATION.md +163 -1
- package/README.md +142 -146
- package/dist/crowdy-client.d.ts +12 -31
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +15 -37
- package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
- package/dist/crowdy-dsh/bridge.js +3 -6
- package/dist/crowdy-studio/controller.d.ts +59 -57
- package/dist/crowdy-studio/controller.d.ts.map +1 -1
- package/dist/crowdy-studio/controller.js +268 -206
- package/dist/crowdy-studio/diagnostics.d.ts +3 -12
- package/dist/crowdy-studio/diagnostics.d.ts.map +1 -1
- package/dist/crowdy-studio/dom-shell.d.ts +2 -4
- package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
- package/dist/crowdy-studio/dom-shell.js +16 -47
- package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -1
- package/dist/crowdy-studio/embed/panel.d.ts +3 -12
- package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
- package/dist/crowdy-studio/embed/panel.js +3 -6
- package/dist/crowdy-studio/index.d.ts +1 -3
- package/dist/crowdy-studio/index.d.ts.map +1 -1
- package/dist/crowdy-studio/index.js +0 -2
- package/dist/crowdy-studio/models.d.ts +3 -4
- package/dist/crowdy-studio/models.d.ts.map +1 -1
- package/dist/crowdy-studio/starter-projects.d.ts +8 -4
- package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
- package/dist/crowdy-studio/starter-projects.js +83 -100
- package/dist/domains/appAccess.d.ts +14 -1
- package/dist/domains/appAccess.d.ts.map +1 -1
- package/dist/domains/appAccess.js +37 -1
- package/dist/domains/exec.d.ts +162 -15
- package/dist/domains/exec.d.ts.map +1 -1
- package/dist/domains/exec.js +180 -18
- package/dist/domains/host.d.ts +3 -3
- package/dist/domains/host.js +3 -3
- package/dist/domains/marketplace.d.ts +9 -58
- package/dist/domains/marketplace.d.ts.map +1 -1
- package/dist/domains/marketplace.js +9 -106
- package/dist/domains/playerWallet.d.ts +6 -12
- package/dist/domains/playerWallet.d.ts.map +1 -1
- package/dist/domains/playerWallet.js +6 -21
- package/dist/errors.d.ts +7 -13
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +6 -10
- package/dist/generated/graphql.d.ts +1384 -7977
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +22 -321
- package/dist/grid-mods/exec-client-halves.d.ts +156 -0
- package/dist/grid-mods/exec-client-halves.d.ts.map +1 -0
- package/dist/grid-mods/exec-client-halves.js +356 -0
- package/dist/grid-mods/grid-host-calls.d.ts +29 -15
- package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
- package/dist/grid-mods/grid-host-calls.js +40 -44
- package/dist/grid-mods/index.d.ts +1 -0
- package/dist/grid-mods/index.d.ts.map +1 -1
- package/dist/grid-mods/index.js +1 -0
- package/dist/grid-mods/mod-runtime.d.ts +21 -6
- package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
- package/dist/grid-mods/mod-runtime.js +6 -2
- package/dist/grid-scope.d.ts +0 -188
- package/dist/grid-scope.d.ts.map +1 -1
- package/dist/grid-scope.js +0 -69
- package/dist/index.d.ts +12 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -16
- package/dist/kit/actions.d.ts +5 -9
- package/dist/kit/actions.d.ts.map +1 -1
- package/dist/kit/actions.js +5 -9
- package/dist/kit/index.d.ts +2 -33
- package/dist/kit/index.d.ts.map +1 -1
- package/dist/kit/index.js +1 -32
- package/dist/kit/kit.d.ts +8 -208
- package/dist/kit/kit.d.ts.map +1 -1
- package/dist/kit/kit.js +5 -163
- package/dist/kit/social.d.ts +1 -3
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/kit/social.js +1 -3
- package/dist/kit/wire.d.ts +16 -5
- package/dist/kit/wire.d.ts.map +1 -1
- package/dist/kit/wire.js +19 -5
- package/dist/live-coding/assets/browser-authoring-index.json +1 -1
- package/dist/live-coding/assets/manifest.json +1 -1
- package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
- package/dist/live-coding/browser-authoring-index.generated.js +1496 -4386
- package/dist/live-coding/rust-analysis.d.ts.map +1 -1
- package/dist/live-coding/rust-analysis.js +31 -23
- package/dist/player-runtime/client-host-calls.d.ts +8 -0
- package/dist/player-runtime/client-host-calls.d.ts.map +1 -0
- package/dist/player-runtime/client-host-calls.js +28 -0
- package/dist/player-runtime/glue-runtime.d.ts +27 -10
- package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
- package/dist/player-runtime/glue-runtime.js +40 -45
- package/dist/player-runtime/glue-sab.d.ts +2 -2
- package/dist/player-runtime/glue-sab.js +2 -2
- package/dist/player-runtime/player-code-broker.d.ts +80 -24
- package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
- package/dist/player-runtime/player-code-broker.js +169 -41
- package/dist/player-runtime/player-glue-worker.d.ts +8 -8
- package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
- package/dist/player-runtime/player-glue-worker.js +26 -9
- package/dist/stores/actors.d.ts +12 -2
- package/dist/stores/actors.d.ts.map +1 -1
- package/dist/stores/actors.js +43 -18
- package/dist/stores/chunks.d.ts +12 -0
- package/dist/stores/chunks.d.ts.map +1 -1
- package/dist/stores/chunks.js +112 -39
- package/dist/stores/durable.d.ts.map +1 -1
- package/dist/stores/durable.js +2 -1
- package/dist/stores/inbox.d.ts +1 -1
- package/dist/stores/inbox.d.ts.map +1 -1
- package/dist/stores/index.d.ts +0 -11
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +0 -4
- package/dist/stores/session.d.ts +0 -2
- package/dist/stores/session.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/crowdy-studio/model-lint-log.d.ts +0 -76
- package/dist/crowdy-studio/model-lint-log.d.ts.map +0 -1
- package/dist/crowdy-studio/model-lint-log.js +0 -93
- package/dist/crowdy-studio/model-lint.d.ts +0 -61
- package/dist/crowdy-studio/model-lint.d.ts.map +0 -1
- package/dist/crowdy-studio/model-lint.js +0 -45
- package/dist/domains/compute.d.ts +0 -208
- package/dist/domains/compute.d.ts.map +0 -1
- package/dist/domains/compute.js +0 -274
- package/dist/domains/controlPlane.d.ts +0 -38
- package/dist/domains/controlPlane.d.ts.map +0 -1
- package/dist/domains/controlPlane.js +0 -43
- package/dist/domains/gameModel.d.ts +0 -1174
- package/dist/domains/gameModel.d.ts.map +0 -1
- package/dist/domains/gameModel.js +0 -1333
- package/dist/domains/playerCompute.d.ts +0 -91
- package/dist/domains/playerCompute.d.ts.map +0 -1
- package/dist/domains/playerCompute.js +0 -136
- package/dist/domains/playerModel.d.ts +0 -20
- package/dist/domains/playerModel.d.ts.map +0 -1
- package/dist/domains/playerModel.js +0 -54
- package/dist/kit/abilities.d.ts +0 -66
- package/dist/kit/abilities.d.ts.map +0 -1
- package/dist/kit/abilities.js +0 -71
- package/dist/kit/blueprints/combat.d.ts +0 -81
- package/dist/kit/blueprints/combat.d.ts.map +0 -1
- package/dist/kit/blueprints/combat.js +0 -357
- package/dist/kit/blueprints/core.d.ts +0 -222
- package/dist/kit/blueprints/core.d.ts.map +0 -1
- package/dist/kit/blueprints/core.js +0 -185
- package/dist/kit/blueprints/decks.d.ts +0 -50
- package/dist/kit/blueprints/decks.d.ts.map +0 -1
- package/dist/kit/blueprints/decks.js +0 -163
- package/dist/kit/blueprints/economy.d.ts +0 -88
- package/dist/kit/blueprints/economy.d.ts.map +0 -1
- package/dist/kit/blueprints/economy.js +0 -533
- package/dist/kit/blueprints/guild.d.ts +0 -51
- package/dist/kit/blueprints/guild.d.ts.map +0 -1
- package/dist/kit/blueprints/guild.js +0 -50
- package/dist/kit/blueprints/index.d.ts +0 -23
- package/dist/kit/blueprints/index.d.ts.map +0 -1
- package/dist/kit/blueprints/index.js +0 -22
- package/dist/kit/blueprints/inventory.d.ts +0 -84
- package/dist/kit/blueprints/inventory.d.ts.map +0 -1
- package/dist/kit/blueprints/inventory.js +0 -257
- package/dist/kit/blueprints/leaderboards.d.ts +0 -49
- package/dist/kit/blueprints/leaderboards.d.ts.map +0 -1
- package/dist/kit/blueprints/leaderboards.js +0 -126
- package/dist/kit/blueprints/liveops.d.ts +0 -42
- package/dist/kit/blueprints/liveops.d.ts.map +0 -1
- package/dist/kit/blueprints/liveops.js +0 -170
- package/dist/kit/blueprints/locks.d.ts +0 -82
- package/dist/kit/blueprints/locks.d.ts.map +0 -1
- package/dist/kit/blueprints/locks.js +0 -155
- package/dist/kit/blueprints/loot.d.ts +0 -90
- package/dist/kit/blueprints/loot.d.ts.map +0 -1
- package/dist/kit/blueprints/loot.js +0 -229
- package/dist/kit/blueprints/matches.d.ts +0 -84
- package/dist/kit/blueprints/matches.d.ts.map +0 -1
- package/dist/kit/blueprints/matches.js +0 -349
- package/dist/kit/blueprints/moderation.d.ts +0 -32
- package/dist/kit/blueprints/moderation.d.ts.map +0 -1
- package/dist/kit/blueprints/moderation.js +0 -140
- package/dist/kit/blueprints/npcs.d.ts +0 -78
- package/dist/kit/blueprints/npcs.d.ts.map +0 -1
- package/dist/kit/blueprints/npcs.js +0 -125
- package/dist/kit/blueprints/plots.d.ts +0 -63
- package/dist/kit/blueprints/plots.d.ts.map +0 -1
- package/dist/kit/blueprints/plots.js +0 -151
- package/dist/kit/blueprints/progression.d.ts +0 -68
- package/dist/kit/blueprints/progression.d.ts.map +0 -1
- package/dist/kit/blueprints/progression.js +0 -324
- package/dist/kit/blueprints/quests.d.ts +0 -72
- package/dist/kit/blueprints/quests.d.ts.map +0 -1
- package/dist/kit/blueprints/quests.js +0 -285
- package/dist/kit/blueprints/worldsim.d.ts +0 -91
- package/dist/kit/blueprints/worldsim.d.ts.map +0 -1
- package/dist/kit/blueprints/worldsim.js +0 -468
- package/dist/kit/combat.d.ts +0 -141
- package/dist/kit/combat.d.ts.map +0 -1
- package/dist/kit/combat.js +0 -196
- package/dist/kit/decks.d.ts +0 -157
- package/dist/kit/decks.d.ts.map +0 -1
- package/dist/kit/decks.js +0 -186
- package/dist/kit/director.d.ts +0 -88
- package/dist/kit/director.d.ts.map +0 -1
- package/dist/kit/director.js +0 -86
- package/dist/kit/economy.d.ts +0 -289
- package/dist/kit/economy.d.ts.map +0 -1
- package/dist/kit/economy.js +0 -427
- package/dist/kit/engine.d.ts +0 -48
- package/dist/kit/engine.d.ts.map +0 -1
- package/dist/kit/engine.js +0 -113
- package/dist/kit/features.d.ts +0 -60
- package/dist/kit/features.d.ts.map +0 -1
- package/dist/kit/features.js +0 -65
- package/dist/kit/instances.d.ts +0 -52
- package/dist/kit/instances.d.ts.map +0 -1
- package/dist/kit/instances.js +0 -60
- package/dist/kit/inventory.d.ts +0 -129
- package/dist/kit/inventory.d.ts.map +0 -1
- package/dist/kit/inventory.js +0 -200
- package/dist/kit/leaderboards.d.ts +0 -86
- package/dist/kit/leaderboards.d.ts.map +0 -1
- package/dist/kit/leaderboards.js +0 -133
- package/dist/kit/liveops.d.ts +0 -112
- package/dist/kit/liveops.d.ts.map +0 -1
- package/dist/kit/liveops.js +0 -183
- package/dist/kit/loot.d.ts +0 -128
- package/dist/kit/loot.d.ts.map +0 -1
- package/dist/kit/loot.js +0 -160
- package/dist/kit/matches.d.ts +0 -301
- package/dist/kit/matches.d.ts.map +0 -1
- package/dist/kit/matches.js +0 -458
- package/dist/kit/matchmaking.d.ts +0 -57
- package/dist/kit/matchmaking.d.ts.map +0 -1
- package/dist/kit/matchmaking.js +0 -59
- package/dist/kit/minigames.d.ts +0 -30
- package/dist/kit/minigames.d.ts.map +0 -1
- package/dist/kit/minigames.js +0 -38
- package/dist/kit/mobs.d.ts +0 -90
- package/dist/kit/mobs.d.ts.map +0 -1
- package/dist/kit/mobs.js +0 -98
- package/dist/kit/moderation.d.ts +0 -73
- package/dist/kit/moderation.d.ts.map +0 -1
- package/dist/kit/moderation.js +0 -103
- package/dist/kit/movement.d.ts +0 -78
- package/dist/kit/movement.d.ts.map +0 -1
- package/dist/kit/movement.js +0 -103
- package/dist/kit/notifications.d.ts +0 -45
- package/dist/kit/notifications.d.ts.map +0 -1
- package/dist/kit/notifications.js +0 -67
- package/dist/kit/npcs.d.ts +0 -226
- package/dist/kit/npcs.d.ts.map +0 -1
- package/dist/kit/npcs.js +0 -141
- package/dist/kit/objects.d.ts +0 -116
- package/dist/kit/objects.d.ts.map +0 -1
- package/dist/kit/objects.js +0 -119
- package/dist/kit/pets.d.ts +0 -85
- package/dist/kit/pets.d.ts.map +0 -1
- package/dist/kit/pets.js +0 -96
- package/dist/kit/plots.d.ts +0 -85
- package/dist/kit/plots.d.ts.map +0 -1
- package/dist/kit/plots.js +0 -113
- package/dist/kit/progression.d.ts +0 -181
- package/dist/kit/progression.d.ts.map +0 -1
- package/dist/kit/progression.js +0 -265
- package/dist/kit/quests.d.ts +0 -171
- package/dist/kit/quests.d.ts.map +0 -1
- package/dist/kit/quests.js +0 -237
- package/dist/kit/racing.d.ts +0 -85
- package/dist/kit/racing.d.ts.map +0 -1
- package/dist/kit/racing.js +0 -99
- package/dist/kit/shared.d.ts +0 -73
- package/dist/kit/shared.d.ts.map +0 -1
- package/dist/kit/shared.js +0 -101
- package/dist/kit/telemetry.d.ts +0 -66
- package/dist/kit/telemetry.d.ts.map +0 -1
- package/dist/kit/telemetry.js +0 -133
- package/dist/kit/territory.d.ts +0 -97
- package/dist/kit/territory.d.ts.map +0 -1
- package/dist/kit/territory.js +0 -114
- package/dist/kit/worldsim.d.ts +0 -263
- package/dist/kit/worldsim.d.ts.map +0 -1
- package/dist/kit/worldsim.js +0 -268
- package/dist/stores/model.d.ts +0 -81
- package/dist/stores/model.d.ts.map +0 -1
- package/dist/stores/model.js +0 -163
|
@@ -1,30 +1,23 @@
|
|
|
1
1
|
import { GLUE_HOST_CALL_TIMEOUT_MS, SAB_HEADER_BYTES, wrapGlueSab, writeGlueResult, } from './glue-sab.js';
|
|
2
|
-
import {
|
|
2
|
+
import { EXEC_CLIENT_HOST_CALLS } from './client-host-calls.js';
|
|
3
3
|
import { defaultClientGridEventBus, } from './client-grid-event-bus.js';
|
|
4
|
+
export { EXEC_CLIENT_HOST_CALLS };
|
|
5
|
+
/** Log lines forwarded per rolling second; past it lines are counted and dropped. */
|
|
6
|
+
export const PLAYER_CODE_LOG_LINES_PER_SECOND = 20;
|
|
7
|
+
/** The longest log line forwarded, in characters. */
|
|
8
|
+
export const PLAYER_CODE_LOG_MAX_CHARS = 1000;
|
|
9
|
+
/** The largest `invoke` payload, and the largest reply accepted, in bytes. */
|
|
10
|
+
export const PLAYER_CODE_INVOKE_MAX_BYTES = 256 * 1024;
|
|
4
11
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* itself (the mod's own bounds; the page-local grid event bus).
|
|
12
|
+
* Per-call-family rate caps (calls per rolling second); flood one, others hold. The allowlist
|
|
13
|
+
* itself is {@link EXEC_CLIENT_HOST_CALLS}, deny by default: only owner-lawful reads and effects
|
|
14
|
+
* cross the bridge, and auth, admin, authoring, grid mutation, raw UDP pose, voice, teams and
|
|
15
|
+
* any network fetch are absent by construction, not by a denylist. `grid_info` and
|
|
16
|
+
* `emit_event` are answered by the broker itself (the mod's own bounds; the page-local grid
|
|
17
|
+
* event bus).
|
|
12
18
|
*/
|
|
13
|
-
export const ALLOWED_HOST_CALLS = (() => {
|
|
14
|
-
var _a;
|
|
15
|
-
const groups = {};
|
|
16
|
-
for (const fn of GENERATED_HOST_CATALOG.functions) {
|
|
17
|
-
if (!fn.targets.includes('client'))
|
|
18
|
-
continue;
|
|
19
|
-
(groups[_a = fn.group] ?? (groups[_a] = new Set())).add(fn.name);
|
|
20
|
-
}
|
|
21
|
-
return groups;
|
|
22
|
-
})();
|
|
23
|
-
/** Per-call-family rate caps (calls per rolling second); flood one, others hold. */
|
|
24
19
|
const RATE_CAPS = {
|
|
25
|
-
model: 100,
|
|
26
20
|
state: 100,
|
|
27
|
-
sessions: 20,
|
|
28
21
|
world_read: 400,
|
|
29
22
|
world_write: 200,
|
|
30
23
|
egress: 60,
|
|
@@ -33,11 +26,7 @@ const RATE_CAPS = {
|
|
|
33
26
|
meta: 100,
|
|
34
27
|
};
|
|
35
28
|
/** Grid-addressed functions whose `gridId` argument must be the mod's own grid. */
|
|
36
|
-
const SELF_GRID_FUNCTIONS = new Set([
|
|
37
|
-
'grid_state_get',
|
|
38
|
-
'grid_state_set',
|
|
39
|
-
'grid_permission_check',
|
|
40
|
-
]);
|
|
29
|
+
const SELF_GRID_FUNCTIONS = new Set(['grid_permission_check']);
|
|
41
30
|
const CHUNK_FUNCTIONS = new Set([
|
|
42
31
|
'chunk_get',
|
|
43
32
|
'voxels_list',
|
|
@@ -45,12 +34,19 @@ const CHUNK_FUNCTIONS = new Set([
|
|
|
45
34
|
'actors_list_radius',
|
|
46
35
|
]);
|
|
47
36
|
const PRESENTATION_FUNCTIONS = new Set(['hud_set', 'overlay_draw']);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
for (const
|
|
51
|
-
|
|
37
|
+
function groupsByFunction(allowed) {
|
|
38
|
+
const byFn = new Map();
|
|
39
|
+
for (const [group, fns] of Object.entries(allowed)) {
|
|
40
|
+
for (const fn of fns)
|
|
41
|
+
byFn.set(fn, group);
|
|
42
|
+
}
|
|
43
|
+
return byFn;
|
|
52
44
|
}
|
|
45
|
+
const FN_TO_GROUP = groupsByFunction(EXEC_CLIENT_HOST_CALLS);
|
|
53
46
|
const RATE_WINDOW_MS = 1000;
|
|
47
|
+
const LOG_LEVELS = ['debug', 'info', 'warn', 'error'];
|
|
48
|
+
const MAX_PENDING_INVOKES = 8;
|
|
49
|
+
const DEFAULT_INVOKE_TIMEOUT_MS = 10000;
|
|
54
50
|
const CIRCUIT_TRIP_THRESHOLD = 5;
|
|
55
51
|
const GLOBAL_HOST_CALL_CAP = 1000;
|
|
56
52
|
const MAX_HOST_CALL_FN_BYTES = 128;
|
|
@@ -69,16 +65,16 @@ const FORBIDDEN_BINDING_KEYS = new Set([
|
|
|
69
65
|
]);
|
|
70
66
|
const utf8Encoder = new TextEncoder();
|
|
71
67
|
/**
|
|
72
|
-
* Page-side security broker for
|
|
73
|
-
* player
|
|
68
|
+
* Page-side security broker for a ck-exec mod's CLIENT half: browser WASM from one
|
|
69
|
+
* `crowdy-client-sdk` crate, built by the platform and served to a player who consented to it.
|
|
74
70
|
*
|
|
75
71
|
* The untrusted glue worker runs the player module; the broker is the trusted
|
|
76
72
|
* boundary on the page:
|
|
77
73
|
* - artifact bytes come only from the platform (hash-verified; side-load
|
|
78
|
-
* refused),
|
|
74
|
+
* refused) and are metered (`ck_fuel`, refilled per dispatch),
|
|
79
75
|
* - a deny-by-default, capability-grouped host-call allowlist crosses the
|
|
80
|
-
* bridge, each call re-validated
|
|
81
|
-
* filtered on both reads and effects,
|
|
76
|
+
* bridge, narrowed to what the player consented to, each call re-validated
|
|
77
|
+
* (confused-deputy safe) and grid-AABB filtered on both reads and effects,
|
|
82
78
|
* - per-call-family rate caps bound a runaway mod,
|
|
83
79
|
* - a local circuit breaker + per-dispatch watchdog recover the page from a
|
|
84
80
|
* hung or abusive worker.
|
|
@@ -106,8 +102,13 @@ export class PlayerCodeBroker {
|
|
|
106
102
|
this.startupTimer = null;
|
|
107
103
|
this.dispatchTimer = null;
|
|
108
104
|
this.activeDispatch = null;
|
|
105
|
+
this.consented = new Set(Array.isArray(this.options.consentedHostCalls) ? this.options.consentedHostCalls : []);
|
|
109
106
|
this.busUnsubscribe = null;
|
|
110
107
|
this.deliveringEventDepth = 0;
|
|
108
|
+
this.logBucket = [];
|
|
109
|
+
this.droppedLogs = 0;
|
|
110
|
+
this.invokeSeq = 0;
|
|
111
|
+
this.pendingInvokes = new Map();
|
|
111
112
|
this.busSubscriber = {
|
|
112
113
|
moduleName: this.options.moduleName ?? null,
|
|
113
114
|
deliver: (event) => this.deliverEvent(event),
|
|
@@ -196,14 +197,19 @@ export class PlayerCodeBroker {
|
|
|
196
197
|
if (this.circuitOpen) {
|
|
197
198
|
throw new Error('player code circuit is open; reset before starting');
|
|
198
199
|
}
|
|
200
|
+
if ((this.options.engine ?? 'ck-exec') !== 'ck-exec' ||
|
|
201
|
+
!this.options.artifactHash ||
|
|
202
|
+
typeof this.options.fuelPerDispatch !== 'bigint' ||
|
|
203
|
+
this.options.fuelPerDispatch <= 0n ||
|
|
204
|
+
!Array.isArray(this.options.consentedHostCalls)) {
|
|
205
|
+
throw new Error('a ck-exec CLIENT half runs only with the artifactHash, fuelPerDispatch and consentedHostCalls it was served with');
|
|
206
|
+
}
|
|
199
207
|
const lifecycleVersion = ++this.lifecycleVersion;
|
|
200
208
|
this.starting = true;
|
|
201
209
|
try {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
throw new Error('refusing to run an artifact that was not fetched from the platform');
|
|
206
|
-
}
|
|
210
|
+
const actual = await this.hash(artifact);
|
|
211
|
+
if (actual !== this.options.artifactHash) {
|
|
212
|
+
throw new Error('refusing to run an artifact that was not fetched from the platform');
|
|
207
213
|
}
|
|
208
214
|
if (lifecycleVersion !== this.lifecycleVersion) {
|
|
209
215
|
throw new Error('PlayerCodeBroker start was cancelled');
|
|
@@ -229,6 +235,46 @@ export class PlayerCodeBroker {
|
|
|
229
235
|
this.stopWorker();
|
|
230
236
|
this.artifact = null;
|
|
231
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Call the running module's `handle_invoke` export with `payload` and resolve with the bytes
|
|
240
|
+
* it returns. The page chooses the payload; the reply is the module's, so treat it as
|
|
241
|
+
* untrusted input. Refused while the module is not running, above
|
|
242
|
+
* {@link PLAYER_CODE_INVOKE_MAX_BYTES}, or with eight invokes already pending; rejected when
|
|
243
|
+
* the module traps, stops or does not answer within `timeoutMs` (default 10 s). Each invoke is
|
|
244
|
+
* one dispatch, on the same fuel budget and watchdog as a tick.
|
|
245
|
+
*/
|
|
246
|
+
invoke(payload, options = {}) {
|
|
247
|
+
const worker = this.worker;
|
|
248
|
+
if (!worker || !this.workerReady || this.circuitOpen) {
|
|
249
|
+
return Promise.reject(new Error('the CLIENT half is not running'));
|
|
250
|
+
}
|
|
251
|
+
if (!(payload instanceof Uint8Array)) {
|
|
252
|
+
return Promise.reject(new Error('invoke takes a Uint8Array payload'));
|
|
253
|
+
}
|
|
254
|
+
if (payload.byteLength > PLAYER_CODE_INVOKE_MAX_BYTES) {
|
|
255
|
+
return Promise.reject(new Error('invoke payload exceeds the browser sandbox limit'));
|
|
256
|
+
}
|
|
257
|
+
if (this.pendingInvokes.size >= MAX_PENDING_INVOKES) {
|
|
258
|
+
return Promise.reject(new Error('too many invokes are pending'));
|
|
259
|
+
}
|
|
260
|
+
this.invokeSeq = (this.invokeSeq % 0x7ffffffe) + 1;
|
|
261
|
+
const id = this.invokeSeq;
|
|
262
|
+
return new Promise((resolve, reject) => {
|
|
263
|
+
const timer = setTimeout(() => {
|
|
264
|
+
if (!this.pendingInvokes.delete(id))
|
|
265
|
+
return;
|
|
266
|
+
reject(new Error('the CLIENT half did not answer the invoke in time'));
|
|
267
|
+
}, options.timeoutMs ?? DEFAULT_INVOKE_TIMEOUT_MS);
|
|
268
|
+
this.pendingInvokes.set(id, { resolve, reject, timer });
|
|
269
|
+
const copy = payload.slice();
|
|
270
|
+
try {
|
|
271
|
+
worker.postMessage({ type: 'invoke', id, payload: copy }, [copy.buffer]);
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
this.settleInvoke(id, new Error(`invoke could not reach the worker: ${error.message}`));
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
232
278
|
/** Clear a tripped circuit so the caller can start again after a fix. */
|
|
233
279
|
resetCircuit() {
|
|
234
280
|
this.circuitOpen = false;
|
|
@@ -291,6 +337,29 @@ export class PlayerCodeBroker {
|
|
|
291
337
|
}
|
|
292
338
|
return;
|
|
293
339
|
}
|
|
340
|
+
if (raw.type === 'log') {
|
|
341
|
+
this.forwardLog(raw.level, raw.message, raw.dropped);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (raw.type === 'invoke-result') {
|
|
345
|
+
if (!Number.isSafeInteger(raw.id))
|
|
346
|
+
return;
|
|
347
|
+
const id = raw.id;
|
|
348
|
+
if (raw.ok !== true) {
|
|
349
|
+
const detail = typeof raw.error === 'string' ? raw.error.slice(0, 200) : 'trap';
|
|
350
|
+
this.settleInvoke(id, new Error(`the CLIENT half's handle_invoke failed: ${detail}`));
|
|
351
|
+
}
|
|
352
|
+
else if (!(raw.payload instanceof Uint8Array)) {
|
|
353
|
+
this.settleInvoke(id, new Error('the CLIENT half answered the invoke with no bytes'));
|
|
354
|
+
}
|
|
355
|
+
else if (raw.payload.byteLength > PLAYER_CODE_INVOKE_MAX_BYTES) {
|
|
356
|
+
this.settleInvoke(id, new Error('the invoke reply exceeds the browser sandbox limit'));
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
this.settleInvoke(id, null, raw.payload.slice());
|
|
360
|
+
}
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
294
363
|
if (raw.type !== 'hostcall')
|
|
295
364
|
return;
|
|
296
365
|
this.armHostCallTimer(generation);
|
|
@@ -316,6 +385,9 @@ export class PlayerCodeBroker {
|
|
|
316
385
|
if (!group) {
|
|
317
386
|
throw new Error('host call is not allowed in the player browser sandbox');
|
|
318
387
|
}
|
|
388
|
+
if (!this.consented.has(raw.fn)) {
|
|
389
|
+
throw new Error('host call is outside the capabilities the player consented to');
|
|
390
|
+
}
|
|
319
391
|
if (!isPlainRecord(raw.args)) {
|
|
320
392
|
// Confused-deputy guard: reject malformed payloads outright rather
|
|
321
393
|
// than coercing them (09 T7).
|
|
@@ -451,7 +523,8 @@ export class PlayerCodeBroker {
|
|
|
451
523
|
type: 'init',
|
|
452
524
|
artifact: workerArtifact,
|
|
453
525
|
authority: 'player',
|
|
454
|
-
|
|
526
|
+
engine: 'ck-exec',
|
|
527
|
+
fuelPerDispatch: this.options.fuelPerDispatch.toString(),
|
|
455
528
|
hostCallTimeoutMs: this.options.hostCallTimeoutMs ?? GLUE_HOST_CALL_TIMEOUT_MS,
|
|
456
529
|
tickIntervalMs: this.options.tickIntervalMs ?? 0,
|
|
457
530
|
}, [workerArtifact]);
|
|
@@ -462,9 +535,64 @@ export class PlayerCodeBroker {
|
|
|
462
535
|
throw error;
|
|
463
536
|
}
|
|
464
537
|
}
|
|
538
|
+
settleInvoke(id, error, reply) {
|
|
539
|
+
const pending = this.pendingInvokes.get(id);
|
|
540
|
+
if (!pending)
|
|
541
|
+
return;
|
|
542
|
+
this.pendingInvokes.delete(id);
|
|
543
|
+
clearTimeout(pending.timer);
|
|
544
|
+
if (error)
|
|
545
|
+
pending.reject(error);
|
|
546
|
+
else
|
|
547
|
+
pending.resolve(reply ?? new Uint8Array(0));
|
|
548
|
+
}
|
|
549
|
+
/** Forward one worker log line within the rate and size bounds; a sink that throws is ignored. */
|
|
550
|
+
forwardLog(level, message, dropped) {
|
|
551
|
+
if (Number.isSafeInteger(dropped) && dropped > 0) {
|
|
552
|
+
this.droppedLogs += dropped;
|
|
553
|
+
}
|
|
554
|
+
const sink = this.options.onLog;
|
|
555
|
+
if (!sink || typeof message !== 'string')
|
|
556
|
+
return;
|
|
557
|
+
const now = Date.now();
|
|
558
|
+
this.logBucket = this.logBucket.filter((t) => now - t < RATE_WINDOW_MS);
|
|
559
|
+
if (this.logBucket.length >= PLAYER_CODE_LOG_LINES_PER_SECOND) {
|
|
560
|
+
this.droppedLogs += 1;
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
this.logBucket.push(now);
|
|
564
|
+
const moduleName = this.options.moduleName ?? null;
|
|
565
|
+
const lines = [];
|
|
566
|
+
if (this.droppedLogs > 0) {
|
|
567
|
+
lines.push({
|
|
568
|
+
level: 'warn',
|
|
569
|
+
message: `${this.droppedLogs} log line${this.droppedLogs === 1 ? '' : 's'} dropped (more than ${PLAYER_CODE_LOG_LINES_PER_SECOND} a second)`,
|
|
570
|
+
moduleName,
|
|
571
|
+
});
|
|
572
|
+
this.droppedLogs = 0;
|
|
573
|
+
}
|
|
574
|
+
lines.push({
|
|
575
|
+
level: (Number.isInteger(level) && LOG_LEVELS[level]) || 'info',
|
|
576
|
+
message: message.length > PLAYER_CODE_LOG_MAX_CHARS
|
|
577
|
+
? `${message.slice(0, PLAYER_CODE_LOG_MAX_CHARS - 1)}…`
|
|
578
|
+
: message,
|
|
579
|
+
moduleName,
|
|
580
|
+
});
|
|
581
|
+
for (const line of lines) {
|
|
582
|
+
try {
|
|
583
|
+
sink(line);
|
|
584
|
+
}
|
|
585
|
+
catch {
|
|
586
|
+
// The page's sink is not the module's business.
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
465
590
|
stopWorker() {
|
|
466
591
|
this.clearStartupTimer();
|
|
467
592
|
this.clearDispatchTimer();
|
|
593
|
+
for (const id of [...this.pendingInvokes.keys()]) {
|
|
594
|
+
this.settleInvoke(id, new Error('the CLIENT half stopped'));
|
|
595
|
+
}
|
|
468
596
|
this.activeDispatch = null;
|
|
469
597
|
this.workerReady = false;
|
|
470
598
|
const worker = this.worker;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Browser Web Worker entry for
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* worker message loop.
|
|
2
|
+
* Browser Web Worker entry for a ck-exec mod's CLIENT half. This is the ONLY
|
|
3
|
+
* platform code that shares an execution context with an untrusted player
|
|
4
|
+
* module. It is intentionally thin: the auditable runtime + ABI marshalling
|
|
5
|
+
* live in [glue-runtime.ts] and the synchronous host-call transport in
|
|
6
|
+
* [glue-sab.ts]; this file only wires them to the worker message loop.
|
|
8
7
|
*
|
|
9
|
-
* - it instantiates the
|
|
10
|
-
* that exposes ONLY `ck.*`
|
|
8
|
+
* - it instantiates the fuel-metered player artifact with an import table
|
|
9
|
+
* that exposes ONLY `ck.*` and `wasi_snapshot_preview1.random_get`
|
|
10
|
+
* (nothing else importable),
|
|
11
11
|
* - it never has the DOM, `window`, auth tokens, `fetch`, or third-party
|
|
12
12
|
* `importScripts`,
|
|
13
13
|
* - `ck.host_call` blocks the worker on a SharedArrayBuffer while the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"player-glue-worker.d.ts","sourceRoot":"","sources":["../../src/player-runtime/player-glue-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAS3B,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"player-glue-worker.d.ts","sourceRoot":"","sources":["../../src/player-runtime/player-glue-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAS3B,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB,CAAC;AAUF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,KAAK,IAAI,CAAC;IACrE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;IACrD,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,GAAG,IAAI,CAyKP"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Browser Web Worker entry for
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* worker message loop.
|
|
2
|
+
* Browser Web Worker entry for a ck-exec mod's CLIENT half. This is the ONLY
|
|
3
|
+
* platform code that shares an execution context with an untrusted player
|
|
4
|
+
* module. It is intentionally thin: the auditable runtime + ABI marshalling
|
|
5
|
+
* live in [glue-runtime.ts] and the synchronous host-call transport in
|
|
6
|
+
* [glue-sab.ts]; this file only wires them to the worker message loop.
|
|
8
7
|
*
|
|
9
|
-
* - it instantiates the
|
|
10
|
-
* that exposes ONLY `ck.*`
|
|
8
|
+
* - it instantiates the fuel-metered player artifact with an import table
|
|
9
|
+
* that exposes ONLY `ck.*` and `wasi_snapshot_preview1.random_get`
|
|
10
|
+
* (nothing else importable),
|
|
11
11
|
* - it never has the DOM, `window`, auth tokens, `fetch`, or third-party
|
|
12
12
|
* `importScripts`,
|
|
13
13
|
* - `ck.host_call` blocks the worker on a SharedArrayBuffer while the
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
import { GlueRuntime, GLUE_HOST_FUNCTIONS, parseFuelBudget, runWithWatchdog, } from './glue-runtime.js';
|
|
24
24
|
import { createGlueSab, armGlueRequest, GLUE_HOST_CALL_TIMEOUT_MS, waitAndReadGlueReply, } from './glue-sab.js';
|
|
25
25
|
export { GlueRuntime, GLUE_HOST_FUNCTIONS, parseFuelBudget, runWithWatchdog, };
|
|
26
|
+
/** Log lines the worker posts per rolling second; the broker forwards fewer. */
|
|
27
|
+
const GLUE_LOG_LINES_PER_SECOND = 50;
|
|
26
28
|
/**
|
|
27
29
|
* Wire the glue runtime to a worker-like message port. Exported (not just
|
|
28
30
|
* run at import) so the Node integration test can drive the identical wiring
|
|
@@ -35,7 +37,22 @@ export function startGlueWorker(port) {
|
|
|
35
37
|
let dispatchId = 0;
|
|
36
38
|
let hostCallTimeoutMs = GLUE_HOST_CALL_TIMEOUT_MS;
|
|
37
39
|
let ticking = false;
|
|
40
|
+
let logTimes = [];
|
|
41
|
+
let droppedLogs = 0;
|
|
38
42
|
const post = (message) => port.postMessage(message);
|
|
43
|
+
// The broker bounds what reaches the page; this bounds what a flooding module costs it in
|
|
44
|
+
// messages. Dropped lines are counted on the next line posted.
|
|
45
|
+
const postLog = (level, message) => {
|
|
46
|
+
const now = Date.now();
|
|
47
|
+
logTimes = logTimes.filter((t) => now - t < 1000);
|
|
48
|
+
if (logTimes.length >= GLUE_LOG_LINES_PER_SECOND) {
|
|
49
|
+
droppedLogs += 1;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
logTimes.push(now);
|
|
53
|
+
post({ type: 'log', level, message, dropped: droppedLogs });
|
|
54
|
+
droppedLogs = 0;
|
|
55
|
+
};
|
|
39
56
|
// Synchronous gateway: post the request (so the page can see it), then
|
|
40
57
|
// block on the SAB until the broker writes the reply.
|
|
41
58
|
const hostCallSync = (reqBytes) => {
|
|
@@ -88,7 +105,7 @@ export function startGlueWorker(port) {
|
|
|
88
105
|
const fuelPerDispatch = parseFuelBudget(init.fuelPerDispatch);
|
|
89
106
|
runtime = new GlueRuntime({
|
|
90
107
|
hostCallSync,
|
|
91
|
-
onLog:
|
|
108
|
+
onLog: postLog,
|
|
92
109
|
fuelPerDispatch,
|
|
93
110
|
});
|
|
94
111
|
try {
|
package/dist/stores/actors.d.ts
CHANGED
|
@@ -46,7 +46,12 @@ export interface AckedActorUpdate<T> {
|
|
|
46
46
|
notification: ActorUpdateEcho;
|
|
47
47
|
receivedAt: number;
|
|
48
48
|
}
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* The record of the most recent send error attributed to this actor: one the
|
|
51
|
+
* server reported for a sequence number, or a send that failed before
|
|
52
|
+
* reaching it (`errorCode` is then the SDK error's code, e.g.
|
|
53
|
+
* `PLATFORM_BUSY`, or `SEND_FAILED`).
|
|
54
|
+
*/
|
|
50
55
|
export interface ActorSendError {
|
|
51
56
|
errorCode: string;
|
|
52
57
|
sequenceNumber: number;
|
|
@@ -119,6 +124,8 @@ export declare class LocalActorStore<T> {
|
|
|
119
124
|
private lastSentRecord;
|
|
120
125
|
private lastAckRecord;
|
|
121
126
|
private lastErrorRecord;
|
|
127
|
+
/** The last send failed before reaching the server: the next tick sends even if unchanged. */
|
|
128
|
+
private resendDue;
|
|
122
129
|
private readonly inFlight;
|
|
123
130
|
private readonly sequences;
|
|
124
131
|
private readonly now;
|
|
@@ -156,7 +163,10 @@ export declare class LocalActorStore<T> {
|
|
|
156
163
|
sendNow(): Promise<void>;
|
|
157
164
|
/** Re-register presence (reconnects, tab return, dropped first join). */
|
|
158
165
|
refresh(reason?: SendReason): Promise<void>;
|
|
159
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* One send-loop tick: dedup unchanged state, keyframe when quiet. A failed
|
|
168
|
+
* loop send lands on {@link lastError} and the next tick sends again.
|
|
169
|
+
*/
|
|
160
170
|
private tick;
|
|
161
171
|
private send;
|
|
162
172
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actors.d.ts","sourceRoot":"","sources":["../../src/stores/actors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GAAG,UAAU,CACtC,WAAW,CAAC,uBAAuB,CAAC,aAAa,CAAC,CAAC,CACpD,CAAC,CAAC,CAAC,CAAC;AAEL,mCAA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AI/D,2BAA2B;IAC3B,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;IAI9D,qDAAqD;IACrD;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAO7B,IAAI,IAAI,IAAI;IAIZ,uCAAuC;IACvC,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,SAAS;CAMlB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,GAAG,EAAE,mBAAmB,EACxB,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC5B,gBAAgB,CAAC,CAAC,CAAC,CAErB"}
|
package/dist/stores/actors.js
CHANGED
|
@@ -43,6 +43,10 @@ export function localStorageUuidStore(key = 'crowdyjs:actor-uuid') {
|
|
|
43
43
|
},
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
+
function sendErrorCode(error) {
|
|
47
|
+
const code = error?.code;
|
|
48
|
+
return typeof code === 'string' && code !== '' ? code : 'SEND_FAILED';
|
|
49
|
+
}
|
|
46
50
|
/**
|
|
47
51
|
* The SDK-managed **local actor**: identity (minted + persisted uuid), typed
|
|
48
52
|
* replication state, current chunk, an automatic 5 Hz send loop with
|
|
@@ -62,6 +66,8 @@ export class LocalActorStore {
|
|
|
62
66
|
this.lastSentRecord = null;
|
|
63
67
|
this.lastAckRecord = null;
|
|
64
68
|
this.lastErrorRecord = null;
|
|
69
|
+
/** The last send failed before reaching the server: the next tick sends even if unchanged. */
|
|
70
|
+
this.resendDue = false;
|
|
65
71
|
this.inFlight = new Map(); // seq → sentAt
|
|
66
72
|
this.sequences = new SequenceAllocator();
|
|
67
73
|
this.now = config.now ?? Date.now;
|
|
@@ -110,8 +116,9 @@ export class LocalActorStore {
|
|
|
110
116
|
const doc = globalThis.document;
|
|
111
117
|
if ((config.refreshOnVisibility ?? true) && doc?.addEventListener) {
|
|
112
118
|
const onVisibility = () => {
|
|
113
|
-
if (doc.visibilityState === 'visible')
|
|
114
|
-
|
|
119
|
+
if (doc.visibilityState === 'visible') {
|
|
120
|
+
this.refresh('visibility').catch(() => { });
|
|
121
|
+
}
|
|
115
122
|
};
|
|
116
123
|
doc.addEventListener('visibilitychange', onVisibility);
|
|
117
124
|
ctx.onDispose(() => doc.removeEventListener('visibilitychange', onVisibility));
|
|
@@ -190,23 +197,26 @@ export class LocalActorStore {
|
|
|
190
197
|
return;
|
|
191
198
|
await this.send(reason);
|
|
192
199
|
}
|
|
193
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* One send-loop tick: dedup unchanged state, keyframe when quiet. A failed
|
|
202
|
+
* loop send lands on {@link lastError} and the next tick sends again.
|
|
203
|
+
*/
|
|
194
204
|
tick() {
|
|
195
205
|
if (!this.currentChunk)
|
|
196
206
|
return;
|
|
197
207
|
const encoded = this.config.codec.encode(this.currentState);
|
|
198
|
-
if ((this.config.sendOnChange ?? true) && this.lastSentRecord) {
|
|
208
|
+
if ((this.config.sendOnChange ?? true) && this.lastSentRecord && !this.resendDue) {
|
|
199
209
|
const quietFor = this.now() - this.lastSentRecord.sentAt;
|
|
200
210
|
const keyframeEvery = this.config.keyframeEveryMs ?? 3000;
|
|
201
211
|
if (encoded === this.lastSentRecord.encoded && quietFor < keyframeEvery) {
|
|
202
212
|
return;
|
|
203
213
|
}
|
|
204
214
|
if (encoded === this.lastSentRecord.encoded) {
|
|
205
|
-
|
|
215
|
+
this.send('keyframe', encoded).catch(() => { });
|
|
206
216
|
return;
|
|
207
217
|
}
|
|
208
218
|
}
|
|
209
|
-
|
|
219
|
+
this.send('interval', encoded).catch(() => { });
|
|
210
220
|
}
|
|
211
221
|
async send(reason, preEncoded) {
|
|
212
222
|
const chunk = this.currentChunk;
|
|
@@ -217,7 +227,9 @@ export class LocalActorStore {
|
|
|
217
227
|
const encoded = preEncoded ?? this.config.codec.encode(state);
|
|
218
228
|
const sequenceNumber = this.sequences.next();
|
|
219
229
|
const sentAt = this.now();
|
|
220
|
-
|
|
230
|
+
const record = { state, encoded, chunk, sequenceNumber, sentAt, reason };
|
|
231
|
+
this.lastSentRecord = record;
|
|
232
|
+
this.resendDue = false;
|
|
221
233
|
this.inFlight.set(sequenceNumber, sentAt);
|
|
222
234
|
if (this.inFlight.size > 256) {
|
|
223
235
|
const oldest = this.inFlight.keys().next().value;
|
|
@@ -231,17 +243,30 @@ export class LocalActorStore {
|
|
|
231
243
|
uuid: this.uuid,
|
|
232
244
|
detail: { reason },
|
|
233
245
|
});
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
246
|
+
try {
|
|
247
|
+
await this.ctx.client.udp.sendActorUpdate({
|
|
248
|
+
appId: this.ctx.appId,
|
|
249
|
+
chunk,
|
|
250
|
+
uuid: this.uuid,
|
|
251
|
+
state: encoded,
|
|
252
|
+
sequenceNumber,
|
|
253
|
+
...(this.config.distance !== undefined ? { distance: this.config.distance } : {}),
|
|
254
|
+
...(this.config.decayRate !== undefined
|
|
255
|
+
? { decayRate: this.config.decayRate }
|
|
256
|
+
: {}),
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
this.inFlight.delete(sequenceNumber);
|
|
261
|
+
this.lastErrorRecord = {
|
|
262
|
+
errorCode: sendErrorCode(error),
|
|
263
|
+
sequenceNumber,
|
|
264
|
+
receivedAt: this.now(),
|
|
265
|
+
};
|
|
266
|
+
if (this.lastSentRecord === record)
|
|
267
|
+
this.resendDue = true;
|
|
268
|
+
throw error;
|
|
269
|
+
}
|
|
245
270
|
}
|
|
246
271
|
}
|
|
247
272
|
/**
|
package/dist/stores/chunks.d.ts
CHANGED
|
@@ -122,6 +122,9 @@ export declare class ChunkStore<TVoxelState = string, TChunkState = string> {
|
|
|
122
122
|
private readonly config;
|
|
123
123
|
private readonly chunks;
|
|
124
124
|
private readonly inFlight;
|
|
125
|
+
private readonly hydrating;
|
|
126
|
+
/** Consecutive failed hydrations per chunk key. */
|
|
127
|
+
private readonly hydrateFailures;
|
|
125
128
|
private readonly writeBackQueue;
|
|
126
129
|
private readonly changeListeners;
|
|
127
130
|
private readonly voxelStateCodec;
|
|
@@ -151,8 +154,17 @@ export declare class ChunkStore<TVoxelState = string, TChunkState = string> {
|
|
|
151
154
|
* configured, marks server-unknown chunks `missing`, and seeds them via
|
|
152
155
|
* `onMissing`. In-flight requests are deduped; safe to call every time the
|
|
153
156
|
* player crosses a chunk boundary.
|
|
157
|
+
*
|
|
158
|
+
* Requests the platform refuses as busy are asked again with backoff, and
|
|
159
|
+
* at most 8 hydrations run at once. Hydration is best effort: a chunk whose
|
|
160
|
+
* states could not be fetched keeps the voxels the bulk load gave it
|
|
161
|
+
* (`hydrated` stays false) and is hydrated on a later call. A chunk whose
|
|
162
|
+
* bulk load failed is `failed` and is requested again by a later call. The
|
|
163
|
+
* promise rejects only when the bulk load itself fails.
|
|
154
164
|
*/
|
|
155
165
|
ensureAround(center: ChunkCoord, radius: number): Promise<void>;
|
|
166
|
+
/** Hydrates chunks with at most {@link HYDRATE_CONCURRENCY} requests in flight. */
|
|
167
|
+
private hydrateAll;
|
|
156
168
|
/**
|
|
157
169
|
* Hydrate one chunk's sparse voxel states (and chunk state) via a
|
|
158
170
|
* single-chunk fetch — bulk loads omit them.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../../src/stores/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAQL,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"chunks.d.ts","sourceRoot":"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