@series-inc/rundot-syncplay 6.0.0-rc.86 → 6.0.0-rc.87

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.
@@ -36,7 +36,7 @@ export const physicsProfileWasmMetadata = Object.freeze({
36
36
  "sourceHash": "824c704786811e1cceb6ab9d7dadcf478d249cf18e400ad77de759848b335857",
37
37
  "wasmSha256": "39ff2be1f6565d3fe3b47e9e9b092f17b2efa6136def77b726bb299cbfb41314",
38
38
  "artifact": "profile",
39
- "packageVersion": "6.0.0-rc.86",
39
+ "packageVersion": "6.0.0-rc.87",
40
40
  "compilerFlags": [
41
41
  "-std=c++20",
42
42
  "-O3",
@@ -36,7 +36,7 @@ export const physicsWasmMetadata = Object.freeze({
36
36
  "sourceHash": "231761ac40b1ac0fb667c9f18736a0e69755a90819bf054b1306195b352039b0",
37
37
  "wasmSha256": "4b309d668bb9042335394d895fb3e649ddcf965861486758a623662a215ba2a6",
38
38
  "artifact": "production",
39
- "packageVersion": "6.0.0-rc.86",
39
+ "packageVersion": "6.0.0-rc.87",
40
40
  "compilerFlags": [
41
41
  "-std=c++20",
42
42
  "-O3",
@@ -50,7 +50,7 @@ export const physics2dWasmMetadata = Object.freeze({
50
50
  "sourceHash": "c982f7b72b0494c8892d40b5fbf1a67ac94a7f20dea1f160abb888f4ccb313c0",
51
51
  "wasmSha256": "49cb90541deed40f5fff1015bb578e13ec9a793d51931c1227e3e5a11bbfa3f7",
52
52
  "artifact": "production",
53
- "packageVersion": "6.0.0-rc.86",
53
+ "packageVersion": "6.0.0-rc.87",
54
54
  "compilerFlags": [
55
55
  "-std=c++20",
56
56
  "-O3",
@@ -437,6 +437,8 @@ export interface AuthorityRoomStoredSnapshotMeta {
437
437
  readonly byteLength: number;
438
438
  }
439
439
  export interface DeterministicAuthorityRoom {
440
+ readonly generation: number;
441
+ heldSeatHumanIds(): readonly string[];
440
442
  readonly confirmedThrough: number;
441
443
  readonly playerCount: number;
442
444
  onPlayerJoin(playerId: string, options?: {
@@ -2486,6 +2486,23 @@ export function createDeterministicAuthorityRoom(transport, config) {
2486
2486
  return effectiveTick !== undefined && now >= effectiveTick;
2487
2487
  },
2488
2488
  onTick,
2489
+ get generation() {
2490
+ return generation;
2491
+ },
2492
+ heldSeatHumanIds() {
2493
+ if (seatPolicy === undefined)
2494
+ return [];
2495
+ const ids = new Set();
2496
+ for (const seat of seatControlState.seats) {
2497
+ if (seat.control.kind !== 'human'
2498
+ && seat.retainedClaim !== null
2499
+ && seat.retainedClaim.playerId !== ''
2500
+ && seat.retainedClaim.holdExpiresAtTick !== undefined) {
2501
+ ids.add(seat.retainedClaim.playerId);
2502
+ }
2503
+ }
2504
+ return [...ids].sort();
2505
+ },
2489
2506
  snapshot() {
2490
2507
  return {
2491
2508
  confirmedThrough: authority.confirmedThrough,
@@ -40,6 +40,11 @@ export interface SyncplayOccupancySnapshot {
40
40
  readonly full: boolean;
41
41
  readonly locked: boolean;
42
42
  }
43
+ export type SyncplaySettlementRejectionReason = 'run-limit' | 'history-budget';
44
+ export interface SyncplaySettlementRejection {
45
+ readonly runId: string;
46
+ readonly reason: SyncplaySettlementRejectionReason;
47
+ }
43
48
  export interface SyncplaySettlementReport {
44
49
  /**
45
50
  * Optional per-run identifier (`[A-Za-z0-9._:-]{1,64}`) used by multi-wave or
@@ -73,6 +78,7 @@ export interface SyncplayRoomTransport extends NetworkedClientTransport {
73
78
  * connected peers into `simulationHooks.settleRecipeId`.
74
79
  */
75
80
  reportSettlement(report: SyncplaySettlementReport): void;
81
+ onSettlementRejected(handler: (event: SyncplaySettlementRejection) => void): () => void;
76
82
  }
77
83
  /**
78
84
  * Join an existing deterministic room by its 6-char code and return a transport
@@ -20,6 +20,7 @@ const SESSION_MSG_TYPE = 'rdm';
20
20
  const BINARY_SESSION_MSG_TYPE = 'rdm-bin';
21
21
  const SECRET_MSG_TYPE = 'rdm-secret';
22
22
  const SETTLEMENT_MSG_TYPE = 'rdm-settle';
23
+ const SETTLEMENT_REJECTED_MSG_TYPE = 'rdm-settle-rejected';
23
24
  const RUN_ID_PATTERN = /^[A-Za-z0-9._:-]{1,64}$/;
24
25
  /** Room type the platform registers the generic deterministic room under. */
25
26
  const SYNCPLAY_ROOM_TYPE = 'deterministic';
@@ -44,6 +45,7 @@ function isPlainRecord(value) {
44
45
  */
45
46
  const MAX_EARLY_SESSION_MESSAGES = 8192;
46
47
  function toTransport(room) {
48
+ const settlementRejectionHandlers = new Set();
47
49
  const connectionHandlers = [];
48
50
  const emitConnectionEvent = (event) => {
49
51
  for (const handler of connectionHandlers)
@@ -167,6 +169,23 @@ function toTransport(room) {
167
169
  }
168
170
  earlySecretMessages.push(text);
169
171
  });
172
+ room.onRaw(SETTLEMENT_REJECTED_MSG_TYPE, (data) => {
173
+ let value = data;
174
+ if (typeof data === 'string') {
175
+ try {
176
+ value = JSON.parse(data);
177
+ }
178
+ catch {
179
+ return;
180
+ }
181
+ }
182
+ if (!isPlainRecord(value) || typeof value.runId !== 'string' || !RUN_ID_PATTERN.test(value.runId)
183
+ || (value.reason !== 'run-limit' && value.reason !== 'history-budget'))
184
+ return;
185
+ const event = Object.freeze({ runId: value.runId, reason: value.reason });
186
+ for (const handler of settlementRejectionHandlers)
187
+ handler(event);
188
+ });
170
189
  return {
171
190
  roomCode: room.roomCode,
172
191
  playerId: room.playerId,
@@ -223,6 +242,10 @@ function toTransport(room) {
223
242
  };
224
243
  },
225
244
  setSeatingOpen: (open) => room.setSeatingOpen(open),
245
+ onSettlementRejected: (handler) => {
246
+ settlementRejectionHandlers.add(handler);
247
+ return () => { settlementRejectionHandlers.delete(handler); };
248
+ },
226
249
  reportSettlement: (report) => {
227
250
  if (!isPlainRecord(report)) {
228
251
  throw new TypeError('SyncplaySettlementReport must be a plain object');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@series-inc/rundot-syncplay",
3
- "version": "6.0.0-rc.86",
3
+ "version": "6.0.0-rc.87",
4
4
  "description": "Kinetix orchestration, rollback, replay, late-join, and deterministic networking for RUN.game",
5
5
  "repository": {
6
6
  "type": "git",