@crowdedkingdoms/crowdyjs 17.14.0-dev.1 → 18.0.1-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 +129 -1
- package/README.md +97 -164
- 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 +34 -59
- package/dist/crowdy-studio/controller.d.ts.map +1 -1
- package/dist/crowdy-studio/controller.js +96 -225
- 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 -49
- package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -2
- package/dist/crowdy-studio/embed/hud-layer.d.ts.map +1 -1
- package/dist/crowdy-studio/embed/panel.d.ts +3 -13
- 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 -12
- package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
- package/dist/crowdy-studio/starter-projects.js +12 -103
- 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/apps.d.ts +1 -10
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +1 -16
- package/dist/domains/host.d.ts +3 -3
- package/dist/domains/host.js +3 -3
- package/dist/domains/hosting.d.ts +0 -6
- package/dist/domains/hosting.d.ts.map +1 -1
- package/dist/domains/hosting.js +1 -16
- package/dist/domains/marketplace.d.ts +9 -70
- package/dist/domains/marketplace.d.ts.map +1 -1
- package/dist/domains/marketplace.js +9 -120
- package/dist/domains/organizations.d.ts +1 -9
- package/dist/domains/organizations.d.ts.map +1 -1
- package/dist/domains/organizations.js +1 -15
- package/dist/domains/payments.d.ts +5 -48
- package/dist/domains/payments.d.ts.map +1 -1
- package/dist/domains/payments.js +5 -57
- 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/domains/quotas.d.ts +20 -7
- package/dist/domains/quotas.d.ts.map +1 -1
- package/dist/domains/quotas.js +15 -6
- package/dist/domains/users.d.ts +7 -74
- package/dist/domains/users.d.ts.map +1 -1
- package/dist/domains/users.js +7 -105
- 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 +955 -8272
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +5 -329
- package/dist/grid-mods/exec-client-halves.d.ts +19 -3
- package/dist/grid-mods/exec-client-halves.d.ts.map +1 -1
- package/dist/grid-mods/exec-client-halves.js +17 -2
- package/dist/grid-mods/grid-host-calls.d.ts +29 -17
- package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
- package/dist/grid-mods/grid-host-calls.js +40 -46
- package/dist/grid-mods/mod-runtime.d.ts +18 -11
- package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
- package/dist/grid-mods/mod-runtime.js +4 -2
- package/dist/grid-scope.d.ts +0 -189
- package/dist/grid-scope.d.ts.map +1 -1
- package/dist/grid-scope.js +0 -70
- package/dist/index.d.ts +12 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -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 +30 -34
- 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 +24 -20
- package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
- package/dist/player-runtime/glue-runtime.js +26 -55
- 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 +70 -43
- package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
- package/dist/player-runtime/player-code-broker.js +159 -64
- package/dist/player-runtime/player-glue-worker.d.ts +8 -9
- package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
- package/dist/player-runtime/player-glue-worker.js +26 -11
- 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,43 +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 = clientHostCalls(() => true);
|
|
14
|
-
/** Client calls only the legacy engines answer, besides the Game Model group. */
|
|
15
|
-
const LEGACY_ONLY_HOST_CALLS = new Set([
|
|
16
|
-
'sessions_list',
|
|
17
|
-
'grid_state_get',
|
|
18
|
-
'grid_state_set',
|
|
19
|
-
]);
|
|
20
|
-
/**
|
|
21
|
-
* The host calls a ck-exec mod's CLIENT half may make, grouped as {@link ALLOWED_HOST_CALLS}:
|
|
22
|
-
* the client half of the host catalog less what only the legacy engines answer (the `model`
|
|
23
|
-
* group, `sessions_list` and `grid_state_*`). It is exactly what crowdy-client-sdk wraps.
|
|
24
|
-
*/
|
|
25
|
-
export const EXEC_CLIENT_HOST_CALLS = clientHostCalls((fn) => fn.group !== 'model' && !LEGACY_ONLY_HOST_CALLS.has(fn.name));
|
|
26
|
-
function clientHostCalls(keep) {
|
|
27
|
-
var _a;
|
|
28
|
-
const groups = {};
|
|
29
|
-
for (const fn of GENERATED_HOST_CATALOG.functions) {
|
|
30
|
-
if (!fn.targets.includes('client') || !keep(fn))
|
|
31
|
-
continue;
|
|
32
|
-
(groups[_a = fn.group] ?? (groups[_a] = new Set())).add(fn.name);
|
|
33
|
-
}
|
|
34
|
-
return groups;
|
|
35
|
-
}
|
|
36
|
-
/** Per-call-family rate caps (calls per rolling second); flood one, others hold. */
|
|
37
19
|
const RATE_CAPS = {
|
|
38
|
-
model: 100,
|
|
39
20
|
state: 100,
|
|
40
|
-
sessions: 20,
|
|
41
21
|
world_read: 400,
|
|
42
22
|
world_write: 200,
|
|
43
23
|
egress: 60,
|
|
@@ -46,11 +26,7 @@ const RATE_CAPS = {
|
|
|
46
26
|
meta: 100,
|
|
47
27
|
};
|
|
48
28
|
/** Grid-addressed functions whose `gridId` argument must be the mod's own grid. */
|
|
49
|
-
const SELF_GRID_FUNCTIONS = new Set([
|
|
50
|
-
'grid_state_get',
|
|
51
|
-
'grid_state_set',
|
|
52
|
-
'grid_permission_check',
|
|
53
|
-
]);
|
|
29
|
+
const SELF_GRID_FUNCTIONS = new Set(['grid_permission_check']);
|
|
54
30
|
const CHUNK_FUNCTIONS = new Set([
|
|
55
31
|
'chunk_get',
|
|
56
32
|
'voxels_list',
|
|
@@ -66,11 +42,11 @@ function groupsByFunction(allowed) {
|
|
|
66
42
|
}
|
|
67
43
|
return byFn;
|
|
68
44
|
}
|
|
69
|
-
const FN_TO_GROUP =
|
|
70
|
-
'player-compute': groupsByFunction(ALLOWED_HOST_CALLS),
|
|
71
|
-
'ck-exec': groupsByFunction(EXEC_CLIENT_HOST_CALLS),
|
|
72
|
-
};
|
|
45
|
+
const FN_TO_GROUP = groupsByFunction(EXEC_CLIENT_HOST_CALLS);
|
|
73
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;
|
|
74
50
|
const CIRCUIT_TRIP_THRESHOLD = 5;
|
|
75
51
|
const GLOBAL_HOST_CALL_CAP = 1000;
|
|
76
52
|
const MAX_HOST_CALL_FN_BYTES = 128;
|
|
@@ -89,16 +65,16 @@ const FORBIDDEN_BINDING_KEYS = new Set([
|
|
|
89
65
|
]);
|
|
90
66
|
const utf8Encoder = new TextEncoder();
|
|
91
67
|
/**
|
|
92
|
-
* Page-side security broker for
|
|
93
|
-
* 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.
|
|
94
70
|
*
|
|
95
71
|
* The untrusted glue worker runs the player module; the broker is the trusted
|
|
96
72
|
* boundary on the page:
|
|
97
73
|
* - artifact bytes come only from the platform (hash-verified; side-load
|
|
98
|
-
* refused),
|
|
74
|
+
* refused) and are metered (`ck_fuel`, refilled per dispatch),
|
|
99
75
|
* - a deny-by-default, capability-grouped host-call allowlist crosses the
|
|
100
|
-
* bridge, each call re-validated
|
|
101
|
-
* 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,
|
|
102
78
|
* - per-call-family rate caps bound a runaway mod,
|
|
103
79
|
* - a local circuit breaker + per-dispatch watchdog recover the page from a
|
|
104
80
|
* hung or abusive worker.
|
|
@@ -126,11 +102,13 @@ export class PlayerCodeBroker {
|
|
|
126
102
|
this.startupTimer = null;
|
|
127
103
|
this.dispatchTimer = null;
|
|
128
104
|
this.activeDispatch = null;
|
|
129
|
-
this.consented = this.options.consentedHostCalls
|
|
130
|
-
? new Set(this.options.consentedHostCalls)
|
|
131
|
-
: null;
|
|
105
|
+
this.consented = new Set(Array.isArray(this.options.consentedHostCalls) ? this.options.consentedHostCalls : []);
|
|
132
106
|
this.busUnsubscribe = null;
|
|
133
107
|
this.deliveringEventDepth = 0;
|
|
108
|
+
this.logBucket = [];
|
|
109
|
+
this.droppedLogs = 0;
|
|
110
|
+
this.invokeSeq = 0;
|
|
111
|
+
this.pendingInvokes = new Map();
|
|
134
112
|
this.busSubscriber = {
|
|
135
113
|
moduleName: this.options.moduleName ?? null,
|
|
136
114
|
deliver: (event) => this.deliverEvent(event),
|
|
@@ -219,20 +197,19 @@ export class PlayerCodeBroker {
|
|
|
219
197
|
if (this.circuitOpen) {
|
|
220
198
|
throw new Error('player code circuit is open; reset before starting');
|
|
221
199
|
}
|
|
222
|
-
if (this.options.engine
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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)) {
|
|
226
205
|
throw new Error('a ck-exec CLIENT half runs only with the artifactHash, fuelPerDispatch and consentedHostCalls it was served with');
|
|
227
206
|
}
|
|
228
207
|
const lifecycleVersion = ++this.lifecycleVersion;
|
|
229
208
|
this.starting = true;
|
|
230
209
|
try {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
throw new Error('refusing to run an artifact that was not fetched from the platform');
|
|
235
|
-
}
|
|
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');
|
|
236
213
|
}
|
|
237
214
|
if (lifecycleVersion !== this.lifecycleVersion) {
|
|
238
215
|
throw new Error('PlayerCodeBroker start was cancelled');
|
|
@@ -258,6 +235,46 @@ export class PlayerCodeBroker {
|
|
|
258
235
|
this.stopWorker();
|
|
259
236
|
this.artifact = null;
|
|
260
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
|
+
}
|
|
261
278
|
/** Clear a tripped circuit so the caller can start again after a fix. */
|
|
262
279
|
resetCircuit() {
|
|
263
280
|
this.circuitOpen = false;
|
|
@@ -320,6 +337,29 @@ export class PlayerCodeBroker {
|
|
|
320
337
|
}
|
|
321
338
|
return;
|
|
322
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
|
+
}
|
|
323
363
|
if (raw.type !== 'hostcall')
|
|
324
364
|
return;
|
|
325
365
|
this.armHostCallTimer(generation);
|
|
@@ -341,11 +381,11 @@ export class PlayerCodeBroker {
|
|
|
341
381
|
utf8Encoder.encode(raw.fn).length > MAX_HOST_CALL_FN_BYTES) {
|
|
342
382
|
throw new Error('invalid host call fn');
|
|
343
383
|
}
|
|
344
|
-
const group = FN_TO_GROUP
|
|
384
|
+
const group = FN_TO_GROUP.get(raw.fn);
|
|
345
385
|
if (!group) {
|
|
346
386
|
throw new Error('host call is not allowed in the player browser sandbox');
|
|
347
387
|
}
|
|
348
|
-
if (
|
|
388
|
+
if (!this.consented.has(raw.fn)) {
|
|
349
389
|
throw new Error('host call is outside the capabilities the player consented to');
|
|
350
390
|
}
|
|
351
391
|
if (!isPlainRecord(raw.args)) {
|
|
@@ -483,8 +523,8 @@ export class PlayerCodeBroker {
|
|
|
483
523
|
type: 'init',
|
|
484
524
|
artifact: workerArtifact,
|
|
485
525
|
authority: 'player',
|
|
486
|
-
engine:
|
|
487
|
-
fuelPerDispatch: this.options.fuelPerDispatch
|
|
526
|
+
engine: 'ck-exec',
|
|
527
|
+
fuelPerDispatch: this.options.fuelPerDispatch.toString(),
|
|
488
528
|
hostCallTimeoutMs: this.options.hostCallTimeoutMs ?? GLUE_HOST_CALL_TIMEOUT_MS,
|
|
489
529
|
tickIntervalMs: this.options.tickIntervalMs ?? 0,
|
|
490
530
|
}, [workerArtifact]);
|
|
@@ -495,9 +535,64 @@ export class PlayerCodeBroker {
|
|
|
495
535
|
throw error;
|
|
496
536
|
}
|
|
497
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
|
+
}
|
|
498
590
|
stopWorker() {
|
|
499
591
|
this.clearStartupTimer();
|
|
500
592
|
this.clearDispatchTimer();
|
|
593
|
+
for (const id of [...this.pendingInvokes.keys()]) {
|
|
594
|
+
this.settleInvoke(id, new Error('the CLIENT half stopped'));
|
|
595
|
+
}
|
|
501
596
|
this.activeDispatch = null;
|
|
502
597
|
this.workerReady = false;
|
|
503
598
|
const worker = this.worker;
|
|
@@ -1,14 +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.*`
|
|
11
|
-
*
|
|
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),
|
|
12
11
|
* - it never has the DOM, `window`, auth tokens, `fetch`, or third-party
|
|
13
12
|
* `importScripts`,
|
|
14
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
|
|
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,14 +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.*`
|
|
11
|
-
*
|
|
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),
|
|
12
11
|
* - it never has the DOM, `window`, auth tokens, `fetch`, or third-party
|
|
13
12
|
* `importScripts`,
|
|
14
13
|
* - `ck.host_call` blocks the worker on a SharedArrayBuffer while the
|
|
@@ -24,6 +23,8 @@
|
|
|
24
23
|
import { GlueRuntime, GLUE_HOST_FUNCTIONS, parseFuelBudget, runWithWatchdog, } from './glue-runtime.js';
|
|
25
24
|
import { createGlueSab, armGlueRequest, GLUE_HOST_CALL_TIMEOUT_MS, waitAndReadGlueReply, } from './glue-sab.js';
|
|
26
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;
|
|
27
28
|
/**
|
|
28
29
|
* Wire the glue runtime to a worker-like message port. Exported (not just
|
|
29
30
|
* run at import) so the Node integration test can drive the identical wiring
|
|
@@ -36,7 +37,22 @@ export function startGlueWorker(port) {
|
|
|
36
37
|
let dispatchId = 0;
|
|
37
38
|
let hostCallTimeoutMs = GLUE_HOST_CALL_TIMEOUT_MS;
|
|
38
39
|
let ticking = false;
|
|
40
|
+
let logTimes = [];
|
|
41
|
+
let droppedLogs = 0;
|
|
39
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
|
+
};
|
|
40
56
|
// Synchronous gateway: post the request (so the page can see it), then
|
|
41
57
|
// block on the SAB until the broker writes the reply.
|
|
42
58
|
const hostCallSync = (reqBytes) => {
|
|
@@ -89,9 +105,8 @@ export function startGlueWorker(port) {
|
|
|
89
105
|
const fuelPerDispatch = parseFuelBudget(init.fuelPerDispatch);
|
|
90
106
|
runtime = new GlueRuntime({
|
|
91
107
|
hostCallSync,
|
|
92
|
-
onLog:
|
|
108
|
+
onLog: postLog,
|
|
93
109
|
fuelPerDispatch,
|
|
94
|
-
engine: init.engine === 'ck-exec' ? 'ck-exec' : 'player-compute',
|
|
95
110
|
});
|
|
96
111
|
try {
|
|
97
112
|
await runtime.instantiate(init.artifact);
|
package/dist/stores/inbox.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ export declare function attachActorInbox<T = string>(ctx: WorldSessionContext, c
|
|
|
124
124
|
/** A decoded client/server event delivered by the {@link EventRouter}. */
|
|
125
125
|
export interface TypedEvent<T> {
|
|
126
126
|
eventType: number;
|
|
127
|
-
/** Whether another client or the server (
|
|
127
|
+
/** Whether another client or the server (a hub's emit) emitted it. */
|
|
128
128
|
origin: 'client' | 'server';
|
|
129
129
|
/** The emitting actor/source uuid. */
|
|
130
130
|
uuid: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/stores/inbox.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,yEAAyE;AACzE,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,OAAO,EAAE,CAAC,CAAC;IACX,WAAW,EAAE,MAA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AO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAwB;IACrD,OAAO,CAAC,kBAAkB,CAAK;IAC/B,OAAO,CAAC,QAAQ,CAAK;gBAGF,GAAG,EAAE,mBAAmB,EACxB,MAAM,GAAE,iBAAsB;IA8CjD;;;;OAIG;IACH,EAAE,CAAC,CAAC,EACF,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,GACtC,MAAM,IAAI;IAcb,yEAAyE;IACzE,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS;IAIpE,sDAAsD;IACtD,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED;;;OAGG;IACG,IAAI,CAAC,CAAC,EACV,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,OAAO,CAAC;IAoBnB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,YAAY;CAIrB;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,mBAAmB,EACxB,MAAM,GAAE,iBAAsB,GAC7B,WAAW,CAEb"}
|
package/dist/stores/index.d.ts
CHANGED
|
@@ -19,13 +19,11 @@ export { LocalActorStore, RemoteActorLane, RemoteActorStore, attachLocalActor, a
|
|
|
19
19
|
export { ErrorStore, attachErrorStore, type AttributedError, type ErrorStoreConfig, } from './errors.js';
|
|
20
20
|
export { ChunkStore, attachChunkStore, type CachedChunk, type ChunkLoadState, type ChunkStoreConfig, type SetVoxelInput, } from './chunks.js';
|
|
21
21
|
export { ActorInbox, ChannelInbox, EventRouter, attachActorInbox, attachChannelInbox, attachEventRouter, type ActorInboxConfig, type ChannelInboxConfig, type EventRouterConfig, type InboxMessage, type TypedEvent, } from './inbox.js';
|
|
22
|
-
export { ContainerMirror, attachContainerMirror, type ContainerMirrorConfig, type MirroredContainer, } from './model.js';
|
|
23
22
|
export { AvatarStateStore, HostTracker, SaveStateStore, attachAvatarState, attachHostTracker, attachSaveState, type AvatarStateConfig, type HostTrackerConfig, type SaveStateConfig, } from './durable.js';
|
|
24
23
|
import { LocalActorStore, RemoteActorStore, type LocalActorConfig, type RemoteActorsConfig } from './actors.js';
|
|
25
24
|
import type { StateCodec } from './codec.js';
|
|
26
25
|
import { ChunkStore, type ChunkStoreConfig } from './chunks.js';
|
|
27
26
|
import { AvatarStateStore, HostTracker, SaveStateStore, type AvatarStateConfig, type HostTrackerConfig, type SaveStateConfig } from './durable.js';
|
|
28
|
-
import { ContainerMirror, type ContainerMirrorConfig } from './model.js';
|
|
29
27
|
import { ErrorStore, type ErrorStoreConfig } from './errors.js';
|
|
30
28
|
import { ActorInbox, ChannelInbox, EventRouter, type ActorInboxConfig, type ChannelInboxConfig, type EventRouterConfig } from './inbox.js';
|
|
31
29
|
import { WorldSessionCore, type WorldSessionBaseConfig, type WorldStoresClient } from './session.js';
|
|
@@ -72,11 +70,6 @@ export interface WorldSessionConfig extends WorldSessionBaseConfig {
|
|
|
72
70
|
save?: SaveStateConfig<any> | true;
|
|
73
71
|
/** Typed avatar public/private/app state ({@link AvatarStateStore}). */
|
|
74
72
|
avatar?: AvatarStateConfig<any, any, any> | true;
|
|
75
|
-
/**
|
|
76
|
-
* Game-model mirror: typed cached container snapshots with coalesced
|
|
77
|
-
* refresh + notify-to-pull channel binding ({@link ContainerMirror}).
|
|
78
|
-
*/
|
|
79
|
-
model?: ContainerMirrorConfig | true;
|
|
80
73
|
}
|
|
81
74
|
/** Infer the payload type of a `codec` config field (else the default `D`). */
|
|
82
75
|
type CodecType<CC, D> = CC extends {
|
|
@@ -152,10 +145,6 @@ export type WorldSession<C extends WorldSessionConfig = WorldSessionConfig> = Wo
|
|
|
152
145
|
avatar: infer CC;
|
|
153
146
|
} ? {
|
|
154
147
|
readonly avatar: AvatarStateStore<AvatarPublicType<CC>, AvatarPrivateType<CC>, AvatarAppType<CC>>;
|
|
155
|
-
} : unknown) & (C extends {
|
|
156
|
-
model: ContainerMirrorConfig | true;
|
|
157
|
-
} ? {
|
|
158
|
-
readonly model: ContainerMirror;
|
|
159
148
|
} : unknown);
|
|
160
149
|
/**
|
|
161
150
|
* Create a **world session**: one shared `udpNotifications` subscription
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,KAAK,EACL,KAAK,EACL,GAAG,EACH,GAAG,EACH,EAAE,EACF,GAAG,EACH,GAAG,EACH,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,SAAS,EACT,EAAE,EACF,GAAG,EACH,GAAG,EACH,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,MAAM,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,SAAS,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,KAAK,EACL,KAAK,EACL,GAAG,EACH,GAAG,EACH,EAAE,EACF,GAAG,EACH,GAAG,EACH,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,SAAS,EACT,EAAE,EACF,GAAG,EACH,GAAG,EACH,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,aA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sDjB"}
|
package/dist/stores/index.js
CHANGED
|
@@ -19,12 +19,10 @@ export { LocalActorStore, RemoteActorLane, RemoteActorStore, attachLocalActor, a
|
|
|
19
19
|
export { ErrorStore, attachErrorStore, } from './errors.js';
|
|
20
20
|
export { ChunkStore, attachChunkStore, } from './chunks.js';
|
|
21
21
|
export { ActorInbox, ChannelInbox, EventRouter, attachActorInbox, attachChannelInbox, attachEventRouter, } from './inbox.js';
|
|
22
|
-
export { ContainerMirror, attachContainerMirror, } from './model.js';
|
|
23
22
|
export { AvatarStateStore, HostTracker, SaveStateStore, attachAvatarState, attachHostTracker, attachSaveState, } from './durable.js';
|
|
24
23
|
import { LocalActorStore, RemoteActorStore, } from './actors.js';
|
|
25
24
|
import { ChunkStore } from './chunks.js';
|
|
26
25
|
import { AvatarStateStore, HostTracker, SaveStateStore, } from './durable.js';
|
|
27
|
-
import { ContainerMirror } from './model.js';
|
|
28
26
|
import { ErrorStore } from './errors.js';
|
|
29
27
|
import { ActorInbox, ChannelInbox, EventRouter, } from './inbox.js';
|
|
30
28
|
import { WorldSessionCore, } from './session.js';
|
|
@@ -88,7 +86,6 @@ export function createWorldSession(client, appId, config) {
|
|
|
88
86
|
const host = cfg.host ? new HostTracker(core, opt(cfg.host)) : undefined;
|
|
89
87
|
const save = cfg.save ? new SaveStateStore(core, opt(cfg.save)) : undefined;
|
|
90
88
|
const avatar = cfg.avatar ? new AvatarStateStore(core, opt(cfg.avatar)) : undefined;
|
|
91
|
-
const model = cfg.model ? new ContainerMirror(core, opt(cfg.model)) : undefined;
|
|
92
89
|
const session = {
|
|
93
90
|
appId,
|
|
94
91
|
context: core,
|
|
@@ -102,7 +99,6 @@ export function createWorldSession(client, appId, config) {
|
|
|
102
99
|
...(host ? { host } : {}),
|
|
103
100
|
...(save ? { save } : {}),
|
|
104
101
|
...(avatar ? { avatar } : {}),
|
|
105
|
-
...(model ? { model } : {}),
|
|
106
102
|
dispose: () => core.dispose(),
|
|
107
103
|
};
|
|
108
104
|
return session;
|
package/dist/stores/session.d.ts
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import type { AvatarsAPI } from '../domains/avatars.js';
|
|
20
20
|
import type { ChunksAPI } from '../domains/chunks.js';
|
|
21
|
-
import type { GameModelAPI } from '../domains/gameModel.js';
|
|
22
21
|
import type { HostAPI } from '../domains/host.js';
|
|
23
22
|
import type { StateAPI } from '../domains/state.js';
|
|
24
23
|
import type { UdpAPI } from '../domains/udp.js';
|
|
@@ -35,7 +34,6 @@ export interface WorldStoresClient {
|
|
|
35
34
|
state: StateAPI;
|
|
36
35
|
avatars: AvatarsAPI;
|
|
37
36
|
host: HostAPI;
|
|
38
|
-
gameModel: GameModelAPI;
|
|
39
37
|
}
|
|
40
38
|
/** The kinds of outbound sends the session can attribute errors to. */
|
|
41
39
|
export type SentPacketKind = 'actorUpdate' | 'voxelUpdate' | 'text' | 'clientEvent' | 'audio' | 'video' | 'singleActorMessage' | 'channelMessage';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/stores/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/stores/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,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