@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.
Files changed (348) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +627 -57
  3. package/dist/agent-tooling-BSMGBix9.d.cts +123 -0
  4. package/dist/agent-tooling-BSMGBix9.d.ts +123 -0
  5. package/dist/agent-tooling.cjs +83 -0
  6. package/dist/agent-tooling.cjs.map +1 -0
  7. package/dist/agent-tooling.d.cts +2 -0
  8. package/dist/agent-tooling.d.ts +2 -0
  9. package/dist/agent-tooling.js +17 -0
  10. package/dist/agent-tooling.js.map +1 -0
  11. package/dist/arcade/bridge/controller.cjs +749 -0
  12. package/dist/arcade/bridge/controller.cjs.map +1 -0
  13. package/dist/arcade/bridge/controller.d.cts +85 -0
  14. package/dist/arcade/bridge/controller.d.ts +85 -0
  15. package/dist/arcade/bridge/controller.js +33 -0
  16. package/dist/arcade/bridge/controller.js.map +1 -0
  17. package/dist/arcade/bridge/host.cjs +421 -0
  18. package/dist/arcade/bridge/host.cjs.map +1 -0
  19. package/dist/arcade/bridge/host.d.cts +73 -0
  20. package/dist/arcade/bridge/host.d.ts +73 -0
  21. package/dist/arcade/bridge/host.js +25 -0
  22. package/dist/arcade/bridge/host.js.map +1 -0
  23. package/dist/arcade/bridge/iframe.cjs +453 -0
  24. package/dist/arcade/bridge/iframe.cjs.map +1 -0
  25. package/dist/arcade/bridge/iframe.d.cts +80 -0
  26. package/dist/arcade/bridge/iframe.d.ts +80 -0
  27. package/dist/arcade/bridge/iframe.js +28 -0
  28. package/dist/arcade/bridge/iframe.js.map +1 -0
  29. package/dist/arcade/bridge.cjs +1067 -0
  30. package/dist/arcade/bridge.cjs.map +1 -0
  31. package/dist/arcade/bridge.d.cts +11 -0
  32. package/dist/arcade/bridge.d.ts +11 -0
  33. package/dist/arcade/bridge.js +76 -0
  34. package/dist/arcade/bridge.js.map +1 -0
  35. package/dist/arcade/host.cjs +488 -0
  36. package/dist/arcade/host.cjs.map +1 -0
  37. package/dist/arcade/host.d.cts +19 -0
  38. package/dist/arcade/host.d.ts +19 -0
  39. package/dist/arcade/host.js +13 -0
  40. package/dist/arcade/host.js.map +1 -0
  41. package/dist/arcade/surface.cjs +113 -0
  42. package/dist/arcade/surface.cjs.map +1 -0
  43. package/dist/arcade/surface.d.cts +14 -0
  44. package/dist/arcade/surface.d.ts +14 -0
  45. package/dist/arcade/surface.js +27 -0
  46. package/dist/arcade/surface.js.map +1 -0
  47. package/dist/arcade/url.cjs +363 -0
  48. package/dist/arcade/url.cjs.map +1 -0
  49. package/dist/arcade/url.d.cts +68 -0
  50. package/dist/arcade/url.d.ts +68 -0
  51. package/dist/arcade/url.js +28 -0
  52. package/dist/arcade/url.js.map +1 -0
  53. package/dist/arcade-runtime-url-BW-MUAOY.d.cts +28 -0
  54. package/dist/arcade-runtime-url-l8qj01Pg.d.ts +28 -0
  55. package/dist/arcade-surface-identity-CQxDpn_w.d.cts +16 -0
  56. package/dist/arcade-surface-identity-CQxDpn_w.d.ts +16 -0
  57. package/dist/arcade.cjs +1565 -0
  58. package/dist/arcade.cjs.map +1 -0
  59. package/dist/arcade.d.cts +18 -0
  60. package/dist/arcade.d.ts +18 -0
  61. package/dist/arcade.js +122 -0
  62. package/dist/arcade.js.map +1 -0
  63. package/dist/capabilities.cjs +39 -0
  64. package/dist/capabilities.cjs.map +1 -0
  65. package/dist/capabilities.d.cts +31 -0
  66. package/dist/capabilities.d.ts +31 -0
  67. package/dist/capabilities.js +12 -0
  68. package/dist/capabilities.js.map +1 -0
  69. package/dist/chunk-2432OL7L.js +193 -0
  70. package/dist/chunk-2432OL7L.js.map +1 -0
  71. package/dist/chunk-2J65FXEP.js +41 -0
  72. package/dist/chunk-2J65FXEP.js.map +1 -0
  73. package/dist/chunk-32NYL7XI.js +539 -0
  74. package/dist/chunk-32NYL7XI.js.map +1 -0
  75. package/dist/chunk-3USU7GY2.js +54 -0
  76. package/dist/chunk-3USU7GY2.js.map +1 -0
  77. package/dist/chunk-BE6Z4SIT.js +65 -0
  78. package/dist/chunk-BE6Z4SIT.js.map +1 -0
  79. package/dist/chunk-CQUG24WX.js +249 -0
  80. package/dist/chunk-CQUG24WX.js.map +1 -0
  81. package/dist/chunk-D3X4MN4U.js +288 -0
  82. package/dist/chunk-D3X4MN4U.js.map +1 -0
  83. package/dist/chunk-EVZJA6RN.js +140 -0
  84. package/dist/chunk-EVZJA6RN.js.map +1 -0
  85. package/dist/chunk-HFWRZVZ3.js +1438 -0
  86. package/dist/chunk-HFWRZVZ3.js.map +1 -0
  87. package/dist/chunk-IKKDONQL.js +1 -0
  88. package/dist/chunk-IKKDONQL.js.map +1 -0
  89. package/dist/chunk-JTF47B56.js +1 -0
  90. package/dist/chunk-JTF47B56.js.map +1 -0
  91. package/dist/chunk-LIXPF4P6.js +22 -0
  92. package/dist/chunk-LIXPF4P6.js.map +1 -0
  93. package/dist/chunk-MKBASO6X.js +216 -0
  94. package/dist/chunk-MKBASO6X.js.map +1 -0
  95. package/dist/chunk-MPDMJIX5.js +1 -0
  96. package/dist/chunk-MPDMJIX5.js.map +1 -0
  97. package/dist/chunk-NCL6WJCL.js +91 -0
  98. package/dist/chunk-NCL6WJCL.js.map +1 -0
  99. package/dist/chunk-NU5W6VAV.js +126 -0
  100. package/dist/chunk-NU5W6VAV.js.map +1 -0
  101. package/dist/chunk-TGRTEWYV.js +195 -0
  102. package/dist/chunk-TGRTEWYV.js.map +1 -0
  103. package/dist/chunk-VDRNNGHX.js +184 -0
  104. package/dist/chunk-VDRNNGHX.js.map +1 -0
  105. package/dist/chunk-VN5LDWVN.js +32 -0
  106. package/dist/chunk-VN5LDWVN.js.map +1 -0
  107. package/dist/chunk-W2VK36RO.js +11 -0
  108. package/dist/chunk-W2VK36RO.js.map +1 -0
  109. package/dist/chunk-X24K52DG.js +12 -0
  110. package/dist/chunk-X24K52DG.js.map +1 -0
  111. package/dist/chunk-XLUWV45V.js +25 -0
  112. package/dist/chunk-XLUWV45V.js.map +1 -0
  113. package/dist/chunk-Y4RAPKKB.js +238 -0
  114. package/dist/chunk-Y4RAPKKB.js.map +1 -0
  115. package/dist/chunk-YXHH3MQT.js +230 -0
  116. package/dist/chunk-YXHH3MQT.js.map +1 -0
  117. package/dist/chunk-ZLPL2R3R.js +183 -0
  118. package/dist/chunk-ZLPL2R3R.js.map +1 -0
  119. package/dist/chunk-ZTQ5SP4H.js +9 -0
  120. package/dist/chunk-ZTQ5SP4H.js.map +1 -0
  121. package/dist/controller-Bod8YYr1.d.cts +172 -0
  122. package/dist/controller-DxVchfiA.d.ts +172 -0
  123. package/dist/dev-log-events-CVAM29hx.d.cts +123 -0
  124. package/dist/dev-log-events-CVAM29hx.d.ts +123 -0
  125. package/dist/handshake-CC_LrK5g.d.cts +31 -0
  126. package/dist/handshake-CC_LrK5g.d.ts +31 -0
  127. package/dist/host-8hmq_Sgc.d.cts +109 -0
  128. package/dist/host-Cw-N6e-5.d.ts +109 -0
  129. package/dist/index.cjs +8512 -3518
  130. package/dist/index.cjs.map +1 -1
  131. package/dist/index.d.cts +676 -1070
  132. package/dist/index.d.ts +676 -1070
  133. package/dist/index.js +4892 -3188
  134. package/dist/index.js.map +1 -1
  135. package/dist/metadata.cjs +114 -0
  136. package/dist/metadata.cjs.map +1 -0
  137. package/dist/metadata.d.cts +95 -0
  138. package/dist/metadata.d.ts +95 -0
  139. package/dist/metadata.js +83 -0
  140. package/dist/metadata.js.map +1 -0
  141. package/dist/notices-CnGaaS8B.d.ts +38 -0
  142. package/dist/notices-NyDM5Mtz.d.cts +38 -0
  143. package/dist/platform-machine.cjs +425 -0
  144. package/dist/platform-machine.cjs.map +1 -0
  145. package/dist/platform-machine.d.cts +1183 -0
  146. package/dist/platform-machine.d.ts +1183 -0
  147. package/dist/platform-machine.js +309 -0
  148. package/dist/platform-machine.js.map +1 -0
  149. package/dist/platform-settings-cuor3i11.d.cts +48 -0
  150. package/dist/platform-settings-cuor3i11.d.ts +48 -0
  151. package/dist/prefabs.cjs +36 -0
  152. package/dist/prefabs.cjs.map +1 -0
  153. package/dist/prefabs.d.cts +49 -0
  154. package/dist/prefabs.d.ts +49 -0
  155. package/dist/prefabs.js +8 -0
  156. package/dist/prefabs.js.map +1 -0
  157. package/dist/preview.cjs +2609 -0
  158. package/dist/preview.cjs.map +1 -0
  159. package/dist/preview.d.cts +155 -0
  160. package/dist/preview.d.ts +155 -0
  161. package/dist/preview.js +1671 -0
  162. package/dist/preview.js.map +1 -0
  163. package/dist/protocol.cjs +621 -54
  164. package/dist/protocol.cjs.map +1 -1
  165. package/dist/protocol.d.cts +76 -240
  166. package/dist/protocol.d.ts +76 -240
  167. package/dist/protocol.js +100 -2
  168. package/dist/protocol.js.map +1 -1
  169. package/dist/realtime-client-Cu8yVJFw.d.cts +15 -0
  170. package/dist/realtime-client-Cu8yVJFw.d.ts +15 -0
  171. package/dist/release.cjs +143 -0
  172. package/dist/release.cjs.map +1 -0
  173. package/dist/release.d.cts +64 -0
  174. package/dist/release.d.ts +64 -0
  175. package/dist/release.js +43 -0
  176. package/dist/release.js.map +1 -0
  177. package/dist/standard-match-phase-BucA5dYo.d.ts +44 -0
  178. package/dist/standard-match-phase-U2ra8J-0.d.cts +44 -0
  179. package/dist/sync-B6QsNrXz.d.cts +125 -0
  180. package/dist/sync-B6QsNrXz.d.ts +125 -0
  181. package/dist/ui.cjs +2827 -0
  182. package/dist/ui.cjs.map +1 -0
  183. package/dist/ui.d.cts +320 -0
  184. package/dist/ui.d.ts +320 -0
  185. package/dist/ui.js +1718 -0
  186. package/dist/ui.js.map +1 -0
  187. package/dist/url-policy-C89zxgw9.d.cts +9 -0
  188. package/dist/url-policy-C89zxgw9.d.ts +9 -0
  189. package/package.json +154 -13
  190. package/src/agent/agent-action.ts +304 -0
  191. package/src/agent/agent-contract.ts +180 -0
  192. package/src/agent-tooling.ts +20 -0
  193. package/src/arcade/bridge/controller.ts +15 -0
  194. package/src/arcade/bridge/host.ts +12 -0
  195. package/src/arcade/bridge/iframe.ts +61 -0
  196. package/src/arcade/bridge.ts +3 -0
  197. package/src/arcade/host.ts +1 -0
  198. package/src/arcade/surface.ts +4 -0
  199. package/src/arcade/url.ts +60 -0
  200. package/src/arcade.ts +4 -0
  201. package/src/audio/audio-manager.ts +162 -171
  202. package/src/audio/hooks.tsx +218 -97
  203. package/src/audio/index.ts +1 -1
  204. package/src/audio/music.tsx +139 -0
  205. package/src/capabilities/manifest.ts +71 -0
  206. package/src/capabilities.ts +12 -0
  207. package/src/components/connection-status-pill.tsx +55 -0
  208. package/src/components/controller-player-name-field.tsx +119 -0
  209. package/src/components/controller-primary-action.tsx +58 -0
  210. package/src/components/host-mute-button.tsx +49 -0
  211. package/src/components/join-qr-overlay.tsx +133 -0
  212. package/src/components/join-url-action-buttons.tsx +95 -0
  213. package/src/components/join-url-controls.tsx +58 -0
  214. package/src/components/join-url-field.tsx +52 -0
  215. package/src/components/lifecycle-action-group.tsx +129 -0
  216. package/src/components/player-avatar-strip.tsx +65 -0
  217. package/src/components/player-avatar.tsx +42 -14
  218. package/src/components/room-qr-code.tsx +125 -0
  219. package/src/components/runtime-shell-header.tsx +37 -0
  220. package/src/components/shell-classes.ts +19 -0
  221. package/src/components/surface-orientation-layout.ts +60 -0
  222. package/src/components/surface-viewport-layout.ts +268 -0
  223. package/src/components/surface-viewport.tsx +314 -0
  224. package/src/components/ui/button.tsx +4 -6
  225. package/src/components/ui/slider.tsx +1 -1
  226. package/src/components/volume-controls.tsx +65 -6
  227. package/src/context/air-jam-context.tsx +209 -141
  228. package/src/context/index.ts +2 -2
  229. package/src/context/session-providers.tsx +77 -0
  230. package/src/context/session-scope.ts +64 -0
  231. package/src/context/socket-manager.ts +6 -25
  232. package/src/contracts/v2/bridge.ts +261 -0
  233. package/src/contracts/v2/handshake.ts +40 -0
  234. package/src/contracts/v2/index.ts +2 -0
  235. package/src/dev/browser-log-sink.ts +912 -0
  236. package/src/diagnostics.ts +128 -0
  237. package/src/events.ts +7 -34
  238. package/src/hooks/internal/use-controller-runtime-api.ts +875 -0
  239. package/src/hooks/internal/use-host-runtime-api.ts +1051 -0
  240. package/src/hooks/internal/use-runtime-control-contract.ts +15 -0
  241. package/src/hooks/internal/use-runtime-inspection-contract.ts +16 -0
  242. package/src/hooks/internal/use-runtime-observability-contract.ts +24 -0
  243. package/src/hooks/use-air-jam-controller.ts +155 -475
  244. package/src/hooks/use-air-jam-host.ts +156 -485
  245. package/src/hooks/use-connection-status.ts +8 -0
  246. package/src/hooks/use-controller-lifecycle-intents.ts +27 -0
  247. package/src/hooks/use-controller-lifecycle-permissions.ts +36 -0
  248. package/src/hooks/use-controller-shell-status.ts +40 -0
  249. package/src/hooks/use-controller-tick.ts +65 -0
  250. package/src/hooks/use-controller-toasts.ts +116 -0
  251. package/src/hooks/use-get-input.ts +8 -5
  252. package/src/hooks/use-host-arcade-restore.ts +30 -0
  253. package/src/hooks/use-host-join-controls.ts +152 -0
  254. package/src/hooks/use-host-tick.ts +171 -0
  255. package/src/hooks/use-input-writer.ts +83 -0
  256. package/src/hooks/use-lifecycle-action-group-model.ts +98 -0
  257. package/src/hooks/use-players.ts +12 -0
  258. package/src/hooks/use-room.ts +22 -0
  259. package/src/hooks/use-send-signal.ts +6 -2
  260. package/src/index.ts +205 -31
  261. package/src/internal/input-manager.ts +195 -215
  262. package/src/lifecycle/index.ts +9 -0
  263. package/src/lifecycle/standard-match-phase.ts +32 -0
  264. package/src/metadata/manifest.ts +152 -0
  265. package/src/metadata.ts +12 -0
  266. package/src/platform-machine.ts +475 -0
  267. package/src/prefabs/types.ts +82 -0
  268. package/src/prefabs.ts +12 -0
  269. package/src/preview/host-workspace.tsx +59 -0
  270. package/src/preview/identity.ts +66 -0
  271. package/src/preview/layout.ts +223 -0
  272. package/src/preview/manager.ts +577 -0
  273. package/src/preview/messages.ts +26 -0
  274. package/src/preview/ownership.ts +81 -0
  275. package/src/preview/url.ts +117 -0
  276. package/src/preview/window.tsx +490 -0
  277. package/src/preview/workspace.tsx +678 -0
  278. package/src/preview.ts +42 -0
  279. package/src/protocol/arcade-platform-actions.ts +29 -0
  280. package/src/protocol/controller.ts +187 -0
  281. package/src/protocol/core.ts +23 -0
  282. package/src/protocol/dev-log-events.ts +222 -0
  283. package/src/protocol/errors.ts +21 -0
  284. package/src/protocol/host-grant.ts +185 -0
  285. package/src/protocol/host.ts +138 -0
  286. package/src/protocol/notices.ts +43 -0
  287. package/src/protocol/signals.ts +38 -0
  288. package/src/protocol/socket-events.ts +154 -0
  289. package/src/protocol/sync.ts +121 -0
  290. package/src/protocol/url-policy.ts +63 -0
  291. package/src/protocol.ts +12 -386
  292. package/src/qrcode.d.ts +16 -0
  293. package/src/release.ts +99 -0
  294. package/src/runtime/air-jam-config.ts +287 -0
  295. package/src/runtime/air-jam-error-boundary.tsx +672 -0
  296. package/src/runtime/arcade-bridge-request-surface.ts +15 -0
  297. package/src/runtime/arcade-runtime-url.ts +95 -0
  298. package/src/runtime/arcade-surface-identity.ts +16 -0
  299. package/src/runtime/contracts/control.ts +68 -0
  300. package/src/runtime/contracts/inspection.ts +165 -0
  301. package/src/runtime/contracts/observability.ts +94 -0
  302. package/src/runtime/controller-bridge.ts +451 -0
  303. package/src/runtime/controller-identity.ts +132 -0
  304. package/src/runtime/controller-presentation.ts +24 -0
  305. package/src/runtime/controller-realtime-client.ts +591 -0
  306. package/src/runtime/create-air-jam-app.tsx +260 -0
  307. package/src/runtime/dev-runtime-events.ts +36 -0
  308. package/src/runtime/embedded-runtime-adapters.ts +68 -0
  309. package/src/runtime/host-bridge.ts +388 -0
  310. package/src/runtime/host-realtime-client.ts +550 -0
  311. package/src/runtime/iframe-bridge.ts +135 -0
  312. package/src/runtime/realtime-client.ts +20 -0
  313. package/src/runtime/router-basename.ts +25 -0
  314. package/src/runtime/runtime-owner-contexts.tsx +4 -0
  315. package/src/runtime/runtime-session-params.ts +169 -0
  316. package/src/runtime/sdk-version.ts +6 -0
  317. package/src/runtime/session-runtimes.tsx +188 -0
  318. package/src/runtime/validate-arcade-bridge-attach.ts +14 -0
  319. package/src/runtime-control.ts +10 -0
  320. package/src/runtime-inspection.ts +14 -0
  321. package/src/runtime-observability.ts +9 -0
  322. package/src/settings/platform-settings-bridge.ts +336 -0
  323. package/src/settings/platform-settings-runtime.tsx +387 -0
  324. package/src/settings/platform-settings.ts +288 -0
  325. package/src/state/connection-store.ts +80 -12
  326. package/src/store/air-jam-store-domain-constants.ts +4 -0
  327. package/src/store/create-air-jam-store.ts +1094 -227
  328. package/src/styles.css +4 -38
  329. package/src/ui.ts +29 -0
  330. package/src/utils/is-rpc-serializable.ts +56 -0
  331. package/src/utils/player-avatar-url.ts +48 -0
  332. package/src/utils/url-builder.ts +7 -0
  333. package/dist/.tsbuildinfo +0 -1
  334. package/dist/chunk-B5DURUWT.js +0 -80
  335. package/dist/chunk-B5DURUWT.js.map +0 -1
  336. package/src/AirJamClient.ts +0 -224
  337. package/src/audio/volume-store.ts +0 -124
  338. package/src/components/controller-shell.tsx +0 -346
  339. package/src/components/host-shell.tsx +0 -521
  340. package/src/components/qr-scanner-dialog.tsx +0 -373
  341. package/src/components/ui/alert.tsx +0 -66
  342. package/src/components/ui/avatar.tsx +0 -46
  343. package/src/components/ui/badge.tsx +0 -47
  344. package/src/components/ui/card.tsx +0 -92
  345. package/src/components/ui/dialog.tsx +0 -122
  346. package/src/components/ui/tabs.tsx +0 -64
  347. package/src/hooks/use-air-jam-shell.ts +0 -379
  348. package/src/hooks/use-fullscreen.ts +0 -108
package/README.md CHANGED
@@ -1,87 +1,657 @@
1
1
  # @air-jam/sdk
2
2
 
3
- The core SDK for building Air Jam games and controllers.
3
+ Core SDK for building Air Jam hosts and mobile controllers.
4
+
5
+ ## Stability And Compatibility Policy
6
+
7
+ Air Jam SDK follows semver. What that means concretely for creators building
8
+ against v1:
9
+
10
+ 1. **Durable v1 surface.** `@air-jam/sdk`, `@air-jam/sdk/ui`, and
11
+ `@air-jam/sdk/styles.css` are the stable authoring and UI lanes. Breaking
12
+ changes on these require a major version bump, and v1 will be kept working
13
+ for games for **at least 12 months** after v1.0.0 ships.
14
+ 2. **Non-breaking v1.x.** Within the `1.x` line we commit to: no removals,
15
+ no incompatible type changes, and no silent behavior changes on the stable
16
+ lanes above. New functionality lands as additive APIs.
17
+ 3. **Experimental leaves.** `@air-jam/sdk/preview`, `@air-jam/sdk/arcade*`,
18
+ `@air-jam/sdk/protocol`, `@air-jam/sdk/capabilities`,
19
+ `@air-jam/sdk/metadata`, and `@air-jam/sdk/prefabs` are intentionally
20
+ unstable future-facing seams. They may change within `1.x` — each carries
21
+ a documented purpose in its leaf, and changes are noted in release notes.
22
+ The agent-facing `runtime-control`, `runtime-inspection`,
23
+ `runtime-observability`, and `contracts/v2` seams exist in-source but are
24
+ **not exported publicly** until a first-party consumer lands; they will be
25
+ re-exported as explicit experimental leaves when that happens.
26
+ 4. **v2 migration.** When v2 ships, we commit to publishing a codemod (or
27
+ migration notes if the surface is too narrow to automate) alongside the
28
+ release. v1 games will not be silently broken — the v1 SDK will remain
29
+ installable.
30
+ 5. **Metadata and capability contracts.** The `defineAirJamGameMetadata` and
31
+ `defineAirJamGameCapabilities` helpers produce versioned, frozen objects.
32
+ Contract versions are bumped explicitly so the platform can accept mixed
33
+ versions during a transition window.
34
+
35
+ Games built against v1 should declare `supportedSdkRange: "^1.0.0"` in their
36
+ metadata unless they intentionally pin tighter.
37
+
38
+ ## Three Lanes (Canonical)
39
+
40
+ 1. `Input lane` (high frequency, transient):
41
+ `useControllerTick` + `useInputWriter` on controller, `host.getInput` / `useGetInput` on host.
42
+ 2. `State lane` (replicated, host-authoritative):
43
+ `createAirJamStore` + `useActions` with `(ctx, payload)` action handlers.
44
+ 3. `Signal lane` (out-of-band UX/system):
45
+ `sendSignal` / `sendSystemCommand` for haptics, toasts, room-level commands, and remote audio cues.
46
+
47
+ Do not mix lanes:
48
+
49
+ 1. Do not send per-frame stick/button input through store actions.
50
+ 2. Do not mutate authoritative game state via signals.
51
+ 3. Do not dispatch state actions via `state.actions.*`; use `useStore.useActions()`.
4
52
 
5
53
  ## Installation
6
54
 
7
55
  ```bash
8
- npm install @air-jam/sdk
9
- # or
10
- pnpm add @air-jam/sdk
56
+ pnpm add @air-jam/sdk zod
57
+ ```
58
+
59
+ ## Minimal Setup
60
+
61
+ Use `defineAirJamGameMetadata` for catalog-facing identity and
62
+ `createAirJamApp` for runtime/session wiring. Platform submissions can still
63
+ edit metadata in the dashboard; the code export gives tooling a typed default
64
+ to prefill, validate, and compare against release artifacts.
65
+
66
+ ```tsx
67
+ import { createAirJamApp, env } from "@air-jam/sdk";
68
+ import { defineAirJamGameMetadata } from "@air-jam/sdk/metadata";
69
+ import { z } from "zod";
70
+
71
+ const inputSchema = z.object({
72
+ vector: z.object({ x: z.number(), y: z.number() }),
73
+ action: z.boolean(),
74
+ });
75
+
76
+ export const gameMetadata = defineAirJamGameMetadata({
77
+ slug: "my-game",
78
+ name: "My Game",
79
+ tagline: "A short catalog pitch for players.",
80
+ category: "party",
81
+ minPlayers: 1,
82
+ maxPlayers: 4,
83
+ inputModalities: ["buttons", "touch"],
84
+ supportedSdkRange: "^1.0.0",
85
+ maintainer: { name: "Your Name" },
86
+ });
87
+
88
+ export const airjam = createAirJamApp({
89
+ runtime: env.vite(import.meta.env),
90
+ controllerPath: "/controller",
91
+ input: { schema: inputSchema },
92
+ });
93
+ ```
94
+
95
+ ## Production Auth Modes
96
+
97
+ There are two canonical production modes:
98
+
99
+ 1. Static `appId` mode
100
+ 2. Optional signed host-grant mode
101
+
102
+ Static `appId` mode is the default. Set:
103
+
104
+ ```bash
105
+ VITE_AIR_JAM_SERVER_URL=https://api.airjam.io
106
+ VITE_AIR_JAM_APP_ID=aj_app_your_app_id
107
+ ```
108
+
109
+ If you want stricter ownership guarantees while keeping the game static, add:
110
+
111
+ ```bash
112
+ VITE_AIR_JAM_HOST_GRANT_ENDPOINT=/api/airjam/host-grant
11
113
  ```
12
114
 
13
- ## Usage
115
+ and have that endpoint return:
14
116
 
15
- ### 1. Host (The Game)
117
+ ```json
118
+ { "hostGrant": "..." }
119
+ ```
16
120
 
17
- Use `useAirJamHost` to register your game session and listen for input.
121
+ The SDK fetches the host grant automatically before `host:bootstrap`. Game code stays unchanged.
122
+
123
+ ## Host Usage
124
+
125
+ Mount runtime ownership explicitly at the host boundary, then read it from child code with `useAirJamHost()`.
126
+
127
+ If a component only needs host session state, call `useAirJamHost(selector)` to
128
+ avoid rerendering on unrelated runtime fields.
129
+ Selectors receive state fields only; call `useAirJamHost()` when a component
130
+ also needs runtime controls such as `joinUrl`, `sendSignal`, or `getInput`.
18
131
 
19
132
  ```tsx
20
- import { useAirJamHost } from "@air-jam/sdk";
21
-
22
- function MyGame() {
23
- const { roomId, joinUrl, connectionStatus, players } = useAirJamHost({
24
- roomId: "MYROOM", // Optional: Custom room ID
25
- maxPlayers: 4,
26
- apiKey: process.env.AIR_JAM_API_KEY, // Required for production
27
- onPlayerJoin: (player) => console.log("Player joined:", player),
28
- onInput: (event) => {
29
- console.log("Input from", event.controllerId, event.input);
30
- },
31
- });
133
+ import { AirJamHostRuntime, env, useAirJamHost } from "@air-jam/sdk";
32
134
 
33
- if (connectionStatus === "connecting") return <div>Connecting...</div>;
135
+ const HostShell = () => (
136
+ <AirJamHostRuntime
137
+ topology={env.vite(import.meta.env).topology}
138
+ appId={import.meta.env.VITE_AIR_JAM_APP_ID}
139
+ input={{ schema: inputSchema }}
140
+ onPlayerJoin={(player) => console.log("joined", player.id)}
141
+ onPlayerLeave={(controllerId) => console.log("left", controllerId)}
142
+ >
143
+ <HostView />
144
+ </AirJamHostRuntime>
145
+ );
34
146
 
147
+ export const HostView = () => {
148
+ const host = useAirJamHost();
35
149
  return (
36
- <div>
37
- <h1>Room: {roomId}</h1>
38
- <p>Join at: {joinUrl}</p>
39
- {/* Render your game here */}
40
- </div>
150
+ <section>
151
+ <h1>Room: {host.roomId}</h1>
152
+ <p>Status: {host.connectionStatus}</p>
153
+ <p>Join URL: {host.joinUrl}</p>
154
+ </section>
41
155
  );
156
+ };
157
+ ```
158
+
159
+ Use `host.players` for gameplay-facing player iteration. Use `host.controllers`
160
+ when you need the richer controller-session roster with source
161
+ (`phone | preview | virtual`), connected state, and resume-lease metadata.
162
+ Use `host.resetRoom()` when you need a fresh empty room without restarting the
163
+ local backend.
164
+
165
+ Use `host.getInput(controllerId)` in your game loop.
166
+
167
+ Default input behavior:
168
+
169
+ - booleans: `pulse` (tap-safe consume-on-read)
170
+ - vectors: `latest` (continuous latest value)
171
+
172
+ Optional overrides are available via `input.behavior` (`pulse | hold | latest`).
173
+
174
+ ### Migration From `input.latch`
175
+
176
+ If you previously used:
177
+
178
+ ```ts
179
+ input: {
180
+ schema,
181
+ latch: {
182
+ booleanFields: ["action"],
183
+ vectorFields: ["vector"],
184
+ },
185
+ }
186
+ ```
187
+
188
+ Use:
189
+
190
+ ```ts
191
+ input: {
192
+ schema,
193
+ behavior: {
194
+ pulse: ["action", "vector"],
195
+ },
42
196
  }
43
197
  ```
44
198
 
45
- ### 2. Controller (The Phone)
199
+ Notes:
200
+
201
+ - most games can now remove input behavior config entirely (`input: { schema }`)
202
+ - booleans default to tap-safe `pulse`
203
+ - vectors default to `latest` (continuous)
204
+
205
+ ## Controller Usage
46
206
 
47
- Use `useAirJamController` to connect a phone to a game session.
207
+ Mount runtime ownership explicitly at the controller boundary, then read it from child code with `useAirJamController()`.
208
+
209
+ If a component only needs controller session state, call
210
+ `useAirJamController(selector)` to avoid rerendering on unrelated runtime
211
+ updates.
212
+ Selectors receive state fields only; call `useAirJamController()` when a
213
+ component also needs controls such as `sendSystemCommand`.
48
214
 
49
215
  ```tsx
50
- import { useAirJamController } from "@air-jam/sdk";
51
-
52
- function MyController() {
53
- const { joinRoom, sendInput, connectionStatus } = useAirJamController();
54
-
55
- // Join a room (usually from URL query param)
56
- useEffect(() => {
57
- joinRoom("MYROOM", "Player 1");
58
- }, []);
59
-
60
- const handlePress = () => {
61
- sendInput({
62
- action: true,
63
- vector: { x: 0, y: 0 },
64
- timestamp: Date.now(),
65
- });
66
- };
216
+ import {
217
+ AirJamControllerRuntime,
218
+ env,
219
+ useAirJamController,
220
+ useControllerTick,
221
+ useInputWriter,
222
+ } from "@air-jam/sdk";
223
+ import { SurfaceViewport } from "@air-jam/sdk/ui";
224
+
225
+ const ControllerShell = () => (
226
+ <AirJamControllerRuntime
227
+ topology={env.vite(import.meta.env).topology}
228
+ appId={import.meta.env.VITE_AIR_JAM_APP_ID}
229
+ nickname="Player 1"
230
+ >
231
+ <ControllerView />
232
+ </AirJamControllerRuntime>
233
+ );
234
+
235
+ export const ControllerView = () => {
236
+ const controller = useAirJamController();
237
+ const writeInput = useInputWriter();
238
+
239
+ useControllerTick(
240
+ () => {
241
+ writeInput({
242
+ vector: { x: 0, y: 0 },
243
+ action: false,
244
+ });
245
+ },
246
+ {
247
+ enabled:
248
+ controller.connectionStatus === "connected" &&
249
+ controller.runtimeState === "playing",
250
+ intervalMs: 16,
251
+ },
252
+ );
253
+
254
+ return (
255
+ <SurfaceViewport orientation="portrait">
256
+ <section>
257
+ <button
258
+ onPointerDown={() =>
259
+ writeInput({
260
+ vector: { x: 0, y: 0 },
261
+ action: true, // one-shot pulses still valid
262
+ })
263
+ }
264
+ >
265
+ Action
266
+ </button>
267
+ </section>
268
+ </SurfaceViewport>
269
+ );
270
+ };
271
+ ```
272
+
273
+ Controllers usually join via URL query param: `/controller?room=ABCD`.
274
+
275
+ Standalone controllers also keep one stable local device identity and the last
276
+ room-scoped controller binding. If the same phone refreshes or briefly
277
+ disconnects, the SDK automatically attempts to resume that controller binding
278
+ instead of creating a duplicate player.
279
+
280
+ The important rule is:
281
+
282
+ 1. mount `AirJamHostRuntime` / `AirJamControllerRuntime` once per runtime surface
283
+ 2. use `useAirJamHost()` / `useAirJamController()` only as read hooks below that boundary
284
+ 3. wrap controller UI in `SurfaceViewport` and set its `orientation` there
285
+
286
+ When the controller runs inside Arcade, `SurfaceViewport` automatically publishes
287
+ its orientation to the parent Arcade chrome. The same component still handles
288
+ standalone controller layout, so games do not need a separate host-side
289
+ orientation bridge. Multiplayer game state should live in the networked stores
290
+ and replicate automatically.
291
+
292
+ ## Preview Controllers (Experimental)
293
+
294
+ The preview-controller feature lives under the explicit experimental leaf:
295
+
296
+ ```ts
297
+ import { HostPreviewControllerWorkspace } from "@air-jam/sdk/preview";
298
+ ```
299
+
300
+ Use it when you want a fast local desktop tryout path without replacing the
301
+ normal phone-controller product model.
302
+
303
+ Important rules:
304
+
305
+ 1. phone controllers remain the canonical product experience
306
+ 2. preview controllers are not a second topology or fake simulator path
307
+ 3. preview controllers use the real controller route and join the same room as normal controllers
308
+ 4. production should stay explicit opt-in
309
+
310
+ The preview workspace also exposes local recovery controls:
311
+
312
+ 1. source-aware `Kick` controls for room controllers
313
+ 2. `Reset room`, which creates a fresh empty room and reloads the local host page
314
+
315
+ Recommended host usage:
316
+
317
+ ```tsx
318
+ import { HostPreviewControllerWorkspace } from "@air-jam/sdk/preview";
319
+
320
+ export const HostView = () => {
321
+ const previewControllersEnabled = import.meta.env.DEV;
322
+
323
+ return (
324
+ <>
325
+ <GameCanvas />
326
+ <HostPreviewControllerWorkspace enabled={previewControllersEnabled} />
327
+ </>
328
+ );
329
+ };
330
+ ```
331
+
332
+ The shared preview leaf currently provides:
333
+
334
+ 1. `HostPreviewControllerWorkspace` for normal host-surface mounting
335
+ 2. `PreviewControllerWorkspace` and `PreviewControllerWindow` for lower-level composition
336
+ 3. `usePreviewControllerManager` for host-local preview session state
337
+ 4. `buildPreviewControllerUrl` and related launch helpers for explicit launch control
338
+
339
+ The floating window chrome also supports per-window portrait/landscape rotation,
340
+ and active preview-window opacity is driven by the shared platform settings
341
+ runtime so hosts can persist their preferred transparency level.
342
+
343
+ Keep preview usage inside explicit host-side UI and do not treat it as a stable
344
+ root-SDK contract yet.
345
+
346
+ ## Runtime Contract Seams (In-Source, Not Public Exports)
347
+
348
+ Air Jam also carries agent-facing runtime seams for control, inspection, and
349
+ observability. Those modules still exist in-source, but they are **not public
350
+ package exports in v1**, so consumers should not import:
351
+
352
+ 1. `@air-jam/sdk/runtime-control`
353
+ 2. `@air-jam/sdk/runtime-inspection`
354
+ 3. `@air-jam/sdk/runtime-observability`
355
+ 4. `@air-jam/sdk/contracts/v2`
67
356
 
68
- return <button onPointerDown={handlePress}>Fire!</button>;
357
+ Current policy:
358
+
359
+ 1. keep these seams private until a real first-party consumer lands
360
+ 2. treat them as future agent-facing homes for bots, tests, previews, and agent tooling
361
+ 3. re-export them later as explicit experimental leaves instead of implying they are stable root-SDK contracts
362
+
363
+ ## Prefab Contract Leaf (Experimental)
364
+
365
+ Prefab definitions should live under a stable, scanable contract instead of
366
+ drifting between scene glue, render layers, and runtime population code.
367
+
368
+ The first prefab contract helpers now live under the explicit experimental leaf:
369
+
370
+ ```ts
371
+ import {
372
+ createPrefabCatalog,
373
+ definePrefab,
374
+ type PrefabDefinition,
375
+ } from "@air-jam/sdk/prefabs";
376
+ ```
377
+
378
+ Use this leaf when you need a canonical prefab definition that future tooling
379
+ can scan, preview, configure, and catalog.
380
+
381
+ Important rules:
382
+
383
+ 1. this leaf defines prefab contracts, not a prefab runtime or editor
384
+ 2. keep prefab definitions separate from scene population, pooling, or runtime spawn systems
385
+ 3. keep larger gameplay behavior in domain, engine, or adapter modules instead of burying it inside prefab metadata
386
+ 4. treat this as the future-facing namespace for Studio and agent-oriented prefab tooling
387
+
388
+ Current scope:
389
+
390
+ 1. `definePrefab(...)` for a stable prefab definition shape
391
+ 2. `createPrefabCatalog(...)` for a game-owned prefab registry export
392
+ 3. shared preview and placement descriptor types for future Studio/catalog work
393
+
394
+ ## Controller Feedback Helpers
395
+
396
+ Use explicit audio ownership at each host/controller surface boundary, then consume that runtime-owned manager below it. `AudioRuntime` is role-aware: controller surfaces automatically receive host-triggered remote sounds.
397
+
398
+ ```tsx
399
+ import { AudioRuntime, useAudio, useControllerToasts } from "@air-jam/sdk";
400
+
401
+ const manifest = {
402
+ hit: { src: ["/sounds/hit.wav"] },
403
+ };
404
+
405
+ const ControllerHud = () => {
406
+ const audio = useAudio();
407
+ const { latestToast } = useControllerToasts();
408
+
409
+ return latestToast ? <p>{latestToast.message}</p> : null;
410
+ };
411
+
412
+ const ControllerShell = () => (
413
+ <AudioRuntime manifest={manifest}>
414
+ <ControllerHud />
415
+ </AudioRuntime>
416
+ );
417
+ ```
418
+
419
+ Host-side `sendSignal("TOAST", ...)` now pairs directly with `useControllerToasts()`.
420
+ Mount `AudioRuntime` once per runtime surface, then call `useAudio()` only below that boundary.
421
+
422
+ ## Shared Platform Settings
423
+
424
+ Shared user settings are platform-owned and inherited by embedded games.
425
+
426
+ Mount `PlatformSettingsRuntime` once in the platform shell when you want a persisted owner runtime.
427
+ `AirJamHostRuntime` / `AirJamControllerRuntime` already provide a settings boundary for games, so repo games should not wrap each host/controller surface in another redundant `PlatformSettingsRuntime`.
428
+
429
+ ```tsx
430
+ import {
431
+ PlatformSettingsRuntime,
432
+ useInheritedPlatformSettings,
433
+ usePlatformAudioSettings,
434
+ } from "@air-jam/sdk";
435
+
436
+ const ArcadeShell = () => (
437
+ <PlatformSettingsRuntime persistence="local">
438
+ <SettingsPanel />
439
+ <EmbeddedGame />
440
+ </PlatformSettingsRuntime>
441
+ );
442
+
443
+ const SettingsPanel = () => {
444
+ const { masterVolume, setMasterVolume } = usePlatformAudioSettings();
445
+ return (
446
+ <button onClick={() => setMasterVolume(masterVolume === 0 ? 1 : 0)}>
447
+ Toggle Master
448
+ </button>
449
+ );
450
+ };
451
+
452
+ const EmbeddedGame = () => {
453
+ const settings = useInheritedPlatformSettings();
454
+ return <pre>{JSON.stringify(settings.audio, null, 2)}</pre>;
455
+ };
456
+ ```
457
+
458
+ Rules:
459
+
460
+ 1. mount `PlatformSettingsRuntime persistence="local"` once in the platform shell
461
+ 2. let `airjam.Host`, `airjam.Controller`, `AirJamHostRuntime`, and `AirJamControllerRuntime` supply the in-game settings boundary automatically
462
+ 3. embedded games inherit platform settings read-only
463
+ 4. keep platform settings limited to shared cross-game concerns like audio, accessibility, and feedback
464
+ 5. do not recreate feature-specific global settings stores alongside this runtime
465
+
466
+ ## Optional UI Primitives
467
+
468
+ `@air-jam/sdk/ui` exports optional presentational primitives (`Button`, `Slider`, `PlayerAvatar`, `VolumeControls`).
469
+ These components are lifecycle-free: they do not create sockets or own host/controller session state.
470
+ `VolumeControls` reads and writes the shared audio slice through the platform settings runtime.
471
+
472
+ ## Networked State (Host Source of Truth)
473
+
474
+ Use `createAirJamStore` for shared game state synced from host to controllers.
475
+
476
+ ```tsx
477
+ import { createAirJamStore } from "@air-jam/sdk";
478
+
479
+ interface RuntimeState {
480
+ phase: "lobby" | "playing";
481
+ actions: {
482
+ setPhase: (
483
+ ctx: {
484
+ actorId: string;
485
+ role: "controller" | "host";
486
+ connectedPlayerIds: string[];
487
+ },
488
+ payload: { phase: "lobby" | "playing" },
489
+ ) => void;
490
+ };
69
491
  }
492
+
493
+ export const useGameStore = createAirJamStore<RuntimeState>((set) => ({
494
+ phase: "lobby",
495
+ actions: {
496
+ setPhase: (_ctx, { phase }) => set({ phase }),
497
+ },
498
+ }));
499
+
500
+ const actions = useGameStore.useActions();
501
+ actions.setPhase({ phase: "playing" });
70
502
  ```
71
503
 
72
- ## API Reference
504
+ Use `useGameStore.useActions()` for action dispatch. On controllers, action calls are proxied to the host automatically and actor identity is attached by the server.
505
+
506
+ Important identity rule:
507
+
508
+ 1. `ctx.actorId` is always the identity of the dispatcher
509
+ 2. if host code calls `useActions()`, then `ctx.actorId === "host"`
510
+ 3. if host code intentionally wants to run the same semantic action as controller `X`, use `useGameStore.asPlayer("X")` instead of smuggling `controllerId` through an unrelated payload
511
+
512
+ Every action dispatch now resolves to an acknowledgement:
513
+
514
+ 1. `{ ok: true, status: "accepted", source, result? }`
515
+ 2. `{ ok: false, status: "rejected", source, reason, message, details? }`
516
+
517
+ Networked action contract:
518
+
519
+ 1. `() => Promise<ack>` for no-payload actions
520
+ 2. `(payloadObject) => Promise<ack>` for payload actions
521
+ 3. payload roots must be plain objects, not primitives, arrays, DOM events, or `T | undefined` unions
522
+ 4. if an action has no payload, omit it entirely instead of using `undefined` as part of an object-union payload type
523
+
524
+ Action context includes `connectedPlayerIds`, so host actions can prune stale assignments without custom presence-sync actions.
525
+
526
+ For host-only local side effects such as sounds, local sim refs, or one-shot animations, use the store's host action listener seam instead of queueing ephemeral commands through replicated state:
527
+
528
+ ```tsx
529
+ useGameStore.useHostActionListener((event) => {
530
+ if (event.actionName !== "fireProjectile") {
531
+ return;
532
+ }
533
+
534
+ projectileRuntimeRef.current.spawn(event.payload);
535
+ });
536
+ ```
537
+
538
+ For explicit host-side player impersonation, use the host-only player-action lane:
539
+
540
+ ```tsx
541
+ const playerActions = useGameStore.asPlayer("ctrl_2");
542
+
543
+ await playerActions.joinTeam({ team: "red" });
544
+ ```
545
+
546
+ When a store action should return an explicit semantic result or rejection, use
547
+ `acceptAirJamAction(...)` and `rejectAirJamAction(...)`:
548
+
549
+ ```tsx
550
+ import {
551
+ acceptAirJamAction,
552
+ createAirJamStore,
553
+ rejectAirJamAction,
554
+ } from "@air-jam/sdk";
555
+
556
+ export const useGameStore = createAirJamStore((set) => ({
557
+ aliveByPlayerId: {} as Record<string, boolean>,
558
+ actions: {
559
+ fire: ({ actorId }) =>
560
+ set((state) => {
561
+ if (!actorId || state.aliveByPlayerId[actorId] === false) {
562
+ return rejectAirJamAction("player_dead", "Dead players cannot fire.");
563
+ }
564
+
565
+ return acceptAirJamAction({ cooldownMs: 4500 });
566
+ }),
567
+ },
568
+ }));
569
+ ```
570
+
571
+ If an action returns `void`, Air Jam treats it as accepted automatically.
572
+
573
+ ## Runtime Pause Controls
574
+
575
+ Runtime pause/play is independent from your game-owned match phase. Keep lobby,
576
+ playing, and ended state in your game store, and use explicit runtime commands
577
+ only for pause UI.
578
+
579
+ ```tsx
580
+ const host = useAirJamHost();
581
+
582
+ <button
583
+ onClick={
584
+ host.runtimeState === "playing" ? host.pauseRuntime : host.resumeRuntime
585
+ }
586
+ >
587
+ {host.runtimeState === "playing" ? "Pause" : "Resume"}
588
+ </button>;
589
+ ```
590
+
591
+ ## One Correct Way (Default Path)
592
+
593
+ 1. Define one `airjam` app config with `createAirJamApp`.
594
+ 2. On controllers, publish input with `useControllerTick` + `useInputWriter`.
595
+ 3. On hosts, read input with `getInput` / `useGetInput`.
596
+ 4. For host gameplay loops, prefer `useHostTick(...)` over hand-rolled `requestAnimationFrame` or `setInterval` loops.
597
+ 5. Keep replicated gameplay state in `createAirJamStore`.
598
+ 6. Dispatch all store actions through `useActions()` zero-arg or payload-object calls and check the returned acknowledgement when outcome matters.
599
+
600
+ ## Canonical `airjam.config.ts`
601
+
602
+ Keep one runtime/session declaration and use role wrappers directly in routes.
603
+
604
+ ```tsx
605
+ import { createAirJamApp, env } from "@air-jam/sdk";
606
+ import { gameInputSchema } from "./types";
607
+
608
+ export const airjam = createAirJamApp({
609
+ runtime: env.vite(import.meta.env),
610
+ controllerPath: "/controller",
611
+ // Optional agent-facing contracts belong here too.
612
+ // agent: agentContract,
613
+ input: {
614
+ schema: gameInputSchema,
615
+ },
616
+ });
617
+ ```
618
+
619
+ ```tsx
620
+ import { Route, Routes } from "react-router-dom";
621
+ import { airjam } from "./airjam.config";
622
+
623
+ export const App = () => (
624
+ <Routes>
625
+ <Route
626
+ path="/"
627
+ element={
628
+ <airjam.Host>
629
+ <HostView />
630
+ </airjam.Host>
631
+ }
632
+ />
633
+ <Route
634
+ path={airjam.paths.controller}
635
+ element={
636
+ <airjam.Controller>
637
+ <ControllerView />
638
+ </airjam.Controller>
639
+ }
640
+ />
641
+ </Routes>
642
+ );
643
+ ```
644
+
645
+ This keeps runtime config, host input schema, route path ownership, and optional agent-facing contracts in one place.
646
+
647
+ Optional future-facing game capability metadata should also live here, but the schema is intentionally experimental and lives in `@air-jam/sdk/capabilities`.
73
648
 
74
- ### `useAirJamHost(options)`
649
+ ## Environment Variables
75
650
 
76
- - `options.roomId`: (Optional) Request a specific room code.
77
- - `options.maxPlayers`: (Optional) Limit number of players (default 8).
78
- - `options.apiKey`: (Optional) Your Air Jam API Key (required for production).
79
- - `options.onInput`: Callback for controller input.
80
- - `options.onPlayerJoin`: Callback when a player joins.
81
- - `options.onPlayerLeave`: Callback when a player leaves.
651
+ - `VITE_AIR_JAM_SERVER_URL` / `NEXT_PUBLIC_AIR_JAM_SERVER_URL`
652
+ - `VITE_AIR_JAM_APP_ID` / `NEXT_PUBLIC_AIR_JAM_APP_ID`
82
653
 
83
- ### `useAirJamController()`
654
+ ## Full Docs
84
655
 
85
- - `joinRoom(roomId, nickname)`: Connect to a room.
86
- - `sendInput(input)`: Send input data to the host.
87
- - `connectionStatus`: Current connection state.
656
+ - Platform docs: https://airjam.io/docs
657
+ - Monorepo docs index: `docs/docs-index.md`