@crowdedkingdoms/crowdyjs 17.6.0 → 17.7.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 +41 -0
- package/README.md +33 -0
- package/dist/client.d.ts +7 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -1
- package/dist/crowdy-client.d.ts +24 -0
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +16 -0
- package/dist/crowdy-dsh/bridge.d.ts +24 -1
- package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
- package/dist/crowdy-dsh/bridge.js +32 -0
- package/dist/crowdy-dsh/index.d.ts +1 -1
- package/dist/crowdy-dsh/index.d.ts.map +1 -1
- package/dist/crowdy-dsh/protocol.d.ts +64 -1
- package/dist/crowdy-dsh/protocol.d.ts.map +1 -1
- package/dist/crowdy-dsh/protocol.js +8 -1
- package/dist/crowdy-studio/starter-projects.js +1 -1
- package/dist/default-origin.d.ts +6 -6
- package/dist/default-origin.d.ts.map +1 -1
- package/dist/default-origin.js +6 -6
- package/dist/domains/actors.d.ts +38 -17
- package/dist/domains/actors.d.ts.map +1 -1
- package/dist/domains/actors.js +38 -17
- package/dist/domains/crowdyStudio.js +1 -1
- package/dist/domains/grids.d.ts +30 -0
- package/dist/domains/grids.d.ts.map +1 -0
- package/dist/domains/grids.js +39 -0
- package/dist/domains/udp.d.ts +5 -1
- package/dist/domains/udp.d.ts.map +1 -1
- package/dist/domains/udp.js +5 -1
- package/dist/generated/graphql.d.ts +169 -9
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +13 -10
- package/dist/grid-mods/grid-host-calls.d.ts +70 -0
- package/dist/grid-mods/grid-host-calls.d.ts.map +1 -0
- package/dist/grid-mods/grid-host-calls.js +220 -0
- package/dist/grid-mods/index.d.ts +3 -0
- package/dist/grid-mods/index.d.ts.map +1 -0
- package/dist/grid-mods/index.js +2 -0
- package/dist/grid-mods/mod-runtime.d.ts +52 -0
- package/dist/grid-mods/mod-runtime.d.ts.map +1 -0
- package/dist/grid-mods/mod-runtime.js +55 -0
- package/dist/grid-program/host.d.ts +88 -0
- package/dist/grid-program/host.d.ts.map +1 -0
- package/dist/grid-program/host.js +231 -0
- package/dist/grid-program/index.d.ts +14 -0
- package/dist/grid-program/index.d.ts.map +1 -0
- package/dist/grid-program/index.js +13 -0
- package/dist/grid-program/program.d.ts +19 -0
- package/dist/grid-program/program.d.ts.map +1 -0
- package/dist/grid-program/program.js +154 -0
- package/dist/grid-program/protocol.d.ts +87 -0
- package/dist/grid-program/protocol.d.ts.map +1 -0
- package/dist/grid-program/protocol.js +17 -0
- package/dist/grid-scope.d.ts +296 -0
- package/dist/grid-scope.d.ts.map +1 -0
- package/dist/grid-scope.js +183 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/kit/matches.d.ts +1 -0
- package/dist/kit/matches.d.ts.map +1 -1
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- 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 +118 -6
- package/dist/player-runtime/client-grid-event-bus.d.ts +37 -0
- package/dist/player-runtime/client-grid-event-bus.d.ts.map +1 -0
- package/dist/player-runtime/client-grid-event-bus.js +56 -0
- package/dist/player-runtime/glue-runtime.d.ts +4 -2
- package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
- package/dist/player-runtime/glue-runtime.js +20 -23
- package/dist/player-runtime/host-catalog.generated.d.ts +16 -0
- package/dist/player-runtime/host-catalog.generated.d.ts.map +1 -0
- package/dist/player-runtime/host-catalog.generated.js +296 -0
- package/dist/player-runtime/player-code-broker.d.ts +38 -0
- package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
- package/dist/player-runtime/player-code-broker.js +116 -35
- package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
- package/dist/player-runtime/player-glue-worker.js +5 -0
- package/dist/realtime.d.ts +7 -0
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +3 -1
- package/package.json +10 -3
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
export const GENERATED_HOST_CATALOG = {
|
|
2
|
+
"catalogVersion": 1,
|
|
3
|
+
"description": "Every compute host function, once. Server dispatchers, the capability summary, the SDK parity gate and the CrowdyJS browser broker are all checked against this file (DN-10: grid scope = app scope intersected with grid confinement).",
|
|
4
|
+
"groups": {
|
|
5
|
+
"model": "Game Model containers, properties, edges and function invocation",
|
|
6
|
+
"state": "Durable user / avatar / grid state blobs",
|
|
7
|
+
"sessions": "Game Model sessions",
|
|
8
|
+
"world_read": "Chunk, voxel and actor reads",
|
|
9
|
+
"world_write": "Voxel writes",
|
|
10
|
+
"egress": "Replication and event egress",
|
|
11
|
+
"present": "Client HUD / overlay presentation",
|
|
12
|
+
"input": "Client input drains",
|
|
13
|
+
"meta": "Permission checks and binding metadata"
|
|
14
|
+
},
|
|
15
|
+
"functions": [
|
|
16
|
+
{
|
|
17
|
+
"name": "container_create",
|
|
18
|
+
"group": "model",
|
|
19
|
+
"targets": [
|
|
20
|
+
"server",
|
|
21
|
+
"client"
|
|
22
|
+
],
|
|
23
|
+
"app": "Any container in the app",
|
|
24
|
+
"grid": "Created on the player tier, owned by the executing identity and tagged with the grid"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "container_get",
|
|
28
|
+
"group": "model",
|
|
29
|
+
"targets": [
|
|
30
|
+
"server",
|
|
31
|
+
"client"
|
|
32
|
+
],
|
|
33
|
+
"app": "Any container in the app",
|
|
34
|
+
"grid": "Only containers the executing identity owns on this grid; others are unavailable"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "container_get_batch",
|
|
38
|
+
"group": "model",
|
|
39
|
+
"targets": [
|
|
40
|
+
"server",
|
|
41
|
+
"client"
|
|
42
|
+
],
|
|
43
|
+
"app": "Up to 32 containers in the app",
|
|
44
|
+
"grid": "Up to 32 owned containers on this grid; foreign ids are silently absent"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "containers_list",
|
|
48
|
+
"group": "model",
|
|
49
|
+
"targets": [
|
|
50
|
+
"server",
|
|
51
|
+
"client"
|
|
52
|
+
],
|
|
53
|
+
"app": "Filtered list over the app",
|
|
54
|
+
"grid": "Owned containers on this grid"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "container_delete",
|
|
58
|
+
"group": "model",
|
|
59
|
+
"targets": [
|
|
60
|
+
"server",
|
|
61
|
+
"client"
|
|
62
|
+
],
|
|
63
|
+
"app": "Any container in the app",
|
|
64
|
+
"grid": "Owned containers on this grid"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "property_set",
|
|
68
|
+
"group": "model",
|
|
69
|
+
"targets": [
|
|
70
|
+
"server",
|
|
71
|
+
"client"
|
|
72
|
+
],
|
|
73
|
+
"app": "Any container in the app",
|
|
74
|
+
"grid": "Owned containers on this grid"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "model_invoke",
|
|
78
|
+
"group": "model",
|
|
79
|
+
"targets": [
|
|
80
|
+
"server",
|
|
81
|
+
"client"
|
|
82
|
+
],
|
|
83
|
+
"app": "Trusted automation path, optional worldWrites",
|
|
84
|
+
"grid": "Ordinary player path as the executing identity; no worldWrites"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "edge_add",
|
|
88
|
+
"group": "model",
|
|
89
|
+
"targets": [
|
|
90
|
+
"server",
|
|
91
|
+
"client"
|
|
92
|
+
],
|
|
93
|
+
"app": "Any two containers in the app",
|
|
94
|
+
"grid": "Both endpoints owned on this grid"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "edge_delete",
|
|
98
|
+
"group": "model",
|
|
99
|
+
"targets": [
|
|
100
|
+
"server",
|
|
101
|
+
"client"
|
|
102
|
+
],
|
|
103
|
+
"app": "Any edge in the app",
|
|
104
|
+
"grid": "Edges between owned containers on this grid"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "sessions_list",
|
|
108
|
+
"group": "sessions",
|
|
109
|
+
"targets": [
|
|
110
|
+
"server",
|
|
111
|
+
"client"
|
|
112
|
+
],
|
|
113
|
+
"app": "Every session in the app",
|
|
114
|
+
"grid": "Sessions whose gridId is this grid"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "user_state_get",
|
|
118
|
+
"group": "state",
|
|
119
|
+
"targets": [
|
|
120
|
+
"server",
|
|
121
|
+
"client"
|
|
122
|
+
],
|
|
123
|
+
"app": "Any user in the app",
|
|
124
|
+
"grid": "The executing identity only"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "user_state_set",
|
|
128
|
+
"group": "state",
|
|
129
|
+
"targets": [
|
|
130
|
+
"server",
|
|
131
|
+
"client"
|
|
132
|
+
],
|
|
133
|
+
"app": "Any user in the app",
|
|
134
|
+
"grid": "The executing identity only"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "avatar_state_get",
|
|
138
|
+
"group": "state",
|
|
139
|
+
"targets": [
|
|
140
|
+
"server",
|
|
141
|
+
"client"
|
|
142
|
+
],
|
|
143
|
+
"app": "Any avatar in the app",
|
|
144
|
+
"grid": "Avatars whose live actor is inside the grid"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "grid_state_get",
|
|
148
|
+
"group": "state",
|
|
149
|
+
"targets": [
|
|
150
|
+
"server",
|
|
151
|
+
"client"
|
|
152
|
+
],
|
|
153
|
+
"app": "Any grid in the app",
|
|
154
|
+
"grid": "This grid only"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "grid_state_set",
|
|
158
|
+
"group": "state",
|
|
159
|
+
"targets": [
|
|
160
|
+
"server",
|
|
161
|
+
"client"
|
|
162
|
+
],
|
|
163
|
+
"app": "Any grid in the app",
|
|
164
|
+
"grid": "This grid only"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "chunk_get",
|
|
168
|
+
"group": "world_read",
|
|
169
|
+
"targets": [
|
|
170
|
+
"server",
|
|
171
|
+
"client"
|
|
172
|
+
],
|
|
173
|
+
"app": "Any chunk in the app",
|
|
174
|
+
"grid": "Chunks inside the grid box"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "voxels_list",
|
|
178
|
+
"group": "world_read",
|
|
179
|
+
"targets": [
|
|
180
|
+
"server",
|
|
181
|
+
"client"
|
|
182
|
+
],
|
|
183
|
+
"app": "Any chunk in the app",
|
|
184
|
+
"grid": "Chunks inside the grid box"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "actors_list",
|
|
188
|
+
"group": "world_read",
|
|
189
|
+
"targets": [
|
|
190
|
+
"server",
|
|
191
|
+
"client"
|
|
192
|
+
],
|
|
193
|
+
"app": "Any chunk in the app",
|
|
194
|
+
"grid": "Chunks inside the grid box"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"name": "actors_list_radius",
|
|
198
|
+
"group": "world_read",
|
|
199
|
+
"targets": [
|
|
200
|
+
"server",
|
|
201
|
+
"client"
|
|
202
|
+
],
|
|
203
|
+
"app": "Chunk box around a centre",
|
|
204
|
+
"grid": "Centre inside the grid box; the box is clipped to the grid"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"name": "voxel_set",
|
|
208
|
+
"group": "world_write",
|
|
209
|
+
"targets": [
|
|
210
|
+
"server",
|
|
211
|
+
"client"
|
|
212
|
+
],
|
|
213
|
+
"app": "System writer, any chunk",
|
|
214
|
+
"grid": "Chunks inside the grid box, and update_voxel_data on the grid"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "grid_permission_check",
|
|
218
|
+
"group": "meta",
|
|
219
|
+
"targets": [
|
|
220
|
+
"server",
|
|
221
|
+
"client"
|
|
222
|
+
],
|
|
223
|
+
"app": "Any user and grid in the app",
|
|
224
|
+
"grid": "The executing identity on this grid"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"name": "grid_info",
|
|
228
|
+
"group": "meta",
|
|
229
|
+
"targets": [
|
|
230
|
+
"client"
|
|
231
|
+
],
|
|
232
|
+
"app": "Not offered",
|
|
233
|
+
"grid": "The binding's own grid id and box, answered locally"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"name": "emit_spatial",
|
|
237
|
+
"group": "egress",
|
|
238
|
+
"targets": [
|
|
239
|
+
"server",
|
|
240
|
+
"client"
|
|
241
|
+
],
|
|
242
|
+
"app": "Any origin chunk",
|
|
243
|
+
"grid": "Origin chunk inside the grid box; reach is min(distance, 8, spatial_max_distance)",
|
|
244
|
+
"egress": true
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"name": "emit_channel",
|
|
248
|
+
"group": "egress",
|
|
249
|
+
"targets": [
|
|
250
|
+
"server",
|
|
251
|
+
"client"
|
|
252
|
+
],
|
|
253
|
+
"app": "Any channel in the app",
|
|
254
|
+
"grid": "Channels of this grid (channel_egress='grid'), or channels the owner may send_messages on (channel_egress='send_messages')",
|
|
255
|
+
"egress": true
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"name": "emit_event",
|
|
259
|
+
"group": "egress",
|
|
260
|
+
"targets": [
|
|
261
|
+
"server",
|
|
262
|
+
"client"
|
|
263
|
+
],
|
|
264
|
+
"app": "The app compute event bus",
|
|
265
|
+
"grid": "The grid event bus: modules on this grid, and app modules with a grid_event trigger",
|
|
266
|
+
"egress": true
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"name": "hud_set",
|
|
270
|
+
"group": "present",
|
|
271
|
+
"targets": [
|
|
272
|
+
"client"
|
|
273
|
+
],
|
|
274
|
+
"app": "Not offered",
|
|
275
|
+
"grid": "The player's own HUD"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"name": "overlay_draw",
|
|
279
|
+
"group": "present",
|
|
280
|
+
"targets": [
|
|
281
|
+
"client"
|
|
282
|
+
],
|
|
283
|
+
"app": "Not offered",
|
|
284
|
+
"grid": "The player's own overlay"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"name": "pointer_clicks",
|
|
288
|
+
"group": "input",
|
|
289
|
+
"targets": [
|
|
290
|
+
"client"
|
|
291
|
+
],
|
|
292
|
+
"app": "Refused on the server",
|
|
293
|
+
"grid": "Refused on the server"
|
|
294
|
+
}
|
|
295
|
+
]
|
|
296
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClientGridEvent, ClientGridEventBus } from './client-grid-event-bus.js';
|
|
1
2
|
export interface PlayerCodeGridBounds {
|
|
2
3
|
low: {
|
|
3
4
|
x: bigint;
|
|
@@ -9,6 +10,12 @@ export interface PlayerCodeGridBounds {
|
|
|
9
10
|
y: bigint;
|
|
10
11
|
z: bigint;
|
|
11
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* The grid's id. Required for the grid event bus (`emit_event` /
|
|
15
|
+
* `on_event`) and for self-grid checks on `grid_state_*`; a broker without
|
|
16
|
+
* it refuses those calls.
|
|
17
|
+
*/
|
|
18
|
+
gridId?: string;
|
|
12
19
|
}
|
|
13
20
|
export interface PlayerCodeHostCall {
|
|
14
21
|
fn: string;
|
|
@@ -64,7 +71,27 @@ export interface PlayerCodeBrokerOptions {
|
|
|
64
71
|
* mod typically ticks ~1 Hz; the per-dispatch watchdog still bounds each.
|
|
65
72
|
*/
|
|
66
73
|
tickIntervalMs?: number;
|
|
74
|
+
/**
|
|
75
|
+
* The mod's name on the grid event bus: the value `emit_event`'s `target`
|
|
76
|
+
* matches, and the `sourceModule` other mods see.
|
|
77
|
+
*/
|
|
78
|
+
moduleName?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Page-local grid event bus. Defaults to one bus shared by every broker on
|
|
81
|
+
* the page; pass `null` to keep this mod off the bus entirely.
|
|
82
|
+
*/
|
|
83
|
+
eventBus?: ClientGridEventBus | null;
|
|
67
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Deny-by-default host-call allowlist, grouped by capability (04 §4), built
|
|
87
|
+
* from the platform host catalog (DN-10: the same list the server dispatchers
|
|
88
|
+
* and the capability summary are checked against). Only owner-lawful reads and
|
|
89
|
+
* effects cross the bridge; auth, admin, authoring, grid mutation, raw UDP
|
|
90
|
+
* pose, voice, teams, and any network fetch are absent by construction, not
|
|
91
|
+
* by a denylist. `grid_info` and `emit_event` are answered by the broker
|
|
92
|
+
* itself (the mod's own bounds; the page-local grid event bus).
|
|
93
|
+
*/
|
|
94
|
+
export declare const ALLOWED_HOST_CALLS: Readonly<Record<string, ReadonlySet<string>>>;
|
|
68
95
|
/**
|
|
69
96
|
* Page-side security broker for browser-target player WASM (production shape,
|
|
70
97
|
* player compute P3).
|
|
@@ -102,7 +129,18 @@ export declare class PlayerCodeBroker {
|
|
|
102
129
|
private startupTimer;
|
|
103
130
|
private dispatchTimer;
|
|
104
131
|
private activeDispatch;
|
|
132
|
+
private busUnsubscribe;
|
|
133
|
+
private deliveringEventDepth;
|
|
134
|
+
private readonly busSubscriber;
|
|
105
135
|
constructor(options: PlayerCodeBrokerOptions);
|
|
136
|
+
/**
|
|
137
|
+
* Hand a grid event to the running mod's `on_event`. Returns false when the
|
|
138
|
+
* mod is not running (not ready, circuit open) so the bus does not count it.
|
|
139
|
+
*/
|
|
140
|
+
deliverEvent(event: ClientGridEvent): boolean;
|
|
141
|
+
private joinEventBus;
|
|
142
|
+
private leaveEventBus;
|
|
143
|
+
private emitGridEvent;
|
|
106
144
|
/**
|
|
107
145
|
* Start the worker on a platform-fetched artifact. Verifies the artifact
|
|
108
146
|
* hash (side-load refusal, T7) before handing bytes to the worker. A retained
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"player-code-broker.d.ts","sourceRoot":"","sources":["../../src/player-runtime/player-code-broker.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"player-code-broker.d.ts","sourceRoot":"","sources":["../../src/player-runtime/player-code-broker.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,eAAe,EACf,kBAAkB,EAEnB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAC/D,gBAAgB,CACd,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,IAAI,GAC/C,IAAI,CAAC;IACR,mBAAmB,CACjB,IAAI,EAAE,SAAS,EACf,Q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J3B;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAK;IAuCb,OAAO,CAAC,WAAW;IAoCnB,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,WAAW;YAiBL,IAAI;CAOnB"}
|
|
@@ -1,44 +1,30 @@
|
|
|
1
1
|
import { GLUE_HOST_CALL_TIMEOUT_MS, SAB_HEADER_BYTES, wrapGlueSab, writeGlueResult, } from './glue-sab.js';
|
|
2
|
+
import { GENERATED_HOST_CATALOG } from './host-catalog.generated.js';
|
|
3
|
+
import { defaultClientGridEventBus, } from './client-grid-event-bus.js';
|
|
2
4
|
/**
|
|
3
|
-
* Deny-by-default host-call allowlist, grouped by capability (04 §4)
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Deny-by-default host-call allowlist, grouped by capability (04 §4), built
|
|
6
|
+
* from the platform host catalog (DN-10: the same list the server dispatchers
|
|
7
|
+
* and the capability summary are checked against). Only owner-lawful reads and
|
|
8
|
+
* effects cross the bridge; auth, admin, authoring, grid mutation, raw UDP
|
|
9
|
+
* pose, voice, teams, and any network fetch are absent by construction, not
|
|
10
|
+
* by a denylist. `grid_info` and `emit_event` are answered by the broker
|
|
11
|
+
* itself (the mod's own bounds; the page-local grid event bus).
|
|
7
12
|
*/
|
|
8
|
-
const ALLOWED_HOST_CALLS = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'user_state_get',
|
|
19
|
-
'user_state_set',
|
|
20
|
-
'grid_state_get',
|
|
21
|
-
'grid_state_set',
|
|
22
|
-
]),
|
|
23
|
-
world_read: new Set([
|
|
24
|
-
'chunk_get',
|
|
25
|
-
'voxels_list',
|
|
26
|
-
'actors_list',
|
|
27
|
-
'actors_list_radius',
|
|
28
|
-
]),
|
|
29
|
-
world_write: new Set(['voxel_set']),
|
|
30
|
-
egress: new Set(['emit_spatial']),
|
|
31
|
-
present: new Set(['hud_set', 'overlay_draw']),
|
|
32
|
-
// Local input the host game drains each tick (Construct: holodeck canvas).
|
|
33
|
-
input: new Set(['pointer_clicks']),
|
|
34
|
-
// grid_info is answered by the broker itself (the mod's own clamped bounds),
|
|
35
|
-
// so a client mod can address its grid without a server round-trip.
|
|
36
|
-
meta: new Set(['grid_permission_check', 'grid_info']),
|
|
37
|
-
};
|
|
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
|
+
})();
|
|
38
23
|
/** Per-call-family rate caps (calls per rolling second); flood one, others hold. */
|
|
39
24
|
const RATE_CAPS = {
|
|
40
25
|
model: 100,
|
|
41
26
|
state: 100,
|
|
27
|
+
sessions: 20,
|
|
42
28
|
world_read: 400,
|
|
43
29
|
world_write: 200,
|
|
44
30
|
egress: 60,
|
|
@@ -46,6 +32,12 @@ const RATE_CAPS = {
|
|
|
46
32
|
input: 400,
|
|
47
33
|
meta: 100,
|
|
48
34
|
};
|
|
35
|
+
/** 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
|
+
]);
|
|
49
41
|
const CHUNK_FUNCTIONS = new Set([
|
|
50
42
|
'chunk_get',
|
|
51
43
|
'voxels_list',
|
|
@@ -114,6 +106,83 @@ export class PlayerCodeBroker {
|
|
|
114
106
|
this.startupTimer = null;
|
|
115
107
|
this.dispatchTimer = null;
|
|
116
108
|
this.activeDispatch = null;
|
|
109
|
+
this.busUnsubscribe = null;
|
|
110
|
+
this.deliveringEventDepth = 0;
|
|
111
|
+
this.busSubscriber = {
|
|
112
|
+
moduleName: this.options.moduleName ?? null,
|
|
113
|
+
deliver: (event) => this.deliverEvent(event),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Hand a grid event to the running mod's `on_event`. Returns false when the
|
|
118
|
+
* mod is not running (not ready, circuit open) so the bus does not count it.
|
|
119
|
+
*/
|
|
120
|
+
deliverEvent(event) {
|
|
121
|
+
const worker = this.worker;
|
|
122
|
+
if (!worker || !this.workerReady || this.circuitOpen)
|
|
123
|
+
return false;
|
|
124
|
+
if (event.gridId !== this.options.grid.gridId)
|
|
125
|
+
return false;
|
|
126
|
+
let payload;
|
|
127
|
+
try {
|
|
128
|
+
payload = utf8Encoder.encode(JSON.stringify(event));
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
if (payload.length > MAX_HOST_CALL_ARGS_BYTES)
|
|
134
|
+
return false;
|
|
135
|
+
this.deliveringEventDepth = event.cascadeDepth;
|
|
136
|
+
try {
|
|
137
|
+
worker.postMessage({ type: 'event', payload });
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
joinEventBus() {
|
|
145
|
+
const gridId = this.options.grid.gridId;
|
|
146
|
+
const bus = this.options.eventBus === undefined
|
|
147
|
+
? defaultClientGridEventBus
|
|
148
|
+
: this.options.eventBus;
|
|
149
|
+
if (!gridId || !bus || this.busUnsubscribe)
|
|
150
|
+
return;
|
|
151
|
+
this.busUnsubscribe = bus.subscribe(gridId, this.busSubscriber);
|
|
152
|
+
}
|
|
153
|
+
leaveEventBus() {
|
|
154
|
+
this.busUnsubscribe?.();
|
|
155
|
+
this.busUnsubscribe = null;
|
|
156
|
+
}
|
|
157
|
+
emitGridEvent(args) {
|
|
158
|
+
const gridId = this.options.grid.gridId;
|
|
159
|
+
const bus = this.options.eventBus === undefined
|
|
160
|
+
? defaultClientGridEventBus
|
|
161
|
+
: this.options.eventBus;
|
|
162
|
+
if (!gridId || !bus) {
|
|
163
|
+
throw new Error('emit_event needs a grid event bus (broker has no gridId)');
|
|
164
|
+
}
|
|
165
|
+
const name = args.name;
|
|
166
|
+
if (typeof name !== 'string' ||
|
|
167
|
+
name.length === 0 ||
|
|
168
|
+
utf8Encoder.encode(name).length > MAX_HOST_CALL_FN_BYTES) {
|
|
169
|
+
throw new Error('emit_event name must be a non-empty string');
|
|
170
|
+
}
|
|
171
|
+
const target = args.target;
|
|
172
|
+
if (target != null && (typeof target !== 'string' || target.length === 0)) {
|
|
173
|
+
throw new Error('emit_event target must be a module name');
|
|
174
|
+
}
|
|
175
|
+
const inEvent = this.activeDispatch?.kind === 'event';
|
|
176
|
+
const event = {
|
|
177
|
+
kind: 'grid_event',
|
|
178
|
+
gridId,
|
|
179
|
+
eventName: name,
|
|
180
|
+
payload: args.payload ?? null,
|
|
181
|
+
sourceModule: this.options.moduleName ?? null,
|
|
182
|
+
target: target ?? null,
|
|
183
|
+
cascadeDepth: inEvent ? this.deliveringEventDepth + 1 : 1,
|
|
184
|
+
};
|
|
185
|
+
return { delivered: bus.publish(event, this.busSubscriber) };
|
|
117
186
|
}
|
|
118
187
|
/**
|
|
119
188
|
* Start the worker on a platform-fetched artifact. Verifies the artifact
|
|
@@ -141,6 +210,7 @@ export class PlayerCodeBroker {
|
|
|
141
210
|
}
|
|
142
211
|
this.artifact = artifact.slice(0);
|
|
143
212
|
this.spawnWorker();
|
|
213
|
+
this.joinEventBus();
|
|
144
214
|
}
|
|
145
215
|
finally {
|
|
146
216
|
if (lifecycleVersion === this.lifecycleVersion)
|
|
@@ -155,6 +225,7 @@ export class PlayerCodeBroker {
|
|
|
155
225
|
stop() {
|
|
156
226
|
this.lifecycleVersion += 1;
|
|
157
227
|
this.starting = false;
|
|
228
|
+
this.leaveEventBus();
|
|
158
229
|
this.stopWorker();
|
|
159
230
|
this.artifact = null;
|
|
160
231
|
}
|
|
@@ -286,7 +357,10 @@ export class PlayerCodeBroker {
|
|
|
286
357
|
});
|
|
287
358
|
return;
|
|
288
359
|
}
|
|
289
|
-
if (
|
|
360
|
+
if (raw.fn === 'emit_event') {
|
|
361
|
+
data = this.emitGridEvent(args);
|
|
362
|
+
}
|
|
363
|
+
else if (PRESENTATION_FUNCTIONS.has(raw.fn)) {
|
|
290
364
|
// Presentation never reaches the SDK/server: it goes only to the
|
|
291
365
|
// game-declared channel. A game that offers no sink silently drops it.
|
|
292
366
|
this.options.onPresentation?.({
|
|
@@ -514,6 +588,13 @@ export class PlayerCodeBroker {
|
|
|
514
588
|
else if (fn === 'voxel_set' || fn === 'emit_spatial') {
|
|
515
589
|
this.assertChunk(args.chunkX, args.chunkY, args.chunkZ);
|
|
516
590
|
}
|
|
591
|
+
else if (SELF_GRID_FUNCTIONS.has(fn)) {
|
|
592
|
+
// Hosts that predate grid ids leave the check to their onHostCall.
|
|
593
|
+
const own = this.options.grid.gridId;
|
|
594
|
+
if (own && String(args.gridId ?? '') !== own) {
|
|
595
|
+
throw new Error('target is outside the player grid');
|
|
596
|
+
}
|
|
597
|
+
}
|
|
517
598
|
}
|
|
518
599
|
assertChunk(xRaw, yRaw, zRaw) {
|
|
519
600
|
const x = toBigInt(xRaw);
|
|
@@ -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;AAOF;;;;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,
|
|
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;AAOF;;;;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,CAyJP"}
|
|
@@ -159,6 +159,11 @@ export function startGlueWorker(port) {
|
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
+
else if (msg.type === 'event' && runtime) {
|
|
163
|
+
const payload = msg.payload instanceof Uint8Array ? msg.payload : new Uint8Array(0);
|
|
164
|
+
const id = beginDispatch('event');
|
|
165
|
+
void runDispatch(() => runtime.event(payload)).then((result) => report(id, 'event', result));
|
|
166
|
+
}
|
|
162
167
|
else if (msg.type === 'stop') {
|
|
163
168
|
ticking = false;
|
|
164
169
|
}
|
package/dist/realtime.d.ts
CHANGED
|
@@ -260,6 +260,12 @@ export interface RealtimeConfig {
|
|
|
260
260
|
* subscription land on the same game-api upstream.
|
|
261
261
|
*/
|
|
262
262
|
lbCookieStore?: LbCookieStore;
|
|
263
|
+
/**
|
|
264
|
+
* WebSocket constructor for the graphql-ws connection. Defaults to the
|
|
265
|
+
* platform's (with the sticky-LB cookie in Node). A grid program passes one
|
|
266
|
+
* that relays over a MessagePort.
|
|
267
|
+
*/
|
|
268
|
+
webSocketImpl?: unknown;
|
|
263
269
|
/**
|
|
264
270
|
* When true, spatial `sendActorUpdate` mutations are sent over the existing
|
|
265
271
|
* graphql-transport-ws connection instead of HTTP POST. Requires an active
|
|
@@ -339,6 +345,7 @@ export declare class RealtimeClient {
|
|
|
339
345
|
private readonly retryMaxDelayMs;
|
|
340
346
|
private readonly waitTimeoutMs;
|
|
341
347
|
private readonly lbCookieStore?;
|
|
348
|
+
private readonly webSocketImplOverride?;
|
|
342
349
|
private readonly wsUplinkMutations;
|
|
343
350
|
private readonly binaryTransport;
|
|
344
351
|
private readonly bundleSends;
|
package/dist/realtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../src/realtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,YAAY,GACZ,WAAW,GACX,cAAc,GACd,cAAc,GACd,QAAQ,CAAC;AAEb;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,CACvC,4BAA4B,CAAC,kBAAkB,CAAC,CACjD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,CACvC,eAAe,EACf;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAC3B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,eAAe,EAAE;QAAE,UAAU,CAAC,EAAE,yBAAyB,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAC3G;;;;;;OAMG;IACH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/dist/realtime.js
CHANGED
|
@@ -73,6 +73,7 @@ export class RealtimeClient {
|
|
|
73
73
|
this.retryMaxDelayMs = config.retryMaxDelayMs ?? 5000;
|
|
74
74
|
this.waitTimeoutMs = config.waitTimeoutMs ?? 5000;
|
|
75
75
|
this.lbCookieStore = config.lbCookieStore;
|
|
76
|
+
this.webSocketImplOverride = config.webSocketImpl;
|
|
76
77
|
this.wsUplinkMutations = config.wsUplinkMutations === true;
|
|
77
78
|
this.binaryTransport = config.binaryTransport === true;
|
|
78
79
|
this.bundleSends = config.bundleSends ?? true;
|
|
@@ -424,7 +425,8 @@ export class RealtimeClient {
|
|
|
424
425
|
}
|
|
425
426
|
}
|
|
426
427
|
this.setStatus('connecting');
|
|
427
|
-
const webSocketImpl =
|
|
428
|
+
const webSocketImpl = this.webSocketImplOverride ??
|
|
429
|
+
createStickyWebSocketImpl(this.lbCookieStore);
|
|
428
430
|
this.client = createClient({
|
|
429
431
|
// A function, not a string: graphql-ws calls it on every connect, so a
|
|
430
432
|
// re-discovered address is picked up by the reconnect already in
|