@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
|
@@ -8,11 +8,12 @@ export class GridHostCallRefused extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
const SPATIAL_KINDS = new Set(['actor', 'client_event', 'server_event', 'text']);
|
|
10
10
|
/**
|
|
11
|
-
* The page-side answer to
|
|
12
|
-
* through ordinary CrowdyJS confined to one grid
|
|
13
|
-
* to `PlayerCodeBroker({ onHostCall })`; the broker
|
|
14
|
-
* allowlist, rate caps and chunk
|
|
15
|
-
* `hud_set` and `overlay_draw`
|
|
11
|
+
* The page-side answer to a CLIENT half's host calls (`EXEC_CLIENT_HOST_CALLS`,
|
|
12
|
+
* what crowdy-client-sdk wraps), through ordinary CrowdyJS confined to one grid
|
|
13
|
+
* (DN-10 §4). Hand the result to `PlayerCodeBroker({ onHostCall })`; the broker
|
|
14
|
+
* has already applied the allowlist, the player's consent, rate caps and chunk
|
|
15
|
+
* clamps, and answers `grid_info`, `emit_event`, `hud_set` and `overlay_draw`
|
|
16
|
+
* itself.
|
|
16
17
|
*/
|
|
17
18
|
export function createGridHostCalls(options) {
|
|
18
19
|
const { scope, client, local } = options;
|
|
@@ -132,44 +133,35 @@ export function createGridHostCalls(options) {
|
|
|
132
133
|
}
|
|
133
134
|
return scope.channels.send(channelId, uuid(args), String(args.payloadBase64 ?? ''));
|
|
134
135
|
}
|
|
135
|
-
case '
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
case 'container_get_batch': {
|
|
147
|
-
const ids = Array.isArray(args.containerIds) ? args.containerIds.slice(0, 32) : [];
|
|
148
|
-
const found = await Promise.all(ids.map((id) => scope.model.container(String(id)).catch(() => null)));
|
|
149
|
-
return found.filter((c) => c != null);
|
|
136
|
+
case 'avatar_state_get': {
|
|
137
|
+
const avatarId = decimalId(args.avatarId);
|
|
138
|
+
if (!avatarId)
|
|
139
|
+
throw new GridHostCallRefused(fn, 'needs an avatar id');
|
|
140
|
+
if (!local?.avatarChunk || !client.avatars)
|
|
141
|
+
throw new GridHostCallRefused(fn);
|
|
142
|
+
const at = await local.avatarChunk(avatarId);
|
|
143
|
+
if (!at || !scope.contains(at)) {
|
|
144
|
+
throw new GridHostCallRefused(fn, 'names an avatar with no live actor in this grid');
|
|
145
|
+
}
|
|
146
|
+
return client.avatars.appState(appId, avatarId);
|
|
150
147
|
}
|
|
151
|
-
case '
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return scope.model.delete(String(args.containerId));
|
|
155
|
-
case 'property_set':
|
|
156
|
-
return scope.model.set({
|
|
157
|
-
containerId: String(args.containerId),
|
|
158
|
-
propertyKey: String(args.key),
|
|
159
|
-
valueJson: JSON.stringify(args.value ?? null),
|
|
160
|
-
});
|
|
161
|
-
case 'model_invoke':
|
|
162
|
-
if (!options.allowModelInvoke)
|
|
148
|
+
case 'grid_permission_check': {
|
|
149
|
+
const player = decimalId(options.userId);
|
|
150
|
+
if (!local?.gridPermissionKeys || !player)
|
|
163
151
|
throw new GridHostCallRefused(fn);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
152
|
+
const gridId = decimalId(args.gridId);
|
|
153
|
+
if (!gridId || gridId !== decimalId(scope.gridId)) {
|
|
154
|
+
throw new GridHostCallRefused(fn, 'names another grid');
|
|
155
|
+
}
|
|
156
|
+
if (decimalId(args.userId) !== player) {
|
|
157
|
+
throw new GridHostCallRefused(fn, 'asks about another player');
|
|
158
|
+
}
|
|
159
|
+
const key = args.permissionKey;
|
|
160
|
+
if (typeof key !== 'string' || !PERMISSION_KEY.test(key)) {
|
|
161
|
+
throw new GridHostCallRefused(fn, 'needs a permission key');
|
|
162
|
+
}
|
|
163
|
+
return new Set(await local.gridPermissionKeys()).has(key);
|
|
164
|
+
}
|
|
173
165
|
case 'user_state_get':
|
|
174
166
|
return client.state.getOne(appId);
|
|
175
167
|
case 'user_state_set':
|
|
@@ -182,13 +174,17 @@ export function createGridHostCalls(options) {
|
|
|
182
174
|
throw new GridHostCallRefused(fn);
|
|
183
175
|
return local.drainPointerClicks();
|
|
184
176
|
default:
|
|
185
|
-
// edge_*, grid_state_*, avatar_state_get and grid_permission_check have
|
|
186
|
-
// no browser GraphQL surface yet: the server host answers them for
|
|
187
|
-
// SERVER mods.
|
|
188
177
|
throw new GridHostCallRefused(fn);
|
|
189
178
|
}
|
|
190
179
|
};
|
|
191
180
|
}
|
|
181
|
+
/** As the runtime permission keys (`runtimePermissions`): lowercase, digits and `_`. */
|
|
182
|
+
const PERMISSION_KEY = /^[a-z][a-z0-9_]{0,63}$/;
|
|
183
|
+
/** A positive decimal id (BigInt as a decimal string, or a safe integer), normalized; else null. */
|
|
184
|
+
function decimalId(value) {
|
|
185
|
+
const text = typeof value === 'string' ? value : typeof value === 'number' && Number.isSafeInteger(value) ? String(value) : '';
|
|
186
|
+
return /^[1-9][0-9]{0,19}$/.test(text) ? text : null;
|
|
187
|
+
}
|
|
192
188
|
function coords(x, y, z) {
|
|
193
189
|
return [BigInt(x), BigInt(y), BigInt(z)];
|
|
194
190
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { createGridHostCalls, GridHostCallRefused, type GridHostCallsOptions, type GridHostLocal, } from './grid-host-calls.js';
|
|
2
2
|
export { startGridMod, type GridModSpec, type WasmGridModSpec, type ProgramGridModSpec, type RunningGridMod, type StartGridModOptions, } from './mod-runtime.js';
|
|
3
|
+
export { ExecClientHalves, type ExecClientHalvesGrid, type ExecClientHalvesOptions, type ExecClientHalfBroker, type ExecClientHalfError, type ExecClientHalfPrompt, type ExecClientHalfStopReason, } from './exec-client-halves.js';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/grid-mods/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/grid-mods/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC"}
|
package/dist/grid-mods/index.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import { type PlayerCodePresentation } from '../player-runtime/player-code-broker.js';
|
|
1
|
+
import { type PlayerCodeEngine, type PlayerCodeLogLine, type PlayerCodePresentation } from '../player-runtime/player-code-broker.js';
|
|
2
2
|
import type { GridProgramPort } from '../grid-program/protocol.js';
|
|
3
3
|
import type { GridScope } from '../grid-scope.js';
|
|
4
4
|
import { type GridHostCallsOptions, type GridHostLocal } from './grid-host-calls.js';
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* A ck-exec mod's CLIENT half: platform-built WASM run in the tokenless glue worker, with the
|
|
7
|
+
* `digest` (as `artifactHash`), `fuelPerDispatch`, `tickIntervalMs` and summary host calls of
|
|
8
|
+
* `exec.modClientArtifactBytes` (`ExecClientHalves` runs a whole grid's).
|
|
9
|
+
*/
|
|
6
10
|
export interface WasmGridModSpec {
|
|
7
11
|
kind: 'wasm';
|
|
8
12
|
moduleName: string;
|
|
9
13
|
artifact: ArrayBuffer;
|
|
10
|
-
artifactHash
|
|
11
|
-
fuelPerDispatch
|
|
14
|
+
artifactHash: string;
|
|
15
|
+
fuelPerDispatch: bigint;
|
|
12
16
|
tickIntervalMs?: number;
|
|
17
|
+
/** `'ck-exec'`, the only engine. */
|
|
18
|
+
engine?: PlayerCodeEngine;
|
|
19
|
+
/** The CLIENT half's `capabilitySummary.hostFunctions` the player consented to. */
|
|
20
|
+
consentedHostCalls: readonly string[];
|
|
13
21
|
/** The platform glue worker URL (`@crowdedkingdoms/crowdyjs/player-glue-worker`). */
|
|
14
22
|
workerUrl: string | URL;
|
|
15
23
|
}
|
|
@@ -32,18 +40,25 @@ export interface StartGridModOptions {
|
|
|
32
40
|
graphqlUrl?: string;
|
|
33
41
|
graphqlWsUrl?: string;
|
|
34
42
|
local?: GridHostLocal;
|
|
35
|
-
|
|
43
|
+
/** Forwarded to `createGridHostCalls`: the visiting player, for `grid_permission_check`. */
|
|
44
|
+
userId?: string;
|
|
36
45
|
onPresentation?: (presentation: PlayerCodePresentation) => void;
|
|
46
|
+
/** A CLIENT half's `crowdy::log` lines, bounded by the broker. Render them as text. */
|
|
47
|
+
onLog?: (line: PlayerCodeLogLine) => void;
|
|
37
48
|
onStopped?: (reason: string) => void;
|
|
38
49
|
}
|
|
39
50
|
export interface RunningGridMod {
|
|
40
51
|
kind: GridModSpec['kind'];
|
|
41
52
|
moduleName: string;
|
|
42
53
|
stop(): void;
|
|
54
|
+
/** A CLIENT half's `handle_invoke` (`PlayerCodeBroker.invoke`); absent for a grid program. */
|
|
55
|
+
invoke?(payload: Uint8Array, options?: {
|
|
56
|
+
timeoutMs?: number;
|
|
57
|
+
}): Promise<Uint8Array>;
|
|
43
58
|
}
|
|
44
59
|
/**
|
|
45
60
|
* One way to run player code inside a grid, whatever it is written in (DN-10
|
|
46
|
-
* §4-5).
|
|
61
|
+
* §4-5). A ck-exec CLIENT half gets the host calls it was consented through
|
|
47
62
|
* {@link createGridHostCalls}; JS grid programs get real CrowdyJS through a
|
|
48
63
|
* grid-token relay. Both are confined to `scope`'s grid, locally for UX and by
|
|
49
64
|
* the server for authority.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod-runtime.d.ts","sourceRoot":"","sources":["../../src/grid-mods/mod-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAE9B
|
|
1
|
+
{"version":3,"file":"mod-runtime.d.ts","sourceRoot":"","sources":["../../src/grid-mods/mod-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,WAAW,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,mFAAmF;IACnF,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,qFAAqF;IACrF,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC;CACzB;AAED,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,IAAI,EAAE,eAAe,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,kBAAkB,CAAC;AAE/D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,qFAAqF;IACrF,KAAK,EAAE,SAAS,CAAC;IACjB,iEAAiE;IACjE,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACvC,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAChE,uFAAuF;IACvF,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC1C,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,IAAI,IAAI,CAAC;IACb,8FAA8F;IAC9F,MAAM,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACrF;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,cAAc,CAAC,CA+CzB"}
|
|
@@ -3,7 +3,7 @@ import { hostGridProgram } from '../grid-program/host.js';
|
|
|
3
3
|
import { createGridHostCalls, } from './grid-host-calls.js';
|
|
4
4
|
/**
|
|
5
5
|
* One way to run player code inside a grid, whatever it is written in (DN-10
|
|
6
|
-
* §4-5).
|
|
6
|
+
* §4-5). A ck-exec CLIENT half gets the host calls it was consented through
|
|
7
7
|
* {@link createGridHostCalls}; JS grid programs get real CrowdyJS through a
|
|
8
8
|
* grid-token relay. Both are confined to `scope`'s grid, locally for UX and by
|
|
9
9
|
* the server for authority.
|
|
@@ -15,6 +15,8 @@ export async function startGridMod(options) {
|
|
|
15
15
|
const box = scope.bounds;
|
|
16
16
|
if (spec.kind === 'wasm') {
|
|
17
17
|
const broker = new PlayerCodeBroker({
|
|
18
|
+
engine: spec.engine,
|
|
19
|
+
consentedHostCalls: spec.consentedHostCalls,
|
|
18
20
|
workerUrl: spec.workerUrl,
|
|
19
21
|
grid: { low: box.low, high: box.high, gridId: scope.gridId },
|
|
20
22
|
moduleName: spec.moduleName,
|
|
@@ -25,9 +27,10 @@ export async function startGridMod(options) {
|
|
|
25
27
|
scope,
|
|
26
28
|
client: options.client,
|
|
27
29
|
local: options.local,
|
|
28
|
-
|
|
30
|
+
...(options.userId !== undefined ? { userId: options.userId } : {}),
|
|
29
31
|
}),
|
|
30
32
|
onPresentation: options.onPresentation,
|
|
33
|
+
onLog: options.onLog,
|
|
31
34
|
onCircuitOpen: (reason) => options.onStopped?.(reason),
|
|
32
35
|
});
|
|
33
36
|
await broker.start(spec.artifact);
|
|
@@ -35,6 +38,7 @@ export async function startGridMod(options) {
|
|
|
35
38
|
kind: 'wasm',
|
|
36
39
|
moduleName: spec.moduleName,
|
|
37
40
|
stop: () => broker.stop(),
|
|
41
|
+
invoke: (payload, invokeOptions) => broker.invoke(payload, invokeOptions),
|
|
38
42
|
};
|
|
39
43
|
}
|
|
40
44
|
if (!options.graphqlUrl || !options.graphqlWsUrl) {
|
package/dist/grid-scope.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { GridsAPI, GridChannel, GridToken } from './domains/grids.js';
|
|
2
|
-
import type { GameModelAPI } from './domains/gameModel.js';
|
|
3
|
-
import type { PlayerModelAPI } from './domains/playerModel.js';
|
|
4
|
-
import type { PlayerComputeAPI } from './domains/playerCompute.js';
|
|
5
2
|
import type { ChannelsAPI } from './domains/channels.js';
|
|
6
3
|
import type { UdpAPI } from './domains/udp.js';
|
|
7
|
-
import type { MarketplaceAPI } from './domains/marketplace.js';
|
|
8
|
-
import type { GameModelCreateSessionMutationVariables, PlayerComputeDeployMutationVariables, PlayerModelCreateContainerMutationVariables, PlayerModelSetPropertyMutationVariables } from './generated/graphql.js';
|
|
9
4
|
/** A chunk address as CrowdyJS passes it on the wire (decimal strings). */
|
|
10
5
|
export interface GridChunk {
|
|
11
6
|
x: string | number | bigint;
|
|
@@ -27,12 +22,8 @@ export interface GridBox {
|
|
|
27
22
|
/** The domain clients a GridScope binds (a CrowdyClient satisfies this). */
|
|
28
23
|
export interface GridScopeClients {
|
|
29
24
|
grids: GridsAPI;
|
|
30
|
-
gameModel: GameModelAPI;
|
|
31
|
-
playerModel: PlayerModelAPI;
|
|
32
|
-
playerCompute: PlayerComputeAPI;
|
|
33
25
|
channels: ChannelsAPI;
|
|
34
26
|
udp: UdpAPI;
|
|
35
|
-
marketplace: MarketplaceAPI;
|
|
36
27
|
}
|
|
37
28
|
/** Thrown locally, before any request, when a call would leave the grid. */
|
|
38
29
|
export declare class GridScopeError extends Error {
|
|
@@ -102,185 +93,6 @@ export declare class GridScope {
|
|
|
102
93
|
leave: (channelId: string) => Promise<boolean>;
|
|
103
94
|
send: (channelId: string, uuid: string, payloadBase64: string) => Promise<boolean>;
|
|
104
95
|
};
|
|
105
|
-
/** Sessions hosted inside this grid (games within the game). */
|
|
106
|
-
readonly sessions: {
|
|
107
|
-
list: (options?: {
|
|
108
|
-
status?: string;
|
|
109
|
-
limit?: number;
|
|
110
|
-
}) => Promise<{
|
|
111
|
-
__typename?: "GmSession";
|
|
112
|
-
sessionId: string;
|
|
113
|
-
appId: string;
|
|
114
|
-
name: string | null;
|
|
115
|
-
status: string;
|
|
116
|
-
createdByUserId: string | null;
|
|
117
|
-
currentTurnUserId: string | null;
|
|
118
|
-
metadataJson: string;
|
|
119
|
-
admission: string;
|
|
120
|
-
maxParticipants: number | null;
|
|
121
|
-
participantCount: number;
|
|
122
|
-
hostUserId: string | null;
|
|
123
|
-
hostTerm: number;
|
|
124
|
-
revision: string;
|
|
125
|
-
endedAt: string | null;
|
|
126
|
-
endReason: string | null;
|
|
127
|
-
createdAt: string;
|
|
128
|
-
presence: string;
|
|
129
|
-
gridId: string | null;
|
|
130
|
-
seededContainerCount: number | null;
|
|
131
|
-
}[]>;
|
|
132
|
-
create: (input?: Omit<GameModelCreateSessionMutationVariables["input"], "appId" | "gridId">) => Promise<{
|
|
133
|
-
__typename?: "GmSession";
|
|
134
|
-
sessionId: string;
|
|
135
|
-
appId: string;
|
|
136
|
-
name: string | null;
|
|
137
|
-
status: string;
|
|
138
|
-
createdByUserId: string | null;
|
|
139
|
-
currentTurnUserId: string | null;
|
|
140
|
-
metadataJson: string;
|
|
141
|
-
admission: string;
|
|
142
|
-
maxParticipants: number | null;
|
|
143
|
-
participantCount: number;
|
|
144
|
-
hostUserId: string | null;
|
|
145
|
-
hostTerm: number;
|
|
146
|
-
revision: string;
|
|
147
|
-
endedAt: string | null;
|
|
148
|
-
endReason: string | null;
|
|
149
|
-
createdAt: string;
|
|
150
|
-
presence: string;
|
|
151
|
-
gridId: string | null;
|
|
152
|
-
seededContainerCount: number | null;
|
|
153
|
-
}>;
|
|
154
|
-
join: (sessionId: string, options?: {
|
|
155
|
-
role?: string;
|
|
156
|
-
actorUuid?: string;
|
|
157
|
-
}) => Promise<{
|
|
158
|
-
__typename?: "GmSessionParticipant";
|
|
159
|
-
sessionId: string;
|
|
160
|
-
userId: string;
|
|
161
|
-
role: string;
|
|
162
|
-
state: string;
|
|
163
|
-
incarnation: number;
|
|
164
|
-
actorUuid: string | null;
|
|
165
|
-
joinedAt: string;
|
|
166
|
-
leftAt: string | null;
|
|
167
|
-
leftReason: string | null;
|
|
168
|
-
}>;
|
|
169
|
-
leave: (sessionId: string, incarnation: number) => Promise<{
|
|
170
|
-
__typename?: "GmSessionParticipant";
|
|
171
|
-
sessionId: string;
|
|
172
|
-
userId: string;
|
|
173
|
-
role: string;
|
|
174
|
-
state: string;
|
|
175
|
-
incarnation: number;
|
|
176
|
-
actorUuid: string | null;
|
|
177
|
-
joinedAt: string;
|
|
178
|
-
leftAt: string | null;
|
|
179
|
-
leftReason: string | null;
|
|
180
|
-
}>;
|
|
181
|
-
};
|
|
182
|
-
/** The player-tier Game Model of this grid. */
|
|
183
|
-
readonly model: {
|
|
184
|
-
containers: () => Promise<{
|
|
185
|
-
__typename?: "PlayerModelContainer";
|
|
186
|
-
containerId: string;
|
|
187
|
-
appId: string;
|
|
188
|
-
gridId: string;
|
|
189
|
-
ownerUserId: string;
|
|
190
|
-
typeKey: string;
|
|
191
|
-
displayName: string | null;
|
|
192
|
-
stateJson: string;
|
|
193
|
-
propertiesJson: string;
|
|
194
|
-
createdAt: string;
|
|
195
|
-
updatedAt: string;
|
|
196
|
-
}[]>;
|
|
197
|
-
container: (containerId: string) => Promise<{
|
|
198
|
-
__typename?: "PlayerModelContainer";
|
|
199
|
-
containerId: string;
|
|
200
|
-
appId: string;
|
|
201
|
-
gridId: string;
|
|
202
|
-
ownerUserId: string;
|
|
203
|
-
typeKey: string;
|
|
204
|
-
displayName: string | null;
|
|
205
|
-
stateJson: string;
|
|
206
|
-
propertiesJson: string;
|
|
207
|
-
createdAt: string;
|
|
208
|
-
updatedAt: string;
|
|
209
|
-
} | null>;
|
|
210
|
-
create: (input: Omit<PlayerModelCreateContainerMutationVariables["input"], "appId" | "gridId">) => Promise<{
|
|
211
|
-
__typename?: "PlayerModelContainer";
|
|
212
|
-
containerId: string;
|
|
213
|
-
appId: string;
|
|
214
|
-
gridId: string;
|
|
215
|
-
ownerUserId: string;
|
|
216
|
-
typeKey: string;
|
|
217
|
-
displayName: string | null;
|
|
218
|
-
stateJson: string;
|
|
219
|
-
propertiesJson: string;
|
|
220
|
-
createdAt: string;
|
|
221
|
-
updatedAt: string;
|
|
222
|
-
}>;
|
|
223
|
-
set: (input: Omit<PlayerModelSetPropertyMutationVariables["input"], "appId" | "gridId">) => Promise<{
|
|
224
|
-
__typename?: "PlayerModelContainer";
|
|
225
|
-
containerId: string;
|
|
226
|
-
appId: string;
|
|
227
|
-
gridId: string;
|
|
228
|
-
ownerUserId: string;
|
|
229
|
-
typeKey: string;
|
|
230
|
-
displayName: string | null;
|
|
231
|
-
stateJson: string;
|
|
232
|
-
propertiesJson: string;
|
|
233
|
-
createdAt: string;
|
|
234
|
-
updatedAt: string;
|
|
235
|
-
}>;
|
|
236
|
-
delete: (containerId: string) => Promise<boolean>;
|
|
237
|
-
};
|
|
238
|
-
/** Player compute on this grid (SERVER/CLIENT modules). */
|
|
239
|
-
readonly compute: {
|
|
240
|
-
deploy: (input: Omit<PlayerComputeDeployMutationVariables["input"], "appId" | "gridId">) => Promise<{
|
|
241
|
-
__typename?: "PlayerWasmModuleVersion";
|
|
242
|
-
versionId: string;
|
|
243
|
-
moduleId: string;
|
|
244
|
-
versionNo: number;
|
|
245
|
-
target: import("./index.js").PlayerComputeTarget;
|
|
246
|
-
sourceFilesJson: string | null;
|
|
247
|
-
openSource: boolean;
|
|
248
|
-
compileStatus: string;
|
|
249
|
-
compileLog: string | null;
|
|
250
|
-
compiledSizeBytes: string | null;
|
|
251
|
-
projectId: string | null;
|
|
252
|
-
sourceRevision: string | null;
|
|
253
|
-
githubCommitSha: string | null;
|
|
254
|
-
createdAt: string;
|
|
255
|
-
}>;
|
|
256
|
-
invoke: (moduleName: string, exportName: string, params?: unknown) => Promise<{
|
|
257
|
-
__typename?: "PlayerComputeInvokeResult";
|
|
258
|
-
resultBase64: string;
|
|
259
|
-
resultJson: string | null;
|
|
260
|
-
fuelUsed: string;
|
|
261
|
-
durationUs: number;
|
|
262
|
-
}>;
|
|
263
|
-
clientMods: () => Promise<{
|
|
264
|
-
__typename?: "GridClientMod";
|
|
265
|
-
attachmentId: string;
|
|
266
|
-
listingId: string | null;
|
|
267
|
-
listingName: string;
|
|
268
|
-
versionId: string | null;
|
|
269
|
-
sourceKind: string;
|
|
270
|
-
authorKind: import("./generated/graphql.js").PlayerCodeOwnerKind;
|
|
271
|
-
authorRef: string;
|
|
272
|
-
serverVersionId: string | null;
|
|
273
|
-
clientVersionId: string | null;
|
|
274
|
-
clientArtifactHash: string;
|
|
275
|
-
gridId: string;
|
|
276
|
-
capabilitySummaryJson: string;
|
|
277
|
-
capabilityHash: string;
|
|
278
|
-
authorCapabilitySummaryJson: string;
|
|
279
|
-
authorCapabilityHash: string;
|
|
280
|
-
callerConsented: boolean;
|
|
281
|
-
callerTrustsAuthor: boolean;
|
|
282
|
-
}[]>;
|
|
283
|
-
};
|
|
284
96
|
/**
|
|
285
97
|
* Replication that ORIGINATES in the grid. Each send checks its chunk
|
|
286
98
|
* locally, then goes out as the ordinary udp call; reach still follows
|
package/dist/grid-scope.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-scope.d.ts","sourceRoot":"","sources":["../src/grid-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"grid-scope.d.ts","sourceRoot":"","sources":["../src/grid-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,2EAA2E;AAC3E,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC5B,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC5B,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,OAAO;IACtB,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;CAC3C;AAED,4EAA4E;AAC5E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,QAAQ,CAAC;IAChB,QAAQ,EAAE,WAAW,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,4EAA4E;AAC5E,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;;GASG;AACH,qBAAa,SAAS;IAIlB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM;IALzB,OAAO,CAAC,GAAG,CAAiB;gBAGT,OAAO,EAAE,gBAAgB,EACjC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACvB,GAAG,CAAC,EAAE,OAAO;IAKf,uEAAuE;IACvE,IAAI,MAAM,IAAI,OAAO,GAAG,IAAI,CAE3B;IAED,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAgBnC,6EAA6E;IAC7E,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAatC,mEAAmE;IAC7D,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAqBxD,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ;oBACL,OAAO,CAAC,WAAW,EAAE,CAAC;uBAGxB,MAAM,YACH;YAAE,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAAC,cAAc,CAAC,EAAE,OAAO,CAAA;SAAE;;;;;;;;;;;;;;0BAQtE,MAAM;;;;;;;;0BAkC64+jB,CAAC;;;;;;;;2BAjCn5+jB,MAAM;0BACP,MAAM,QAAQ,MAAM,iBAAiB,MAAM;MAM7D;IAEF;;;;OAIG;IACH,QAAQ,CAAC,IAAI;6BACU,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;6BAIvD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;sBAI9D,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;6BAI/C,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;MAI5E;CACH"}
|
package/dist/grid-scope.js
CHANGED
|
@@ -37,75 +37,6 @@ export class GridScope {
|
|
|
37
37
|
payload: payloadBase64,
|
|
38
38
|
}),
|
|
39
39
|
};
|
|
40
|
-
/** Sessions hosted inside this grid (games within the game). */
|
|
41
|
-
this.sessions = {
|
|
42
|
-
list: (options = {}) => this.clients.gameModel.sessions({
|
|
43
|
-
appId: this.appId,
|
|
44
|
-
gridId: this.gridId,
|
|
45
|
-
...options,
|
|
46
|
-
}),
|
|
47
|
-
create: (input = {}) => this.clients.gameModel.createSession({
|
|
48
|
-
...input,
|
|
49
|
-
appId: this.appId,
|
|
50
|
-
gridId: this.gridId,
|
|
51
|
-
}),
|
|
52
|
-
join: (sessionId, options = {}) => this.clients.gameModel.joinSession({
|
|
53
|
-
appId: this.appId,
|
|
54
|
-
sessionId,
|
|
55
|
-
...options,
|
|
56
|
-
}),
|
|
57
|
-
leave: (sessionId, incarnation) => this.clients.gameModel.leaveSession({
|
|
58
|
-
appId: this.appId,
|
|
59
|
-
sessionId,
|
|
60
|
-
incarnation,
|
|
61
|
-
}),
|
|
62
|
-
};
|
|
63
|
-
/** The player-tier Game Model of this grid. */
|
|
64
|
-
this.model = {
|
|
65
|
-
containers: () => this.clients.playerModel.containers({
|
|
66
|
-
appId: this.appId,
|
|
67
|
-
gridId: this.gridId,
|
|
68
|
-
}),
|
|
69
|
-
container: (containerId) => this.clients.playerModel.container({
|
|
70
|
-
appId: this.appId,
|
|
71
|
-
gridId: this.gridId,
|
|
72
|
-
containerId,
|
|
73
|
-
}),
|
|
74
|
-
create: (input) => this.clients.playerModel.createContainer({
|
|
75
|
-
...input,
|
|
76
|
-
appId: this.appId,
|
|
77
|
-
gridId: this.gridId,
|
|
78
|
-
}),
|
|
79
|
-
set: (input) => this.clients.playerModel.setProperty({
|
|
80
|
-
...input,
|
|
81
|
-
appId: this.appId,
|
|
82
|
-
gridId: this.gridId,
|
|
83
|
-
}),
|
|
84
|
-
delete: (containerId) => this.clients.playerModel.deleteContainer({
|
|
85
|
-
appId: this.appId,
|
|
86
|
-
gridId: this.gridId,
|
|
87
|
-
containerId,
|
|
88
|
-
}),
|
|
89
|
-
};
|
|
90
|
-
/** Player compute on this grid (SERVER/CLIENT modules). */
|
|
91
|
-
this.compute = {
|
|
92
|
-
deploy: (input) => this.clients.playerCompute.deploy({
|
|
93
|
-
...input,
|
|
94
|
-
appId: this.appId,
|
|
95
|
-
gridId: this.gridId,
|
|
96
|
-
}),
|
|
97
|
-
invoke: (moduleName, exportName, params) => this.clients.playerCompute.invoke({
|
|
98
|
-
appId: this.appId,
|
|
99
|
-
gridId: this.gridId,
|
|
100
|
-
moduleName,
|
|
101
|
-
exportName,
|
|
102
|
-
...(params !== undefined ? { paramsJson: JSON.stringify(params) } : {}),
|
|
103
|
-
}),
|
|
104
|
-
clientMods: () => this.clients.marketplace.gridClientMods({
|
|
105
|
-
appId: this.appId,
|
|
106
|
-
gridId: this.gridId,
|
|
107
|
-
}),
|
|
108
|
-
};
|
|
109
40
|
/**
|
|
110
41
|
* Replication that ORIGINATES in the grid. Each send checks its chunk
|
|
111
42
|
* locally, then goes out as the ordinary udp call; reach still follows
|
package/dist/index.d.ts
CHANGED
|
@@ -37,17 +37,16 @@
|
|
|
37
37
|
* As of v6 the SDK wraps the **full** public API surface, namespaced
|
|
38
38
|
* by audience: the game-client surface (`auth`, `users`, `udp`, `world`,
|
|
39
39
|
* `chunks`/`voxels`/`actors`/`avatars`/`state`/`teleport`/`channels`/`teams`/
|
|
40
|
-
* `
|
|
40
|
+
* `exec`/`host`) and the privileged studio-admin surface grouped under
|
|
41
41
|
* `client.admin` (`organizations`, `appAccess`, `billing`, `payments`,
|
|
42
42
|
* `quotas`, `usage`, `sharedEnvironment`, `gameApps`; also
|
|
43
|
-
* available top-level)
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* or internal tooling, never an untrusted browser.
|
|
43
|
+
* available top-level). Admin calls still require the appropriate token +
|
|
44
|
+
* permission — the server enforces them; the SDK only provides typed
|
|
45
|
+
* wrappers. Drive admin calls from a studio backend or internal tooling,
|
|
46
|
+
* never an untrusted browser.
|
|
48
47
|
*/
|
|
49
48
|
/** The published package version. Mirrors `package.json`. */
|
|
50
|
-
export declare const VERSION = "
|
|
49
|
+
export declare const VERSION = "18.0.0-dev.1";
|
|
51
50
|
export { LbCookieStore } from './lb-cookie-store.js';
|
|
52
51
|
export { CrowdyClient, createCrowdyClient, type CrowdyClientConfig, } from './crowdy-client.js';
|
|
53
52
|
export { CROWDY_DEFAULT_TIER, CROWDY_DEFAULT_HOST, CROWDY_DEFAULT_HTTP_ORIGIN, CROWDY_DEFAULT_WS_ORIGIN, } from './default-origin.js';
|
|
@@ -59,7 +58,7 @@ export { BUNDLE_HEADER_BYTES, BUNDLE_LENGTH_PREFIX_BYTES, RELAY_MAX_BUNDLE_MEMBE
|
|
|
59
58
|
export { VIDEO_FRAGMENT_HEADER_BYTES, MAX_VIDEO_FRAGMENT_BODY_BYTES, MAX_VIDEO_FRAGMENTS, VIDEO_FRAME_TIMEOUT_MS, VIDEO_FRAGMENT_VERSION, VideoCodec, fragmentFrame, parseVideoFragmentHeader, isNewerFrameId, VideoFrameAssembler, type VideoFragmentHeader, type AssembledVideoFrame, } from './media/video-frames.js';
|
|
60
59
|
export { RealtimeMetrics, payloadBytesOf, type RealtimeMetricsCounters, type RealtimeMetricsKind, type RealtimeMetricsSnapshot, } from './metrics.js';
|
|
61
60
|
export { WorldClient, ActorClient, type ActorOptions } from './world.js';
|
|
62
|
-
export {
|
|
61
|
+
export { GameKitClient, SocialKit, EVENT_CONTACT_DAMAGE, EVENT_ABILITY, EVENT_CONTROL_POINT, EVENT_MOVEMENT_VIOLATION, EVENT_PROPOSAL, EVENT_RACE_TIMING, EVENT_ZONE_CHANGE, EVENT_SCORE, EVENT_TURN, EVENT_WEATHER, FLAG_GROUNDED, FLAG_MOB, FLAG_NPC, FLAG_RESERVED3, POSE_BYTES, decodeEnginePose, encodeEnginePose, engineLanes, enginePoseCodec, parseContactDamage, parseEngineEvent, parseAbilityEvent, parseControlPointEvent, parseMovementViolation, parseProposalEvent, parseRaceTimingEvent, parseScoreEvent, parseTurnEvent, parseWeatherEvent, parseZoneChangeEvent, poseSuffix, runOptimisticAction, type OptimisticActionOutcome, type OptimisticActionSpec, type ContactDamageEvent, type EnginePose, type GameKitDomains, type GameKitOptions, type KitChatMessage, type KitGroupWithChannel, type SocialKitOptions, type AbilityEvent, type ControlPointEvent, type MovementViolationEvent, type ProposalEvent, type RaceTimingEvent, type ZoneChangeEvent, type ScoreEvent, type TurnEvent, type WeatherEvent, } from './kit/index.js';
|
|
63
62
|
export type { StateCodec, Ticker, WorldSession, WorldSessionConfig, WorldStoresClient, } from './stores/index.js';
|
|
64
63
|
export { APP_UNAVAILABLE_CODE, CrowdyAppUnavailableError, CrowdyError, CrowdyGraphQLError, CrowdyHttpError, CrowdyNetworkError, CrowdyProtocolError, CrowdyRealtimeError, CrowdyTimeoutError, CrowdyUserCodeFaultError, playerFaultOf, WRONG_DATACENTER_CODE, } from './errors.js';
|
|
65
64
|
export type { CrowdyFaultBlame, CrowdyFaultCode, CrowdyPlayerFault, } from './errors.js';
|
|
@@ -83,7 +82,6 @@ export { PaymentsAPI } from './domains/payments.js';
|
|
|
83
82
|
export { QuotasAPI } from './domains/quotas.js';
|
|
84
83
|
export { UsageAPI } from './domains/usage.js';
|
|
85
84
|
export { SharedEnvironmentAPI } from './domains/sharedEnvironment.js';
|
|
86
|
-
export { ControlPlaneAPI } from './domains/controlPlane.js';
|
|
87
85
|
export { AdminAPI } from './domains/admin.js';
|
|
88
86
|
export { AvatarsAPI } from './domains/avatars.js';
|
|
89
87
|
export { HostAPI } from './domains/host.js';
|
|
@@ -97,28 +95,24 @@ export { ServerStatusAPI } from './domains/serverStatus.js';
|
|
|
97
95
|
export { ChannelsAPI } from './domains/channels.js';
|
|
98
96
|
export { TeamsAPI } from './domains/teams.js';
|
|
99
97
|
export { UdpAPI } from './domains/udp.js';
|
|
100
|
-
export {
|
|
101
|
-
export { ComputeAPI, COMPUTE_SDK_VERSION, COMPUTE_ABI_VERSION, type DeployVersionOptions, type WaitForCompileOptions, } from './domains/compute.js';
|
|
102
|
-
export { ExecAPI, ExecConnection, CrowdyExecError, EXEC_STATUSES, execStatus, encodeExecFrame, decodeExecFrame, type ExecStatus, type ExecClientFrame, type ExecServerFrame, type ExecPush, type ExecPushHandler, type ExecEndpoint, type ExecConnectOptions, type ExecWebSocketCtor, type ExecNodeTypeInput, type ExecDeployOptions, type ExecCrate, type ExecSourceFile, type ExecBuild, type ExecStarter, type ExecStarterPack, type ExecLogLine, type ExecLogsOptions, type ExecInstance, type ExecVersion, type ExecManifest, type ExecManifestType, type ExecAppStatus, type ExecEndpointStat, type ExecEndpointStatsOptions, ExecModScope, execModType, type ExecMod, type ExecModListing, type ExecModSwitch, } from './domains/exec.js';
|
|
103
|
-
export { PlayerComputeAPI } from './domains/playerCompute.js';
|
|
98
|
+
export { ExecAPI, ExecConnection, CrowdyExecError, EXEC_STATUSES, execStatus, encodeExecFrame, decodeExecFrame, type ExecStatus, type ExecClientFrame, type ExecServerFrame, type ExecPush, type ExecPushHandler, type ExecEndpoint, type ExecConnectOptions, type ExecWebSocketCtor, type ExecNodeTypeInput, type ExecDeployOptions, type ExecCrate, type ExecSourceFile, type ExecBuild, type ExecBuildArtifact, type ExecStarter, type ExecStarterPack, type ExecLogLine, type ExecLogsOptions, type ExecInstance, type ExecVersion, type ExecManifest, type ExecManifestType, type ExecAppStatus, type ExecEndpointStat, type ExecEndpointStatsOptions, ExecModScope, execModType, EXEC_CLIENT_ABI_VERSION, type ExecMod, type ExecModListing, type ExecModSwitch, type ExecClientCapabilitySummary, type ExecModClient, type ExecGridClientMod, type ExecModClientArtifact, type ExecModClientArtifactBytes, } from './domains/exec.js';
|
|
104
99
|
export { CrowdyStudioAPI } from './domains/crowdyStudio.js';
|
|
105
100
|
export { PlayerWalletAPI } from './domains/playerWallet.js';
|
|
106
101
|
export { MarketplaceAPI } from './domains/marketplace.js';
|
|
107
|
-
export {
|
|
108
|
-
export { PlayerCodeBroker, ALLOWED_HOST_CALLS, type PlayerCodeBrokerOptions, type PlayerCodeGridBounds, type PlayerCodeHostCall, type PlayerCodeWorkerLike, type PlayerCodePresentation, } from './player-runtime/player-code-broker.js';
|
|
102
|
+
export { PlayerCodeBroker, EXEC_CLIENT_HOST_CALLS, PLAYER_CODE_INVOKE_MAX_BYTES, PLAYER_CODE_LOG_LINES_PER_SECOND, PLAYER_CODE_LOG_MAX_CHARS, type PlayerCodeEngine, type PlayerCodeBrokerOptions, type PlayerCodeGridBounds, type PlayerCodeHostCall, type PlayerCodeLogLevel, type PlayerCodeLogLine, type PlayerCodeWorkerLike, type PlayerCodePresentation, } from './player-runtime/player-code-broker.js';
|
|
109
103
|
export { ClientGridEventBus, defaultClientGridEventBus, CLIENT_GRID_EVENT_MAX_CASCADE, type ClientGridEvent, type ClientGridEventSubscriber, } from './player-runtime/client-grid-event-bus.js';
|
|
110
104
|
export * from './grid-mods/index.js';
|
|
111
105
|
export { GridScope, GridScopeError, type GridBox, type GridChunk, type GridScopeClients, } from './grid-scope.js';
|
|
112
106
|
export { GridsAPI, type GridToken, type GridChannel } from './domains/grids.js';
|
|
113
107
|
export { GENERATED_HOST_CATALOG, type HostCatalog, type HostCatalogFunction, } from './player-runtime/host-catalog.generated.js';
|
|
114
108
|
export { GLUE_HOST_FUNCTIONS, parseFuelBudget, runWithWatchdog, GlueRuntime, startGlueWorker, type GlueInitMessage, type GlueDispatchResult, } from './player-runtime/player-glue-worker.js';
|
|
115
|
-
export { type GuestExports, type GlueRuntimeOptions, } from './player-runtime/glue-runtime.js';
|
|
109
|
+
export { EXEC_CLIENT_ABI_IMPORTS, GLUE_LOG_MAX_BYTES, type GuestExports, type GlueRuntimeOptions, } from './player-runtime/glue-runtime.js';
|
|
116
110
|
export { createGlueSab, wrapGlueSab, armGlueRequest, waitAndReadGlueReply, writeGlueResult, writeGlueReply, glueEncoder, glueDecoder, type GlueSab, } from './player-runtime/glue-sab.js';
|
|
117
111
|
export * from './crowdy-studio/index.js';
|
|
118
112
|
export { createMintRediscover, type MintCapablePortal, } from './rediscover.js';
|
|
119
113
|
export { createBootstrapRediscover, type BootstrapRediscoverOptions, } from './bootstrap-rediscover.js';
|
|
120
|
-
export type { ChunkCoordinatesInput, VoxelCoordinatesInput, ActorUpdateRequestInput, VoxelUpdateRequestInput, ClientAudioPacketInput, ClientVideoPacketInput, ClientTextPacketInput, ClientEventNotificationInput, UdpProxyConnectionStatus, RealtimeConnectionEvent, GameClientBootstrap,
|
|
114
|
+
export type { ChunkCoordinatesInput, VoxelCoordinatesInput, ActorUpdateRequestInput, VoxelUpdateRequestInput, ClientAudioPacketInput, ClientVideoPacketInput, ClientTextPacketInput, ClientEventNotificationInput, UdpProxyConnectionStatus, RealtimeConnectionEvent, GameClientBootstrap, GridOwnership, AssignGridOwnershipInput, TransferGridOwnershipInput, UpdateGamertagInput, CreateActorInput, UpdateActorInput, ActorFilterInput, BatchActorLookupInput, CreateUserAppStateInput, UpdateUserStateInput, UpdateAvatarStateInput, UpdateActorStateInput, UpdateChunkStateInput, UpdateChunkLodsInput, ChunkUpdateInput, UpdateVoxelInput, RollbackVoxelUpdatesInput, GetChunkInput, GetChunkLodsInput, GetChunksByDistanceInput, GetVoxelListInput, ListVoxelsInput, ListVoxelUpdatesByDistanceInput, TeleportRequestInput, LodDataInput, VoxelStateInput, Chunk, ChunkLodsResponse, ChunksByDistanceResponse, ChunkVoxelResponse, ChunkVoxelUpdatesResponse, Voxel, VoxelUpdatesByDistanceResponse, VoxelUpdateHistoryEvent, RollbackVoxelEventResult, Actor, Avatar, AvatarDto, TeleportResponse, UserAppState, ServerStatus, GraphQlServer, ServerVersionInfo, VersionInfo, PageInfo, UdpNotificationsSubscription, GmAppFeature, GmTierFeature, DefineAppFeatureInput, GrantTierFeatureInput, Scalars, } from './generated/graphql.js';
|
|
121
115
|
export type { CreateAppInput, UpdateAppInput, CreateOrganizationInput, CreateOrgTokenInput, UpdateOrgTokenInput, InviteOrgMemberInput, CreateOrgRoleInput, UpdateOrgRoleInput, CreateAccessTierInput, UpdateAccessTierInput, GrantAppAccessInput, CreateCheckoutInput, CheckoutFilterInput, SetQuotaInput, AppCodeAdmission, AdmitAppCodeInput, } from './generated/graphql.js';
|
|
122
|
-
export { ServerState, AppVisibility,
|
|
116
|
+
export { ServerState, AppVisibility, GridOwnerKind, GridTenure, CodeAdmissionMode, CodeAdmissionSubjectKind, } from './generated/graphql.js';
|
|
123
117
|
export { DiscoveryDomain, type AppEndpoint } from './domains/discovery.js';
|
|
124
118
|
//# sourceMappingURL=index.d.ts.map
|