@auraindustry/aurajs 0.1.1 → 0.1.5

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 (144) hide show
  1. package/README.md +7 -0
  2. package/benchmarks/perf-thresholds.json +27 -0
  3. package/package.json +6 -1
  4. package/src/ai-guidance.mjs +302 -0
  5. package/src/asset-pack.mjs +2 -1
  6. package/src/authored-project.mjs +498 -2
  7. package/src/authored-runtime.mjs +14 -0
  8. package/src/bin-integrity.mjs +33 -26
  9. package/src/build-contract/capabilities.mjs +87 -1
  10. package/src/build-contract/constants.mjs +1 -0
  11. package/src/build-contract.mjs +2 -0
  12. package/src/bundler.mjs +143 -13
  13. package/src/cli.mjs +681 -13
  14. package/src/commands/packs.mjs +741 -0
  15. package/src/commands/project-authoring.mjs +128 -1
  16. package/src/conformance/cases/app-and-ui-runtime-cases.mjs +1 -2
  17. package/src/conformance/cases/core-runtime-cases.mjs +6 -2
  18. package/src/conformance/cases/scene3d-and-media-cases.mjs +238 -0
  19. package/src/conformance/cases/systems-and-gameplay-cases.mjs +1126 -10
  20. package/src/conformance-mobile.mjs +166 -0
  21. package/src/conformance.mjs +89 -30
  22. package/src/evidence-bundle.mjs +242 -0
  23. package/src/external-package-surface.mjs +1 -1
  24. package/src/headless-test/runtime-coordinator.mjs +186 -33
  25. package/src/headless-test.mjs +2 -0
  26. package/src/helpers/2d/index.mjs +183 -0
  27. package/src/helpers/index.mjs +26 -0
  28. package/src/helpers/starter-utils/adventure-objectives.js +102 -0
  29. package/src/helpers/starter-utils/adventure-world-2d.js +221 -0
  30. package/src/helpers/starter-utils/animation-2d.js +337 -0
  31. package/src/helpers/starter-utils/animation-packaging-2d.js +203 -0
  32. package/src/helpers/starter-utils/atlas-assets-2d.js +111 -0
  33. package/src/helpers/starter-utils/autoplay-debug-2d.js +215 -0
  34. package/src/helpers/starter-utils/avatar-3d.js +404 -0
  35. package/src/helpers/starter-utils/combat-feedback-2d.js +320 -0
  36. package/src/helpers/starter-utils/combat-runtime-2d.js +290 -0
  37. package/src/helpers/starter-utils/core.js +150 -0
  38. package/src/helpers/starter-utils/dialogue-2d.js +351 -0
  39. package/src/helpers/starter-utils/enemy-archetypes-2d.js +68 -0
  40. package/src/helpers/starter-utils/index.js +26 -0
  41. package/src/helpers/starter-utils/inventory-2d.js +268 -0
  42. package/src/helpers/starter-utils/journal-2d.js +267 -0
  43. package/src/helpers/starter-utils/platformer-3d.js +132 -0
  44. package/src/helpers/starter-utils/scene-audio-2d.js +236 -0
  45. package/src/helpers/starter-utils/streamed-world-2d.js +378 -0
  46. package/src/helpers/starter-utils/tilemap-nav-2d.js +499 -0
  47. package/src/helpers/starter-utils/tilemap-world-2d.js +205 -0
  48. package/src/helpers/starter-utils/triggers.js +662 -0
  49. package/src/helpers/starter-utils/tween-2d.js +615 -0
  50. package/src/helpers/starter-utils/wave-director.js +101 -0
  51. package/src/helpers/starter-utils/world-compositor-2d.js +253 -0
  52. package/src/helpers/starter-utils/world-persistence-2d.js +180 -0
  53. package/src/mobile/android/build.mjs +606 -0
  54. package/src/mobile/android/host-artifact.mjs +280 -0
  55. package/src/mobile/ios/build.mjs +1323 -0
  56. package/src/mobile/ios/host-artifact.mjs +819 -0
  57. package/src/mobile/shared/capabilities.mjs +174 -0
  58. package/src/package-integrity.mjs +18 -4
  59. package/src/packs/catalog.mjs +259 -0
  60. package/src/perf-benchmark-runner.mjs +17 -12
  61. package/src/perf-benchmark.mjs +408 -4
  62. package/src/publish-command.mjs +434 -17
  63. package/src/publish-validation.mjs +22 -11
  64. package/src/replay-runtime.mjs +257 -0
  65. package/src/scaffold/config.mjs +2 -0
  66. package/src/scaffold/fs.mjs +8 -1
  67. package/src/scaffold/project-docs.mjs +101 -41
  68. package/src/scaffold.mjs +4 -0
  69. package/src/session-runtime.mjs +4 -3
  70. package/src/web-conformance.mjs +0 -36
  71. package/templates/create/2d/src/runtime/app.js +4 -0
  72. package/templates/create/2d-adventure/config/gameplay/adventure.config.js +9 -6
  73. package/templates/create/2d-adventure/content/gameplay/dialogue.js +85 -0
  74. package/templates/create/2d-adventure/content/gameplay/world.js +32 -36
  75. package/templates/create/2d-adventure/content/gameplay/world.tilemap.json +273 -0
  76. package/templates/create/2d-adventure/docs/design/loop.md +4 -3
  77. package/templates/create/2d-adventure/prefabs/relic.prefab.js +10 -10
  78. package/templates/create/2d-adventure/prefabs/world.prefab.js +127 -74
  79. package/templates/create/2d-adventure/scenes/gameplay.scene.js +603 -112
  80. package/templates/create/2d-adventure/src/runtime/capabilities.js +16 -0
  81. package/templates/create/2d-adventure/ui/hud.screen.js +187 -4
  82. package/templates/create/2d-adventure/ui/journal.screen.js +183 -0
  83. package/templates/create/2d-survivor/src/runtime/app.js +4 -0
  84. package/templates/create/3d/scenes/gameplay.scene.js +30 -3
  85. package/templates/create/3d/src/runtime/app.js +4 -0
  86. package/templates/create/3d/src/runtime/capabilities.js +5 -0
  87. package/templates/create/3d/src/runtime/materials.js +10 -0
  88. package/templates/create/3d-adventure/scenes/gameplay.scene.js +30 -3
  89. package/templates/create/3d-adventure/src/runtime/capabilities.js +5 -0
  90. package/templates/create/3d-adventure/src/runtime/materials.js +11 -0
  91. package/templates/create/3d-collectathon/scenes/gameplay.scene.js +30 -3
  92. package/templates/create/3d-collectathon/src/runtime/app.js +4 -0
  93. package/templates/create/3d-collectathon/src/runtime/capabilities.js +5 -0
  94. package/templates/create/3d-collectathon/src/runtime/materials.js +10 -0
  95. package/templates/create/blank/assets/splash/aurajs-gg-wordmark.webp +0 -0
  96. package/templates/create/blank/assets/splash/bg.webp +0 -0
  97. package/templates/create/blank/assets/splash/boot-loop.wav +0 -0
  98. package/templates/create/blank/assets/splash/boot-sting.wav +0 -0
  99. package/templates/create/blank/assets/splash/logo-mascot-sheet.webp +0 -0
  100. package/templates/create/blank/assets/splash/logoholo.webp +0 -0
  101. package/templates/create/blank/src/main.js +5 -1
  102. package/templates/create/blank/src/runtime/splash.js +305 -0
  103. package/templates/create/local-multiplayer/scenes/gameplay.scene.js +186 -12
  104. package/templates/create/local-multiplayer/src/runtime/capabilities.js +8 -1
  105. package/templates/create/shared/assets/splash/aurajs-gg-wordmark.webp +0 -0
  106. package/templates/create/shared/assets/splash/bg.webp +0 -0
  107. package/templates/create/shared/assets/splash/boot-loop.wav +0 -0
  108. package/templates/create/shared/assets/splash/boot-sting.wav +0 -0
  109. package/templates/create/shared/assets/splash/logo-mascot-sheet.webp +0 -0
  110. package/templates/create/shared/assets/splash/logoholo.webp +0 -0
  111. package/templates/create/shared/src/runtime/splash.js +305 -0
  112. package/templates/create/shared/src/runtime/ui-forms.js +552 -0
  113. package/templates/create/shared/src/starter-utils/adventure-world-2d.js +221 -0
  114. package/templates/create/shared/src/starter-utils/animation-packaging-2d.js +203 -0
  115. package/templates/create/shared/src/starter-utils/atlas-assets-2d.js +111 -0
  116. package/templates/create/shared/src/starter-utils/autoplay-debug-2d.js +215 -0
  117. package/templates/create/shared/src/starter-utils/combat-runtime-2d.js +290 -0
  118. package/templates/create/shared/src/starter-utils/dialogue-2d.js +351 -0
  119. package/templates/create/shared/src/starter-utils/index.js +15 -1
  120. package/templates/create/shared/src/starter-utils/inventory-2d.js +268 -0
  121. package/templates/create/shared/src/starter-utils/journal-2d.js +267 -0
  122. package/templates/create/shared/src/starter-utils/scene-audio-2d.js +236 -0
  123. package/templates/create/shared/src/starter-utils/streamed-world-2d.js +378 -0
  124. package/templates/create/shared/src/starter-utils/tilemap-nav-2d.js +499 -0
  125. package/templates/create/shared/src/starter-utils/tilemap-world-2d.js +205 -0
  126. package/templates/create/shared/src/starter-utils/world-compositor-2d.js +253 -0
  127. package/templates/create/shared/src/starter-utils/world-persistence-2d.js +180 -0
  128. package/templates/create/video-cutscene/src/runtime/app.js +4 -0
  129. package/templates/create-bin/play.js +148 -7
  130. package/templates/skills/auramaxx/SKILL.md +46 -0
  131. package/templates/skills/auramaxx/project-requirements.md +68 -0
  132. package/templates/skills/auramaxx/starter-recipes.md +104 -0
  133. package/templates/skills/auramaxx/validation-checklist.md +49 -0
  134. package/templates/starter/assets/splash/aurajs-gg-wordmark.webp +0 -0
  135. package/templates/starter/assets/splash/bg.webp +0 -0
  136. package/templates/starter/assets/splash/boot-loop.wav +0 -0
  137. package/templates/starter/assets/splash/boot-sting.wav +0 -0
  138. package/templates/starter/assets/splash/logo-mascot-sheet.webp +0 -0
  139. package/templates/starter/assets/splash/logoholo.webp +0 -0
  140. package/templates/starter/src/main.js +4 -0
  141. package/templates/starter/src/runtime/splash.js +305 -0
  142. package/templates/skills/aurajs/SKILL.md +0 -96
  143. package/templates/skills/aurajs/api-contract-3d.md +0 -7
  144. package/templates/skills/aurajs/api-contract.md +0 -7
@@ -0,0 +1,280 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { copyFileSync, existsSync, mkdirSync, statSync } from 'node:fs';
3
+ import { dirname, join, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ export const ANDROID_HOST_ARTIFACT_ABI = 'arm64-v8a';
7
+ export const ANDROID_HOST_ARTIFACT_TARGET_TRIPLE = 'aarch64-linux-android';
8
+ export const ANDROID_HOST_LIBRARY_NAME = 'libaurajs_host.so';
9
+
10
+ const here = dirname(fileURLToPath(import.meta.url));
11
+ const DEFAULT_DIST_ROOT = resolve(here, '../../../../platform/dist/android');
12
+ const DEFAULT_RUST_HOST_ROOT = resolve(here, '../../../../rust-host');
13
+
14
+ export function produceAndroidHostArtifact(options = {}) {
15
+ const env = options.env && typeof options.env === 'object' ? options.env : process.env;
16
+ const spawnSyncImpl = options.spawnSyncImpl || spawnSync;
17
+ const abi = String(options.abi || ANDROID_HOST_ARTIFACT_ABI);
18
+ const distRoot = resolve(options.distRoot || DEFAULT_DIST_ROOT);
19
+ const distArtifactPath = join(distRoot, abi, ANDROID_HOST_LIBRARY_NAME);
20
+ const explicitSourcePath = options.sourceLibraryPath ? resolve(options.sourceLibraryPath) : null;
21
+
22
+ if (existsSync(distArtifactPath)) {
23
+ return buildSuccess({
24
+ reasonCode: 'android_host_artifact_existing_dist',
25
+ sourceKind: 'existing_dist',
26
+ abi,
27
+ distRoot,
28
+ distArtifactPath,
29
+ sourceLibraryPath: distArtifactPath,
30
+ });
31
+ }
32
+
33
+ if (explicitSourcePath) {
34
+ if (!existsSync(explicitSourcePath)) {
35
+ return buildFailure({
36
+ reasonCode: 'android_host_artifact_explicit_missing',
37
+ sourceKind: 'explicit_missing',
38
+ abi,
39
+ distRoot,
40
+ distArtifactPath,
41
+ sourceLibraryPath: explicitSourcePath,
42
+ detail: `explicit Android host library input is missing: ${explicitSourcePath}`,
43
+ });
44
+ }
45
+
46
+ stageHostArtifact(explicitSourcePath, distArtifactPath);
47
+ return buildSuccess({
48
+ reasonCode: 'android_host_artifact_explicit_copied',
49
+ sourceKind: 'explicit_input',
50
+ abi,
51
+ distRoot,
52
+ distArtifactPath,
53
+ sourceLibraryPath: explicitSourcePath,
54
+ });
55
+ }
56
+
57
+ const rustHostRoot = resolve(options.rustHostRoot || DEFAULT_RUST_HOST_ROOT);
58
+ const cargoManifestPath = join(rustHostRoot, 'Cargo.toml');
59
+ if (!existsSync(cargoManifestPath)) {
60
+ return buildFailure({
61
+ reasonCode: 'android_rust_host_crate_missing',
62
+ sourceKind: 'missing_prereq',
63
+ abi,
64
+ distRoot,
65
+ distArtifactPath,
66
+ rustHostRoot,
67
+ cargoManifestPath,
68
+ detail: `AuraJS Rust host crate is missing: ${cargoManifestPath}`,
69
+ });
70
+ }
71
+
72
+ const ndkRoot = normalizeExistingPath(env.ANDROID_NDK_ROOT || env.ANDROID_NDK_HOME || null);
73
+ if (!ndkRoot) {
74
+ return buildFailure({
75
+ reasonCode: 'android_ndk_missing',
76
+ sourceKind: 'missing_prereq',
77
+ abi,
78
+ distRoot,
79
+ distArtifactPath,
80
+ rustHostRoot,
81
+ cargoManifestPath,
82
+ detail: 'ANDROID_NDK_ROOT or ANDROID_NDK_HOME must point at a valid Android NDK install.',
83
+ });
84
+ }
85
+
86
+ const cargoExecutable = normalizeCommand(options.cargoExecutable || env.CARGO || 'cargo');
87
+ const cargoProbe = probeCommand({
88
+ spawnSyncImpl,
89
+ executable: cargoExecutable,
90
+ args: ['--version'],
91
+ cwd: rustHostRoot,
92
+ env,
93
+ });
94
+ if (!cargoProbe.ok) {
95
+ return buildFailure({
96
+ reasonCode: 'android_rust_cargo_missing',
97
+ sourceKind: 'missing_prereq',
98
+ abi,
99
+ distRoot,
100
+ distArtifactPath,
101
+ rustHostRoot,
102
+ cargoManifestPath,
103
+ cargoExecutable,
104
+ detail: cargoProbe.detail || `failed to run ${cargoExecutable} --version`,
105
+ });
106
+ }
107
+
108
+ const cargoNdkProbe = probeCommand({
109
+ spawnSyncImpl,
110
+ executable: cargoExecutable,
111
+ args: ['ndk', '--version'],
112
+ cwd: rustHostRoot,
113
+ env: {
114
+ ...env,
115
+ ANDROID_NDK_ROOT: ndkRoot,
116
+ ANDROID_NDK_HOME: ndkRoot,
117
+ },
118
+ });
119
+ if (!cargoNdkProbe.ok) {
120
+ return buildFailure({
121
+ reasonCode: 'android_cargo_ndk_missing',
122
+ sourceKind: 'missing_prereq',
123
+ abi,
124
+ distRoot,
125
+ distArtifactPath,
126
+ rustHostRoot,
127
+ cargoManifestPath,
128
+ cargoExecutable,
129
+ ndkRoot,
130
+ detail: cargoNdkProbe.detail || `failed to run ${cargoExecutable} ndk --version`,
131
+ });
132
+ }
133
+
134
+ const buildArgs = [
135
+ 'ndk',
136
+ '-t',
137
+ abi,
138
+ '-o',
139
+ distRoot,
140
+ 'build',
141
+ '--manifest-path',
142
+ cargoManifestPath,
143
+ '--release',
144
+ '--lib',
145
+ ];
146
+ const buildEnv = {
147
+ ...env,
148
+ ANDROID_NDK_ROOT: ndkRoot,
149
+ ANDROID_NDK_HOME: ndkRoot,
150
+ };
151
+ const buildResult = spawnSyncImpl(cargoExecutable, buildArgs, {
152
+ cwd: rustHostRoot,
153
+ encoding: 'utf8',
154
+ env: buildEnv,
155
+ });
156
+ if (buildResult?.error) {
157
+ return buildFailure({
158
+ reasonCode: 'android_host_artifact_build_failed',
159
+ sourceKind: 'cargo_ndk',
160
+ abi,
161
+ distRoot,
162
+ distArtifactPath,
163
+ rustHostRoot,
164
+ cargoManifestPath,
165
+ cargoExecutable,
166
+ ndkRoot,
167
+ command: [cargoExecutable, ...buildArgs],
168
+ detail: `failed to launch Android host build: ${buildResult.error.message}`,
169
+ });
170
+ }
171
+ if (!buildResult || buildResult.status !== 0) {
172
+ return buildFailure({
173
+ reasonCode: 'android_host_artifact_build_failed',
174
+ sourceKind: 'cargo_ndk',
175
+ abi,
176
+ distRoot,
177
+ distArtifactPath,
178
+ rustHostRoot,
179
+ cargoManifestPath,
180
+ cargoExecutable,
181
+ ndkRoot,
182
+ command: [cargoExecutable, ...buildArgs],
183
+ detail: formatProcessFailure(buildResult, `${cargoExecutable} ${buildArgs.join(' ')}`),
184
+ });
185
+ }
186
+
187
+ if (!existsSync(distArtifactPath)) {
188
+ return buildFailure({
189
+ reasonCode: 'android_host_artifact_output_missing',
190
+ sourceKind: 'cargo_ndk',
191
+ abi,
192
+ distRoot,
193
+ distArtifactPath,
194
+ rustHostRoot,
195
+ cargoManifestPath,
196
+ cargoExecutable,
197
+ ndkRoot,
198
+ command: [cargoExecutable, ...buildArgs],
199
+ detail: `Android host build reported success but did not produce ${distArtifactPath}`,
200
+ });
201
+ }
202
+
203
+ return buildSuccess({
204
+ reasonCode: 'android_host_artifact_built',
205
+ sourceKind: 'cargo_ndk',
206
+ abi,
207
+ distRoot,
208
+ distArtifactPath,
209
+ rustHostRoot,
210
+ cargoManifestPath,
211
+ cargoExecutable,
212
+ ndkRoot,
213
+ command: [cargoExecutable, ...buildArgs],
214
+ });
215
+ }
216
+
217
+ function stageHostArtifact(sourcePath, distArtifactPath) {
218
+ mkdirSync(dirname(distArtifactPath), { recursive: true });
219
+ if (resolve(sourcePath) !== resolve(distArtifactPath)) {
220
+ copyFileSync(sourcePath, distArtifactPath);
221
+ }
222
+ }
223
+
224
+ function buildSuccess(result) {
225
+ return {
226
+ ok: true,
227
+ ...result,
228
+ artifactSizeBytes: statSync(result.distArtifactPath).size,
229
+ };
230
+ }
231
+
232
+ function buildFailure(result) {
233
+ return {
234
+ ok: false,
235
+ ...result,
236
+ };
237
+ }
238
+
239
+ function normalizeExistingPath(value) {
240
+ if (!value) return null;
241
+ const resolved = resolve(String(value));
242
+ return existsSync(resolved) ? resolved : null;
243
+ }
244
+
245
+ function normalizeCommand(value) {
246
+ const text = String(value || '').trim();
247
+ return text || 'cargo';
248
+ }
249
+
250
+ function probeCommand({ spawnSyncImpl, executable, args, cwd, env }) {
251
+ const result = spawnSyncImpl(executable, args, {
252
+ cwd,
253
+ encoding: 'utf8',
254
+ env,
255
+ });
256
+ if (result?.error) {
257
+ return {
258
+ ok: false,
259
+ detail: `failed to launch ${executable} ${args.join(' ')}: ${result.error.message}`,
260
+ };
261
+ }
262
+ if (!result || result.status !== 0) {
263
+ return {
264
+ ok: false,
265
+ detail: formatProcessFailure(result, `${executable} ${args.join(' ')}`),
266
+ };
267
+ }
268
+ return { ok: true };
269
+ }
270
+
271
+ function formatProcessFailure(result, label) {
272
+ const detail = [result?.stdout, result?.stderr]
273
+ .filter((value) => typeof value === 'string' && value.trim().length > 0)
274
+ .map((value) => value.trim())
275
+ .join('\n');
276
+ if (detail.length > 0) {
277
+ return `${label} failed: ${detail}`;
278
+ }
279
+ return `${label} failed with status ${result?.status ?? 'unknown'}`;
280
+ }