@auraindustry/aurajs 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/README.md +103 -7
  2. package/benchmarks/perf-thresholds.json +54 -0
  3. package/package.json +4 -7
  4. package/src/asset-pack.mjs +5 -1
  5. package/src/authored-project.mjs +1449 -0
  6. package/src/authored-runtime.mjs +2016 -0
  7. package/src/authoring/avatar-animation-graph.mjs +648 -0
  8. package/src/bin-integrity.mjs +272 -0
  9. package/src/build-contract/assets.mjs +130 -0
  10. package/src/build-contract/capabilities.mjs +116 -0
  11. package/src/build-contract/constants.mjs +6 -0
  12. package/src/build-contract/helpers.mjs +44 -0
  13. package/src/build-contract/web-templates.mjs +5993 -0
  14. package/src/build-contract.mjs +27 -2910
  15. package/src/bundler.mjs +188 -55
  16. package/src/cli.mjs +4825 -1512
  17. package/src/commands/project-authoring.mjs +434 -0
  18. package/src/config.mjs +27 -0
  19. package/src/conformance/cases/app-and-ui-runtime-cases.mjs +3309 -0
  20. package/src/conformance/cases/core-runtime-cases.mjs +1431 -0
  21. package/src/conformance/cases/index.mjs +11 -0
  22. package/src/conformance/cases/scene3d-and-media-cases.mjs +2094 -0
  23. package/src/conformance/cases/systems-and-gameplay-cases.mjs +1776 -0
  24. package/src/conformance/shared.mjs +27 -0
  25. package/src/conformance-runner.mjs +25 -13
  26. package/src/conformance.mjs +619 -4020
  27. package/src/cutscene.mjs +362 -5
  28. package/src/dev-cli-action.mjs +249 -0
  29. package/src/dev-cli-inspect.mjs +92 -0
  30. package/src/dev-cli-state.mjs +80 -0
  31. package/src/external-asset-cache.mjs +587 -0
  32. package/src/external-asset-policy.mjs +217 -0
  33. package/src/external-package-surface.mjs +206 -0
  34. package/src/game-action-runtime.mjs +869 -0
  35. package/src/game-state-runtime.mjs +206 -6
  36. package/src/headless-action.mjs +186 -0
  37. package/src/headless-test/runtime-animation.mjs +1173 -0
  38. package/src/headless-test/runtime-coordinator.mjs +1514 -0
  39. package/src/headless-test/runtime-primitives.mjs +320 -0
  40. package/src/headless-test/runtime-world.mjs +2253 -0
  41. package/src/headless-test.mjs +392 -4298
  42. package/src/host-binary.mjs +342 -14
  43. package/src/icon-discovery.mjs +64 -0
  44. package/src/make-catalog.mjs +109 -0
  45. package/src/make.mjs +197 -0
  46. package/src/package-integrity.mjs +586 -0
  47. package/src/perf-benchmark.mjs +353 -0
  48. package/src/postinstall.mjs +5 -5
  49. package/src/prefabs/index.mjs +34 -0
  50. package/src/prefabs/scene-serialization.mjs +184 -0
  51. package/src/project-importer.mjs +620 -0
  52. package/src/project-registry.mjs +24 -0
  53. package/src/publish-command.mjs +195 -0
  54. package/src/publish-env-example.mjs +83 -0
  55. package/src/publish-validation.mjs +708 -0
  56. package/src/retro/assets/compile.mjs +232 -0
  57. package/src/retro/backend-gba/authoring.mjs +1029 -0
  58. package/src/retro/backend-gba/rom.mjs +363 -0
  59. package/src/retro/backend-gbc/rom.mjs +85 -0
  60. package/src/retro/build.mjs +278 -0
  61. package/src/retro/cli/commands.mjs +292 -0
  62. package/src/retro/cli/templates.mjs +84 -0
  63. package/src/retro/diagnostics/catalog.mjs +110 -0
  64. package/src/retro/diagnostics/emit.mjs +72 -0
  65. package/src/retro/emulator/case-overlay.mjs +64 -0
  66. package/src/retro/emulator/discovery.mjs +158 -0
  67. package/src/retro/emulator/macos-case-overlay.swift +220 -0
  68. package/src/retro/emulator/profiles.mjs +146 -0
  69. package/src/retro/emulator/runner.mjs +289 -0
  70. package/src/retro/frontend/load-project.mjs +98 -0
  71. package/src/retro/index.mjs +30 -0
  72. package/src/retro/ir/build-ir.mjs +108 -0
  73. package/src/retro/runtime-gba/contract.mjs +151 -0
  74. package/src/retro/runtime-gbc/contract.mjs +117 -0
  75. package/src/retro/shared/span.mjs +26 -0
  76. package/src/retro/shared/targets.mjs +64 -0
  77. package/src/retro/validator/check-project.mjs +114 -0
  78. package/src/runtime-hotspot-audit.mjs +707 -0
  79. package/src/scaffold/config.mjs +1000 -0
  80. package/src/scaffold/fs.mjs +56 -0
  81. package/src/scaffold/layout.mjs +318 -0
  82. package/src/scaffold/project-docs.mjs +438 -0
  83. package/src/scaffold.mjs +93 -596
  84. package/src/scene-composition/index.mjs +326 -0
  85. package/src/scene-composition/runtime.mjs +751 -0
  86. package/src/self-hosted-assets.mjs +604 -0
  87. package/src/session-client.mjs +750 -0
  88. package/src/session-native-launcher.mjs +74 -0
  89. package/src/session-protocol.mjs +75 -0
  90. package/src/session-runtime.mjs +321 -0
  91. package/src/session-server.mjs +360 -0
  92. package/src/shader-kits/index.mjs +773 -0
  93. package/src/starter-content-registry.mjs +292 -0
  94. package/src/state-artifacts.mjs +662 -24
  95. package/src/state-dev-reload.mjs +99 -2
  96. package/src/terminal-ui.mjs +245 -0
  97. package/src/web-conformance.mjs +219 -0
  98. package/templates/create/2d/config/gameplay/shooter.config.js +26 -0
  99. package/templates/create/2d/content/gameplay/waves.json +26 -0
  100. package/templates/create/2d/content/registries/.gitkeep +1 -0
  101. package/templates/create/2d/docs/design/.gitkeep +1 -0
  102. package/templates/create/2d/docs/design/loop.md +5 -0
  103. package/templates/create/2d/prefabs/enemies.prefab.js +90 -0
  104. package/templates/create/2d/prefabs/enemy-basic.prefab.js +18 -0
  105. package/templates/create/2d/prefabs/player.prefab.js +36 -0
  106. package/templates/create/2d/prefabs/projectiles.prefab.js +35 -0
  107. package/templates/create/2d/scenes/boot.scene.js +12 -0
  108. package/templates/create/2d/scenes/gameplay.scene.js +230 -0
  109. package/templates/create/2d/scenes/menu.scene.js +9 -0
  110. package/templates/create/2d/src/main.js +6 -185
  111. package/templates/create/2d/src/runtime/app.js +49 -0
  112. package/templates/create/2d/src/runtime/capabilities.js +35 -0
  113. package/templates/create/2d/ui/hud.screen.js +40 -0
  114. package/templates/create/2d/ui/pause.screen.js +149 -0
  115. package/templates/create/2d/ui/settings.screen.js +347 -0
  116. package/templates/create/2d/ui/title.screen.js +13 -0
  117. package/templates/create/2d-adventure/aura.config.json +28 -0
  118. package/templates/create/2d-adventure/config/gameplay/adventure.config.js +14 -0
  119. package/templates/create/2d-adventure/content/gameplay/world.js +46 -0
  120. package/templates/create/2d-adventure/content/registries/.gitkeep +1 -0
  121. package/templates/create/2d-adventure/docs/design/loop.md +5 -0
  122. package/templates/create/2d-adventure/prefabs/player.prefab.js +54 -0
  123. package/templates/create/2d-adventure/prefabs/relic.prefab.js +38 -0
  124. package/templates/create/2d-adventure/prefabs/world.prefab.js +125 -0
  125. package/templates/create/2d-adventure/scenes/gameplay.scene.js +256 -0
  126. package/templates/create/2d-adventure/src/runtime/capabilities.js +34 -0
  127. package/templates/create/2d-adventure/ui/hud.screen.js +60 -0
  128. package/templates/create/2d-survivor/config/gameplay/survivor.config.js +33 -0
  129. package/templates/create/2d-survivor/content/gameplay/spawn-zones.json +29 -0
  130. package/templates/create/2d-survivor/content/registries/.gitkeep +1 -0
  131. package/templates/create/2d-survivor/docs/design/.gitkeep +1 -0
  132. package/templates/create/2d-survivor/docs/design/loop.md +5 -0
  133. package/templates/create/2d-survivor/prefabs/enemies.prefab.js +178 -0
  134. package/templates/create/2d-survivor/prefabs/enemy-swarm.prefab.js +18 -0
  135. package/templates/create/2d-survivor/prefabs/player.prefab.js +42 -0
  136. package/templates/create/2d-survivor/prefabs/projectiles.prefab.js +56 -0
  137. package/templates/create/2d-survivor/scenes/boot.scene.js +12 -0
  138. package/templates/create/2d-survivor/scenes/gameplay.scene.js +314 -0
  139. package/templates/create/2d-survivor/scenes/menu.scene.js +9 -0
  140. package/templates/create/2d-survivor/src/main.js +5 -332
  141. package/templates/create/2d-survivor/src/runtime/app.js +49 -0
  142. package/templates/create/2d-survivor/src/runtime/capabilities.js +35 -0
  143. package/templates/create/2d-survivor/ui/hud.screen.js +45 -0
  144. package/templates/create/2d-survivor/ui/title.screen.js +13 -0
  145. package/templates/create/3d/assets/models/starter-avatar.gltf +184 -0
  146. package/templates/create/3d/config/gameplay/.gitkeep +1 -0
  147. package/templates/create/3d/content/gameplay/checkpoints.json +33 -0
  148. package/templates/create/3d/content/gameplay/course.js +40 -0
  149. package/templates/create/3d/content/registries/.gitkeep +1 -0
  150. package/templates/create/3d/docs/design/.gitkeep +1 -0
  151. package/templates/create/3d/docs/design/loop.md +5 -0
  152. package/templates/create/3d/prefabs/checkpoint.prefab.js +15 -0
  153. package/templates/create/3d/prefabs/player.prefab.js +204 -0
  154. package/templates/create/3d/prefabs/world.prefab.js +112 -0
  155. package/templates/create/3d/scenes/boot.scene.js +12 -0
  156. package/templates/create/3d/scenes/checkpoint.scene.js +9 -0
  157. package/templates/create/3d/scenes/gameplay.scene.js +292 -0
  158. package/templates/create/3d/src/main.js +6 -295
  159. package/templates/create/3d/src/runtime/app.js +49 -0
  160. package/templates/create/3d/src/runtime/capabilities.js +53 -0
  161. package/templates/create/3d/src/runtime/materials.js +34 -0
  162. package/templates/create/3d/src/runtime/state.js +39 -0
  163. package/templates/create/3d/ui/hud.screen.js +75 -0
  164. package/templates/create/3d/ui/pause.screen.js +166 -0
  165. package/templates/create/3d/ui/settings.screen.js +387 -0
  166. package/templates/create/3d-adventure/assets/models/starter-avatar.gltf +184 -0
  167. package/templates/create/3d-adventure/aura.config.json +28 -0
  168. package/templates/create/3d-adventure/config/gameplay/adventure.config.js +9 -0
  169. package/templates/create/3d-adventure/content/gameplay/course.js +62 -0
  170. package/templates/create/3d-adventure/content/registries/.gitkeep +1 -0
  171. package/templates/create/3d-adventure/docs/design/loop.md +5 -0
  172. package/templates/create/3d-adventure/prefabs/player.prefab.js +168 -0
  173. package/templates/create/3d-adventure/prefabs/relic.prefab.js +35 -0
  174. package/templates/create/3d-adventure/prefabs/world.prefab.js +119 -0
  175. package/templates/create/3d-adventure/scenes/gameplay.scene.js +358 -0
  176. package/templates/create/3d-adventure/src/runtime/capabilities.js +56 -0
  177. package/templates/create/3d-adventure/src/runtime/materials.js +39 -0
  178. package/templates/create/3d-adventure/src/runtime/state.js +31 -0
  179. package/templates/create/3d-adventure/ui/hud.screen.js +70 -0
  180. package/templates/create/3d-adventure/ui/pause.screen.js +437 -0
  181. package/templates/create/3d-collectathon/assets/models/starter-avatar.gltf +184 -0
  182. package/templates/create/3d-collectathon/config/gameplay/.gitkeep +1 -0
  183. package/templates/create/3d-collectathon/content/gameplay/collectibles.json +26 -0
  184. package/templates/create/3d-collectathon/content/gameplay/course.js +46 -0
  185. package/templates/create/3d-collectathon/content/registries/.gitkeep +1 -0
  186. package/templates/create/3d-collectathon/docs/design/.gitkeep +1 -0
  187. package/templates/create/3d-collectathon/docs/design/loop.md +5 -0
  188. package/templates/create/3d-collectathon/prefabs/collectible.prefab.js +15 -0
  189. package/templates/create/3d-collectathon/prefabs/player.prefab.js +207 -0
  190. package/templates/create/3d-collectathon/prefabs/world.prefab.js +112 -0
  191. package/templates/create/3d-collectathon/scenes/boot.scene.js +12 -0
  192. package/templates/create/3d-collectathon/scenes/checkpoint.scene.js +9 -0
  193. package/templates/create/3d-collectathon/scenes/gameplay.scene.js +200 -0
  194. package/templates/create/3d-collectathon/src/main.js +5 -355
  195. package/templates/create/3d-collectathon/src/runtime/app.js +49 -0
  196. package/templates/create/3d-collectathon/src/runtime/capabilities.js +53 -0
  197. package/templates/create/3d-collectathon/src/runtime/materials.js +34 -0
  198. package/templates/create/3d-collectathon/src/runtime/state.js +27 -0
  199. package/templates/create/3d-collectathon/ui/hud.screen.js +66 -0
  200. package/templates/create/3d-collectathon/ui/pause.screen.js +13 -0
  201. package/templates/create/blank/config/gameplay/.gitkeep +1 -0
  202. package/templates/create/blank/content/gameplay/.gitkeep +1 -0
  203. package/templates/create/blank/content/registries/.gitkeep +1 -0
  204. package/templates/create/blank/docs/design/.gitkeep +1 -0
  205. package/templates/create/blank/docs/design/loop.md +5 -0
  206. package/templates/create/blank/prefabs/.gitkeep +1 -0
  207. package/templates/create/blank/scenes/.gitkeep +1 -0
  208. package/templates/create/blank/src/runtime/.gitkeep +1 -0
  209. package/templates/create/blank/ui/.gitkeep +1 -0
  210. package/templates/create/deckbuilder-2d/assets/audio/.gitkeep +1 -0
  211. package/templates/create/deckbuilder-2d/assets/fonts/.gitkeep +1 -0
  212. package/templates/create/deckbuilder-2d/assets/sprites/.gitkeep +1 -0
  213. package/templates/create/deckbuilder-2d/assets/starter/README.md +11 -0
  214. package/templates/create/deckbuilder-2d/assets/ui/.gitkeep +1 -0
  215. package/templates/create/deckbuilder-2d/aura.config.json +28 -0
  216. package/templates/create/deckbuilder-2d/config/gameplay/deckbuilder.config.js +26 -0
  217. package/templates/create/deckbuilder-2d/content/cards/guard.card.js +19 -0
  218. package/templates/create/deckbuilder-2d/content/cards/spark.card.js +20 -0
  219. package/templates/create/deckbuilder-2d/content/cards/starter.deck.js +69 -0
  220. package/templates/create/deckbuilder-2d/content/cards/strike.card.js +19 -0
  221. package/templates/create/deckbuilder-2d/content/cards/survey.card.js +20 -0
  222. package/templates/create/deckbuilder-2d/content/encounters/training-battle.encounter.js +14 -0
  223. package/templates/create/deckbuilder-2d/content/encounters/training-battle.js +65 -0
  224. package/templates/create/deckbuilder-2d/content/enemies/training-automaton.enemy.js +48 -0
  225. package/templates/create/deckbuilder-2d/content/gameplay/.gitkeep +1 -0
  226. package/templates/create/deckbuilder-2d/content/registries/cards.registry.js +26 -0
  227. package/templates/create/deckbuilder-2d/content/registries/encounters.registry.js +20 -0
  228. package/templates/create/deckbuilder-2d/content/registries/enemies.registry.js +20 -0
  229. package/templates/create/deckbuilder-2d/content/registries/relics.registry.js +20 -0
  230. package/templates/create/deckbuilder-2d/content/relics/ember-charm.relic.js +18 -0
  231. package/templates/create/deckbuilder-2d/docs/design/loop.md +12 -0
  232. package/templates/create/deckbuilder-2d/prefabs/.gitkeep +1 -0
  233. package/templates/create/deckbuilder-2d/scenes/boot.scene.js +84 -0
  234. package/templates/create/deckbuilder-2d/scenes/gameplay.scene.js +641 -0
  235. package/templates/create/deckbuilder-2d/src/components/.gitkeep +1 -0
  236. package/templates/create/deckbuilder-2d/src/main.js +17 -0
  237. package/templates/create/deckbuilder-2d/src/runtime/capabilities.js +22 -0
  238. package/templates/create/deckbuilder-2d/src/shared/.gitkeep +1 -0
  239. package/templates/create/deckbuilder-2d/src/systems/.gitkeep +1 -0
  240. package/templates/create/deckbuilder-2d/tests/smoke/.gitkeep +1 -0
  241. package/templates/create/deckbuilder-2d/ui/hud.screen.js +80 -0
  242. package/templates/create/deckbuilder-2d/ui/pause.screen.js +146 -0
  243. package/templates/create/deckbuilder-2d/ui/settings.screen.js +342 -0
  244. package/templates/create/local-multiplayer/aura.config.json +40 -0
  245. package/templates/create/local-multiplayer/config/gameplay/local-multiplayer.config.js +26 -0
  246. package/templates/create/local-multiplayer/content/gameplay/room-layout.js +13 -0
  247. package/templates/create/local-multiplayer/content/registries/.gitkeep +1 -0
  248. package/templates/create/local-multiplayer/docs/design/loop.md +14 -0
  249. package/templates/create/local-multiplayer/prefabs/player.prefab.js +99 -0
  250. package/templates/create/local-multiplayer/scenes/boot.scene.js +12 -0
  251. package/templates/create/local-multiplayer/scenes/gameplay.scene.js +443 -0
  252. package/templates/create/local-multiplayer/src/main.js +17 -0
  253. package/templates/create/local-multiplayer/src/runtime/capabilities.js +28 -0
  254. package/templates/create/local-multiplayer/ui/hud.screen.js +60 -0
  255. package/templates/create/shared/src/runtime/project-inspector.js +105 -0
  256. package/templates/create/shared/src/runtime/scene-flow.js +290 -0
  257. package/templates/create/shared/src/runtime/screen-shell.js +222 -0
  258. package/templates/create/shared/src/runtime/ui-forms.js +209 -0
  259. package/templates/create/shared/src/runtime/ui-settings.js +237 -0
  260. package/templates/create/shared/src/runtime/ui-theme.js +352 -0
  261. package/templates/create/shared/src/starter-utils/adventure-objectives.js +102 -0
  262. package/templates/create/shared/src/starter-utils/animation-2d.js +337 -0
  263. package/templates/create/shared/src/starter-utils/avatar-3d.js +404 -0
  264. package/templates/create/shared/src/starter-utils/combat-feedback-2d.js +320 -0
  265. package/templates/create/shared/src/starter-utils/core.js +39 -3
  266. package/templates/create/shared/src/starter-utils/index.js +8 -2
  267. package/templates/create/shared/src/starter-utils/platformer-3d.js +34 -3
  268. package/templates/create/shared/src/starter-utils/triggers.js +662 -0
  269. package/templates/create/shared/src/starter-utils/tween-2d.js +615 -0
  270. package/templates/create/video-cutscene/assets/video/.gitkeep +0 -0
  271. package/templates/create/video-cutscene/aura.config.json +28 -0
  272. package/templates/create/video-cutscene/config/gameplay/.gitkeep +0 -0
  273. package/templates/create/video-cutscene/content/gameplay/.gitkeep +0 -0
  274. package/templates/create/video-cutscene/content/registries/.gitkeep +0 -0
  275. package/templates/create/video-cutscene/docs/design/loop.md +22 -0
  276. package/templates/create/video-cutscene/prefabs/.gitkeep +0 -0
  277. package/templates/create/video-cutscene/scenes/boot.scene.js +11 -0
  278. package/templates/create/video-cutscene/scenes/cutscene.scene.js +113 -0
  279. package/templates/create/video-cutscene/scenes/gameplay.scene.js +50 -0
  280. package/templates/create/video-cutscene/src/main.js +17 -0
  281. package/templates/create/video-cutscene/src/runtime/app.js +52 -0
  282. package/templates/create/video-cutscene/src/runtime/capabilities.js +35 -0
  283. package/templates/create/video-cutscene/src/runtime/state.js +13 -0
  284. package/templates/create/video-cutscene/ui/.gitkeep +0 -0
  285. package/templates/create-bin/play.js +1187 -0
  286. package/templates/make/README.md +46 -0
  287. package/templates/make/catalog.json +51 -0
  288. package/templates/make/component/files/{{MAKE_NAME}}.component.js +20 -0
  289. package/templates/make/component/manifest.json +9 -0
  290. package/templates/make/data/files/{{MAKE_NAME}}.json +14 -0
  291. package/templates/make/data/manifest.json +9 -0
  292. package/templates/make/material/files/{{MAKE_NAME}}.material.json +17 -0
  293. package/templates/make/material/manifest.json +9 -0
  294. package/templates/make/prefab/files/{{MAKE_NAME}}.prefab.js +20 -0
  295. package/templates/make/prefab/manifest.json +9 -0
  296. package/templates/make/scene/files/{{MAKE_NAME}}.scene.js +31 -0
  297. package/templates/make/scene/manifest.json +9 -0
  298. package/templates/make/shader/files/{{MAKE_NAME}}.shader.js +23 -0
  299. package/templates/make/shader/manifest.json +9 -0
  300. package/templates/make/system/files/{{MAKE_NAME}}.system.js +15 -0
  301. package/templates/make/system/manifest.json +9 -0
  302. package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.js +16 -0
  303. package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.json +23 -0
  304. package/templates/make/ui-screen/manifest.json +10 -0
  305. package/templates/make-starters/deckbuilder-2d/card/files/{{MAKE_NAME}}.card.js +22 -0
  306. package/templates/make-starters/deckbuilder-2d/card/manifest.json +9 -0
  307. package/templates/make-starters/deckbuilder-2d/catalog.json +34 -0
  308. package/templates/make-starters/deckbuilder-2d/encounter/files/{{MAKE_NAME}}.encounter.js +18 -0
  309. package/templates/make-starters/deckbuilder-2d/encounter/manifest.json +9 -0
  310. package/templates/make-starters/deckbuilder-2d/enemy/files/{{MAKE_NAME}}.enemy.js +28 -0
  311. package/templates/make-starters/deckbuilder-2d/enemy/manifest.json +9 -0
  312. package/templates/make-starters/deckbuilder-2d/relic/files/{{MAKE_NAME}}.relic.js +23 -0
  313. package/templates/make-starters/deckbuilder-2d/relic/manifest.json +9 -0
  314. package/templates/retro/platformer/README.md +10 -0
  315. package/templates/retro/platformer/assets/retro/assets.json +91 -0
  316. package/templates/retro/platformer/aura.config.json +7 -0
  317. package/templates/retro/platformer/package.json +5 -0
  318. package/templates/retro/platformer/src/main.js +40 -0
  319. package/templates/retro/puzzle-grid/README.md +10 -0
  320. package/templates/retro/puzzle-grid/assets/retro/assets.json +90 -0
  321. package/templates/retro/puzzle-grid/aura.config.json +7 -0
  322. package/templates/retro/puzzle-grid/package.json +5 -0
  323. package/templates/retro/puzzle-grid/src/main.js +29 -0
  324. package/templates/retro/tactics-grid/README.md +10 -0
  325. package/templates/retro/tactics-grid/assets/retro/assets.json +90 -0
  326. package/templates/retro/tactics-grid/aura.config.json +7 -0
  327. package/templates/retro/tactics-grid/package.json +5 -0
  328. package/templates/retro/tactics-grid/src/main.js +35 -0
  329. package/templates/retro/topdown-adventure/README.md +10 -0
  330. package/templates/retro/topdown-adventure/assets/retro/assets.json +95 -0
  331. package/templates/retro/topdown-adventure/aura.config.json +7 -0
  332. package/templates/retro/topdown-adventure/package.json +5 -0
  333. package/templates/retro/topdown-adventure/src/main.js +29 -0
  334. package/templates/skills/aurajs/SKILL.md +61 -5
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from 'node:child_process';
4
+ import process from 'node:process';
5
+
6
+ function parseArgs(argv) {
7
+ const parsed = {
8
+ cwd: process.cwd(),
9
+ executable: null,
10
+ args: [],
11
+ };
12
+
13
+ for (let i = 0; i < argv.length; i += 1) {
14
+ const token = argv[i];
15
+ if (token === '--cwd') {
16
+ parsed.cwd = argv[i + 1] || parsed.cwd;
17
+ i += 1;
18
+ continue;
19
+ }
20
+ if (token === '--executable') {
21
+ parsed.executable = argv[i + 1] || null;
22
+ i += 1;
23
+ continue;
24
+ }
25
+ if (token === '--') {
26
+ parsed.args = argv.slice(i + 1);
27
+ break;
28
+ }
29
+ }
30
+
31
+ if (!parsed.executable) {
32
+ throw new Error('session-native-launcher requires --executable');
33
+ }
34
+
35
+ return parsed;
36
+ }
37
+
38
+ async function main() {
39
+ const parsed = parseArgs(process.argv.slice(2));
40
+ const child = spawn(parsed.executable, parsed.args, {
41
+ cwd: parsed.cwd,
42
+ stdio: 'inherit',
43
+ env: process.env,
44
+ });
45
+
46
+ child.on('error', (error) => {
47
+ process.stderr.write(`${error.message}\n`);
48
+ process.exit(1);
49
+ });
50
+
51
+ const forwardSignal = (signal) => {
52
+ if (!child.killed && child.exitCode == null) {
53
+ try {
54
+ child.kill(signal);
55
+ } catch {}
56
+ }
57
+ };
58
+
59
+ process.on('SIGTERM', () => forwardSignal('SIGTERM'));
60
+ process.on('SIGINT', () => forwardSignal('SIGINT'));
61
+
62
+ child.on('exit', (code, signal) => {
63
+ if (signal) {
64
+ process.exit(1);
65
+ return;
66
+ }
67
+ process.exit(code ?? 0);
68
+ });
69
+ }
70
+
71
+ main().catch((error) => {
72
+ process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
73
+ process.exit(1);
74
+ });
@@ -0,0 +1,75 @@
1
+ export const DEV_SESSION_REGISTRY_SCHEMA_VERSION = 'aurajs.dev-session-registry.v1';
2
+ export const DEV_SESSION_REQUEST_SCHEMA_VERSION = 'aurajs.dev-session-request.v1';
3
+ export const DEV_SESSION_RESPONSE_SCHEMA_VERSION = 'aurajs.dev-session-response.v1';
4
+ export const DEV_SESSION_REPORT_SCHEMA_VERSION = 'aurajs.dev-session-report.v1';
5
+
6
+ export const DEFAULT_SESSION_WIDTH = 1280;
7
+ export const DEFAULT_SESSION_HEIGHT = 720;
8
+ export const DEFAULT_SESSION_REQUEST_TIMEOUT_MS = 5000;
9
+ export const DEFAULT_SESSION_START_TIMEOUT_MS = 15000;
10
+
11
+ export function orderSessionRecord(record) {
12
+ const ordered = {};
13
+ const keyOrder = [
14
+ 'sessionId',
15
+ 'name',
16
+ 'mode',
17
+ 'origin',
18
+ 'launchReasonCode',
19
+ 'controllerPid',
20
+ 'pid',
21
+ 'projectRoot',
22
+ 'entryFile',
23
+ 'socketPath',
24
+ 'logPath',
25
+ 'createdAt',
26
+ 'frameIndex',
27
+ 'elapsedSeconds',
28
+ 'requestCount',
29
+ 'current',
30
+ ];
31
+
32
+ for (const key of keyOrder) {
33
+ if (Object.prototype.hasOwnProperty.call(record, key)) {
34
+ ordered[key] = record[key];
35
+ }
36
+ }
37
+
38
+ return ordered;
39
+ }
40
+
41
+ export function orderSessionRegistry(registry) {
42
+ const ordered = {
43
+ schemaVersion: DEV_SESSION_REGISTRY_SCHEMA_VERSION,
44
+ currentSessionId: registry.currentSessionId || null,
45
+ sessions: Array.isArray(registry.sessions)
46
+ ? registry.sessions.map((record) => orderSessionRecord(record))
47
+ : [],
48
+ };
49
+
50
+ return ordered;
51
+ }
52
+
53
+ export function orderSessionReport(report) {
54
+ const ordered = {};
55
+ const keyOrder = [
56
+ 'schemaVersion',
57
+ 'ok',
58
+ 'reasonCode',
59
+ 'sessionId',
60
+ 'currentSessionId',
61
+ 'closed',
62
+ 'stale',
63
+ 'detail',
64
+ 'session',
65
+ 'sessions',
66
+ ];
67
+
68
+ for (const key of keyOrder) {
69
+ if (Object.prototype.hasOwnProperty.call(report, key)) {
70
+ ordered[key] = report[key];
71
+ }
72
+ }
73
+
74
+ return ordered;
75
+ }
@@ -0,0 +1,321 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import vm from 'node:vm';
4
+
5
+ import { bundleProject } from './bundler.mjs';
6
+ import {
7
+ HeadlessTestError,
8
+ createHeadlessAura,
9
+ createRuntimeContext,
10
+ executeSetup,
11
+ executeFrameSteps,
12
+ } from './headless-test.mjs';
13
+ import {
14
+ GAME_ACTION_RESULT_SCHEMA_VERSION,
15
+ } from './game-action-runtime.mjs';
16
+
17
+ function cloneInspectorSnapshot(value) {
18
+ if (value == null) {
19
+ return null;
20
+ }
21
+ try {
22
+ return JSON.parse(JSON.stringify(value));
23
+ } catch {
24
+ return null;
25
+ }
26
+ }
27
+
28
+ function toFiniteNumberOrNull(value) {
29
+ return Number.isFinite(value) ? Number(value) : null;
30
+ }
31
+
32
+ function createUnavailableActionResult(reasonCode, detail) {
33
+ const payload = {
34
+ schemaVersion: GAME_ACTION_RESULT_SCHEMA_VERSION,
35
+ ok: false,
36
+ reasonCode: typeof reasonCode === 'string' && reasonCode
37
+ ? reasonCode
38
+ : 'action_run_failed',
39
+ };
40
+
41
+ if (typeof detail === 'string' && detail.trim()) {
42
+ payload.detail = detail.trim();
43
+ }
44
+
45
+ return payload;
46
+ }
47
+
48
+ function createSessionTestState() {
49
+ return {
50
+ failures: [],
51
+ passes: 0,
52
+ drawCalls: 0,
53
+ audioCalls: 0,
54
+ logs: [],
55
+ };
56
+ }
57
+
58
+ export async function bootSessionRuntime(options = {}) {
59
+ const projectRoot = resolve(options.projectRoot || process.cwd());
60
+ const entryFile = resolve(projectRoot, options.file || 'src/main.js');
61
+ const width = options.width ?? 1280;
62
+ const height = options.height ?? 720;
63
+ const outFile = resolve(projectRoot, options.outFile || '.aura/session/runtime.bundle.js');
64
+
65
+ if (!existsSync(entryFile)) {
66
+ throw new HeadlessTestError(`Session entry file not found: ${entryFile}`);
67
+ }
68
+
69
+ const bundle = bundleProject({
70
+ projectRoot,
71
+ mode: 'test',
72
+ entryFile,
73
+ outFile,
74
+ });
75
+
76
+ const testState = createSessionTestState();
77
+ const aura = createHeadlessAura({ width, height, testState });
78
+ const context = vm.createContext(createRuntimeContext(aura, testState));
79
+
80
+ const source = readFileSync(bundle.outFile, 'utf8');
81
+ const script = new vm.Script(source, {
82
+ filename: bundle.outFile,
83
+ displayErrors: true,
84
+ });
85
+
86
+ try {
87
+ script.runInContext(context, { timeout: 5000 });
88
+ await executeSetup(aura);
89
+ } catch (error) {
90
+ throw new HeadlessTestError(`Session runtime boot failed: ${error.message}`, {
91
+ stack: error.stack,
92
+ });
93
+ }
94
+
95
+ return {
96
+ aura,
97
+ bundle,
98
+ entryFile,
99
+ width,
100
+ height,
101
+ frameIndex: 0,
102
+ elapsedSeconds: 0,
103
+ testState,
104
+ };
105
+ }
106
+
107
+ export async function advanceSessionFrames(runtime, frames = 0) {
108
+ const nextFrames = Number.isInteger(Number(frames)) && Number(frames) >= 0
109
+ ? Number(frames)
110
+ : 0;
111
+
112
+ if (nextFrames === 0) return;
113
+ await executeFrameSteps(runtime.aura, nextFrames);
114
+ runtime.frameIndex += nextFrames;
115
+ runtime.elapsedSeconds += nextFrames / 60;
116
+ }
117
+
118
+ export function exportSessionState(runtime, options = {}) {
119
+ const stateNs = runtime.aura.state && typeof runtime.aura.state === 'object'
120
+ ? runtime.aura.state
121
+ : null;
122
+ if (!stateNs || typeof stateNs.exportState !== 'function') {
123
+ return {
124
+ ok: false,
125
+ reasonCode: 'state_export_failed',
126
+ detail: 'aura.state.exportState hook is unavailable.',
127
+ };
128
+ }
129
+
130
+ try {
131
+ return stateNs.exportState({
132
+ mode: options.mode || 'headless',
133
+ seed: options.seed,
134
+ frameIndex: runtime.frameIndex,
135
+ elapsedSeconds: runtime.elapsedSeconds,
136
+ capturedAt: options.capturedAt ?? null,
137
+ });
138
+ } catch (error) {
139
+ return {
140
+ ok: false,
141
+ reasonCode: 'state_export_failed',
142
+ detail: error instanceof Error ? error.message : String(error),
143
+ };
144
+ }
145
+ }
146
+
147
+ export function applySessionState(runtime, payload) {
148
+ const stateNs = runtime.aura.state && typeof runtime.aura.state === 'object'
149
+ ? runtime.aura.state
150
+ : null;
151
+ if (!stateNs || typeof stateNs.apply !== 'function') {
152
+ return {
153
+ ok: false,
154
+ reasonCode: 'state_apply_failed',
155
+ detail: 'aura.state.apply hook is unavailable.',
156
+ };
157
+ }
158
+
159
+ try {
160
+ return stateNs.apply(payload);
161
+ } catch (error) {
162
+ return {
163
+ ok: false,
164
+ reasonCode: 'state_apply_failed',
165
+ detail: error instanceof Error ? error.message : String(error),
166
+ };
167
+ }
168
+ }
169
+
170
+ export function getSessionActionSchema(runtime) {
171
+ const actionNs = runtime.aura.action && typeof runtime.aura.action === 'object'
172
+ ? runtime.aura.action
173
+ : null;
174
+ if (!actionNs || typeof actionNs.getSchema !== 'function') {
175
+ return {
176
+ ok: false,
177
+ reasonCode: 'action_contract_unavailable',
178
+ detail: 'aura.action.getSchema hook is unavailable.',
179
+ };
180
+ }
181
+
182
+ try {
183
+ return actionNs.getSchema();
184
+ } catch (error) {
185
+ return {
186
+ ok: false,
187
+ reasonCode: 'invalid_action_contract',
188
+ detail: error instanceof Error ? error.message : String(error),
189
+ };
190
+ }
191
+ }
192
+
193
+ export async function runSessionAction(runtime, options = {}) {
194
+ const request = options.request;
195
+ const actionNs = runtime.aura.action && typeof runtime.aura.action === 'object'
196
+ ? runtime.aura.action
197
+ : null;
198
+
199
+ if (!request || typeof request !== 'object' || Array.isArray(request)) {
200
+ return {
201
+ actionResult: createUnavailableActionResult('invalid_action_request', 'request must be an object'),
202
+ stateResult: null,
203
+ };
204
+ }
205
+ if (!actionNs || typeof actionNs.run !== 'function') {
206
+ return {
207
+ actionResult: createUnavailableActionResult('action_contract_unavailable', 'aura.action.run hook is unavailable.'),
208
+ stateResult: null,
209
+ };
210
+ }
211
+
212
+ let actionResult;
213
+ try {
214
+ actionResult = await Promise.resolve(actionNs.run(request));
215
+ } catch (error) {
216
+ actionResult = createUnavailableActionResult(
217
+ 'action_run_failed',
218
+ error instanceof Error ? error.message : String(error),
219
+ );
220
+ }
221
+
222
+ let stateResult = null;
223
+ const frames = Number.isInteger(Number(options.frames)) && Number(options.frames) >= 0
224
+ ? Number(options.frames)
225
+ : 0;
226
+ if (options.includeState === true || frames > 0) {
227
+ await advanceSessionFrames(runtime, frames);
228
+ stateResult = exportSessionState(runtime, {
229
+ mode: options.mode || 'headless',
230
+ capturedAt: options.capturedAt ?? null,
231
+ });
232
+ }
233
+
234
+ return {
235
+ actionResult,
236
+ stateResult,
237
+ };
238
+ }
239
+
240
+ export async function exportSessionInspect(runtime, options = {}) {
241
+ const debugNs = runtime.aura.debug && typeof runtime.aura.debug === 'object'
242
+ ? runtime.aura.debug
243
+ : null;
244
+
245
+ if (!debugNs || typeof debugNs.enableInspector !== 'function' || typeof debugNs.inspectorStats !== 'function') {
246
+ return {
247
+ enabled: true,
248
+ status: 'fail',
249
+ reasonCode: 'runtime_inspector_snapshot_hooks_unavailable',
250
+ sourceCaseId: null,
251
+ snapshot: null,
252
+ error: 'aura.debug.enableInspector()/inspectorStats() unavailable',
253
+ };
254
+ }
255
+
256
+ try {
257
+ const baseline = cloneInspectorSnapshot(debugNs.inspectorStats());
258
+ debugNs.enableInspector(true);
259
+ await advanceSessionFrames(runtime, options.frames ?? 0);
260
+ const active = cloneInspectorSnapshot(debugNs.inspectorStats());
261
+ debugNs.enableInspector(false);
262
+ const afterDisable = cloneInspectorSnapshot(debugNs.inspectorStats());
263
+
264
+ const snapshot = !active || active.enabled !== true
265
+ ? null
266
+ : {
267
+ status: 'pass',
268
+ reasonCode: 'runtime_inspector_snapshot_ok',
269
+ defaultDisabledLowOverhead: baseline?.enabled === false,
270
+ frame: {
271
+ frameCount: toFiniteNumberOrNull(active.frameCount),
272
+ fps: toFiniteNumberOrNull(active?.frame?.fps),
273
+ deltaSeconds: toFiniteNumberOrNull(active?.frame?.deltaSeconds),
274
+ elapsedSeconds: toFiniteNumberOrNull(active?.frame?.elapsedSeconds),
275
+ },
276
+ window: active?.window || null,
277
+ queues: active?.queues || null,
278
+ resetAfterDisable: {
279
+ enabled: afterDisable?.enabled === false,
280
+ frameCount: toFiniteNumberOrNull(afterDisable?.frameCount),
281
+ elapsedSeconds: toFiniteNumberOrNull(afterDisable?.frame?.elapsedSeconds),
282
+ },
283
+ phase2: active?.phase2 || null,
284
+ draw2dRuntime: active?.draw2dRuntime || null,
285
+ scene3dRuntime: active?.scene3dRuntime || null,
286
+ raw: {
287
+ baseline,
288
+ active,
289
+ afterDisable,
290
+ },
291
+ };
292
+
293
+ return snapshot
294
+ ? {
295
+ enabled: true,
296
+ status: 'pass',
297
+ reasonCode: 'runtime_inspector_snapshot_ok',
298
+ sourceCaseId: null,
299
+ snapshot,
300
+ error: null,
301
+ }
302
+ : {
303
+ enabled: true,
304
+ status: 'fail',
305
+ reasonCode: 'runtime_inspector_snapshot_disabled',
306
+ sourceCaseId: null,
307
+ snapshot: null,
308
+ error: 'Inspector did not report enabled stats after enableInspector(true).',
309
+ };
310
+ } catch (error) {
311
+ return {
312
+ enabled: true,
313
+ status: 'fail',
314
+ reasonCode: 'runtime_inspector_snapshot_collect_failed',
315
+ sourceCaseId: null,
316
+ snapshot: null,
317
+ error: error instanceof Error ? error.message : String(error),
318
+ };
319
+ }
320
+ }
321
+