@series-inc/rundot-game-sdk 5.22.0-beta.5 → 5.23.0-beta.0
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/{AdsApi-BMDHC7On.d.ts → AdsApi-25-HRS5D.d.ts} +86 -5
- package/dist/{chunk-RWCJU5GG.js → chunk-APR46OZQ.js} +178 -50
- package/dist/chunk-APR46OZQ.js.map +1 -0
- package/dist/{chunk-33BJAOLE.js → chunk-NTONRZFO.js} +6 -6
- package/dist/chunk-NTONRZFO.js.map +1 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +2 -2
- package/dist/mp-server/index.d.ts +224 -1
- package/dist/mp-server/index.js +214 -1
- package/dist/mp-server/index.js.map +1 -1
- package/dist/rundot-game-api/index.d.ts +2 -2
- package/dist/rundot-game-api/index.js +2 -2
- package/dist/sandbox/index.js +8 -6
- package/dist/sandbox/index.js.map +1 -1
- package/dist/vite/{dev-server-GV5N4RH3.js → dev-server-4TS6JS4G.js} +27 -2
- package/dist/vite/dev-server-4TS6JS4G.js.map +1 -0
- package/dist/vite/index.d.ts +64 -6
- package/dist/vite/index.js +166 -23
- package/dist/vite/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-33BJAOLE.js.map +0 -1
- package/dist/chunk-RWCJU5GG.js.map +0 -1
- package/dist/vite/dev-server-GV5N4RH3.js.map +0 -1
|
@@ -404,6 +404,12 @@ interface DeviceApi {
|
|
|
404
404
|
getDevice(): DeviceInfo;
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
+
interface PlatformCapabilities {
|
|
408
|
+
/** Rewarded/interstitial ads can be shown on this platform. */
|
|
409
|
+
readonly ads: boolean;
|
|
410
|
+
/** In-app purchases can be initiated on this platform. */
|
|
411
|
+
readonly purchases: boolean;
|
|
412
|
+
}
|
|
407
413
|
interface EnvironmentInfo {
|
|
408
414
|
readonly isDevelopment: boolean;
|
|
409
415
|
readonly platform: string;
|
|
@@ -415,6 +421,24 @@ interface EnvironmentInfo {
|
|
|
415
421
|
readonly isTablet: boolean;
|
|
416
422
|
readonly language: string;
|
|
417
423
|
};
|
|
424
|
+
/**
|
|
425
|
+
* Channel-static, host-gated feature availability. Synchronous and fixed
|
|
426
|
+
* for the session. A host that predates this field omits it on the wire;
|
|
427
|
+
* `HostEnvironmentApi` then defaults each capability to `true`.
|
|
428
|
+
*/
|
|
429
|
+
readonly capabilities: PlatformCapabilities;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* The INIT_SDK environment payload as it arrives over the wire / is stored on
|
|
433
|
+
* `_environmentData`. Identical to `EnvironmentInfo` except `capabilities` is
|
|
434
|
+
* optional (and partial), because a host older than the capabilities field
|
|
435
|
+
* omits it. `HostEnvironmentApi` upgrades this into a full `EnvironmentInfo`.
|
|
436
|
+
*/
|
|
437
|
+
interface RawEnvironmentInfo extends Omit<EnvironmentInfo, 'capabilities'> {
|
|
438
|
+
readonly capabilities?: {
|
|
439
|
+
readonly ads?: boolean;
|
|
440
|
+
readonly purchases?: boolean;
|
|
441
|
+
};
|
|
418
442
|
}
|
|
419
443
|
interface EnvironmentApi {
|
|
420
444
|
getEnvironment(): EnvironmentInfo;
|
|
@@ -1661,7 +1685,7 @@ type Protocol = {
|
|
|
1661
1685
|
interface JoinTicketRequest {
|
|
1662
1686
|
roomType: string;
|
|
1663
1687
|
roomCode?: string;
|
|
1664
|
-
action: 'create' | 'joinOrCreate' | 'joinByCode';
|
|
1688
|
+
action: 'create' | 'joinOrCreate' | 'joinByCode' | 'matchmake';
|
|
1665
1689
|
/**
|
|
1666
1690
|
* Equality constraints for matchmaking. A candidate room matches iff every
|
|
1667
1691
|
* key here exists on the room's stored criteria with a strictly-equal value.
|
|
@@ -1674,13 +1698,19 @@ interface JoinTicketRequest {
|
|
|
1674
1698
|
isPrivate?: boolean;
|
|
1675
1699
|
metadata?: Record<string, unknown>;
|
|
1676
1700
|
};
|
|
1701
|
+
/**
|
|
1702
|
+
* Stable key for a persistent room type (e.g. the current season's globe id),
|
|
1703
|
+
* resolved by the host from the platform `SeasonSchedule`. Routes the join to
|
|
1704
|
+
* the deterministic, version-independent persistent room (Phase 1 + Phase 13).
|
|
1705
|
+
*/
|
|
1706
|
+
persistentKey?: string;
|
|
1677
1707
|
}
|
|
1678
1708
|
/**
|
|
1679
1709
|
* Optional matchmaking/create knobs threaded through the client room APIs.
|
|
1680
|
-
*
|
|
1710
|
+
* All fields optional, so an omitted `RoomOptions` is the pre-WS6 path by
|
|
1681
1711
|
* construction — no runtime "did the caller pass options" guard is needed.
|
|
1682
1712
|
*/
|
|
1683
|
-
type RoomOptions = Pick<JoinTicketRequest, 'criteria' | 'createOptions'>;
|
|
1713
|
+
type RoomOptions = Pick<JoinTicketRequest, 'criteria' | 'createOptions' | 'persistentKey'>;
|
|
1684
1714
|
/** Summary of a realtime room, as listed by `multiplayer.getUserRooms()`. */
|
|
1685
1715
|
interface RealtimeRoomSummary {
|
|
1686
1716
|
roomId: string;
|
|
@@ -1699,6 +1729,16 @@ interface ListUserRoomsOptions {
|
|
|
1699
1729
|
includeDisposed?: boolean;
|
|
1700
1730
|
}
|
|
1701
1731
|
|
|
1732
|
+
/** A persisted room chat message (Req 20). Mirrors the server's ChatMessage. */
|
|
1733
|
+
interface ChatMessageData {
|
|
1734
|
+
id: string;
|
|
1735
|
+
roomId: string;
|
|
1736
|
+
senderId: string;
|
|
1737
|
+
senderName?: string;
|
|
1738
|
+
text: string;
|
|
1739
|
+
ts: number;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1702
1742
|
/**
|
|
1703
1743
|
* Server-authoritative room types used by the client multiplayer layer.
|
|
1704
1744
|
*/
|
|
@@ -1725,6 +1765,13 @@ interface ServerRoom<P extends Protocol> {
|
|
|
1725
1765
|
on(events: RoomEvents<P>): void;
|
|
1726
1766
|
/** Send a typed message to the server room. */
|
|
1727
1767
|
send(message: P): void;
|
|
1768
|
+
/**
|
|
1769
|
+
* Send a room chat message (Req 20). The server authorizes it against the live
|
|
1770
|
+
* roster, persists it, and delivers it to all members (incl. you) as `onChat`.
|
|
1771
|
+
*/
|
|
1772
|
+
sendChat(text: string): void;
|
|
1773
|
+
/** Request recent chat history; the reply arrives via `onChatHistory`. */
|
|
1774
|
+
fetchChatHistory(limit?: number): void;
|
|
1728
1775
|
/** Leave the room and close the connection. */
|
|
1729
1776
|
leave(): void;
|
|
1730
1777
|
/** Get estimated server time (local time + offset). */
|
|
@@ -1735,6 +1782,20 @@ interface RoomEvents<P extends Protocol> {
|
|
|
1735
1782
|
onMessage?: (message: P) => void;
|
|
1736
1783
|
/** Called when a targeted message is received */
|
|
1737
1784
|
onPrivateMessage?: (message: P) => void;
|
|
1785
|
+
/**
|
|
1786
|
+
* Called for an authoritative world delta (Req 7). Convenience wrapper over the
|
|
1787
|
+
* `world:delta` broadcast so games don't match on the msgType string.
|
|
1788
|
+
*/
|
|
1789
|
+
onDelta?: (delta: unknown) => void;
|
|
1790
|
+
/**
|
|
1791
|
+
* Called when the server asks the client to resync (a delta exceeded the WS
|
|
1792
|
+
* frame cap, or state diverged). The client should refetch full state.
|
|
1793
|
+
*/
|
|
1794
|
+
onResync?: (reason: string) => void;
|
|
1795
|
+
/** Called when a room chat message is delivered (Req 20). */
|
|
1796
|
+
onChat?: (message: ChatMessageData) => void;
|
|
1797
|
+
/** Called with the reply to {@link ServerRoom.fetchChatHistory}. */
|
|
1798
|
+
onChatHistory?: (messages: ChatMessageData[]) => void;
|
|
1738
1799
|
/** Called when a player joins the room */
|
|
1739
1800
|
onPlayerJoined?: (player: ServerPlayer) => void;
|
|
1740
1801
|
/** Called when a player leaves the room */
|
|
@@ -1751,6 +1812,12 @@ interface RoomEvents<P extends Protocol> {
|
|
|
1751
1812
|
onReconnecting?: () => void;
|
|
1752
1813
|
/** Called when reconnected */
|
|
1753
1814
|
onReconnected?: () => void;
|
|
1815
|
+
/**
|
|
1816
|
+
* Called when the server moved this player to another room (move_player /
|
|
1817
|
+
* Req 19). The socket stays open and now serves `roomId`; the game should
|
|
1818
|
+
* refetch state for the new room. {@link ServerRoom.roomCode} updates to match.
|
|
1819
|
+
*/
|
|
1820
|
+
onMoved?: (roomId: string) => void;
|
|
1754
1821
|
}
|
|
1755
1822
|
|
|
1756
1823
|
/**
|
|
@@ -1771,11 +1838,25 @@ interface MultiplayerApi {
|
|
|
1771
1838
|
* Join an existing room or create a new one (matchmaking by room type).
|
|
1772
1839
|
*/
|
|
1773
1840
|
joinOrCreateRoom<P extends Protocol>(roomType: string, opts?: RoomOptions): Promise<ServerRoom<P>>;
|
|
1841
|
+
/**
|
|
1842
|
+
* Server-authoritative PvP matchmaking (Req 18): request a match under
|
|
1843
|
+
* `opts.criteria`. Resolves once the platform pairs you with another player —
|
|
1844
|
+
* even if you land on different server instances — and joins you into the
|
|
1845
|
+
* shared room. The returned promise stays pending while waiting for an
|
|
1846
|
+
* opponent (up to `opts.matchmakeTimeoutMs`).
|
|
1847
|
+
*/
|
|
1848
|
+
matchmakeRoom<P extends Protocol>(roomType: string, opts?: MatchmakeOptions): Promise<ServerRoom<P>>;
|
|
1774
1849
|
/**
|
|
1775
1850
|
* List the realtime rooms the current user is a member of.
|
|
1776
1851
|
*/
|
|
1777
1852
|
getUserRooms(options?: ListUserRoomsOptions): Promise<RealtimeRoomSummary[]>;
|
|
1778
1853
|
}
|
|
1854
|
+
type MatchmakeOptions = Pick<RoomOptions, 'criteria'> & {
|
|
1855
|
+
/** How long to wait for an opponent before rejecting (default 120s). */
|
|
1856
|
+
matchmakeTimeoutMs?: number;
|
|
1857
|
+
/** How often to poll the pool while waiting (default 1s). */
|
|
1858
|
+
pollIntervalMs?: number;
|
|
1859
|
+
};
|
|
1779
1860
|
|
|
1780
1861
|
interface LoggingApi {
|
|
1781
1862
|
logDebug(message: string, ...args: any[]): void;
|
|
@@ -4211,7 +4292,7 @@ interface RundotGameAPI {
|
|
|
4211
4292
|
config: Record<string, never>;
|
|
4212
4293
|
_profileData?: Profile;
|
|
4213
4294
|
_deviceData?: DeviceInfo;
|
|
4214
|
-
_environmentData?:
|
|
4295
|
+
_environmentData?: RawEnvironmentInfo;
|
|
4215
4296
|
_safeAreaData?: SafeArea;
|
|
4216
4297
|
_localeData?: string;
|
|
4217
4298
|
_languageCodeData?: string;
|
|
@@ -4457,4 +4538,4 @@ interface AdsApi {
|
|
|
4457
4538
|
showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
|
|
4458
4539
|
}
|
|
4459
4540
|
|
|
4460
|
-
export { type EnvironmentInfo as $, type AnalyticsApi as A, type BatchRecipeRequirementsResult as B, type NotificationsApi as C, type ScheduleLocalNotification as D, type ScheduleNotificationOptions as E, type RCSAvailabilityStatus as F, type ScheduleRCSInput as G, type Host as H, type ScheduleRCSResult as I, type RequestRCSOptInInput as J, type RequestRCSOptInResult as K, type PopupsApi as L, type ShowToastOptions as M, type NavigationApi as N, type LikeDialogResult as O, type Profile as P, type QuitOptions as Q, type RundotGameAPI as R, type SimulationActiveRunsUpdate as S, type CommentsPanelResult as T, type LikeStateResult as U, type ShowInterstitialAdOptions as V, type ShowRewardedAdOptions as W, type ProfileApi as X, type DeviceApi as Y, type DeviceInfo as Z, type EnvironmentApi as _, type RecipeRequirementQuery as a, type ListRoomsOptions as a$, type SystemApi as a0, type SafeArea as a1, type AddToHomeScreenResult as a2, type CdnApi as a3, type FetchFromCdnOptions as a4, type AssetUrlResult as a5, type TimeApi as a6, type ServerTimeData as a7, type GetFutureTimeOptions as a8, type AiApi as a9, type SimulationAvailableItem as aA, type SimulationPowerPreview as aB, type SimulationSlotMutationResult as aC, type SimulationSlotContainer as aD, type SimulationAssignment as aE, type SimulationState as aF, type ExecuteRecipeOptions as aG, type ExecuteRecipeResponse as aH, type CollectRecipeResult as aI, type ResetStateOptions as aJ, type ResetStateResult as aK, type GetActiveRunsOptions as aL, type ExecuteScopedRecipeOptions as aM, type ExecuteScopedRecipeResult as aN, type GetAvailableRecipesOptions as aO, type GetAvailableRecipesResult as aP, type Recipe as aQ, type GetBatchRecipeRequirements as aR, type TriggerRecipeChainOptions as aS, type RoomDataUpdate as aT, type RoomMessageEvent as aU, type ProposedMoveEvent as aV, RundotGameTransport as aW, type RoomsApi as aX, type CreateRoomOptions as aY, type JoinOrCreateRoomOptions as aZ, type JoinOrCreateResult as a_, type AiChatCompletionRequest as aa, type AiChatCompletionData as ab, type AiChatCompletionStreamOptions as ac, type AiChatCompletionStreamChunk as ad, type HapticsApi as ae, HapticFeedbackStyle as af, type GamepadSnapshot as ag, type GamepadConnectionEvent as ah, type Subscription as ai, type GamepadApi as aj, type GamepadLatencyStats as ak, type FeaturesApi as al, type Experiment as am, type LifecycleApi as an, type SleepCallback as ao, type AwakeCallback as ap, type PauseCallback as aq, type ResumeCallback as ar, type QuitCallback as as, type BackButtonCallback as at, type IdentityChangedCallback as au, type IdentityChangedEvent as av, type SimulationApi as aw, type SimulationSlotValidationResult as ax, type SimulationBatchOperation as ay, type SimulationBatchOperationsResult as az, type RecipeRequirementResult as b, type AdminThreeDGenApi as b$, type UpdateRoomDataOptions as b0, type RoomMessageRequest as b1, type StartRoomGameOptions as b2, type ProposeMoveRequest as b3, type ProposeMoveResult as b4, type ValidateMoveVerdict as b5, type ValidateMoveResult as b6, type RoomSubscriptionOptions as b7, type LoggingApi as b8, type IapApi as b9, type CanShareFileResult as bA, type EntitlementApi as bB, type Entitlement as bC, type LedgerEntry as bD, type StatsApi as bE, type GrantInfo as bF, type CollectiblesApi as bG, type CollectibleCard as bH, type VipClaimResult as bI, type ShopApi as bJ, type StorefrontResponse as bK, type StorefrontItem as bL, type ShopPurchaseResponse as bM, type ShopOrderHistoryResponse as bN, type PromptLoginResult as bO, type AccessTier as bP, type AccessGateApi as bQ, type TextGenApi as bR, type UgcApi as bS, type MultiplayerApi as bT, type VideoApi as bU, type AppApi as bV, type AdminUgcApi as bW, type AdminImageGenApi as bX, type AdminVideoGenApi as bY, type AdminSpriteGenApi as bZ, type AdminAudioGenApi as b_, type SpendCurrencyOptions as ba, type SpendCurrencyResult as bb, type SubscriptionTier as bc, type RunSubscriptionsResponse as bd, type SubscriptionInterval as be, type PurchaseSubscriptionResponse as bf, type OpenStoreResult as bg, type LoadEmbeddedAssetsResponse as bh, type SharedAssetsApi as bi, type CreditsApi as bj, type CreditsBillingContext as bk, type CreditBalance as bl, type CreditSubscription as bm, type CreditPlansCatalog as bn, type OpenPaywallOptions as bo, type CreditsPurchaseResult as bp, type Unsubscribe as bq, type PreloaderApi as br, type SocialApi as bs, type ShareMetadata as bt, type ShareLinkResult as bu, type SocialQRCodeOptions as bv, type QRCodeResult as bw, type ShareClickData as bx, type ShareFileOptions as by, type ShareFileResult as bz, type RundotGameAvailableRecipe as c, type AiContentBlock as c$, type AppRole as c0, type ResolveLaunchIntentOptions as c1, type LaunchIntent as c2, type ReleaseNote as c3, type AdminUgcBrowseParams as c4, type AdminUgcBrowseResponse as c5, type AdminUgcListReportsParams as c6, type AdminUgcListReportsResponse as c7, type AdminUgcResolveAction as c8, type AdminGenBrowseParams as c9, type ClipPersistOptions as cA, type ClipResult as cB, type UgcEntry as cC, type CaptureConsentStatus as cD, AccessDeniedError as cE, type AdminGenApi as cF, type AdminImageGenBrowseParams as cG, type AdminImageGenBrowseResponse as cH, type AdminImageGenListReportsParams as cI, type AdminImageGenListReportsResponse as cJ, type AdminImageGenResolveAction as cK, type AdminSpriteGenBrowseParams as cL, type AdminSpriteGenBrowseResponse as cM, type AdminSpriteGenListReportsParams as cN, type AdminSpriteGenListReportsResponse as cO, type AdminSpriteGenResolveAction as cP, type AdminThreeDGenBrowseParams as cQ, type AdminThreeDGenBrowseResponse as cR, type AdminThreeDGenListReportsParams as cS, type AdminThreeDGenListReportsResponse as cT, type AdminThreeDGenResolveAction as cU, type AdminUgcEntry as cV, type AdminVideoGenBrowseParams as cW, type AdminVideoGenBrowseResponse as cX, type AdminVideoGenListReportsParams as cY, type AdminVideoGenListReportsResponse as cZ, type AdminVideoGenResolveAction as c_, type AdminGenBrowseResponse as ca, type ImageGenEntry as cb, type AdminGenListReportsParams as cc, type AdminGenListReportsResponse as cd, type ImageGenReport as ce, type AdminGenResolveAction as cf, type SpriteGenEntry as cg, type SpriteGenReport as ch, type ThreeDGenEntry as ci, type ThreeDGenReport as cj, type Avatar3dApi as ck, type AssetManifest as cl, type Avatar3dConfig as cm, type ShowEditorOptions as cn, type Avatar3dEdits as co, type AdsApi as cp, type SharedStorageHostApi as cq, type FilesApi as cr, type ClipsApi as cs, type AttributionApi as ct, type InitializationContext as cu, type InitializationOptions as cv, type CaptureConsent as cw, type StartClipRecordingOptions as cx, type ClipBlob as cy, type ClipsSupport as cz, type RundotGameCollectRecipeResult as d, RpcInboundStorageApi as d$, type AiImageContent as d0, type AiImageUrlContent as d1, type AiMessage as d2, type AiResponseFormat as d3, type AiTextContent as d4, type AiToolResultContent as d5, type AiToolUseContent as d6, type Asset as d7, type AudioGenEntry as d8, type AudioGenReport as d9, type InboundStorageApi as dA, type IsPlayerSubscribedRequest as dB, type JoinOrCreateRoomEnvelopeResponse as dC, type JoinRoomMatchCriteria as dD, type LaunchIntentKind as dE, type ListUserRoomsOptions as dF, type LoadEmbeddedAssetsRequest as dG, MockAvatarApi as dH, type NotificationTriggerInput as dI, type OnNotificationCallback as dJ, type OnRequestCallback as dK, type OnResponseCallback as dL, type ProposedMovePayload as dM, type Protocol as dN, type PurchaseSubscriptionRequest as dO, type RCSAvailabilityReason as dP, type RCSOptInStatus as dQ, ROOM_GAME_PHASES as dR, type RealtimeRoomSummary as dS, type RecipeInfo as dT, type ReleaseType as dU, type RoomEnvelopeResponse as dV, type RoomEvents as dW, type RoomGamePhase as dX, type RoomMessageEventType as dY, type RoomMessagePayload as dZ, type RoomsEnvelopeResponse as d_, CLIP_CONTENT_TYPE as da, CREDITS_EXHAUSTED_CODE as db, type Category as dc, type ClipAudioOptions as dd, type ClipCameraOptions as de, type ClipPipLayout as df, type ClipPipPosition as dg, type ConnectionState as dh, type CreditFreeDailyInfo as di, type CreditPlan as dj, type CreditTopUpPack as dk, type CreditsBilledTo as dl, CreditsExhaustedError as dm, type CreditsExhaustedErrorInfo as dn, type CreditsPurchaseOutcome as dp, GAMEPAD_BUTTON_NAMES as dq, type GamepadAxes as dr, type GamepadButtonName as ds, type GamepadButtonState as dt, type GamepadSource as du, type GetSubscriptionsForTierRequest as dv, type HudInsets as dw, type IdentityChangeReason as dx, type InboundForKeyEntry as dy, type InboundMethodIds as dz, type RundotGameExecuteRecipeOptions as e, RpcSharedAssetsApi as e0, type RpcTransport as e1, type RunSubscription as e2, type RundotGameRoomCustomMetadata as e3, type RundotGameRoomPayload as e4, type RundotGameRoomRules as e5, type RundotGameRoomRulesGameState as e6, SHARE_FILE_ALLOWED_MIME_TYPES as e7, SHARE_FILE_MAX_SIZE_BYTES as e8, type ScheduleRCSStatus as e9, type ServerPlayer as ea, type ServerRoom as eb, type ShareFileMimeType as ec, type ShopOrder as ed, type SimulationBatchOperationAssign as ee, type SimulationBatchOperationRemove as ef, type SimulationBatchOperationResult as eg, type SimulationPersonalState as eh, type SimulationRoomActiveRecipe as ei, type SimulationRoomState as ej, type StorefrontCollection as ek, type StorefrontCollectionItem as el, type SubPath as em, type Tool as en, type ToolChoice as eo, type ToolUse as ep, type TimeIntervalTriggerInput as eq, type UgcReport as er, type VideoGenEntry as es, type VideoGenReport as et, asCreditsExhaustedError as eu, createHost as ev, isCreditsExhaustedError as ew, mapCreditsExhaustion as ex, resolveCollectionItemPrice as ey, type RundotGameExecuteRecipeResult as f, type RundotGameExecuteScopedRecipeOptions as g, RundotGameRoom as h, type RundotGameSimulationConfig as i, type RundotGameSimulationEffect as j, type RundotGameSimulationRecipe as k, type RundotGameSimulationStateResponse as l, type SimulationEntityUpdate as m, type SimulationRunSummary as n, type SimulationSnapshotUpdate as o, type SimulationSubscribeOptions as p, type SimulationUpdateData as q, type SimulationUpdateType as r, type RpcRequest as s, type RpcResponse as t, type RpcNotification as u, RpcClient as v, type StorageApi as w, type NavigationStackInfo as x, type PushAppOptions as y, type NavigateToGameOptions as z };
|
|
4541
|
+
export { type EnvironmentInfo as $, type AnalyticsApi as A, type BatchRecipeRequirementsResult as B, type NotificationsApi as C, type ScheduleLocalNotification as D, type ScheduleNotificationOptions as E, type RCSAvailabilityStatus as F, type ScheduleRCSInput as G, type Host as H, type ScheduleRCSResult as I, type RequestRCSOptInInput as J, type RequestRCSOptInResult as K, type PopupsApi as L, type ShowToastOptions as M, type NavigationApi as N, type LikeDialogResult as O, type Profile as P, type QuitOptions as Q, type RundotGameAPI as R, type SimulationActiveRunsUpdate as S, type CommentsPanelResult as T, type LikeStateResult as U, type ShowInterstitialAdOptions as V, type ShowRewardedAdOptions as W, type ProfileApi as X, type DeviceApi as Y, type DeviceInfo as Z, type EnvironmentApi as _, type RecipeRequirementQuery as a, type ListRoomsOptions as a$, type SystemApi as a0, type SafeArea as a1, type AddToHomeScreenResult as a2, type CdnApi as a3, type FetchFromCdnOptions as a4, type AssetUrlResult as a5, type TimeApi as a6, type ServerTimeData as a7, type GetFutureTimeOptions as a8, type AiApi as a9, type SimulationAvailableItem as aA, type SimulationPowerPreview as aB, type SimulationSlotMutationResult as aC, type SimulationSlotContainer as aD, type SimulationAssignment as aE, type SimulationState as aF, type ExecuteRecipeOptions as aG, type ExecuteRecipeResponse as aH, type CollectRecipeResult as aI, type ResetStateOptions as aJ, type ResetStateResult as aK, type GetActiveRunsOptions as aL, type ExecuteScopedRecipeOptions as aM, type ExecuteScopedRecipeResult as aN, type GetAvailableRecipesOptions as aO, type GetAvailableRecipesResult as aP, type Recipe as aQ, type GetBatchRecipeRequirements as aR, type TriggerRecipeChainOptions as aS, type RoomDataUpdate as aT, type RoomMessageEvent as aU, type ProposedMoveEvent as aV, RundotGameTransport as aW, type RoomsApi as aX, type CreateRoomOptions as aY, type JoinOrCreateRoomOptions as aZ, type JoinOrCreateResult as a_, type AiChatCompletionRequest as aa, type AiChatCompletionData as ab, type AiChatCompletionStreamOptions as ac, type AiChatCompletionStreamChunk as ad, type HapticsApi as ae, HapticFeedbackStyle as af, type GamepadSnapshot as ag, type GamepadConnectionEvent as ah, type Subscription as ai, type GamepadApi as aj, type GamepadLatencyStats as ak, type FeaturesApi as al, type Experiment as am, type LifecycleApi as an, type SleepCallback as ao, type AwakeCallback as ap, type PauseCallback as aq, type ResumeCallback as ar, type QuitCallback as as, type BackButtonCallback as at, type IdentityChangedCallback as au, type IdentityChangedEvent as av, type SimulationApi as aw, type SimulationSlotValidationResult as ax, type SimulationBatchOperation as ay, type SimulationBatchOperationsResult as az, type RecipeRequirementResult as b, type AdminThreeDGenApi as b$, type UpdateRoomDataOptions as b0, type RoomMessageRequest as b1, type StartRoomGameOptions as b2, type ProposeMoveRequest as b3, type ProposeMoveResult as b4, type ValidateMoveVerdict as b5, type ValidateMoveResult as b6, type RoomSubscriptionOptions as b7, type LoggingApi as b8, type IapApi as b9, type CanShareFileResult as bA, type EntitlementApi as bB, type Entitlement as bC, type LedgerEntry as bD, type StatsApi as bE, type GrantInfo as bF, type CollectiblesApi as bG, type CollectibleCard as bH, type VipClaimResult as bI, type ShopApi as bJ, type StorefrontResponse as bK, type StorefrontItem as bL, type ShopPurchaseResponse as bM, type ShopOrderHistoryResponse as bN, type PromptLoginResult as bO, type AccessTier as bP, type AccessGateApi as bQ, type TextGenApi as bR, type UgcApi as bS, type MultiplayerApi as bT, type VideoApi as bU, type AppApi as bV, type AdminUgcApi as bW, type AdminImageGenApi as bX, type AdminVideoGenApi as bY, type AdminSpriteGenApi as bZ, type AdminAudioGenApi as b_, type SpendCurrencyOptions as ba, type SpendCurrencyResult as bb, type SubscriptionTier as bc, type RunSubscriptionsResponse as bd, type SubscriptionInterval as be, type PurchaseSubscriptionResponse as bf, type OpenStoreResult as bg, type LoadEmbeddedAssetsResponse as bh, type SharedAssetsApi as bi, type CreditsApi as bj, type CreditsBillingContext as bk, type CreditBalance as bl, type CreditSubscription as bm, type CreditPlansCatalog as bn, type OpenPaywallOptions as bo, type CreditsPurchaseResult as bp, type Unsubscribe as bq, type PreloaderApi as br, type SocialApi as bs, type ShareMetadata as bt, type ShareLinkResult as bu, type SocialQRCodeOptions as bv, type QRCodeResult as bw, type ShareClickData as bx, type ShareFileOptions as by, type ShareFileResult as bz, type RundotGameAvailableRecipe as c, type AdminVideoGenResolveAction as c$, type AppRole as c0, type ResolveLaunchIntentOptions as c1, type LaunchIntent as c2, type ReleaseNote as c3, type AdminUgcBrowseParams as c4, type AdminUgcBrowseResponse as c5, type AdminUgcListReportsParams as c6, type AdminUgcListReportsResponse as c7, type AdminUgcResolveAction as c8, type AdminGenBrowseParams as c9, type ClipsSupport as cA, type ClipPersistOptions as cB, type ClipResult as cC, type UgcEntry as cD, type CaptureConsentStatus as cE, AccessDeniedError as cF, type AdminGenApi as cG, type AdminImageGenBrowseParams as cH, type AdminImageGenBrowseResponse as cI, type AdminImageGenListReportsParams as cJ, type AdminImageGenListReportsResponse as cK, type AdminImageGenResolveAction as cL, type AdminSpriteGenBrowseParams as cM, type AdminSpriteGenBrowseResponse as cN, type AdminSpriteGenListReportsParams as cO, type AdminSpriteGenListReportsResponse as cP, type AdminSpriteGenResolveAction as cQ, type AdminThreeDGenBrowseParams as cR, type AdminThreeDGenBrowseResponse as cS, type AdminThreeDGenListReportsParams as cT, type AdminThreeDGenListReportsResponse as cU, type AdminThreeDGenResolveAction as cV, type AdminUgcEntry as cW, type AdminVideoGenBrowseParams as cX, type AdminVideoGenBrowseResponse as cY, type AdminVideoGenListReportsParams as cZ, type AdminVideoGenListReportsResponse as c_, type AdminGenBrowseResponse as ca, type ImageGenEntry as cb, type AdminGenListReportsParams as cc, type AdminGenListReportsResponse as cd, type ImageGenReport as ce, type AdminGenResolveAction as cf, type SpriteGenEntry as cg, type SpriteGenReport as ch, type ThreeDGenEntry as ci, type ThreeDGenReport as cj, type Avatar3dApi as ck, type AssetManifest as cl, type Avatar3dConfig as cm, type ShowEditorOptions as cn, type Avatar3dEdits as co, type AdsApi as cp, type RawEnvironmentInfo as cq, type SharedStorageHostApi as cr, type FilesApi as cs, type ClipsApi as ct, type AttributionApi as cu, type InitializationContext as cv, type InitializationOptions as cw, type CaptureConsent as cx, type StartClipRecordingOptions as cy, type ClipBlob as cz, type RundotGameCollectRecipeResult as d, type RoomGamePhase as d$, type AiContentBlock as d0, type AiImageContent as d1, type AiImageUrlContent as d2, type AiMessage as d3, type AiResponseFormat as d4, type AiTextContent as d5, type AiToolResultContent as d6, type AiToolUseContent as d7, type Asset as d8, type AudioGenEntry as d9, type InboundForKeyEntry as dA, type InboundMethodIds as dB, type InboundStorageApi as dC, type IsPlayerSubscribedRequest as dD, type JoinOrCreateRoomEnvelopeResponse as dE, type JoinRoomMatchCriteria as dF, type LaunchIntentKind as dG, type ListUserRoomsOptions as dH, type LoadEmbeddedAssetsRequest as dI, type MatchmakeOptions as dJ, MockAvatarApi as dK, type NotificationTriggerInput as dL, type OnNotificationCallback as dM, type OnRequestCallback as dN, type OnResponseCallback as dO, type PlatformCapabilities as dP, type ProposedMovePayload as dQ, type Protocol as dR, type PurchaseSubscriptionRequest as dS, type RCSAvailabilityReason as dT, type RCSOptInStatus as dU, ROOM_GAME_PHASES as dV, type RealtimeRoomSummary as dW, type RecipeInfo as dX, type ReleaseType as dY, type RoomEnvelopeResponse as dZ, type RoomEvents as d_, type AudioGenReport as da, CLIP_CONTENT_TYPE as db, CREDITS_EXHAUSTED_CODE as dc, type Category as dd, type ChatMessageData as de, type ClipAudioOptions as df, type ClipCameraOptions as dg, type ClipPipLayout as dh, type ClipPipPosition as di, type ConnectionState as dj, type CreditFreeDailyInfo as dk, type CreditPlan as dl, type CreditTopUpPack as dm, type CreditsBilledTo as dn, CreditsExhaustedError as dp, type CreditsExhaustedErrorInfo as dq, type CreditsPurchaseOutcome as dr, GAMEPAD_BUTTON_NAMES as ds, type GamepadAxes as dt, type GamepadButtonName as du, type GamepadButtonState as dv, type GamepadSource as dw, type GetSubscriptionsForTierRequest as dx, type HudInsets as dy, type IdentityChangeReason as dz, type RundotGameExecuteRecipeOptions as e, type RoomMessageEventType as e0, type RoomMessagePayload as e1, type RoomsEnvelopeResponse as e2, RpcInboundStorageApi as e3, RpcSharedAssetsApi as e4, type RpcTransport as e5, type RunSubscription as e6, type RundotGameRoomCustomMetadata as e7, type RundotGameRoomPayload as e8, type RundotGameRoomRules as e9, isCreditsExhaustedError as eA, mapCreditsExhaustion as eB, resolveCollectionItemPrice as eC, type RundotGameRoomRulesGameState as ea, SHARE_FILE_ALLOWED_MIME_TYPES as eb, SHARE_FILE_MAX_SIZE_BYTES as ec, type ScheduleRCSStatus as ed, type ServerPlayer as ee, type ServerRoom as ef, type ShareFileMimeType as eg, type ShopOrder as eh, type SimulationBatchOperationAssign as ei, type SimulationBatchOperationRemove as ej, type SimulationBatchOperationResult as ek, type SimulationPersonalState as el, type SimulationRoomActiveRecipe as em, type SimulationRoomState as en, type StorefrontCollection as eo, type StorefrontCollectionItem as ep, type SubPath as eq, type Tool as er, type ToolChoice as es, type ToolUse as et, type TimeIntervalTriggerInput as eu, type UgcReport as ev, type VideoGenEntry as ew, type VideoGenReport as ex, asCreditsExhaustedError as ey, createHost as ez, type RundotGameExecuteRecipeResult as f, type RundotGameExecuteScopedRecipeOptions as g, RundotGameRoom as h, type RundotGameSimulationConfig as i, type RundotGameSimulationEffect as j, type RundotGameSimulationRecipe as k, type RundotGameSimulationStateResponse as l, type SimulationEntityUpdate as m, type SimulationRunSummary as n, type SimulationSnapshotUpdate as o, type SimulationSubscribeOptions as p, type SimulationUpdateData as q, type SimulationUpdateType as r, type RpcRequest as s, type RpcResponse as t, type RpcNotification as u, RpcClient as v, type StorageApi as w, type NavigationStackInfo as x, type PushAppOptions as y, type NavigateToGameOptions as z };
|
|
@@ -387,12 +387,12 @@ var MockAdsApi = class {
|
|
|
387
387
|
}
|
|
388
388
|
async showRewardedAdAsync(options) {
|
|
389
389
|
mockLog(TAG, "showRewardedAdAsync");
|
|
390
|
-
await this.mockOverlay.showAdOverlay(options);
|
|
390
|
+
await this.mockOverlay.showAdOverlay("rewarded", options);
|
|
391
391
|
return true;
|
|
392
392
|
}
|
|
393
393
|
async showInterstitialAd(options) {
|
|
394
394
|
mockLog(TAG, "showInterstitialAd");
|
|
395
|
-
await this.mockOverlay.showAdOverlay(options);
|
|
395
|
+
await this.mockOverlay.showAdOverlay("interstitial", options);
|
|
396
396
|
return true;
|
|
397
397
|
}
|
|
398
398
|
};
|
|
@@ -1439,7 +1439,13 @@ var HostEnvironmentApi = class {
|
|
|
1439
1439
|
"[RUN] Environment info not available. You must await RundotGameAPI.initializeAsync() before calling getEnvironment(). INIT_SDK has not completed."
|
|
1440
1440
|
);
|
|
1441
1441
|
}
|
|
1442
|
-
return
|
|
1442
|
+
return {
|
|
1443
|
+
...environment,
|
|
1444
|
+
capabilities: {
|
|
1445
|
+
ads: environment.capabilities?.ads ?? true,
|
|
1446
|
+
purchases: environment.capabilities?.purchases ?? true
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1443
1449
|
}
|
|
1444
1450
|
};
|
|
1445
1451
|
|
|
@@ -1470,6 +1476,10 @@ var MockEnvironmentApi = class {
|
|
|
1470
1476
|
isMobile: typeof navigator !== "undefined" ? /Mobi|Android/i.test(navigator.userAgent) : false,
|
|
1471
1477
|
isTablet: typeof navigator !== "undefined" ? /iPad|Tablet|Pad/i.test(navigator.userAgent) : false,
|
|
1472
1478
|
language: typeof navigator !== "undefined" ? navigator.language || "en-US" : "en-US"
|
|
1479
|
+
},
|
|
1480
|
+
capabilities: {
|
|
1481
|
+
ads: true,
|
|
1482
|
+
purchases: true
|
|
1473
1483
|
}
|
|
1474
1484
|
};
|
|
1475
1485
|
}
|
|
@@ -5687,45 +5697,23 @@ async function exchangeForCustomToken(idToken, cloudRunBaseUrl, playerId) {
|
|
|
5687
5697
|
}
|
|
5688
5698
|
return customToken;
|
|
5689
5699
|
}
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
const response = await fetch(
|
|
5693
|
-
method: "POST",
|
|
5694
|
-
headers: {
|
|
5695
|
-
"Content-Type": "application/json",
|
|
5696
|
-
"Authorization": `Bearer ${apiKey}`
|
|
5697
|
-
}
|
|
5698
|
-
});
|
|
5699
|
-
if (!response.ok) {
|
|
5700
|
-
const text = await response.text();
|
|
5701
|
-
throw new Error(`[RUN] API key exchange failed (${response.status}): ${text}`);
|
|
5702
|
-
}
|
|
5703
|
-
const data = await response.json();
|
|
5704
|
-
const result = data.data;
|
|
5705
|
-
const customToken = result?.customToken;
|
|
5706
|
-
if (typeof customToken !== "string" || customToken.length === 0) {
|
|
5707
|
-
throw new Error("[RUN] API key exchange: response missing customToken");
|
|
5708
|
-
}
|
|
5709
|
-
return customToken;
|
|
5710
|
-
}
|
|
5711
|
-
async function exchangePlaygroundKeyForCustomToken(apiKey, cloudRunBaseUrl) {
|
|
5712
|
-
const url = `${cloudRunBaseUrl}/v1/auth/exchange-playground-key`;
|
|
5713
|
-
const response = await fetch(url, {
|
|
5700
|
+
var RUNDOT_HEADLESS_AUTH_PATH = "/__rundot-headless-auth";
|
|
5701
|
+
async function fetchHeadlessCustomToken() {
|
|
5702
|
+
const response = await fetch(RUNDOT_HEADLESS_AUTH_PATH, {
|
|
5714
5703
|
method: "POST",
|
|
5715
5704
|
headers: {
|
|
5716
5705
|
"Content-Type": "application/json",
|
|
5717
|
-
"
|
|
5706
|
+
"X-Rundot-Sandbox": "1"
|
|
5718
5707
|
}
|
|
5719
5708
|
});
|
|
5720
5709
|
if (!response.ok) {
|
|
5721
5710
|
const text = await response.text();
|
|
5722
|
-
throw new Error(`[RUN]
|
|
5711
|
+
throw new Error(`[RUN] Headless auth failed (${response.status}): ${text}`);
|
|
5723
5712
|
}
|
|
5724
5713
|
const data = await response.json();
|
|
5725
|
-
const
|
|
5726
|
-
const customToken = result?.customToken;
|
|
5714
|
+
const customToken = data.customToken;
|
|
5727
5715
|
if (typeof customToken !== "string" || customToken.length === 0) {
|
|
5728
|
-
throw new Error("[RUN]
|
|
5716
|
+
throw new Error("[RUN] Headless auth: response missing customToken");
|
|
5729
5717
|
}
|
|
5730
5718
|
return customToken;
|
|
5731
5719
|
}
|
|
@@ -5812,21 +5800,12 @@ async function initializeFirebaseClient() {
|
|
|
5812
5800
|
}, 1e4);
|
|
5813
5801
|
});
|
|
5814
5802
|
const hasGoogleProvider = (user) => user.providerData?.some((p) => p.providerId === "google.com") === true;
|
|
5815
|
-
|
|
5816
|
-
const { apiKey, cloudRunUrl, gameManagerUrl, target } = config;
|
|
5817
|
-
if (!apiKey) return null;
|
|
5818
|
-
if (apiKey.startsWith("rk_")) {
|
|
5819
|
-
return target === "playground" && cloudRunUrl ? () => exchangePlaygroundKeyForCustomToken(apiKey, cloudRunUrl) : null;
|
|
5820
|
-
}
|
|
5821
|
-
return gameManagerUrl ? () => exchangeApiKeyForCustomToken(apiKey, gameManagerUrl) : null;
|
|
5822
|
-
};
|
|
5823
|
-
const headlessExchange = resolveHeadlessExchange();
|
|
5824
|
-
if (headlessExchange) {
|
|
5803
|
+
if (config.hasHeadlessAuth) {
|
|
5825
5804
|
try {
|
|
5826
|
-
const customToken = await
|
|
5805
|
+
const customToken = await fetchHeadlessCustomToken();
|
|
5827
5806
|
await signInWithCustomToken(auth, customToken);
|
|
5828
5807
|
} catch (error) {
|
|
5829
|
-
console.error("[RUN]
|
|
5808
|
+
console.error("[RUN] Headless auth failed:", error);
|
|
5830
5809
|
throw error;
|
|
5831
5810
|
}
|
|
5832
5811
|
const firestore2 = getFirestore(app);
|
|
@@ -7244,7 +7223,7 @@ var BrowserCaptureConsent = class {
|
|
|
7244
7223
|
|
|
7245
7224
|
// src/mp/client/RundotServerRoom.ts
|
|
7246
7225
|
var RundotServerRoom = class _RundotServerRoom {
|
|
7247
|
-
/** The shareable room code (e.g. "HX9KWR") */
|
|
7226
|
+
/** The shareable room code (e.g. "HX9KWR"). Updated if the server moves us. */
|
|
7248
7227
|
roomCode;
|
|
7249
7228
|
playerId;
|
|
7250
7229
|
ws;
|
|
@@ -7315,6 +7294,16 @@ var RundotServerRoom = class _RundotServerRoom {
|
|
|
7315
7294
|
const { type, ...data } = message;
|
|
7316
7295
|
this.ws.send({ type: "message", msgType: type, data });
|
|
7317
7296
|
}
|
|
7297
|
+
/** Send a room chat message (Req 20). Delivered back to all members via onChat. */
|
|
7298
|
+
sendChat(text) {
|
|
7299
|
+
if (this._phase === "dead" || this._phase === "reconnecting") return;
|
|
7300
|
+
this.ws.send({ type: "message", msgType: "chat:send", data: { text } });
|
|
7301
|
+
}
|
|
7302
|
+
/** Request recent chat history; reply arrives on onChatHistory. */
|
|
7303
|
+
fetchChatHistory(limit) {
|
|
7304
|
+
if (this._phase === "dead" || this._phase === "reconnecting") return;
|
|
7305
|
+
this.ws.send({ type: "message", msgType: "chat:history", data: { limit } });
|
|
7306
|
+
}
|
|
7318
7307
|
/**
|
|
7319
7308
|
* Leave the room and close the connection.
|
|
7320
7309
|
*/
|
|
@@ -7360,16 +7349,35 @@ var RundotServerRoom = class _RundotServerRoom {
|
|
|
7360
7349
|
case "room:reconnecting":
|
|
7361
7350
|
this.onReconnectingMessageReceived();
|
|
7362
7351
|
break;
|
|
7352
|
+
case "room:moved":
|
|
7353
|
+
this.onMovedMessageReceived(msg);
|
|
7354
|
+
break;
|
|
7363
7355
|
case "room:reconnected":
|
|
7364
7356
|
this.onReconnectedMessageReceived(msg);
|
|
7365
7357
|
break;
|
|
7366
7358
|
case "pong":
|
|
7367
7359
|
this.onPongMessageReceived(msg);
|
|
7368
7360
|
break;
|
|
7361
|
+
case "chat:message":
|
|
7362
|
+
this.events.onChat?.(msg.data);
|
|
7363
|
+
break;
|
|
7364
|
+
case "chat:history":
|
|
7365
|
+
this.events.onChatHistory?.(msg.data.messages);
|
|
7366
|
+
break;
|
|
7369
7367
|
}
|
|
7370
7368
|
}
|
|
7371
7369
|
onBroadcastMessageReceived(msg) {
|
|
7372
7370
|
this.log(`broadcast msgType=${msg.msgType}`);
|
|
7371
|
+
if (msg.msgType === "world:delta") {
|
|
7372
|
+
const data = msg.data;
|
|
7373
|
+
this.events.onDelta?.(data?.delta ?? msg.data);
|
|
7374
|
+
return;
|
|
7375
|
+
}
|
|
7376
|
+
if (msg.msgType === "world:resync") {
|
|
7377
|
+
const data = msg.data;
|
|
7378
|
+
this.events.onResync?.(data?.reason ?? "resync");
|
|
7379
|
+
return;
|
|
7380
|
+
}
|
|
7373
7381
|
this.events.onMessage?.(this.toMessage(msg.msgType, msg.data));
|
|
7374
7382
|
}
|
|
7375
7383
|
onSendToMessageReceived(msg) {
|
|
@@ -7407,6 +7415,12 @@ var RundotServerRoom = class _RundotServerRoom {
|
|
|
7407
7415
|
this.events.onReconnecting?.();
|
|
7408
7416
|
}
|
|
7409
7417
|
}
|
|
7418
|
+
onMovedMessageReceived(msg) {
|
|
7419
|
+
this.log(`moved to room=${msg._roomId} code=${msg.roomCode}`);
|
|
7420
|
+
this.roomCode = msg.roomCode;
|
|
7421
|
+
this.ws.retargetRoom(msg._roomId, msg.roomCode);
|
|
7422
|
+
this.events.onMoved?.(msg._roomId);
|
|
7423
|
+
}
|
|
7410
7424
|
onReconnectedMessageReceived(_msg) {
|
|
7411
7425
|
this.ws.confirmConnection();
|
|
7412
7426
|
if (this.transitionTo("active")) {
|
|
@@ -7525,6 +7539,15 @@ var ServerWebSocket = class {
|
|
|
7525
7539
|
setAuthMessage(msg) {
|
|
7526
7540
|
this._authMessage = msg;
|
|
7527
7541
|
}
|
|
7542
|
+
/**
|
|
7543
|
+
* Retarget the room a reconnect resumes after a server-driven move
|
|
7544
|
+
* (move_player / Req 19). The socket itself is unchanged; this only updates
|
|
7545
|
+
* the `_roomId`/`roomCode` replayed in the reconnect auth frame.
|
|
7546
|
+
*/
|
|
7547
|
+
retargetRoom(roomId, roomCode) {
|
|
7548
|
+
if (!this._authMessage) return;
|
|
7549
|
+
this._authMessage = { ...this._authMessage, _roomId: roomId, roomCode };
|
|
7550
|
+
}
|
|
7528
7551
|
/**
|
|
7529
7552
|
* Connect to the WebSocket server.
|
|
7530
7553
|
* On reconnection, sends a fresh auth token with { reconnect: true }.
|
|
@@ -7590,7 +7613,8 @@ var ServerWebSocket = class {
|
|
|
7590
7613
|
roomCode: this._authMessage.roomCode,
|
|
7591
7614
|
action: this._authMessage.action || "joinOrCreate",
|
|
7592
7615
|
criteria: this._joinOptions?.criteria,
|
|
7593
|
-
createOptions: this._joinOptions?.createOptions
|
|
7616
|
+
createOptions: this._joinOptions?.createOptions,
|
|
7617
|
+
persistentKey: this._joinOptions?.persistentKey
|
|
7594
7618
|
};
|
|
7595
7619
|
const freshTicket = await this._getJoinTicket(req);
|
|
7596
7620
|
if (this.ws !== socket || socket.readyState !== WebSocket.OPEN) return;
|
|
@@ -7687,6 +7711,18 @@ var WsMultiplayerApi = class {
|
|
|
7687
7711
|
async joinOrCreateRoom(roomType, opts) {
|
|
7688
7712
|
return this._joinWithAction("joinOrCreate", roomType, void 0, opts);
|
|
7689
7713
|
}
|
|
7714
|
+
async matchmakeRoom(roomType, opts) {
|
|
7715
|
+
const req = {
|
|
7716
|
+
roomType,
|
|
7717
|
+
action: "matchmake",
|
|
7718
|
+
criteria: opts?.criteria
|
|
7719
|
+
};
|
|
7720
|
+
const ticket = await this.getJoinTicket(req);
|
|
7721
|
+
return this._connectMatchmaking(
|
|
7722
|
+
{ type: "auth", protocolVersion: PROTOCOL_VERSION, ticket, roomType, action: "matchmake" },
|
|
7723
|
+
opts
|
|
7724
|
+
);
|
|
7725
|
+
}
|
|
7690
7726
|
async getUserRooms(options) {
|
|
7691
7727
|
if (!this.listUserRooms) {
|
|
7692
7728
|
throw new Error("getUserRooms is not available in this environment");
|
|
@@ -7699,7 +7735,8 @@ var WsMultiplayerApi = class {
|
|
|
7699
7735
|
action,
|
|
7700
7736
|
roomCode,
|
|
7701
7737
|
criteria: opts?.criteria,
|
|
7702
|
-
createOptions: opts?.createOptions
|
|
7738
|
+
createOptions: opts?.createOptions,
|
|
7739
|
+
persistentKey: opts?.persistentKey
|
|
7703
7740
|
};
|
|
7704
7741
|
const ticket = await this.getJoinTicket(req);
|
|
7705
7742
|
return this._connect(
|
|
@@ -7707,11 +7744,98 @@ var WsMultiplayerApi = class {
|
|
|
7707
7744
|
opts
|
|
7708
7745
|
);
|
|
7709
7746
|
}
|
|
7747
|
+
/**
|
|
7748
|
+
* Matchmaking connect (Req 18): like {@link _connect} but the socket parks in
|
|
7749
|
+
* the server lobby until paired. While the server reports `matchmaking:pending`
|
|
7750
|
+
* the client polls the pool; once the server pairs and emits `room:joined` the
|
|
7751
|
+
* room resolves. The waiting window is `matchmakeTimeoutMs` (default 120s),
|
|
7752
|
+
* deliberately longer than the plain connect timeout.
|
|
7753
|
+
*/
|
|
7754
|
+
_connectMatchmaking(authMsg, opts) {
|
|
7755
|
+
const wsUrl = this.resolveServerUrl().replace(/^http/, "ws") + "/ws";
|
|
7756
|
+
const ws = new ServerWebSocket({ url: wsUrl });
|
|
7757
|
+
ws.setTicketProvider(this.getJoinTicket);
|
|
7758
|
+
ws.setJoinOptions({ criteria: opts?.criteria });
|
|
7759
|
+
const timeoutMs = opts?.matchmakeTimeoutMs ?? 12e4;
|
|
7760
|
+
const pollIntervalMs = opts?.pollIntervalMs ?? 1e3;
|
|
7761
|
+
return new Promise((resolve, reject) => {
|
|
7762
|
+
let resolved = false;
|
|
7763
|
+
let pollTimer = null;
|
|
7764
|
+
const stopPolling = () => {
|
|
7765
|
+
if (pollTimer) {
|
|
7766
|
+
clearInterval(pollTimer);
|
|
7767
|
+
pollTimer = null;
|
|
7768
|
+
}
|
|
7769
|
+
};
|
|
7770
|
+
const startPolling = () => {
|
|
7771
|
+
if (pollTimer) return;
|
|
7772
|
+
pollTimer = setInterval(() => {
|
|
7773
|
+
ws.send({ type: "message", msgType: "matchmaking:poll", data: {} });
|
|
7774
|
+
}, pollIntervalMs);
|
|
7775
|
+
};
|
|
7776
|
+
const timeout = setTimeout(() => {
|
|
7777
|
+
if (!resolved) {
|
|
7778
|
+
resolved = true;
|
|
7779
|
+
stopPolling();
|
|
7780
|
+
ws.send({ type: "message", msgType: "matchmaking:cancel", data: {} });
|
|
7781
|
+
ws.close();
|
|
7782
|
+
reject(new Error("Matchmaking timeout \u2014 no opponent found"));
|
|
7783
|
+
}
|
|
7784
|
+
}, timeoutMs);
|
|
7785
|
+
const settle = (fn) => {
|
|
7786
|
+
if (resolved) return;
|
|
7787
|
+
resolved = true;
|
|
7788
|
+
stopPolling();
|
|
7789
|
+
clearTimeout(timeout);
|
|
7790
|
+
fn();
|
|
7791
|
+
};
|
|
7792
|
+
const handlePreJoinMessage = (msg) => {
|
|
7793
|
+
if (resolved) return;
|
|
7794
|
+
switch (msg.type) {
|
|
7795
|
+
case "room:joined": {
|
|
7796
|
+
ws.setAuthMessage({ ...authMsg, _roomId: msg._roomId });
|
|
7797
|
+
const room = new RundotServerRoom(msg.roomCode, msg.playerId, ws);
|
|
7798
|
+
settle(() => resolve(room));
|
|
7799
|
+
break;
|
|
7800
|
+
}
|
|
7801
|
+
case "matchmaking:pending":
|
|
7802
|
+
startPolling();
|
|
7803
|
+
break;
|
|
7804
|
+
case "matchmaking:idle":
|
|
7805
|
+
ws.close();
|
|
7806
|
+
settle(() => reject(new Error("Matchmaking is no longer active (pool expired or cancelled)")));
|
|
7807
|
+
break;
|
|
7808
|
+
case "matchmaking:cancelled":
|
|
7809
|
+
ws.close();
|
|
7810
|
+
settle(() => reject(new Error("Matchmaking cancelled")));
|
|
7811
|
+
break;
|
|
7812
|
+
case "room:error":
|
|
7813
|
+
ws.close();
|
|
7814
|
+
settle(() => reject(new Error(msg.message)));
|
|
7815
|
+
break;
|
|
7816
|
+
}
|
|
7817
|
+
};
|
|
7818
|
+
const handlePreJoinError = (err) => {
|
|
7819
|
+
if (!resolved) {
|
|
7820
|
+
ws.close();
|
|
7821
|
+
settle(() => reject(err));
|
|
7822
|
+
}
|
|
7823
|
+
};
|
|
7824
|
+
ws.on({
|
|
7825
|
+
onMessage: handlePreJoinMessage,
|
|
7826
|
+
onError: handlePreJoinError,
|
|
7827
|
+
onStateChange: () => {
|
|
7828
|
+
}
|
|
7829
|
+
});
|
|
7830
|
+
ws.setAuthMessage(authMsg);
|
|
7831
|
+
ws.connect();
|
|
7832
|
+
});
|
|
7833
|
+
}
|
|
7710
7834
|
_connect(authMsg, opts) {
|
|
7711
7835
|
const wsUrl = this.resolveServerUrl().replace(/^http/, "ws") + "/ws";
|
|
7712
7836
|
const ws = new ServerWebSocket({ url: wsUrl });
|
|
7713
7837
|
ws.setTicketProvider(this.getJoinTicket);
|
|
7714
|
-
ws.setJoinOptions({ criteria: opts?.criteria, createOptions: opts?.createOptions });
|
|
7838
|
+
ws.setJoinOptions({ criteria: opts?.criteria, createOptions: opts?.createOptions, persistentKey: opts?.persistentKey });
|
|
7715
7839
|
return new Promise((resolve, reject) => {
|
|
7716
7840
|
let resolved = false;
|
|
7717
7841
|
const timeout = setTimeout(() => {
|
|
@@ -7872,6 +7996,10 @@ var MockMultiplayerApi = class {
|
|
|
7872
7996
|
if (this.delegate) return this.delegate.joinOrCreateRoom(roomType, opts);
|
|
7873
7997
|
return this.createRoom(roomType, opts);
|
|
7874
7998
|
}
|
|
7999
|
+
async matchmakeRoom(roomType, opts) {
|
|
8000
|
+
if (this.delegate) return this.delegate.matchmakeRoom(roomType, opts);
|
|
8001
|
+
return this.createRoom(roomType, opts);
|
|
8002
|
+
}
|
|
7875
8003
|
async getUserRooms(options) {
|
|
7876
8004
|
if (this.delegate) return this.delegate.getUserRooms(options);
|
|
7877
8005
|
let rooms = this.mockRooms;
|
|
@@ -7882,5 +8010,5 @@ var MockMultiplayerApi = class {
|
|
|
7882
8010
|
};
|
|
7883
8011
|
|
|
7884
8012
|
export { AccessDeniedError, BaseCdnApi, BrowserCaptureConsent, CLIP_CONTENT_TYPE, CREDITS_EXHAUSTED_CODE, ClipRecorder, ClipsApiImpl, CreditsExhaustedError, DEFAULT_SHARED_LIB_CDN_BASE, DualEmitStorageApi, EMBEDDED_LIBRARIES, EMBEDDED_LIBRARY_BY_KEY, FILE_EXTENSION_PATTERN, GAMEPAD_BUTTON_NAMES, HapticFeedbackStyle, HostCdnApi, HostDeviceApi, HostEnvironmentApi, HostProfileApi, HostSystemApi, HostTimeApi, LatencyTracker, MIN_CDN_PATH_SEGMENTS, MODULE_TO_LIBRARY_SPECIFIERS, MockAccessGateApi, MockAdminUgcApi, MockAdsApi, MockAnalyticsApi, MockAppApi, MockAttributionApi, MockAvatarApi, MockCdnApi, MockCollectiblesApi, MockCreditsApi, MockDebug, MockDeviceApi, MockEntitlementApi, MockEnvironmentApi, MockFeaturesApi, MockGamepadApi, MockHapticsApi, MockIapApi, MockLifecycleApi, MockLoggingApi, MockMultiplayerApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockShopApi, MockStatsApi, MockStorageApi, MockSystemApi, MockTimeApi, MockVideoApi, PER_APP_SUBDOMAIN_HOST_PATTERN, ROOM_GAME_PHASES, RpcAccessGateApi, RpcAdsApi, RpcAnalyticsApi, RpcAttributionApi, RpcAvatarApi, RpcCollectiblesApi, RpcCreditsApi, RpcEntitlementApi, RpcFeaturesApi, RpcGamepadApi, RpcHapticsApi, RpcInboundStorageApi, RpcLifecycleApi, RpcLoggingApi, RpcNavigationApi, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcRoomsApi, RpcSharedAssetsApi, RpcShopApi, RpcStatsApi, RpcStorageApi, RpcVideoApi, RundotGameMessageId, RundotGameRoom, SHARE_FILE_ALLOWED_MIME_TYPES, SHARE_FILE_MAX_SIZE_BYTES, SandboxAppApi, SandboxProfileApi, WebGamepadReader, WsMultiplayerApi, applyAccessGates, asCreditsExhaustedError, base64ToArrayBuffer, base64ToUtf8, buildFunctionsBaseUrl, createAccessGatedApi, createMockAdminGenApi, createMockStorageApi, createRpcAdminGenApi, exchangeForCustomToken, gateStreaming, generateId, getCloudRunUrl, getFirebaseClient, getLibraryDefinition, getSandboxConfig, hasHostedUrlStructure, initializeAccessGate, initializeAds, initializeAnalytics, initializeAttribution, initializeAvatar3d, initializeCdn, initializeCollectibles, initializeCredits, initializeEntitlements, initializeFeaturesApi, initializeGamepad, initializeHaptics, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeShop, initializeStackNavigation, initializeStats, initializeStorage, initializeSystem, initializeTime, initializeVideo, isCreditsExhaustedError, isPacificDaylightTime, isPerAppSubdomain, isSandboxEnabled, mapCreditsExhaustion, mockLog, normalizeStandardGamepad, observeFirestoreCollection, observeFirestoreDocument, parseCdnLocationFromUrl, parseCdnLocationFromWindow, parseCdnPathSegments, resolveCollectionItemPrice, sanitizeProfile, setStoredAppRole, setupRoomNotifications, signInWithGoogle, wireIdentityReplica };
|
|
7885
|
-
//# sourceMappingURL=chunk-
|
|
7886
|
-
//# sourceMappingURL=chunk-
|
|
8013
|
+
//# sourceMappingURL=chunk-APR46OZQ.js.map
|
|
8014
|
+
//# sourceMappingURL=chunk-APR46OZQ.js.map
|