@air-jam/sdk 0.9.2 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (590) hide show
  1. package/README.md +185 -242
  2. package/dist/actions-D4eh6Xaa.d.cts +72 -0
  3. package/dist/actions-D4eh6Xaa.d.ts +72 -0
  4. package/dist/{agent-tooling-BSMGBix9.d.cts → agent-contract-DfLm4Mf-.d.ts} +3 -19
  5. package/dist/{agent-tooling-BSMGBix9.d.ts → agent-contract-TINzp-5Y.d.cts} +3 -19
  6. package/dist/agent-tooling.cjs +270 -42
  7. package/dist/agent-tooling.cjs.map +1 -1
  8. package/dist/agent-tooling.d.cts +117 -2
  9. package/dist/agent-tooling.d.ts +117 -2
  10. package/dist/agent-tooling.js +150 -11
  11. package/dist/agent-tooling.js.map +1 -1
  12. package/dist/air-jam-context-BCVCWiaT.d.ts +410 -0
  13. package/dist/air-jam-context-DavligpM.d.cts +410 -0
  14. package/dist/arcade/bridge/controller.cjs +872 -582
  15. package/dist/arcade/bridge/controller.cjs.map +1 -1
  16. package/dist/arcade/bridge/controller.d.cts +28 -76
  17. package/dist/arcade/bridge/controller.d.ts +28 -76
  18. package/dist/arcade/bridge/controller.js +27 -26
  19. package/dist/arcade/bridge/controller.js.map +1 -1
  20. package/dist/arcade/bridge/host.cjs +1017 -252
  21. package/dist/arcade/bridge/host.cjs.map +1 -1
  22. package/dist/arcade/bridge/host.d.cts +6 -72
  23. package/dist/arcade/bridge/host.d.ts +6 -72
  24. package/dist/arcade/bridge/host.js +19 -21
  25. package/dist/arcade/bridge/host.js.map +1 -1
  26. package/dist/arcade/bridge/iframe.cjs +3 -31
  27. package/dist/arcade/bridge/iframe.cjs.map +1 -1
  28. package/dist/arcade/bridge/iframe.d.cts +4 -46
  29. package/dist/arcade/bridge/iframe.d.ts +4 -46
  30. package/dist/arcade/bridge/iframe.js +6 -18
  31. package/dist/arcade/bridge/iframe.js.map +1 -1
  32. package/dist/arcade/host.cjs +0 -479
  33. package/dist/arcade/host.cjs.map +1 -1
  34. package/dist/arcade/host.d.cts +1 -18
  35. package/dist/arcade/host.d.ts +1 -18
  36. package/dist/arcade/host.js +0 -13
  37. package/dist/arcade/host.js.map +1 -1
  38. package/dist/arcade/runtime.cjs +12163 -0
  39. package/dist/arcade/runtime.cjs.map +1 -0
  40. package/dist/arcade/runtime.d.cts +54 -0
  41. package/dist/arcade/runtime.d.ts +54 -0
  42. package/dist/arcade/runtime.js +45 -0
  43. package/dist/arcade/runtime.js.map +1 -0
  44. package/dist/arcade/surface.cjs +12 -35
  45. package/dist/arcade/surface.cjs.map +1 -1
  46. package/dist/arcade/surface.d.cts +19 -2
  47. package/dist/arcade/surface.d.ts +19 -2
  48. package/dist/arcade/surface.js +12 -14
  49. package/dist/arcade/surface.js.map +1 -1
  50. package/dist/arcade/url.cjs +45 -283
  51. package/dist/arcade/url.cjs.map +1 -1
  52. package/dist/arcade/url.d.cts +3 -56
  53. package/dist/arcade/url.d.ts +3 -56
  54. package/dist/arcade/url.js +33 -16
  55. package/dist/arcade/url.js.map +1 -1
  56. package/dist/chunk-24NZZOIO.js +700 -0
  57. package/dist/chunk-24NZZOIO.js.map +1 -0
  58. package/dist/chunk-27QLKLZL.js +469 -0
  59. package/dist/chunk-27QLKLZL.js.map +1 -0
  60. package/dist/{chunk-UWJOIVON.js → chunk-2H2FGF3H.js} +3 -6
  61. package/dist/chunk-2H2FGF3H.js.map +1 -0
  62. package/dist/chunk-2QZADUGA.js +188 -0
  63. package/dist/chunk-2QZADUGA.js.map +1 -0
  64. package/dist/chunk-3LDQCQL2.js +307 -0
  65. package/dist/chunk-3LDQCQL2.js.map +1 -0
  66. package/dist/chunk-3M7656SU.js +389 -0
  67. package/dist/chunk-3M7656SU.js.map +1 -0
  68. package/dist/{chunk-ZLPL2R3R.js → chunk-5CRZFIN6.js} +2 -82
  69. package/dist/chunk-5CRZFIN6.js.map +1 -0
  70. package/dist/chunk-5TVVPBQI.js +7 -0
  71. package/dist/chunk-5TVVPBQI.js.map +1 -0
  72. package/dist/chunk-6Y3F6Y2K.js +343 -0
  73. package/dist/chunk-6Y3F6Y2K.js.map +1 -0
  74. package/dist/{chunk-EVZJA6RN.js → chunk-6ZJUA63D.js} +183 -2
  75. package/dist/chunk-6ZJUA63D.js.map +1 -0
  76. package/dist/chunk-A6EOGRRG.js +49 -0
  77. package/dist/chunk-A6EOGRRG.js.map +1 -0
  78. package/dist/chunk-BEM77SVQ.js +57 -0
  79. package/dist/chunk-BEM77SVQ.js.map +1 -0
  80. package/dist/chunk-C5722GTG.js +176 -0
  81. package/dist/chunk-C5722GTG.js.map +1 -0
  82. package/dist/{chunk-DY67S3LR.js → chunk-C5GS2GMK.js} +99 -105
  83. package/dist/chunk-C5GS2GMK.js.map +1 -0
  84. package/dist/chunk-CDL7LYZH.js +19 -0
  85. package/dist/chunk-CDL7LYZH.js.map +1 -0
  86. package/dist/chunk-DA3TE4OP.js +16 -0
  87. package/dist/chunk-DA3TE4OP.js.map +1 -0
  88. package/dist/chunk-DBF7NJ3S.js +72 -0
  89. package/dist/chunk-DBF7NJ3S.js.map +1 -0
  90. package/dist/chunk-DHFKL3DI.js +2477 -0
  91. package/dist/chunk-DHFKL3DI.js.map +1 -0
  92. package/dist/chunk-DRBPVG47.js +89 -0
  93. package/dist/chunk-DRBPVG47.js.map +1 -0
  94. package/dist/{chunk-7OTQTT6H.js → chunk-EG25EXSA.js} +24 -3
  95. package/dist/chunk-EG25EXSA.js.map +1 -0
  96. package/dist/chunk-FCG42U7D.js +131 -0
  97. package/dist/chunk-FCG42U7D.js.map +1 -0
  98. package/dist/chunk-FJ4J2BEC.js +26 -0
  99. package/dist/chunk-FJ4J2BEC.js.map +1 -0
  100. package/dist/chunk-H4DEVMTO.js +221 -0
  101. package/dist/chunk-H4DEVMTO.js.map +1 -0
  102. package/dist/chunk-I6TSHJF7.js +63 -0
  103. package/dist/chunk-I6TSHJF7.js.map +1 -0
  104. package/dist/{chunk-NCL6WJCL.js → chunk-JCGTL77W.js} +32 -1
  105. package/dist/chunk-JCGTL77W.js.map +1 -0
  106. package/dist/chunk-JJVCBUYM.js +98 -0
  107. package/dist/chunk-JJVCBUYM.js.map +1 -0
  108. package/dist/chunk-K6BJJJJM.js +138 -0
  109. package/dist/chunk-K6BJJJJM.js.map +1 -0
  110. package/dist/chunk-KSYN4I5Y.js +50 -0
  111. package/dist/chunk-KSYN4I5Y.js.map +1 -0
  112. package/dist/chunk-KUGROY5S.js +265 -0
  113. package/dist/chunk-KUGROY5S.js.map +1 -0
  114. package/dist/chunk-LX6CTPDW.js +16 -0
  115. package/dist/chunk-LX6CTPDW.js.map +1 -0
  116. package/dist/{chunk-BE6Z4SIT.js → chunk-M5553I2G.js} +2 -11
  117. package/dist/chunk-M5553I2G.js.map +1 -0
  118. package/dist/{chunk-X24K52DG.js → chunk-MD25536W.js} +1 -1
  119. package/dist/chunk-MD25536W.js.map +1 -0
  120. package/dist/{chunk-3USU7GY2.js → chunk-MJAWAHLT.js} +1 -1
  121. package/dist/chunk-MJAWAHLT.js.map +1 -0
  122. package/dist/chunk-OAXCFPZ7.js +14 -0
  123. package/dist/chunk-OAXCFPZ7.js.map +1 -0
  124. package/dist/chunk-QHBRHYMV.js +81 -0
  125. package/dist/chunk-QHBRHYMV.js.map +1 -0
  126. package/dist/chunk-QTNYGAZ7.js +45 -0
  127. package/dist/chunk-QTNYGAZ7.js.map +1 -0
  128. package/dist/chunk-S3TN7Y7L.js +921 -0
  129. package/dist/chunk-S3TN7Y7L.js.map +1 -0
  130. package/dist/chunk-SMKD4JY3.js +129 -0
  131. package/dist/chunk-SMKD4JY3.js.map +1 -0
  132. package/dist/{chunk-NUJBMV3O.js → chunk-TFW4NJW2.js} +619 -646
  133. package/dist/chunk-TFW4NJW2.js.map +1 -0
  134. package/dist/chunk-UBBP2UY3.js +83 -0
  135. package/dist/chunk-UBBP2UY3.js.map +1 -0
  136. package/dist/chunk-URVBMQCK.js +802 -0
  137. package/dist/chunk-URVBMQCK.js.map +1 -0
  138. package/dist/chunk-VGX2274F.js +1995 -0
  139. package/dist/chunk-VGX2274F.js.map +1 -0
  140. package/dist/chunk-WAFGYJZN.js +1513 -0
  141. package/dist/chunk-WAFGYJZN.js.map +1 -0
  142. package/dist/chunk-WGHNGQUS.js +78 -0
  143. package/dist/chunk-WGHNGQUS.js.map +1 -0
  144. package/dist/chunk-XLY44PXZ.js +46 -0
  145. package/dist/chunk-XLY44PXZ.js.map +1 -0
  146. package/dist/connection-store-BYpQ50W2.d.ts +41 -0
  147. package/dist/connection-store-D6QqzXU1.d.cts +41 -0
  148. package/dist/control-Bv8dWjyp.d.ts +1400 -0
  149. package/dist/control-CNzybWMd.d.cts +1400 -0
  150. package/dist/controller-0CVO1t_3.d.cts +26 -0
  151. package/dist/controller-agent-vOiuK7T6.d.cts +130 -0
  152. package/dist/controller-agent-vOiuK7T6.d.ts +130 -0
  153. package/dist/controller-bridge.cjs +992 -0
  154. package/dist/controller-bridge.cjs.map +1 -0
  155. package/dist/controller-bridge.d.cts +52 -0
  156. package/dist/controller-bridge.d.ts +52 -0
  157. package/dist/controller-bridge.js +23 -0
  158. package/dist/controller-bridge.js.map +1 -0
  159. package/dist/controller-capture-2GKKGHJ2.js +8 -0
  160. package/dist/controller-capture-2GKKGHJ2.js.map +1 -0
  161. package/dist/controller-h9M2Nngd.d.ts +26 -0
  162. package/dist/controller-press-EWWIMVXP.js +231 -0
  163. package/dist/controller-press-EWWIMVXP.js.map +1 -0
  164. package/dist/core-BAO0pHrJ.d.cts +15 -0
  165. package/dist/core-BAO0pHrJ.d.ts +15 -0
  166. package/dist/core.cjs +5931 -0
  167. package/dist/core.cjs.map +1 -0
  168. package/dist/core.d.cts +232 -0
  169. package/dist/core.d.ts +232 -0
  170. package/dist/core.js +906 -0
  171. package/dist/core.js.map +1 -0
  172. package/dist/dev-events-BffobOfb.d.ts +31 -0
  173. package/dist/dev-events-Ct7QEgKb.d.cts +31 -0
  174. package/dist/dev-log-events-B1_B3guZ.d.cts +47 -0
  175. package/dist/dev-log-events-B1_B3guZ.d.ts +47 -0
  176. package/dist/frames-D-xKuODS.d.cts +686 -0
  177. package/dist/frames-D-xKuODS.d.ts +686 -0
  178. package/dist/game-Db58JNk3.d.cts +77 -0
  179. package/dist/game-bySEy-QO.d.ts +77 -0
  180. package/dist/host-runtime-BuLhGQx5.d.ts +399 -0
  181. package/dist/host-runtime-_06jpW5v.d.cts +399 -0
  182. package/dist/index.cjs +12406 -8020
  183. package/dist/index.cjs.map +1 -1
  184. package/dist/index.d.cts +106 -973
  185. package/dist/index.d.ts +106 -973
  186. package/dist/index.js +451 -4637
  187. package/dist/index.js.map +1 -1
  188. package/dist/input-Xvs80gqG.d.cts +92 -0
  189. package/dist/input-Xvs80gqG.d.ts +92 -0
  190. package/dist/input-bindings-BaEFrgRb.d.cts +129 -0
  191. package/dist/input-bindings-BgsJRLPm.d.ts +129 -0
  192. package/dist/leased-control-BEg4JuXA.d.cts +158 -0
  193. package/dist/leased-control-BEg4JuXA.d.ts +158 -0
  194. package/dist/metadata.cjs +3 -9
  195. package/dist/metadata.cjs.map +1 -1
  196. package/dist/metadata.d.cts +6 -17
  197. package/dist/metadata.d.ts +6 -17
  198. package/dist/metadata.js +8 -76
  199. package/dist/metadata.js.map +1 -1
  200. package/dist/phone-room-session-Ca6rlxJr.d.ts +439 -0
  201. package/dist/phone-room-session-DkPR-K6e.d.cts +439 -0
  202. package/dist/platform-machine.cjs +248 -18
  203. package/dist/platform-machine.cjs.map +1 -1
  204. package/dist/platform-machine.d.cts +1867 -96
  205. package/dist/platform-machine.d.ts +1867 -96
  206. package/dist/platform-machine.js +206 -18
  207. package/dist/platform-machine.js.map +1 -1
  208. package/dist/{platform-settings-cuor3i11.d.cts → platform-settings-Yb0fQ1dl.d.cts} +1 -3
  209. package/dist/{platform-settings-cuor3i11.d.ts → platform-settings-Yb0fQ1dl.d.ts} +1 -3
  210. package/dist/prefabs.cjs +134 -3
  211. package/dist/prefabs.cjs.map +1 -1
  212. package/dist/prefabs.d.cts +23 -47
  213. package/dist/prefabs.d.ts +23 -47
  214. package/dist/prefabs.js +23 -4
  215. package/dist/prefabs.js.map +1 -1
  216. package/dist/preview.cjs +2269 -774
  217. package/dist/preview.cjs.map +1 -1
  218. package/dist/preview.d.cts +195 -38
  219. package/dist/preview.d.ts +195 -38
  220. package/dist/preview.js +494 -260
  221. package/dist/preview.js.map +1 -1
  222. package/dist/protocol.cjs +705 -396
  223. package/dist/protocol.cjs.map +1 -1
  224. package/dist/protocol.d.cts +49 -100
  225. package/dist/protocol.d.ts +49 -100
  226. package/dist/protocol.js +56 -75
  227. package/dist/protocol.js.map +1 -1
  228. package/dist/release.cjs +37 -0
  229. package/dist/release.cjs.map +1 -1
  230. package/dist/release.d.cts +29 -3
  231. package/dist/release.d.ts +29 -3
  232. package/dist/release.js +13 -1
  233. package/dist/release.js.map +1 -1
  234. package/dist/replay-input-log-BvX4As2f.d.ts +31 -0
  235. package/dist/replay-input-log-Vcl0VDIy.d.cts +31 -0
  236. package/dist/room-protocol.cjs +794 -0
  237. package/dist/room-protocol.cjs.map +1 -0
  238. package/dist/room-protocol.d.cts +63 -0
  239. package/dist/room-protocol.d.ts +63 -0
  240. package/dist/room-protocol.js +143 -0
  241. package/dist/room-protocol.js.map +1 -0
  242. package/dist/room-session.cjs +2336 -0
  243. package/dist/room-session.cjs.map +1 -0
  244. package/dist/room-session.d.cts +77 -0
  245. package/dist/room-session.d.ts +77 -0
  246. package/dist/room-session.js +103 -0
  247. package/dist/room-session.js.map +1 -0
  248. package/dist/runtime/prefab-inspection-bridge.cjs +207 -0
  249. package/dist/runtime/prefab-inspection-bridge.cjs.map +1 -0
  250. package/dist/runtime/prefab-inspection-bridge.d.cts +156 -0
  251. package/dist/runtime/prefab-inspection-bridge.d.ts +156 -0
  252. package/dist/runtime/prefab-inspection-bridge.js +22 -0
  253. package/dist/runtime/prefab-inspection-bridge.js.map +1 -0
  254. package/dist/runtime-control.cjs +2150 -0
  255. package/dist/runtime-control.cjs.map +1 -0
  256. package/dist/runtime-control.d.cts +985 -0
  257. package/dist/runtime-control.d.ts +985 -0
  258. package/dist/runtime-control.js +268 -0
  259. package/dist/runtime-control.js.map +1 -0
  260. package/dist/runtime-inspection.cjs +1319 -0
  261. package/dist/runtime-inspection.cjs.map +1 -0
  262. package/dist/runtime-inspection.d.cts +555 -0
  263. package/dist/runtime-inspection.d.ts +555 -0
  264. package/dist/runtime-inspection.js +29 -0
  265. package/dist/runtime-inspection.js.map +1 -0
  266. package/dist/runtime-reporting-K_ZXpubu.d.cts +43 -0
  267. package/dist/runtime-reporting-K_ZXpubu.d.ts +43 -0
  268. package/dist/runtime-topology.cjs +2 -5
  269. package/dist/runtime-topology.cjs.map +1 -1
  270. package/dist/runtime-topology.d.cts +1 -1
  271. package/dist/runtime-topology.d.ts +1 -1
  272. package/dist/runtime-topology.js +1 -1
  273. package/dist/runtime-topology.js.map +1 -1
  274. package/dist/scoped-connector-CiiWu06D.d.ts +66 -0
  275. package/dist/scoped-connector-D7252pn0.d.cts +66 -0
  276. package/dist/sdk-channels-S6j6AH8v.d.cts +103 -0
  277. package/dist/sdk-channels-S6j6AH8v.d.ts +103 -0
  278. package/dist/simulation-BfRnC4rg.d.ts +782 -0
  279. package/dist/simulation-BwZx2pgt.d.cts +782 -0
  280. package/dist/{standard-match-phase-BucA5dYo.d.ts → standard-match-phase-D4N-AU0d.d.cts} +3 -13
  281. package/dist/{standard-match-phase-U2ra8J-0.d.cts → standard-match-phase-abt8ZjCh.d.ts} +3 -13
  282. package/dist/transport-CWF29jU6.d.cts +173 -0
  283. package/dist/transport-CWF29jU6.d.ts +173 -0
  284. package/dist/types-p28maMEo.d.cts +102 -0
  285. package/dist/types-p28maMEo.d.ts +102 -0
  286. package/dist/ui.cjs +2324 -1051
  287. package/dist/ui.cjs.map +1 -1
  288. package/dist/ui.d.cts +75 -17
  289. package/dist/ui.d.ts +75 -17
  290. package/dist/ui.js +555 -389
  291. package/dist/ui.js.map +1 -1
  292. package/package.json +88 -37
  293. package/src/agent/agent-action.ts +0 -39
  294. package/src/agent/agent-contract-conformance.ts +208 -0
  295. package/src/agent/agent-contract.ts +2 -4
  296. package/src/agent/agent-evaluator.ts +95 -0
  297. package/src/agent/capture-canvas.ts +79 -0
  298. package/src/agent/host-canvas-capture.ts +189 -0
  299. package/src/agent-tooling.ts +8 -18
  300. package/src/arcade/bridge/controller.ts +8 -11
  301. package/src/arcade/bridge/host.ts +6 -11
  302. package/src/arcade/bridge/iframe.ts +1 -50
  303. package/src/arcade/host.ts +0 -1
  304. package/src/arcade/runtime.ts +6 -0
  305. package/src/arcade/surface.ts +6 -1
  306. package/src/arcade/url.ts +2 -9
  307. package/src/audio/audio-manager.ts +23 -47
  308. package/src/audio/hooks.tsx +59 -72
  309. package/src/components/controller-player-name-field.tsx +2 -2
  310. package/src/components/controller-primary-action.tsx +1 -1
  311. package/src/components/controls.tsx +398 -0
  312. package/src/components/gamepad-layout.tsx +69 -0
  313. package/src/components/join-url-controls.tsx +5 -1
  314. package/src/components/lifecycle-action-group.tsx +1 -1
  315. package/src/components/player-avatar.tsx +50 -3
  316. package/src/components/room-qr-code.tsx +36 -77
  317. package/src/components/stage-capture-surface.tsx +91 -0
  318. package/src/components/surface-viewport.tsx +16 -3
  319. package/src/components/ui/button.tsx +1 -1
  320. package/src/constants.ts +0 -15
  321. package/src/context/air-jam-context.tsx +64 -195
  322. package/src/context/session-providers.tsx +13 -10
  323. package/src/controller-bridge.ts +7 -0
  324. package/src/core/assets.ts +48 -0
  325. package/src/core/config.ts +70 -0
  326. package/src/core/connection-store.ts +77 -0
  327. package/src/core/controller-input.ts +147 -0
  328. package/src/core/controller-runtime.ts +427 -0
  329. package/src/core/dev-events.ts +18 -0
  330. package/src/core/environment.ts +132 -0
  331. package/src/core/game-description.ts +44 -0
  332. package/src/core/game.ts +130 -0
  333. package/src/core/host-input.ts +207 -0
  334. package/src/core/host-runtime.ts +988 -0
  335. package/src/core/hosted-rooms.ts +26 -0
  336. package/src/core/input-bindings.ts +180 -0
  337. package/src/core/input-log.ts +144 -0
  338. package/src/core/input.ts +228 -0
  339. package/src/core/local-input.ts +319 -0
  340. package/src/core/replay-input-log.ts +298 -0
  341. package/src/core/replicated-store.ts +1178 -0
  342. package/src/core/room-action-ack.ts +43 -0
  343. package/src/core/settings.ts +202 -0
  344. package/src/core/simulation.ts +307 -0
  345. package/src/core/theme.ts +33 -0
  346. package/src/core.ts +162 -0
  347. package/src/dev/browser-log-sink.ts +47 -27
  348. package/src/diagnostics.ts +5 -6
  349. package/src/hooks/internal/use-controller-runtime-api.ts +58 -836
  350. package/src/hooks/internal/use-host-runtime-api.ts +98 -1013
  351. package/src/hooks/internal/use-runtime-inspection-contract.ts +14 -2
  352. package/src/hooks/use-air-jam-controller.ts +41 -62
  353. package/src/hooks/use-air-jam-host.ts +66 -107
  354. package/src/hooks/use-air-jam-settings.ts +27 -0
  355. package/src/hooks/use-controller-toasts.ts +16 -19
  356. package/src/hooks/use-host-agent-capture.ts +31 -0
  357. package/src/hooks/use-lifecycle-action-group-model.ts +1 -1
  358. package/src/hooks/use-send-signal.ts +23 -156
  359. package/src/hooks/use-simulation.ts +83 -0
  360. package/src/index.ts +26 -106
  361. package/src/lifecycle/index.ts +0 -4
  362. package/src/lifecycle/standard-match-phase.ts +1 -22
  363. package/src/metadata/manifest.ts +8 -20
  364. package/src/metadata.ts +1 -1
  365. package/src/platform-machine.ts +236 -15
  366. package/src/prefabs/types.ts +91 -20
  367. package/src/prefabs/view.ts +82 -0
  368. package/src/prefabs.ts +19 -0
  369. package/src/preview/host-workspace.tsx +4 -9
  370. package/src/preview/identity.ts +31 -23
  371. package/src/preview/layout.ts +5 -1
  372. package/src/preview/manager.ts +205 -78
  373. package/src/preview/messages.ts +47 -0
  374. package/src/preview/ownership.ts +6 -1
  375. package/src/preview/url.ts +46 -23
  376. package/src/preview/window.tsx +26 -69
  377. package/src/preview/workspace-local-seats.ts +166 -0
  378. package/src/preview/workspace.tsx +137 -66
  379. package/src/preview.ts +27 -15
  380. package/src/protocol/actions.ts +58 -0
  381. package/src/protocol/arcade-platform-actions.ts +20 -16
  382. package/src/protocol/controller.ts +15 -169
  383. package/src/protocol/core.ts +8 -15
  384. package/src/protocol/dev-log-events.ts +5 -84
  385. package/src/protocol/leased-control.ts +177 -0
  386. package/src/protocol/room/addressing.ts +35 -0
  387. package/src/protocol/room/close-codes.ts +33 -0
  388. package/src/protocol/room/frames.ts +343 -0
  389. package/src/protocol/room/input-codec.ts +182 -0
  390. package/src/protocol/room/limits.ts +58 -0
  391. package/src/protocol/room/patch.ts +135 -0
  392. package/src/protocol/room/sdk-channels.ts +81 -0
  393. package/src/protocol/room/seat-id.ts +31 -0
  394. package/src/protocol/room/transport.ts +63 -0
  395. package/src/protocol/room/weight.ts +58 -0
  396. package/src/protocol/runtime-reporting.ts +78 -0
  397. package/src/protocol/signed-envelope.ts +176 -0
  398. package/src/protocol.ts +4 -7
  399. package/src/qrcode.d.ts +3 -13
  400. package/src/release.ts +32 -0
  401. package/src/room-protocol.ts +10 -0
  402. package/src/room-session/browser-wake-events.ts +14 -0
  403. package/src/room-session/channel-state.ts +293 -0
  404. package/src/room-session/clock.ts +24 -0
  405. package/src/room-session/host-room-session.ts +379 -0
  406. package/src/room-session/input-lane.ts +125 -0
  407. package/src/room-session/listeners.ts +22 -0
  408. package/src/room-session/loopback-link.ts +58 -0
  409. package/src/room-session/phone-room-session.ts +368 -0
  410. package/src/room-session/port-link.ts +116 -0
  411. package/src/room-session/room-key.ts +9 -0
  412. package/src/room-session/roster.ts +23 -0
  413. package/src/room-session/scoped-connector.ts +577 -0
  414. package/src/room-session/session-link.ts +306 -0
  415. package/src/room-session/web-socket-link.ts +57 -0
  416. package/src/room-session.ts +12 -0
  417. package/src/runtime/air-jam-config.ts +53 -51
  418. package/src/runtime/air-jam-error-boundary.tsx +52 -2
  419. package/src/runtime/arcade-runtime-url.ts +8 -9
  420. package/src/runtime/browser-controller-environment.ts +116 -0
  421. package/src/runtime/browser-host-environment.ts +137 -0
  422. package/src/runtime/browser-replay.ts +211 -0
  423. package/src/runtime/browser-room.ts +41 -0
  424. package/src/runtime/connected-runtime-error-boundary.tsx +58 -0
  425. package/src/runtime/contracts/agent-control.ts +195 -0
  426. package/src/runtime/contracts/clip.ts +169 -0
  427. package/src/runtime/contracts/control.ts +744 -59
  428. package/src/runtime/contracts/controller-agent.ts +130 -0
  429. package/src/runtime/contracts/input-log.ts +38 -0
  430. package/src/runtime/contracts/inspection.ts +25 -22
  431. package/src/runtime/contracts/observation.ts +186 -0
  432. package/src/runtime/contracts/runtime-identity.ts +43 -0
  433. package/src/runtime/contracts/timeline.ts +59 -0
  434. package/src/runtime/controller-agent-bridge.ts +152 -0
  435. package/src/runtime/controller-bridge-context.ts +29 -0
  436. package/src/runtime/controller-capture.ts +50 -0
  437. package/src/runtime/controller-identity.ts +54 -115
  438. package/src/runtime/controller-presentation.ts +47 -17
  439. package/src/runtime/controller-press.ts +271 -0
  440. package/src/runtime/create-air-jam-app.tsx +120 -83
  441. package/src/runtime/dev-runtime-events.ts +6 -18
  442. package/src/runtime/embedded-parent.ts +22 -0
  443. package/src/runtime/embedded-runtime-adapters.ts +10 -9
  444. package/src/runtime/host-agent-bridge.ts +127 -0
  445. package/src/runtime/host-capture-boundary.tsx +92 -0
  446. package/src/runtime/host-capture-context.ts +7 -0
  447. package/src/runtime/host-clip-reader.ts +93 -0
  448. package/src/runtime/host-clip-recorder.ts +342 -0
  449. package/src/runtime/host-input-log-reader.ts +120 -0
  450. package/src/runtime/host-observation.ts +207 -0
  451. package/src/runtime/host-pace.ts +36 -0
  452. package/src/runtime/host-runtime-fault.ts +51 -0
  453. package/src/runtime/host-timeline.ts +152 -0
  454. package/src/runtime/local-players.tsx +96 -0
  455. package/src/runtime/local-reference-game-identity.ts +13 -0
  456. package/src/runtime/local-seats.ts +612 -0
  457. package/src/runtime/participant-control.ts +162 -0
  458. package/src/runtime/prefab-inspection-bridge.ts +174 -0
  459. package/src/runtime/prefab-inspection-clock.ts +12 -0
  460. package/src/runtime/prefab-inspection-context.ts +20 -0
  461. package/src/runtime/prefab-inspection-runtime.tsx +328 -0
  462. package/src/runtime/preview-inspection-bridge.ts +130 -0
  463. package/src/runtime/replay-runtime.tsx +101 -0
  464. package/src/runtime/room-bridge.ts +110 -0
  465. package/src/runtime/runtime-owner-contexts.tsx +9 -0
  466. package/src/runtime/runtime-session-params.ts +23 -86
  467. package/src/runtime/session-runtimes.tsx +231 -64
  468. package/src/runtime/stage-capture.ts +25 -0
  469. package/src/runtime-control.ts +44 -8
  470. package/src/runtime-inspection.ts +14 -7
  471. package/src/runtime-topology.ts +7 -8
  472. package/src/settings/platform-settings-runtime.tsx +48 -8
  473. package/src/settings/platform-settings.ts +0 -96
  474. package/src/store/use-air-jam-store.ts +73 -0
  475. package/src/ui.ts +3 -3
  476. package/src/utils/is-rpc-serializable.ts +11 -19
  477. package/src/utils/url-builder.ts +0 -7
  478. package/dist/arcade/bridge.cjs +0 -1067
  479. package/dist/arcade/bridge.cjs.map +0 -1
  480. package/dist/arcade/bridge.d.cts +0 -11
  481. package/dist/arcade/bridge.d.ts +0 -11
  482. package/dist/arcade/bridge.js +0 -76
  483. package/dist/arcade/bridge.js.map +0 -1
  484. package/dist/arcade-runtime-url-BW-MUAOY.d.cts +0 -28
  485. package/dist/arcade-runtime-url-l8qj01Pg.d.ts +0 -28
  486. package/dist/arcade.cjs +0 -1737
  487. package/dist/arcade.cjs.map +0 -1
  488. package/dist/arcade.d.cts +0 -18
  489. package/dist/arcade.d.ts +0 -18
  490. package/dist/arcade.js +0 -123
  491. package/dist/arcade.js.map +0 -1
  492. package/dist/capabilities.cjs +0 -39
  493. package/dist/capabilities.cjs.map +0 -1
  494. package/dist/capabilities.d.cts +0 -31
  495. package/dist/capabilities.d.ts +0 -31
  496. package/dist/capabilities.js +0 -12
  497. package/dist/capabilities.js.map +0 -1
  498. package/dist/chunk-32NYL7XI.js +0 -539
  499. package/dist/chunk-32NYL7XI.js.map +0 -1
  500. package/dist/chunk-3USU7GY2.js.map +0 -1
  501. package/dist/chunk-6CMB356F.js +0 -193
  502. package/dist/chunk-6CMB356F.js.map +0 -1
  503. package/dist/chunk-7OTQTT6H.js.map +0 -1
  504. package/dist/chunk-BE6Z4SIT.js.map +0 -1
  505. package/dist/chunk-CVYR5RJT.js +0 -184
  506. package/dist/chunk-CVYR5RJT.js.map +0 -1
  507. package/dist/chunk-DY67S3LR.js.map +0 -1
  508. package/dist/chunk-E5PVHEAX.js +0 -126
  509. package/dist/chunk-E5PVHEAX.js.map +0 -1
  510. package/dist/chunk-EDRQIOCV.js +0 -25
  511. package/dist/chunk-EDRQIOCV.js.map +0 -1
  512. package/dist/chunk-EVZJA6RN.js.map +0 -1
  513. package/dist/chunk-IKKDONQL.js +0 -1
  514. package/dist/chunk-IKKDONQL.js.map +0 -1
  515. package/dist/chunk-JO2HR5PV.js +0 -43
  516. package/dist/chunk-JO2HR5PV.js.map +0 -1
  517. package/dist/chunk-JTF47B56.js +0 -1
  518. package/dist/chunk-JTF47B56.js.map +0 -1
  519. package/dist/chunk-KOB73SPD.js +0 -216
  520. package/dist/chunk-KOB73SPD.js.map +0 -1
  521. package/dist/chunk-LIXPF4P6.js +0 -22
  522. package/dist/chunk-LIXPF4P6.js.map +0 -1
  523. package/dist/chunk-M4DKOI42.js +0 -32
  524. package/dist/chunk-M4DKOI42.js.map +0 -1
  525. package/dist/chunk-MPDMJIX5.js +0 -1
  526. package/dist/chunk-MPDMJIX5.js.map +0 -1
  527. package/dist/chunk-NCL6WJCL.js.map +0 -1
  528. package/dist/chunk-NUJBMV3O.js.map +0 -1
  529. package/dist/chunk-Q4UALQO4.js +0 -288
  530. package/dist/chunk-Q4UALQO4.js.map +0 -1
  531. package/dist/chunk-TGRTEWYV.js +0 -195
  532. package/dist/chunk-TGRTEWYV.js.map +0 -1
  533. package/dist/chunk-UWJOIVON.js.map +0 -1
  534. package/dist/chunk-W2VK36RO.js +0 -11
  535. package/dist/chunk-W2VK36RO.js.map +0 -1
  536. package/dist/chunk-X24K52DG.js.map +0 -1
  537. package/dist/chunk-YXHH3MQT.js +0 -230
  538. package/dist/chunk-YXHH3MQT.js.map +0 -1
  539. package/dist/chunk-ZLPL2R3R.js.map +0 -1
  540. package/dist/chunk-ZTQ5SP4H.js +0 -9
  541. package/dist/chunk-ZTQ5SP4H.js.map +0 -1
  542. package/dist/controller-Bod8YYr1.d.cts +0 -172
  543. package/dist/controller-DxVchfiA.d.ts +0 -172
  544. package/dist/dev-log-events-CVAM29hx.d.cts +0 -123
  545. package/dist/dev-log-events-CVAM29hx.d.ts +0 -123
  546. package/dist/handshake-CC_LrK5g.d.cts +0 -31
  547. package/dist/handshake-CC_LrK5g.d.ts +0 -31
  548. package/dist/host-8hmq_Sgc.d.cts +0 -109
  549. package/dist/host-Cw-N6e-5.d.ts +0 -109
  550. package/dist/notices-CnGaaS8B.d.ts +0 -38
  551. package/dist/notices-NyDM5Mtz.d.cts +0 -38
  552. package/dist/realtime-client-Cu8yVJFw.d.cts +0 -15
  553. package/dist/realtime-client-Cu8yVJFw.d.ts +0 -15
  554. package/dist/sync-B6QsNrXz.d.cts +0 -125
  555. package/dist/sync-B6QsNrXz.d.ts +0 -125
  556. package/src/arcade/bridge.ts +0 -3
  557. package/src/arcade.ts +0 -4
  558. package/src/capabilities/manifest.ts +0 -71
  559. package/src/capabilities.ts +0 -12
  560. package/src/context/socket-manager.ts +0 -79
  561. package/src/events.ts +0 -124
  562. package/src/hooks/internal/use-runtime-control-contract.ts +0 -15
  563. package/src/hooks/internal/use-runtime-observability-contract.ts +0 -24
  564. package/src/hooks/use-connection-status.ts +0 -8
  565. package/src/hooks/use-controller-tick.ts +0 -65
  566. package/src/hooks/use-get-input.ts +0 -100
  567. package/src/hooks/use-host-arcade-restore.ts +0 -30
  568. package/src/hooks/use-host-tick.ts +0 -171
  569. package/src/hooks/use-input-writer.ts +0 -83
  570. package/src/hooks/use-players.ts +0 -12
  571. package/src/internal/input-manager.ts +0 -356
  572. package/src/protocol/errors.ts +0 -21
  573. package/src/protocol/host-grant.ts +0 -185
  574. package/src/protocol/host.ts +0 -138
  575. package/src/protocol/notices.ts +0 -43
  576. package/src/protocol/signals.ts +0 -38
  577. package/src/protocol/socket-events.ts +0 -154
  578. package/src/protocol/sync.ts +0 -121
  579. package/src/runtime/contracts/observability.ts +0 -94
  580. package/src/runtime/controller-bridge.ts +0 -451
  581. package/src/runtime/controller-realtime-client.ts +0 -591
  582. package/src/runtime/host-bridge.ts +0 -388
  583. package/src/runtime/host-realtime-client.ts +0 -550
  584. package/src/runtime/realtime-client.ts +0 -20
  585. package/src/runtime/validate-arcade-bridge-attach.ts +0 -14
  586. package/src/runtime-observability.ts +0 -9
  587. package/src/state/connection-store.ts +0 -152
  588. package/src/store/create-air-jam-store.ts +0 -1141
  589. package/src/store/index.ts +0 -1
  590. package/src/utils/ids.ts +0 -31
@@ -1,195 +0,0 @@
1
- // src/agent/agent-action.ts
2
- var createActionError = (meta, message) => new Error(
3
- `[${meta.contractKind ?? "action"}:${meta.gameId}.${meta.actionName}] ${message}`
4
- );
5
- var createAgentActionMetadata = (payload, options) => ({
6
- description: options?.description,
7
- payload: {
8
- ...payload,
9
- description: options?.payloadDescription ?? payload.description
10
- },
11
- resultDescription: options?.resultDescription
12
- });
13
- var defineAgentActionInput = (parse, metadata) => ({
14
- parse,
15
- metadata
16
- });
17
- var parseFiniteNumber = (payload, meta) => {
18
- const nextValue = typeof payload === "number" && Number.isFinite(payload) ? payload : typeof payload === "string" ? Number(payload) : Number.NaN;
19
- if (!Number.isFinite(nextValue)) {
20
- throw createActionError(meta, "expected a finite number payload");
21
- }
22
- return nextValue;
23
- };
24
- var parseStringValue = (payload, meta) => {
25
- if (typeof payload !== "string") {
26
- throw createActionError(meta, "expected a string payload");
27
- }
28
- return payload;
29
- };
30
- var parseBooleanValue = (payload, meta) => {
31
- if (typeof payload === "boolean") {
32
- return payload;
33
- }
34
- if (payload === "true" || payload === "1") {
35
- return true;
36
- }
37
- if (payload === "false" || payload === "0") {
38
- return false;
39
- }
40
- throw createActionError(meta, "expected a boolean payload");
41
- };
42
- var parseEnumValue = (values, payload, meta) => {
43
- if (typeof payload !== "string" || !values.includes(payload)) {
44
- throw createActionError(meta, `expected one of: ${values.join(", ")}`);
45
- }
46
- return payload;
47
- };
48
- var noneInput = (options) => defineAgentActionInput(
49
- () => void 0,
50
- createAgentActionMetadata({ kind: "none" }, options)
51
- );
52
- var numberInput = (options) => defineAgentActionInput(
53
- parseFiniteNumber,
54
- createAgentActionMetadata({ kind: "number" }, options)
55
- );
56
- var stringInput = (options) => defineAgentActionInput(
57
- parseStringValue,
58
- createAgentActionMetadata({ kind: "string" }, options)
59
- );
60
- var booleanInput = (options) => defineAgentActionInput(
61
- parseBooleanValue,
62
- createAgentActionMetadata({ kind: "boolean" }, options)
63
- );
64
- var enumInput = (values, options) => defineAgentActionInput(
65
- (payload, meta) => parseEnumValue(values, payload, meta),
66
- createAgentActionMetadata(
67
- {
68
- kind: "enum",
69
- allowedValues: [...values]
70
- },
71
- options
72
- )
73
- );
74
- var jsonInput = (options) => defineAgentActionInput(
75
- (payload) => payload,
76
- createAgentActionMetadata({ kind: "json" }, options)
77
- );
78
- function customInput(optionsOrParse, maybeParse) {
79
- if (typeof optionsOrParse === "function") {
80
- return defineAgentActionInput(
81
- optionsOrParse,
82
- createAgentActionMetadata({ kind: "json" })
83
- );
84
- }
85
- if (typeof maybeParse === "function") {
86
- return defineAgentActionInput(
87
- maybeParse,
88
- createAgentActionMetadata(
89
- {
90
- kind: optionsOrParse.payloadKind ?? "json",
91
- allowedValues: optionsOrParse.allowedValues
92
- },
93
- optionsOrParse
94
- )
95
- );
96
- }
97
- throw new Error("Invalid agent action input definition.");
98
- }
99
- var zodInput = (schema, options) => defineAgentActionInput(
100
- (payload, meta) => {
101
- const result = schema.safeParse(payload);
102
- if (result.success) {
103
- return result.data;
104
- }
105
- const firstIssue = result.error.issues[0];
106
- throw createActionError(
107
- meta,
108
- firstIssue?.message ?? "payload failed schema validation"
109
- );
110
- },
111
- createAgentActionMetadata({ kind: "json" }, options)
112
- );
113
- var agentActionInput = {
114
- none: noneInput,
115
- number: numberInput,
116
- string: stringInput,
117
- boolean: booleanInput,
118
- enum: enumInput,
119
- json: jsonInput,
120
- custom: customInput,
121
- zod: zodInput
122
- };
123
- var describeAgentActionInputs = (actions) => Object.entries(actions).map(([name, definition]) => {
124
- const metadata = definition.metadata;
125
- return {
126
- name,
127
- description: metadata?.description ?? null,
128
- payload: {
129
- kind: metadata?.payload.kind ?? "json",
130
- description: metadata?.payload.description ?? null,
131
- ...metadata?.payload.allowedValues ? {
132
- allowedValues: [...metadata.payload.allowedValues]
133
- } : {}
134
- },
135
- resultDescription: metadata?.resultDescription ?? null
136
- };
137
- }).sort((left, right) => left.name.localeCompare(right.name));
138
-
139
- // src/agent/agent-contract.ts
140
- var agentStore = () => ({});
141
- var defineAirJamAgentStores = (stores) => stores;
142
- var listAirJamAgentStoreDomains = (contract) => Object.keys(contract.stores);
143
- var describeAirJamAgentAction = (action) => ({
144
- description: action.description ?? action.input.metadata.description,
145
- payload: {
146
- ...action.input.metadata.payload
147
- },
148
- resultDescription: action.resultDescription ?? action.input.metadata.resultDescription
149
- });
150
- var resolveAirJamAgentActionPayload = (action, payload, meta) => {
151
- const parsedInput = action.input.parse(payload, meta);
152
- return action.toPayload ? action.toPayload(parsedInput) : parsedInput;
153
- };
154
- var agentAction = {
155
- participant: (target, options) => ({
156
- target: {
157
- kind: "participant",
158
- actionName: target.actionName,
159
- ...target.storeDomain ? { storeDomain: target.storeDomain } : {}
160
- },
161
- description: options.description,
162
- availability: options.availability,
163
- input: options.input,
164
- toPayload: options.toPayload,
165
- resultDescription: options.resultDescription
166
- }),
167
- host: (target, options) => ({
168
- target: {
169
- kind: "host",
170
- actionName: target.actionName,
171
- ...target.storeDomain ? { storeDomain: target.storeDomain } : {}
172
- },
173
- description: options.description,
174
- availability: options.availability,
175
- input: options.input,
176
- toPayload: options.toPayload,
177
- resultDescription: options.resultDescription
178
- })
179
- };
180
- var defineAirJamAgentContract = (contract) => contract;
181
-
182
- export {
183
- createAgentActionMetadata,
184
- defineAgentActionInput,
185
- agentActionInput,
186
- describeAgentActionInputs,
187
- agentStore,
188
- defineAirJamAgentStores,
189
- listAirJamAgentStoreDomains,
190
- describeAirJamAgentAction,
191
- resolveAirJamAgentActionPayload,
192
- agentAction,
193
- defineAirJamAgentContract
194
- };
195
- //# sourceMappingURL=chunk-TGRTEWYV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/agent/agent-action.ts","../src/agent/agent-contract.ts"],"sourcesContent":["import type { ZodType } from \"zod\";\n\nexport type AirJamAgentActionPayloadKind =\n | \"none\"\n | \"boolean\"\n | \"number\"\n | \"string\"\n | \"enum\"\n | \"json\";\n\nexport type AirJamAgentActionPayloadMetadata = {\n kind: AirJamAgentActionPayloadKind;\n description?: string;\n allowedValues?: string[];\n};\n\nexport type AirJamAgentActionMetadata = {\n description?: string;\n payload: AirJamAgentActionPayloadMetadata;\n resultDescription?: string;\n};\n\nexport type AirJamAgentActionDescriptor = {\n name: string;\n description: string | null;\n payload: {\n kind: AirJamAgentActionPayloadKind;\n description: string | null;\n allowedValues?: string[];\n };\n resultDescription: string | null;\n};\n\nexport type AirJamAgentActionParseMeta = {\n gameId: string;\n actionName: string;\n contractKind?: string;\n};\n\nexport type AirJamAgentActionInputDefinition<TPayload = unknown> = {\n parse: (payload: unknown, meta: AirJamAgentActionParseMeta) => TPayload;\n metadata: AirJamAgentActionMetadata;\n};\n\nexport type InferAirJamAgentActionInputPayload<TInput> =\n TInput extends AirJamAgentActionInputDefinition<infer TPayload>\n ? TPayload\n : never;\n\nexport type AirJamAgentActionOptions = {\n description?: string;\n payloadDescription?: string;\n resultDescription?: string;\n};\n\nexport type AirJamAgentActionCustomOptions = AirJamAgentActionOptions & {\n payloadKind?: AirJamAgentActionPayloadKind;\n allowedValues?: string[];\n};\n\nconst createActionError = (\n meta: AirJamAgentActionParseMeta,\n message: string,\n): Error =>\n new Error(\n `[${meta.contractKind ?? \"action\"}:${meta.gameId}.${meta.actionName}] ${message}`,\n );\n\nexport const createAgentActionMetadata = (\n payload: AirJamAgentActionPayloadMetadata,\n options?: AirJamAgentActionOptions,\n): AirJamAgentActionMetadata => ({\n description: options?.description,\n payload: {\n ...payload,\n description: options?.payloadDescription ?? payload.description,\n },\n resultDescription: options?.resultDescription,\n});\n\nexport const defineAgentActionInput = <TPayload>(\n parse: (payload: unknown, meta: AirJamAgentActionParseMeta) => TPayload,\n metadata: AirJamAgentActionMetadata,\n): AirJamAgentActionInputDefinition<TPayload> => ({\n parse,\n metadata,\n});\n\nconst parseFiniteNumber = (\n payload: unknown,\n meta: AirJamAgentActionParseMeta,\n): number => {\n const nextValue =\n typeof payload === \"number\" && Number.isFinite(payload)\n ? payload\n : typeof payload === \"string\"\n ? Number(payload)\n : Number.NaN;\n\n if (!Number.isFinite(nextValue)) {\n throw createActionError(meta, \"expected a finite number payload\");\n }\n\n return nextValue;\n};\n\nconst parseStringValue = (\n payload: unknown,\n meta: AirJamAgentActionParseMeta,\n): string => {\n if (typeof payload !== \"string\") {\n throw createActionError(meta, \"expected a string payload\");\n }\n\n return payload;\n};\n\nconst parseBooleanValue = (\n payload: unknown,\n meta: AirJamAgentActionParseMeta,\n): boolean => {\n if (typeof payload === \"boolean\") {\n return payload;\n }\n\n if (payload === \"true\" || payload === \"1\") {\n return true;\n }\n\n if (payload === \"false\" || payload === \"0\") {\n return false;\n }\n\n throw createActionError(meta, \"expected a boolean payload\");\n};\n\nconst parseEnumValue = <const TValues extends readonly string[]>(\n values: TValues,\n payload: unknown,\n meta: AirJamAgentActionParseMeta,\n): TValues[number] => {\n if (typeof payload !== \"string\" || !values.includes(payload)) {\n throw createActionError(meta, `expected one of: ${values.join(\", \")}`);\n }\n\n return payload as TValues[number];\n};\n\ntype AirJamAgentActionCustomParser<TPayload> = (\n payload: unknown,\n meta: AirJamAgentActionParseMeta,\n) => TPayload;\n\ntype AirJamAgentActionZodSchema<TPayload> = ZodType<TPayload>;\n\nconst noneInput = (\n options?: AirJamAgentActionOptions,\n): AirJamAgentActionInputDefinition<void> =>\n defineAgentActionInput(\n () => undefined,\n createAgentActionMetadata({ kind: \"none\" }, options),\n );\n\nconst numberInput = (\n options?: AirJamAgentActionOptions,\n): AirJamAgentActionInputDefinition<number> =>\n defineAgentActionInput(\n parseFiniteNumber,\n createAgentActionMetadata({ kind: \"number\" }, options),\n );\n\nconst stringInput = (\n options?: AirJamAgentActionOptions,\n): AirJamAgentActionInputDefinition<string> =>\n defineAgentActionInput(\n parseStringValue,\n createAgentActionMetadata({ kind: \"string\" }, options),\n );\n\nconst booleanInput = (\n options?: AirJamAgentActionOptions,\n): AirJamAgentActionInputDefinition<boolean> =>\n defineAgentActionInput(\n parseBooleanValue,\n createAgentActionMetadata({ kind: \"boolean\" }, options),\n );\n\nconst enumInput = <const TValues extends readonly string[]>(\n values: TValues,\n options?: AirJamAgentActionOptions,\n): AirJamAgentActionInputDefinition<TValues[number]> =>\n defineAgentActionInput(\n (payload, meta) => parseEnumValue(values, payload, meta),\n createAgentActionMetadata(\n {\n kind: \"enum\",\n allowedValues: [...values],\n },\n options,\n ),\n );\n\nconst jsonInput = (\n options?: AirJamAgentActionOptions,\n): AirJamAgentActionInputDefinition<unknown> =>\n defineAgentActionInput(\n (payload) => payload,\n createAgentActionMetadata({ kind: \"json\" }, options),\n );\n\nfunction customInput<TPayload>(\n parse: AirJamAgentActionCustomParser<TPayload>,\n): AirJamAgentActionInputDefinition<TPayload>;\nfunction customInput<TPayload>(\n options: AirJamAgentActionCustomOptions,\n parse: AirJamAgentActionCustomParser<TPayload>,\n): AirJamAgentActionInputDefinition<TPayload>;\nfunction customInput<TPayload>(\n optionsOrParse:\n | AirJamAgentActionCustomOptions\n | AirJamAgentActionCustomParser<TPayload>,\n maybeParse?: AirJamAgentActionCustomParser<TPayload>,\n): AirJamAgentActionInputDefinition<TPayload> {\n if (typeof optionsOrParse === \"function\") {\n return defineAgentActionInput(\n optionsOrParse,\n createAgentActionMetadata({ kind: \"json\" }),\n );\n }\n\n if (typeof maybeParse === \"function\") {\n return defineAgentActionInput(\n maybeParse,\n createAgentActionMetadata(\n {\n kind: optionsOrParse.payloadKind ?? \"json\",\n allowedValues: optionsOrParse.allowedValues,\n },\n optionsOrParse,\n ),\n );\n }\n\n throw new Error(\"Invalid agent action input definition.\");\n}\n\nconst zodInput = <TPayload>(\n schema: AirJamAgentActionZodSchema<TPayload>,\n options?: AirJamAgentActionOptions,\n): AirJamAgentActionInputDefinition<TPayload> =>\n defineAgentActionInput(\n (payload, meta) => {\n const result = schema.safeParse(payload);\n if (result.success) {\n return result.data;\n }\n\n const firstIssue = result.error.issues[0];\n throw createActionError(\n meta,\n firstIssue?.message ?? \"payload failed schema validation\",\n );\n },\n createAgentActionMetadata({ kind: \"json\" }, options),\n );\n\nexport const agentActionInput = {\n none: noneInput,\n number: numberInput,\n string: stringInput,\n boolean: booleanInput,\n enum: enumInput,\n json: jsonInput,\n custom: customInput,\n zod: zodInput,\n};\n\nexport const describeAgentActionInputs = <\n TActions extends Record<\n string,\n { metadata?: AirJamAgentActionMetadata | undefined }\n >,\n>(\n actions: TActions,\n): AirJamAgentActionDescriptor[] =>\n Object.entries(actions)\n .map(([name, definition]) => {\n const metadata = definition.metadata;\n return {\n name,\n description: metadata?.description ?? null,\n payload: {\n kind: metadata?.payload.kind ?? \"json\",\n description: metadata?.payload.description ?? null,\n ...(metadata?.payload.allowedValues\n ? {\n allowedValues: [...metadata.payload.allowedValues],\n }\n : {}),\n },\n resultDescription: metadata?.resultDescription ?? null,\n };\n })\n .sort((left, right) => left.name.localeCompare(right.name));\n","import {\n type AirJamAgentActionInputDefinition,\n type AirJamAgentActionMetadata,\n type AirJamAgentActionOptions,\n type AirJamAgentActionParseMeta,\n type AirJamAgentActionPayloadKind,\n type AirJamAgentActionPayloadMetadata,\n} from \"./agent-action.js\";\n\nexport type AirJamAgentJsonObject = Record<string, unknown>;\n\nexport type AirJamAgentContractPayloadKind = AirJamAgentActionPayloadKind;\n\nexport type AirJamAgentContractPayloadMetadata =\n AirJamAgentActionPayloadMetadata;\n\nexport type AirJamAgentStoreDeclaration<TStore extends object = object> = {\n readonly __store?: TStore;\n};\n\nexport type AirJamAgentStoreDeclarations = Record<\n string,\n AirJamAgentStoreDeclaration<object>\n>;\n\nexport type AirJamAgentActionTarget = {\n kind: \"participant\" | \"host\";\n actionName: string;\n storeDomain?: string;\n};\n\nexport type AirJamAgentStores = Record<string, object>;\n\nexport type InferAirJamAgentStores<\n TDeclarations extends AirJamAgentStoreDeclarations,\n> = {\n [TKey in keyof TDeclarations]: TDeclarations[TKey] extends AirJamAgentStoreDeclaration<\n infer TStore\n >\n ? TStore\n : never;\n};\n\ntype AirJamAgentActionContractBase = {\n target: AirJamAgentActionTarget;\n description?: string;\n availability?: string;\n /**\n * Human and agent-facing description of the expected semantic effect.\n * This does not automatically become runtime result data; return\n * `acceptAirJamAction(result)` from the underlying store action when callers\n * need an actual result payload.\n */\n resultDescription?: string;\n};\n\nexport type AirJamAgentResolvedActionContract<\n TInput = unknown,\n TPayload = TInput,\n> = AirJamAgentActionContractBase & {\n input: AirJamAgentActionInputDefinition<TInput>;\n toPayload?: (input: TInput) => TPayload;\n};\n\n// Existential wildcard for heterogenous action contracts.\n/* eslint-disable @typescript-eslint/no-explicit-any -- These aliases intentionally erase generic action and store shapes at contract boundaries. */\nexport type AirJamAgentActionContract = AirJamAgentResolvedActionContract<\n any,\n any\n>;\n\n// Existential wildcard for published agent contracts with arbitrary snapshot/store shapes.\nexport type AnyAirJamAgentContract = AirJamAgentContract<any, any>;\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\nexport type AirJamAgentContractActionOptions<\n TInput,\n TPayload = TInput,\n> = AirJamAgentActionOptions & {\n availability?: string;\n input: AirJamAgentActionInputDefinition<TInput>;\n toPayload?: (input: TInput) => TPayload;\n};\n\nexport type AirJamAgentSnapshotContext<\n TStores extends AirJamAgentStores = AirJamAgentStores,\n> = {\n controllerId: string | null;\n stores: Partial<TStores>;\n};\n\nexport type AirJamAgentContract<\n TSnapshot extends AirJamAgentJsonObject = AirJamAgentJsonObject,\n TStoreDeclarations extends AirJamAgentStoreDeclarations =\n AirJamAgentStoreDeclarations,\n> = {\n stores: TStoreDeclarations;\n snapshotDescription?: string;\n projectSnapshot: (\n context: AirJamAgentSnapshotContext<\n InferAirJamAgentStores<TStoreDeclarations>\n >,\n ) => TSnapshot | Promise<TSnapshot>;\n actions: Record<string, AirJamAgentActionContract>;\n};\n\nexport const agentStore = <\n TStore extends object,\n>(): AirJamAgentStoreDeclaration<TStore> =>\n ({}) as AirJamAgentStoreDeclaration<TStore>;\n\nexport const defineAirJamAgentStores = <\n TDeclarations extends AirJamAgentStoreDeclarations,\n>(\n stores: TDeclarations,\n): TDeclarations => stores;\n\nexport const listAirJamAgentStoreDomains = (\n contract: AnyAirJamAgentContract,\n): string[] => Object.keys(contract.stores);\n\nexport const describeAirJamAgentAction = (\n action: AirJamAgentActionContract,\n): AirJamAgentActionMetadata => ({\n description: action.description ?? action.input.metadata.description,\n payload: {\n ...action.input.metadata.payload,\n },\n resultDescription:\n action.resultDescription ?? action.input.metadata.resultDescription,\n});\n\nexport const resolveAirJamAgentActionPayload = (\n action: AirJamAgentActionContract,\n payload: unknown,\n meta: AirJamAgentActionParseMeta,\n): unknown => {\n const parsedInput = action.input.parse(payload, meta);\n return action.toPayload ? action.toPayload(parsedInput) : parsedInput;\n};\n\nexport const agentAction = {\n participant: <TInput, TPayload = TInput>(\n target: Omit<AirJamAgentActionTarget, \"kind\">,\n options: AirJamAgentContractActionOptions<TInput, TPayload>,\n ): AirJamAgentResolvedActionContract<TInput, TPayload> => ({\n target: {\n kind: \"participant\",\n actionName: target.actionName,\n ...(target.storeDomain ? { storeDomain: target.storeDomain } : {}),\n },\n description: options.description,\n availability: options.availability,\n input: options.input,\n toPayload: options.toPayload,\n resultDescription: options.resultDescription,\n }),\n host: <TInput, TPayload = TInput>(\n target: Omit<AirJamAgentActionTarget, \"kind\">,\n options: AirJamAgentContractActionOptions<TInput, TPayload>,\n ): AirJamAgentResolvedActionContract<TInput, TPayload> => ({\n target: {\n kind: \"host\",\n actionName: target.actionName,\n ...(target.storeDomain ? { storeDomain: target.storeDomain } : {}),\n },\n description: options.description,\n availability: options.availability,\n input: options.input,\n toPayload: options.toPayload,\n resultDescription: options.resultDescription,\n }),\n};\n\nexport const defineAirJamAgentContract = <\n TSnapshot extends AirJamAgentJsonObject,\n TStoreDeclarations extends AirJamAgentStoreDeclarations,\n>(\n contract: AirJamAgentContract<TSnapshot, TStoreDeclarations>,\n): AirJamAgentContract<TSnapshot, TStoreDeclarations> => contract;\n"],"mappings":";AA4DA,IAAM,oBAAoB,CACxB,MACA,YAEA,IAAI;AAAA,EACF,IAAI,KAAK,gBAAgB,QAAQ,IAAI,KAAK,MAAM,IAAI,KAAK,UAAU,KAAK,OAAO;AACjF;AAEK,IAAM,4BAA4B,CACvC,SACA,aAC+B;AAAA,EAC/B,aAAa,SAAS;AAAA,EACtB,SAAS;AAAA,IACP,GAAG;AAAA,IACH,aAAa,SAAS,sBAAsB,QAAQ;AAAA,EACtD;AAAA,EACA,mBAAmB,SAAS;AAC9B;AAEO,IAAM,yBAAyB,CACpC,OACA,cACgD;AAAA,EAChD;AAAA,EACA;AACF;AAEA,IAAM,oBAAoB,CACxB,SACA,SACW;AACX,QAAM,YACJ,OAAO,YAAY,YAAY,OAAO,SAAS,OAAO,IAClD,UACA,OAAO,YAAY,WACjB,OAAO,OAAO,IACd,OAAO;AAEf,MAAI,CAAC,OAAO,SAAS,SAAS,GAAG;AAC/B,UAAM,kBAAkB,MAAM,kCAAkC;AAAA,EAClE;AAEA,SAAO;AACT;AAEA,IAAM,mBAAmB,CACvB,SACA,SACW;AACX,MAAI,OAAO,YAAY,UAAU;AAC/B,UAAM,kBAA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AAM,4BAA4B,CAIvC,aACuD;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/runtime-topology.ts"],"sourcesContent":["export type RuntimeMode =\n | \"standalone-dev\"\n | \"standalone-secure\"\n | \"arcade-live\"\n | \"arcade-built\"\n | \"self-hosted-production\"\n | \"hosted-release\";\n\nexport type SurfaceRole =\n | \"host\"\n | \"controller\"\n | \"platform-host\"\n | \"platform-controller\";\n\nexport type ProxyStrategy = \"none\" | \"platform-proxy\" | \"dev-proxy\";\n\nexport interface RuntimeTopologyInput {\n runtimeMode: RuntimeMode;\n surfaceRole: SurfaceRole;\n appOrigin: string;\n backendOrigin: string;\n socketOrigin?: string;\n publicHost?: string;\n assetBasePath?: string;\n secureTransport?: boolean;\n embedded?: boolean;\n embedParentOrigin?: string;\n proxyStrategy?: ProxyStrategy;\n}\n\nexport interface ProjectRuntimeTopologyInput {\n runtimeMode?:\n | \"standalone-dev\"\n | \"standalone-secure\"\n | \"self-hosted-production\"\n | \"hosted-release\";\n surfaceRole: Extract<SurfaceRole, \"host\" | \"controller\">;\n appOrigin: string;\n backendOrigin?: string;\n socketOrigin?: string;\n publicHost?: string;\n assetBasePath?: string;\n secureTransport?: boolean;\n embedded?: boolean;\n embedParentOrigin?: string;\n proxyStrategy?: Extract<ProxyStrategy, \"none\" | \"dev-proxy\">;\n}\n\nexport interface ResolvedAirJamRuntimeTopology {\n runtimeMode: RuntimeMode;\n surfaceRole: SurfaceRole;\n appOrigin: string;\n backendOrigin: string;\n socketOrigin: string;\n publicHost: string;\n assetBasePath: string;\n secureTransport: boolean;\n embedded: boolean;\n embedParentOrigin?: string;\n proxyStrategy: ProxyStrategy;\n}\n\nconst RUNTIME_MODES = new Set<RuntimeMode>([\n \"standalone-dev\",\n \"standalone-secure\",\n \"arcade-live\",\n \"arcade-built\",\n \"self-hosted-production\",\n \"hosted-release\",\n]);\n\nconst SURFACE_ROLES = new Set<SurfaceRole>([\n \"host\",\n \"controller\",\n \"platform-host\",\n \"platform-controller\",\n]);\n\nconst PROXY_STRATEGIES = new Set<ProxyStrategy>([\n \"none\",\n \"platform-proxy\",\n \"dev-proxy\",\n]);\n\nconst PROJECT_RUNTIME_MODES = new Set<\n NonNullable<ProjectRuntimeTopologyInput[\"runtimeMode\"]>\n>([\n \"standalone-dev\",\n \"standalone-secure\",\n \"self-hosted-production\",\n \"hosted-release\",\n]);\n\nconst LOCAL_DEV_CONTROL_SURFACE_RUNTIME_MODES = new Set<RuntimeMode>([\n \"standalone-dev\",\n \"standalone-secure\",\n \"arcade-live\",\n \"arcade-built\",\n]);\n\nexport const AIR_JAM_RUNTIME_TOPOLOGY_ENV_KEYS = [\n \"VITE_AIR_JAM_RUNTIME_TOPOLOGY\",\n \"NEXT_PUBLIC_AIR_JAM_RUNTIME_TOPOLOGY\",\n \"AIR_JAM_RUNTIME_TOPOLOGY\",\n];\n\nexport const AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX = \"aj_topology_\";\nexport const AIR_JAM_RUNTIME_TOPOLOGY_WINDOW_KEY =\n \"__AIR_JAM_RUNTIME_TOPOLOGY__\";\n\nconst REQUIRED_QUERY_KEYS = [\n \"runtime_mode\",\n \"surface_role\",\n \"app_origin\",\n \"backend_origin\",\n \"public_host\",\n \"asset_base_path\",\n \"secure_transport\",\n \"embedded\",\n \"proxy_strategy\",\n] as const;\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === \"object\" && !Array.isArray(value);\n\nconst assertString = (value: unknown, fieldName: string): string => {\n if (typeof value !== \"string\") {\n throw new Error(`Runtime topology field \"${fieldName}\" must be a string.`);\n }\n\n const normalized = value.trim();\n if (!normalized) {\n throw new Error(`Runtime topology field \"${fieldName}\" cannot be empty.`);\n }\n\n return normalized;\n};\n\nconst assertBoolean = (value: unknown, fieldName: string): boolean => {\n if (typeof value !== \"boolean\") {\n throw new Error(`Runtime topology field \"${fieldName}\" must be a boolean.`);\n }\n\n return value;\n};\n\nconst assertUrl = (value: unknown, fieldName: string): string => {\n const normalized = assertString(value, fieldName);\n const withScheme = normalized.includes(\"://\")\n ? normalized\n : `http://${normalized}`;\n\n let parsed: URL;\n try {\n parsed = new URL(withScheme);\n } catch {\n throw new Error(\n `Runtime topology field \"${fieldName}\" must be a valid absolute URL.`,\n );\n }\n\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n throw new Error(\n `Runtime topology field \"${fieldName}\" must use http or https.`,\n );\n }\n\n parsed.pathname = \"\";\n parsed.search = \"\";\n parsed.hash = \"\";\n return parsed.origin;\n};\n\nconst normalizeAssetBasePath = (value: unknown): string => {\n if (value == null) {\n return \"/\";\n }\n\n const normalized = assertString(value, \"assetBasePath\");\n if (normalized === \"/\") {\n return normalized;\n }\n\n const withLeadingSlash = normalized.startsWith(\"/\")\n ? normalized\n : `/${normalized}`;\n\n return withLeadingSlash.endsWith(\"/\") && withLeadingSlash.length > 1\n ? withLeadingSlash.slice(0, -1)\n : withLeadingSlash;\n};\n\nconst toBooleanParam = (value: boolean): string => (value ? \"true\" : \"false\");\n\nconst fromBooleanParam = (value: string | null, fieldName: string): boolean => {\n if (value === \"true\") {\n return true;\n }\n\n if (value === \"false\") {\n return false;\n }\n\n throw new Error(\n `Runtime topology query field \"${fieldName}\" must be \"true\" or \"false\".`,\n );\n};\n\nconst resolveDefaultSocketOrigin = ({\n proxyStrategy,\n appOrigin,\n backendOrigin,\n}: {\n proxyStrategy: ProxyStrategy;\n appOrigin: string;\n backendOrigin: string;\n}): string => {\n if (proxyStrategy === \"none\") {\n return backendOrigin;\n }\n\n return appOrigin;\n};\n\nconst inferSecureTransport = ({\n runtimeMode,\n appOrigin,\n backendOrigin,\n socketOrigin,\n publicHost,\n}: {\n runtimeMode: RuntimeMode;\n appOrigin: string;\n backendOrigin: string;\n socketOrigin: string;\n publicHost: string;\n}): boolean => {\n if (runtimeMode === \"standalone-secure\") {\n return true;\n }\n\n return [appOrigin, backendOrigin, socketOrigin, publicHost].every((origin) =>\n origin.startsWith(\"https://\"),\n );\n};\n\nexport const resolveRuntimeTopology = (\n input: RuntimeTopologyInput,\n): ResolvedAirJamRuntimeTopology => {\n if (!isObject(input)) {\n throw new Error(\"Runtime topology input must be an object.\");\n }\n\n const runtimeMode = assertString(\n input.runtimeMode,\n \"runtimeMode\",\n ) as RuntimeMode;\n if (!RUNTIME_MODES.has(runtimeMode)) {\n throw new Error(\n `Unsupported runtime mode \"${runtimeMode}\". Use one of: ${Array.from(RUNTIME_MODES).join(\", \")}.`,\n );\n }\n\n const surfaceRole = assertString(\n input.surfaceRole,\n \"surfaceRole\",\n ) as SurfaceRole;\n if (!SURFACE_ROLES.has(surfaceRole)) {\n throw new Error(\n `Unsupported surface role \"${surfaceRole}\". Use one of: ${Array.from(SURFACE_ROLES).join(\", \")}.`,\n );\n }\n\n const appOrigin = assertUrl(input.appOrigin, \"appOrigin\");\n const backendOrigin = assertUrl(input.backendOrigin, \"backendOrigin\");\n\n const proxyStrategy =\n input.proxyStrategy == null\n ? \"none\"\n : (assertString(input.proxyStrategy, \"proxyStrategy\") as ProxyStrategy);\n if (!PROXY_STRATEGIES.has(proxyStrategy)) {\n throw new Error(\n `Unsupported proxy strategy \"${proxyStrategy}\". Use one of: ${Array.from(PROXY_STRATEGIES).join(\", \")}.`,\n );\n }\n\n const socketOrigin =\n input.socketOrigin != null\n ? assertUrl(input.socketOrigin, \"socketOrigin\")\n : resolveDefaultSocketOrigin({ proxyStrategy, appOrigin, backendOrigin });\n const publicHost =\n input.publicHost != null\n ? assertUrl(input.publicHost, \"publicHost\")\n : appOrigin;\n const assetBasePath = normalizeAssetBasePath(input.assetBasePath);\n const embedded =\n input.embedded == null ? false : assertBoolean(input.embedded, \"embedded\");\n const embedParentOrigin =\n input.embedParentOrigin == null\n ? undefined\n : assertUrl(input.embedParentOrigin, \"embedParentOrigin\");\n\n if (embedded && !embedParentOrigin) {\n throw new Error(\n 'Embedded runtimes must provide \"embedParentOrigin\" in their topology.',\n );\n }\n\n if (!embedded && embedParentOrigin) {\n throw new Error(\n 'Non-embedded runtimes cannot provide \"embedParentOrigin\" in their topology.',\n );\n }\n\n const secureTransport =\n input.secureTransport == null\n ? inferSecureTransport({\n runtimeMode,\n appOrigin,\n backendOrigin,\n socketOrigin,\n publicHost,\n })\n : assertBoolean(input.secureTransport, \"secureTransport\");\n\n return {\n runtimeMode,\n surfaceRole,\n appOrigin,\n backendOrigin,\n socketOrigin,\n publicHost,\n assetBasePath,\n secureTransport,\n embedded,\n ...(embedParentOrigin ? { embedParentOrigin } : {}),\n proxyStrategy,\n };\n};\n\nexport const resolveProjectRuntimeTopology = (\n input: ProjectRuntimeTopologyInput,\n): ResolvedAirJamRuntimeTopology => {\n if (!isObject(input)) {\n throw new Error(\"Project runtime topology input must be an object.\");\n }\n\n const requestedRuntimeMode =\n input.runtimeMode == null\n ? input.secureTransport\n ? \"standalone-secure\"\n : \"standalone-dev\"\n : (assertString(input.runtimeMode, \"runtimeMode\") as NonNullable<\n ProjectRuntimeTopologyInput[\"runtimeMode\"]\n >);\n\n if (!PROJECT_RUNTIME_MODES.has(requestedRuntimeMode)) {\n throw new Error(\n `Unsupported project runtime mode \"${requestedRuntimeMode}\". Use one of: ${Array.from(PROJECT_RUNTIME_MODES).join(\", \")}.`,\n );\n }\n\n const proxyStrategy =\n input.proxyStrategy ??\n (requestedRuntimeMode === \"standalone-dev\" ||\n requestedRuntimeMode === \"standalone-secure\"\n ? \"dev-proxy\"\n : \"none\");\n\n const appOrigin = assertUrl(input.appOrigin, \"appOrigin\");\n const backendOrigin =\n input.backendOrigin != null\n ? assertUrl(input.backendOrigin, \"backendOrigin\")\n : appOrigin;\n const publicHost =\n input.publicHost != null\n ? assertUrl(input.publicHost, \"publicHost\")\n : appOrigin;\n\n return resolveRuntimeTopology({\n runtimeMode: requestedRuntimeMode,\n surfaceRole: input.surfaceRole,\n appOrigin,\n backendOrigin,\n publicHost,\n assetBasePath: input.assetBasePath,\n secureTransport: input.secureTransport,\n embedded: input.embedded,\n embedParentOrigin: input.embedParentOrigin,\n proxyStrategy,\n ...(input.socketOrigin ? { socketOrigin: input.socketOrigin } : {}),\n });\n};\n\nexport const isLocalDevControlSurfaceRuntimeMode = (\n runtimeMode: RuntimeMode,\n): boolean =>\n LOCAL_DEV_CONTROL_SURFACE_RUNTIME_MODES.has(\n assertString(runtimeMode, \"runtimeMode\") as RuntimeMode,\n );\n\nexport const isLocalDevControlSurfaceTopology = ({\n runtimeMode,\n}: Pick<ResolvedAirJamRuntimeTopology, \"runtimeMode\">): boolean =>\n isLocalDevControlSurfaceRuntimeMode(runtimeMode);\n\nexport const serializeRuntimeTopology = (\n topology: RuntimeTopologyInput | ResolvedAirJamRuntimeTopology,\n): string => JSON.stringify(resolveRuntimeTopology(topology));\n\nexport const parseRuntimeTopology = (\n serialized: string,\n): ResolvedAirJamRuntimeTopology => {\n const normalized = assertString(\n serialized,\n \"serialized runtime topology\",\n );\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(normalized);\n } catch {\n throw new Error(\"Runtime topology must be valid JSON.\");\n }\n\n return resolveRuntimeTopology(parsed as RuntimeTopologyInput);\n};\n\nexport const readRuntimeTopologyFromEnv = (\n env: Record<string, string | undefined> = process.env,\n): ResolvedAirJamRuntimeTopology | null => {\n for (const key of AIR_JAM_RUNTIME_TOPOLOGY_ENV_KEYS) {\n const candidate = env?.[key];\n if (typeof candidate === \"string\" && candidate.trim().length > 0) {\n return parseRuntimeTopology(candidate);\n }\n }\n\n return null;\n};\n\nexport const readRuntimeTopologyFromWindow = (\n target:\n | Record<string, unknown>\n | { [AIR_JAM_RUNTIME_TOPOLOGY_WINDOW_KEY]?: unknown }\n | undefined = (globalThis as typeof globalThis & {\n window?: { [AIR_JAM_RUNTIME_TOPOLOGY_WINDOW_KEY]?: unknown };\n }).window,\n): ResolvedAirJamRuntimeTopology | null => {\n if (!target || typeof target !== \"object\") {\n return null;\n }\n\n const candidate = target[AIR_JAM_RUNTIME_TOPOLOGY_WINDOW_KEY];\n if (typeof candidate === \"string\" && candidate.trim().length > 0) {\n return parseRuntimeTopology(candidate);\n }\n\n if (isObject(candidate)) {\n return resolveRuntimeTopology(candidate as unknown as RuntimeTopologyInput);\n }\n\n return null;\n};\n\nexport const runtimeTopologyToQueryParams = (\n topology: RuntimeTopologyInput | ResolvedAirJamRuntimeTopology,\n): Record<string, string> => {\n const resolved = resolveRuntimeTopology(topology);\n\n return {\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}runtime_mode`]:\n resolved.runtimeMode,\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}surface_role`]:\n resolved.surfaceRole,\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}app_origin`]:\n resolved.appOrigin,\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}backend_origin`]:\n resolved.backendOrigin,\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}socket_origin`]:\n resolved.socketOrigin,\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}public_host`]:\n resolved.publicHost,\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}asset_base_path`]:\n resolved.assetBasePath,\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}secure_transport`]:\n toBooleanParam(resolved.secureTransport),\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}embedded`]: toBooleanParam(\n resolved.embedded,\n ),\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}proxy_strategy`]:\n resolved.proxyStrategy,\n ...(resolved.embedParentOrigin\n ? {\n [`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}embed_parent_origin`]:\n resolved.embedParentOrigin,\n }\n : {}),\n };\n};\n\nexport const parseRuntimeTopologyFromSearchParams = (\n params: URLSearchParams,\n): ResolvedAirJamRuntimeTopology | null => {\n if (!(params instanceof URLSearchParams)) {\n throw new Error(\n \"Runtime topology search param reader expects URLSearchParams.\",\n );\n }\n\n const hasAnyTopologyParam = REQUIRED_QUERY_KEYS.some((key) =>\n params.has(`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}${key}`),\n );\n if (!hasAnyTopologyParam) {\n return null;\n }\n\n const missing = REQUIRED_QUERY_KEYS.filter(\n (key) =>\n !params.has(`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}${key}`),\n );\n if (missing.length > 0) {\n throw new Error(\n `Runtime topology search params are incomplete. Missing: ${missing.join(\", \")}.`,\n );\n }\n\n const embedParentOrigin = params.get(\n `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}embed_parent_origin`,\n );\n\n return resolveRuntimeTopology({\n runtimeMode: params.get(\n `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}runtime_mode`,\n ) as RuntimeMode,\n surfaceRole: params.get(\n `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}surface_role`,\n ) as SurfaceRole,\n appOrigin: params.get(\n `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}app_origin`,\n ) as string,\n backendOrigin: params.get(\n `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}backend_origin`,\n ) as string,\n socketOrigin: params.get(\n `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}socket_origin`,\n ) as string,\n publicHost: params.get(\n `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}public_host`,\n ) as string,\n assetBasePath: params.get(\n `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}asset_base_path`,\n ) as string,\n secureTransport: fromBooleanParam(\n params.get(\n `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}secure_transport`,\n ),\n \"secure_transport\",\n ),\n embedded: fromBooleanParam(\n params.get(`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}embedded`),\n \"embedded\",\n ),\n proxyStrategy: params.get(\n `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}proxy_strategy`,\n ) as ProxyStrategy,\n ...(embedParentOrigin ? { embedParentOrigin } : {}),\n });\n};\n"],"mappings":";AA8DA,IAAM,gBAAgB,oBAAI,IAAiB;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,gBAAgB,oBAAI,IAAiB;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,mBAAmB,oBAAI,IAAmB;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,wBAAwB,oBAAI,IAEhC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,0CAA0C,oBAAI,IAAiB;AAAA,EACnE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,oCAAoC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,8CAA8C;AACpD,IAAM,sCACX;AAEF,IAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,WAAW,CAAC,UAChB,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAErE,IAAM,eAAe,CAAC,OAAgB,cAA8B;AAClE,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,IAAI,MAAM,2BAA2B,SAAS,qBAAqB;AAAA,EAC3E;AAEA,QAAM,aAAa,MAAM,KAAK;AAC9B,MAAI,C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CAAC;AACH;","names":[]}
@@ -1,11 +0,0 @@
1
- // src/constants.ts
2
- var DEFAULT_SERVER_PORT = 4e3;
3
- var CONTROLLER_PATH = "/controller";
4
- var DEFAULT_MAX_PLAYERS = 8;
5
-
6
- export {
7
- DEFAULT_SERVER_PORT,
8
- CONTROLLER_PATH,
9
- DEFAULT_MAX_PLAYERS
10
- };
11
- //# sourceMappingURL=chunk-W2VK36RO.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Core Air Jam constants used across the SDK\n */\n\n/**\n * Default server port for Air Jam server\n */\nexport const DEFAULT_SERVER_PORT = 4000;\n\n/**\n * Standard path for controller endpoints.\n * All Air Jam games use this convention - controller is always at {baseUrl}/controller\n */\nexport const CONTROLLER_PATH = \"/controller\";\n\n/**\n * Input debounce time in milliseconds\n * Used to prevent rapid input events from overwhelming the system\n */\nexport const INPUT_DEBOUNCE_MS = 200;\n\n/**\n * Toggle debounce time in milliseconds\n * Used for game state toggles to prevent accidental double-toggles\n */\nexport const TOGGLE_DEBOUNCE_MS = 300;\n\n/**\n * Socket.IO configuration\n */\nexport const SOCKET_CONFIG = {\n /**\n * Ping interval in milliseconds\n */\n PING_INTERVAL: 2000,\n\n /**\n * Ping timeout in milliseconds\n */\n PING_TIMEOUT: 5000,\n} as const;\n\n/**\n * Maximum players allowed in a room by default\n */\nexport const DEFAULT_MAX_PLAYERS = 8;\n"],"mappings":";AAOO,IAAM,sBAAsB;AAM5B,IAAM,kBAAkB;AAgCxB,IAAM,sBAAsB;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/runtime/arcade-surface-identity.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Minimum Arcade surface identity for embedded runtime bridge attach (see docs/systems/arcade-surface-contract.md).\n */\nexport const arcadeSurfaceRuntimeIdentitySchema = z\n .object({\n epoch: z.number().int().nonnegative(),\n kind: z.enum([\"browser\", \"game\"]),\n gameId: z.string().nullable(),\n })\n .strict();\n\nexport type ArcadeSurfaceRuntimeIdentity = z.infer<\n typeof arcadeSurfaceRuntimeIdentitySchema\n>;\n"],"mappings":";AAAA,SAAS,SAAS;AAKX,IAAM,qCAAqC,EAC/C,OAAO;AAAA,EACN,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY;AAAA,EACpC,MAAM,EAAE,KAAK,CAAC,WAAW,MAAM,CAAC;AAAA,EAChC,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC9B,CAAC,EACA,OAAO;","names":[]}
@@ -1,230 +0,0 @@
1
- import {
2
- CONTROLLER_PATH,
3
- DEFAULT_SERVER_PORT
4
- } from "./chunk-W2VK36RO.js";
5
-
6
- // src/utils/network-ip.ts
7
- var isVirtualNetwork = (ip) => {
8
- if (ip.startsWith("192.168.64.") || ip.startsWith("192.168.65.")) {
9
- return true;
10
- }
11
- if (ip.startsWith("172.17.")) {
12
- return true;
13
- }
14
- if (ip.startsWith("172.18.") || ip.startsWith("172.19.")) {
15
- return true;
16
- }
17
- if (ip.startsWith("169.254.")) {
18
- return true;
19
- }
20
- return false;
21
- };
22
- var scoreIp = (ip) => {
23
- if (ip.startsWith("192.168.")) {
24
- const parts = ip.split(".");
25
- const thirdOctet = parseInt(parts[2] || "0", 10);
26
- if (thirdOctet < 64) {
27
- return 100 - thirdOctet;
28
- }
29
- return 10;
30
- }
31
- if (ip.startsWith("10.")) {
32
- return 50;
33
- }
34
- if (/^172\.(1[6-9]|2[0-9]|3[01])\./.test(ip)) {
35
- return 30;
36
- }
37
- return 0;
38
- };
39
- var getLocalNetworkIp = () => {
40
- return new Promise((resolve) => {
41
- if (typeof window === "undefined" || typeof RTCPeerConnection === "undefined") {
42
- resolve(null);
43
- return;
44
- }
45
- const pc = new RTCPeerConnection({
46
- iceServers: [{ urls: "stun:stun.l.google.com:19302" }]
47
- });
48
- const candidates = [];
49
- let candidateGatheringComplete = false;
50
- const resolveOnce = (ip) => {
51
- pc.close();
52
- resolve(ip);
53
- };
54
- const timeout = setTimeout(() => {
55
- if (candidateGatheringComplete) {
56
- pickBestCandidate();
57
- } else {
58
- setTimeout(() => {
59
- pickBestCandidate();
60
- }, 500);
61
- }
62
- }, 3e3);
63
- const pickBestCandidate = () => {
64
- if (candidates.length === 0) {
65
- resolveOnce(null);
66
- return;
67
- }
68
- candidates.sort((a, b) => b.score - a.score);
69
- const best = candidates[0];
70
- clearTimeout(timeout);
71
- resolveOnce(best.ip);
72
- };
73
- pc.onicecandidate = (event) => {
74
- if (event.candidate) {
75
- const candidate = event.candidate.candidate;
76
- const match = candidate.match(/([0-9]{1,3}(\.[0-9]{1,3}){3})/);
77
- if (match) {
78
- const ip = match[1];
79
- if (ip === "127.0.0.1") {
80
- return;
81
- }
82
- const isPrivate = ip.startsWith("192.168.") || ip.startsWith("10.") || /^172\.(1[6-9]|2[0-9]|3[01])\./.test(ip);
83
- if (isPrivate && !isVirtualNetwork(ip)) {
84
- const score = scoreIp(ip);
85
- candidates.push({ ip, score });
86
- }
87
- }
88
- } else {
89
- candidateGatheringComplete = true;
90
- setTimeout(() => {
91
- pickBestCandidate();
92
- }, 200);
93
- }
94
- };
95
- pc.createDataChannel("");
96
- pc.createOffer().then((offer) => pc.setLocalDescription(offer)).catch(() => {
97
- clearTimeout(timeout);
98
- resolveOnce(null);
99
- });
100
- });
101
- };
102
-
103
- // src/utils/url-builder.ts
104
- var UrlBuilder = class {
105
- cachedLocalIp = null;
106
- ipDetectionPromise = null;
107
- /**
108
- * Get the local network IP address with caching.
109
- * First call triggers detection, subsequent calls return cached value.
110
- */
111
- async getLocalIp() {
112
- if (this.cachedLocalIp !== null) {
113
- return this.cachedLocalIp;
114
- }
115
- if (this.ipDetectionPromise !== null) {
116
- return this.ipDetectionPromise;
117
- }
118
- this.ipDetectionPromise = getLocalNetworkIp().then((ip) => {
119
- this.cachedLocalIp = ip;
120
- this.ipDetectionPromise = null;
121
- return ip;
122
- });
123
- return this.ipDetectionPromise;
124
- }
125
- /**
126
- * Clear the cached IP address.
127
- * Useful for testing or when network changes are detected.
128
- */
129
- clearCache() {
130
- this.cachedLocalIp = null;
131
- this.ipDetectionPromise = null;
132
- }
133
- /**
134
- * Normalize a URL for mobile access.
135
- * Replaces localhost with the local network IP.
136
- */
137
- async normalizeForMobile(url) {
138
- if (typeof window === "undefined") return url;
139
- try {
140
- const urlObj = new URL(url);
141
- if (urlObj.hostname === "localhost" || urlObj.hostname === "127.0.0.1") {
142
- const localIp = await this.getLocalIp();
143
- if (localIp) {
144
- urlObj.hostname = localIp;
145
- return urlObj.toString();
146
- }
147
- urlObj.hostname = window.location.hostname;
148
- return urlObj.toString();
149
- }
150
- return url;
151
- } catch {
152
- return url;
153
- }
154
- }
155
- /**
156
- * Build a controller URL with room code.
157
- * Controller is always at {baseUrl}/controller (standardized convention).
158
- * Automatically uses local IP when running on localhost.
159
- */
160
- async buildControllerUrl(roomId, options) {
161
- const path = CONTROLLER_PATH;
162
- if (options?.host) {
163
- const url2 = new URL(path, this.normalizeOrigin(options.host));
164
- url2.searchParams.set("room", roomId);
165
- if (options.capabilityToken) {
166
- url2.searchParams.set("aj_controller_cap", options.capabilityToken);
167
- }
168
- return url2.toString();
169
- }
170
- let base;
171
- if (typeof window === "undefined") {
172
- base = `http://localhost:${DEFAULT_SERVER_PORT}`;
173
- } else {
174
- const currentUrl = new URL(window.location.href);
175
- if (!this.isLocalhost(currentUrl.hostname)) {
176
- base = currentUrl.origin;
177
- } else {
178
- const localIp = await this.getLocalIp();
179
- if (localIp) {
180
- const port = currentUrl.port;
181
- base = port ? `http://${localIp}:${port}` : `http://${localIp}`;
182
- } else {
183
- base = currentUrl.origin;
184
- }
185
- }
186
- }
187
- const url = new URL(path, base);
188
- url.searchParams.set("room", roomId);
189
- if (options?.capabilityToken) {
190
- url.searchParams.set("aj_controller_cap", options.capabilityToken);
191
- }
192
- return url.toString();
193
- }
194
- /**
195
- * Resolve the server URL.
196
- * Uses explicit URL if provided, otherwise infers from window location.
197
- */
198
- resolveServerUrl(explicit) {
199
- if (explicit) {
200
- return this.normalizeOrigin(explicit);
201
- }
202
- if (typeof window !== "undefined") {
203
- const url = new URL(window.location.href);
204
- url.port = String(DEFAULT_SERVER_PORT);
205
- return url.origin;
206
- }
207
- return `http://localhost:${DEFAULT_SERVER_PORT}`;
208
- }
209
- /**
210
- * Check if a hostname is localhost.
211
- */
212
- isLocalhost(hostname) {
213
- return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]";
214
- }
215
- /**
216
- * Normalize an origin string to ensure it has a protocol.
217
- */
218
- normalizeOrigin(origin) {
219
- if (!origin.includes("://")) {
220
- return `http://${origin}`;
221
- }
222
- return origin;
223
- }
224
- };
225
- var urlBuilder = new UrlBuilder();
226
-
227
- export {
228
- urlBuilder
229
- };
230
- //# sourceMappingURL=chunk-YXHH3MQT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/network-ip.ts","../src/utils/url-builder.ts"],"sourcesContent":["/**\n * Checks if an IP is from a virtual network interface (Docker, VMs, etc.)\n */\nconst isVirtualNetwork = (ip: string): boolean => {\n // Docker Desktop on Mac uses 192.168.64.x and 192.168.65.x\n if (ip.startsWith(\"192.168.64.\") || ip.startsWith(\"192.168.65.\")) {\n return true;\n }\n // Docker default bridge network\n if (ip.startsWith(\"172.17.\")) {\n return true;\n }\n // Other common virtual network ranges\n if (ip.startsWith(\"172.18.\") || ip.startsWith(\"172.19.\")) {\n return true;\n }\n // Link-local addresses\n if (ip.startsWith(\"169.254.\")) {\n return true;\n }\n return false;\n};\n\n/**\n * Scores an IP address to determine preference.\n * Higher score = more preferred.\n */\nconst scoreIp = (ip: string): number => {\n // Prefer 192.168.0.x - 192.168.63.x (common home network ranges, excluding virtual networks)\n if (ip.startsWith(\"192.168.\")) {\n const parts = ip.split(\".\");\n const thirdOctet = parseInt(parts[2] || \"0\", 10);\n // Prefer lower third octets (0-63) as they're more likely to be real networks\n if (thirdOctet < 64) {\n return 100 - thirdOctet; // Higher score for lower numbers\n }\n // 64+ are often virtual, but we'll still consider them if nothing else\n return 10;\n }\n // Prefer 10.x.x.x networks\n if (ip.startsWith(\"10.\")) {\n return 50;\n }\n // 172.16-31.x.x networks (but not 172.17.x.x which is Docker)\n if (/^172\\.(1[6-9]|2[0-9]|3[01])\\./.test(ip)) {\n return 30;\n }\n return 0;\n};\n\n/**\n * Gets the local network IP address using WebRTC.\n * Filters out virtual network interfaces and prefers real network IPs.\n * Returns null if unable to determine the IP.\n */\nexport const getLocalNetworkIp = (): Promise<string | null> => {\n return new Promise((resolve) => {\n // If not in browser, return null\n if (\n typeof window === \"undefined\" ||\n typeof RTCPeerConnection === \"undefined\"\n ) {\n resolve(null);\n return;\n }\n\n const pc = new RTCPeerConnection({\n iceServers: [{ urls: \"stun:stun.l.google.com:19302\" }],\n });\n\n const candidates: Array<{ ip: string; score: number }> = [];\n let candidateGatheringComplete = false;\n\n const resolveOnce = (ip: string | null) => {\n pc.close();\n resolve(ip);\n };\n\n // Timeout after 3 seconds\n const timeout = setTimeout(() => {\n if (candidateGatheringComplete) {\n pickBestCandidate();\n } else {\n // Wait a bit more for candidates to arrive\n setTimeout(() => {\n pickBestCandidate();\n }, 500);\n }\n }, 3000);\n\n const pickBestCandidate = () => {\n if (candidates.length === 0) {\n resolveOnce(null);\n return;\n }\n\n // Sort by score (highest first), then pick the best one\n candidates.sort((a, b) => b.score - a.score);\n const best = candidates[0];\n clearTimeout(timeout);\n resolveOnce(best.ip);\n };\n\n pc.onicecandidate = (event) => {\n if (event.candidate) {\n const candidate = event.candidate.candidate;\n const match = candidate.match(/([0-9]{1,3}(\\.[0-9]{1,3}){3})/);\n if (match) {\n const ip = match[1];\n // Filter out localhost\n if (ip === \"127.0.0.1\") {\n return;\n }\n\n // Check if it's a private network IP\n const isPrivate =\n ip.startsWith(\"192.168.\") ||\n ip.startsWith(\"10.\") ||\n /^172\\.(1[6-9]|2[0-9]|3[01])\\./.test(ip);\n\n if (isPrivate && !isVirtualNetwork(ip)) {\n const score = scoreIp(ip);\n candidates.push({ ip, score });\n }\n }\n } else {\n // No more candidates - gathering is complete\n candidateGatheringComplete = true;\n // Give it a moment for any last candidates to arrive, then pick the best\n setTimeout(() => {\n pickBestCandidate();\n }, 200);\n }\n };\n\n // Create a data channel to trigger candidate gathering\n pc.createDataChannel(\"\");\n pc.createOffer()\n .then((offer) => pc.setLocalDescription(offer))\n .catch(() => {\n clearTimeout(timeout);\n resolveOnce(null);\n });\n });\n};\n","import { CONTROLLER_PATH, DEFAULT_SERVER_PORT } from \"../constants\";\nimport type { RoomCode } from \"../protocol\";\nimport { getLocalNetworkIp } from \"./network-ip\";\n\n/**\n * Centralized URL builder service for Air Jam.\n * Handles IP detection, URL normalization, and construction of all URL types.\n */\nclass UrlBuilder {\n private cachedLocalIp: string | null = null;\n private ipDetectionPromise: Promise<string | null> | null = null;\n\n /**\n * Get the local network IP address with caching.\n * First call triggers detection, subsequent calls return cached value.\n */\n async getLocalIp(): Promise<string | null> {\n // Return cached value if available\n if (this.cachedLocalIp !== null) {\n return this.cachedLocalIp;\n }\n\n // If detection is already in progress, wait for it\n if (this.ipDetectionPromise !== null) {\n return this.ipDetectionPromise;\n }\n\n // Start IP detection\n this.ipDetectionPromise = getLocalNetworkIp().then((ip) => {\n this.cachedLocalIp = ip;\n this.ipDetectionPromise = null;\n return ip;\n });\n\n return this.ipDetectionPromise;\n }\n\n /**\n * Clear the cached IP address.\n * Useful for testing or when network changes are detected.\n */\n clearCache(): void {\n this.cachedLocalIp = null;\n this.ipDetectionPromise = null;\n }\n\n /**\n * Normalize a URL for mobile access.\n * Replaces localhost with the local network IP.\n */\n async normalizeForMobile(url: string): Promise<string> {\n if (typeof window === \"undefined\") return url;\n\n try {\n const urlObj = new URL(url);\n\n // If URL uses localhost, replace with local network IP\n if (urlObj.hostname === \"localhost\" || urlObj.hostname === \"127.0.0.1\") {\n const localIp = await this.getLocalIp();\n\n if (localIp) {\n urlObj.hostname = localIp;\n return urlObj.toString();\n }\n\n // Fallback to current hostname if IP detection fails\n urlObj.hostname = window.location.hostname;\n return urlObj.toString();\n }\n\n return url;\n } catch {\n return url;\n }\n }\n\n /**\n * Build a controller URL with room code.\n * Controller is always at {baseUrl}/controller (standardized convention).\n * Automatically uses local IP when running on localhost.\n */\n async buildControllerUrl(\n roomId: RoomCode,\n options?: {\n host?: string;\n capabilityToken?: string;\n },\n ): Promise<string> {\n const path = CONTROLLER_PATH;\n\n // If explicit host is provided, use it\n if (options?.host) {\n const url = new URL(path, this.normalizeOrigin(options.host));\n url.searchParams.set(\"room\", roomId);\n if (options.capabilityToken) {\n url.searchParams.set(\"aj_controller_cap\", options.capabilityToken);\n }\n return url.toString();\n }\n\n // Determine base URL\n let base: string;\n if (typeof window === \"undefined\") {\n base = `http://localhost:${DEFAULT_SERVER_PORT}`;\n } else {\n const currentUrl = new URL(window.location.href);\n\n // If not localhost, use the current origin\n if (!this.isLocalhost(currentUrl.hostname)) {\n base = currentUrl.origin;\n } else {\n // If localhost, try to get the local network IP\n const localIp = await this.getLocalIp();\n if (localIp) {\n // Preserve the port from the current URL\n const port = currentUrl.port;\n base = port ? `http://${localIp}:${port}` : `http://${localIp}`;\n } else {\n // Fallback to localhost if we can't determine the IP\n base = currentUrl.origin;\n }\n }\n }\n\n const url = new URL(path, base);\n url.searchParams.set(\"room\", roomId);\n if (options?.capabilityToken) {\n url.searchParams.set(\"aj_controller_cap\", options.capabilityToken);\n }\n return url.toString();\n }\n\n /**\n * Resolve the server URL.\n * Uses explicit URL if provided, otherwise infers from window location.\n */\n resolveServerUrl(explicit?: string): string {\n if (explicit) {\n return this.normalizeOrigin(explicit);\n }\n\n if (typeof window !== \"undefined\") {\n const url = new URL(window.location.href);\n url.port = String(DEFAULT_SERVER_PORT);\n return url.origin;\n }\n\n return `http://localhost:${DEFAULT_SERVER_PORT}`;\n }\n\n /**\n * Check if a hostname is localhost.\n */\n private isLocalhost(hostname: string): boolean {\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"[::1]\"\n );\n }\n\n /**\n * Normalize an origin string to ensure it has a protocol.\n */\n private normalizeOrigin(origin: string): string {\n if (!origin.includes(\"://\")) {\n return `http://${origin}`;\n }\n return origin;\n }\n}\n\n// Export singleton instance\nexport const urlBuilder = new UrlBuilder();\n\n// Export class for testing/advanced usage\nexport { UrlBuilder };\n"],"mappings":";;;;;;AAGA,IAAM,mBAAmB,CAAC,OAAwB;AAEhD,MAAI,GAAG,WAAW,aAAa,KAAK,GAAG,WAAW,aAAa,GAAG;AAChE,WAAO;AAAA,EACT;AAEA,MAAI,GAAG,WAAW,SAAS,GAAG;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,GAAG,WAAW,SAAS,KAAK,GAAG,WAAW,SAAS,GAAG;AACxD,WAAO;AAAA,EACT;AAEA,MAAI,GAAG,WAAW,UAAU,GAAG;AAC7B,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAMA,IAAM,UAAU,CAAC,OAAuB;AAEtC,MAAI,GAAG,WAAW,UAAU,GAAG;AAC7B,UAAM,QAAQ,GAAG,MAAM,GAAG;AAC1B,UAAM,aAAa,SAAS,MAAM,CAAC,KAAK,KAAK,EAAE;AAE/C,QAAI,aAAa,IAAI;AACnB,aAAO,MAAM;AAAA,IACf;AAEA,WAAO;AAAA,EACT;AAEA,MAAI,GAAG,WAAW,KAAK,GAAG;AACxB,WAAO;AAAA,EACT;AAEA,MAAI,gCAAgC,KAAK,EAAE,GAAG;AAC5C,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAOO,IAAM,oBAAoB,MAA8B;AAC7D,SAAO,IAAI,QAAQ,CAAC,YAAY;AAE9B,QACE,OAAO,WAAW,eAClB,OAAO,sBAAsB,aAC7B;AACA,cAAQ,IAAI;AACZ;AAAA,IACF;AAEA,UAAM,KAAK,IAAI,kBAAkB;AAAA,MAC/B,YAAY,CAAC,EAAE,MAAM,+BAA+B,CAAC;AAAA,IACvD,CAAC;AAED,UAAM,aAAmD,CAAC;AAC1D,QAAI,6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A,IACzB;AACA,WAAO;AAAA,EACT;AACF;AAGO,IAAM,aAAa,IAAI,WAAW;","names":["url"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/settings/platform-settings.ts"],"sourcesContent":["export type PlatformSettingsPersistence = \"local\" | \"none\";\n\nexport interface PlatformAudioSettings {\n masterVolume: number;\n musicVolume: number;\n sfxVolume: number;\n}\n\nexport interface PlatformAccessibilitySettings {\n reducedMotion: boolean;\n highContrast: boolean;\n}\n\nexport interface PlatformFeedbackSettings {\n hapticsEnabled: boolean;\n}\n\nexport interface PlatformPreviewControllerSettings {\n activeOpacity: number;\n}\n\nexport interface PlatformSettings {\n audio: PlatformAudioSettings;\n accessibility: PlatformAccessibilitySettings;\n feedback: PlatformFeedbackSettings;\n previewControllers: PlatformPreviewControllerSettings;\n}\n\nexport type PlatformSettingsSnapshot = PlatformSettings;\nexport interface RoomPlatformSettingsSnapshot {\n audio: PlatformAudioSettings;\n previewControllers: PlatformPreviewControllerSettings;\n}\n\nexport interface PartialRoomPlatformSettingsPatch {\n audio?: Partial<PlatformAudioSettings>;\n previewControllers?: Partial<PlatformPreviewControllerSettings>;\n}\n\nexport const PLATFORM_SETTINGS_STORAGE_KEY = \"air-jam-platform-settings\";\nexport const LEGACY_AUDIO_SETTINGS_STORAGE_KEY = \"air-jam-volume-settings\";\n\nexport const DEFAULT_PLATFORM_SETTINGS: PlatformSettingsSnapshot = {\n audio: {\n masterVolume: 1,\n musicVolume: 0.8,\n sfxVolume: 1,\n },\n accessibility: {\n reducedMotion: false,\n highContrast: false,\n },\n feedback: {\n hapticsEnabled: true,\n },\n previewControllers: {\n activeOpacity: 1,\n },\n};\n\nexport const DEFAULT_ROOM_PLATFORM_SETTINGS: RoomPlatformSettingsSnapshot = {\n audio: DEFAULT_PLATFORM_SETTINGS.audio,\n previewControllers: DEFAULT_PLATFORM_SETTINGS.previewControllers,\n};\n\ntype PartialPlatformAudioSettings = Partial<PlatformAudioSettings>;\ntype PartialPlatformAccessibilitySettings =\n Partial<PlatformAccessibilitySettings>;\ntype PartialPlatformFeedbackSettings = Partial<PlatformFeedbackSettings>;\ntype PartialPlatformPreviewControllerSettings =\n Partial<PlatformPreviewControllerSettings>;\n\nexport interface PartialPlatformSettings {\n audio?: PartialPlatformAudioSettings;\n accessibility?: PartialPlatformAccessibilitySettings;\n feedback?: PartialPlatformFeedbackSettings;\n previewControllers?: PartialPlatformPreviewControllerSettings;\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst clamp01 = (value: number): number => Math.max(0, Math.min(1, value));\n\nconst normalizeBoolean = (value: unknown, fallback: boolean): boolean =>\n typeof value === \"boolean\" ? value : fallback;\n\nconst normalizeAudioSettings = (\n value: unknown,\n fallback: PlatformAudioSettings,\n): PlatformAudioSettings => {\n if (!isRecord(value)) {\n return fallback;\n }\n\n return {\n masterVolume:\n typeof value.masterVolume === \"number\"\n ? clamp01(value.masterVolume)\n : fallback.masterVolume,\n musicVolume:\n typeof value.musicVolume === \"number\"\n ? clamp01(value.musicVolume)\n : fallback.musicVolume,\n sfxVolume:\n typeof value.sfxVolume === \"number\"\n ? clamp01(value.sfxVolume)\n : fallback.sfxVolume,\n };\n};\n\nconst normalizePreviewControllerSettings = (\n value: unknown,\n fallback: PlatformPreviewControllerSettings,\n): PlatformPreviewControllerSettings => {\n if (!isRecord(value)) {\n return fallback;\n }\n\n return {\n activeOpacity:\n typeof value.activeOpacity === \"number\"\n ? clamp01(value.activeOpacity)\n : fallback.activeOpacity,\n };\n};\n\nexport const normalizePlatformSettings = (\n value: unknown,\n): PlatformSettingsSnapshot => {\n if (!isRecord(value)) {\n return DEFAULT_PLATFORM_SETTINGS;\n }\n\n return {\n audio: normalizeAudioSettings(value.audio, DEFAULT_PLATFORM_SETTINGS.audio),\n accessibility: {\n reducedMotion: normalizeBoolean(\n isRecord(value.accessibility)\n ? value.accessibility.reducedMotion\n : null,\n DEFAULT_PLATFORM_SETTINGS.accessibility.reducedMotion,\n ),\n highContrast: normalizeBoolean(\n isRecord(value.accessibility) ? value.accessibility.highContrast : null,\n DEFAULT_PLATFORM_SETTINGS.accessibility.highContrast,\n ),\n },\n feedback: {\n hapticsEnabled: normalizeBoolean(\n isRecord(value.feedback) ? value.feedback.hapticsEnabled : null,\n DEFAULT_PLATFORM_SETTINGS.feedback.hapticsEnabled,\n ),\n },\n previewControllers: normalizePreviewControllerSettings(\n value.previewControllers,\n DEFAULT_PLATFORM_SETTINGS.previewControllers,\n ),\n };\n};\n\nexport const mergePlatformSettings = (\n current: PlatformSettingsSnapshot,\n patch: PartialPlatformSettings,\n): PlatformSettingsSnapshot =>\n normalizePlatformSettings({\n audio: { ...current.audio, ...patch.audio },\n accessibility: {\n ...current.accessibility,\n ...patch.accessibility,\n },\n feedback: { ...current.feedback, ...patch.feedback },\n previewControllers: {\n ...current.previewControllers,\n ...patch.previewControllers,\n },\n });\n\nexport const getEffectiveAudioVolume = (\n settings: PlatformAudioSettings,\n category: \"music\" | \"sfx\",\n): number => {\n const categoryVolume =\n category === \"music\" ? settings.musicVolume : settings.sfxVolume;\n return clamp01(settings.masterVolume) * clamp01(categoryVolume);\n};\n\nexport const toRoomPlatformSettingsSnapshot = (\n settings: PlatformSettingsSnapshot,\n): RoomPlatformSettingsSnapshot => ({\n audio: settings.audio,\n previewControllers: settings.previewControllers,\n});\n\nexport const mergeRoomPlatformSettingsSnapshot = (\n current: RoomPlatformSettingsSnapshot,\n patch: PartialRoomPlatformSettingsPatch,\n): RoomPlatformSettingsSnapshot => ({\n audio: normalizeAudioSettings(\n { ...current.audio, ...patch.audio },\n current.audio,\n ),\n previewControllers: normalizePreviewControllerSettings(\n {\n ...current.previewControllers,\n ...patch.previewControllers,\n },\n current.previewControllers,\n ),\n});\n\nconst tryParseJson = (raw: string | null): unknown => {\n if (!raw) {\n return null;\n }\n\n try {\n return JSON.parse(raw) as unknown;\n } catch {\n return null;\n }\n};\n\nconst readLegacyAudioSettings = (): PlatformSettingsSnapshot | null => {\n const parsed = tryParseJson(\n window.localStorage.getItem(LEGACY_AUDIO_SETTINGS_STORAGE_KEY),\n );\n\n if (!isRecord(parsed)) {\n return null;\n }\n\n return normalizePlatformSettings({\n ...DEFAULT_PLATFORM_SETTINGS,\n audio: {\n masterVolume: parsed.masterVolume,\n musicVolume: parsed.musicVolume,\n sfxVolume: parsed.sfxVolume,\n },\n });\n};\n\nexport const readPersistedPlatformSettings = (): PlatformSettingsSnapshot => {\n if (typeof window === \"undefined\") {\n return DEFAULT_PLATFORM_SETTINGS;\n }\n\n const current = tryParseJson(\n window.localStorage.getItem(PLATFORM_SETTINGS_STORAGE_KEY),\n );\n if (current) {\n return normalizePlatformSettings(current);\n }\n\n const migrated = readLegacyAudioSettings();\n if (!migrated) {\n return DEFAULT_PLATFORM_SETTINGS;\n }\n\n try {\n window.localStorage.setItem(\n PLATFORM_SETTINGS_STORAGE_KEY,\n JSON.stringify(migrated),\n );\n window.localStorage.removeItem(LEGACY_AUDIO_SETTINGS_STORAGE_KEY);\n } catch {\n // Best-effort only.\n }\n\n return migrated;\n};\n\nexport const persistPlatformSettings = (\n snapshot: PlatformSettingsSnapshot,\n): void => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n try {\n window.localStorage.setItem(\n PLATFORM_SETTINGS_STORAGE_KEY,\n JSON.stringify(snapshot),\n );\n } catch {\n // Ignore storage failures.\n }\n};\n"],"mappings":";AAuCO,IAAM,gCAAgC;AACtC,IAAM,oCAAoC;AAE1C,IAAM,4BAAsD;AAAA,EACjE,OAAO;AAAA,IACL,cAAc;AAAA,IACd,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AAAA,EACA,eAAe;AAAA,IACb,eAAe;AAAA,IACf,cAAc;AAAA,EAChB;AAAA,EACA,UAAU;AAAA,IACR,gBAAgB;AAAA,EAClB;AAAA,EACA,oBAAoB;AAAA,IAClB,eAAe;AAAA,EACjB;AACF;AAEO,IAAM,iCAA+D;AAAA,EAC1E,OAAO,0BAA0B;A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AAAA,IACb,OAAO,aAAa,QAAQ,iCAAiC;AAAA,EAC/D;AAEA,MAAI,CAAC,SAAS,MAAM,GAAG;AACrB,WAAO;AAAA,EACT;AAEA,SAAO,0BAA0B;AAAA,IAC/B,GAAG;AAAA,IACH,OAAO;AAAA,MACL,cAAc,OAAO;AAAA,MACrB,aAAa,OAAO;AAAA,MACpB,WAAW,OAAO;AAAA,IACpB;AAAA,EACF,CAAC;AACH;AAEO,IAAM,gCAAgC,MAAgC;AAC3E,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO;AAAA,EACT;AAEA,QAAM,UAAU;AAAA,IACd,OAAO,aAAa,QAAQ,6BAA6B;AAAA,EAC3D;AACA,MAAI,SAAS;AACX,WAAO,0BAA0B,OAAO;AAAA,EAC1C;AAEA,QAAM,WAAW,wBAAwB;AACzC,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,MAAI;AACF,WAAO,aAAa;AAAA,MAClB;AAAA,MACA,KAAK,UAAU,QAAQ;AAAA,IACzB;AACA,WAAO,aAAa,WAAW,iCAAiC;AAAA,EAClE,QAAQ;AAAA,EAER;AAEA,SAAO;AACT;AAEO,IAAM,0BAA0B,CACrC,aACS;AACT,MAAI,OAAO,WAAW,aAAa;AACjC;AAAA,EACF;AAEA,MAAI;AACF,WAAO,aAAa;AAAA,MAClB;AAAA,MACA,KAAK,UAAU,QAAQ;AAAA,IACzB;AAAA,EACF,QAAQ;AAAA,EAER;AACF;","names":[]}
@@ -1,9 +0,0 @@
1
- // src/runtime/arcade-bridge-request-surface.ts
2
- var isArcadeSurfaceMismatch = (active, request) => {
3
- return request.epoch !== active.epoch || request.kind !== active.kind || request.gameId !== active.gameId;
4
- };
5
-
6
- export {
7
- isArcadeSurfaceMismatch
8
- };
9
- //# sourceMappingURL=chunk-ZTQ5SP4H.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/runtime/arcade-bridge-request-surface.ts"],"sourcesContent":["import type { ArcadeSurfaceRuntimeIdentity } from \"./arcade-surface-identity\";\n\n/**\n * Returns true when the iframe surface identity does not match the parent's active surface.\n */\nexport const isArcadeSurfaceMismatch = (\n active: ArcadeSurfaceRuntimeIdentity,\n request: ArcadeSurfaceRuntimeIdentity,\n): boolean => {\n return (\n request.epoch !== active.epoch ||\n request.kind !== active.kind ||\n request.gameId !== active.gameId\n );\n};\n"],"mappings":";AAKO,IAAM,0BAA0B,CACrC,QACA,YACY;AACZ,SACE,QAAQ,UAAU,OAAO,SACzB,QAAQ,SAAS,OAAO,QACxB,QAAQ,WAAW,OAAO;AAE9B;","names":[]}