@air-jam/sdk 0.1.3 → 0.9.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/LICENSE +21 -0
- package/README.md +627 -57
- package/dist/agent-tooling-BSMGBix9.d.cts +123 -0
- package/dist/agent-tooling-BSMGBix9.d.ts +123 -0
- package/dist/agent-tooling.cjs +83 -0
- package/dist/agent-tooling.cjs.map +1 -0
- package/dist/agent-tooling.d.cts +2 -0
- package/dist/agent-tooling.d.ts +2 -0
- package/dist/agent-tooling.js +17 -0
- package/dist/agent-tooling.js.map +1 -0
- package/dist/arcade/bridge/controller.cjs +749 -0
- package/dist/arcade/bridge/controller.cjs.map +1 -0
- package/dist/arcade/bridge/controller.d.cts +85 -0
- package/dist/arcade/bridge/controller.d.ts +85 -0
- package/dist/arcade/bridge/controller.js +33 -0
- package/dist/arcade/bridge/controller.js.map +1 -0
- package/dist/arcade/bridge/host.cjs +421 -0
- package/dist/arcade/bridge/host.cjs.map +1 -0
- package/dist/arcade/bridge/host.d.cts +73 -0
- package/dist/arcade/bridge/host.d.ts +73 -0
- package/dist/arcade/bridge/host.js +25 -0
- package/dist/arcade/bridge/host.js.map +1 -0
- package/dist/arcade/bridge/iframe.cjs +453 -0
- package/dist/arcade/bridge/iframe.cjs.map +1 -0
- package/dist/arcade/bridge/iframe.d.cts +80 -0
- package/dist/arcade/bridge/iframe.d.ts +80 -0
- package/dist/arcade/bridge/iframe.js +28 -0
- package/dist/arcade/bridge/iframe.js.map +1 -0
- package/dist/arcade/bridge.cjs +1067 -0
- package/dist/arcade/bridge.cjs.map +1 -0
- package/dist/arcade/bridge.d.cts +11 -0
- package/dist/arcade/bridge.d.ts +11 -0
- package/dist/arcade/bridge.js +76 -0
- package/dist/arcade/bridge.js.map +1 -0
- package/dist/arcade/host.cjs +488 -0
- package/dist/arcade/host.cjs.map +1 -0
- package/dist/arcade/host.d.cts +19 -0
- package/dist/arcade/host.d.ts +19 -0
- package/dist/arcade/host.js +13 -0
- package/dist/arcade/host.js.map +1 -0
- package/dist/arcade/surface.cjs +113 -0
- package/dist/arcade/surface.cjs.map +1 -0
- package/dist/arcade/surface.d.cts +14 -0
- package/dist/arcade/surface.d.ts +14 -0
- package/dist/arcade/surface.js +27 -0
- package/dist/arcade/surface.js.map +1 -0
- package/dist/arcade/url.cjs +363 -0
- package/dist/arcade/url.cjs.map +1 -0
- package/dist/arcade/url.d.cts +68 -0
- package/dist/arcade/url.d.ts +68 -0
- package/dist/arcade/url.js +28 -0
- package/dist/arcade/url.js.map +1 -0
- package/dist/arcade-runtime-url-BW-MUAOY.d.cts +28 -0
- package/dist/arcade-runtime-url-l8qj01Pg.d.ts +28 -0
- package/dist/arcade-surface-identity-CQxDpn_w.d.cts +16 -0
- package/dist/arcade-surface-identity-CQxDpn_w.d.ts +16 -0
- package/dist/arcade.cjs +1565 -0
- package/dist/arcade.cjs.map +1 -0
- package/dist/arcade.d.cts +18 -0
- package/dist/arcade.d.ts +18 -0
- package/dist/arcade.js +122 -0
- package/dist/arcade.js.map +1 -0
- package/dist/capabilities.cjs +39 -0
- package/dist/capabilities.cjs.map +1 -0
- package/dist/capabilities.d.cts +31 -0
- package/dist/capabilities.d.ts +31 -0
- package/dist/capabilities.js +12 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/chunk-2432OL7L.js +193 -0
- package/dist/chunk-2432OL7L.js.map +1 -0
- package/dist/chunk-2J65FXEP.js +41 -0
- package/dist/chunk-2J65FXEP.js.map +1 -0
- package/dist/chunk-32NYL7XI.js +539 -0
- package/dist/chunk-32NYL7XI.js.map +1 -0
- package/dist/chunk-3USU7GY2.js +54 -0
- package/dist/chunk-3USU7GY2.js.map +1 -0
- package/dist/chunk-BE6Z4SIT.js +65 -0
- package/dist/chunk-BE6Z4SIT.js.map +1 -0
- package/dist/chunk-CQUG24WX.js +249 -0
- package/dist/chunk-CQUG24WX.js.map +1 -0
- package/dist/chunk-D3X4MN4U.js +288 -0
- package/dist/chunk-D3X4MN4U.js.map +1 -0
- package/dist/chunk-EVZJA6RN.js +140 -0
- package/dist/chunk-EVZJA6RN.js.map +1 -0
- package/dist/chunk-HFWRZVZ3.js +1438 -0
- package/dist/chunk-HFWRZVZ3.js.map +1 -0
- package/dist/chunk-IKKDONQL.js +1 -0
- package/dist/chunk-IKKDONQL.js.map +1 -0
- package/dist/chunk-JTF47B56.js +1 -0
- package/dist/chunk-JTF47B56.js.map +1 -0
- package/dist/chunk-LIXPF4P6.js +22 -0
- package/dist/chunk-LIXPF4P6.js.map +1 -0
- package/dist/chunk-MKBASO6X.js +216 -0
- package/dist/chunk-MKBASO6X.js.map +1 -0
- package/dist/chunk-MPDMJIX5.js +1 -0
- package/dist/chunk-MPDMJIX5.js.map +1 -0
- package/dist/chunk-NCL6WJCL.js +91 -0
- package/dist/chunk-NCL6WJCL.js.map +1 -0
- package/dist/chunk-NU5W6VAV.js +126 -0
- package/dist/chunk-NU5W6VAV.js.map +1 -0
- package/dist/chunk-TGRTEWYV.js +195 -0
- package/dist/chunk-TGRTEWYV.js.map +1 -0
- package/dist/chunk-VDRNNGHX.js +184 -0
- package/dist/chunk-VDRNNGHX.js.map +1 -0
- package/dist/chunk-VN5LDWVN.js +32 -0
- package/dist/chunk-VN5LDWVN.js.map +1 -0
- package/dist/chunk-W2VK36RO.js +11 -0
- package/dist/chunk-W2VK36RO.js.map +1 -0
- package/dist/chunk-X24K52DG.js +12 -0
- package/dist/chunk-X24K52DG.js.map +1 -0
- package/dist/chunk-XLUWV45V.js +25 -0
- package/dist/chunk-XLUWV45V.js.map +1 -0
- package/dist/chunk-Y4RAPKKB.js +238 -0
- package/dist/chunk-Y4RAPKKB.js.map +1 -0
- package/dist/chunk-YXHH3MQT.js +230 -0
- package/dist/chunk-YXHH3MQT.js.map +1 -0
- package/dist/chunk-ZLPL2R3R.js +183 -0
- package/dist/chunk-ZLPL2R3R.js.map +1 -0
- package/dist/chunk-ZTQ5SP4H.js +9 -0
- package/dist/chunk-ZTQ5SP4H.js.map +1 -0
- package/dist/controller-Bod8YYr1.d.cts +172 -0
- package/dist/controller-DxVchfiA.d.ts +172 -0
- package/dist/dev-log-events-CVAM29hx.d.cts +123 -0
- package/dist/dev-log-events-CVAM29hx.d.ts +123 -0
- package/dist/handshake-CC_LrK5g.d.cts +31 -0
- package/dist/handshake-CC_LrK5g.d.ts +31 -0
- package/dist/host-8hmq_Sgc.d.cts +109 -0
- package/dist/host-Cw-N6e-5.d.ts +109 -0
- package/dist/index.cjs +8512 -3518
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +676 -1070
- package/dist/index.d.ts +676 -1070
- package/dist/index.js +4892 -3188
- package/dist/index.js.map +1 -1
- package/dist/metadata.cjs +114 -0
- package/dist/metadata.cjs.map +1 -0
- package/dist/metadata.d.cts +95 -0
- package/dist/metadata.d.ts +95 -0
- package/dist/metadata.js +83 -0
- package/dist/metadata.js.map +1 -0
- package/dist/notices-CnGaaS8B.d.ts +38 -0
- package/dist/notices-NyDM5Mtz.d.cts +38 -0
- package/dist/platform-machine.cjs +425 -0
- package/dist/platform-machine.cjs.map +1 -0
- package/dist/platform-machine.d.cts +1183 -0
- package/dist/platform-machine.d.ts +1183 -0
- package/dist/platform-machine.js +309 -0
- package/dist/platform-machine.js.map +1 -0
- package/dist/platform-settings-cuor3i11.d.cts +48 -0
- package/dist/platform-settings-cuor3i11.d.ts +48 -0
- package/dist/prefabs.cjs +36 -0
- package/dist/prefabs.cjs.map +1 -0
- package/dist/prefabs.d.cts +49 -0
- package/dist/prefabs.d.ts +49 -0
- package/dist/prefabs.js +8 -0
- package/dist/prefabs.js.map +1 -0
- package/dist/preview.cjs +2609 -0
- package/dist/preview.cjs.map +1 -0
- package/dist/preview.d.cts +155 -0
- package/dist/preview.d.ts +155 -0
- package/dist/preview.js +1671 -0
- package/dist/preview.js.map +1 -0
- package/dist/protocol.cjs +621 -54
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.cts +76 -240
- package/dist/protocol.d.ts +76 -240
- package/dist/protocol.js +100 -2
- package/dist/protocol.js.map +1 -1
- package/dist/realtime-client-Cu8yVJFw.d.cts +15 -0
- package/dist/realtime-client-Cu8yVJFw.d.ts +15 -0
- package/dist/release.cjs +143 -0
- package/dist/release.cjs.map +1 -0
- package/dist/release.d.cts +64 -0
- package/dist/release.d.ts +64 -0
- package/dist/release.js +43 -0
- package/dist/release.js.map +1 -0
- package/dist/standard-match-phase-BucA5dYo.d.ts +44 -0
- package/dist/standard-match-phase-U2ra8J-0.d.cts +44 -0
- package/dist/sync-B6QsNrXz.d.cts +125 -0
- package/dist/sync-B6QsNrXz.d.ts +125 -0
- package/dist/ui.cjs +2827 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.cts +320 -0
- package/dist/ui.d.ts +320 -0
- package/dist/ui.js +1718 -0
- package/dist/ui.js.map +1 -0
- package/dist/url-policy-C89zxgw9.d.cts +9 -0
- package/dist/url-policy-C89zxgw9.d.ts +9 -0
- package/package.json +154 -13
- package/src/agent/agent-action.ts +304 -0
- package/src/agent/agent-contract.ts +180 -0
- package/src/agent-tooling.ts +20 -0
- package/src/arcade/bridge/controller.ts +15 -0
- package/src/arcade/bridge/host.ts +12 -0
- package/src/arcade/bridge/iframe.ts +61 -0
- package/src/arcade/bridge.ts +3 -0
- package/src/arcade/host.ts +1 -0
- package/src/arcade/surface.ts +4 -0
- package/src/arcade/url.ts +60 -0
- package/src/arcade.ts +4 -0
- package/src/audio/audio-manager.ts +162 -171
- package/src/audio/hooks.tsx +218 -97
- package/src/audio/index.ts +1 -1
- package/src/audio/music.tsx +139 -0
- package/src/capabilities/manifest.ts +71 -0
- package/src/capabilities.ts +12 -0
- package/src/components/connection-status-pill.tsx +55 -0
- package/src/components/controller-player-name-field.tsx +119 -0
- package/src/components/controller-primary-action.tsx +58 -0
- package/src/components/host-mute-button.tsx +49 -0
- package/src/components/join-qr-overlay.tsx +133 -0
- package/src/components/join-url-action-buttons.tsx +95 -0
- package/src/components/join-url-controls.tsx +58 -0
- package/src/components/join-url-field.tsx +52 -0
- package/src/components/lifecycle-action-group.tsx +129 -0
- package/src/components/player-avatar-strip.tsx +65 -0
- package/src/components/player-avatar.tsx +42 -14
- package/src/components/room-qr-code.tsx +125 -0
- package/src/components/runtime-shell-header.tsx +37 -0
- package/src/components/shell-classes.ts +19 -0
- package/src/components/surface-orientation-layout.ts +60 -0
- package/src/components/surface-viewport-layout.ts +268 -0
- package/src/components/surface-viewport.tsx +314 -0
- package/src/components/ui/button.tsx +4 -6
- package/src/components/ui/slider.tsx +1 -1
- package/src/components/volume-controls.tsx +65 -6
- package/src/context/air-jam-context.tsx +209 -141
- package/src/context/index.ts +2 -2
- package/src/context/session-providers.tsx +77 -0
- package/src/context/session-scope.ts +64 -0
- package/src/context/socket-manager.ts +6 -25
- package/src/contracts/v2/bridge.ts +261 -0
- package/src/contracts/v2/handshake.ts +40 -0
- package/src/contracts/v2/index.ts +2 -0
- package/src/dev/browser-log-sink.ts +912 -0
- package/src/diagnostics.ts +128 -0
- package/src/events.ts +7 -34
- package/src/hooks/internal/use-controller-runtime-api.ts +875 -0
- package/src/hooks/internal/use-host-runtime-api.ts +1051 -0
- package/src/hooks/internal/use-runtime-control-contract.ts +15 -0
- package/src/hooks/internal/use-runtime-inspection-contract.ts +16 -0
- package/src/hooks/internal/use-runtime-observability-contract.ts +24 -0
- package/src/hooks/use-air-jam-controller.ts +155 -475
- package/src/hooks/use-air-jam-host.ts +156 -485
- package/src/hooks/use-connection-status.ts +8 -0
- package/src/hooks/use-controller-lifecycle-intents.ts +27 -0
- package/src/hooks/use-controller-lifecycle-permissions.ts +36 -0
- package/src/hooks/use-controller-shell-status.ts +40 -0
- package/src/hooks/use-controller-tick.ts +65 -0
- package/src/hooks/use-controller-toasts.ts +116 -0
- package/src/hooks/use-get-input.ts +8 -5
- package/src/hooks/use-host-arcade-restore.ts +30 -0
- package/src/hooks/use-host-join-controls.ts +152 -0
- package/src/hooks/use-host-tick.ts +171 -0
- package/src/hooks/use-input-writer.ts +83 -0
- package/src/hooks/use-lifecycle-action-group-model.ts +98 -0
- package/src/hooks/use-players.ts +12 -0
- package/src/hooks/use-room.ts +22 -0
- package/src/hooks/use-send-signal.ts +6 -2
- package/src/index.ts +205 -31
- package/src/internal/input-manager.ts +195 -215
- package/src/lifecycle/index.ts +9 -0
- package/src/lifecycle/standard-match-phase.ts +32 -0
- package/src/metadata/manifest.ts +152 -0
- package/src/metadata.ts +12 -0
- package/src/platform-machine.ts +475 -0
- package/src/prefabs/types.ts +82 -0
- package/src/prefabs.ts +12 -0
- package/src/preview/host-workspace.tsx +59 -0
- package/src/preview/identity.ts +66 -0
- package/src/preview/layout.ts +223 -0
- package/src/preview/manager.ts +577 -0
- package/src/preview/messages.ts +26 -0
- package/src/preview/ownership.ts +81 -0
- package/src/preview/url.ts +117 -0
- package/src/preview/window.tsx +490 -0
- package/src/preview/workspace.tsx +678 -0
- package/src/preview.ts +42 -0
- package/src/protocol/arcade-platform-actions.ts +29 -0
- package/src/protocol/controller.ts +187 -0
- package/src/protocol/core.ts +23 -0
- package/src/protocol/dev-log-events.ts +222 -0
- package/src/protocol/errors.ts +21 -0
- package/src/protocol/host-grant.ts +185 -0
- package/src/protocol/host.ts +138 -0
- package/src/protocol/notices.ts +43 -0
- package/src/protocol/signals.ts +38 -0
- package/src/protocol/socket-events.ts +154 -0
- package/src/protocol/sync.ts +121 -0
- package/src/protocol/url-policy.ts +63 -0
- package/src/protocol.ts +12 -386
- package/src/qrcode.d.ts +16 -0
- package/src/release.ts +99 -0
- package/src/runtime/air-jam-config.ts +287 -0
- package/src/runtime/air-jam-error-boundary.tsx +672 -0
- package/src/runtime/arcade-bridge-request-surface.ts +15 -0
- package/src/runtime/arcade-runtime-url.ts +95 -0
- package/src/runtime/arcade-surface-identity.ts +16 -0
- package/src/runtime/contracts/control.ts +68 -0
- package/src/runtime/contracts/inspection.ts +165 -0
- package/src/runtime/contracts/observability.ts +94 -0
- package/src/runtime/controller-bridge.ts +451 -0
- package/src/runtime/controller-identity.ts +132 -0
- package/src/runtime/controller-presentation.ts +24 -0
- package/src/runtime/controller-realtime-client.ts +591 -0
- package/src/runtime/create-air-jam-app.tsx +260 -0
- package/src/runtime/dev-runtime-events.ts +36 -0
- package/src/runtime/embedded-runtime-adapters.ts +68 -0
- package/src/runtime/host-bridge.ts +388 -0
- package/src/runtime/host-realtime-client.ts +550 -0
- package/src/runtime/iframe-bridge.ts +135 -0
- package/src/runtime/realtime-client.ts +20 -0
- package/src/runtime/router-basename.ts +25 -0
- package/src/runtime/runtime-owner-contexts.tsx +4 -0
- package/src/runtime/runtime-session-params.ts +169 -0
- package/src/runtime/sdk-version.ts +6 -0
- package/src/runtime/session-runtimes.tsx +188 -0
- package/src/runtime/validate-arcade-bridge-attach.ts +14 -0
- package/src/runtime-control.ts +10 -0
- package/src/runtime-inspection.ts +14 -0
- package/src/runtime-observability.ts +9 -0
- package/src/settings/platform-settings-bridge.ts +336 -0
- package/src/settings/platform-settings-runtime.tsx +387 -0
- package/src/settings/platform-settings.ts +288 -0
- package/src/state/connection-store.ts +80 -12
- package/src/store/air-jam-store-domain-constants.ts +4 -0
- package/src/store/create-air-jam-store.ts +1094 -227
- package/src/styles.css +4 -38
- package/src/ui.ts +29 -0
- package/src/utils/is-rpc-serializable.ts +56 -0
- package/src/utils/player-avatar-url.ts +48 -0
- package/src/utils/url-builder.ts +7 -0
- package/dist/.tsbuildinfo +0 -1
- package/dist/chunk-B5DURUWT.js +0 -80
- package/dist/chunk-B5DURUWT.js.map +0 -1
- package/src/AirJamClient.ts +0 -224
- package/src/audio/volume-store.ts +0 -124
- package/src/components/controller-shell.tsx +0 -346
- package/src/components/host-shell.tsx +0 -521
- package/src/components/qr-scanner-dialog.tsx +0 -373
- package/src/components/ui/alert.tsx +0 -66
- package/src/components/ui/avatar.tsx +0 -46
- package/src/components/ui/badge.tsx +0 -47
- package/src/components/ui/card.tsx +0 -92
- package/src/components/ui/dialog.tsx +0 -122
- package/src/components/ui/tabs.tsx +0 -64
- package/src/hooks/use-air-jam-shell.ts +0 -379
- package/src/hooks/use-fullscreen.ts +0 -108
package/src/preview.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export {
|
|
2
|
+
HostPreviewControllerWorkspace,
|
|
3
|
+
type HostPreviewControllerWorkspaceProps,
|
|
4
|
+
} from "./preview/host-workspace";
|
|
5
|
+
export {
|
|
6
|
+
AIR_JAM_PREVIEW_DEVICE_QUERY_PARAM,
|
|
7
|
+
AIR_JAM_PREVIEW_FLAG_QUERY_PARAM,
|
|
8
|
+
createPreviewControllerIdentity,
|
|
9
|
+
isPreviewControllerSearchParams,
|
|
10
|
+
normalizePreviewDeviceId,
|
|
11
|
+
readPreviewControllerDeviceIdFromLocation,
|
|
12
|
+
readPreviewControllerDeviceIdFromSearchParams,
|
|
13
|
+
type PreviewControllerIdentity,
|
|
14
|
+
} from "./preview/identity";
|
|
15
|
+
export {
|
|
16
|
+
usePreviewControllerManager,
|
|
17
|
+
type PreviewControllerSession,
|
|
18
|
+
type PreviewControllerSurfaceState,
|
|
19
|
+
type UsePreviewControllerManagerOptions,
|
|
20
|
+
type UsePreviewControllerManagerResult,
|
|
21
|
+
} from "./preview/manager";
|
|
22
|
+
export {
|
|
23
|
+
isEmbeddedArcadeRuntimeSearchParams,
|
|
24
|
+
resolveHostPreviewControllerWorkspaceEnabled,
|
|
25
|
+
type HostPreviewControllerWorkspaceEnabled,
|
|
26
|
+
type ResolveHostPreviewControllerWorkspaceEnabledOptions,
|
|
27
|
+
} from "./preview/ownership";
|
|
28
|
+
export {
|
|
29
|
+
buildPreviewControllerUrl,
|
|
30
|
+
createPreviewControllerLaunch,
|
|
31
|
+
type BuildPreviewControllerUrlOptions,
|
|
32
|
+
type PreviewControllerLaunch,
|
|
33
|
+
} from "./preview/url";
|
|
34
|
+
export {
|
|
35
|
+
PreviewControllerWindow,
|
|
36
|
+
previewControllerWindowStateLabel,
|
|
37
|
+
type PreviewControllerWindowProps,
|
|
38
|
+
} from "./preview/window";
|
|
39
|
+
export {
|
|
40
|
+
PreviewControllerWorkspace,
|
|
41
|
+
type PreviewControllerWorkspaceProps,
|
|
42
|
+
} from "./preview/workspace";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform (Arcade shell) commands sent as `controller:action_rpc` / `airjam:action_rpc` with
|
|
3
|
+
* `storeDomain: arcade.surface`. The server routes these to the **master** host socket so they
|
|
4
|
+
* always hit the outer Arcade shell, not an embedded child host.
|
|
5
|
+
*
|
|
6
|
+
* Gameplay actions must not use the `airjam.arcade.` prefix.
|
|
7
|
+
*/
|
|
8
|
+
export const AIRJAM_ARCADE_PLATFORM_ACTION_PREFIX = "airjam.arcade." as const;
|
|
9
|
+
|
|
10
|
+
/** Canonical action names for QR overlay and game exit from the controller shell. */
|
|
11
|
+
export const airJamArcadePlatformActions = {
|
|
12
|
+
ping: "airjam.arcade.ping",
|
|
13
|
+
toggleQr: "airjam.arcade.toggle_qr",
|
|
14
|
+
showQr: "airjam.arcade.show_qr",
|
|
15
|
+
hideQr: "airjam.arcade.hide_qr",
|
|
16
|
+
exitGame: "airjam.arcade.exit_game",
|
|
17
|
+
updateRoomSettings: "airjam.arcade.update_room_settings",
|
|
18
|
+
} as const;
|
|
19
|
+
|
|
20
|
+
export type AirJamArcadePlatformActionName =
|
|
21
|
+
(typeof airJamArcadePlatformActions)[keyof typeof airJamArcadePlatformActions];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Server routing: platform UI commands under `airjam.arcade.*` must be delivered to the master
|
|
25
|
+
* host (Arcade shell), not the active embedded game host.
|
|
26
|
+
*/
|
|
27
|
+
export const isAirJamArcadePlatformPrefixAction = (
|
|
28
|
+
actionName: string,
|
|
29
|
+
): boolean => actionName.startsWith(AIRJAM_ARCADE_PLATFORM_ACTION_PREFIX);
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { RoomPlatformSettingsSnapshot } from "../settings/platform-settings";
|
|
3
|
+
import { roomCodeSchema, type RoomCode } from "./core";
|
|
4
|
+
import type { ErrorCode } from "./errors";
|
|
5
|
+
|
|
6
|
+
export const controllerInputSchema = z.object({
|
|
7
|
+
roomId: roomCodeSchema,
|
|
8
|
+
controllerId: z.string().min(3),
|
|
9
|
+
input: z.record(z.string(), z.unknown()),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type ControllerInputPayload = Record<string, unknown>;
|
|
13
|
+
|
|
14
|
+
export interface ControllerInputEvent {
|
|
15
|
+
roomId: RoomCode;
|
|
16
|
+
controllerId: string;
|
|
17
|
+
input: ControllerInputPayload;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const controllerOrientationSchema = z.enum(["portrait", "landscape"]);
|
|
21
|
+
|
|
22
|
+
export type ControllerOrientation = z.infer<typeof controllerOrientationSchema>;
|
|
23
|
+
|
|
24
|
+
export const controllerSourceSchema = z.enum(["phone", "preview", "virtual"]);
|
|
25
|
+
|
|
26
|
+
export type ControllerSource = z.infer<typeof controllerSourceSchema>;
|
|
27
|
+
|
|
28
|
+
export const PREVIEW_CONTROLLER_DEVICE_ID_PREFIX = "pd_";
|
|
29
|
+
export const VIRTUAL_CONTROLLER_DEVICE_ID_PREFIX = "aj-mcp-device-";
|
|
30
|
+
|
|
31
|
+
export const inferControllerSourceFromDeviceId = (
|
|
32
|
+
deviceId: string | null | undefined,
|
|
33
|
+
): ControllerSource => {
|
|
34
|
+
const normalized = deviceId?.trim();
|
|
35
|
+
if (!normalized) {
|
|
36
|
+
return "phone";
|
|
37
|
+
}
|
|
38
|
+
if (normalized.startsWith(PREVIEW_CONTROLLER_DEVICE_ID_PREFIX)) {
|
|
39
|
+
return "preview";
|
|
40
|
+
}
|
|
41
|
+
if (normalized.startsWith(VIRTUAL_CONTROLLER_DEVICE_ID_PREFIX)) {
|
|
42
|
+
return "virtual";
|
|
43
|
+
}
|
|
44
|
+
return "phone";
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const controllerStateSchema = z.object({
|
|
48
|
+
roomId: roomCodeSchema,
|
|
49
|
+
state: z.object({
|
|
50
|
+
orientation: controllerOrientationSchema.optional(),
|
|
51
|
+
message: z.string().optional(),
|
|
52
|
+
roomSettings: z
|
|
53
|
+
.object({
|
|
54
|
+
audio: z.object({
|
|
55
|
+
masterVolume: z.number().min(0).max(1),
|
|
56
|
+
musicVolume: z.number().min(0).max(1),
|
|
57
|
+
sfxVolume: z.number().min(0).max(1),
|
|
58
|
+
}),
|
|
59
|
+
previewControllers: z.object({
|
|
60
|
+
activeOpacity: z.number().min(0).max(1),
|
|
61
|
+
}),
|
|
62
|
+
})
|
|
63
|
+
.optional(),
|
|
64
|
+
runtimeState: z.enum(["paused", "playing"]).optional(),
|
|
65
|
+
stateVersion: z.number().int().nonnegative().optional(),
|
|
66
|
+
}),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export type ControllerStateMessage = z.infer<typeof controllerStateSchema>;
|
|
70
|
+
|
|
71
|
+
export type ControllerStatePayload = z.infer<
|
|
72
|
+
typeof controllerStateSchema
|
|
73
|
+
>["state"];
|
|
74
|
+
export type ControllerRoomSettingsState = RoomPlatformSettingsSnapshot;
|
|
75
|
+
|
|
76
|
+
export const controllerJoinSchema = z.object({
|
|
77
|
+
roomId: roomCodeSchema,
|
|
78
|
+
controllerId: z.string().min(3),
|
|
79
|
+
/**
|
|
80
|
+
* Stable local controller device identity used as a reconnect hint.
|
|
81
|
+
* Older clients may omit this and fall back to controllerId-only behavior.
|
|
82
|
+
*/
|
|
83
|
+
deviceId: z.string().min(8).max(128).optional(),
|
|
84
|
+
nickname: z.string().trim().min(1).max(24).optional(),
|
|
85
|
+
/** Preset avatar key (platform-defined); optional at join. */
|
|
86
|
+
avatarId: z.string().trim().min(1).max(48).optional(),
|
|
87
|
+
capabilityToken: z.string().min(1).optional(),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export type ControllerJoinPayload = z.infer<typeof controllerJoinSchema>;
|
|
91
|
+
|
|
92
|
+
export const controllerLeaveSchema = z.object({
|
|
93
|
+
roomId: roomCodeSchema,
|
|
94
|
+
controllerId: z.string().min(3),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export type ControllerLeavePayload = z.infer<typeof controllerLeaveSchema>;
|
|
98
|
+
|
|
99
|
+
export interface ControllerLeaveAck {
|
|
100
|
+
ok: boolean;
|
|
101
|
+
message?: string;
|
|
102
|
+
code?: ErrorCode | string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const controllerSystemSchema = z.object({
|
|
106
|
+
roomId: roomCodeSchema,
|
|
107
|
+
command: z.enum(["exit", "pause", "resume"]),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export type ControllerSystemPayload = z.infer<typeof controllerSystemSchema>;
|
|
111
|
+
|
|
112
|
+
export interface PlayerProfile {
|
|
113
|
+
id: string;
|
|
114
|
+
label: string;
|
|
115
|
+
color?: string;
|
|
116
|
+
/** Preset avatar id chosen by the player (platform resolves to artwork). */
|
|
117
|
+
avatarId?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const playerProfilePatchSchema = z
|
|
121
|
+
.object({
|
|
122
|
+
label: z.string().trim().min(1).max(24).optional(),
|
|
123
|
+
avatarId: z.string().trim().min(1).max(48).optional(),
|
|
124
|
+
})
|
|
125
|
+
.strict();
|
|
126
|
+
|
|
127
|
+
export type PlayerProfilePatch = z.infer<typeof playerProfilePatchSchema>;
|
|
128
|
+
|
|
129
|
+
export const controllerUpdatePlayerProfileSchema = z
|
|
130
|
+
.object({
|
|
131
|
+
roomId: roomCodeSchema,
|
|
132
|
+
controllerId: z.string().min(3),
|
|
133
|
+
patch: playerProfilePatchSchema,
|
|
134
|
+
})
|
|
135
|
+
.refine(
|
|
136
|
+
(data) =>
|
|
137
|
+
data.patch.label !== undefined || data.patch.avatarId !== undefined,
|
|
138
|
+
{ message: "patch must include at least one field" },
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
export type ControllerUpdatePlayerProfilePayload = z.infer<
|
|
142
|
+
typeof controllerUpdatePlayerProfileSchema
|
|
143
|
+
>;
|
|
144
|
+
|
|
145
|
+
export interface ControllerUpdatePlayerProfileAck {
|
|
146
|
+
ok: boolean;
|
|
147
|
+
message?: string;
|
|
148
|
+
player?: PlayerProfile;
|
|
149
|
+
code?: ErrorCode | string;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface ControllerJoinAck {
|
|
153
|
+
ok: boolean;
|
|
154
|
+
controllerId?: string;
|
|
155
|
+
roomId?: RoomCode;
|
|
156
|
+
resumed?: boolean;
|
|
157
|
+
message?: string;
|
|
158
|
+
code?: ErrorCode | string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export const controllerPrivilegedGrantSchema = z.enum([
|
|
162
|
+
"system",
|
|
163
|
+
"play_sound",
|
|
164
|
+
"action_rpc",
|
|
165
|
+
]);
|
|
166
|
+
|
|
167
|
+
export type ControllerPrivilegedGrant = z.infer<
|
|
168
|
+
typeof controllerPrivilegedGrantSchema
|
|
169
|
+
>;
|
|
170
|
+
|
|
171
|
+
export const controllerPrivilegedCapabilitySchema = z.object({
|
|
172
|
+
token: z.string().min(1),
|
|
173
|
+
expiresAt: z.number().int().positive(),
|
|
174
|
+
grants: z.array(controllerPrivilegedGrantSchema).min(1),
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
export type ControllerPrivilegedCapability = z.infer<
|
|
178
|
+
typeof controllerPrivilegedCapabilitySchema
|
|
179
|
+
>;
|
|
180
|
+
|
|
181
|
+
export interface ControllerSocketAuthority {
|
|
182
|
+
roomId: RoomCode;
|
|
183
|
+
controllerId: string;
|
|
184
|
+
deviceId: string;
|
|
185
|
+
joinedAt: number;
|
|
186
|
+
privilegedGrants: ControllerPrivilegedGrant[];
|
|
187
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export type RoomCode = string;
|
|
4
|
+
|
|
5
|
+
export type ConnectionRole = "host" | "controller";
|
|
6
|
+
|
|
7
|
+
export type ConnectionStatus =
|
|
8
|
+
| "idle"
|
|
9
|
+
| "connecting"
|
|
10
|
+
| "connected"
|
|
11
|
+
| "disconnected"
|
|
12
|
+
| "reconnecting";
|
|
13
|
+
|
|
14
|
+
export type RunMode = "standalone" | "platform";
|
|
15
|
+
|
|
16
|
+
export type RuntimeState = "paused" | "playing";
|
|
17
|
+
|
|
18
|
+
export const roomCodeSchema = z
|
|
19
|
+
.string()
|
|
20
|
+
.trim()
|
|
21
|
+
.min(4)
|
|
22
|
+
.max(8)
|
|
23
|
+
.regex(/^[A-Z0-9]+$/, { message: "room code must contain only A-Z or 0-9" });
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
export type AirJamDevBrowserLogSource =
|
|
2
|
+
| "console"
|
|
3
|
+
| "window-error"
|
|
4
|
+
| "unhandledrejection"
|
|
5
|
+
| "diagnostic"
|
|
6
|
+
| "runtime";
|
|
7
|
+
|
|
8
|
+
export type AirJamDevBrowserConsoleCategory =
|
|
9
|
+
| "airjam"
|
|
10
|
+
| "app"
|
|
11
|
+
| "framework"
|
|
12
|
+
| "browser";
|
|
13
|
+
|
|
14
|
+
const describeBrowserConsoleValue = (value: unknown): string => {
|
|
15
|
+
if (typeof value === "string") {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
if (value instanceof Error) {
|
|
19
|
+
return value.message;
|
|
20
|
+
}
|
|
21
|
+
if (value === undefined) {
|
|
22
|
+
return "undefined";
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
return JSON.stringify(value);
|
|
26
|
+
} catch {
|
|
27
|
+
return String(value);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const matchesAnyPrefix = (value: string, prefixes: string[]): boolean => {
|
|
32
|
+
return prefixes.some((prefix) => value.startsWith(prefix));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const resolveAirJamBrowserConsoleCategory = (
|
|
36
|
+
value: string | unknown[],
|
|
37
|
+
): AirJamDevBrowserConsoleCategory => {
|
|
38
|
+
const message =
|
|
39
|
+
typeof value === "string"
|
|
40
|
+
? value
|
|
41
|
+
: value.map((entry) => describeBrowserConsoleValue(entry)).join(" ");
|
|
42
|
+
const firstText =
|
|
43
|
+
typeof value === "string"
|
|
44
|
+
? value
|
|
45
|
+
: typeof value[0] === "string"
|
|
46
|
+
? value[0]
|
|
47
|
+
: "";
|
|
48
|
+
|
|
49
|
+
if (
|
|
50
|
+
matchesAnyPrefix(message, [
|
|
51
|
+
"[AirJam]",
|
|
52
|
+
"[Arcade]",
|
|
53
|
+
"[GamePlayer]",
|
|
54
|
+
"[InputManager]",
|
|
55
|
+
"[Arcade][AJ_",
|
|
56
|
+
]) ||
|
|
57
|
+
matchesAnyPrefix(firstText, [
|
|
58
|
+
"[AirJam]",
|
|
59
|
+
"[Arcade]",
|
|
60
|
+
"[GamePlayer]",
|
|
61
|
+
"[InputManager]",
|
|
62
|
+
"[Arcade][AJ_",
|
|
63
|
+
])
|
|
64
|
+
) {
|
|
65
|
+
return "airjam";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (
|
|
69
|
+
matchesAnyPrefix(firstText, ["%c >> query", "%c << query"]) ||
|
|
70
|
+
message.startsWith("[Fast Refresh]") ||
|
|
71
|
+
message.includes("Download the React DevTools") ||
|
|
72
|
+
message.includes("No routes matched location") ||
|
|
73
|
+
message.startsWith("Warning:")
|
|
74
|
+
) {
|
|
75
|
+
return "framework";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (
|
|
79
|
+
message.includes("Largest Contentful Paint") ||
|
|
80
|
+
message.startsWith('Image with src "') ||
|
|
81
|
+
message.includes("ResizeObserver loop")
|
|
82
|
+
) {
|
|
83
|
+
return "browser";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return "app";
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const AIRJAM_DEV_LOG_EVENTS = {
|
|
90
|
+
server: {
|
|
91
|
+
started: "server.started",
|
|
92
|
+
startupFailed: "server.startup.failed",
|
|
93
|
+
},
|
|
94
|
+
socket: {
|
|
95
|
+
connected: "socket.connected",
|
|
96
|
+
disconnected: "socket.disconnected",
|
|
97
|
+
},
|
|
98
|
+
auth: {
|
|
99
|
+
modeDisabled: "auth.mode.disabled",
|
|
100
|
+
modeMasterKey: "auth.mode.master_key",
|
|
101
|
+
modeDatabaseAndHostGrant: "auth.mode.database_and_host_grant",
|
|
102
|
+
modeDatabase: "auth.mode.database",
|
|
103
|
+
modeHostGrantOnly: "auth.mode.host_grant_only",
|
|
104
|
+
backendMissing: "auth.backend.missing",
|
|
105
|
+
appIdLastUsedAtUpdateFailed: "auth.app_id_last_used_at_update.failed",
|
|
106
|
+
appIdVerificationDatabaseError: "auth.app_id_verification.database_error",
|
|
107
|
+
},
|
|
108
|
+
browser: {
|
|
109
|
+
logSessionStarted: "browser.log_session.started",
|
|
110
|
+
logBatchReceived: "browser.log_batch.received",
|
|
111
|
+
console: "browser.console",
|
|
112
|
+
windowError: "browser.window_error",
|
|
113
|
+
unhandledRejection: "browser.unhandled_rejection",
|
|
114
|
+
diagnostic: "browser.diagnostic",
|
|
115
|
+
runtime: "browser.runtime",
|
|
116
|
+
},
|
|
117
|
+
runtime: {
|
|
118
|
+
providerMounted: "runtime.provider.mounted",
|
|
119
|
+
providerUnmounted: "runtime.provider.unmounted",
|
|
120
|
+
windowBeforeUnload: "runtime.window.beforeunload",
|
|
121
|
+
windowPageHide: "runtime.window.pagehide",
|
|
122
|
+
socketConnected: "runtime.socket.connected",
|
|
123
|
+
socketDisconnected: "runtime.socket.disconnected",
|
|
124
|
+
socketConnectError: "runtime.socket.connect_error",
|
|
125
|
+
hostCreateRoomRequested: "runtime.host.create_room.requested",
|
|
126
|
+
hostReconnectRequested: "runtime.host.reconnect.requested",
|
|
127
|
+
hostReconnectRetryScheduled: "runtime.host.reconnect.retry_scheduled",
|
|
128
|
+
hostResetRoomRequested: "runtime.host.reset_room.requested",
|
|
129
|
+
hostStateReceived: "runtime.host.state.received",
|
|
130
|
+
controllerJoinRequested: "runtime.controller.join.requested",
|
|
131
|
+
controllerStateReceived: "runtime.controller.state.received",
|
|
132
|
+
phaseTransition: "runtime.phase.transition",
|
|
133
|
+
stateVersionReceived: "runtime.state_version.received",
|
|
134
|
+
invariantViolation: "runtime.invariant.violation",
|
|
135
|
+
embeddedBridgeRequested: "runtime.embedded_bridge.requested",
|
|
136
|
+
embeddedBridgeAttached: "runtime.embedded_bridge.attached",
|
|
137
|
+
embeddedBridgeRejected: "runtime.embedded_bridge.rejected",
|
|
138
|
+
embeddedBridgeClosed: "runtime.embedded_bridge.closed",
|
|
139
|
+
browserLogSinkFailure: "runtime.browser_log_sink.failure",
|
|
140
|
+
},
|
|
141
|
+
host: {
|
|
142
|
+
lifecycleRejected: "host.lifecycle.rejected",
|
|
143
|
+
bootstrapVerified: "host.bootstrap.verified",
|
|
144
|
+
bootstrapRejected: "host.bootstrap.rejected",
|
|
145
|
+
disconnectPendingRoomClose: "host.disconnect.pending_room_close",
|
|
146
|
+
disconnectRoomClosed: "host.disconnect.room_closed",
|
|
147
|
+
registerSystemAccepted: "host.register_system.accepted",
|
|
148
|
+
registerSystemRejected: "host.register_system.rejected",
|
|
149
|
+
createRoomAccepted: "host.create_room.accepted",
|
|
150
|
+
createRoomRejected: "host.create_room.rejected",
|
|
151
|
+
reconnectAccepted: "host.reconnect.accepted",
|
|
152
|
+
reconnectRejected: "host.reconnect.rejected",
|
|
153
|
+
resetRoomAccepted: "host.reset_room.accepted",
|
|
154
|
+
resetRoomRejected: "host.reset_room.rejected",
|
|
155
|
+
systemAccepted: "host.system.accepted",
|
|
156
|
+
systemRejected: "host.system.rejected",
|
|
157
|
+
stateRejected: "host.state.rejected",
|
|
158
|
+
signalRejected: "host.signal.rejected",
|
|
159
|
+
playSoundRejected: "host.play_sound.rejected",
|
|
160
|
+
stateBroadcastSummary: "host.state_broadcast.summary",
|
|
161
|
+
reconnectStateReconcile: "host.reconnect.state_reconcile",
|
|
162
|
+
stateSyncSummary: "host.state_sync.summary",
|
|
163
|
+
stateSyncRejected: "host.state_sync.rejected",
|
|
164
|
+
},
|
|
165
|
+
controller: {
|
|
166
|
+
joinAccepted: "controller.join.accepted",
|
|
167
|
+
joinRejected: "controller.join.rejected",
|
|
168
|
+
resumeAccepted: "controller.resume.accepted",
|
|
169
|
+
disconnectPendingResume: "controller.disconnect.pending_resume",
|
|
170
|
+
disconnectLeaseExpired: "controller.disconnect.lease_expired",
|
|
171
|
+
disconnectApplied: "controller.disconnect.applied",
|
|
172
|
+
profileUpdateAccepted: "controller.profile_update.accepted",
|
|
173
|
+
profileUpdateRejected: "controller.profile_update.rejected",
|
|
174
|
+
leaveAccepted: "controller.leave.accepted",
|
|
175
|
+
leaveRejected: "controller.leave.rejected",
|
|
176
|
+
inputSummary: "controller.input.summary",
|
|
177
|
+
inputDroppedSummary: "controller.input_dropped.summary",
|
|
178
|
+
inputRejected: "controller.input.rejected",
|
|
179
|
+
systemAccepted: "controller.system.accepted",
|
|
180
|
+
systemRejected: "controller.system.rejected",
|
|
181
|
+
playSoundRejected: "controller.play_sound.rejected",
|
|
182
|
+
actionRpcSummary: "controller.action_rpc.summary",
|
|
183
|
+
actionRpcRejected: "controller.action_rpc.rejected",
|
|
184
|
+
},
|
|
185
|
+
system: {
|
|
186
|
+
launchGameAccepted: "system.launch_game.accepted",
|
|
187
|
+
launchGameRejected: "system.launch_game.rejected",
|
|
188
|
+
closeGameAccepted: "system.close_game.accepted",
|
|
189
|
+
closeGameRejected: "system.close_game.rejected",
|
|
190
|
+
},
|
|
191
|
+
childHost: {
|
|
192
|
+
joinAccepted: "child_host.join.accepted",
|
|
193
|
+
joinRejected: "child_host.join.rejected",
|
|
194
|
+
disconnectPendingSystemFocus: "child_host.disconnect.pending_system_focus",
|
|
195
|
+
disconnectSystemFocusRestored:
|
|
196
|
+
"child_host.disconnect.system_focus_restored",
|
|
197
|
+
},
|
|
198
|
+
embeddedGame: {
|
|
199
|
+
activateAccepted: "embedded_game.activate.accepted",
|
|
200
|
+
activateRejected: "embedded_game.activate.rejected",
|
|
201
|
+
},
|
|
202
|
+
} as const;
|
|
203
|
+
|
|
204
|
+
type ValueOf<T> = T[keyof T];
|
|
205
|
+
|
|
206
|
+
export type AirJamDevLogEventName = ValueOf<{
|
|
207
|
+
[Group in keyof typeof AIRJAM_DEV_LOG_EVENTS]: ValueOf<
|
|
208
|
+
(typeof AIRJAM_DEV_LOG_EVENTS)[Group]
|
|
209
|
+
>;
|
|
210
|
+
}>;
|
|
211
|
+
|
|
212
|
+
const AIRJAM_BROWSER_LOG_EVENT_BY_SOURCE = {
|
|
213
|
+
console: AIRJAM_DEV_LOG_EVENTS.browser.console,
|
|
214
|
+
"window-error": AIRJAM_DEV_LOG_EVENTS.browser.windowError,
|
|
215
|
+
unhandledrejection: AIRJAM_DEV_LOG_EVENTS.browser.unhandledRejection,
|
|
216
|
+
diagnostic: AIRJAM_DEV_LOG_EVENTS.browser.diagnostic,
|
|
217
|
+
runtime: AIRJAM_DEV_LOG_EVENTS.browser.runtime,
|
|
218
|
+
} as const satisfies Record<AirJamDevBrowserLogSource, AirJamDevLogEventName>;
|
|
219
|
+
|
|
220
|
+
export const resolveAirJamBrowserLogEvent = (
|
|
221
|
+
source: AirJamDevBrowserLogSource,
|
|
222
|
+
): AirJamDevLogEventName => AIRJAM_BROWSER_LOG_EVENT_BY_SOURCE[source];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export enum ErrorCode {
|
|
2
|
+
ROOM_NOT_FOUND = "ROOM_NOT_FOUND",
|
|
3
|
+
ROOM_FULL = "ROOM_FULL",
|
|
4
|
+
INVALID_APP_ID = "INVALID_APP_ID",
|
|
5
|
+
UNAUTHORIZED = "UNAUTHORIZED",
|
|
6
|
+
INVALID_TOKEN = "INVALID_TOKEN",
|
|
7
|
+
TOKEN_EXPIRED = "TOKEN_EXPIRED",
|
|
8
|
+
CONNECTION_FAILED = "CONNECTION_FAILED",
|
|
9
|
+
ALREADY_CONNECTED = "ALREADY_CONNECTED",
|
|
10
|
+
INVALID_PAYLOAD = "INVALID_PAYLOAD",
|
|
11
|
+
INVALID_ROOM_CODE = "INVALID_ROOM_CODE",
|
|
12
|
+
INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
|
|
13
|
+
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
|
|
14
|
+
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ServerErrorPayload {
|
|
18
|
+
code: ErrorCode | string;
|
|
19
|
+
message: string;
|
|
20
|
+
details?: unknown;
|
|
21
|
+
}
|