@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/dist/protocol.d.ts
CHANGED
|
@@ -1,283 +1,119 @@
|
|
|
1
|
+
import { b as ControllerStateMessage, c as ControllerJoinPayload, d as ControllerJoinAck, e as ControllerUpdatePlayerProfilePayload, f as ControllerUpdatePlayerProfileAck, g as ControllerLeavePayload, h as ControllerLeaveAck, i as ControllerInputEvent, j as ControllerSystemPayload, S as ServerErrorPayload, k as ControllerSocketAuthority } from './controller-DxVchfiA.js';
|
|
2
|
+
export { G as ConnectionRole, H as ConnectionStatus, m as ControllerInputPayload, o as ControllerOrientation, C as ControllerPrivilegedCapability, D as ControllerPrivilegedGrant, u as ControllerRoomSettingsState, a as ControllerSource, t as ControllerStatePayload, E as ErrorCode, q as PREVIEW_CONTROLLER_DEVICE_ID_PREFIX, P as PlayerProfile, z as PlayerProfilePatch, R as RoomCode, I as RunMode, J as RuntimeState, V as VIRTUAL_CONTROLLER_DEVICE_ID_PREFIX, l as controllerInputSchema, v as controllerJoinSchema, w as controllerLeaveSchema, n as controllerOrientationSchema, F as controllerPrivilegedCapabilitySchema, B as controllerPrivilegedGrantSchema, p as controllerSourceSchema, s as controllerStateSchema, x as controllerSystemSchema, A as controllerUpdatePlayerProfileSchema, r as inferControllerSourceFromDeviceId, y as playerProfilePatchSchema, K as roomCodeSchema } from './controller-DxVchfiA.js';
|
|
3
|
+
export { b as AIRJAM_DEV_LOG_EVENTS, a as AirJamDevBrowserConsoleCategory, A as AirJamDevBrowserLogSource, c as AirJamDevLogEventName, r as resolveAirJamBrowserConsoleCategory, d as resolveAirJamBrowserLogEvent } from './dev-log-events-CVAM29hx.js';
|
|
4
|
+
import { H as HostBootstrapPayload, a as HostBootstrapAck, b as HostRegisterSystemPayload, c as HostRegistrationAck, d as HostCreateRoomPayload, e as HostReconnectPayload, f as HostResetRoomPayload, g as HostRemoveControllerPayload, h as HostControllerActionAck, S as SystemLaunchGamePayload, i as SystemLaunchGameAck, j as HostJoinAsChildPayload, k as HostActivateEmbeddedGamePayload, l as HostSocketAuthority } from './host-Cw-N6e-5.js';
|
|
5
|
+
export { C as ChildHostCapability, p as HostArcadeSessionSnapshot, n as HostSessionKind, o as childHostCapabilitySchema, u as hostActivateEmbeddedGameSchema, q as hostBootstrapSchema, v as hostCreateRoomSchema, t as hostJoinAsChildSchema, w as hostReconnectSchema, r as hostRegisterSystemSchema, y as hostRemoveControllerSchema, x as hostResetRoomSchema, m as hostSessionKindSchema, s as systemLaunchGameSchema } from './host-Cw-N6e-5.js';
|
|
1
6
|
import { z } from 'zod';
|
|
7
|
+
import { R as RoomReadyNotice, a as ControllerJoinedNotice, b as ControllerLeftNotice, P as PlayerUpdatedNotice, c as ControllerWelcomePayload, H as HostLeftNotice } from './notices-CnGaaS8B.js';
|
|
8
|
+
export { C as ControllerPresenceNotice } from './notices-CnGaaS8B.js';
|
|
9
|
+
import { S as SignalPayload, P as PlaySoundEventPayload, H as HostStateSyncPayload, C as ControllerActionRpcPayload, A as AirJamActionInvocationResult, a as HostActionRpcPayload, b as ControllerStateSyncRequestPayload, c as PlaySoundPayload, d as AirJamStateSyncPayload, e as AirJamActionRpcPayload, f as AirJamStateSyncRequestPayload } from './sync-B6QsNrXz.js';
|
|
10
|
+
export { m as AirJamActionAccepted, j as AirJamActionActor, i as AirJamActionActorRole, k as AirJamActionPayload, n as AirJamActionRejected, h as HapticSignalPayload, g as SignalType, T as ToastSignalPayload, l as airJamActionPayloadSchema, o as controllerActionRpcSchema, r as controllerStateSyncRequestSchema, p as hostActionRpcSchema, q as hostStateSyncSchema } from './sync-B6QsNrXz.js';
|
|
11
|
+
export { a as appendRuntimeQueryParams, g as getRuntimeUrlOrigin, i as isTrustedRuntimeMessageOrigin, n as normalizeRuntimeUrl, r as runtimeUrlSchema } from './url-policy-C89zxgw9.js';
|
|
12
|
+
import './platform-settings-cuor3i11.js';
|
|
2
13
|
|
|
3
|
-
type RoomCode = string;
|
|
4
|
-
type ConnectionRole = "host" | "controller";
|
|
5
|
-
type ConnectionStatus = "idle" | "connecting" | "connected" | "disconnected" | "reconnecting";
|
|
6
|
-
type RunMode = "standalone" | "platform";
|
|
7
|
-
type GameState = "paused" | "playing";
|
|
8
|
-
declare const roomCodeSchema: z.ZodString;
|
|
9
|
-
declare const controllerInputSchema: z.ZodObject<{
|
|
10
|
-
roomId: z.ZodString;
|
|
11
|
-
controllerId: z.ZodString;
|
|
12
|
-
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
|
-
type ControllerInputPayload = Record<string, unknown>;
|
|
15
|
-
interface ControllerInputEvent {
|
|
16
|
-
roomId: RoomCode;
|
|
17
|
-
controllerId: string;
|
|
18
|
-
input: ControllerInputPayload;
|
|
19
|
-
}
|
|
20
|
-
declare const controllerStateSchema: z.ZodObject<{
|
|
21
|
-
roomId: z.ZodString;
|
|
22
|
-
state: z.ZodObject<{
|
|
23
|
-
orientation: z.ZodOptional<z.ZodEnum<{
|
|
24
|
-
portrait: "portrait";
|
|
25
|
-
landscape: "landscape";
|
|
26
|
-
}>>;
|
|
27
|
-
message: z.ZodOptional<z.ZodString>;
|
|
28
|
-
gameState: z.ZodOptional<z.ZodEnum<{
|
|
29
|
-
paused: "paused";
|
|
30
|
-
playing: "playing";
|
|
31
|
-
}>>;
|
|
32
|
-
}, z.core.$strip>;
|
|
33
|
-
}, z.core.$strip>;
|
|
34
|
-
type ControllerStateMessage = z.infer<typeof controllerStateSchema>;
|
|
35
|
-
type ControllerStatePayload = z.infer<typeof controllerStateSchema>["state"];
|
|
36
|
-
declare const hostRegistrationSchema: z.ZodObject<{
|
|
37
|
-
roomId: z.ZodString;
|
|
38
|
-
maxPlayers: z.ZodDefault<z.ZodNumber>;
|
|
39
|
-
apiKey: z.ZodOptional<z.ZodString>;
|
|
40
|
-
mode: z.ZodDefault<z.ZodEnum<{
|
|
41
|
-
master: "master";
|
|
42
|
-
child: "child";
|
|
43
|
-
}>>;
|
|
44
|
-
controllerUrl: z.ZodOptional<z.ZodString>;
|
|
45
|
-
}, z.core.$strip>;
|
|
46
|
-
type HostRegistrationPayload = z.infer<typeof hostRegistrationSchema>;
|
|
47
|
-
declare const controllerJoinSchema: z.ZodObject<{
|
|
48
|
-
roomId: z.ZodString;
|
|
49
|
-
controllerId: z.ZodString;
|
|
50
|
-
nickname: z.ZodOptional<z.ZodString>;
|
|
51
|
-
}, z.core.$strip>;
|
|
52
|
-
type ControllerJoinPayload = z.infer<typeof controllerJoinSchema>;
|
|
53
|
-
declare const controllerLeaveSchema: z.ZodObject<{
|
|
54
|
-
roomId: z.ZodString;
|
|
55
|
-
controllerId: z.ZodString;
|
|
56
|
-
}, z.core.$strip>;
|
|
57
|
-
type ControllerLeavePayload = z.infer<typeof controllerLeaveSchema>;
|
|
58
|
-
interface PlayerProfile {
|
|
59
|
-
id: string;
|
|
60
|
-
label: string;
|
|
61
|
-
color?: string;
|
|
62
|
-
}
|
|
63
|
-
interface HostRegistrationAck {
|
|
64
|
-
ok: boolean;
|
|
65
|
-
roomId?: RoomCode;
|
|
66
|
-
message?: string;
|
|
67
|
-
code?: ErrorCode | string;
|
|
68
|
-
}
|
|
69
|
-
interface ControllerJoinAck {
|
|
70
|
-
ok: boolean;
|
|
71
|
-
controllerId?: string;
|
|
72
|
-
roomId?: RoomCode;
|
|
73
|
-
message?: string;
|
|
74
|
-
code?: ErrorCode | string;
|
|
75
|
-
}
|
|
76
|
-
declare const controllerSystemSchema: z.ZodObject<{
|
|
77
|
-
roomId: z.ZodString;
|
|
78
|
-
command: z.ZodEnum<{
|
|
79
|
-
exit: "exit";
|
|
80
|
-
ready: "ready";
|
|
81
|
-
toggle_pause: "toggle_pause";
|
|
82
|
-
}>;
|
|
83
|
-
}, z.core.$strip>;
|
|
84
|
-
type ControllerSystemPayload = z.infer<typeof controllerSystemSchema>;
|
|
85
14
|
/**
|
|
86
|
-
*
|
|
15
|
+
* Platform (Arcade shell) commands sent as `controller:action_rpc` / `airjam:action_rpc` with
|
|
16
|
+
* `storeDomain: arcade.surface`. The server routes these to the **master** host socket so they
|
|
17
|
+
* always hit the outer Arcade shell, not an embedded child host.
|
|
18
|
+
*
|
|
19
|
+
* Gameplay actions must not use the `airjam.arcade.` prefix.
|
|
87
20
|
*/
|
|
88
|
-
declare
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
INVALID_PAYLOAD = "INVALID_PAYLOAD",
|
|
98
|
-
INVALID_ROOM_CODE = "INVALID_ROOM_CODE",
|
|
99
|
-
INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
|
|
100
|
-
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
|
|
101
|
-
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Standardized error payload
|
|
105
|
-
*/
|
|
106
|
-
interface ServerErrorPayload {
|
|
107
|
-
code: ErrorCode | string;
|
|
108
|
-
message: string;
|
|
109
|
-
details?: unknown;
|
|
110
|
-
}
|
|
111
|
-
interface ControllerWelcomePayload {
|
|
112
|
-
controllerId: string;
|
|
113
|
-
roomId: RoomCode;
|
|
114
|
-
player?: PlayerProfile;
|
|
115
|
-
}
|
|
116
|
-
interface ControllerJoinedNotice {
|
|
117
|
-
controllerId: string;
|
|
118
|
-
nickname?: string;
|
|
119
|
-
player?: PlayerProfile;
|
|
120
|
-
}
|
|
121
|
-
interface ControllerLeftNotice {
|
|
122
|
-
controllerId: string;
|
|
123
|
-
}
|
|
124
|
-
interface RoomReadyNotice {
|
|
125
|
-
roomId: RoomCode;
|
|
126
|
-
}
|
|
127
|
-
interface HostLeftNotice {
|
|
128
|
-
roomId: RoomCode;
|
|
129
|
-
reason: string;
|
|
130
|
-
}
|
|
131
|
-
type SignalType = "HAPTIC" | "TOAST";
|
|
132
|
-
interface HapticSignalPayload {
|
|
133
|
-
pattern: "light" | "medium" | "heavy" | "success" | "failure" | "custom";
|
|
134
|
-
sequence?: number | number[];
|
|
135
|
-
}
|
|
136
|
-
interface ToastSignalPayload {
|
|
137
|
-
message: string;
|
|
138
|
-
color?: string;
|
|
139
|
-
duration?: number;
|
|
140
|
-
}
|
|
141
|
-
type SignalPayload = {
|
|
142
|
-
targetId?: string;
|
|
143
|
-
type: "HAPTIC";
|
|
144
|
-
payload: HapticSignalPayload;
|
|
145
|
-
} | {
|
|
146
|
-
targetId?: string;
|
|
147
|
-
type: "TOAST";
|
|
148
|
-
payload: ToastSignalPayload;
|
|
21
|
+
declare const AIRJAM_ARCADE_PLATFORM_ACTION_PREFIX: "airjam.arcade.";
|
|
22
|
+
/** Canonical action names for QR overlay and game exit from the controller shell. */
|
|
23
|
+
declare const airJamArcadePlatformActions: {
|
|
24
|
+
readonly ping: "airjam.arcade.ping";
|
|
25
|
+
readonly toggleQr: "airjam.arcade.toggle_qr";
|
|
26
|
+
readonly showQr: "airjam.arcade.show_qr";
|
|
27
|
+
readonly hideQr: "airjam.arcade.hide_qr";
|
|
28
|
+
readonly exitGame: "airjam.arcade.exit_game";
|
|
29
|
+
readonly updateRoomSettings: "airjam.arcade.update_room_settings";
|
|
149
30
|
};
|
|
150
|
-
|
|
151
|
-
roomId: string;
|
|
152
|
-
targetControllerId?: string;
|
|
153
|
-
soundId: string;
|
|
154
|
-
volume?: number;
|
|
155
|
-
loop?: boolean;
|
|
156
|
-
}
|
|
157
|
-
declare const hostRegisterSystemSchema: z.ZodObject<{
|
|
158
|
-
roomId: z.ZodString;
|
|
159
|
-
apiKey: z.ZodOptional<z.ZodString>;
|
|
160
|
-
}, z.core.$strip>;
|
|
161
|
-
type HostRegisterSystemPayload = z.infer<typeof hostRegisterSystemSchema>;
|
|
162
|
-
declare const systemLaunchGameSchema: z.ZodObject<{
|
|
163
|
-
roomId: z.ZodString;
|
|
164
|
-
gameId: z.ZodString;
|
|
165
|
-
gameUrl: z.ZodString;
|
|
166
|
-
}, z.core.$strip>;
|
|
167
|
-
type SystemLaunchGamePayload = z.infer<typeof systemLaunchGameSchema>;
|
|
168
|
-
declare const hostJoinAsChildSchema: z.ZodObject<{
|
|
169
|
-
roomId: z.ZodString;
|
|
170
|
-
joinToken: z.ZodString;
|
|
171
|
-
}, z.core.$strip>;
|
|
172
|
-
type HostJoinAsChildPayload = z.infer<typeof hostJoinAsChildSchema>;
|
|
31
|
+
type AirJamArcadePlatformActionName = (typeof airJamArcadePlatformActions)[keyof typeof airJamArcadePlatformActions];
|
|
173
32
|
/**
|
|
174
|
-
*
|
|
33
|
+
* Server routing: platform UI commands under `airjam.arcade.*` must be delivered to the master
|
|
34
|
+
* host (Arcade shell), not the active embedded game host.
|
|
175
35
|
*/
|
|
176
|
-
declare const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
apiKey: z.ZodOptional<z.ZodString>;
|
|
36
|
+
declare const isAirJamArcadePlatformPrefixAction: (actionName: string) => boolean;
|
|
37
|
+
|
|
38
|
+
declare const hostGrantScopeSchema: z.ZodLiteral<"host:bootstrap">;
|
|
39
|
+
declare const hostGrantClaimsSchema: z.ZodObject<{
|
|
40
|
+
typ: z.ZodLiteral<"airjam.host_grant.v1">;
|
|
41
|
+
appId: z.ZodString;
|
|
42
|
+
exp: z.ZodNumber;
|
|
43
|
+
iat: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodLiteral<"host:bootstrap">>>;
|
|
45
|
+
origins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
187
46
|
}, z.core.$strip>;
|
|
188
|
-
type
|
|
189
|
-
interface
|
|
47
|
+
type HostGrantClaims = z.infer<typeof hostGrantClaimsSchema>;
|
|
48
|
+
interface CreateHostGrantInput {
|
|
49
|
+
secret: string;
|
|
50
|
+
claims: Pick<HostGrantClaims, "appId" | "exp"> & Partial<Pick<HostGrantClaims, "typ" | "iat" | "scopes" | "origins">>;
|
|
51
|
+
}
|
|
52
|
+
declare const createHostGrant: ({ secret, claims, }: CreateHostGrantInput) => Promise<string>;
|
|
53
|
+
interface VerifyHostGrantInput {
|
|
54
|
+
secret: string;
|
|
55
|
+
token: string;
|
|
56
|
+
now?: number;
|
|
57
|
+
}
|
|
58
|
+
interface VerifyHostGrantResult {
|
|
190
59
|
ok: boolean;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
code?: ErrorCode | string;
|
|
194
|
-
}
|
|
195
|
-
interface ClientLoadUiPayload {
|
|
196
|
-
url: string;
|
|
197
|
-
}
|
|
198
|
-
interface HostStateSyncPayload {
|
|
199
|
-
roomId: string;
|
|
200
|
-
data: Record<string, unknown>;
|
|
201
|
-
}
|
|
202
|
-
interface ControllerActionRpcPayload {
|
|
203
|
-
roomId: string;
|
|
204
|
-
actionName: string;
|
|
205
|
-
args: unknown[];
|
|
206
|
-
controllerId: string;
|
|
207
|
-
}
|
|
208
|
-
interface AirJamStateSyncPayload {
|
|
209
|
-
roomId: string;
|
|
210
|
-
data: Record<string, unknown>;
|
|
211
|
-
}
|
|
212
|
-
interface AirJamActionRpcPayload {
|
|
213
|
-
actionName: string;
|
|
214
|
-
args: unknown[];
|
|
215
|
-
controllerId: string;
|
|
60
|
+
claims?: HostGrantClaims;
|
|
61
|
+
error?: string;
|
|
216
62
|
}
|
|
63
|
+
declare const verifyHostGrant: ({ secret, token, now, }: VerifyHostGrantInput) => Promise<VerifyHostGrantResult>;
|
|
64
|
+
|
|
217
65
|
interface ClientToServerEvents {
|
|
218
|
-
"host:
|
|
66
|
+
"host:bootstrap": (payload: HostBootstrapPayload, callback: (ack: HostBootstrapAck) => void) => void;
|
|
219
67
|
"host:registerSystem": (payload: HostRegisterSystemPayload, callback: (ack: HostRegistrationAck) => void) => void;
|
|
220
68
|
"host:createRoom": (payload: HostCreateRoomPayload, callback: (ack: HostRegistrationAck) => void) => void;
|
|
221
69
|
"host:reconnect": (payload: HostReconnectPayload, callback: (ack: HostRegistrationAck) => void) => void;
|
|
70
|
+
"host:resetRoom": (payload: HostResetRoomPayload, callback: (ack: HostRegistrationAck) => void) => void;
|
|
71
|
+
"host:removeController": (payload: HostRemoveControllerPayload, callback: (ack: HostControllerActionAck) => void) => void;
|
|
222
72
|
"system:launchGame": (payload: SystemLaunchGamePayload, callback: (ack: SystemLaunchGameAck) => void) => void;
|
|
223
73
|
"host:joinAsChild": (payload: HostJoinAsChildPayload, callback: (ack: HostRegistrationAck) => void) => void;
|
|
74
|
+
"host:activateEmbeddedGame": (payload: HostActivateEmbeddedGamePayload, callback: (ack: HostRegistrationAck) => void) => void;
|
|
224
75
|
"system:closeGame": (payload: {
|
|
225
76
|
roomId: string;
|
|
226
77
|
}) => void;
|
|
227
|
-
"host:state": (payload:
|
|
228
|
-
"controller:join": (payload:
|
|
229
|
-
"controller:
|
|
230
|
-
"controller:
|
|
231
|
-
"controller:
|
|
232
|
-
"
|
|
78
|
+
"host:state": (payload: ControllerStateMessage) => void;
|
|
79
|
+
"controller:join": (payload: ControllerJoinPayload, callback: (ack: ControllerJoinAck) => void) => void;
|
|
80
|
+
"controller:updatePlayerProfile": (payload: ControllerUpdatePlayerProfilePayload, callback: (ack: ControllerUpdatePlayerProfileAck) => void) => void;
|
|
81
|
+
"controller:leave": (payload: ControllerLeavePayload, callback: (ack: ControllerLeaveAck) => void) => void;
|
|
82
|
+
"controller:input": (payload: ControllerInputEvent) => void;
|
|
83
|
+
"controller:system": (payload: ControllerSystemPayload) => void;
|
|
84
|
+
"host:system": (payload: ControllerSystemPayload) => void;
|
|
233
85
|
"host:signal": (payload: SignalPayload) => void;
|
|
234
86
|
"host:play_sound": (payload: PlaySoundEventPayload) => void;
|
|
235
87
|
"controller:play_sound": (payload: PlaySoundEventPayload) => void;
|
|
236
88
|
"host:state_sync": (payload: HostStateSyncPayload) => void;
|
|
237
|
-
"controller:action_rpc": (payload: ControllerActionRpcPayload) => void;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
id: string;
|
|
241
|
-
volume?: number;
|
|
242
|
-
loop?: boolean;
|
|
89
|
+
"controller:action_rpc": (payload: ControllerActionRpcPayload, callback?: (ack: AirJamActionInvocationResult) => void) => void;
|
|
90
|
+
"controller:host_action_rpc": (payload: HostActionRpcPayload, callback?: (ack: AirJamActionInvocationResult) => void) => void;
|
|
91
|
+
"controller:state_sync_request": (payload: ControllerStateSyncRequestPayload) => void;
|
|
243
92
|
}
|
|
244
93
|
interface ServerToClientEvents {
|
|
245
94
|
"server:roomReady": (payload: RoomReadyNotice) => void;
|
|
246
95
|
"server:controllerJoined": (payload: ControllerJoinedNotice) => void;
|
|
247
96
|
"server:controllerLeft": (payload: ControllerLeftNotice) => void;
|
|
97
|
+
"server:playerUpdated": (payload: PlayerUpdatedNotice) => void;
|
|
248
98
|
"server:input": (payload: ControllerInputEvent) => void;
|
|
249
99
|
"server:error": (payload: ServerErrorPayload) => void;
|
|
250
|
-
"server:state": (payload:
|
|
100
|
+
"server:state": (payload: ControllerStateMessage) => void;
|
|
251
101
|
"server:welcome": (payload: ControllerWelcomePayload) => void;
|
|
252
102
|
"server:hostLeft": (payload: HostLeftNotice) => void;
|
|
253
103
|
"server:signal": (payload: SignalPayload) => void;
|
|
254
104
|
"server:playSound": (payload: PlaySoundPayload) => void;
|
|
255
105
|
"server:redirect": (url: string) => void;
|
|
256
106
|
"server:closeChild": () => void;
|
|
257
|
-
"client:loadUi": (payload: ClientLoadUiPayload) => void;
|
|
258
|
-
"client:unloadUi": () => void;
|
|
259
107
|
"airjam:state_sync": (payload: AirJamStateSyncPayload) => void;
|
|
260
|
-
"airjam:action_rpc": (payload: AirJamActionRpcPayload) => void;
|
|
108
|
+
"airjam:action_rpc": (payload: AirJamActionRpcPayload, callback?: (ack: AirJamActionInvocationResult) => void) => void;
|
|
109
|
+
"airjam:state_sync_request": (payload: AirJamStateSyncRequestPayload) => void;
|
|
261
110
|
}
|
|
262
111
|
interface InterServerEvents {
|
|
263
112
|
ping: () => void;
|
|
264
113
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
type: string;
|
|
269
|
-
}
|
|
270
|
-
interface ProxyReadyMessage extends ProxyMessageBase {
|
|
271
|
-
type: "AIRJAM_READY";
|
|
272
|
-
}
|
|
273
|
-
interface ProxyInputMessage extends ProxyMessageBase {
|
|
274
|
-
type: "AIRJAM_INPUT";
|
|
275
|
-
payload: ControllerInputPayload;
|
|
276
|
-
}
|
|
277
|
-
interface ProxyStateMessage extends ProxyMessageBase {
|
|
278
|
-
type: "AIRJAM_STATE";
|
|
279
|
-
payload: ControllerStatePayload;
|
|
114
|
+
interface SocketData {
|
|
115
|
+
hostAuthority?: HostSocketAuthority;
|
|
116
|
+
controllerAuthority?: ControllerSocketAuthority;
|
|
280
117
|
}
|
|
281
|
-
type AirJamProxyMessage = ProxyReadyMessage | ProxyInputMessage | ProxyStateMessage;
|
|
282
118
|
|
|
283
|
-
export {
|
|
119
|
+
export { AIRJAM_ARCADE_PLATFORM_ACTION_PREFIX, AirJamActionInvocationResult, AirJamActionRpcPayload, type AirJamArcadePlatformActionName, AirJamStateSyncPayload, AirJamStateSyncRequestPayload, type ClientToServerEvents, ControllerActionRpcPayload, ControllerInputEvent, ControllerJoinAck, ControllerJoinPayload, ControllerJoinedNotice, ControllerLeaveAck, ControllerLeavePayload, ControllerLeftNotice, ControllerSocketAuthority, ControllerStateMessage, ControllerStateSyncRequestPayload, ControllerSystemPayload, ControllerUpdatePlayerProfileAck, ControllerUpdatePlayerProfilePayload, ControllerWelcomePayload, type CreateHostGrantInput, HostActionRpcPayload, HostActivateEmbeddedGamePayload, HostBootstrapAck, HostBootstrapPayload, HostControllerActionAck, HostCreateRoomPayload, type HostGrantClaims, HostJoinAsChildPayload, HostLeftNotice, HostReconnectPayload, HostRegisterSystemPayload, HostRegistrationAck, HostRemoveControllerPayload, HostResetRoomPayload, HostSocketAuthority, HostStateSyncPayload, type InterServerEvents, PlaySoundEventPayload, PlaySoundPayload, PlayerUpdatedNotice, RoomReadyNotice, ServerErrorPayload, type ServerToClientEvents, SignalPayload, type SocketData, SystemLaunchGameAck, SystemLaunchGamePayload, type VerifyHostGrantInput, type VerifyHostGrantResult, airJamArcadePlatformActions, createHostGrant, hostGrantClaimsSchema, hostGrantScopeSchema, isAirJamArcadePlatformPrefixAction, verifyHostGrant };
|
package/dist/protocol.js
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
AIRJAM_ARCADE_PLATFORM_ACTION_PREFIX,
|
|
3
|
+
AIRJAM_DEV_LOG_EVENTS,
|
|
4
|
+
ErrorCode,
|
|
5
|
+
PREVIEW_CONTROLLER_DEVICE_ID_PREFIX,
|
|
6
|
+
VIRTUAL_CONTROLLER_DEVICE_ID_PREFIX,
|
|
7
|
+
airJamActionPayloadSchema,
|
|
8
|
+
airJamArcadePlatformActions,
|
|
9
|
+
childHostCapabilitySchema,
|
|
10
|
+
controllerActionRpcSchema,
|
|
11
|
+
controllerInputSchema,
|
|
12
|
+
controllerJoinSchema,
|
|
13
|
+
controllerLeaveSchema,
|
|
14
|
+
controllerOrientationSchema,
|
|
15
|
+
controllerPrivilegedCapabilitySchema,
|
|
16
|
+
controllerPrivilegedGrantSchema,
|
|
17
|
+
controllerSourceSchema,
|
|
18
|
+
controllerStateSchema,
|
|
19
|
+
controllerStateSyncRequestSchema,
|
|
20
|
+
controllerSystemSchema,
|
|
21
|
+
controllerUpdatePlayerProfileSchema,
|
|
22
|
+
createHostGrant,
|
|
23
|
+
hostActionRpcSchema,
|
|
24
|
+
hostActivateEmbeddedGameSchema,
|
|
25
|
+
hostBootstrapSchema,
|
|
26
|
+
hostCreateRoomSchema,
|
|
27
|
+
hostGrantClaimsSchema,
|
|
28
|
+
hostGrantScopeSchema,
|
|
29
|
+
hostJoinAsChildSchema,
|
|
30
|
+
hostReconnectSchema,
|
|
31
|
+
hostRegisterSystemSchema,
|
|
32
|
+
hostRemoveControllerSchema,
|
|
33
|
+
hostResetRoomSchema,
|
|
34
|
+
hostSessionKindSchema,
|
|
35
|
+
hostStateSyncSchema,
|
|
36
|
+
inferControllerSourceFromDeviceId,
|
|
37
|
+
isAirJamArcadePlatformPrefixAction,
|
|
38
|
+
playerProfilePatchSchema,
|
|
39
|
+
resolveAirJamBrowserConsoleCategory,
|
|
40
|
+
resolveAirJamBrowserLogEvent,
|
|
41
|
+
roomCodeSchema,
|
|
42
|
+
systemLaunchGameSchema,
|
|
43
|
+
verifyHostGrant
|
|
44
|
+
} from "./chunk-32NYL7XI.js";
|
|
45
|
+
import {
|
|
46
|
+
appendRuntimeQueryParams,
|
|
47
|
+
getRuntimeUrlOrigin,
|
|
48
|
+
isTrustedRuntimeMessageOrigin,
|
|
49
|
+
normalizeRuntimeUrl,
|
|
50
|
+
runtimeUrlSchema
|
|
51
|
+
} from "./chunk-3USU7GY2.js";
|
|
52
|
+
export {
|
|
53
|
+
AIRJAM_ARCADE_PLATFORM_ACTION_PREFIX,
|
|
54
|
+
AIRJAM_DEV_LOG_EVENTS,
|
|
55
|
+
ErrorCode,
|
|
56
|
+
PREVIEW_CONTROLLER_DEVICE_ID_PREFIX,
|
|
57
|
+
VIRTUAL_CONTROLLER_DEVICE_ID_PREFIX,
|
|
58
|
+
airJamActionPayloadSchema,
|
|
59
|
+
airJamArcadePlatformActions,
|
|
60
|
+
appendRuntimeQueryParams,
|
|
61
|
+
childHostCapabilitySchema,
|
|
62
|
+
controllerActionRpcSchema,
|
|
63
|
+
controllerInputSchema,
|
|
64
|
+
controllerJoinSchema,
|
|
65
|
+
controllerLeaveSchema,
|
|
66
|
+
controllerOrientationSchema,
|
|
67
|
+
controllerPrivilegedCapabilitySchema,
|
|
68
|
+
controllerPrivilegedGrantSchema,
|
|
69
|
+
controllerSourceSchema,
|
|
70
|
+
controllerStateSchema,
|
|
71
|
+
controllerStateSyncRequestSchema,
|
|
72
|
+
controllerSystemSchema,
|
|
73
|
+
controllerUpdatePlayerProfileSchema,
|
|
74
|
+
createHostGrant,
|
|
75
|
+
getRuntimeUrlOrigin,
|
|
76
|
+
hostActionRpcSchema,
|
|
77
|
+
hostActivateEmbeddedGameSchema,
|
|
78
|
+
hostBootstrapSchema,
|
|
79
|
+
hostCreateRoomSchema,
|
|
80
|
+
hostGrantClaimsSchema,
|
|
81
|
+
hostGrantScopeSchema,
|
|
82
|
+
hostJoinAsChildSchema,
|
|
83
|
+
hostReconnectSchema,
|
|
84
|
+
hostRegisterSystemSchema,
|
|
85
|
+
hostRemoveControllerSchema,
|
|
86
|
+
hostResetRoomSchema,
|
|
87
|
+
hostSessionKindSchema,
|
|
88
|
+
hostStateSyncSchema,
|
|
89
|
+
inferControllerSourceFromDeviceId,
|
|
90
|
+
isAirJamArcadePlatformPrefixAction,
|
|
91
|
+
isTrustedRuntimeMessageOrigin,
|
|
92
|
+
normalizeRuntimeUrl,
|
|
93
|
+
playerProfilePatchSchema,
|
|
94
|
+
resolveAirJamBrowserConsoleCategory,
|
|
95
|
+
resolveAirJamBrowserLogEvent,
|
|
96
|
+
roomCodeSchema,
|
|
97
|
+
runtimeUrlSchema,
|
|
98
|
+
systemLaunchGameSchema,
|
|
99
|
+
verifyHostGrant
|
|
100
|
+
};
|
|
3
101
|
//# sourceMappingURL=protocol.js.map
|
package/dist/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface AirJamRealtimeClient {
|
|
2
|
+
readonly connected: boolean;
|
|
3
|
+
readonly id?: string;
|
|
4
|
+
connect(): this;
|
|
5
|
+
disconnect(): this;
|
|
6
|
+
on(event: string, listener: BridgeListener): this;
|
|
7
|
+
off(event: string, listener?: BridgeListener): this;
|
|
8
|
+
emit(event: string, ...args: unknown[]): this;
|
|
9
|
+
emitWithAck<TAck>(event: string, ...args: unknown[]): Promise<TAck>;
|
|
10
|
+
}
|
|
11
|
+
type BridgeListener = {
|
|
12
|
+
bivarianceHack(...args: unknown[]): void;
|
|
13
|
+
}["bivarianceHack"];
|
|
14
|
+
|
|
15
|
+
export type { AirJamRealtimeClient as A };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface AirJamRealtimeClient {
|
|
2
|
+
readonly connected: boolean;
|
|
3
|
+
readonly id?: string;
|
|
4
|
+
connect(): this;
|
|
5
|
+
disconnect(): this;
|
|
6
|
+
on(event: string, listener: BridgeListener): this;
|
|
7
|
+
off(event: string, listener?: BridgeListener): this;
|
|
8
|
+
emit(event: string, ...args: unknown[]): this;
|
|
9
|
+
emitWithAck<TAck>(event: string, ...args: unknown[]): Promise<TAck>;
|
|
10
|
+
}
|
|
11
|
+
type BridgeListener = {
|
|
12
|
+
bivarianceHack(...args: unknown[]): void;
|
|
13
|
+
}["bivarianceHack"];
|
|
14
|
+
|
|
15
|
+
export type { AirJamRealtimeClient as A };
|
package/dist/release.cjs
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/release.ts
|
|
31
|
+
var release_exports = {};
|
|
32
|
+
__export(release_exports, {
|
|
33
|
+
HOSTED_RELEASE_CONTROLLER_PATH: () => HOSTED_RELEASE_CONTROLLER_PATH,
|
|
34
|
+
HOSTED_RELEASE_ENTRY_PATH: () => HOSTED_RELEASE_ENTRY_PATH,
|
|
35
|
+
HOSTED_RELEASE_HOST_PATH: () => HOSTED_RELEASE_HOST_PATH,
|
|
36
|
+
HOSTED_RELEASE_MANIFEST_PATH: () => HOSTED_RELEASE_MANIFEST_PATH,
|
|
37
|
+
createHostedReleaseArtifactManifest: () => createHostedReleaseArtifactManifest,
|
|
38
|
+
gameReleaseSourceKindSchema: () => gameReleaseSourceKindSchema,
|
|
39
|
+
gameReleaseSourceKindValues: () => gameReleaseSourceKindValues,
|
|
40
|
+
gameReleaseStatusSchema: () => gameReleaseStatusSchema,
|
|
41
|
+
gameReleaseStatusValues: () => gameReleaseStatusValues,
|
|
42
|
+
hostedReleaseArtifactManifestSchema: () => hostedReleaseArtifactManifestSchema,
|
|
43
|
+
isHostedReleaseSpaFallbackPath: () => isHostedReleaseSpaFallbackPath,
|
|
44
|
+
releaseCheckKindSchema: () => releaseCheckKindSchema,
|
|
45
|
+
releaseCheckKindValues: () => releaseCheckKindValues,
|
|
46
|
+
releaseCheckStatusSchema: () => releaseCheckStatusSchema,
|
|
47
|
+
releaseCheckStatusValues: () => releaseCheckStatusValues,
|
|
48
|
+
releaseReportSourceSchema: () => releaseReportSourceSchema,
|
|
49
|
+
releaseReportSourceValues: () => releaseReportSourceValues,
|
|
50
|
+
releaseReportStatusSchema: () => releaseReportStatusSchema,
|
|
51
|
+
releaseReportStatusValues: () => releaseReportStatusValues
|
|
52
|
+
});
|
|
53
|
+
module.exports = __toCommonJS(release_exports);
|
|
54
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
55
|
+
var import_zod = require("zod");
|
|
56
|
+
var gameReleaseSourceKindValues = ["upload"];
|
|
57
|
+
var gameReleaseSourceKindSchema = import_zod.z.enum(gameReleaseSourceKindValues);
|
|
58
|
+
var gameReleaseStatusValues = [
|
|
59
|
+
"draft",
|
|
60
|
+
"uploading",
|
|
61
|
+
"checking",
|
|
62
|
+
"ready",
|
|
63
|
+
"live",
|
|
64
|
+
"failed",
|
|
65
|
+
"quarantined",
|
|
66
|
+
"archived"
|
|
67
|
+
];
|
|
68
|
+
var gameReleaseStatusSchema = import_zod.z.enum(gameReleaseStatusValues);
|
|
69
|
+
var releaseCheckKindValues = [
|
|
70
|
+
"artifact_validation",
|
|
71
|
+
"screenshot_capture",
|
|
72
|
+
"image_moderation"
|
|
73
|
+
];
|
|
74
|
+
var releaseCheckKindSchema = import_zod.z.enum(releaseCheckKindValues);
|
|
75
|
+
var releaseCheckStatusValues = [
|
|
76
|
+
"pending",
|
|
77
|
+
"passed",
|
|
78
|
+
"failed",
|
|
79
|
+
"warning"
|
|
80
|
+
];
|
|
81
|
+
var releaseCheckStatusSchema = import_zod.z.enum(releaseCheckStatusValues);
|
|
82
|
+
var releaseReportStatusValues = [
|
|
83
|
+
"open",
|
|
84
|
+
"reviewed",
|
|
85
|
+
"dismissed"
|
|
86
|
+
];
|
|
87
|
+
var releaseReportStatusSchema = import_zod.z.enum(releaseReportStatusValues);
|
|
88
|
+
var releaseReportSourceValues = ["play_page", "arcade"];
|
|
89
|
+
var releaseReportSourceSchema = import_zod.z.enum(releaseReportSourceValues);
|
|
90
|
+
var HOSTED_RELEASE_ENTRY_PATH = "index.html";
|
|
91
|
+
var HOSTED_RELEASE_MANIFEST_PATH = ".airjam/release-manifest.json";
|
|
92
|
+
var HOSTED_RELEASE_HOST_PATH = "/";
|
|
93
|
+
var HOSTED_RELEASE_CONTROLLER_PATH = "/controller";
|
|
94
|
+
var hostedReleaseArtifactManifestSchema = import_zod.z.object({
|
|
95
|
+
schemaVersion: import_zod.z.literal(1),
|
|
96
|
+
kind: import_zod.z.literal("airjam-hosted-release"),
|
|
97
|
+
routes: import_zod.z.object({
|
|
98
|
+
host: import_zod.z.literal(HOSTED_RELEASE_HOST_PATH),
|
|
99
|
+
controller: import_zod.z.literal(HOSTED_RELEASE_CONTROLLER_PATH)
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
var createHostedReleaseArtifactManifest = () => ({
|
|
103
|
+
schemaVersion: 1,
|
|
104
|
+
kind: "airjam-hosted-release",
|
|
105
|
+
routes: {
|
|
106
|
+
host: HOSTED_RELEASE_HOST_PATH,
|
|
107
|
+
controller: HOSTED_RELEASE_CONTROLLER_PATH
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
var normalizeHostedReleaseRequestPath = (value) => value.replaceAll("\\", "/").replace(/^\/+/, "").replace(/\/+/g, "/").trim();
|
|
111
|
+
var isHostedReleaseSpaFallbackPath = (relativePath) => {
|
|
112
|
+
const normalizedPath = normalizeHostedReleaseRequestPath(relativePath);
|
|
113
|
+
if (!normalizedPath) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (import_node_path.default.posix.extname(normalizedPath)) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
return normalizedPath === HOSTED_RELEASE_CONTROLLER_PATH.slice(1) || normalizedPath.startsWith(`${HOSTED_RELEASE_CONTROLLER_PATH.slice(1)}/`);
|
|
120
|
+
};
|
|
121
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
122
|
+
0 && (module.exports = {
|
|
123
|
+
HOSTED_RELEASE_CONTROLLER_PATH,
|
|
124
|
+
HOSTED_RELEASE_ENTRY_PATH,
|
|
125
|
+
HOSTED_RELEASE_HOST_PATH,
|
|
126
|
+
HOSTED_RELEASE_MANIFEST_PATH,
|
|
127
|
+
createHostedReleaseArtifactManifest,
|
|
128
|
+
gameReleaseSourceKindSchema,
|
|
129
|
+
gameReleaseSourceKindValues,
|
|
130
|
+
gameReleaseStatusSchema,
|
|
131
|
+
gameReleaseStatusValues,
|
|
132
|
+
hostedReleaseArtifactManifestSchema,
|
|
133
|
+
isHostedReleaseSpaFallbackPath,
|
|
134
|
+
releaseCheckKindSchema,
|
|
135
|
+
releaseCheckKindValues,
|
|
136
|
+
releaseCheckStatusSchema,
|
|
137
|
+
releaseCheckStatusValues,
|
|
138
|
+
releaseReportSourceSchema,
|
|
139
|
+
releaseReportSourceValues,
|
|
140
|
+
releaseReportStatusSchema,
|
|
141
|
+
releaseReportStatusValues
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=release.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/release.ts"],"sourcesContent":["import path from \"node:path\";\nimport { z } from \"zod\";\n\nexport const gameReleaseSourceKindValues = [\"upload\"] as const;\nexport type GameReleaseSourceKind =\n (typeof gameReleaseSourceKindValues)[number];\nexport const gameReleaseSourceKindSchema = z.enum(gameReleaseSourceKindValues);\n\nexport const gameReleaseStatusValues = [\n \"draft\",\n \"uploading\",\n \"checking\",\n \"ready\",\n \"live\",\n \"failed\",\n \"quarantined\",\n \"archived\",\n] as const;\nexport type GameReleaseStatus = (typeof gameReleaseStatusValues)[number];\nexport const gameReleaseStatusSchema = z.enum(gameReleaseStatusValues);\n\nexport const releaseCheckKindValues = [\n \"artifact_validation\",\n \"screenshot_capture\",\n \"image_moderation\",\n] as const;\nexport type ReleaseCheckKind = (typeof releaseCheckKindValues)[number];\nexport const releaseCheckKindSchema = z.enum(releaseCheckKindValues);\n\nexport const releaseCheckStatusValues = [\n \"pending\",\n \"passed\",\n \"failed\",\n \"warning\",\n] as const;\nexport type ReleaseCheckStatus = (typeof releaseCheckStatusValues)[number];\nexport const releaseCheckStatusSchema = z.enum(releaseCheckStatusValues);\n\nexport const releaseReportStatusValues = [\n \"open\",\n \"reviewed\",\n \"dismissed\",\n] as const;\nexport type ReleaseReportStatus = (typeof releaseReportStatusValues)[number];\nexport const releaseReportStatusSchema = z.enum(releaseReportStatusValues);\n\nexport const releaseReportSourceValues = [\"play_page\", \"arcade\"] as const;\nexport type ReleaseReportSource = (typeof releaseReportSourceValues)[number];\nexport const releaseReportSourceSchema = z.enum(releaseReportSourceValues);\n\nexport const HOSTED_RELEASE_ENTRY_PATH = \"index.html\" as const;\nexport const HOSTED_RELEASE_MANIFEST_PATH =\n \".airjam/release-manifest.json\" as const;\nexport const HOSTED_RELEASE_HOST_PATH = \"/\" as const;\nexport const HOSTED_RELEASE_CONTROLLER_PATH = \"/controller\" as const;\n\nexport const hostedReleaseArtifactManifestSchema = z.object({\n schemaVersion: z.literal(1),\n kind: z.literal(\"airjam-hosted-release\"),\n routes: z.object({\n host: z.literal(HOSTED_RELEASE_HOST_PATH),\n controller: z.literal(HOSTED_RELEASE_CONTROLLER_PATH),\n }),\n});\n\nexport type HostedReleaseArtifactManifest = z.infer<\n typeof hostedReleaseArtifactManifestSchema\n>;\n\nexport const createHostedReleaseArtifactManifest =\n (): HostedReleaseArtifactManifest => ({\n schemaVersion: 1,\n kind: \"airjam-hosted-release\",\n routes: {\n host: HOSTED_RELEASE_HOST_PATH,\n controller: HOSTED_RELEASE_CONTROLLER_PATH,\n },\n });\n\nconst normalizeHostedReleaseRequestPath = (value: string): string =>\n value.replaceAll(\"\\\\\", \"/\").replace(/^\\/+/, \"\").replace(/\\/+/g, \"/\").trim();\n\nexport const isHostedReleaseSpaFallbackPath = (\n relativePath: string,\n): boolean => {\n const normalizedPath = normalizeHostedReleaseRequestPath(relativePath);\n if (!normalizedPath) {\n return false;\n }\n\n if (path.posix.extname(normalizedPath)) {\n return false;\n }\n\n return (\n normalizedPath === HOSTED_RELEASE_CONTROLLER_PATH.slice(1) ||\n normalizedPath.startsWith(`${HOSTED_RELEASE_CONTROLLER_PATH.slice(1)}/`)\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAiB;AACjB,iBAAkB;AAEX,IAAM,8BAA8B,CAAC,QAAQ;AAG7C,IAAM,8BAA8B,aAAE,KAAK,2BAA2B;AAEtE,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,0BAA0B,aAAE,KAAK,uBAAuB;AAE9D,IAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,yBAAyB,aAAE,KAAK,sBAAsB;AAE5D,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,2BAA2B,aAAE,KAAK,wBAAwB;AAEhE,IAAM,4BAA4B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,4BAA4B,aAAE,KAAK,yBAAyB;AAElE,IAAM,4BAA4B,CAAC,aAAa,QAAQ;AAExD,IAAM,4BAA4B,aAAE,KAAK,yBAAyB;AAElE,IAAM,4BAA4B;AAClC,IAAM,+BACX;AACK,IAAM,2BAA2B;AACjC,IAAM,iCAAiC;AAEvC,IAAM,sCAAsC,aAAE,OAAO;AAAA,EAC1D,eAAe,aAAE,QAAQ,CAAC;AAAA,EAC1B,MAAM,aAAE,QAAQ,uBAAuB;AAAA,EACvC,QAAQ,aAAE,OAAO;AAAA,IACf,MAAM,aAAE,QAAQ,wBAAwB;AAAA,IACxC,YAAY,aAAE,QAAQ,8BAA8B;AAAA,EACtD,CAAC;AACH,CAAC;AAMM,IAAM,sCACX,OAAsC;AAAA,EACpC,eAAe;AAAA,EACf,MAAM;AAAA,EACN,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,YAAY;AAAA,EACd;AACF;AAEF,IAAM,oCAAoC,CAAC,UACzC,MAAM,WAAW,MAAM,GAAG,EAAE,QAAQ,QAAQ,EAAE,EAAE,QAAQ,QAAQ,GAAG,EAAE,KAAK;AAErE,IAAM,iCAAiC,CAC5C,iBACY;AACZ,QAAM,iBAAiB,kCAAkC,YAAY;AACrE,MAAI,CAAC,gBAAgB;AACnB,WAAO;AAAA,EACT;AAEA,MAAI,iBAAAA,QAAK,MAAM,QAAQ,cAAc,GAAG;AACtC,WAAO;AAAA,EACT;AAEA,SACE,mBAAmB,+BAA+B,MAAM,CAAC,KACzD,eAAe,WAAW,GAAG,+BAA+B,MAAM,CAAC,CAAC,GAAG;AAE3E;","names":["path"]}
|