@genex-ai/multiplayer 0.17.6 → 0.17.8

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.
Files changed (40) hide show
  1. package/PROTOCOL.md +101 -30
  2. package/README.md +35 -14
  3. package/WORLD-GLTF.md +109 -0
  4. package/WORLD-SCENE.md +135 -0
  5. package/dist/authority/fast-udp.d.ts +4 -2
  6. package/dist/authority/fast-udp.js +8 -46
  7. package/dist/authority/fast-webtransport.d.ts +26 -4
  8. package/dist/authority/fast-webtransport.js +12 -115
  9. package/dist/authority/index.d.ts +379 -41
  10. package/dist/authority/index.js +247 -47
  11. package/dist/authority/module.d.ts +2 -1
  12. package/dist/authority/module.js +1 -1
  13. package/dist/bridge-authority.d.ts +3 -2
  14. package/dist/bridge-authority.global.js +10 -9
  15. package/dist/bridge-authority.js +11 -6
  16. package/dist/bridge.global.js +5 -5
  17. package/dist/bridge.js +3 -3
  18. package/dist/chunk-2NGXXQDS.js +1916 -0
  19. package/dist/{chunk-ZSWF4VCN.js → chunk-CSQEEANB.js} +78 -2
  20. package/dist/{chunk-UX3F6YTV.js → chunk-FPWP22Y7.js} +1 -1
  21. package/dist/{chunk-5JGRFT2N.js → chunk-NFMGIKFZ.js} +879 -1898
  22. package/dist/{chunk-K3SF5VDS.js → chunk-OD6NRSX2.js} +3 -1
  23. package/dist/{chunk-7QVOIHJF.js → chunk-QY3QQNDJ.js} +2 -2
  24. package/dist/{chunk-Y6XHXDIK.js → chunk-QZOCUQJT.js} +820 -537
  25. package/dist/chunk-TSYEWPVO.js +44 -0
  26. package/dist/chunk-TVTVIMIH.js +675 -0
  27. package/dist/chunk-YWQ3ALYY.js +69 -0
  28. package/dist/{fast-client-CZ41v-oB.d.ts → fast-client--A88q0kk.d.ts} +85 -4
  29. package/dist/index.js +3 -3
  30. package/dist/level-build-CbRqrYJq.d.ts +140 -0
  31. package/dist/{module-DqtFb5wA.d.ts → module-CSpXrzFc.d.ts} +151 -400
  32. package/dist/{physics-predict-49udN3a1.d.ts → physics-predict-C7ZB1gDG.d.ts} +18 -3
  33. package/dist/protocol.d.ts +87 -2
  34. package/dist/protocol.js +15 -1
  35. package/dist/shot-world-D22tqOUT.d.ts +485 -0
  36. package/dist/world-fit/index.d.ts +549 -0
  37. package/dist/world-fit/index.js +4763 -0
  38. package/dist/world-fit/three.d.ts +77 -0
  39. package/dist/world-fit/three.js +140 -0
  40. package/package.json +15 -3
@@ -1,4 +1,4 @@
1
- import { aB as PhysicsLimits, T as TickHz, a as PhysicsErrorCode, aY as ResolvedPhysics, aR as PresetSpec, i as RemotePredict, k as PropSlide, f as LiftsPolicy } from './module-DqtFb5wA.js';
1
+ import { ap as PhysicsLimits, T as TickHz, a as PhysicsErrorCode, aF as ResolvedPhysics, ay as PresetSpec, f as RemotePredict, h as PropSlide, e as LiftsPolicy } from './module-CSpXrzFc.js';
2
2
 
3
3
  /** The contract version a physics room's world is created with (C§4 `WorldDesc.contract`). */
4
4
  declare const PHYSICS_CONTRACT = "1.0";
@@ -13,6 +13,21 @@ declare const PHYSICS_SCALED_LIMITS: readonly (keyof PhysicsLimits)[];
13
13
  declare const PHYSICS_REAL_LIMITS: readonly (keyof PhysicsLimits)[];
14
14
  /** A paid tier raises a limit at most to this many times its default (C§11). */
15
15
  declare const PHYSICS_CEILING_FACTOR = 4;
16
+ /** What a world past the default `staticPieces` adds to the room's `memoryBytes`, per piece: above the core's model of
17
+ * any piece (C§11.1: a box 1,568 bytes, an 8-point ramp 1,954), so the world leaves a room the bodies and contacts the
18
+ * default gives one. */
19
+ declare const PHYSICS_STATIC_PIECE_BYTES = 2048;
20
+ /** The largest world a predicting room holds (§17.11): what every shipped client's core imports. Past it the client's
21
+ * core refuses the world, so the host draws the bodies from the server for every seat rather than leave each to find out. */
22
+ declare const PHYSICS_PREDICT_MAX_BOXES = 4096;
23
+ declare const PHYSICS_PREDICT_MAX_RAMPS = 512;
24
+ /** Whether a room with this static world predicts when it asks to. */
25
+ declare const physicsWorldPredicts: (boxes: number, ramps: number) => boolean;
26
+ /** A room's limits for a static world of `pieces` solids (§17.10 *The static world*). A world the limits hold changes
27
+ * nothing: the description, and with it `physicsHash`, stay as they were. A larger one is the module's map, not a
28
+ * paid extra: `staticPieces` rises to it and `memoryBytes` by its size, up to the core's ceiling. A module that lowered
29
+ * `staticPieces` asked for less, and the core refuses its world. */
30
+ declare function physicsLimitsForWorld(limits: PhysicsLimits, pieces: number): PhysicsLimits;
16
31
  /** A room's limit ceiling as its admission grants it, with `worldExtent` and `maxSpeed` per unit
17
32
  * of `lengthUnit`, like {@link PHYSICS_DEFAULT_LIMITS}. Each limit is between its default and
18
33
  * {@link PHYSICS_CEILING_FACTOR} times it. In release 1 every room's ceiling is the default. */
@@ -129,7 +144,7 @@ interface PhysicsWorldDesc {
129
144
  }
130
145
  /** The world a room with `physics` at `tickHz` creates; a predicting room's solver iterations follow
131
146
  * the stacking hook ({@link solverIterationsOf}). */
132
- declare function physicsWorldDesc(physics: ResolvedPhysics, tickHz: TickHz, predicting?: boolean): PhysicsWorldDesc;
147
+ declare function physicsWorldDesc(physics: ResolvedPhysics, tickHz: TickHz, predicting?: boolean, worldPieces?: number): PhysicsWorldDesc;
133
148
  /** `physEv`'s kind codes. */
134
149
  declare const PhysEvKind: {
135
150
  readonly CONTACT_BEGIN: 0;
@@ -1205,4 +1220,4 @@ declare function selfTestPredictCore(core: PredictCore): boolean;
1205
1220
  * does not, load the core with its non-SIMD module (`init({ module })`): the same stateHashes. */
1206
1221
  declare function wasmSimdSupported(): boolean;
1207
1222
 
1208
- export { PHYSICS_PRESET_LENGTH_UNITS as $, type AuthorityContactRule as A, BODY_CORRECTION_TAU_MS as B, type ContactBody as C, type DrawClock as D, type KeyframeSeat as E, PHYSICS_BODY_FIELDS as F, PHYSICS_CEILING_FACTOR as G, HOST_BODY_FIELDS as H, ISLAND_MARGIN_METRES as I, PHYSICS_CONTESTED_METRES as J, type KeyframeBody as K, PHYSICS_CONTRACT as L, PHYSICS_DEFAULT_CEILING as M, PHYSICS_DEFAULT_LIMITS as N, type OwnPoseOf as O, type PhysicsCeiling as P, PHYSICS_DEFAULT_PATCH_HZ as Q, type RemoteInput as R, PHYSICS_FULL_RATE_BODIES as S, PHYSICS_KEY_MAX_BYTES as T, PHYSICS_KIND_MAX_BYTES as U, PHYSICS_LIMIT_NAMES as V, PHYSICS_OVERLAP_MAX_KEYS as W, PHYSICS_PATCH_HZ as X, PHYSICS_PREDICT_MAX_ANGULAR as Y, PHYSICS_PREDICT_MAX_LINEAR as Z, PHYSICS_PREDICT_MIN_ITERATIONS as _, type PhysEvRow as a, correctionTauMs as a$, PHYSICS_REAL_LIMITS as a0, PHYSICS_ROTATING_BODIES as a1, PHYSICS_SCALED_LIMITS as a2, PHYSICS_SHAPES_MAX as a3, PHYSICS_SHAPE_MAX_CHARS as a4, PHYSICS_STATIC_PREFIX as a5, PHYSICS_SUBSTEPS as a6, PHYS_BUDGET_CALM_SHARE as a7, PHYS_BUDGET_MIN_SAMPLES as a8, PHYS_BUDGET_P90_FACTOR as a9, PredictSmoothing as aA, type PredictWorld as aB, type PredictorOptions as aC, type PresetBodyShape as aD, type QuantizedRange as aE, RULED_SLEW as aF, RULED_SNAP_TICKS as aG, type RemoteStep as aH, type RuleSeat as aI, type RuleTick as aJ, type RuleVelocity as aK, SEAT_LIFT_MAX as aL, SEAT_PAIR_EASE as aM, SEAT_ROUND_RATE as aN, SHAPE_REF_KINDS as aO, SeatContacts as aP, type SeatSide as aQ, WIRE_REST_MAX as aR, WIRE_ROW_STRIDE as aS, type WireBodyState as aT, type WireFields as aU, bodyRadiusOf as aV, bodyStateOf as aW, checkResolvedPhysics as aX, clampedVelocity as aY, correctionAt as aZ, correctionShare as a_, PHYS_BUDGET_WINDOW as aa, PHYS_CANARY_MAX_MISMATCH as ab, PHYS_CANARY_MIN_SAMPLES as ac, PHYS_CANARY_WINDOW as ad, PHYS_CPU_CALM_PROBES as ae, PHYS_CPU_PROBE_MS as af, PHYS_PREDICT_HASHES_KEPT as ag, PHYS_PREDICT_SET_SIZES as ah, PHYS_RESIM_BUDGET_MS as ai, type PairPush as aj, type PhysDesc as ak, type PhysDescPredict as al, type PhysEvContactBegin as am, PhysEvKind as an, type PhysEvOther as ao, type PhysHitRow as ap, type PhysOverlapRow as aq, type PhysicsBodyField as ar, PhysicsConfigRange as as, PhysicsPredictRange as at, PhysicsPredictor as au, type PhysicsResolution as av, type PhysicsWorldDesc as aw, type PredictKeyframe as ax, type PredictLifts as ay, type PredictResult as az, type PhysAnswerRow as b, decayedInput as b0, dequantizeBodyValue as b1, drawBody as b2, effectivePatchHz as b3, extrapolateBody as b4, extrapolationSeconds as b5, inlineShapes as b6, innerDtOf as b7, isPhysicsKey as b8, isPhysicsKind as b9, separateSeats as bA, slerpFromIdentity as bB, snapMetresOf as bC, solverIterationsOf as bD, wasmSimdSupported as bE, wireFieldsOf as bF, wireRowOfExport as bG, wireRowOfState as bH, writeWireRow as bI, isPhysicsPatchHz as ba, keyframeTicks as bb, liftOff as bc, motorText as bd, nextPredictSetSize as be, parsePhysDesc as bf, physDescText as bg, physicsBudgetMs as bh, physicsCeilingValid as bi, physicsLimitsAt as bj, physicsWorldDesc as bk, proximityIslands as bl, quantizeBodyValue as bm, quatMul as bn, quatNormalize as bo, receiveBodyState as bp, remoteInputWeight as bq, resolvePhysicsConfig as br, restStepsOf as bs, ruledPoseAt as bt, sameBodyState as bu, seatPairKey as bv, seatRuleTick as bw, selfTestPredictCore as bx, separateAround as by, separateDrawn as bz, type PhysBodyRow as c, PredictStatus as d, type AuthoritySeatRule as e, type PredictCore as f, type PredictBodyRule as g, type PredictKinematicRule as h, type AdoptReport as i, BODY_EXTRAPOLATE_BACK_TICKS as j, BODY_EXTRAPOLATE_MAX_MS as k, BODY_SNAP_METRES as l, type BodyDrawing as m, type BodyFields as n, type BodyPose as o, BodyQuantization as p, BodySnap as q, type BodyState as r, CONTACT_FIELDS as s, type ContactField as t, DrawHandoff as u, type DrawQuat as v, type DrawVec3 as w, type IslandBody as x, type KeyframeJoint as y, type KeyframeOutside as z };
1223
+ export { PHYSICS_PREDICT_MAX_RAMPS as $, type AuthorityContactRule as A, BODY_CORRECTION_TAU_MS as B, type ContactBody as C, type DrawClock as D, type KeyframeSeat as E, PHYSICS_BODY_FIELDS as F, PHYSICS_CEILING_FACTOR as G, HOST_BODY_FIELDS as H, ISLAND_MARGIN_METRES as I, PHYSICS_CONTESTED_METRES as J, type KeyframeBody as K, PHYSICS_CONTRACT as L, PHYSICS_DEFAULT_CEILING as M, PHYSICS_DEFAULT_LIMITS as N, type OwnPoseOf as O, type PhysicsCeiling as P, PHYSICS_DEFAULT_PATCH_HZ as Q, type RemoteInput as R, PHYSICS_FULL_RATE_BODIES as S, PHYSICS_KEY_MAX_BYTES as T, PHYSICS_KIND_MAX_BYTES as U, PHYSICS_LIMIT_NAMES as V, PHYSICS_OVERLAP_MAX_KEYS as W, PHYSICS_PATCH_HZ as X, PHYSICS_PREDICT_MAX_ANGULAR as Y, PHYSICS_PREDICT_MAX_BOXES as Z, PHYSICS_PREDICT_MAX_LINEAR as _, type PhysEvRow as a, clampedVelocity as a$, PHYSICS_PREDICT_MIN_ITERATIONS as a0, PHYSICS_PRESET_LENGTH_UNITS as a1, PHYSICS_REAL_LIMITS as a2, PHYSICS_ROTATING_BODIES as a3, PHYSICS_SCALED_LIMITS as a4, PHYSICS_SHAPES_MAX as a5, PHYSICS_SHAPE_MAX_CHARS as a6, PHYSICS_STATIC_PIECE_BYTES as a7, PHYSICS_STATIC_PREFIX as a8, PHYSICS_SUBSTEPS as a9, type PredictKeyframe as aA, type PredictLifts as aB, type PredictResult as aC, PredictSmoothing as aD, type PredictWorld as aE, type PredictorOptions as aF, type PresetBodyShape as aG, type QuantizedRange as aH, RULED_SLEW as aI, RULED_SNAP_TICKS as aJ, type RemoteStep as aK, type RuleSeat as aL, type RuleTick as aM, type RuleVelocity as aN, SEAT_LIFT_MAX as aO, SEAT_PAIR_EASE as aP, SEAT_ROUND_RATE as aQ, SHAPE_REF_KINDS as aR, SeatContacts as aS, type SeatSide as aT, WIRE_REST_MAX as aU, WIRE_ROW_STRIDE as aV, type WireBodyState as aW, type WireFields as aX, bodyRadiusOf as aY, bodyStateOf as aZ, checkResolvedPhysics as a_, PHYS_BUDGET_CALM_SHARE as aa, PHYS_BUDGET_MIN_SAMPLES as ab, PHYS_BUDGET_P90_FACTOR as ac, PHYS_BUDGET_WINDOW as ad, PHYS_CANARY_MAX_MISMATCH as ae, PHYS_CANARY_MIN_SAMPLES as af, PHYS_CANARY_WINDOW as ag, PHYS_CPU_CALM_PROBES as ah, PHYS_CPU_PROBE_MS as ai, PHYS_PREDICT_HASHES_KEPT as aj, PHYS_PREDICT_SET_SIZES as ak, PHYS_RESIM_BUDGET_MS as al, type PairPush as am, type PhysDesc as an, type PhysDescPredict as ao, type PhysEvContactBegin as ap, PhysEvKind as aq, type PhysEvOther as ar, type PhysHitRow as as, type PhysOverlapRow as at, type PhysicsBodyField as au, PhysicsConfigRange as av, PhysicsPredictRange as aw, PhysicsPredictor as ax, type PhysicsResolution as ay, type PhysicsWorldDesc as az, type PhysAnswerRow as b, correctionAt as b0, correctionShare as b1, correctionTauMs as b2, decayedInput as b3, dequantizeBodyValue as b4, drawBody as b5, effectivePatchHz as b6, extrapolateBody as b7, extrapolationSeconds as b8, inlineShapes as b9, seatPairKey as bA, seatRuleTick as bB, selfTestPredictCore as bC, separateAround as bD, separateDrawn as bE, separateSeats as bF, slerpFromIdentity as bG, snapMetresOf as bH, solverIterationsOf as bI, wasmSimdSupported as bJ, wireFieldsOf as bK, wireRowOfExport as bL, wireRowOfState as bM, writeWireRow as bN, innerDtOf as ba, isPhysicsKey as bb, isPhysicsKind as bc, isPhysicsPatchHz as bd, keyframeTicks as be, liftOff as bf, motorText as bg, nextPredictSetSize as bh, parsePhysDesc as bi, physDescText as bj, physicsBudgetMs as bk, physicsCeilingValid as bl, physicsLimitsAt as bm, physicsLimitsForWorld as bn, physicsWorldDesc as bo, physicsWorldPredicts as bp, proximityIslands as bq, quantizeBodyValue as br, quatMul as bs, quatNormalize as bt, receiveBodyState as bu, remoteInputWeight as bv, resolvePhysicsConfig as bw, restStepsOf as bx, ruledPoseAt as by, sameBodyState as bz, type PhysBodyRow as c, PredictStatus as d, type AuthoritySeatRule as e, type PredictCore as f, type PredictBodyRule as g, type PredictKinematicRule as h, type AdoptReport as i, BODY_EXTRAPOLATE_BACK_TICKS as j, BODY_EXTRAPOLATE_MAX_MS as k, BODY_SNAP_METRES as l, type BodyDrawing as m, type BodyFields as n, type BodyPose as o, BodyQuantization as p, BodySnap as q, type BodyState as r, CONTACT_FIELDS as s, type ContactField as t, DrawHandoff as u, type DrawQuat as v, type DrawVec3 as w, type IslandBody as x, type KeyframeJoint as y, type KeyframeOutside as z };
@@ -53,7 +53,30 @@ declare const AuthorityJoinOption: {
53
53
  * most {@link AuthorityCaps.MAX_CAP_CHARS} characters; absent = []. Any other value is refused
54
54
  * with 400 by every authority room. */
55
55
  readonly CAPS: "caps";
56
+ /** The client's SDK and version, `<sdk>/<version>` (§17.1): counted so a protocol bump can see whom it would
57
+ * strand. Telemetry only: anything malformed is counted as unknown, never refused. */
58
+ readonly SDK: "sdk";
59
+ /** The pool this join asks for (§17.2 *Choosing a room*): rooms are found by it beside the game and
60
+ * the region. Absent or empty = the game's one pool, as a client that names no room has always had.
61
+ * Malformed (authority/room-key.ts `matchKeyOf`) is refused with 400. */
62
+ readonly MATCH_KEY: "matchKey";
63
+ /** `true` on a `create` makes a private room: no matchmaking reaches it, only its code. Any other
64
+ * type is refused with 400. */
65
+ readonly PRIVATE: "private";
66
+ /** The room this seat lost (§17.13 *Drain and rejoin*): a room code. Rooms are found by it too, so a
67
+ * lost room's seats meet in one successor, which alone reads the room's hand-off. Absent or empty =
68
+ * no successor. Malformed is refused with 400. */
69
+ readonly SUCCESSOR_OF: "successorOf";
70
+ /** `true` keeps a successor closed to the game's pool: the lost room was private. Any other type is
71
+ * refused with 400. */
72
+ readonly SUCCESSOR_CLOSED: "successorClosed";
56
73
  };
74
+ /** `server:restart` on an authority room (§17.13): the room closes with 4001 this long after it. */
75
+ interface AuthorityDrainNotice {
76
+ drainMs: number;
77
+ }
78
+ /** The SDK label this TypeScript client sends. tests hold it to package.json. */
79
+ declare const AUTHORITY_SDK_LABEL = "ts/0.17.8";
57
80
  /** Client capabilities (§17.10 *Joining*). */
58
81
  declare const AuthorityCaps: {
59
82
  /** Decodes and draws §17.10's physics bodies. A physics room refuses a join without it (426). An
@@ -85,6 +108,10 @@ declare const AuthorityCaps: {
85
108
  * beside `tick@1`. An SDK sends it only once it passes `fast-transport.json` and its transport
86
109
  * tests; a room that does not offer the channel ignores it. */
87
110
  readonly FAST: "fast@1";
111
+ /** The seat can come back to the fast channel after a fallback (§17.12 *Return to the channel*): it asks
112
+ * for a fresh binding, proves the path and swaps. Sent beside `fast@1`; a host that does not know it
113
+ * ignores it, and a client asks only a host whose binding says `rev` 2. */
114
+ readonly FAST_RETURN: "fast-return@1";
88
115
  readonly MAX_CAPS: 16;
89
116
  readonly MAX_CAP_CHARS: 32;
90
117
  };
@@ -126,7 +153,7 @@ declare const SERVER_OWNED_JOIN_OPTIONS: readonly ["clients", "preset", "winCond
126
153
  /** The authority room's server-owned options (§17.2): the relay's plus what the authority server
127
154
  * stamps from the admission it got for the room and the region the join entered through (§17.1). A separate list on purpose — adding these names to
128
155
  * {@link SERVER_OWNED_JOIN_OPTIONS} would start refusing protocol-3 joins that send them today. */
129
- declare const AUTHORITY_SERVER_OWNED_JOIN_OPTIONS: readonly ["clients", "preset", "winCondition", "config", "matchmade", "moduleSha", "tickHz", "maxPlayers", "lagComp", "seed", "units", "leaseId", "region"];
156
+ declare const AUTHORITY_SERVER_OWNED_JOIN_OPTIONS: readonly ["clients", "preset", "winCondition", "config", "matchmade", "moduleSha", "tickHz", "maxPlayers", "lagComp", "seed", "units", "leaseId", "region", "createdBy"];
130
157
  /** Join refusal codes (the matchmaking error's `code`; the message names the reason). */
131
158
  declare const JoinError: {
132
159
  /** A server-owned option was sent. */
@@ -135,6 +162,9 @@ declare const JoinError: {
135
162
  readonly AUTH_REQUIRED: 401;
136
163
  /** Token for another game ('wrong game'), or the room's guest cap is full. */
137
164
  readonly FORBIDDEN: 403;
165
+ /** A join by code entered through another region than the room's (§17.2 *Choosing a room*): the
166
+ * client tries its next region. */
167
+ readonly WRONG_REGION: 421;
138
168
  /** `protocol` missing or outside the room type's window ({@link RELAY_WINDOW},
139
169
  * {@link AUTHORITY_WINDOW}). Update the client. */
140
170
  readonly PROTOCOL_UNSUPPORTED: 426;
@@ -263,6 +293,22 @@ declare const GLOBAL_RATE: {
263
293
  /** Colyseus's own per-socket ceiling. Unlike the lanes this CLOSES the socket (4002); it exists
264
294
  * only to stop a raw socket hammering far past anything the lanes accept. */
265
295
  declare const MAX_MESSAGES_PER_SECOND = 1200;
296
+ /** The same ceiling on an authority room's socket (§17.6 *The socket ceiling*): twenty seconds of inputs
297
+ * at the top tick rate, so a seat whose TCP stalled that long and then hands its whole backlog over in
298
+ * a second is not closed for it. A seat costs the worker's event loop about 5 µs a frame: 1% of a core
299
+ * at the ceiling, and it may not exceed it. */
300
+ declare const AUTHORITY_MAX_MESSAGES_PER_SECOND = 2400;
301
+ /** The largest frame an authority node reads (a bigger one closes the socket): a client sends an input
302
+ * frame (under 100 bytes) and `__fast:off` and nothing else, and no room type there takes a shared value. */
303
+ declare const AUTHORITY_MAX_FRAME_BYTES: number;
304
+ /** Why a seat, not its room, was closed: the reason text of its close frame. */
305
+ declare const SeatCloseReason: {
306
+ /** Its socket passed {@link AUTHORITY_MAX_MESSAGES_PER_SECOND} (4002). */
307
+ readonly MessageFlood: "message_flood";
308
+ /** Its input had not changed for the room's idle limit (4408). */
309
+ readonly SeatIdle: "seat_idle";
310
+ };
311
+ type SeatCloseReason = (typeof SeatCloseReason)[keyof typeof SeatCloseReason];
266
312
  /** The lane each relay-handled client message spends. Game events and anything unhandled: bulk. */
267
313
  declare const MESSAGE_LANE: Readonly<Record<ClientMessageType, RateLane>>;
268
314
  /** WebSocket close codes a client can observe. Terminal = the seat is gone; do not reconnect. */
@@ -286,11 +332,50 @@ declare const CloseCode: {
286
332
  readonly REVOKED: 4401;
287
333
  /** A newer session of the same player took the seat (second tab, or the page reloaded). */
288
334
  readonly SUPERSEDED: 4409;
335
+ /** Authority rooms: the seat's input had not changed for the room's idle limit (§17.6 *Room lifetime*). */
336
+ readonly IDLE: 4408;
289
337
  /** The operator or the platform halted the room (kill switch, takedown, disabled game). */
290
338
  readonly MODULE_HALTED: 4500;
291
339
  /** The game's room module broke its limits or threw; the room is gone. */
292
340
  readonly MODULE_FAULT: 4501;
293
341
  };
342
+ /** Why an authority room's module was stopped. These are abuse and defect kills, distinct from billing: a quota
343
+ * never closes a live room. The host's reason for an end, and the reason text of the close frame every seat gets
344
+ * (§17.6), for the game's creator to read. */
345
+ declare const AuthorityCloseCode: {
346
+ /** A call ran past its hard timeout (an infinite loop, a long microtask). */
347
+ readonly ModuleTimeout: "module_timeout";
348
+ /** The module hit its memory limit, or the heap poll caught it near the limit. */
349
+ readonly ModuleMemory: "module_memory";
350
+ /** The module threw (or failed to load) too many times. */
351
+ readonly ModuleError: "module_error";
352
+ /** The module's output broke the wire limits too many times. */
353
+ readonly ModuleOutputInvalid: "module_output_invalid";
354
+ /** The module stayed under the hard timeout but over the mean CPU budget for a whole window. */
355
+ readonly ModuleBudget: "module_budget";
356
+ /** The operator or the platform stopped the room (kill switch, takedown, disabled game). */
357
+ readonly Halted: "halted";
358
+ /** isolated-vm's wall-clock backstop stopped a call while the guest's own CPU stayed under its limit: the
359
+ * host stalled (contention, a GC pause, descheduled). The guest was cut off mid-call, so it is
360
+ * never called again; the room ends, but the module is not at fault. */
361
+ readonly HostStall: "host_stall";
362
+ /** The room's physics passed the physics meter for the third strike (§17.10). */
363
+ readonly PhysicsBudget: "physics_budget";
364
+ /** The room reached its age limit (§17.6 *Room lifetime*), announced like a drain. Not a fault. */
365
+ readonly RoomAge: "room_age";
366
+ /** The room sent more than its ceiling for a whole window (§17.6 *The downlink budget*): its module writes
367
+ * too much state or too many events for its seats. Lower what it writes; no strike comes first. */
368
+ readonly ModuleBandwidth: "module_bandwidth";
369
+ /** The physics core answered `internal` (C§11.3): every physics room on that instance ends. Never
370
+ * the module's fault. */
371
+ readonly PhysicsInternal: "physics_internal";
372
+ };
373
+ type AuthorityCloseCode = (typeof AuthorityCloseCode)[keyof typeof AuthorityCloseCode];
374
+ /** A close frame's reason text as the vocabulary, or null: it comes from the network, so anything else reads as no reason.
375
+ * Nothing at the module's top level, so the relay's bridge bundle, which never closes an authority room, leaves all this out. */
376
+ declare function authorityCloseCodeOf(reason: unknown): AuthorityCloseCode | null;
377
+ /** What to tell a player when a room ends with a reason: the code is for the game's creator, and none of them is the player's to act on. */
378
+ declare const AUTHORITY_ROOM_ENDED_TEXT = "This match ended because of a problem with the game. Please try again.";
294
379
  declare const Limits: {
295
380
  readonly ROOM_MAX_CLIENTS: 64;
296
381
  readonly MAX_NAME_CHARS: 64;
@@ -551,4 +636,4 @@ declare const ClockSync: {
551
636
  readonly WARMUP_ACKS: 30;
552
637
  };
553
638
 
554
- export { AUTHORITY_ENCODER_BUFFER_BYTES, AUTHORITY_MIN_PROTOCOL_VERSION, AUTHORITY_PHYSICS_TICK_WEIGHT, AUTHORITY_PHYSICS_UNITS, AUTHORITY_PROTOCOL_VERSION, AUTHORITY_SERVER_OWNED_JOIN_OPTIONS, AUTHORITY_WINDOW, AuthorityCaps, AuthorityJoinOption, AuthorityTiming, type ChatMessage, ClientMessage, type ClientMessageType, ClientReconnection, ClockSync, CloseCode, GLOBAL_RATE, type IceConfig, type IceServer, type InputEnvelope, Interpolation, JoinError, JoinOption, Limits, MAX_MESSAGES_PER_SECOND, MESSAGE_LANE, MIN_PROTOCOL_VERSION, type MatchEnded, type ObjectControlOperation, type ObjectControlReason, type ObjectControlRequest, type ObjectControlResult, type ObjectPublish, POSE_KEYS, PROTOCOL_VERSION, type PoseKey, type PosePublish, type ProtocolWindow, RATE_LANES, RELAY_WINDOW, RESERVED_EVENT_PREFIXES, RESERVED_EVENT_TYPES, RESERVED_SHARED_PREFIX, type RateLane, RelayTiming, RoomType, SEND_TIME_KEY, SERVER_OWNED_JOIN_OPTIONS, STAGING_ROOM_PREFIX, ServerMessage, type ServerMessageType, type SharedWrite, type VoiceSignal, type VoiceSignalEnvelope, authorityPhysicsBudgetSixtieths, authorityRoomUnits, authorityTickBudgetMs, capsOf, inProtocolWindow, isReservedEventType, roomKeyFor, slugOfRoomKey };
639
+ export { AUTHORITY_ENCODER_BUFFER_BYTES, AUTHORITY_MAX_FRAME_BYTES, AUTHORITY_MAX_MESSAGES_PER_SECOND, AUTHORITY_MIN_PROTOCOL_VERSION, AUTHORITY_PHYSICS_TICK_WEIGHT, AUTHORITY_PHYSICS_UNITS, AUTHORITY_PROTOCOL_VERSION, AUTHORITY_ROOM_ENDED_TEXT, AUTHORITY_SDK_LABEL, AUTHORITY_SERVER_OWNED_JOIN_OPTIONS, AUTHORITY_WINDOW, AuthorityCaps, AuthorityCloseCode, type AuthorityDrainNotice, AuthorityJoinOption, AuthorityTiming, type ChatMessage, ClientMessage, type ClientMessageType, ClientReconnection, ClockSync, CloseCode, GLOBAL_RATE, type IceConfig, type IceServer, type InputEnvelope, Interpolation, JoinError, JoinOption, Limits, MAX_MESSAGES_PER_SECOND, MESSAGE_LANE, MIN_PROTOCOL_VERSION, type MatchEnded, type ObjectControlOperation, type ObjectControlReason, type ObjectControlRequest, type ObjectControlResult, type ObjectPublish, POSE_KEYS, PROTOCOL_VERSION, type PoseKey, type PosePublish, type ProtocolWindow, RATE_LANES, RELAY_WINDOW, RESERVED_EVENT_PREFIXES, RESERVED_EVENT_TYPES, RESERVED_SHARED_PREFIX, type RateLane, RelayTiming, RoomType, SEND_TIME_KEY, SERVER_OWNED_JOIN_OPTIONS, STAGING_ROOM_PREFIX, SeatCloseReason, ServerMessage, type ServerMessageType, type SharedWrite, type VoiceSignal, type VoiceSignalEnvelope, authorityCloseCodeOf, authorityPhysicsBudgetSixtieths, authorityRoomUnits, authorityTickBudgetMs, capsOf, inProtocolWindow, isReservedEventType, roomKeyFor, slugOfRoomKey };
package/dist/protocol.js CHANGED
@@ -1,12 +1,17 @@
1
1
  import {
2
2
  AUTHORITY_ENCODER_BUFFER_BYTES,
3
+ AUTHORITY_MAX_FRAME_BYTES,
4
+ AUTHORITY_MAX_MESSAGES_PER_SECOND,
3
5
  AUTHORITY_MIN_PROTOCOL_VERSION,
4
6
  AUTHORITY_PHYSICS_TICK_WEIGHT,
5
7
  AUTHORITY_PHYSICS_UNITS,
6
8
  AUTHORITY_PROTOCOL_VERSION,
9
+ AUTHORITY_ROOM_ENDED_TEXT,
10
+ AUTHORITY_SDK_LABEL,
7
11
  AUTHORITY_SERVER_OWNED_JOIN_OPTIONS,
8
12
  AUTHORITY_WINDOW,
9
13
  AuthorityCaps,
14
+ AuthorityCloseCode,
10
15
  AuthorityJoinOption,
11
16
  AuthorityTiming,
12
17
  ClientMessage,
@@ -33,7 +38,9 @@ import {
33
38
  SEND_TIME_KEY,
34
39
  SERVER_OWNED_JOIN_OPTIONS,
35
40
  STAGING_ROOM_PREFIX,
41
+ SeatCloseReason,
36
42
  ServerMessage,
43
+ authorityCloseCodeOf,
37
44
  authorityPhysicsBudgetSixtieths,
38
45
  authorityRoomUnits,
39
46
  authorityTickBudgetMs,
@@ -42,16 +49,21 @@ import {
42
49
  isReservedEventType,
43
50
  roomKeyFor,
44
51
  slugOfRoomKey
45
- } from "./chunk-ZSWF4VCN.js";
52
+ } from "./chunk-CSQEEANB.js";
46
53
  export {
47
54
  AUTHORITY_ENCODER_BUFFER_BYTES,
55
+ AUTHORITY_MAX_FRAME_BYTES,
56
+ AUTHORITY_MAX_MESSAGES_PER_SECOND,
48
57
  AUTHORITY_MIN_PROTOCOL_VERSION,
49
58
  AUTHORITY_PHYSICS_TICK_WEIGHT,
50
59
  AUTHORITY_PHYSICS_UNITS,
51
60
  AUTHORITY_PROTOCOL_VERSION,
61
+ AUTHORITY_ROOM_ENDED_TEXT,
62
+ AUTHORITY_SDK_LABEL,
52
63
  AUTHORITY_SERVER_OWNED_JOIN_OPTIONS,
53
64
  AUTHORITY_WINDOW,
54
65
  AuthorityCaps,
66
+ AuthorityCloseCode,
55
67
  AuthorityJoinOption,
56
68
  AuthorityTiming,
57
69
  ClientMessage,
@@ -78,7 +90,9 @@ export {
78
90
  SEND_TIME_KEY,
79
91
  SERVER_OWNED_JOIN_OPTIONS,
80
92
  STAGING_ROOM_PREFIX,
93
+ SeatCloseReason,
81
94
  ServerMessage,
95
+ authorityCloseCodeOf,
82
96
  authorityPhysicsBudgetSixtieths,
83
97
  authorityRoomUnits,
84
98
  authorityTickBudgetMs,