@indiegems/gem-web-sdk 23.3.0 → 24.0.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/dist/sdk.d.ts CHANGED
@@ -922,6 +922,7 @@ declare class OrdersApi {
922
922
  interface GamePass {
923
923
  readonly pass: string;
924
924
  readonly held: boolean;
925
+ readonly daysLeft: number;
925
926
  readonly endsAt: string | null;
926
927
  }
927
928
  type PassesEvent = "changed";
@@ -1157,1458 +1158,1773 @@ declare class TransfersApi {
1157
1158
  cancel(transferId: string, signal?: AbortSignal): Promise<Transfer>;
1158
1159
  private resolve;
1159
1160
  }
1160
- interface GameConfig extends GameConfigSnapshot {
1161
- items: GameConfigSnapshot["items"];
1162
- currencies: GameConfigSnapshot["currencies"];
1163
- catalogs: GameConfigSnapshot["catalogs"];
1164
- loot_tables: GameConfigSnapshot["loot_tables"];
1165
- affix_pools?: GameConfigSnapshot["affix_pools"];
1166
- progressions: GameConfigSnapshot["progressions"];
1167
- game_room_templates: GameConfigSnapshot["game_room_templates"];
1168
- kv: GameConfigSnapshot["kv"];
1169
- run_types?: GameConfigSnapshot["run_types"];
1170
- leaderboards?: GameConfigSnapshot["leaderboards"];
1171
- async_opponent_types?: GameConfigSnapshot["async_opponent_types"];
1172
- analytics_events?: GameConfigSnapshot["analytics_events"];
1173
- analytics_funnels?: GameConfigSnapshot["analytics_funnels"];
1174
- "rewarded_placements"?: SnapshotRewardedPlacement[];
1175
- version: GameConfigSnapshot["version"];
1176
- hash: GameConfigSnapshot["hash"];
1177
- item(idOrSlug: string): SnapshotItem | null;
1178
- currency(idOrSlug: string): SnapshotCurrency | null;
1179
- }
1180
- declare class GemConfigError extends Error {
1181
- readonly reason: "config_unreachable" | "config_too_large" | "config_malformed" | "config_timeout" | "config_channel_unknown";
1182
- constructor(reason: "config_unreachable" | "config_too_large" | "config_malformed" | "config_timeout" | "config_channel_unknown", message: string);
1161
+ declare const PROTOCOL: "gem-web-bridge";
1162
+ type GemErrorCode = "version_mismatch" | "handshake_timeout" | "handshake_duplicate" | "invalid_message" | "rate_limited" | "token_unavailable" | "unsupported" | "unsupported_capability" | "internal";
1163
+ interface GemToken {
1164
+ readonly gem: typeof PROTOCOL;
1165
+ readonly type: "gem.token";
1166
+ readonly token: string;
1167
+ readonly requestId?: string;
1168
+ readonly generation: number;
1169
+ readonly apiBaseUrl?: string;
1170
+ readonly playerId: string;
1171
+ readonly gameId: string;
1172
+ readonly channel: "dev" | "test" | "release";
1173
+ readonly gameVersion?: string;
1174
+ readonly expiresAt: number;
1175
+ readonly chainEndsAt: number;
1176
+ readonly allowDevTools?: boolean;
1183
1177
  }
1184
- interface GameConfigOptions {
1185
- readonly fetch?: typeof globalThis.fetch;
1186
- readonly timeoutMs?: number;
1178
+ interface GemTokenDenied {
1179
+ readonly gem: typeof PROTOCOL;
1180
+ readonly type: "gem.token.denied";
1181
+ readonly requestId: string;
1182
+ readonly retryable: boolean;
1183
+ readonly retryAfterMs?: number;
1184
+ readonly reason: "chain_exhausted" | "unavailable";
1185
+ readonly correlationId: string;
1187
1186
  }
1188
- interface DropRateEntry$1 {
1189
- readonly entryId: string;
1190
- readonly weight: number;
1191
- readonly dropRate: number;
1192
- readonly rarityTier?: string;
1187
+ interface GemPause {
1188
+ readonly gem: typeof PROTOCOL;
1189
+ readonly type: "gem.pause";
1190
+ readonly paused: boolean;
1193
1191
  }
1194
- interface DropRates {
1195
- readonly lootTableId: string;
1196
- readonly name: string;
1197
- readonly rollCount: number;
1198
- readonly allowDuplicateRolls: boolean;
1199
- readonly totalWeight: number;
1200
- readonly entries: readonly DropRateEntry$1[];
1192
+ interface GemPrefs$1 {
1193
+ readonly gem: typeof PROTOCOL;
1194
+ readonly type: "gem.prefs";
1195
+ readonly reducedMotion: boolean;
1196
+ readonly muted: boolean;
1197
+ readonly showFrameStats?: boolean;
1198
+ readonly music?: boolean;
1199
+ readonly sounds?: boolean;
1200
+ readonly locale: string;
1201
+ readonly recommended?: {
1202
+ volume: number;
1203
+ batterySaver: boolean;
1204
+ keyboardLayout: "wasd" | "arrows";
1205
+ gamepadConfirm: "south" | "east";
1206
+ vibration: boolean;
1207
+ lookSensitivity?: number;
1208
+ gamepadLookSensitivity?: number;
1209
+ invertLookY?: boolean;
1210
+ touchMovement?: string;
1211
+ graphicsQuality?: string;
1212
+ graphicsQualityAuto?: boolean;
1213
+ colorHelp?: boolean;
1214
+ textScale?: number;
1215
+ };
1201
1216
  }
1202
- declare class GameConfigApi {
1203
- private readonly api;
1204
- private readonly channel;
1205
- private readonly options;
1206
- private loaded;
1207
- private inFlight;
1208
- private generation;
1209
- private readonly dropRatesByConfig;
1210
- constructor(api: GameApi$1, channel: () => string, options?: GameConfigOptions);
1211
- load(): Promise<GameConfig | null>;
1212
- refresh(): void;
1213
- dropRates(lootTableId: string, signal?: AbortSignal): Promise<DropRates>;
1214
- private fetchConfig;
1217
+ interface GemCohorts$1 {
1218
+ readonly gem: typeof PROTOCOL;
1219
+ readonly type: "gem.cohorts";
1220
+ readonly cohorts: {
1221
+ experimentId: string;
1222
+ variantKey: string;
1223
+ }[];
1215
1224
  }
1216
- declare const MAX_PERIODS_BACK = 400;
1217
- type ChallengeWindow = "daily" | "weekly" | "monthly" | "cron" | (string & {});
1218
- interface Challenge {
1219
- readonly id: string;
1220
- readonly slug?: string;
1221
- readonly window: ChallengeWindow;
1222
- readonly periodStartAt: number;
1223
- readonly periodEndsAt: number;
1224
- readonly periodLocalDate?: string;
1225
- readonly boundary: string;
1226
- readonly resetTime: string;
1227
- readonly seed: string;
1228
- readonly data?: string;
1229
- readonly dataHash?: string;
1225
+ interface GemInventoryChanged {
1226
+ readonly gem: typeof PROTOCOL;
1227
+ readonly type: "gem.inventoryChanged";
1230
1228
  }
1231
- interface ListChallengesOptions {
1232
- readonly periodsBack?: number;
1233
- readonly signal?: AbortSignal;
1229
+ interface GemViewport$1 {
1230
+ readonly gem: typeof PROTOCOL;
1231
+ readonly type: "gem.viewport";
1232
+ readonly insets: {
1233
+ top: number;
1234
+ right: number;
1235
+ bottom: number;
1236
+ left: number;
1237
+ };
1238
+ readonly reserved?: {
1239
+ x: number;
1240
+ y: number;
1241
+ width: number;
1242
+ height: number;
1243
+ control?: {
1244
+ x: number;
1245
+ y: number;
1246
+ width: number;
1247
+ height: number;
1248
+ };
1249
+ }[];
1234
1250
  }
1235
- declare class ChallengesApi {
1236
- #private;
1237
- constructor(api: GameApi$1);
1238
- list(options?: ListChallengesOptions): Promise<Challenge[]>;
1251
+ interface GemDeviceSettings {
1252
+ readonly gem: typeof PROTOCOL;
1253
+ readonly type: "gem.deviceSettings";
1254
+ readonly settings?: unknown;
1239
1255
  }
1240
- interface PlayerBadge$1 {
1241
- readonly itemId: string;
1242
- readonly iconUrl: string;
1256
+ interface GemWillTerminate {
1257
+ readonly gem: typeof PROTOCOL;
1258
+ readonly type: "gem.willTerminate";
1259
+ readonly reason: "grant_expiring" | "session_ended" | "navigating" | "kill_switch";
1260
+ readonly graceMs: number;
1243
1261
  }
1244
- type Avatar3dFamily = "small_human" | "adult_human" | (string & {});
1245
- interface WornAvatar3d$1 {
1246
- readonly family: Avatar3dFamily;
1247
- readonly id: string;
1248
- readonly modelUrl: string;
1249
- readonly iconUrl: string;
1262
+ interface GemRoomEvent {
1263
+ readonly gem: typeof PROTOCOL;
1264
+ readonly type: "gem.roomEvent";
1265
+ readonly event: "updated" | "match_started" | "match_ready" | "match_failed" | "version_stale";
1266
+ readonly roomId: string;
1267
+ readonly matchId?: string;
1268
+ readonly version?: number;
1269
+ readonly reason?: string;
1270
+ readonly platform?: "universal" | "mobile";
1250
1271
  }
1251
- interface PlayerIdentity {
1252
- readonly playerId?: string;
1253
- readonly displayName?: PlayerText;
1254
- readonly discriminator?: string;
1255
- readonly displayTag?: PlayerText;
1256
- readonly avatarIconId?: string;
1257
- readonly avatarIconUrl?: string;
1258
- readonly avatar3dId?: string;
1259
- readonly avatar3dModelUrl?: string;
1260
- readonly avatar3dIconUrl?: string;
1261
- readonly avatars3d?: readonly WornAvatar3d$1[];
1262
- readonly badges: readonly PlayerBadge$1[];
1272
+ interface GemSocketState {
1273
+ readonly gem: typeof PROTOCOL;
1274
+ readonly type: "gem.socketState";
1275
+ readonly connected: boolean;
1276
+ readonly reason?: "connecting" | "dropped" | "watchdog" | "terminal";
1263
1277
  }
1264
- declare function mapIdentity(row: unknown): PlayerIdentity;
1265
- declare function platformIconUrl(url: string | undefined): string | undefined;
1266
- interface LeaderboardPeriod {
1267
- readonly id: string;
1268
- readonly localDate?: string;
1269
- readonly startAt?: number;
1270
- readonly endsAt?: number;
1271
- readonly opensAt: number;
1272
- readonly closesAt: number;
1273
- readonly final: boolean;
1278
+ interface GemSeatedEvent {
1279
+ readonly gem: typeof PROTOCOL;
1280
+ readonly type: "gem.seatedEvent";
1281
+ readonly roomId: string;
1274
1282
  }
1275
- interface LeaderboardEntry extends RankedRow, PlayerIdentity {
1276
- readonly rank: number;
1277
- readonly occurredAt: number;
1278
- readonly entityId?: string;
1279
- readonly entityType?: EntityType$1;
1280
- readonly stats?: Readonly<Record<string, number>>;
1281
- readonly properties?: Readonly<Record<string, unknown>>;
1282
- readonly isViewer?: boolean;
1283
+ interface GemAutoStartFailedEvent {
1284
+ readonly gem: typeof PROTOCOL;
1285
+ readonly type: "gem.autoStartFailedEvent";
1286
+ readonly roomId: string;
1287
+ readonly code: string;
1283
1288
  }
1284
- interface Leaderboard {
1285
- readonly leaderboardType: string;
1286
- readonly runType: string;
1287
- readonly bucket1?: string;
1288
- readonly bucket2?: string;
1289
- readonly entries: readonly LeaderboardEntry[];
1290
- readonly generatedAt: number;
1291
- readonly updateFrequencySeconds?: number;
1292
- readonly period?: LeaderboardPeriod;
1289
+ interface GemTicketEvent {
1290
+ readonly gem: typeof PROTOCOL;
1291
+ readonly type: "gem.ticketEvent";
1292
+ readonly event: "queued" | "matched" | "expired" | "cancelled" | "failed";
1293
+ readonly ticketId: string;
1294
+ readonly partySize?: number;
1295
+ readonly queuedAt?: number;
1296
+ readonly expiresAt?: number;
1297
+ readonly reason?: string;
1298
+ readonly roomId?: string;
1293
1299
  }
1294
- interface RankedRow {
1295
- readonly rank: number;
1296
- readonly occurredAt: number;
1297
- readonly stats?: Readonly<Record<string, number>>;
1298
- readonly properties?: Readonly<Record<string, unknown>>;
1300
+ interface GemSignalEvent {
1301
+ readonly gem: typeof PROTOCOL;
1302
+ readonly type: "gem.signalEvent";
1303
+ readonly event: "hello" | "offer" | "answer" | "ice" | "peerJoined" | "peerLeft" | "migration" | "matchEnded" | "error";
1304
+ readonly matchId: string;
1305
+ readonly data: unknown;
1299
1306
  }
1300
- interface EntityLeaderboardEntry extends RankedRow {
1301
- readonly rank: number;
1302
- readonly stats?: Readonly<Record<string, number>>;
1307
+ interface GemRelayDraining {
1308
+ readonly gem: typeof PROTOCOL;
1309
+ readonly type: "gem.relayDraining";
1310
+ readonly matchId: string;
1311
+ readonly clusterTargetId: string;
1312
+ readonly relayIps: string[];
1313
+ readonly drainingSince: string;
1314
+ readonly deadline: string;
1303
1315
  }
1304
- interface EntityLeaderboard {
1305
- readonly leaderboardType: string;
1306
- readonly runType: string;
1307
- readonly entityType: EntityType$1;
1308
- readonly entityId: string;
1309
- readonly bucket1?: string;
1310
- readonly bucket2?: string;
1311
- readonly entries: readonly EntityLeaderboardEntry[];
1312
- readonly personalBest: EntityLeaderboardEntry | null;
1313
- readonly totalRuns: number;
1314
- readonly totalRunsExact: boolean;
1315
- readonly generatedAt: number;
1316
- readonly period?: LeaderboardPeriod;
1316
+ interface GemDedicatedEvent {
1317
+ readonly gem: typeof PROTOCOL;
1318
+ readonly type: "gem.dedicatedEvent";
1319
+ readonly event: "answer" | "error" | "matchEnded";
1320
+ readonly matchId: string;
1321
+ readonly sdp?: string;
1322
+ readonly sessionId?: string;
1323
+ readonly code?: string;
1324
+ readonly message?: string;
1325
+ readonly reason?: string;
1317
1326
  }
1318
- interface PeriodOptions {
1319
- readonly periodsBack?: number;
1320
- readonly period?: string;
1321
- readonly playerId?: string;
1327
+ interface GemPartyResult {
1328
+ readonly gem: typeof PROTOCOL;
1329
+ readonly type: "gem.partyResult";
1330
+ readonly requestId: string;
1331
+ readonly partyId?: string;
1322
1332
  }
1323
- interface EntityLeaderboardOptions extends PeriodOptions {
1324
- readonly bucket1?: string;
1325
- readonly bucket2?: string;
1326
- readonly limit?: number;
1327
- readonly signal?: AbortSignal;
1333
+ interface GemClusterTarget {
1334
+ readonly gem: typeof PROTOCOL;
1335
+ readonly type: "gem.clusterTarget";
1336
+ readonly clusterTargetId: string;
1337
+ readonly clusterTargetIds?: string[];
1328
1338
  }
1329
- interface GetLeaderboardOptions extends PeriodOptions {
1330
- readonly bucket1?: string;
1331
- readonly bucket2?: string;
1332
- readonly signal?: AbortSignal;
1339
+ interface GemGraphicsRoutes {
1340
+ readonly gem: typeof PROTOCOL;
1341
+ readonly type: "gem.graphicsRoutes";
1342
+ readonly entries: {
1343
+ gpu: string;
1344
+ route?: string;
1345
+ host?: string;
1346
+ }[];
1333
1347
  }
1334
- declare class LeaderboardsApi {
1335
- #private;
1336
- constructor(api: GameApi$1);
1337
- get(leaderboardType: string, options?: GetLeaderboardOptions): Promise<Leaderboard>;
1338
- friends(leaderboardType: string, options?: GetLeaderboardOptions): Promise<Leaderboard>;
1339
- mine(leaderboardType: string, options?: EntityLeaderboardOptions): Promise<EntityLeaderboard>;
1340
- character(leaderboardType: string, characterId: string, options?: EntityLeaderboardOptions): Promise<EntityLeaderboard>;
1348
+ interface GemScreenshotDenied {
1349
+ readonly gem: typeof PROTOCOL;
1350
+ readonly type: "gem.screenshot.denied";
1351
+ readonly reason: "not_wired" | "no_source" | "unsupported" | "unreadable" | "tainted" | "too_large" | "busy" | "declined" | "failed";
1352
+ readonly retryable: boolean;
1341
1353
  }
1342
- interface ShowcaseValue {
1343
- readonly playerId: string;
1344
- readonly key: string;
1345
- readonly value: unknown;
1346
- readonly updatedAt: number;
1354
+ interface GemDedicatedOffer {
1355
+ readonly gem: typeof PROTOCOL;
1356
+ readonly type: "gem.dedicatedOffer";
1357
+ readonly matchId: string;
1358
+ readonly sdp: string;
1359
+ readonly intent: "initial" | "ice_restart" | "full_reconnect";
1347
1360
  }
1348
- interface ShowcaseFriendEntry extends PlayerIdentity {
1349
- readonly playerId: string;
1350
- readonly value: unknown;
1351
- readonly isViewer: boolean;
1352
- readonly updatedAt: number;
1361
+ interface GemLocalServer {
1362
+ readonly gem: typeof PROTOCOL;
1363
+ readonly type: "gem.localServer";
1364
+ readonly requestId: string;
1365
+ readonly serverId?: string;
1353
1366
  }
1354
- interface ShowcaseFriends {
1355
- readonly key: string;
1356
- readonly entries: readonly ShowcaseFriendEntry[];
1357
- readonly generatedAt: number;
1367
+ interface GemLocalServerDenied {
1368
+ readonly gem: typeof PROTOCOL;
1369
+ readonly type: "gem.localServer.denied";
1370
+ readonly requestId: string;
1371
+ readonly retryable: boolean;
1372
+ readonly reason: "refused" | "unavailable";
1358
1373
  }
1359
- interface ShowcaseCallOptions {
1360
- readonly signal?: AbortSignal;
1374
+ interface GemMenuSelect {
1375
+ readonly gem: typeof PROTOCOL;
1376
+ readonly type: "gem.menuSelect";
1377
+ readonly entry: "settings" | "item";
1378
+ readonly id?: string;
1361
1379
  }
1362
- declare class ShowcaseApi {
1363
- private readonly api;
1364
- private readonly selfPlayerId;
1365
- constructor(api: GameApi$1, selfPlayerId: () => Promise<string>);
1366
- friends(key: string, options?: ShowcaseCallOptions): Promise<ShowcaseFriends>;
1367
- of(playerId: string, key: string, options?: ShowcaseCallOptions): Promise<ShowcaseValue | null>;
1368
- set(key: string, value: unknown, options?: ShowcaseCallOptions): Promise<ShowcaseValue>;
1369
- clear(key: string, options?: ShowcaseCallOptions): Promise<void>;
1380
+ interface GemSettingsDeclare {
1381
+ readonly gem: typeof PROTOCOL;
1382
+ readonly type: "gem.settingsDeclare";
1383
+ readonly settings: {
1384
+ id: string;
1385
+ label: string;
1386
+ kind: "toggle" | "slider" | "choice";
1387
+ value: boolean | number | string;
1388
+ quick?: boolean;
1389
+ icon?: string;
1390
+ min?: number;
1391
+ max?: number;
1392
+ step?: number;
1393
+ options?: {
1394
+ id: string;
1395
+ label: string;
1396
+ }[];
1397
+ }[];
1370
1398
  }
1371
- interface Friend extends PlayerIdentity {
1372
- readonly playerId: string;
1399
+ interface GemSettingChange {
1400
+ readonly gem: typeof PROTOCOL;
1401
+ readonly type: "gem.settingChange";
1402
+ readonly id: string;
1403
+ readonly value: boolean | number | string;
1373
1404
  }
1374
- interface FriendsPage {
1375
- readonly friends: readonly Friend[];
1376
- readonly nextCursor?: string;
1405
+ interface GemShareResult {
1406
+ readonly gem: typeof PROTOCOL;
1407
+ readonly type: "gem.shareResult";
1408
+ readonly requestId: string;
1409
+ readonly outcome: "accepted" | "refused";
1410
+ readonly reason?: string;
1411
+ readonly key?: string;
1377
1412
  }
1378
- interface ListFriendsOptions {
1379
- readonly limit?: number;
1380
- readonly cursor?: string;
1381
- readonly signal?: AbortSignal;
1413
+ interface GemPurchaseResult {
1414
+ readonly gem: typeof PROTOCOL;
1415
+ readonly type: "gem.purchaseResult";
1416
+ readonly requestId: string;
1417
+ readonly outcome: "ok" | "declined" | "unavailable";
1418
+ readonly reason?: string;
1419
+ readonly purchaseId?: string;
1382
1420
  }
1383
- interface FriendChallenge {
1384
- readonly id: string;
1385
- readonly from: Friend;
1386
- readonly template: string;
1387
- readonly params: Readonly<Record<string, string | number>>;
1388
- readonly createdAt: number;
1389
- readonly openedAt?: number;
1390
- readonly answeredAt?: number;
1421
+ interface GemPurchaseSettled {
1422
+ readonly gem: typeof PROTOCOL;
1423
+ readonly type: "gem.purchaseSettled";
1424
+ readonly purchaseKind: "item" | "recipe";
1425
+ readonly targetId: string;
1426
+ readonly catalogId?: string;
1427
+ readonly quantity: number;
1428
+ readonly purchaseId?: string;
1391
1429
  }
1392
- interface FriendChallengesPage {
1393
- readonly challenges: readonly FriendChallenge[];
1394
- readonly nextCursor?: string;
1430
+ interface GemDeviceSettingsResult {
1431
+ readonly gem: typeof PROTOCOL;
1432
+ readonly type: "gem.deviceSettings.result";
1433
+ readonly requestId: string;
1434
+ readonly outcome: "stored" | "too_large" | "unavailable";
1395
1435
  }
1396
- interface ListFriendChallengesOptions {
1397
- readonly limit?: number;
1398
- readonly cursor?: string;
1399
- readonly signal?: AbortSignal;
1436
+ interface GemAdResult {
1437
+ readonly gem: typeof PROTOCOL;
1438
+ readonly type: "gem.adResult";
1439
+ readonly requestId: string;
1440
+ readonly outcome: "shown" | "no_ad" | "unavailable";
1400
1441
  }
1401
- interface FriendChallengeRequest {
1402
- readonly playerId: string;
1403
- readonly template: string;
1404
- readonly params?: Readonly<Record<string, string | number>>;
1442
+ interface GemMomentResult {
1443
+ readonly gem: typeof PROTOCOL;
1444
+ readonly type: "gem.momentResult";
1445
+ readonly requestId: string;
1446
+ readonly shown: boolean;
1405
1447
  }
1406
- type FriendChallengeOutcomeKind = "accepted" | "cancelled" | "refused" | "unavailable";
1407
- interface FriendChallengeOutcome {
1408
- readonly outcome: FriendChallengeOutcomeKind;
1448
+ interface GemSignInResult {
1449
+ readonly gem: typeof PROTOCOL;
1450
+ readonly type: "gem.signInResult";
1451
+ readonly requestId: string;
1452
+ readonly outcome: "signed_in" | "declined" | "unavailable";
1409
1453
  }
1410
- type FriendChallengeErrorCode = "unknown_template" | "template_not_on_channel" | "param_invalid" | "param_undeclared" | "recipient_invalid" | (string & {});
1411
- declare class FriendChallengeError extends GemApiError {
1412
- readonly code?: FriendChallengeErrorCode;
1454
+ interface GemFriendChallengeResult {
1455
+ readonly gem: typeof PROTOCOL;
1456
+ readonly type: "gem.friendChallengeResult";
1457
+ readonly requestId: string;
1458
+ readonly outcome: "accepted" | "cancelled" | "refused" | "unavailable" | "rate_limited" | "invalid";
1459
+ readonly code?: string;
1413
1460
  readonly param?: string;
1414
1461
  readonly channel?: string;
1415
1462
  readonly configVersion?: number;
1416
- constructor(source: GemApiError, extra?: {
1417
- readonly param?: string;
1418
- readonly channel?: string;
1419
- readonly configVersion?: number;
1420
- });
1463
+ readonly retryAfterMs?: number;
1464
+ readonly detail?: string;
1421
1465
  }
1422
- interface PlayInviteRequest {
1423
- readonly params?: Readonly<Record<string, string>>;
1466
+ interface GemRequestPlayInvite {
1467
+ readonly gem: typeof PROTOCOL;
1468
+ readonly type: "gem.requestPlayInvite";
1469
+ readonly requestId: string;
1470
+ readonly params?: {
1471
+ key: string;
1472
+ value: string;
1473
+ }[];
1424
1474
  }
1425
- interface FriendsApiDependencies {
1426
- readonly challenge?: (request: FriendChallengeRequest) => Promise<FriendChallengeOutcome>;
1427
- readonly inviteToPlay?: (request?: PlayInviteRequest) => Promise<boolean>;
1428
- readonly setInviteParams?: (params: Readonly<Record<string, string>> | null) => boolean;
1429
- readonly launchedChallengeId?: string;
1475
+ interface GemPlayInviteResult {
1476
+ readonly gem: typeof PROTOCOL;
1477
+ readonly type: "gem.playInviteResult";
1478
+ readonly requestId: string;
1479
+ readonly shown: boolean;
1430
1480
  }
1431
- declare class FriendsApi {
1432
- #private;
1433
- constructor(api: GameApi$1, dependencies?: FriendsApiDependencies);
1434
- list(options?: ListFriendsOptions): Promise<FriendsPage>;
1435
- challenge(request: FriendChallengeRequest): Promise<FriendChallengeOutcome>;
1436
- inviteToPlay(request?: PlayInviteRequest): Promise<boolean>;
1437
- setInviteParams(params: Readonly<Record<string, string>> | null): boolean;
1438
- inbox(options?: ListFriendChallengesOptions): Promise<FriendChallengesPage>;
1439
- launchedChallenge(options?: {
1440
- readonly signal?: AbortSignal;
1441
- }): Promise<FriendChallenge | null>;
1442
- markAnswered(id: string): Promise<void>;
1481
+ interface GemInviteParams {
1482
+ readonly gem: typeof PROTOCOL;
1483
+ readonly type: "gem.inviteParams";
1484
+ readonly params?: {
1485
+ key: string;
1486
+ value: string;
1487
+ }[];
1443
1488
  }
1444
- type PlatformCurrencyAccess = "read" | "spend";
1445
- interface PlatformCurrency {
1446
- readonly slug: string;
1447
- readonly currencyId: string;
1448
- readonly balance: number;
1449
- readonly access: PlatformCurrencyAccess;
1489
+ interface GemRequestAppLinks {
1490
+ readonly gem: typeof PROTOCOL;
1491
+ readonly type: "gem.requestAppLinks";
1492
+ readonly requestId: string;
1450
1493
  }
1451
- interface PlatformCurrencyReadOptions {
1452
- readonly signal?: AbortSignal;
1494
+ interface GemAppLinksResult {
1495
+ readonly gem: typeof PROTOCOL;
1496
+ readonly type: "gem.appLinksResult";
1497
+ readonly requestId: string;
1498
+ readonly outcome: "ok" | "declined" | "unavailable";
1499
+ readonly reason?: string;
1500
+ readonly arcade?: {
1501
+ store: "app_store" | "google_play";
1502
+ };
1503
+ readonly game?: {
1504
+ store: "app_store" | "google_play";
1505
+ };
1453
1506
  }
1454
- declare class PlatformCurrenciesApi {
1455
- #private;
1456
- constructor(api: GameApi$1);
1457
- get(options?: PlatformCurrencyReadOptions): Promise<readonly PlatformCurrency[]>;
1507
+ interface GemRequestOpenApp {
1508
+ readonly gem: typeof PROTOCOL;
1509
+ readonly type: "gem.requestOpenApp";
1510
+ readonly requestId: string;
1511
+ readonly target: "arcade" | "game";
1458
1512
  }
1459
- type EarnAllowancePeriod = "day" | "window";
1460
- interface EarnAllowance {
1461
- readonly currencySlug: string;
1462
- readonly currencyId: string;
1463
- readonly limit: number;
1464
- readonly earned: number;
1465
- readonly remaining: number;
1466
- readonly period: EarnAllowancePeriod;
1467
- readonly periodDays: number;
1468
- readonly resetsAt?: number;
1513
+ interface GemOpenAppResult {
1514
+ readonly gem: typeof PROTOCOL;
1515
+ readonly type: "gem.openAppResult";
1516
+ readonly requestId: string;
1517
+ readonly outcome: "ok" | "declined" | "unavailable";
1518
+ readonly reason?: string;
1469
1519
  }
1470
- interface EarnAllowanceReadOptions {
1471
- readonly signal?: AbortSignal;
1520
+ interface GemRequestOpenGame {
1521
+ readonly gem: typeof PROTOCOL;
1522
+ readonly type: "gem.requestOpenGame";
1523
+ readonly requestId: string;
1524
+ readonly ref: string;
1472
1525
  }
1473
- interface EarnAllowanceSignal {
1474
- on(listener: () => void): () => void;
1475
- emit(): void;
1526
+ interface GemOpenGameResult {
1527
+ readonly gem: typeof PROTOCOL;
1528
+ readonly type: "gem.openGameResult";
1529
+ readonly requestId: string;
1530
+ readonly outcome: "ok" | "declined" | "unavailable";
1531
+ readonly reason?: string;
1476
1532
  }
1477
- type EarnAllowanceEvent = "changed";
1478
- declare class PlatformEarnAllowanceApi {
1479
- #private;
1480
- constructor(api: GameApi$1, signal?: EarnAllowanceSignal, log?: ((line: string) => void) | null);
1481
- get(options?: EarnAllowanceReadOptions): Promise<readonly EarnAllowance[]>;
1482
- on(event: EarnAllowanceEvent, listener: () => void): () => void;
1533
+ interface GemRequestSimilarGames {
1534
+ readonly gem: typeof PROTOCOL;
1535
+ readonly type: "gem.requestSimilarGames";
1536
+ readonly requestId: string;
1537
+ readonly limit?: number;
1483
1538
  }
1484
- declare class PlatformApi {
1485
- readonly currencies: PlatformCurrenciesApi;
1486
- readonly earnAllowance: PlatformEarnAllowanceApi;
1487
- constructor(api: GameApi$1, earnAllowanceSignal?: EarnAllowanceSignal, log?: ((line: string) => void) | null);
1539
+ interface GemSimilarGamesResult {
1540
+ readonly gem: typeof PROTOCOL;
1541
+ readonly type: "gem.similarGamesResult";
1542
+ readonly requestId: string;
1543
+ readonly outcome: "ok" | "declined" | "unavailable";
1544
+ readonly reason?: string;
1545
+ readonly games: {
1546
+ gameId: string;
1547
+ slug?: string;
1548
+ iconUrl: string;
1549
+ capsuleLandscapeUrl: string;
1550
+ capsulePortraitUrl: string;
1551
+ previewVideoUrl?: string;
1552
+ previewPosterUrl?: string;
1553
+ untrusted: {
1554
+ name: string;
1555
+ tagline: string;
1556
+ shortDescription: string;
1557
+ tags: string[];
1558
+ };
1559
+ }[];
1488
1560
  }
1489
- interface ProfileShowcaseEntry$1 {
1490
- readonly key: string;
1491
- readonly visibility: string;
1492
- readonly value: unknown;
1493
- readonly updatedAt: number;
1561
+ interface GemRequestStoreOffers {
1562
+ readonly gem: typeof PROTOCOL;
1563
+ readonly type: "gem.requestStoreOffers";
1564
+ readonly requestId: string;
1494
1565
  }
1495
- interface PlayerProfile extends PlayerIdentity {
1496
- readonly playerId: string;
1497
- readonly showcase: readonly ProfileShowcaseEntry$1[];
1498
- readonly generatedAt: number;
1566
+ interface GemStoreOffersResult {
1567
+ readonly gem: typeof PROTOCOL;
1568
+ readonly type: "gem.storeOffersResult";
1569
+ readonly requestId: string;
1570
+ readonly outcome: "ok" | "declined" | "unavailable";
1571
+ readonly reason?: string;
1572
+ readonly offers: {
1573
+ skuId: string;
1574
+ kind: "gem_pack" | "boost" | "pass" | "bundle";
1575
+ name: string;
1576
+ description: string;
1577
+ imageUrl?: string;
1578
+ priceDisplay: string;
1579
+ grant?: {
1580
+ currency: string;
1581
+ amount: number;
1582
+ };
1583
+ pass?: string;
1584
+ earnMultipliers?: {
1585
+ currencySlug: string;
1586
+ multiplierBp: number;
1587
+ }[];
1588
+ }[];
1499
1589
  }
1500
- interface ProfileCallOptions {
1501
- readonly signal?: AbortSignal;
1590
+ interface GemRequestStorePurchase {
1591
+ readonly gem: typeof PROTOCOL;
1592
+ readonly type: "gem.requestStorePurchase";
1593
+ readonly requestId: string;
1594
+ readonly skuId: string;
1502
1595
  }
1503
- declare class ProfilesApi {
1504
- #private;
1505
- constructor(api: GameApi$1);
1506
- of(playerId: string, options?: ProfileCallOptions): Promise<PlayerProfile | null>;
1596
+ interface GemStorePurchaseResult {
1597
+ readonly gem: typeof PROTOCOL;
1598
+ readonly type: "gem.storePurchaseResult";
1599
+ readonly requestId: string;
1600
+ readonly outcome: "ok" | "declined" | "unavailable";
1601
+ readonly reason?: string;
1507
1602
  }
1508
- interface FunctionInvokeOptions {
1509
- readonly signal?: AbortSignal;
1510
- readonly cueId?: string;
1603
+ interface GemStorePurchaseSettled {
1604
+ readonly gem: typeof PROTOCOL;
1605
+ readonly type: "gem.storePurchaseSettled";
1606
+ readonly skuId: string;
1511
1607
  }
1512
- interface FunctionResult {
1513
- readonly bytes: Uint8Array;
1514
- readonly invocationId?: string;
1515
- text(): string;
1516
- json<T = unknown>(): T;
1608
+ interface GemRequestStoreOfferSheet {
1609
+ readonly gem: typeof PROTOCOL;
1610
+ readonly type: "gem.requestStoreOfferSheet";
1611
+ readonly requestId: string;
1612
+ readonly skuId: string;
1517
1613
  }
1518
- type FunctionFailure = "trap" | "memory_exceeded" | "cpu_budget_exceeded" | "host_call_limit" | "output_too_large" | "argument_too_large";
1519
- declare class GemFunctionError extends GemApiError {
1520
- readonly invocationId?: string;
1521
- readonly functionMessage?: string;
1522
- readonly failure?: FunctionFailure | (string & {});
1523
- constructor(source: GemApiError, extra: {
1524
- readonly invocationId?: string;
1525
- readonly functionMessage?: string;
1526
- readonly failure?: string;
1527
- });
1528
- get retryable(): boolean;
1614
+ interface GemStoreOfferSheetResult {
1615
+ readonly gem: typeof PROTOCOL;
1616
+ readonly type: "gem.storeOfferSheetResult";
1617
+ readonly requestId: string;
1618
+ readonly outcome: "ok" | "declined" | "unavailable";
1619
+ readonly reason?: string;
1529
1620
  }
1530
- declare class FunctionsApi {
1531
- #private;
1532
- constructor(invoke: (body: Uint8Array, options?: {
1533
- signal?: AbortSignal;
1534
- cue_id?: string;
1535
- }) => Promise<BytesResponse>);
1536
- invoke(input: unknown, options?: FunctionInvokeOptions): Promise<FunctionResult>;
1621
+ interface PlayerBoostMultiplier {
1622
+ readonly currencyId: string;
1623
+ readonly currencySlug: string;
1624
+ readonly multiplier: number;
1537
1625
  }
1538
- type SessionEndReason = "grant_expiring" | "session_ended" | "navigating" | "kill_switch" | "pagehide";
1539
- type MatchTransport = "dedicated" | "p2p";
1540
- type PlatformEventName = "gem_session_start" | "gem_session_end" | "gem_pause" | "gem_resume" | "gem_boot_ready" | "gem_match_started" | "gem_match_ended" | "gem_auth_lost" | "gem_graphics_context_lost";
1541
- declare const PLATFORM_EVENTS: readonly PlatformEventName[];
1542
- type AnalyticsValue = string | number;
1543
- interface AnalyticsRejection$1 {
1544
- readonly index: number;
1545
- readonly code: string;
1626
+ interface PlayerBoost {
1627
+ readonly active: boolean;
1628
+ readonly multipliers: readonly PlayerBoostMultiplier[];
1629
+ readonly expiresInDays?: number;
1546
1630
  }
1547
- interface AnalyticsFlushResult {
1548
- readonly accepted: number;
1549
- readonly rejected: readonly AnalyticsRejection$1[];
1550
- readonly dropped: number;
1551
- readonly duplicate: boolean;
1631
+ interface PlayerBadge$1 {
1632
+ readonly itemId: string;
1633
+ readonly iconUrl: string;
1552
1634
  }
1553
- interface AnalyticsFlushOptions {
1554
- readonly keepalive?: boolean;
1555
- readonly signal?: AbortSignal;
1635
+ type Avatar3dFamily = "small_human" | "adult_human" | (string & {});
1636
+ interface WornAvatar3d$1 {
1637
+ readonly family: Avatar3dFamily;
1638
+ readonly id: string;
1639
+ readonly modelUrl: string;
1640
+ readonly iconUrl: string;
1556
1641
  }
1557
- interface AnalyticsOptions {
1558
- readonly enabled?: boolean;
1559
- readonly flushIntervalMs?: number;
1560
- readonly maxQueue?: number;
1642
+ interface PlayerIdentity {
1643
+ readonly playerId?: string;
1644
+ readonly displayName?: PlayerText;
1645
+ readonly discriminator?: string;
1646
+ readonly displayTag?: PlayerText;
1647
+ readonly avatarIconId?: string;
1648
+ readonly avatarIconUrl?: string;
1649
+ readonly avatar3dId?: string;
1650
+ readonly avatar3dModelUrl?: string;
1651
+ readonly avatar3dIconUrl?: string;
1652
+ readonly avatars3d?: readonly WornAvatar3d$1[];
1653
+ readonly badges: readonly PlayerBadge$1[];
1561
1654
  }
1562
- interface AnalyticsApiOptions {
1563
- readonly environment?: Readonly<Record<string, string>> | (() => Readonly<Record<string, string>>);
1564
- readonly client: () => GemClient;
1565
- readonly clock: Clock;
1566
- readonly gameId: () => string | null;
1567
- readonly playerId: () => string | null;
1568
- readonly awaitPlayerId?: () => Promise<string>;
1569
- readonly declarations?: () => Promise<readonly {
1655
+ declare function mapIdentity(row: unknown): PlayerIdentity;
1656
+ declare function platformIconUrl(url: string | undefined): string | undefined;
1657
+ interface RewardCue {
1658
+ currencySlug: string;
1659
+ cueId?: string;
1660
+ expected?: number;
1661
+ origin?: {
1662
+ x: number;
1663
+ y: number;
1664
+ };
1665
+ }
1666
+ type GemCorner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
1667
+ type RewardPresentation = "arcade" | "game";
1668
+ interface MenuStyle {
1669
+ readonly ground: string;
1670
+ readonly accent: string;
1671
+ }
1672
+ type FrameState = "waiting" | "connected" | "refused" | "closed";
1673
+ interface FramePlayer extends PlayerIdentity {
1674
+ readonly displayName: PlayerText;
1675
+ readonly displayHandle: PlayerText;
1676
+ readonly avatarUrl?: string;
1677
+ readonly boost: PlayerBoost;
1678
+ }
1679
+ type GemArcadeAsk = Omit<GemRequestAppLinks, "gem"> | Omit<GemRequestOpenApp, "gem"> | Omit<GemRequestOpenGame, "gem"> | Omit<GemRequestSimilarGames, "gem"> | Omit<GemRequestStoreOffers, "gem"> | Omit<GemRequestStorePurchase, "gem"> | Omit<GemRequestStoreOfferSheet, "gem">;
1680
+ type GemFriendsWindowAsk = Omit<GemRequestPlayInvite, "gem"> | Omit<GemInviteParams, "gem">;
1681
+ type GemArcadeAnswer = GemAppLinksResult | GemOpenAppResult | GemOpenGameResult | GemSimilarGamesResult | GemStoreOffersResult | GemStorePurchaseResult | GemStorePurchaseSettled | GemStoreOfferSheetResult;
1682
+ interface FrameCallbacks {
1683
+ onToken?(msg: GemToken): void;
1684
+ onPause?(msg: GemPause): void;
1685
+ onMenuSelect?(msg: GemMenuSelect): void;
1686
+ onSettingChange?(msg: GemSettingChange): void;
1687
+ onPrefs?(msg: GemPrefs$1): void;
1688
+ onCohorts?(msg: GemCohorts$1): void;
1689
+ onEarnAllowanceChanged?(): void;
1690
+ onInventoryChanged?(msg: GemInventoryChanged): void;
1691
+ onViewport?(msg: GemViewport$1): void;
1692
+ onWillTerminate?(msg: GemWillTerminate): void;
1693
+ onDevtools?(action: "open" | "close" | "toggle"): void;
1694
+ onScreenshot?(request: {
1695
+ maxWidth: number;
1696
+ maxHeight: number;
1697
+ }, port: MessagePort, deny: (reason: GemScreenshotDenied["reason"], retryable: boolean) => void): void;
1698
+ onRequestContext?(): void;
1699
+ onTokenDenied?(msg: GemTokenDenied): void;
1700
+ onLocalServer?(msg: GemLocalServer): void;
1701
+ onLocalServerDenied?(msg: GemLocalServerDenied): void;
1702
+ onPlayer?(player: FramePlayer, signInAvailable?: boolean): void;
1703
+ onRoomEvent?(msg: GemRoomEvent): void;
1704
+ onSeatedEvent?(msg: GemSeatedEvent): void;
1705
+ onAutoStartFailedEvent?(msg: GemAutoStartFailedEvent): void;
1706
+ onTicketEvent?(msg: GemTicketEvent): void;
1707
+ onSocketState?(msg: GemSocketState): void;
1708
+ onSignalEvent?(msg: GemSignalEvent): void;
1709
+ onRelayDraining?(msg: GemRelayDraining): void;
1710
+ onDedicatedEvent?(msg: GemDedicatedEvent): void;
1711
+ onClusterTarget?(msg: GemClusterTarget): void;
1712
+ onGraphicsRoutes?(msg: GemGraphicsRoutes): void;
1713
+ onPartyResult?(msg: GemPartyResult): void;
1714
+ onPurchaseResult?(msg: GemPurchaseResult): void;
1715
+ onPurchaseSettled?(msg: GemPurchaseSettled): void;
1716
+ onShareResult?(msg: GemShareResult): void;
1717
+ onDeviceSettings?(msg: GemDeviceSettings): void;
1718
+ onDeviceSettingsResult?(msg: GemDeviceSettingsResult): void;
1719
+ onAdResult?(msg: GemAdResult): void;
1720
+ onMomentResult?(msg: GemMomentResult): void;
1721
+ onSignInResult?(msg: GemSignInResult): void;
1722
+ onFriendChallengeResult?(msg: GemFriendChallengeResult): void;
1723
+ onArcadeAnswer?(msg: GemArcadeAnswer): void;
1724
+ onPlayInviteResult?(msg: GemPlayInviteResult): void;
1725
+ onError?(code: GemErrorCode, message?: string): void;
1726
+ onDropped?(code: GemErrorCode, message?: string): void;
1727
+ onStateChange?(state: FrameState): void;
1728
+ onRefused?(reason: string): void;
1729
+ }
1730
+ interface FrameOptions extends FrameCallbacks {
1731
+ allowedEmbedders: readonly string[];
1732
+ selfOrigin?: string;
1733
+ expectedSource: unknown;
1734
+ capabilities?: readonly string[];
1735
+ clock?: Clock;
1736
+ }
1737
+ declare class GemFrame {
1738
+ private readonly options;
1739
+ private state;
1740
+ private port;
1741
+ private version;
1742
+ private peerCapabilities;
1743
+ private unbidden;
1744
+ private engagedSent;
1745
+ private readyPending;
1746
+ private readySent;
1747
+ private settleWaiters;
1748
+ private readonly clock;
1749
+ private readonly inbound;
1750
+ private readonly outbound;
1751
+ private readonly expectedSource;
1752
+ constructor(options: FrameOptions);
1753
+ get currentState(): FrameState;
1754
+ get parentCapabilities(): readonly string[];
1755
+ parentSupports(capability: string): boolean;
1756
+ get protocolVersion(): number | null;
1757
+ get unbiddenLaunch(): boolean;
1758
+ handleWindowMessage(event: HandshakeEvent): boolean;
1759
+ ready(): void;
1760
+ settled(timeoutMs?: number): Promise<FrameState>;
1761
+ progress(loaded: number, total: number): void;
1762
+ requestToken(requestId: string, reason: "initial" | "expiring" | "rejected"): void;
1763
+ requestLocalServer(requestId: string, gameRoomId: string): boolean;
1764
+ exit(reason?: string): void;
1765
+ openExternal(url: string): void;
1766
+ requestFullscreen(enabled: boolean): void;
1767
+ reportMuted(muted: boolean): boolean;
1768
+ reportEngaged(): boolean;
1769
+ cueReward(cue: RewardCue): boolean;
1770
+ showPortraitBorders(name: string | null): boolean;
1771
+ setWalletVisible(visible: boolean, options?: {
1772
+ only?: readonly string[];
1773
+ }): boolean;
1774
+ setMenu(items?: ReadonlyArray<{
1570
1775
  readonly id: string;
1571
- readonly dimensions?: Readonly<Record<string, unknown>> | null;
1572
- }[] | null | undefined>;
1573
- readonly options?: AnalyticsOptions;
1574
- readonly log?: ((message: string) => void) | null;
1776
+ readonly label: string;
1777
+ }>): boolean;
1778
+ declareSettings(settings: GemSettingsDeclare["settings"]): boolean;
1779
+ setGemCorner(corner: GemCorner): boolean;
1780
+ setRewardPresentation(mode: RewardPresentation): boolean;
1781
+ setMenuStyle(style: MenuStyle | null): boolean;
1782
+ requestShare(params: ReadonlyArray<{
1783
+ readonly key: string;
1784
+ readonly value: string;
1785
+ }>, requestId?: string): boolean;
1786
+ requestAvatarPicker(tab?: "2d" | "3d"): boolean;
1787
+ requestVibrate(pattern: readonly number[]): boolean;
1788
+ reportFrameStats(stats: {
1789
+ fps: number;
1790
+ frameTimeP95Ms: number;
1791
+ counts?: "pageFrames" | "gameDraws";
1792
+ }): boolean;
1793
+ sendGameContext(context: Record<string, unknown>): boolean;
1794
+ signal(signal: string, matchId: string, data: Record<string, unknown>): void;
1795
+ dedicatedOffer(matchId: string, sdp: string, intent: GemDedicatedOffer["intent"]): void;
1796
+ requestParty(requestId: string): boolean;
1797
+ requestPurchase(requestId: string, purchaseKind: "item" | "recipe", targetId: string, currencySlug: string, quantity?: number, catalogId?: string, origin?: "sheet" | "direct_refused"): boolean;
1798
+ requestAvatar3dPurchase(requestId: string, itemId: string, currencySlug: string): boolean;
1799
+ putDeviceSettings(requestId: string, settings: Readonly<Record<string, unknown>>): boolean;
1800
+ requestAd(requestId: string, placement: string, format: "interstitial" | "rewarded"): boolean;
1801
+ signalMoment(requestId: string, kind: string, placement?: string, wall?: boolean): boolean;
1802
+ readyCalled(): boolean;
1803
+ requestSignIn(requestId: string): boolean;
1804
+ requestFriendChallenge(requestId: string, playerId: string, template: string, params?: Readonly<Record<string, string | number>>): boolean;
1805
+ requestArcade(msg: GemArcadeAsk | GemFriendsWindowAsk): boolean;
1806
+ close(): void;
1807
+ private transition;
1808
+ private refuseMalformed;
1809
+ private dropUnknownType;
1810
+ private refuse;
1811
+ private fail;
1812
+ private gated;
1813
+ private send;
1814
+ private receive;
1815
+ private dispatchInbound;
1816
+ private screenshotDenied;
1575
1817
  }
1576
- declare class AnalyticsApi {
1577
- #private;
1578
- constructor(options: AnalyticsApiOptions);
1579
- track(name: string, props?: Readonly<Record<string, AnalyticsValue>>): void;
1580
- setContext(props: Readonly<Record<string, AnalyticsValue>>): void;
1581
- experiment(key: string, count: number): Promise<number>;
1582
- experiment<T extends string>(key: string, options: readonly T[]): Promise<T>;
1583
- get environment(): Readonly<Record<string, string>>;
1584
- flush(options?: AnalyticsFlushOptions): Promise<AnalyticsFlushResult>;
1585
- trackPlatform(name: PlatformEventName, props?: Readonly<Record<string, AnalyticsValue>>): void;
1586
- hold(): void;
1587
- release(): void;
1588
- get held(): boolean;
1589
- startSession(): void;
1590
- endSession(reason: SessionEndReason): void;
1591
- setPaused(paused: boolean): void;
1592
- setHidden(hidden: boolean): void;
1593
- dispose(): void;
1594
- get pending(): number;
1818
+ type ArcadeOutcomeKind = "ok" | "declined" | "unavailable";
1819
+ interface ArcadeOutcome {
1820
+ readonly outcome: ArcadeOutcomeKind;
1821
+ readonly reason?: string;
1595
1822
  }
1596
- interface BootMark {
1823
+ interface ArcadeOffer {
1824
+ readonly skuId: string;
1825
+ readonly kind: ArcadeOfferKind;
1597
1826
  readonly name: string;
1598
- readonly at: number;
1827
+ readonly description: string;
1828
+ readonly imageUrl?: string;
1829
+ readonly priceDisplay: string;
1830
+ readonly grant?: {
1831
+ readonly currency: string;
1832
+ readonly amount: number;
1833
+ };
1834
+ readonly pass?: string;
1835
+ readonly earnMultipliers: readonly ArcadeOfferEarnMultiplier[];
1599
1836
  }
1600
- interface BootTimeline {
1601
- mark(name: string, at?: number): boolean;
1602
- timeline(): string;
1603
- readonly marks: readonly BootMark[];
1837
+ type ArcadeOfferKind = "coin_pack" | "gem_pack" | "boost" | "pass" | "bundle";
1838
+ interface ArcadeOfferEarnMultiplier {
1839
+ readonly currencySlug: string;
1840
+ readonly multiplierBp: number;
1604
1841
  }
1605
- interface BootTimelineOptions {
1606
- readonly now?: () => number;
1842
+ interface ShowPassOutcome extends ArcadeOutcome {
1843
+ readonly held: boolean;
1607
1844
  }
1608
- declare function markOnResolve<T>(boot: BootTimeline, name: string, work: Promise<T>, log?: ((message: string) => void) | null): Promise<T>;
1609
- declare function reportOnResolve(boot: BootTimeline, log?: ((message: string) => void) | null): <T>(work: Promise<T>) => Promise<T>;
1610
- declare function createBootTimeline(options?: BootTimelineOptions): BootTimeline;
1611
- type GemGraphicsRoute = "webgpu" | "webgl";
1612
- interface GemPreferredRoute {
1613
- readonly route: GemGraphicsRoute;
1614
- readonly listed: boolean;
1845
+ interface StoreOffersOutcome extends ArcadeOutcome {
1846
+ readonly offers: readonly ArcadeOffer[];
1615
1847
  }
1616
- interface GemGraphicsRouteEntry {
1617
- readonly gpu: string;
1618
- readonly route?: string;
1619
- readonly host?: string;
1848
+ interface StoreSettlement {
1849
+ readonly skuId: string;
1620
1850
  }
1621
- interface PreferredRouteOptions {
1622
- readonly timeoutMs?: number;
1851
+ interface StoreApi {
1852
+ readonly available: boolean;
1853
+ readonly showOfferAvailable: boolean;
1854
+ offers(): Promise<StoreOffersOutcome>;
1855
+ purchase(skuId: string): Promise<ArcadeOutcome>;
1856
+ showOffer(skuId: string): Promise<ArcadeOutcome>;
1857
+ showPass(slug: string): Promise<ShowPassOutcome>;
1858
+ passOnSale(slug: string): Promise<boolean>;
1859
+ onSettled(listener: (settlement: StoreSettlement) => void): () => void;
1623
1860
  }
1624
- interface GraphicsApi {
1625
- preferredRoute(options?: PreferredRouteOptions): Promise<GemPreferredRoute>;
1861
+ type PlatformGrantSource = {
1862
+ readonly source: "pass";
1863
+ readonly pass: string;
1864
+ readonly amount: number;
1865
+ } | {
1866
+ readonly source: "boost";
1867
+ readonly amount: number;
1868
+ };
1869
+ interface PlatformGrantPreview {
1870
+ readonly currencySlug?: string;
1871
+ readonly currencyId?: string;
1872
+ readonly base: number;
1873
+ readonly total: number;
1874
+ readonly breakdown: readonly PlatformGrantSource[];
1875
+ readonly ifComplete?: true;
1626
1876
  }
1627
- type DevToolsOpener = "game" | "platform";
1628
- interface GemDevTools {
1629
- open(): Promise<boolean>;
1630
- close(): void;
1631
- readonly isOpen: boolean;
1877
+ interface EarningsApi {
1878
+ fromReceipt(change: unknown): Promise<PlatformGrantPreview | null>;
1632
1879
  }
1633
- type ClusterTargetLike = string | null | undefined;
1634
- declare const CLIENT_PLATFORMS: readonly [
1635
- "universal",
1636
- "mobile",
1637
- "web"
1638
- ];
1639
- type ClientPlatform$1 = (typeof CLIENT_PLATFORMS)[number];
1640
- interface ClientVersion {
1641
- readonly platform?: ClientPlatform$1;
1642
- readonly gameVersion: string;
1643
- readonly engineVersion?: string;
1880
+ type PreviewTarget = {
1881
+ readonly recipe: string;
1882
+ } | {
1883
+ readonly progression: string;
1884
+ readonly add?: number;
1885
+ };
1886
+ type PreviewGrant = {
1887
+ readonly kind: "item";
1888
+ readonly itemId: string;
1889
+ readonly quantity: number;
1890
+ } | {
1891
+ readonly kind: "currency";
1892
+ readonly currencyId: string;
1893
+ readonly amount: number;
1894
+ } | {
1895
+ readonly kind: "roll";
1896
+ readonly lootTableId: string;
1897
+ readonly count: number;
1898
+ };
1899
+ interface UnmetRequirement {
1900
+ readonly index: number;
1901
+ readonly kind: string;
1644
1902
  }
1645
- interface ReadyMatch {
1646
- readonly status: "ready";
1647
- readonly matchId: string;
1648
- readonly protocol: string;
1649
- readonly joinCredential?: string;
1650
- readonly credentialExpiresAt?: number;
1651
- readonly host?: string;
1652
- readonly port?: number;
1903
+ interface BonusPreview {
1904
+ readonly id: string;
1905
+ readonly grants: readonly PreviewGrant[];
1906
+ readonly eligible: boolean | "unknown";
1907
+ readonly unmet: readonly UnmetRequirement[];
1653
1908
  }
1654
- interface StartMatchWaiting {
1655
- readonly attempt: number;
1656
- readonly elapsedMs: number;
1657
- readonly budgetMs: number;
1658
- readonly nextAttemptInMs: number;
1659
- readonly status: number;
1660
- readonly message: string;
1909
+ interface PassUpsell {
1910
+ readonly pass: string;
1911
+ readonly name: string;
1912
+ readonly offer: ArcadeOffer;
1913
+ readonly platformGrants: readonly {
1914
+ readonly currencySlug?: string;
1915
+ readonly currencyId?: string;
1916
+ readonly total: number;
1917
+ readonly extra: number;
1918
+ readonly ifComplete?: true;
1919
+ }[];
1920
+ readonly bonuses: readonly {
1921
+ readonly id: string;
1922
+ readonly grants: readonly PreviewGrant[];
1923
+ }[];
1661
1924
  }
1662
- interface StartMatchRetryOptions {
1663
- readonly budgetMs?: number;
1664
- readonly initialDelayMs?: number;
1665
- readonly maxDelayMs?: number;
1666
- readonly onWaiting?: (waiting: StartMatchWaiting) => void;
1925
+ interface ConfigPreview {
1926
+ readonly grants: readonly PreviewGrant[];
1927
+ readonly platformGrants: readonly PlatformGrantPreview[];
1928
+ readonly bonuses: readonly BonusPreview[];
1929
+ readonly upsells: readonly PassUpsell[];
1930
+ }
1931
+ interface PreviewHoldings {
1932
+ readonly items: ReadonlyMap<string, number> | null;
1933
+ readonly currencies: ReadonlyMap<string, number> | null;
1934
+ readonly progressions: ReadonlyMap<string, {
1935
+ readonly value: number;
1936
+ readonly completed: boolean;
1937
+ }> | null;
1938
+ readonly passes: ReadonlyMap<string, boolean> | null;
1939
+ }
1940
+ interface PreviewBoost {
1941
+ readonly currencyId?: string;
1942
+ readonly currencySlug?: string;
1943
+ readonly multiplierBp: number;
1944
+ }
1945
+ declare class PreviewError extends Error {
1946
+ readonly code: "not_found" | "invalid_argument" | "unsupported";
1947
+ constructor(code: "not_found" | "invalid_argument" | "unsupported", message: string);
1667
1948
  }
1668
- interface ClusterTarget {
1669
- readonly id: string;
1670
- readonly pressure: string;
1949
+ interface GameConfig extends GameConfigSnapshot {
1950
+ items: GameConfigSnapshot["items"];
1951
+ currencies: GameConfigSnapshot["currencies"];
1952
+ catalogs: GameConfigSnapshot["catalogs"];
1953
+ loot_tables: GameConfigSnapshot["loot_tables"];
1954
+ affix_pools?: GameConfigSnapshot["affix_pools"];
1955
+ progressions: GameConfigSnapshot["progressions"];
1956
+ game_room_templates: GameConfigSnapshot["game_room_templates"];
1957
+ kv: GameConfigSnapshot["kv"];
1958
+ run_types?: GameConfigSnapshot["run_types"];
1959
+ leaderboards?: GameConfigSnapshot["leaderboards"];
1960
+ async_opponent_types?: GameConfigSnapshot["async_opponent_types"];
1961
+ analytics_events?: GameConfigSnapshot["analytics_events"];
1962
+ analytics_funnels?: GameConfigSnapshot["analytics_funnels"];
1963
+ "rewarded_placements"?: SnapshotRewardedPlacement[];
1964
+ version: GameConfigSnapshot["version"];
1965
+ hash: GameConfigSnapshot["hash"];
1966
+ item(idOrSlug: string): SnapshotItem | null;
1967
+ currency(idOrSlug: string): SnapshotCurrency | null;
1671
1968
  }
1672
- type DedicatedServerFailure = "timeout" | "aborted" | "allocation_failed" | "no_server_ready" | "start_rate_limited" | "p2p_unavailable" | "unsupported_protocol" | "credential_expired" | "credential_reused" | "join_rate_limited" | "signaling_unavailable" | "signaling_failed" | "offer_refused" | "invalid_sdp" | "media_refused" | "connection_failed" | "join_refused" | "match_ended" | "misconfigured";
1673
- declare class DedicatedServerError extends Error {
1674
- readonly reason: DedicatedServerFailure;
1675
- readonly retryable: boolean;
1676
- readonly platformCode: string | undefined;
1677
- constructor(reason: DedicatedServerFailure, message: string, options?: {
1678
- cause?: unknown;
1679
- platformCode?: string;
1680
- });
1969
+ declare class GemConfigError extends Error {
1970
+ readonly reason: "config_unreachable" | "config_too_large" | "config_malformed" | "config_timeout" | "config_channel_unknown";
1971
+ constructor(reason: "config_unreachable" | "config_too_large" | "config_malformed" | "config_timeout" | "config_channel_unknown", message: string);
1681
1972
  }
1682
- type SignalingIntent = "initial" | "ice_restart" | "full_reconnect";
1683
- interface OfferRequest {
1684
- readonly matchId: string;
1685
- readonly sdp: string;
1686
- readonly intent: SignalingIntent;
1973
+ interface PreviewSources {
1974
+ boost(): readonly PreviewBoost[];
1975
+ holdings(needsInventory: boolean): Promise<PreviewHoldings>;
1976
+ offers(): Promise<readonly ArcadeOffer[]>;
1687
1977
  }
1688
- interface SignalingAnswer {
1689
- readonly sdp: string;
1978
+ interface GameConfigOptions {
1979
+ readonly fetch?: typeof globalThis.fetch;
1980
+ readonly timeoutMs?: number;
1690
1981
  }
1691
- interface SignalingChannel {
1692
- exchange(request: OfferRequest, signal?: AbortSignal): Promise<SignalingAnswer>;
1693
- close(): void;
1982
+ interface DropRateEntry$1 {
1983
+ readonly entryId: string;
1984
+ readonly weight: number;
1985
+ readonly dropRate: number;
1986
+ readonly rarityTier?: string;
1694
1987
  }
1695
- type SdpType$1 = "offer" | "answer" | "pranswer" | "rollback";
1696
- interface SessionDescriptionLike$1 {
1697
- readonly type: SdpType$1;
1698
- readonly sdp?: string;
1988
+ interface DropRates {
1989
+ readonly lootTableId: string;
1990
+ readonly name: string;
1991
+ readonly rollCount: number;
1992
+ readonly allowDuplicateRolls: boolean;
1993
+ readonly totalWeight: number;
1994
+ readonly entries: readonly DropRateEntry$1[];
1699
1995
  }
1700
- interface DataChannelInitLike$1 {
1701
- readonly ordered?: boolean;
1702
- readonly maxRetransmits?: number;
1996
+ declare class GameConfigApi {
1997
+ private readonly api;
1998
+ private readonly channel;
1999
+ private readonly options;
2000
+ private loaded;
2001
+ private inFlight;
2002
+ private generation;
2003
+ private readonly dropRatesByConfig;
2004
+ constructor(api: GameApi$1, channel: () => string, options?: GameConfigOptions);
2005
+ load(): Promise<GameConfig | null>;
2006
+ refresh(): void;
2007
+ bindPreview(sources: PreviewSources): void;
2008
+ private previewSources;
2009
+ preview(target: PreviewTarget): Promise<ConfigPreview>;
2010
+ dropRates(lootTableId: string, signal?: AbortSignal): Promise<DropRates>;
2011
+ private fetchConfig;
1703
2012
  }
1704
- interface EventTargetLike$1 {
1705
- addEventListener(type: string, listener: (event: unknown) => void): void;
1706
- removeEventListener(type: string, listener: (event: unknown) => void): void;
2013
+ declare const MAX_PERIODS_BACK = 400;
2014
+ type ChallengeWindow = "daily" | "weekly" | "monthly" | "cron" | (string & {});
2015
+ interface Challenge {
2016
+ readonly id: string;
2017
+ readonly slug?: string;
2018
+ readonly window: ChallengeWindow;
2019
+ readonly periodStartAt: number;
2020
+ readonly periodEndsAt: number;
2021
+ readonly periodLocalDate?: string;
2022
+ readonly boundary: string;
2023
+ readonly resetTime: string;
2024
+ readonly seed: string;
2025
+ readonly data?: string;
2026
+ readonly dataHash?: string;
1707
2027
  }
1708
- interface DataChannelLike$1 extends EventTargetLike$1 {
1709
- readonly readyState: string;
1710
- send(data: string | Uint8Array): void;
1711
- close(): void;
2028
+ interface ListChallengesOptions {
2029
+ readonly periodsBack?: number;
2030
+ readonly signal?: AbortSignal;
2031
+ }
2032
+ declare class ChallengesApi {
2033
+ #private;
2034
+ constructor(api: GameApi$1);
2035
+ list(options?: ListChallengesOptions): Promise<Challenge[]>;
1712
2036
  }
1713
- interface PeerConnectionLike$1 extends EventTargetLike$1 {
1714
- readonly localDescription: SessionDescriptionLike$1 | null;
1715
- readonly iceGatheringState: string;
1716
- createDataChannel(label: string, init?: DataChannelInitLike$1): DataChannelLike$1;
1717
- createOffer(): Promise<SessionDescriptionLike$1>;
1718
- setLocalDescription(description: SessionDescriptionLike$1): Promise<void>;
1719
- setRemoteDescription(description: SessionDescriptionLike$1): Promise<void>;
1720
- close(): void;
2037
+ interface LeaderboardPeriod {
2038
+ readonly id: string;
2039
+ readonly localDate?: string;
2040
+ readonly startAt?: number;
2041
+ readonly endsAt?: number;
2042
+ readonly opensAt: number;
2043
+ readonly closesAt: number;
2044
+ readonly final: boolean;
1721
2045
  }
1722
- interface JoinWelcome {
1723
- readonly playerId?: string;
1724
- readonly matchId?: string;
1725
- readonly heartbeatIntervalMs?: number;
2046
+ interface LeaderboardEntry extends RankedRow, PlayerIdentity {
2047
+ readonly rank: number;
2048
+ readonly occurredAt: number;
2049
+ readonly entityId?: string;
2050
+ readonly entityType?: EntityType$1;
2051
+ readonly stats?: Readonly<Record<string, number>>;
2052
+ readonly properties?: Readonly<Record<string, unknown>>;
2053
+ readonly isViewer?: boolean;
1726
2054
  }
1727
- interface JoinExchange {
1728
- readonly welcome: JoinWelcome;
1729
- detach(): void;
2055
+ interface Leaderboard {
2056
+ readonly leaderboardType: string;
2057
+ readonly runType: string;
2058
+ readonly bucket1?: string;
2059
+ readonly bucket2?: string;
2060
+ readonly entries: readonly LeaderboardEntry[];
2061
+ readonly generatedAt: number;
2062
+ readonly updateFrequencySeconds?: number;
2063
+ readonly period?: LeaderboardPeriod;
1730
2064
  }
1731
- interface PresentCredentialOptions {
1732
- readonly channel: DataChannelLike$1;
1733
- readonly credential: string;
1734
- readonly credentialExpiresAt: number;
1735
- readonly clock: Clock;
1736
- readonly ceilingMs?: number;
1737
- readonly wire?: number;
1738
- readonly heartbeat?: boolean;
1739
- readonly onMessage?: (data: unknown) => void;
1740
- readonly signal?: AbortSignal;
2065
+ interface RankedRow {
2066
+ readonly rank: number;
2067
+ readonly occurredAt: number;
2068
+ readonly stats?: Readonly<Record<string, number>>;
2069
+ readonly properties?: Readonly<Record<string, unknown>>;
1741
2070
  }
1742
- declare function presentJoinCredential(options: PresentCredentialOptions): Promise<JoinExchange>;
1743
- type TransportKind = "webtransport" | "webrtc" | "websocket";
1744
- declare const UNRELIABLE_CHANNEL_LABEL = "gem-uu";
1745
- interface SendOptions$1 {
1746
- readonly reliable?: boolean;
1747
- readonly ordered?: boolean;
2071
+ interface EntityLeaderboardEntry extends RankedRow {
2072
+ readonly rank: number;
2073
+ readonly stats?: Readonly<Record<string, number>>;
1748
2074
  }
1749
- interface MessageMeta {
1750
- readonly reliable: boolean;
1751
- readonly ordered: boolean;
2075
+ interface EntityLeaderboard {
2076
+ readonly leaderboardType: string;
2077
+ readonly runType: string;
2078
+ readonly entityType: EntityType$1;
2079
+ readonly entityId: string;
2080
+ readonly bucket1?: string;
2081
+ readonly bucket2?: string;
2082
+ readonly entries: readonly EntityLeaderboardEntry[];
2083
+ readonly personalBest: EntityLeaderboardEntry | null;
2084
+ readonly totalRuns: number;
2085
+ readonly totalRunsExact: boolean;
2086
+ readonly generatedAt: number;
2087
+ readonly period?: LeaderboardPeriod;
1752
2088
  }
1753
- interface GameServerLink {
1754
- readonly transport: TransportKind;
1755
- send(data: Uint8Array | string, options?: SendOptions$1): void;
1756
- onMessage(handler: (data: Uint8Array | string, meta: MessageMeta) => void): void;
1757
- onClose(handler: (reason?: string) => void): void;
1758
- close(): void;
2089
+ interface PeriodOptions {
2090
+ readonly periodsBack?: number;
2091
+ readonly period?: string;
2092
+ readonly playerId?: string;
1759
2093
  }
1760
- interface TransportAdvert {
1761
- readonly v: number;
1762
- readonly host: string;
1763
- readonly port: number;
1764
- readonly match_id: string;
1765
- readonly webrtc?: boolean;
1766
- readonly webtransport?: {
1767
- readonly url: string;
1768
- readonly cert_sha256_b64: string;
1769
- readonly expires_at?: number;
1770
- readonly named_url?: string;
1771
- };
1772
- readonly websocket?: {
1773
- readonly url: string;
1774
- readonly tls?: boolean;
1775
- };
2094
+ interface EntityLeaderboardOptions extends PeriodOptions {
2095
+ readonly bucket1?: string;
2096
+ readonly bucket2?: string;
2097
+ readonly limit?: number;
2098
+ readonly signal?: AbortSignal;
1776
2099
  }
1777
- declare function readTemplateTransports(value: unknown): readonly TransportKind[] | null;
1778
- declare function readTransportAdvert(settings: unknown, forMatch?: string): TransportAdvert | null;
1779
- declare function webTransportAvailable(): boolean;
1780
- type RoomArgScalar = string | number | boolean;
1781
- type RoomArgValue$1 = RoomArgScalar | readonly RoomArgScalar[];
1782
- type RoomArgs = Readonly<Record<string, RoomArgValue$1>>;
1783
- type RoomArgType$1 = "string" | "int" | "float" | "bool" | (string & {});
1784
- interface RoomArgEntry {
1785
- readonly name: string;
1786
- readonly type: RoomArgType$1;
1787
- readonly list: boolean;
1788
- readonly required: boolean;
1789
- readonly mutable: boolean;
1790
- readonly fixed?: RoomArgValue$1;
1791
- readonly default?: RoomArgValue$1;
1792
- readonly description?: string;
1793
- readonly allowed?: readonly RoomArgScalar[];
1794
- readonly min?: number;
1795
- readonly max?: number;
1796
- readonly minItems?: number;
1797
- readonly maxItems?: number;
1798
- readonly maxLength?: number;
2100
+ interface GetLeaderboardOptions extends PeriodOptions {
2101
+ readonly bucket1?: string;
2102
+ readonly bucket2?: string;
2103
+ readonly signal?: AbortSignal;
1799
2104
  }
1800
- type RoomStatus = "open" | "in_game" | "closed" | (string & {});
1801
- type PlayWithOutcome = "joined" | "unavailable";
1802
- type MatchConnectionState = "disconnected" | "connecting" | "connected" | "suspended";
1803
- type MatchSessionPhase = "none" | "starting" | "ready" | "connected" | "suspended" | "ended" | (string & {});
1804
- interface MatchSession {
1805
- readonly phase: MatchSessionPhase;
1806
- readonly matchId?: string;
1807
- readonly reason?: string;
1808
- readonly roomReopened?: boolean;
2105
+ declare class LeaderboardsApi {
2106
+ #private;
2107
+ constructor(api: GameApi$1);
2108
+ get(leaderboardType: string, options?: GetLeaderboardOptions): Promise<Leaderboard>;
2109
+ friends(leaderboardType: string, options?: GetLeaderboardOptions): Promise<Leaderboard>;
2110
+ mine(leaderboardType: string, options?: EntityLeaderboardOptions): Promise<EntityLeaderboard>;
2111
+ character(leaderboardType: string, characterId: string, options?: EntityLeaderboardOptions): Promise<EntityLeaderboard>;
1809
2112
  }
1810
- interface MatchEnded {
1811
- readonly matchId: string;
1812
- readonly reason: string;
1813
- readonly roomReopened: boolean;
2113
+ interface ShowcaseValue {
2114
+ readonly playerId: string;
2115
+ readonly key: string;
2116
+ readonly value: unknown;
2117
+ readonly updatedAt: number;
1814
2118
  }
1815
- interface MatchSuspended {
1816
- readonly matchId: string;
1817
- readonly cause: string;
2119
+ interface ShowcaseFriendEntry extends PlayerIdentity {
2120
+ readonly playerId: string;
2121
+ readonly value: unknown;
2122
+ readonly isViewer: boolean;
2123
+ readonly updatedAt: number;
1818
2124
  }
1819
- interface MatchReconnecting {
1820
- readonly matchId: string;
1821
- readonly attempt: number;
1822
- readonly attempts: number;
1823
- readonly remainingMs: number;
2125
+ interface ShowcaseFriends {
2126
+ readonly key: string;
2127
+ readonly entries: readonly ShowcaseFriendEntry[];
2128
+ readonly generatedAt: number;
1824
2129
  }
1825
- interface MatchReconnected {
1826
- readonly matchId: string;
1827
- readonly attempt: number;
2130
+ interface ShowcaseCallOptions {
2131
+ readonly signal?: AbortSignal;
1828
2132
  }
1829
- interface AutoReconnectOptions {
1830
- readonly budgetMs?: number;
1831
- readonly attempts?: number;
1832
- readonly maxDelayMs?: number;
2133
+ declare class ShowcaseApi {
2134
+ private readonly api;
2135
+ private readonly selfPlayerId;
2136
+ constructor(api: GameApi$1, selfPlayerId: () => Promise<string>);
2137
+ friends(key: string, options?: ShowcaseCallOptions): Promise<ShowcaseFriends>;
2138
+ of(playerId: string, key: string, options?: ShowcaseCallOptions): Promise<ShowcaseValue | null>;
2139
+ set(key: string, value: unknown, options?: ShowcaseCallOptions): Promise<ShowcaseValue>;
2140
+ clear(key: string, options?: ShowcaseCallOptions): Promise<void>;
1833
2141
  }
1834
- interface RoomMember extends PlayerIdentity {
2142
+ interface Friend extends PlayerIdentity {
1835
2143
  readonly playerId: string;
1836
- readonly isReady: boolean;
1837
- readonly role: string;
1838
- readonly joinedAt: number;
1839
- readonly groupId?: string;
1840
- readonly platform?: string;
1841
2144
  }
1842
- interface Room {
1843
- readonly id: string;
1844
- readonly gameId: string;
1845
- readonly name: string;
1846
- readonly status: RoomStatus;
1847
- readonly hostPlayerId: string;
1848
- readonly maxPlayers: number;
1849
- readonly memberCount: number;
1850
- readonly members: readonly RoomMember[];
1851
- readonly isPublic: boolean;
1852
- readonly joinCode?: string;
1853
- readonly settings?: unknown;
1854
- readonly roomArgs?: RoomArgs;
1855
- readonly roomArgsTemplate?: readonly RoomArgEntry[];
1856
- readonly gameChannel: string;
1857
- readonly region?: string;
1858
- readonly clusterTargetId?: string;
1859
- readonly selfHosted: boolean;
1860
- readonly matchId?: string;
1861
- readonly version: number;
1862
- readonly templateId?: string;
1863
- readonly templateSlug?: string;
1864
- readonly roomType: string;
1865
- readonly transports?: readonly TransportKind[];
1866
- readonly createdAt: number;
1867
- readonly updatedAt: number;
1868
- readonly startedAt?: number;
2145
+ interface FriendsPage {
2146
+ readonly friends: readonly Friend[];
2147
+ readonly nextCursor?: string;
1869
2148
  }
1870
- interface MatchAutoStartFailed {
1871
- readonly roomId: string;
1872
- readonly code: string;
1873
- readonly handled: boolean;
2149
+ interface ListFriendsOptions {
2150
+ readonly limit?: number;
2151
+ readonly cursor?: string;
2152
+ readonly signal?: AbortSignal;
1874
2153
  }
1875
- interface RoomSummary {
2154
+ interface FriendChallenge {
1876
2155
  readonly id: string;
1877
- readonly gameId: string;
1878
- readonly name: string;
1879
- readonly status: RoomStatus;
1880
- readonly hostPlayerId: string;
1881
- readonly maxPlayers: number;
1882
- readonly memberCount: number;
1883
- readonly isPublic: boolean;
1884
- readonly gameChannel: string;
1885
- readonly roomType: string;
2156
+ readonly from: Friend;
2157
+ readonly template: string;
2158
+ readonly params: Readonly<Record<string, string | number>>;
1886
2159
  readonly createdAt: number;
2160
+ readonly openedAt?: number;
2161
+ readonly answeredAt?: number;
1887
2162
  }
1888
- interface RoomPage {
1889
- readonly rooms: readonly RoomSummary[];
2163
+ interface FriendChallengesPage {
2164
+ readonly challenges: readonly FriendChallenge[];
1890
2165
  readonly nextCursor?: string;
1891
2166
  }
1892
- interface RoomOperationError {
1893
- readonly operation: string;
1894
- readonly code: number;
1895
- readonly reason: string;
1896
- readonly message: string;
1897
- readonly retryable: boolean;
1898
- }
1899
- interface QueueForMatchOptions {
1900
- readonly templateSlugs: readonly string[];
1901
- readonly partyId?: string;
2167
+ interface ListFriendChallengesOptions {
2168
+ readonly limit?: number;
2169
+ readonly cursor?: string;
1902
2170
  readonly signal?: AbortSignal;
1903
2171
  }
1904
- type MatchTicketStatus = "queued" | "matched" | "expired" | "cancelled" | "failed" | "lost" | "unavailable";
1905
- type MatchTicketOutcome = {
1906
- readonly status: "matched";
1907
- readonly room: Room;
1908
- } | {
1909
- readonly status: "expired";
1910
- readonly reason: string;
1911
- } | {
1912
- readonly status: "cancelled";
1913
- readonly reason: string;
1914
- } | {
1915
- readonly status: "failed";
1916
- readonly reason: string;
1917
- } | {
1918
- readonly status: "lost";
1919
- } | {
1920
- readonly status: "unavailable";
1921
- };
1922
- interface MatchTicket {
1923
- readonly id: string;
1924
- readonly status: MatchTicketStatus;
1925
- readonly partySize: number;
1926
- readonly queuedAt: number;
1927
- readonly expiresAt: number;
1928
- readonly outcome: Promise<MatchTicketOutcome>;
1929
- cancel(): Promise<MatchTicketOutcome>;
2172
+ interface FriendChallengeRequest {
2173
+ readonly playerId: string;
2174
+ readonly template: string;
2175
+ readonly params?: Readonly<Record<string, string | number>>;
1930
2176
  }
1931
- interface CreateRoomOptions {
1932
- readonly name: string;
1933
- readonly maxPlayers?: number;
1934
- readonly isPublic?: boolean;
1935
- readonly settings?: unknown;
1936
- readonly region?: string;
1937
- readonly templateId?: string;
1938
- readonly templateSlug?: string;
1939
- readonly partyId?: string;
1940
- readonly roomArgs?: RoomArgs;
1941
- readonly signal?: AbortSignal;
2177
+ type FriendChallengeOutcomeKind = "accepted" | "cancelled" | "refused" | "unavailable";
2178
+ interface FriendChallengeOutcome {
2179
+ readonly outcome: FriendChallengeOutcomeKind;
1942
2180
  }
1943
- interface JoinRoomOptions {
1944
- readonly partyId?: string;
1945
- readonly signal?: AbortSignal;
2181
+ type FriendChallengeErrorCode = "unknown_template" | "template_not_on_channel" | "param_invalid" | "param_undeclared" | "recipient_invalid" | (string & {});
2182
+ declare class FriendChallengeError extends GemApiError {
2183
+ readonly code?: FriendChallengeErrorCode;
2184
+ readonly param?: string;
2185
+ readonly channel?: string;
2186
+ readonly configVersion?: number;
2187
+ constructor(source: GemApiError, extra?: {
2188
+ readonly param?: string;
2189
+ readonly channel?: string;
2190
+ readonly configVersion?: number;
2191
+ });
1946
2192
  }
1947
- interface QuickJoinOptions extends JoinRoomOptions {
1948
- readonly templateSlug?: string;
1949
- readonly templateSlugs?: readonly string[];
1950
- readonly templateId?: string;
1951
- readonly region?: string;
1952
- readonly name?: string;
2193
+ interface PlayInviteRequest {
2194
+ readonly params?: Readonly<Record<string, string>>;
1953
2195
  }
1954
- interface ListRoomsOptions {
1955
- readonly status?: "open" | "in_game";
1956
- readonly templateSlug?: string;
1957
- readonly limit?: number;
1958
- readonly cursor?: string;
2196
+ interface FriendsApiDependencies {
2197
+ readonly challenge?: (request: FriendChallengeRequest) => Promise<FriendChallengeOutcome>;
2198
+ readonly inviteToPlay?: (request?: PlayInviteRequest) => Promise<boolean>;
2199
+ readonly setInviteParams?: (params: Readonly<Record<string, string>> | null) => boolean;
2200
+ readonly launchedChallengeId?: string;
2201
+ }
2202
+ declare class FriendsApi {
2203
+ #private;
2204
+ constructor(api: GameApi$1, dependencies?: FriendsApiDependencies);
2205
+ list(options?: ListFriendsOptions): Promise<FriendsPage>;
2206
+ challenge(request: FriendChallengeRequest): Promise<FriendChallengeOutcome>;
2207
+ inviteToPlay(request?: PlayInviteRequest): Promise<boolean>;
2208
+ setInviteParams(params: Readonly<Record<string, string>> | null): boolean;
2209
+ inbox(options?: ListFriendChallengesOptions): Promise<FriendChallengesPage>;
2210
+ launchedChallenge(options?: {
2211
+ readonly signal?: AbortSignal;
2212
+ }): Promise<FriendChallenge | null>;
2213
+ markAnswered(id: string): Promise<void>;
2214
+ }
2215
+ type PlatformCurrencyAccess = "read" | "spend";
2216
+ interface PlatformCurrency {
2217
+ readonly slug: string;
2218
+ readonly currencyId: string;
2219
+ readonly balance: number;
2220
+ readonly access: PlatformCurrencyAccess;
2221
+ }
2222
+ interface PlatformCurrencyReadOptions {
1959
2223
  readonly signal?: AbortSignal;
1960
2224
  }
1961
- interface UpdateRoomOptions {
1962
- readonly name?: string;
1963
- readonly maxPlayers?: number;
1964
- readonly isPublic?: boolean;
1965
- readonly settings?: unknown;
1966
- readonly roomArgs?: RoomArgs;
2225
+ declare class PlatformCurrenciesApi {
2226
+ #private;
2227
+ constructor(api: GameApi$1);
2228
+ get(options?: PlatformCurrencyReadOptions): Promise<readonly PlatformCurrency[]>;
2229
+ }
2230
+ type EarnAllowancePeriod = "day" | "window";
2231
+ interface EarnAllowance {
2232
+ readonly currencySlug: string;
2233
+ readonly currencyId: string;
2234
+ readonly limit: number;
2235
+ readonly earned: number;
2236
+ readonly remaining: number;
2237
+ readonly period: EarnAllowancePeriod;
2238
+ readonly periodDays: number;
2239
+ readonly resetsAt?: number;
2240
+ }
2241
+ interface EarnAllowanceReadOptions {
1967
2242
  readonly signal?: AbortSignal;
1968
2243
  }
1969
- type PartyTicketStatus = "queued" | "matched" | "expired" | "cancelled" | "failed" | "lost";
1970
- type PartyTicketOutcome = {
1971
- readonly status: "matched";
1972
- } | {
1973
- readonly status: "expired";
1974
- readonly reason: string;
1975
- } | {
1976
- readonly status: "cancelled";
1977
- readonly reason: string;
1978
- } | {
1979
- readonly status: "failed";
1980
- readonly reason: string;
1981
- } | {
1982
- readonly status: "lost";
1983
- };
1984
- interface PartyTicket {
1985
- readonly id: string;
1986
- readonly status: PartyTicketStatus;
1987
- readonly partySize: number;
1988
- readonly queuedAt: number;
1989
- readonly expiresAt: number;
1990
- readonly outcome: Promise<PartyTicketOutcome>;
2244
+ interface EarnAllowanceSignal {
2245
+ on(listener: () => void): () => void;
2246
+ emit(): void;
1991
2247
  }
1992
- interface RelayedTicketEvent {
1993
- readonly event: "queued" | "matched" | "expired" | "cancelled" | "failed";
1994
- readonly ticketId: string;
1995
- readonly partySize?: number;
1996
- readonly queuedAt?: number;
1997
- readonly expiresAt?: number;
1998
- readonly reason?: string;
1999
- readonly roomId?: string;
2248
+ type EarnAllowanceEvent = "changed";
2249
+ declare class PlatformEarnAllowanceApi {
2250
+ #private;
2251
+ constructor(api: GameApi$1, signal?: EarnAllowanceSignal, log?: ((line: string) => void) | null);
2252
+ get(options?: EarnAllowanceReadOptions): Promise<readonly EarnAllowance[]>;
2253
+ on(event: EarnAllowanceEvent, listener: () => void): () => void;
2000
2254
  }
2001
- interface RoomEventMap {
2002
- created: [
2003
- Room
2004
- ];
2005
- joined: [
2006
- Room
2007
- ];
2008
- left: [
2009
- ];
2010
- closed: [
2011
- ];
2012
- updated: [
2013
- Room
2014
- ];
2015
- seated: [
2016
- Room
2017
- ];
2018
- partyQueued: [
2019
- PartyTicket
2020
- ];
2021
- listed: [
2022
- RoomPage
2023
- ];
2024
- mineListed: [
2025
- readonly RoomSummary[]
2026
- ];
2027
- memberJoined: [
2028
- string
2029
- ];
2030
- memberLeft: [
2031
- string
2032
- ];
2033
- kicked: [
2034
- ];
2035
- readyChanged: [
2036
- string,
2037
- boolean
2038
- ];
2039
- hostChanged: [
2040
- string
2041
- ];
2042
- matchStartWaiting: [
2043
- StartMatchWaiting
2044
- ];
2045
- matchAutoStartFailed: [
2046
- MatchAutoStartFailed
2047
- ];
2048
- matchAllocationStarted: [
2049
- string
2050
- ];
2051
- matchReady: [
2052
- ReadyMatch
2053
- ];
2054
- matchFailed: [
2055
- string,
2056
- string
2057
- ];
2058
- matchEnded: [
2059
- MatchEnded
2060
- ];
2061
- matchSuspended: [
2062
- MatchSuspended
2063
- ];
2064
- matchReconnecting: [
2065
- MatchReconnecting
2066
- ];
2067
- matchReconnected: [
2068
- MatchReconnected
2069
- ];
2070
- versionUpdateAvailable: [
2071
- ClientPlatform$1 | undefined
2072
- ];
2073
- error: [
2074
- RoomOperationError
2075
- ];
2255
+ declare class PlatformApi {
2256
+ readonly currencies: PlatformCurrenciesApi;
2257
+ readonly earnAllowance: PlatformEarnAllowanceApi;
2258
+ constructor(api: GameApi$1, earnAllowanceSignal?: EarnAllowanceSignal, log?: ((line: string) => void) | null);
2076
2259
  }
2077
- type RoomEventName = keyof RoomEventMap;
2078
- interface MatchEndHint {
2079
- readonly matchId?: string;
2080
- readonly reason?: string;
2260
+ interface ProfileShowcaseEntry$1 {
2261
+ readonly key: string;
2262
+ readonly visibility: string;
2263
+ readonly value: unknown;
2264
+ readonly updatedAt: number;
2081
2265
  }
2082
- interface RelayedRoomEvent {
2083
- readonly event: "updated" | "match_started" | "match_ready" | "match_failed" | "version_stale";
2084
- readonly roomId: string;
2085
- readonly matchId?: string;
2086
- readonly version?: number;
2087
- readonly reason?: string;
2088
- readonly platform?: ClientPlatform$1;
2266
+ interface PlayerProfile extends PlayerIdentity {
2267
+ readonly playerId: string;
2268
+ readonly showcase: readonly ProfileShowcaseEntry$1[];
2269
+ readonly generatedAt: number;
2089
2270
  }
2090
- interface StartMatchOptions {
2091
- readonly clusterTargetId?: ClusterTargetLike;
2092
- readonly retry?: StartMatchRetryOptions;
2271
+ interface ProfileCallOptions {
2093
2272
  readonly signal?: AbortSignal;
2094
2273
  }
2095
- interface AwaitMatchOptions {
2096
- readonly timeoutMs?: number;
2097
- readonly pollIntervalMs?: number;
2274
+ declare class ProfilesApi {
2275
+ #private;
2276
+ constructor(api: GameApi$1);
2277
+ of(playerId: string, options?: ProfileCallOptions): Promise<PlayerProfile | null>;
2278
+ }
2279
+ interface FunctionInvokeOptions {
2098
2280
  readonly signal?: AbortSignal;
2281
+ readonly cueId?: string;
2099
2282
  }
2100
- interface StartedMatch {
2101
- readonly matchId: string;
2102
- readonly status: string;
2283
+ interface FunctionResult {
2284
+ readonly bytes: Uint8Array;
2285
+ readonly invocationId?: string;
2286
+ text(): string;
2287
+ json<T = unknown>(): T;
2103
2288
  }
2104
- interface RoomManager {
2105
- create(options: CreateRoomOptions): Promise<Room>;
2106
- join(roomId: string, options?: JoinRoomOptions): Promise<Room>;
2107
- joinByCode(code: string, options?: JoinRoomOptions): Promise<Room>;
2108
- quickJoin(options: QuickJoinOptions): Promise<Room>;
2109
- queueForMatch(options: QueueForMatchOptions): Promise<MatchTicket>;
2110
- list(options?: ListRoomsOptions): Promise<RoomPage>;
2111
- myRooms(signal?: AbortSignal): Promise<readonly RoomSummary[]>;
2112
- leave(options?: {
2113
- asGroup?: boolean;
2114
- signal?: AbortSignal;
2115
- keepalive?: boolean;
2116
- }): Promise<void>;
2117
- leaveAll(signal?: AbortSignal): Promise<readonly string[]>;
2118
- close(signal?: AbortSignal): Promise<void>;
2119
- refresh(signal?: AbortSignal): Promise<Room | null>;
2120
- setReady(isReady: boolean, signal?: AbortSignal): Promise<Room>;
2121
- kick(playerId: string, signal?: AbortSignal): Promise<Room>;
2122
- transferHost(playerId: string, signal?: AbortSignal): Promise<Room>;
2123
- update(options: UpdateRoomOptions): Promise<Room>;
2124
- startMatch(options?: StartMatchOptions): Promise<StartedMatch>;
2125
- awaitMatch(options?: AwaitMatchOptions): Promise<ReadyMatch>;
2126
- pollMatchStatus(options?: AwaitMatchOptions): Promise<ReadyMatch>;
2127
- notifyMatchConnected(matchId: string): void;
2128
- notifyMatchDisconnected(cause?: string): Promise<void>;
2129
- reconnectToMatch(options?: AwaitMatchOptions): Promise<ReadyMatch>;
2130
- notifyLeavingMatch(options?: {
2131
- keepalive?: boolean;
2132
- }): Promise<void>;
2133
- readonly gameId: string | null;
2134
- readonly currentRoom: Room | null;
2135
- readonly currentTicket: MatchTicket | null;
2136
- readonly partyTicket: PartyTicket | null;
2137
- readonly currentMatch: ReadyMatch | null;
2138
- readonly matchConnectionState: MatchConnectionState;
2139
- readonly matchSession: MatchSession;
2140
- readonly isInRoom: boolean;
2141
- readonly isHost: boolean;
2142
- readonly members: readonly Room["members"][number][];
2143
- readonly playWith: PlayWithOutcome | null;
2144
- on<K extends RoomEventName>(event: K, listener: (...args: RoomEventMap[K]) => void): () => void;
2145
- off<K extends RoomEventName>(event: K, listener: (...args: RoomEventMap[K]) => void): void;
2146
- once<K extends RoomEventName>(event: K, listener: (...args: RoomEventMap[K]) => void): () => void;
2147
- handleRoomEvent(event: RelayedRoomEvent): void;
2148
- handleSeated(roomId: string): void;
2149
- handleAutoStartFailed(roomId: string, code: string): void;
2150
- handleTicketEvent(event: RelayedTicketEvent): void;
2151
- reconcileSeats(): Promise<void>;
2152
- reconcile(hint?: MatchEndHint): Promise<void>;
2153
- startPolling(intervalMs?: number): void;
2154
- stopPolling(): void;
2155
- settled(): Promise<void>;
2156
- dispose(): void;
2289
+ type FunctionFailure = "trap" | "memory_exceeded" | "cpu_budget_exceeded" | "host_call_limit" | "output_too_large" | "argument_too_large";
2290
+ declare class GemFunctionError extends GemApiError {
2291
+ readonly invocationId?: string;
2292
+ readonly functionMessage?: string;
2293
+ readonly failure?: FunctionFailure | (string & {});
2294
+ constructor(source: GemApiError, extra: {
2295
+ readonly invocationId?: string;
2296
+ readonly functionMessage?: string;
2297
+ readonly failure?: string;
2298
+ });
2299
+ get retryable(): boolean;
2157
2300
  }
2158
- declare const PROTOCOL: "gem-web-bridge";
2159
- type GemErrorCode = "version_mismatch" | "handshake_timeout" | "handshake_duplicate" | "invalid_message" | "rate_limited" | "token_unavailable" | "unsupported" | "unsupported_capability" | "internal";
2160
- interface GemToken {
2161
- readonly gem: typeof PROTOCOL;
2162
- readonly type: "gem.token";
2163
- readonly token: string;
2164
- readonly requestId?: string;
2165
- readonly generation: number;
2166
- readonly apiBaseUrl?: string;
2167
- readonly playerId: string;
2168
- readonly gameId: string;
2169
- readonly channel: "dev" | "test" | "release";
2170
- readonly gameVersion?: string;
2171
- readonly expiresAt: number;
2172
- readonly chainEndsAt: number;
2173
- readonly allowDevTools?: boolean;
2301
+ declare class FunctionsApi {
2302
+ #private;
2303
+ constructor(invoke: (body: Uint8Array, options?: {
2304
+ signal?: AbortSignal;
2305
+ cue_id?: string;
2306
+ }) => Promise<BytesResponse>);
2307
+ invoke(input: unknown, options?: FunctionInvokeOptions): Promise<FunctionResult>;
2174
2308
  }
2175
- interface GemTokenDenied {
2176
- readonly gem: typeof PROTOCOL;
2177
- readonly type: "gem.token.denied";
2178
- readonly requestId: string;
2179
- readonly retryable: boolean;
2180
- readonly retryAfterMs?: number;
2181
- readonly reason: "chain_exhausted" | "unavailable";
2182
- readonly correlationId: string;
2309
+ type SessionEndReason = "grant_expiring" | "session_ended" | "navigating" | "kill_switch" | "pagehide";
2310
+ type MatchTransport = "dedicated" | "p2p";
2311
+ type PlatformEventName = "gem_session_start" | "gem_session_end" | "gem_pause" | "gem_resume" | "gem_boot_ready" | "gem_match_started" | "gem_match_ended" | "gem_auth_lost" | "gem_graphics_context_lost";
2312
+ declare const PLATFORM_EVENTS: readonly PlatformEventName[];
2313
+ type AnalyticsValue = string | number;
2314
+ interface AnalyticsRejection$1 {
2315
+ readonly index: number;
2316
+ readonly code: string;
2183
2317
  }
2184
- interface GemPause {
2185
- readonly gem: typeof PROTOCOL;
2186
- readonly type: "gem.pause";
2187
- readonly paused: boolean;
2318
+ interface AnalyticsFlushResult {
2319
+ readonly accepted: number;
2320
+ readonly rejected: readonly AnalyticsRejection$1[];
2321
+ readonly dropped: number;
2322
+ readonly duplicate: boolean;
2188
2323
  }
2189
- interface GemPrefs$1 {
2190
- readonly gem: typeof PROTOCOL;
2191
- readonly type: "gem.prefs";
2192
- readonly reducedMotion: boolean;
2193
- readonly muted: boolean;
2194
- readonly showFrameStats?: boolean;
2195
- readonly music?: boolean;
2196
- readonly sounds?: boolean;
2197
- readonly locale: string;
2198
- readonly recommended?: {
2199
- volume: number;
2200
- batterySaver: boolean;
2201
- keyboardLayout: "wasd" | "arrows";
2202
- gamepadConfirm: "south" | "east";
2203
- vibration: boolean;
2204
- lookSensitivity?: number;
2205
- gamepadLookSensitivity?: number;
2206
- invertLookY?: boolean;
2207
- touchMovement?: string;
2208
- graphicsQuality?: string;
2209
- graphicsQualityAuto?: boolean;
2210
- colorHelp?: boolean;
2211
- textScale?: number;
2212
- };
2324
+ interface AnalyticsFlushOptions {
2325
+ readonly keepalive?: boolean;
2326
+ readonly signal?: AbortSignal;
2213
2327
  }
2214
- interface GemCohorts$1 {
2215
- readonly gem: typeof PROTOCOL;
2216
- readonly type: "gem.cohorts";
2217
- readonly cohorts: {
2218
- experimentId: string;
2219
- variantKey: string;
2220
- }[];
2328
+ interface AnalyticsOptions {
2329
+ readonly enabled?: boolean;
2330
+ readonly flushIntervalMs?: number;
2331
+ readonly maxQueue?: number;
2221
2332
  }
2222
- interface GemInventoryChanged {
2223
- readonly gem: typeof PROTOCOL;
2224
- readonly type: "gem.inventoryChanged";
2333
+ interface AnalyticsApiOptions {
2334
+ readonly environment?: Readonly<Record<string, string>> | (() => Readonly<Record<string, string>>);
2335
+ readonly client: () => GemClient;
2336
+ readonly clock: Clock;
2337
+ readonly gameId: () => string | null;
2338
+ readonly playerId: () => string | null;
2339
+ readonly awaitPlayerId?: () => Promise<string>;
2340
+ readonly declarations?: () => Promise<readonly {
2341
+ readonly id: string;
2342
+ readonly dimensions?: Readonly<Record<string, unknown>> | null;
2343
+ }[] | null | undefined>;
2344
+ readonly options?: AnalyticsOptions;
2345
+ readonly log?: ((message: string) => void) | null;
2225
2346
  }
2226
- interface GemViewport$1 {
2227
- readonly gem: typeof PROTOCOL;
2228
- readonly type: "gem.viewport";
2229
- readonly insets: {
2230
- top: number;
2231
- right: number;
2232
- bottom: number;
2233
- left: number;
2234
- };
2235
- readonly reserved?: {
2236
- x: number;
2237
- y: number;
2238
- width: number;
2239
- height: number;
2240
- control?: {
2241
- x: number;
2242
- y: number;
2243
- width: number;
2244
- height: number;
2245
- };
2246
- }[];
2347
+ declare class AnalyticsApi {
2348
+ #private;
2349
+ constructor(options: AnalyticsApiOptions);
2350
+ track(name: string, props?: Readonly<Record<string, AnalyticsValue>>): void;
2351
+ setContext(props: Readonly<Record<string, AnalyticsValue>>): void;
2352
+ experiment(key: string, count: number): Promise<number>;
2353
+ experiment<T extends string>(key: string, options: readonly T[]): Promise<T>;
2354
+ get environment(): Readonly<Record<string, string>>;
2355
+ flush(options?: AnalyticsFlushOptions): Promise<AnalyticsFlushResult>;
2356
+ trackPlatform(name: PlatformEventName, props?: Readonly<Record<string, AnalyticsValue>>): void;
2357
+ hold(): void;
2358
+ release(): void;
2359
+ get held(): boolean;
2360
+ startSession(): void;
2361
+ endSession(reason: SessionEndReason): void;
2362
+ setPaused(paused: boolean): void;
2363
+ setHidden(hidden: boolean): void;
2364
+ dispose(): void;
2365
+ get pending(): number;
2247
2366
  }
2248
- interface GemDeviceSettings {
2249
- readonly gem: typeof PROTOCOL;
2250
- readonly type: "gem.deviceSettings";
2251
- readonly settings?: unknown;
2367
+ interface BootMark {
2368
+ readonly name: string;
2369
+ readonly at: number;
2252
2370
  }
2253
- interface GemWillTerminate {
2254
- readonly gem: typeof PROTOCOL;
2255
- readonly type: "gem.willTerminate";
2256
- readonly reason: "grant_expiring" | "session_ended" | "navigating" | "kill_switch";
2257
- readonly graceMs: number;
2371
+ interface BootTimeline {
2372
+ mark(name: string, at?: number): boolean;
2373
+ timeline(): string;
2374
+ readonly marks: readonly BootMark[];
2258
2375
  }
2259
- interface GemRoomEvent {
2260
- readonly gem: typeof PROTOCOL;
2261
- readonly type: "gem.roomEvent";
2262
- readonly event: "updated" | "match_started" | "match_ready" | "match_failed" | "version_stale";
2263
- readonly roomId: string;
2264
- readonly matchId?: string;
2265
- readonly version?: number;
2266
- readonly reason?: string;
2267
- readonly platform?: "universal" | "mobile";
2376
+ interface BootTimelineOptions {
2377
+ readonly now?: () => number;
2268
2378
  }
2269
- interface GemSocketState {
2270
- readonly gem: typeof PROTOCOL;
2271
- readonly type: "gem.socketState";
2272
- readonly connected: boolean;
2273
- readonly reason?: "connecting" | "dropped" | "watchdog" | "terminal";
2379
+ declare function markOnResolve<T>(boot: BootTimeline, name: string, work: Promise<T>, log?: ((message: string) => void) | null): Promise<T>;
2380
+ declare function reportOnResolve(boot: BootTimeline, log?: ((message: string) => void) | null): <T>(work: Promise<T>) => Promise<T>;
2381
+ declare function createBootTimeline(options?: BootTimelineOptions): BootTimeline;
2382
+ type GemGraphicsRoute = "webgpu" | "webgl";
2383
+ interface GemPreferredRoute {
2384
+ readonly route: GemGraphicsRoute;
2385
+ readonly listed: boolean;
2274
2386
  }
2275
- interface GemSeatedEvent {
2276
- readonly gem: typeof PROTOCOL;
2277
- readonly type: "gem.seatedEvent";
2278
- readonly roomId: string;
2387
+ interface GemGraphicsRouteEntry {
2388
+ readonly gpu: string;
2389
+ readonly route?: string;
2390
+ readonly host?: string;
2279
2391
  }
2280
- interface GemAutoStartFailedEvent {
2281
- readonly gem: typeof PROTOCOL;
2282
- readonly type: "gem.autoStartFailedEvent";
2283
- readonly roomId: string;
2284
- readonly code: string;
2392
+ interface PreferredRouteOptions {
2393
+ readonly timeoutMs?: number;
2285
2394
  }
2286
- interface GemTicketEvent {
2287
- readonly gem: typeof PROTOCOL;
2288
- readonly type: "gem.ticketEvent";
2289
- readonly event: "queued" | "matched" | "expired" | "cancelled" | "failed";
2290
- readonly ticketId: string;
2291
- readonly partySize?: number;
2292
- readonly queuedAt?: number;
2293
- readonly expiresAt?: number;
2294
- readonly reason?: string;
2295
- readonly roomId?: string;
2395
+ interface GraphicsApi {
2396
+ preferredRoute(options?: PreferredRouteOptions): Promise<GemPreferredRoute>;
2296
2397
  }
2297
- interface GemSignalEvent {
2298
- readonly gem: typeof PROTOCOL;
2299
- readonly type: "gem.signalEvent";
2300
- readonly event: "hello" | "offer" | "answer" | "ice" | "peerJoined" | "peerLeft" | "migration" | "matchEnded" | "error";
2301
- readonly matchId: string;
2302
- readonly data: unknown;
2398
+ type DevToolsOpener = "game" | "platform";
2399
+ interface GemDevTools {
2400
+ open(): Promise<boolean>;
2401
+ close(): void;
2402
+ readonly isOpen: boolean;
2303
2403
  }
2304
- interface GemRelayDraining {
2305
- readonly gem: typeof PROTOCOL;
2306
- readonly type: "gem.relayDraining";
2307
- readonly matchId: string;
2308
- readonly clusterTargetId: string;
2309
- readonly relayIps: string[];
2310
- readonly drainingSince: string;
2311
- readonly deadline: string;
2404
+ type ClusterTargetLike = string | null | undefined;
2405
+ declare const CLIENT_PLATFORMS: readonly [
2406
+ "universal",
2407
+ "mobile",
2408
+ "web"
2409
+ ];
2410
+ type ClientPlatform$1 = (typeof CLIENT_PLATFORMS)[number];
2411
+ interface ClientVersion {
2412
+ readonly platform?: ClientPlatform$1;
2413
+ readonly gameVersion: string;
2414
+ readonly engineVersion?: string;
2312
2415
  }
2313
- interface GemDedicatedEvent {
2314
- readonly gem: typeof PROTOCOL;
2315
- readonly type: "gem.dedicatedEvent";
2316
- readonly event: "answer" | "error" | "matchEnded";
2416
+ interface ReadyMatch {
2417
+ readonly status: "ready";
2317
2418
  readonly matchId: string;
2318
- readonly sdp?: string;
2319
- readonly sessionId?: string;
2320
- readonly code?: string;
2321
- readonly message?: string;
2322
- readonly reason?: string;
2419
+ readonly protocol: string;
2420
+ readonly joinCredential?: string;
2421
+ readonly credentialExpiresAt?: number;
2422
+ readonly host?: string;
2423
+ readonly port?: number;
2323
2424
  }
2324
- interface GemPartyResult {
2325
- readonly gem: typeof PROTOCOL;
2326
- readonly type: "gem.partyResult";
2327
- readonly requestId: string;
2328
- readonly partyId?: string;
2425
+ interface StartMatchWaiting {
2426
+ readonly attempt: number;
2427
+ readonly elapsedMs: number;
2428
+ readonly budgetMs: number;
2429
+ readonly nextAttemptInMs: number;
2430
+ readonly status: number;
2431
+ readonly message: string;
2329
2432
  }
2330
- interface GemClusterTarget {
2331
- readonly gem: typeof PROTOCOL;
2332
- readonly type: "gem.clusterTarget";
2333
- readonly clusterTargetId: string;
2334
- readonly clusterTargetIds?: string[];
2433
+ interface StartMatchRetryOptions {
2434
+ readonly budgetMs?: number;
2435
+ readonly initialDelayMs?: number;
2436
+ readonly maxDelayMs?: number;
2437
+ readonly onWaiting?: (waiting: StartMatchWaiting) => void;
2335
2438
  }
2336
- interface GemGraphicsRoutes {
2337
- readonly gem: typeof PROTOCOL;
2338
- readonly type: "gem.graphicsRoutes";
2339
- readonly entries: {
2340
- gpu: string;
2341
- route?: string;
2342
- host?: string;
2343
- }[];
2439
+ interface ClusterTarget {
2440
+ readonly id: string;
2441
+ readonly pressure: string;
2344
2442
  }
2345
- interface GemScreenshotDenied {
2346
- readonly gem: typeof PROTOCOL;
2347
- readonly type: "gem.screenshot.denied";
2348
- readonly reason: "not_wired" | "no_source" | "unsupported" | "unreadable" | "tainted" | "too_large" | "busy" | "declined" | "failed";
2443
+ type DedicatedServerFailure = "timeout" | "aborted" | "allocation_failed" | "no_server_ready" | "start_rate_limited" | "p2p_unavailable" | "unsupported_protocol" | "credential_expired" | "credential_reused" | "join_rate_limited" | "signaling_unavailable" | "signaling_failed" | "offer_refused" | "invalid_sdp" | "media_refused" | "connection_failed" | "join_refused" | "match_ended" | "misconfigured";
2444
+ declare class DedicatedServerError extends Error {
2445
+ readonly reason: DedicatedServerFailure;
2349
2446
  readonly retryable: boolean;
2447
+ readonly platformCode: string | undefined;
2448
+ constructor(reason: DedicatedServerFailure, message: string, options?: {
2449
+ cause?: unknown;
2450
+ platformCode?: string;
2451
+ });
2350
2452
  }
2351
- interface GemDedicatedOffer {
2352
- readonly gem: typeof PROTOCOL;
2353
- readonly type: "gem.dedicatedOffer";
2453
+ type SignalingIntent = "initial" | "ice_restart" | "full_reconnect";
2454
+ interface OfferRequest {
2354
2455
  readonly matchId: string;
2355
2456
  readonly sdp: string;
2356
- readonly intent: "initial" | "ice_restart" | "full_reconnect";
2457
+ readonly intent: SignalingIntent;
2357
2458
  }
2358
- interface GemLocalServer {
2359
- readonly gem: typeof PROTOCOL;
2360
- readonly type: "gem.localServer";
2361
- readonly requestId: string;
2362
- readonly serverId?: string;
2459
+ interface SignalingAnswer {
2460
+ readonly sdp: string;
2363
2461
  }
2364
- interface GemLocalServerDenied {
2365
- readonly gem: typeof PROTOCOL;
2366
- readonly type: "gem.localServer.denied";
2367
- readonly requestId: string;
2368
- readonly retryable: boolean;
2369
- readonly reason: "refused" | "unavailable";
2462
+ interface SignalingChannel {
2463
+ exchange(request: OfferRequest, signal?: AbortSignal): Promise<SignalingAnswer>;
2464
+ close(): void;
2370
2465
  }
2371
- interface GemMenuSelect {
2372
- readonly gem: typeof PROTOCOL;
2373
- readonly type: "gem.menuSelect";
2374
- readonly entry: "settings" | "item";
2375
- readonly id?: string;
2466
+ type SdpType$1 = "offer" | "answer" | "pranswer" | "rollback";
2467
+ interface SessionDescriptionLike$1 {
2468
+ readonly type: SdpType$1;
2469
+ readonly sdp?: string;
2376
2470
  }
2377
- interface GemSettingsDeclare {
2378
- readonly gem: typeof PROTOCOL;
2379
- readonly type: "gem.settingsDeclare";
2380
- readonly settings: {
2381
- id: string;
2382
- label: string;
2383
- kind: "toggle" | "slider" | "choice";
2384
- value: boolean | number | string;
2385
- quick?: boolean;
2386
- icon?: string;
2387
- min?: number;
2388
- max?: number;
2389
- step?: number;
2390
- options?: {
2391
- id: string;
2392
- label: string;
2393
- }[];
2394
- }[];
2471
+ interface DataChannelInitLike$1 {
2472
+ readonly ordered?: boolean;
2473
+ readonly maxRetransmits?: number;
2474
+ }
2475
+ interface EventTargetLike$1 {
2476
+ addEventListener(type: string, listener: (event: unknown) => void): void;
2477
+ removeEventListener(type: string, listener: (event: unknown) => void): void;
2478
+ }
2479
+ interface DataChannelLike$1 extends EventTargetLike$1 {
2480
+ readonly readyState: string;
2481
+ send(data: string | Uint8Array): void;
2482
+ close(): void;
2483
+ }
2484
+ interface PeerConnectionLike$1 extends EventTargetLike$1 {
2485
+ readonly localDescription: SessionDescriptionLike$1 | null;
2486
+ readonly iceGatheringState: string;
2487
+ createDataChannel(label: string, init?: DataChannelInitLike$1): DataChannelLike$1;
2488
+ createOffer(): Promise<SessionDescriptionLike$1>;
2489
+ setLocalDescription(description: SessionDescriptionLike$1): Promise<void>;
2490
+ setRemoteDescription(description: SessionDescriptionLike$1): Promise<void>;
2491
+ close(): void;
2492
+ }
2493
+ interface JoinWelcome {
2494
+ readonly playerId?: string;
2495
+ readonly matchId?: string;
2496
+ readonly heartbeatIntervalMs?: number;
2497
+ }
2498
+ interface JoinExchange {
2499
+ readonly welcome: JoinWelcome;
2500
+ detach(): void;
2501
+ }
2502
+ interface PresentCredentialOptions {
2503
+ readonly channel: DataChannelLike$1;
2504
+ readonly credential: string;
2505
+ readonly credentialExpiresAt: number;
2506
+ readonly clock: Clock;
2507
+ readonly ceilingMs?: number;
2508
+ readonly wire?: number;
2509
+ readonly heartbeat?: boolean;
2510
+ readonly onMessage?: (data: unknown) => void;
2511
+ readonly signal?: AbortSignal;
2512
+ }
2513
+ declare function presentJoinCredential(options: PresentCredentialOptions): Promise<JoinExchange>;
2514
+ type TransportKind = "webtransport" | "webrtc" | "websocket";
2515
+ declare const UNRELIABLE_CHANNEL_LABEL = "gem-uu";
2516
+ interface SendOptions$1 {
2517
+ readonly reliable?: boolean;
2518
+ readonly ordered?: boolean;
2519
+ }
2520
+ interface MessageMeta {
2521
+ readonly reliable: boolean;
2522
+ readonly ordered: boolean;
2523
+ }
2524
+ interface GameServerLink {
2525
+ readonly transport: TransportKind;
2526
+ send(data: Uint8Array | string, options?: SendOptions$1): void;
2527
+ onMessage(handler: (data: Uint8Array | string, meta: MessageMeta) => void): void;
2528
+ onClose(handler: (reason?: string) => void): void;
2529
+ close(): void;
2395
2530
  }
2396
- interface GemSettingChange {
2397
- readonly gem: typeof PROTOCOL;
2398
- readonly type: "gem.settingChange";
2399
- readonly id: string;
2400
- readonly value: boolean | number | string;
2531
+ interface TransportAdvert {
2532
+ readonly v: number;
2533
+ readonly host: string;
2534
+ readonly port: number;
2535
+ readonly match_id: string;
2536
+ readonly webrtc?: boolean;
2537
+ readonly webtransport?: {
2538
+ readonly url: string;
2539
+ readonly cert_sha256_b64: string;
2540
+ readonly expires_at?: number;
2541
+ readonly named_url?: string;
2542
+ };
2543
+ readonly websocket?: {
2544
+ readonly url: string;
2545
+ readonly tls?: boolean;
2546
+ };
2401
2547
  }
2402
- interface GemShareResult {
2403
- readonly gem: typeof PROTOCOL;
2404
- readonly type: "gem.shareResult";
2405
- readonly requestId: string;
2406
- readonly outcome: "accepted" | "refused";
2407
- readonly reason?: string;
2408
- readonly key?: string;
2548
+ declare function readTemplateTransports(value: unknown): readonly TransportKind[] | null;
2549
+ declare function readTransportAdvert(settings: unknown, forMatch?: string): TransportAdvert | null;
2550
+ declare function webTransportAvailable(): boolean;
2551
+ type RoomArgScalar = string | number | boolean;
2552
+ type RoomArgValue$1 = RoomArgScalar | readonly RoomArgScalar[];
2553
+ type RoomArgs = Readonly<Record<string, RoomArgValue$1>>;
2554
+ type RoomArgType$1 = "string" | "int" | "float" | "bool" | (string & {});
2555
+ interface RoomArgEntry {
2556
+ readonly name: string;
2557
+ readonly type: RoomArgType$1;
2558
+ readonly list: boolean;
2559
+ readonly required: boolean;
2560
+ readonly mutable: boolean;
2561
+ readonly fixed?: RoomArgValue$1;
2562
+ readonly default?: RoomArgValue$1;
2563
+ readonly description?: string;
2564
+ readonly allowed?: readonly RoomArgScalar[];
2565
+ readonly min?: number;
2566
+ readonly max?: number;
2567
+ readonly minItems?: number;
2568
+ readonly maxItems?: number;
2569
+ readonly maxLength?: number;
2409
2570
  }
2410
- interface GemPurchaseResult {
2411
- readonly gem: typeof PROTOCOL;
2412
- readonly type: "gem.purchaseResult";
2413
- readonly requestId: string;
2414
- readonly outcome: "ok" | "declined" | "unavailable";
2571
+ type RoomStatus = "open" | "in_game" | "closed" | (string & {});
2572
+ type PlayWithOutcome = "joined" | "unavailable";
2573
+ type MatchConnectionState = "disconnected" | "connecting" | "connected" | "suspended";
2574
+ type MatchSessionPhase = "none" | "starting" | "ready" | "connected" | "suspended" | "ended" | (string & {});
2575
+ interface MatchSession {
2576
+ readonly phase: MatchSessionPhase;
2577
+ readonly matchId?: string;
2415
2578
  readonly reason?: string;
2416
- readonly purchaseId?: string;
2579
+ readonly roomReopened?: boolean;
2417
2580
  }
2418
- interface GemPurchaseSettled {
2419
- readonly gem: typeof PROTOCOL;
2420
- readonly type: "gem.purchaseSettled";
2421
- readonly purchaseKind: "item" | "recipe";
2422
- readonly targetId: string;
2423
- readonly catalogId?: string;
2424
- readonly quantity: number;
2425
- readonly purchaseId?: string;
2581
+ interface MatchEnded {
2582
+ readonly matchId: string;
2583
+ readonly reason: string;
2584
+ readonly roomReopened: boolean;
2426
2585
  }
2427
- interface GemDeviceSettingsResult {
2428
- readonly gem: typeof PROTOCOL;
2429
- readonly type: "gem.deviceSettings.result";
2430
- readonly requestId: string;
2431
- readonly outcome: "stored" | "too_large" | "unavailable";
2586
+ interface MatchSuspended {
2587
+ readonly matchId: string;
2588
+ readonly cause: string;
2432
2589
  }
2433
- interface GemAdResult {
2434
- readonly gem: typeof PROTOCOL;
2435
- readonly type: "gem.adResult";
2436
- readonly requestId: string;
2437
- readonly outcome: "shown" | "no_ad" | "unavailable";
2590
+ interface MatchReconnecting {
2591
+ readonly matchId: string;
2592
+ readonly attempt: number;
2593
+ readonly attempts: number;
2594
+ readonly remainingMs: number;
2438
2595
  }
2439
- interface GemMomentResult {
2440
- readonly gem: typeof PROTOCOL;
2441
- readonly type: "gem.momentResult";
2442
- readonly requestId: string;
2443
- readonly shown: boolean;
2596
+ interface MatchReconnected {
2597
+ readonly matchId: string;
2598
+ readonly attempt: number;
2444
2599
  }
2445
- interface GemSignInResult {
2446
- readonly gem: typeof PROTOCOL;
2447
- readonly type: "gem.signInResult";
2448
- readonly requestId: string;
2449
- readonly outcome: "signed_in" | "declined" | "unavailable";
2600
+ interface AutoReconnectOptions {
2601
+ readonly budgetMs?: number;
2602
+ readonly attempts?: number;
2603
+ readonly maxDelayMs?: number;
2450
2604
  }
2451
- interface GemFriendChallengeResult {
2452
- readonly gem: typeof PROTOCOL;
2453
- readonly type: "gem.friendChallengeResult";
2454
- readonly requestId: string;
2455
- readonly outcome: "accepted" | "cancelled" | "refused" | "unavailable" | "rate_limited" | "invalid";
2456
- readonly code?: string;
2457
- readonly param?: string;
2458
- readonly channel?: string;
2459
- readonly configVersion?: number;
2460
- readonly retryAfterMs?: number;
2461
- readonly detail?: string;
2605
+ interface RoomMember extends PlayerIdentity {
2606
+ readonly playerId: string;
2607
+ readonly isReady: boolean;
2608
+ readonly role: string;
2609
+ readonly joinedAt: number;
2610
+ readonly groupId?: string;
2611
+ readonly platform?: string;
2462
2612
  }
2463
- interface GemRequestPlayInvite {
2464
- readonly gem: typeof PROTOCOL;
2465
- readonly type: "gem.requestPlayInvite";
2466
- readonly requestId: string;
2467
- readonly params?: {
2468
- key: string;
2469
- value: string;
2470
- }[];
2613
+ interface Room {
2614
+ readonly id: string;
2615
+ readonly gameId: string;
2616
+ readonly name: string;
2617
+ readonly status: RoomStatus;
2618
+ readonly hostPlayerId: string;
2619
+ readonly maxPlayers: number;
2620
+ readonly memberCount: number;
2621
+ readonly members: readonly RoomMember[];
2622
+ readonly isPublic: boolean;
2623
+ readonly joinCode?: string;
2624
+ readonly settings?: unknown;
2625
+ readonly roomArgs?: RoomArgs;
2626
+ readonly roomArgsTemplate?: readonly RoomArgEntry[];
2627
+ readonly gameChannel: string;
2628
+ readonly region?: string;
2629
+ readonly clusterTargetId?: string;
2630
+ readonly selfHosted: boolean;
2631
+ readonly matchId?: string;
2632
+ readonly version: number;
2633
+ readonly templateId?: string;
2634
+ readonly templateSlug?: string;
2635
+ readonly roomType: string;
2636
+ readonly transports?: readonly TransportKind[];
2637
+ readonly createdAt: number;
2638
+ readonly updatedAt: number;
2639
+ readonly startedAt?: number;
2471
2640
  }
2472
- interface GemPlayInviteResult {
2473
- readonly gem: typeof PROTOCOL;
2474
- readonly type: "gem.playInviteResult";
2475
- readonly requestId: string;
2476
- readonly shown: boolean;
2641
+ interface MatchAutoStartFailed {
2642
+ readonly roomId: string;
2643
+ readonly code: string;
2644
+ readonly handled: boolean;
2477
2645
  }
2478
- interface GemInviteParams {
2479
- readonly gem: typeof PROTOCOL;
2480
- readonly type: "gem.inviteParams";
2481
- readonly params?: {
2482
- key: string;
2483
- value: string;
2484
- }[];
2646
+ interface RoomSummary {
2647
+ readonly id: string;
2648
+ readonly gameId: string;
2649
+ readonly name: string;
2650
+ readonly status: RoomStatus;
2651
+ readonly hostPlayerId: string;
2652
+ readonly maxPlayers: number;
2653
+ readonly memberCount: number;
2654
+ readonly isPublic: boolean;
2655
+ readonly gameChannel: string;
2656
+ readonly roomType: string;
2657
+ readonly createdAt: number;
2485
2658
  }
2486
- interface GemRequestAppLinks {
2487
- readonly gem: typeof PROTOCOL;
2488
- readonly type: "gem.requestAppLinks";
2489
- readonly requestId: string;
2659
+ interface RoomPage {
2660
+ readonly rooms: readonly RoomSummary[];
2661
+ readonly nextCursor?: string;
2490
2662
  }
2491
- interface GemAppLinksResult {
2492
- readonly gem: typeof PROTOCOL;
2493
- readonly type: "gem.appLinksResult";
2494
- readonly requestId: string;
2495
- readonly outcome: "ok" | "declined" | "unavailable";
2496
- readonly reason?: string;
2497
- readonly arcade?: {
2498
- store: "app_store" | "google_play";
2499
- };
2500
- readonly game?: {
2501
- store: "app_store" | "google_play";
2502
- };
2663
+ interface RoomOperationError {
2664
+ readonly operation: string;
2665
+ readonly code: number;
2666
+ readonly reason: string;
2667
+ readonly message: string;
2668
+ readonly retryable: boolean;
2503
2669
  }
2504
- interface GemRequestOpenApp {
2505
- readonly gem: typeof PROTOCOL;
2506
- readonly type: "gem.requestOpenApp";
2507
- readonly requestId: string;
2508
- readonly target: "arcade" | "game";
2670
+ interface QueueForMatchOptions {
2671
+ readonly templateSlugs: readonly string[];
2672
+ readonly partyId?: string;
2673
+ readonly signal?: AbortSignal;
2674
+ }
2675
+ type MatchTicketStatus = "queued" | "matched" | "expired" | "cancelled" | "failed" | "lost" | "unavailable";
2676
+ type MatchTicketOutcome = {
2677
+ readonly status: "matched";
2678
+ readonly room: Room;
2679
+ } | {
2680
+ readonly status: "expired";
2681
+ readonly reason: string;
2682
+ } | {
2683
+ readonly status: "cancelled";
2684
+ readonly reason: string;
2685
+ } | {
2686
+ readonly status: "failed";
2687
+ readonly reason: string;
2688
+ } | {
2689
+ readonly status: "lost";
2690
+ } | {
2691
+ readonly status: "unavailable";
2692
+ };
2693
+ interface MatchTicket {
2694
+ readonly id: string;
2695
+ readonly status: MatchTicketStatus;
2696
+ readonly partySize: number;
2697
+ readonly queuedAt: number;
2698
+ readonly expiresAt: number;
2699
+ readonly outcome: Promise<MatchTicketOutcome>;
2700
+ cancel(): Promise<MatchTicketOutcome>;
2509
2701
  }
2510
- interface GemOpenAppResult {
2511
- readonly gem: typeof PROTOCOL;
2512
- readonly type: "gem.openAppResult";
2513
- readonly requestId: string;
2514
- readonly outcome: "ok" | "declined" | "unavailable";
2515
- readonly reason?: string;
2702
+ interface CreateRoomOptions {
2703
+ readonly name: string;
2704
+ readonly maxPlayers?: number;
2705
+ readonly isPublic?: boolean;
2706
+ readonly settings?: unknown;
2707
+ readonly region?: string;
2708
+ readonly templateId?: string;
2709
+ readonly templateSlug?: string;
2710
+ readonly partyId?: string;
2711
+ readonly roomArgs?: RoomArgs;
2712
+ readonly signal?: AbortSignal;
2516
2713
  }
2517
- interface GemRequestOpenGame {
2518
- readonly gem: typeof PROTOCOL;
2519
- readonly type: "gem.requestOpenGame";
2520
- readonly requestId: string;
2521
- readonly ref: string;
2714
+ interface JoinRoomOptions {
2715
+ readonly partyId?: string;
2716
+ readonly signal?: AbortSignal;
2522
2717
  }
2523
- interface GemOpenGameResult {
2524
- readonly gem: typeof PROTOCOL;
2525
- readonly type: "gem.openGameResult";
2526
- readonly requestId: string;
2527
- readonly outcome: "ok" | "declined" | "unavailable";
2528
- readonly reason?: string;
2718
+ interface QuickJoinOptions extends JoinRoomOptions {
2719
+ readonly templateSlug?: string;
2720
+ readonly templateSlugs?: readonly string[];
2721
+ readonly templateId?: string;
2722
+ readonly region?: string;
2723
+ readonly name?: string;
2529
2724
  }
2530
- interface GemRequestSimilarGames {
2531
- readonly gem: typeof PROTOCOL;
2532
- readonly type: "gem.requestSimilarGames";
2533
- readonly requestId: string;
2725
+ interface ListRoomsOptions {
2726
+ readonly status?: "open" | "in_game";
2727
+ readonly templateSlug?: string;
2534
2728
  readonly limit?: number;
2729
+ readonly cursor?: string;
2730
+ readonly signal?: AbortSignal;
2535
2731
  }
2536
- interface GemSimilarGamesResult {
2537
- readonly gem: typeof PROTOCOL;
2538
- readonly type: "gem.similarGamesResult";
2539
- readonly requestId: string;
2540
- readonly outcome: "ok" | "declined" | "unavailable";
2541
- readonly reason?: string;
2542
- readonly games: {
2543
- gameId: string;
2544
- slug?: string;
2545
- iconUrl: string;
2546
- capsuleLandscapeUrl: string;
2547
- capsulePortraitUrl: string;
2548
- previewVideoUrl?: string;
2549
- previewPosterUrl?: string;
2550
- untrusted: {
2551
- name: string;
2552
- tagline: string;
2553
- shortDescription: string;
2554
- tags: string[];
2555
- };
2556
- }[];
2732
+ interface UpdateRoomOptions {
2733
+ readonly name?: string;
2734
+ readonly maxPlayers?: number;
2735
+ readonly isPublic?: boolean;
2736
+ readonly settings?: unknown;
2737
+ readonly roomArgs?: RoomArgs;
2738
+ readonly signal?: AbortSignal;
2557
2739
  }
2558
- interface GemRequestStoreOffers {
2559
- readonly gem: typeof PROTOCOL;
2560
- readonly type: "gem.requestStoreOffers";
2561
- readonly requestId: string;
2740
+ type PartyTicketStatus = "queued" | "matched" | "expired" | "cancelled" | "failed" | "lost";
2741
+ type PartyTicketOutcome = {
2742
+ readonly status: "matched";
2743
+ } | {
2744
+ readonly status: "expired";
2745
+ readonly reason: string;
2746
+ } | {
2747
+ readonly status: "cancelled";
2748
+ readonly reason: string;
2749
+ } | {
2750
+ readonly status: "failed";
2751
+ readonly reason: string;
2752
+ } | {
2753
+ readonly status: "lost";
2754
+ };
2755
+ interface PartyTicket {
2756
+ readonly id: string;
2757
+ readonly status: PartyTicketStatus;
2758
+ readonly partySize: number;
2759
+ readonly queuedAt: number;
2760
+ readonly expiresAt: number;
2761
+ readonly outcome: Promise<PartyTicketOutcome>;
2562
2762
  }
2563
- interface GemStoreOffersResult {
2564
- readonly gem: typeof PROTOCOL;
2565
- readonly type: "gem.storeOffersResult";
2566
- readonly requestId: string;
2567
- readonly outcome: "ok" | "declined" | "unavailable";
2763
+ interface RelayedTicketEvent {
2764
+ readonly event: "queued" | "matched" | "expired" | "cancelled" | "failed";
2765
+ readonly ticketId: string;
2766
+ readonly partySize?: number;
2767
+ readonly queuedAt?: number;
2768
+ readonly expiresAt?: number;
2568
2769
  readonly reason?: string;
2569
- readonly offers: {
2570
- skuId: string;
2571
- kind: "gem_pack" | "boost" | "pass" | "bundle";
2572
- name: string;
2573
- description: string;
2574
- imageUrl?: string;
2575
- priceDisplay: string;
2576
- grant?: {
2577
- currency: string;
2578
- amount: number;
2579
- };
2580
- }[];
2770
+ readonly roomId?: string;
2581
2771
  }
2582
- interface GemRequestStorePurchase {
2583
- readonly gem: typeof PROTOCOL;
2584
- readonly type: "gem.requestStorePurchase";
2585
- readonly requestId: string;
2586
- readonly skuId: string;
2772
+ interface RoomEventMap {
2773
+ created: [
2774
+ Room
2775
+ ];
2776
+ joined: [
2777
+ Room
2778
+ ];
2779
+ left: [
2780
+ ];
2781
+ closed: [
2782
+ ];
2783
+ updated: [
2784
+ Room
2785
+ ];
2786
+ seated: [
2787
+ Room
2788
+ ];
2789
+ partyQueued: [
2790
+ PartyTicket
2791
+ ];
2792
+ listed: [
2793
+ RoomPage
2794
+ ];
2795
+ mineListed: [
2796
+ readonly RoomSummary[]
2797
+ ];
2798
+ memberJoined: [
2799
+ string
2800
+ ];
2801
+ memberLeft: [
2802
+ string
2803
+ ];
2804
+ kicked: [
2805
+ ];
2806
+ readyChanged: [
2807
+ string,
2808
+ boolean
2809
+ ];
2810
+ hostChanged: [
2811
+ string
2812
+ ];
2813
+ matchStartWaiting: [
2814
+ StartMatchWaiting
2815
+ ];
2816
+ matchAutoStartFailed: [
2817
+ MatchAutoStartFailed
2818
+ ];
2819
+ matchAllocationStarted: [
2820
+ string
2821
+ ];
2822
+ matchReady: [
2823
+ ReadyMatch
2824
+ ];
2825
+ matchFailed: [
2826
+ string,
2827
+ string
2828
+ ];
2829
+ matchEnded: [
2830
+ MatchEnded
2831
+ ];
2832
+ matchSuspended: [
2833
+ MatchSuspended
2834
+ ];
2835
+ matchReconnecting: [
2836
+ MatchReconnecting
2837
+ ];
2838
+ matchReconnected: [
2839
+ MatchReconnected
2840
+ ];
2841
+ versionUpdateAvailable: [
2842
+ ClientPlatform$1 | undefined
2843
+ ];
2844
+ error: [
2845
+ RoomOperationError
2846
+ ];
2587
2847
  }
2588
- interface GemStorePurchaseResult {
2589
- readonly gem: typeof PROTOCOL;
2590
- readonly type: "gem.storePurchaseResult";
2591
- readonly requestId: string;
2592
- readonly outcome: "ok" | "declined" | "unavailable";
2848
+ type RoomEventName = keyof RoomEventMap;
2849
+ interface MatchEndHint {
2850
+ readonly matchId?: string;
2593
2851
  readonly reason?: string;
2594
2852
  }
2595
- interface GemStorePurchaseSettled {
2596
- readonly gem: typeof PROTOCOL;
2597
- readonly type: "gem.storePurchaseSettled";
2598
- readonly skuId: string;
2853
+ interface RelayedRoomEvent {
2854
+ readonly event: "updated" | "match_started" | "match_ready" | "match_failed" | "version_stale";
2855
+ readonly roomId: string;
2856
+ readonly matchId?: string;
2857
+ readonly version?: number;
2858
+ readonly reason?: string;
2859
+ readonly platform?: ClientPlatform$1;
2599
2860
  }
2600
- interface GemRequestStoreOfferSheet {
2601
- readonly gem: typeof PROTOCOL;
2602
- readonly type: "gem.requestStoreOfferSheet";
2603
- readonly requestId: string;
2604
- readonly skuId: string;
2861
+ interface StartMatchOptions {
2862
+ readonly clusterTargetId?: ClusterTargetLike;
2863
+ readonly retry?: StartMatchRetryOptions;
2864
+ readonly signal?: AbortSignal;
2605
2865
  }
2606
- interface GemStoreOfferSheetResult {
2607
- readonly gem: typeof PROTOCOL;
2608
- readonly type: "gem.storeOfferSheetResult";
2609
- readonly requestId: string;
2610
- readonly outcome: "ok" | "declined" | "unavailable";
2611
- readonly reason?: string;
2866
+ interface AwaitMatchOptions {
2867
+ readonly timeoutMs?: number;
2868
+ readonly pollIntervalMs?: number;
2869
+ readonly signal?: AbortSignal;
2870
+ }
2871
+ interface StartedMatch {
2872
+ readonly matchId: string;
2873
+ readonly status: string;
2874
+ }
2875
+ interface RoomManager {
2876
+ create(options: CreateRoomOptions): Promise<Room>;
2877
+ join(roomId: string, options?: JoinRoomOptions): Promise<Room>;
2878
+ joinByCode(code: string, options?: JoinRoomOptions): Promise<Room>;
2879
+ quickJoin(options: QuickJoinOptions): Promise<Room>;
2880
+ queueForMatch(options: QueueForMatchOptions): Promise<MatchTicket>;
2881
+ list(options?: ListRoomsOptions): Promise<RoomPage>;
2882
+ myRooms(signal?: AbortSignal): Promise<readonly RoomSummary[]>;
2883
+ leave(options?: {
2884
+ asGroup?: boolean;
2885
+ signal?: AbortSignal;
2886
+ keepalive?: boolean;
2887
+ }): Promise<void>;
2888
+ leaveAll(signal?: AbortSignal): Promise<readonly string[]>;
2889
+ close(signal?: AbortSignal): Promise<void>;
2890
+ refresh(signal?: AbortSignal): Promise<Room | null>;
2891
+ setReady(isReady: boolean, signal?: AbortSignal): Promise<Room>;
2892
+ kick(playerId: string, signal?: AbortSignal): Promise<Room>;
2893
+ transferHost(playerId: string, signal?: AbortSignal): Promise<Room>;
2894
+ update(options: UpdateRoomOptions): Promise<Room>;
2895
+ startMatch(options?: StartMatchOptions): Promise<StartedMatch>;
2896
+ awaitMatch(options?: AwaitMatchOptions): Promise<ReadyMatch>;
2897
+ pollMatchStatus(options?: AwaitMatchOptions): Promise<ReadyMatch>;
2898
+ notifyMatchConnected(matchId: string): void;
2899
+ notifyMatchDisconnected(cause?: string): Promise<void>;
2900
+ reconnectToMatch(options?: AwaitMatchOptions): Promise<ReadyMatch>;
2901
+ notifyLeavingMatch(options?: {
2902
+ keepalive?: boolean;
2903
+ }): Promise<void>;
2904
+ readonly gameId: string | null;
2905
+ readonly currentRoom: Room | null;
2906
+ readonly currentTicket: MatchTicket | null;
2907
+ readonly partyTicket: PartyTicket | null;
2908
+ readonly currentMatch: ReadyMatch | null;
2909
+ readonly matchConnectionState: MatchConnectionState;
2910
+ readonly matchSession: MatchSession;
2911
+ readonly isInRoom: boolean;
2912
+ readonly isHost: boolean;
2913
+ readonly members: readonly Room["members"][number][];
2914
+ readonly playWith: PlayWithOutcome | null;
2915
+ on<K extends RoomEventName>(event: K, listener: (...args: RoomEventMap[K]) => void): () => void;
2916
+ off<K extends RoomEventName>(event: K, listener: (...args: RoomEventMap[K]) => void): void;
2917
+ once<K extends RoomEventName>(event: K, listener: (...args: RoomEventMap[K]) => void): () => void;
2918
+ handleRoomEvent(event: RelayedRoomEvent): void;
2919
+ handleSeated(roomId: string): void;
2920
+ handleAutoStartFailed(roomId: string, code: string): void;
2921
+ handleTicketEvent(event: RelayedTicketEvent): void;
2922
+ reconcileSeats(): Promise<void>;
2923
+ reconcile(hint?: MatchEndHint): Promise<void>;
2924
+ startPolling(intervalMs?: number): void;
2925
+ stopPolling(): void;
2926
+ settled(): Promise<void>;
2927
+ dispose(): void;
2612
2928
  }
2613
2929
  interface ConnectOptions {
2614
2930
  readonly clusterTargetId?: ClusterTargetLike;
@@ -3027,9 +3343,15 @@ interface GemServerHost extends ServerBundleHost {
3027
3343
  broadcast(data: string | Uint8Array, options?: BroadcastOptions): void;
3028
3344
  kick(playerId: string, reason?: string): void;
3029
3345
  endMatch?(): Promise<"ok" | "already_ended" | "refused" | "failed" | (string & {})>;
3346
+ passes?(playerId: string): Promise<GemServerHostRead>;
3347
+ boost?(playerId: string): Promise<GemServerHostRead>;
3030
3348
  log(message: string): void;
3031
3349
  warn(message: string): void;
3032
3350
  }
3351
+ interface GemServerHostRead {
3352
+ readonly status: number;
3353
+ readonly body: unknown;
3354
+ }
3033
3355
  interface HostTokenSourceOptions {
3034
3356
  readonly clock: Clock;
3035
3357
  readonly timeoutMs?: number;
@@ -4608,6 +4930,15 @@ interface ServerListChallengesOptions {
4608
4930
  interface ServerChallenges {
4609
4931
  list(options: ServerListChallengesOptions): Promise<Challenge[]>;
4610
4932
  }
4933
+ interface MatchBoostMultiplier {
4934
+ readonly currencySlug: string;
4935
+ readonly multiplier: number;
4936
+ }
4937
+ interface MatchPlayerBoost {
4938
+ readonly active: boolean;
4939
+ readonly multipliers: readonly MatchBoostMultiplier[];
4940
+ readonly expiresInDays?: number;
4941
+ }
4611
4942
  interface GemServerOptions {
4612
4943
  readonly baseUrl?: string;
4613
4944
  readonly clock?: Clock;
@@ -4646,7 +4977,10 @@ interface GemServer {
4646
4977
  readonly seats?: number;
4647
4978
  }, signal?: AbortSignal): Promise<MatchBackfillState>;
4648
4979
  reportPlayers(reports: readonly MatchPlayerReport[], signal?: AbortSignal): Promise<MatchPlayerReportResult[]>;
4980
+ playerPasses(playerId: string, signal?: AbortSignal): Promise<readonly GamePass[]>;
4981
+ playerBoost(playerId: string, signal?: AbortSignal): Promise<MatchPlayerBoost>;
4649
4982
  };
4983
+ readonly earnings: EarningsApi;
4650
4984
  readonly analytics: ServerAnalytics;
4651
4985
  readonly functions: FunctionsApi;
4652
4986
  readonly challenges: ServerChallenges;
@@ -4816,177 +5150,6 @@ interface AccountApi {
4816
5150
  onSignInAvailableChange(listener: (available: boolean) => void): () => void;
4817
5151
  requestSignIn(): Promise<SignInOutcome>;
4818
5152
  }
4819
- interface PlayerBoostMultiplier {
4820
- readonly currencyId: string;
4821
- readonly currencySlug: string;
4822
- readonly multiplier: number;
4823
- }
4824
- interface PlayerBoost {
4825
- readonly active: boolean;
4826
- readonly multipliers: readonly PlayerBoostMultiplier[];
4827
- readonly expiresInDays?: number;
4828
- }
4829
- interface RewardCue {
4830
- currencySlug: string;
4831
- cueId?: string;
4832
- expected?: number;
4833
- origin?: {
4834
- x: number;
4835
- y: number;
4836
- };
4837
- }
4838
- type GemCorner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
4839
- type RewardPresentation = "arcade" | "game";
4840
- interface MenuStyle {
4841
- readonly ground: string;
4842
- readonly accent: string;
4843
- }
4844
- type FrameState = "waiting" | "connected" | "refused" | "closed";
4845
- interface FramePlayer extends PlayerIdentity {
4846
- readonly displayName: PlayerText;
4847
- readonly displayHandle: PlayerText;
4848
- readonly avatarUrl?: string;
4849
- readonly boost: PlayerBoost;
4850
- }
4851
- type GemArcadeAsk = Omit<GemRequestAppLinks, "gem"> | Omit<GemRequestOpenApp, "gem"> | Omit<GemRequestOpenGame, "gem"> | Omit<GemRequestSimilarGames, "gem"> | Omit<GemRequestStoreOffers, "gem"> | Omit<GemRequestStorePurchase, "gem"> | Omit<GemRequestStoreOfferSheet, "gem">;
4852
- type GemFriendsWindowAsk = Omit<GemRequestPlayInvite, "gem"> | Omit<GemInviteParams, "gem">;
4853
- type GemArcadeAnswer = GemAppLinksResult | GemOpenAppResult | GemOpenGameResult | GemSimilarGamesResult | GemStoreOffersResult | GemStorePurchaseResult | GemStorePurchaseSettled | GemStoreOfferSheetResult;
4854
- interface FrameCallbacks {
4855
- onToken?(msg: GemToken): void;
4856
- onPause?(msg: GemPause): void;
4857
- onMenuSelect?(msg: GemMenuSelect): void;
4858
- onSettingChange?(msg: GemSettingChange): void;
4859
- onPrefs?(msg: GemPrefs$1): void;
4860
- onCohorts?(msg: GemCohorts$1): void;
4861
- onEarnAllowanceChanged?(): void;
4862
- onInventoryChanged?(msg: GemInventoryChanged): void;
4863
- onViewport?(msg: GemViewport$1): void;
4864
- onWillTerminate?(msg: GemWillTerminate): void;
4865
- onDevtools?(action: "open" | "close" | "toggle"): void;
4866
- onScreenshot?(request: {
4867
- maxWidth: number;
4868
- maxHeight: number;
4869
- }, port: MessagePort, deny: (reason: GemScreenshotDenied["reason"], retryable: boolean) => void): void;
4870
- onRequestContext?(): void;
4871
- onTokenDenied?(msg: GemTokenDenied): void;
4872
- onLocalServer?(msg: GemLocalServer): void;
4873
- onLocalServerDenied?(msg: GemLocalServerDenied): void;
4874
- onPlayer?(player: FramePlayer, signInAvailable?: boolean): void;
4875
- onRoomEvent?(msg: GemRoomEvent): void;
4876
- onSeatedEvent?(msg: GemSeatedEvent): void;
4877
- onAutoStartFailedEvent?(msg: GemAutoStartFailedEvent): void;
4878
- onTicketEvent?(msg: GemTicketEvent): void;
4879
- onSocketState?(msg: GemSocketState): void;
4880
- onSignalEvent?(msg: GemSignalEvent): void;
4881
- onRelayDraining?(msg: GemRelayDraining): void;
4882
- onDedicatedEvent?(msg: GemDedicatedEvent): void;
4883
- onClusterTarget?(msg: GemClusterTarget): void;
4884
- onGraphicsRoutes?(msg: GemGraphicsRoutes): void;
4885
- onPartyResult?(msg: GemPartyResult): void;
4886
- onPurchaseResult?(msg: GemPurchaseResult): void;
4887
- onPurchaseSettled?(msg: GemPurchaseSettled): void;
4888
- onShareResult?(msg: GemShareResult): void;
4889
- onDeviceSettings?(msg: GemDeviceSettings): void;
4890
- onDeviceSettingsResult?(msg: GemDeviceSettingsResult): void;
4891
- onAdResult?(msg: GemAdResult): void;
4892
- onMomentResult?(msg: GemMomentResult): void;
4893
- onSignInResult?(msg: GemSignInResult): void;
4894
- onFriendChallengeResult?(msg: GemFriendChallengeResult): void;
4895
- onArcadeAnswer?(msg: GemArcadeAnswer): void;
4896
- onPlayInviteResult?(msg: GemPlayInviteResult): void;
4897
- onError?(code: GemErrorCode, message?: string): void;
4898
- onDropped?(code: GemErrorCode, message?: string): void;
4899
- onStateChange?(state: FrameState): void;
4900
- onRefused?(reason: string): void;
4901
- }
4902
- interface FrameOptions extends FrameCallbacks {
4903
- allowedEmbedders: readonly string[];
4904
- selfOrigin?: string;
4905
- expectedSource: unknown;
4906
- capabilities?: readonly string[];
4907
- clock?: Clock;
4908
- }
4909
- declare class GemFrame {
4910
- private readonly options;
4911
- private state;
4912
- private port;
4913
- private version;
4914
- private peerCapabilities;
4915
- private unbidden;
4916
- private engagedSent;
4917
- private readyPending;
4918
- private readySent;
4919
- private settleWaiters;
4920
- private readonly clock;
4921
- private readonly inbound;
4922
- private readonly outbound;
4923
- private readonly expectedSource;
4924
- constructor(options: FrameOptions);
4925
- get currentState(): FrameState;
4926
- get parentCapabilities(): readonly string[];
4927
- parentSupports(capability: string): boolean;
4928
- get protocolVersion(): number | null;
4929
- get unbiddenLaunch(): boolean;
4930
- handleWindowMessage(event: HandshakeEvent): boolean;
4931
- ready(): void;
4932
- settled(timeoutMs?: number): Promise<FrameState>;
4933
- progress(loaded: number, total: number): void;
4934
- requestToken(requestId: string, reason: "initial" | "expiring" | "rejected"): void;
4935
- requestLocalServer(requestId: string, gameRoomId: string): boolean;
4936
- exit(reason?: string): void;
4937
- openExternal(url: string): void;
4938
- requestFullscreen(enabled: boolean): void;
4939
- reportMuted(muted: boolean): boolean;
4940
- reportEngaged(): boolean;
4941
- cueReward(cue: RewardCue): boolean;
4942
- showPortraitBorders(name: string | null): boolean;
4943
- setWalletVisible(visible: boolean, options?: {
4944
- only?: readonly string[];
4945
- }): boolean;
4946
- setMenu(items?: ReadonlyArray<{
4947
- readonly id: string;
4948
- readonly label: string;
4949
- }>): boolean;
4950
- declareSettings(settings: GemSettingsDeclare["settings"]): boolean;
4951
- setGemCorner(corner: GemCorner): boolean;
4952
- setRewardPresentation(mode: RewardPresentation): boolean;
4953
- setMenuStyle(style: MenuStyle | null): boolean;
4954
- requestShare(params: ReadonlyArray<{
4955
- readonly key: string;
4956
- readonly value: string;
4957
- }>, requestId?: string): boolean;
4958
- requestAvatarPicker(tab?: "2d" | "3d"): boolean;
4959
- requestVibrate(pattern: readonly number[]): boolean;
4960
- reportFrameStats(stats: {
4961
- fps: number;
4962
- frameTimeP95Ms: number;
4963
- counts?: "pageFrames" | "gameDraws";
4964
- }): boolean;
4965
- sendGameContext(context: Record<string, unknown>): boolean;
4966
- signal(signal: string, matchId: string, data: Record<string, unknown>): void;
4967
- dedicatedOffer(matchId: string, sdp: string, intent: GemDedicatedOffer["intent"]): void;
4968
- requestParty(requestId: string): boolean;
4969
- requestPurchase(requestId: string, purchaseKind: "item" | "recipe", targetId: string, currencySlug: string, quantity?: number, catalogId?: string, origin?: "sheet" | "direct_refused"): boolean;
4970
- requestAvatar3dPurchase(requestId: string, itemId: string, currencySlug: string): boolean;
4971
- putDeviceSettings(requestId: string, settings: Readonly<Record<string, unknown>>): boolean;
4972
- requestAd(requestId: string, placement: string, format: "interstitial" | "rewarded"): boolean;
4973
- signalMoment(requestId: string, kind: string, placement?: string, wall?: boolean): boolean;
4974
- readyCalled(): boolean;
4975
- requestSignIn(requestId: string): boolean;
4976
- requestFriendChallenge(requestId: string, playerId: string, template: string, params?: Readonly<Record<string, string | number>>): boolean;
4977
- requestArcade(msg: GemArcadeAsk | GemFriendsWindowAsk): boolean;
4978
- close(): void;
4979
- private transition;
4980
- private refuseMalformed;
4981
- private dropUnknownType;
4982
- private refuse;
4983
- private fail;
4984
- private gated;
4985
- private send;
4986
- private receive;
4987
- private dispatchInbound;
4988
- private screenshotDenied;
4989
- }
4990
5153
  interface ShareRequest {
4991
5154
  readonly params?: Readonly<Record<string, string>>;
4992
5155
  }
@@ -4999,11 +5162,6 @@ interface ShareApi {
4999
5162
  readonly available: boolean;
5000
5163
  request(request?: ShareRequest): Promise<void>;
5001
5164
  }
5002
- type ArcadeOutcomeKind = "ok" | "declined" | "unavailable";
5003
- interface ArcadeOutcome {
5004
- readonly outcome: ArcadeOutcomeKind;
5005
- readonly reason?: string;
5006
- }
5007
5165
  type AppStore = "app_store" | "google_play";
5008
5166
  interface AppListing {
5009
5167
  readonly store: AppStore;
@@ -5041,32 +5199,6 @@ interface ArcadeApi {
5041
5199
  readonly limit?: number;
5042
5200
  }): Promise<SimilarGamesOutcome>;
5043
5201
  }
5044
- interface ArcadeOffer {
5045
- readonly skuId: string;
5046
- readonly kind: "gem_pack" | "boost" | "pass" | "bundle";
5047
- readonly name: string;
5048
- readonly description: string;
5049
- readonly imageUrl?: string;
5050
- readonly priceDisplay: string;
5051
- readonly grant?: {
5052
- readonly currency: string;
5053
- readonly amount: number;
5054
- };
5055
- }
5056
- interface StoreOffersOutcome extends ArcadeOutcome {
5057
- readonly offers: readonly ArcadeOffer[];
5058
- }
5059
- interface StoreSettlement {
5060
- readonly skuId: string;
5061
- }
5062
- interface StoreApi {
5063
- readonly available: boolean;
5064
- readonly showOfferAvailable: boolean;
5065
- offers(): Promise<StoreOffersOutcome>;
5066
- purchase(skuId: string): Promise<ArcadeOutcome>;
5067
- showOffer(skuId: string): Promise<ArcadeOutcome>;
5068
- onSettled(listener: (settlement: StoreSettlement) => void): () => void;
5069
- }
5070
5202
  type BrandingTheme = "light" | "dark";
5071
5203
  interface BrandingVariant {
5072
5204
  readonly url: string;
@@ -5291,6 +5423,7 @@ interface GemPlayer extends PlayerIdentity {
5291
5423
  readonly displayHandle: PlayerText;
5292
5424
  readonly avatarUrl?: string;
5293
5425
  readonly boost: PlayerBoost;
5426
+ readonly isGuest: boolean;
5294
5427
  }
5295
5428
  interface GemPrefs {
5296
5429
  readonly reducedMotion: boolean;
@@ -5378,6 +5511,7 @@ interface Gem {
5378
5511
  readonly characters: CharactersApi;
5379
5512
  readonly transfers: TransfersApi;
5380
5513
  readonly gameConfig: GameConfigApi;
5514
+ readonly earnings: EarningsApi;
5381
5515
  readonly purchases: PurchaseApi;
5382
5516
  readonly deviceSettings: DeviceSettingsApi;
5383
5517
  readonly graphics: GraphicsApi;
@@ -5445,4 +5579,4 @@ interface ExitAnalytics {
5445
5579
  }
5446
5580
  declare function leaveAndExit(rooms: ExitRooms, bridge: ExitBridge | null, reason?: string, analytics?: ExitAnalytics): Promise<void>;
5447
5581
  declare function createGem(options?: GemOptions): Gem;
5448
- export { ARCADE_EMBEDDERS, AVATAR_RIGS, type AccountApi, type AdFormat, type AdOutcome, type AdOutcomeKind, type AdRequest, type AdsApi, AnalyticsApi, type AnalyticsFlushOptions, type AnalyticsFlushResult, type AnalyticsOptions, type AnalyticsRejection$1 as AnalyticsRejection, type AnalyticsValue, type AppLinksOutcome, type AppListing, type AppStore, type ArcadeApi, type ArcadeAvailability, type ArcadeOffer, type ArcadeOutcome, type ArcadeOutcomeKind, AuthError, type AuthFailure, type AuthState, type Avatar3dFamily, type Avatar3dOffer, type Avatar3dPrice, type Avatar3dPurchaseRequest, type AvatarRigNode, type AvatarRigs, type Avatars3dApi, type Base64String, type BootMark, type BootTimeline, type BrandingApi, type BrandingAsset, type BrandingAssetOptions, type BrandingCurrency, type BrandingImageOptions, type BrandingList, type BrandingLookup, type BrandingTheme, type BrandingVariant, type BroadcastOptions, type BytesResponse, CONDITIONAL_HEADERS, type Challenge, type ChallengeWindow, ChallengesApi, type ClientOptions, type Clock, type ConditionalRequestHeaders, type ConfiguredPurchasePayment, type ConfiguredPurchaseRequest, type ConfiguredPurchaseResult, type ControlsApi, DEVICE_SETTINGS_MAX_BYTES, DedicatedServerError, type DedicatedServerFailure, type DedicatedServerSession, type DevToolsOpener, type DeviceSettings, type DeviceSettingsApi, type DeviceSettingsPutOutcome, type DirectPurchaseRequest, type DirectPurchaseResult, type EarnAllowance, type EarnAllowanceEvent, type EarnAllowancePeriod, type EarnAllowanceReadOptions, type EntityLeaderboard, type EntityLeaderboardEntry, type EntityLeaderboardOptions, type EntityType$1 as EntityType, type ExitAnalytics, type ExitBridge, type ExitRooms, type FrameState, type Friend, type FriendChallenge, FriendChallengeError, type FriendChallengeErrorCode, type FriendChallengeOutcome, type FriendChallengeOutcomeKind, type FriendChallengeRequest, type FriendChallengesPage, FriendsApi, type FriendsPage, type FunctionFailure, type FunctionInvokeOptions, type FunctionResult, FunctionsApi, type GameApi, type GameCard, type GameConfig, type GameMenu, type GameMenuItem, type GamePass, type GameServerLink, type GameSettingsApi, type Gem, GemApiError, type GemAudioChannels, GemClient, type GemCohort, type GemCohorts, GemConfigError, type GemControlBox, type GemCorner, type GemDevTools, type GemErrorReason, GemFrame, GemFunctionError, type GemGameChoiceSetting, type GemGameSetting, type GemGameSettingBase, type GemGameSettingChange, type GemGameSettingIcon, type GemGameSettingOption, type GemGameSettingValue, type GemGameSliderSetting, type GemGameToggleSetting, type GemGraphicsQuality, type GemGraphicsRoute, type GemGraphicsRouteEntry, type GemIdentity, type GemInsets, type GemLook, type GemLookBase, type GemLookDelta, type GemLookOptions, type GemLookSpeed, type GemMatchApi, type GemMatchServer, type GemMatchServerModule, type GemOptions, type GemPlayer, type GemPreferredRoute, type GemPrefs, type GemRecommendedSettings, type GemReservedArea, GemSaveError, type GemServer, type GemServerBundle, type GemServerFactory, type GemServerHost, type GemServerHostProfile, type GemServerIdentity, type GemServerLifecycle, type GemServerOptions, type GemServerProfile, type GemTerminationNotice, GemUnframedError, type GemViewport, type GetLeaderboardOptions, type GraphicsApi, type HostTokenSource, type HostTokenSourceOptions, type JoinWelcome, type Leaderboard, type LeaderboardEntry, type LeaderboardPeriod, LeaderboardsApi, type ListChallengesOptions, type ListFriendChallengesOptions, type ListFriendsOptions, MAX_PERIODS_BACK, type MatchBackfillState, type MatchConnectOptions, type MatchConnection, type MatchHosting, type MatchHostingMode, type MatchPlayerReport, type MatchPlayerReportResult, type MatchServeOptions, type MatchTransport, type MenuStyle, type MessageMeta, type MomentKind, type MomentResult, type MomentSignal, type MomentsApi, type MultiTransportSession, PLATFORM_EVENTS, type PassesApi, type PassesEvent, type PeriodOptions, PlatformApi, PlatformCurrenciesApi, type PlatformCurrency, type PlatformCurrencyAccess, type PlatformCurrencyPurchasePayment, type PlatformCurrencyPurchaseRequest, type PlatformCurrencyPurchaseResult, type PlatformCurrencyReadOptions, PlatformEarnAllowanceApi, type PlatformEventName, type PlayInviteRequest, type PlayerBadge$1 as PlayerBadge, type PlayerBoost, type PlayerBoostMultiplier, type PlayerIdentity, type PlayerProfile, type PlayerScope, PlayerText, type PreferredRouteOptions, type ProfileCallOptions, type ProfileShowcaseEntry$1 as ProfileShowcaseEntry, ProfilesApi, type PurchaseApi, type PurchaseOptions, type PurchaseOutcome, PurchaseRefusal, type PurchaseRefusalCode, type PurchaseRequest, type PurchaseSettlement, type PutBytesOptions, type PutSaveOptions, type RankedRow, type RecipeAvailability, type RecipeLock, type RequestOptions, type RewardCue, type RewardPresentation, type RewardedOption, type RewardedStatus, type RoomArgValue, type SavePage, type SaveRecord, type SendOptions$1 as SendOptions, type ServerApi, type ServerBundleHost, type ServerTokenGrant, type SessionEndReason, type ShareApi, ShareRefusal, type ShareRequest, ShowcaseApi, type ShowcaseCallOptions, type ShowcaseFriendEntry, type ShowcaseFriends, type ShowcaseValue, type SignInOutcome, type SignInOutcomeKind, type SimilarGamesOutcome, type SnapshotCurrency, type SnapshotItem, type StoreApi, type StoreOffersOutcome, type StoreSettlement, type TokenGrant, type Transport, type TransportAdvert, type TransportKind, TransportRefusal, type TransportRequest, type TransportResponse, UNRELIABLE_CHANNEL_LABEL, type VersionedGetOptions, type VersionedResponse, type VibrationApi, type WalletVisibleOptions, type WornAvatar3d$1 as WornAvatar3d, asPlayerText, createBootTimeline, createGem, createGemServer, createHostTokenSource, createMatchServer, defineServer, experimentSelection, leaveAndExit, mapIdentity, markOnResolve, platformIconUrl, presentJoinCredential, readTemplateTransports, readTransportAdvert, reportOnResolve, systemClock, text, toBase64, webTransportAvailable };
5582
+ export { ARCADE_EMBEDDERS, AVATAR_RIGS, type AccountApi, type AdFormat, type AdOutcome, type AdOutcomeKind, type AdRequest, type AdsApi, AnalyticsApi, type AnalyticsFlushOptions, type AnalyticsFlushResult, type AnalyticsOptions, type AnalyticsRejection$1 as AnalyticsRejection, type AnalyticsValue, type AppLinksOutcome, type AppListing, type AppStore, type ArcadeApi, type ArcadeAvailability, type ArcadeOffer, type ArcadeOfferEarnMultiplier, type ArcadeOfferKind, type ArcadeOutcome, type ArcadeOutcomeKind, AuthError, type AuthFailure, type AuthState, type Avatar3dFamily, type Avatar3dOffer, type Avatar3dPrice, type Avatar3dPurchaseRequest, type AvatarRigNode, type AvatarRigs, type Avatars3dApi, type Base64String, type BonusPreview, type BootMark, type BootTimeline, type BrandingApi, type BrandingAsset, type BrandingAssetOptions, type BrandingCurrency, type BrandingImageOptions, type BrandingList, type BrandingLookup, type BrandingTheme, type BrandingVariant, type BroadcastOptions, type BytesResponse, CONDITIONAL_HEADERS, type Challenge, type ChallengeWindow, ChallengesApi, type ClientOptions, type Clock, type ConditionalRequestHeaders, type ConfigPreview, type ConfiguredPurchasePayment, type ConfiguredPurchaseRequest, type ConfiguredPurchaseResult, type ControlsApi, DEVICE_SETTINGS_MAX_BYTES, DedicatedServerError, type DedicatedServerFailure, type DedicatedServerSession, type DevToolsOpener, type DeviceSettings, type DeviceSettingsApi, type DeviceSettingsPutOutcome, type DirectPurchaseRequest, type DirectPurchaseResult, type EarnAllowance, type EarnAllowanceEvent, type EarnAllowancePeriod, type EarnAllowanceReadOptions, type EarningsApi, type EntityLeaderboard, type EntityLeaderboardEntry, type EntityLeaderboardOptions, type EntityType$1 as EntityType, type ExitAnalytics, type ExitBridge, type ExitRooms, type FrameState, type Friend, type FriendChallenge, FriendChallengeError, type FriendChallengeErrorCode, type FriendChallengeOutcome, type FriendChallengeOutcomeKind, type FriendChallengeRequest, type FriendChallengesPage, FriendsApi, type FriendsPage, type FunctionFailure, type FunctionInvokeOptions, type FunctionResult, FunctionsApi, type GameApi, type GameCard, type GameConfig, type GameMenu, type GameMenuItem, type GamePass, type GameServerLink, type GameSettingsApi, type Gem, GemApiError, type GemAudioChannels, GemClient, type GemCohort, type GemCohorts, GemConfigError, type GemControlBox, type GemCorner, type GemDevTools, type GemErrorReason, GemFrame, GemFunctionError, type GemGameChoiceSetting, type GemGameSetting, type GemGameSettingBase, type GemGameSettingChange, type GemGameSettingIcon, type GemGameSettingOption, type GemGameSettingValue, type GemGameSliderSetting, type GemGameToggleSetting, type GemGraphicsQuality, type GemGraphicsRoute, type GemGraphicsRouteEntry, type GemIdentity, type GemInsets, type GemLook, type GemLookBase, type GemLookDelta, type GemLookOptions, type GemLookSpeed, type GemMatchApi, type GemMatchServer, type GemMatchServerModule, type GemOptions, type GemPlayer, type GemPreferredRoute, type GemPrefs, type GemRecommendedSettings, type GemReservedArea, GemSaveError, type GemServer, type GemServerBundle, type GemServerFactory, type GemServerHost, type GemServerHostProfile, type GemServerHostRead, type GemServerIdentity, type GemServerLifecycle, type GemServerOptions, type GemServerProfile, type GemTerminationNotice, GemUnframedError, type GemViewport, type GetLeaderboardOptions, type GraphicsApi, type HostTokenSource, type HostTokenSourceOptions, type JoinWelcome, type Leaderboard, type LeaderboardEntry, type LeaderboardPeriod, LeaderboardsApi, type ListChallengesOptions, type ListFriendChallengesOptions, type ListFriendsOptions, MAX_PERIODS_BACK, type MatchBackfillState, type MatchBoostMultiplier, type MatchConnectOptions, type MatchConnection, type MatchHosting, type MatchHostingMode, type MatchPlayerBoost, type MatchPlayerReport, type MatchPlayerReportResult, type MatchServeOptions, type MatchTransport, type MenuStyle, type MessageMeta, type MomentKind, type MomentResult, type MomentSignal, type MomentsApi, type MultiTransportSession, PLATFORM_EVENTS, type PassUpsell, type PassesApi, type PassesEvent, type PeriodOptions, PlatformApi, PlatformCurrenciesApi, type PlatformCurrency, type PlatformCurrencyAccess, type PlatformCurrencyPurchasePayment, type PlatformCurrencyPurchaseRequest, type PlatformCurrencyPurchaseResult, type PlatformCurrencyReadOptions, PlatformEarnAllowanceApi, type PlatformEventName, type PlatformGrantPreview, type PlatformGrantSource, type PlayInviteRequest, type PlayerBadge$1 as PlayerBadge, type PlayerBoost, type PlayerBoostMultiplier, type PlayerIdentity, type PlayerProfile, type PlayerScope, PlayerText, type PreferredRouteOptions, PreviewError, type PreviewGrant, type PreviewTarget, type ProfileCallOptions, type ProfileShowcaseEntry$1 as ProfileShowcaseEntry, ProfilesApi, type PurchaseApi, type PurchaseOptions, type PurchaseOutcome, PurchaseRefusal, type PurchaseRefusalCode, type PurchaseRequest, type PurchaseSettlement, type PutBytesOptions, type PutSaveOptions, type RankedRow, type RecipeAvailability, type RecipeLock, type RequestOptions, type RewardCue, type RewardPresentation, type RewardedOption, type RewardedStatus, type RoomArgValue, type SavePage, type SaveRecord, type SendOptions$1 as SendOptions, type ServerApi, type ServerBundleHost, type ServerTokenGrant, type SessionEndReason, type ShareApi, ShareRefusal, type ShareRequest, type ShowPassOutcome, ShowcaseApi, type ShowcaseCallOptions, type ShowcaseFriendEntry, type ShowcaseFriends, type ShowcaseValue, type SignInOutcome, type SignInOutcomeKind, type SimilarGamesOutcome, type SnapshotCurrency, type SnapshotItem, type StoreApi, type StoreOffersOutcome, type StoreSettlement, type TokenGrant, type Transport, type TransportAdvert, type TransportKind, TransportRefusal, type TransportRequest, type TransportResponse, UNRELIABLE_CHANNEL_LABEL, type UnmetRequirement, type VersionedGetOptions, type VersionedResponse, type VibrationApi, type WalletVisibleOptions, type WornAvatar3d$1 as WornAvatar3d, asPlayerText, createBootTimeline, createGem, createGemServer, createHostTokenSource, createMatchServer, defineServer, experimentSelection, leaveAndExit, mapIdentity, markOnResolve, platformIconUrl, presentJoinCredential, readTemplateTransports, readTransportAdvert, reportOnResolve, systemClock, text, toBase64, webTransportAvailable };