@aura3d/engine 1.0.3 → 1.0.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 (198) hide show
  1. package/README.md +309 -7
  2. package/dist/animation/AnimationClipEvents.d.ts +57 -0
  3. package/dist/animation/AnimationClipEvents.d.ts.map +1 -0
  4. package/dist/animation/AnimationClipEvents.js +171 -0
  5. package/dist/animation/AnimationClipEvents.js.map +1 -0
  6. package/dist/animation/AnimationClipRegistry.d.ts +76 -0
  7. package/dist/animation/AnimationClipRegistry.d.ts.map +1 -0
  8. package/dist/animation/AnimationClipRegistry.js +130 -0
  9. package/dist/animation/AnimationClipRegistry.js.map +1 -0
  10. package/dist/animation/AnimationController.d.ts +168 -0
  11. package/dist/animation/AnimationController.d.ts.map +1 -0
  12. package/dist/animation/AnimationController.js +619 -0
  13. package/dist/animation/AnimationController.js.map +1 -0
  14. package/dist/animation/HumanoidRetargeting.d.ts +76 -0
  15. package/dist/animation/HumanoidRetargeting.d.ts.map +1 -0
  16. package/dist/animation/HumanoidRetargeting.js +331 -0
  17. package/dist/animation/HumanoidRetargeting.js.map +1 -0
  18. package/dist/animation/browser-index.d.ts +18 -0
  19. package/dist/animation/browser-index.d.ts.map +1 -1
  20. package/dist/animation/browser-index.js +13 -0
  21. package/dist/animation/browser-index.js.map +1 -1
  22. package/dist/animation/index.d.ts +16 -1
  23. package/dist/animation/index.d.ts.map +1 -1
  24. package/dist/animation/index.js +11 -1
  25. package/dist/animation/index.js.map +1 -1
  26. package/dist/animation/threejs-compatibility/AnimationDiagnostics.d.ts.map +1 -1
  27. package/dist/animation/threejs-compatibility/AnimationDiagnostics.js +3 -5
  28. package/dist/animation/threejs-compatibility/AnimationDiagnostics.js.map +1 -1
  29. package/dist/assets/GLTFAnimationRuntime.js +1 -1
  30. package/dist/assets/GLTFLoader.js +1 -1
  31. package/dist/aura3d-cli/cli.js +194 -8
  32. package/dist/aura3d-cli/cli.js.map +1 -1
  33. package/dist/aura3d-cli/index.d.ts +280 -3
  34. package/dist/aura3d-cli/index.d.ts.map +1 -1
  35. package/dist/aura3d-cli/index.js +886 -4
  36. package/dist/aura3d-cli/index.js.map +1 -1
  37. package/dist/aura3d-cli/pull-bridge.d.ts +95 -0
  38. package/dist/aura3d-cli/pull-bridge.d.ts.map +1 -0
  39. package/dist/aura3d-cli/pull-bridge.js +247 -0
  40. package/dist/aura3d-cli/pull-bridge.js.map +1 -0
  41. package/dist/create-aura3d/index.d.ts +1 -1
  42. package/dist/create-aura3d/index.d.ts.map +1 -1
  43. package/dist/create-aura3d/index.js +9 -2
  44. package/dist/create-aura3d/index.js.map +1 -1
  45. package/dist/editor-runtime/ProjectSerializer.d.ts +74 -1
  46. package/dist/editor-runtime/ProjectSerializer.d.ts.map +1 -1
  47. package/dist/editor-runtime/ProjectSerializer.js +123 -6
  48. package/dist/editor-runtime/ProjectSerializer.js.map +1 -1
  49. package/dist/editor-runtime/TimelineModel.d.ts +18 -0
  50. package/dist/editor-runtime/TimelineModel.d.ts.map +1 -1
  51. package/dist/editor-runtime/TimelineModel.js +67 -3
  52. package/dist/editor-runtime/TimelineModel.js.map +1 -1
  53. package/dist/editor-runtime/TimelineRuntimeBridge.d.ts +98 -0
  54. package/dist/editor-runtime/TimelineRuntimeBridge.d.ts.map +1 -0
  55. package/dist/editor-runtime/TimelineRuntimeBridge.js +186 -0
  56. package/dist/editor-runtime/TimelineRuntimeBridge.js.map +1 -0
  57. package/dist/editor-runtime/index.d.ts +3 -1
  58. package/dist/editor-runtime/index.d.ts.map +1 -1
  59. package/dist/editor-runtime/index.js +1 -0
  60. package/dist/editor-runtime/index.js.map +1 -1
  61. package/dist/engine/agent-api/AnimationController.d.ts +607 -0
  62. package/dist/engine/agent-api/AnimationController.d.ts.map +1 -0
  63. package/dist/engine/agent-api/AnimationController.js +2192 -0
  64. package/dist/engine/agent-api/AnimationController.js.map +1 -0
  65. package/dist/engine/agent-api/AssetEvidence.d.ts +88 -0
  66. package/dist/engine/agent-api/AssetEvidence.d.ts.map +1 -0
  67. package/dist/engine/agent-api/AssetEvidence.js +157 -0
  68. package/dist/engine/agent-api/AssetEvidence.js.map +1 -0
  69. package/dist/engine/agent-api/AuraAppHandle.d.ts +55 -0
  70. package/dist/engine/agent-api/AuraAppHandle.d.ts.map +1 -0
  71. package/dist/engine/agent-api/AuraAppHandle.js +15 -0
  72. package/dist/engine/agent-api/AuraAppHandle.js.map +1 -0
  73. package/dist/engine/agent-api/AuraVoiceBridge.d.ts +96 -0
  74. package/dist/engine/agent-api/AuraVoiceBridge.d.ts.map +1 -0
  75. package/dist/engine/agent-api/AuraVoiceBridge.js +370 -0
  76. package/dist/engine/agent-api/AuraVoiceBridge.js.map +1 -0
  77. package/dist/engine/agent-api/CartoonDirector.d.ts +95 -0
  78. package/dist/engine/agent-api/CartoonDirector.d.ts.map +1 -0
  79. package/dist/engine/agent-api/CartoonDirector.js +342 -0
  80. package/dist/engine/agent-api/CartoonDirector.js.map +1 -0
  81. package/dist/engine/agent-api/CartoonPerformance.d.ts +149 -0
  82. package/dist/engine/agent-api/CartoonPerformance.d.ts.map +1 -0
  83. package/dist/engine/agent-api/CartoonPerformance.js +317 -0
  84. package/dist/engine/agent-api/CartoonPerformance.js.map +1 -0
  85. package/dist/engine/agent-api/CartoonRenderQueue.d.ts +132 -0
  86. package/dist/engine/agent-api/CartoonRenderQueue.d.ts.map +1 -0
  87. package/dist/engine/agent-api/CartoonRenderQueue.js +385 -0
  88. package/dist/engine/agent-api/CartoonRenderQueue.js.map +1 -0
  89. package/dist/engine/agent-api/CharacterAssembly.d.ts +126 -0
  90. package/dist/engine/agent-api/CharacterAssembly.d.ts.map +1 -0
  91. package/dist/engine/agent-api/CharacterAssembly.js +280 -0
  92. package/dist/engine/agent-api/CharacterAssembly.js.map +1 -0
  93. package/dist/engine/agent-api/DialoguePerformance.d.ts +150 -0
  94. package/dist/engine/agent-api/DialoguePerformance.d.ts.map +1 -0
  95. package/dist/engine/agent-api/DialoguePerformance.js +335 -0
  96. package/dist/engine/agent-api/DialoguePerformance.js.map +1 -0
  97. package/dist/engine/agent-api/FrameLoop.d.ts +70 -0
  98. package/dist/engine/agent-api/FrameLoop.d.ts.map +1 -0
  99. package/dist/engine/agent-api/FrameLoop.js +165 -0
  100. package/dist/engine/agent-api/FrameLoop.js.map +1 -0
  101. package/dist/engine/agent-api/GameAssetValidation.d.ts +279 -0
  102. package/dist/engine/agent-api/GameAssetValidation.d.ts.map +1 -0
  103. package/dist/engine/agent-api/GameAssetValidation.js +719 -0
  104. package/dist/engine/agent-api/GameAssetValidation.js.map +1 -0
  105. package/dist/engine/agent-api/GameEvidence.d.ts +148 -0
  106. package/dist/engine/agent-api/GameEvidence.d.ts.map +1 -0
  107. package/dist/engine/agent-api/GameEvidence.js +269 -0
  108. package/dist/engine/agent-api/GameEvidence.js.map +1 -0
  109. package/dist/engine/agent-api/GameRuntime.d.ts +931 -0
  110. package/dist/engine/agent-api/GameRuntime.d.ts.map +1 -0
  111. package/dist/engine/agent-api/GameRuntime.js +2229 -0
  112. package/dist/engine/agent-api/GameRuntime.js.map +1 -0
  113. package/dist/engine/agent-api/GameSceneBridge.d.ts +54 -0
  114. package/dist/engine/agent-api/GameSceneBridge.d.ts.map +1 -0
  115. package/dist/engine/agent-api/GameSceneBridge.js +110 -0
  116. package/dist/engine/agent-api/GameSceneBridge.js.map +1 -0
  117. package/dist/engine/agent-api/PromptAnimationContract.d.ts +278 -0
  118. package/dist/engine/agent-api/PromptAnimationContract.d.ts.map +1 -0
  119. package/dist/engine/agent-api/PromptAnimationContract.js +238 -0
  120. package/dist/engine/agent-api/PromptAnimationContract.js.map +1 -0
  121. package/dist/engine/agent-api/PromptAnimationEvidence.d.ts +183 -0
  122. package/dist/engine/agent-api/PromptAnimationEvidence.d.ts.map +1 -0
  123. package/dist/engine/agent-api/PromptAnimationEvidence.js +454 -0
  124. package/dist/engine/agent-api/PromptAnimationEvidence.js.map +1 -0
  125. package/dist/engine/agent-api/RuntimeNodeHandle.d.ts +100 -0
  126. package/dist/engine/agent-api/RuntimeNodeHandle.d.ts.map +1 -0
  127. package/dist/engine/agent-api/RuntimeNodeHandle.js +36 -0
  128. package/dist/engine/agent-api/RuntimeNodeHandle.js.map +1 -0
  129. package/dist/engine/agent-api/ShotTimeline.d.ts +179 -0
  130. package/dist/engine/agent-api/ShotTimeline.d.ts.map +1 -0
  131. package/dist/engine/agent-api/ShotTimeline.js +264 -0
  132. package/dist/engine/agent-api/ShotTimeline.js.map +1 -0
  133. package/dist/engine/agent-api/VisemeController.d.ts +89 -0
  134. package/dist/engine/agent-api/VisemeController.d.ts.map +1 -0
  135. package/dist/engine/agent-api/VisemeController.js +207 -0
  136. package/dist/engine/agent-api/VisemeController.js.map +1 -0
  137. package/dist/engine/agent-api/game-kits/fighting.d.ts +123 -0
  138. package/dist/engine/agent-api/game-kits/fighting.d.ts.map +1 -0
  139. package/dist/engine/agent-api/game-kits/fighting.js +483 -0
  140. package/dist/engine/agent-api/game-kits/fighting.js.map +1 -0
  141. package/dist/engine/agent-api/game-kits/index.d.ts +15 -0
  142. package/dist/engine/agent-api/game-kits/index.d.ts.map +1 -0
  143. package/dist/engine/agent-api/game-kits/index.js +6 -0
  144. package/dist/engine/agent-api/game-kits/index.js.map +1 -0
  145. package/dist/engine/agent-api/humanoid-walk-runtime.d.ts +1 -0
  146. package/dist/engine/agent-api/humanoid-walk-runtime.d.ts.map +1 -1
  147. package/dist/engine/agent-api/index.d.ts +487 -1
  148. package/dist/engine/agent-api/index.d.ts.map +1 -1
  149. package/dist/engine/agent-api/index.js +740 -6
  150. package/dist/engine/agent-api/index.js.map +1 -1
  151. package/dist/engine/agent-api/product-viewer-runtime.d.ts.map +1 -1
  152. package/dist/index.d.ts +1 -0
  153. package/dist/index.js +1 -0
  154. package/dist/physics/CollisionVolumes.d.ts +57 -0
  155. package/dist/physics/CollisionVolumes.d.ts.map +1 -0
  156. package/dist/physics/CollisionVolumes.js +159 -0
  157. package/dist/physics/CollisionVolumes.js.map +1 -0
  158. package/dist/physics/HitboxWorld.d.ts +229 -0
  159. package/dist/physics/HitboxWorld.d.ts.map +1 -0
  160. package/dist/physics/HitboxWorld.js +640 -0
  161. package/dist/physics/HitboxWorld.js.map +1 -0
  162. package/dist/physics/KinematicBody.d.ts +157 -0
  163. package/dist/physics/KinematicBody.d.ts.map +1 -0
  164. package/dist/physics/KinematicBody.js +405 -0
  165. package/dist/physics/KinematicBody.js.map +1 -0
  166. package/dist/physics/KinematicWorld.d.ts +58 -0
  167. package/dist/physics/KinematicWorld.d.ts.map +1 -0
  168. package/dist/physics/KinematicWorld.js +246 -0
  169. package/dist/physics/KinematicWorld.js.map +1 -0
  170. package/dist/physics/index.d.ts +4 -0
  171. package/dist/physics/index.d.ts.map +1 -1
  172. package/dist/physics/index.js +4 -0
  173. package/dist/physics/index.js.map +1 -1
  174. package/dist/rendering/ForwardPass.js +2 -2
  175. package/dist/rendering/ShaderLibrary.js +2 -2
  176. package/dist/rendering/SkinnedLitMaterial.js +3 -3
  177. package/dist/rendering/SkinnedUnlitMaterial.js +3 -3
  178. package/dist/scene/Renderable.js +2 -2
  179. package/dist/scripting/VisualGraph.d.ts +2 -1
  180. package/dist/scripting/VisualGraph.d.ts.map +1 -1
  181. package/dist/scripting/VisualGraph.js +118 -1
  182. package/dist/scripting/VisualGraph.js.map +1 -1
  183. package/dist/scripting/VisualGraphContext.d.ts +123 -0
  184. package/dist/scripting/VisualGraphContext.d.ts.map +1 -0
  185. package/dist/scripting/VisualGraphContext.js +2 -0
  186. package/dist/scripting/VisualGraphContext.js.map +1 -0
  187. package/dist/scripting/VisualGraphExecutor.d.ts +6 -1
  188. package/dist/scripting/VisualGraphExecutor.d.ts.map +1 -1
  189. package/dist/scripting/VisualGraphExecutor.js +364 -7
  190. package/dist/scripting/VisualGraphExecutor.js.map +1 -1
  191. package/dist/scripting/VisualNodeCatalog.d.ts +1 -1
  192. package/dist/scripting/VisualNodeCatalog.d.ts.map +1 -1
  193. package/dist/scripting/VisualNodeCatalog.js +61 -1
  194. package/dist/scripting/VisualNodeCatalog.js.map +1 -1
  195. package/dist/scripting/index.d.ts +1 -0
  196. package/dist/scripting/index.d.ts.map +1 -1
  197. package/dist/scripting/index.js.map +1 -1
  198. package/package.json +192 -118
package/README.md CHANGED
@@ -15,7 +15,30 @@ Use Aura3D when you are building browser 3D apps, prompt-authored scenes, produc
15
15
 
16
16
  ## Current release
17
17
 
18
- `@aura3d/engine@1.0.3` removes Three.js from the root engine runtime and npm dependency graph. The default Aura3D install now uses Aura-owned browser runtime code; Three.js migration support lives in the separately installed `@aura3d/three-compat` package.
18
+ `@aura3d/engine@1.0.5` is the current release candidate for browser-native game routes, visible GLB animation runtime evidence, prompt-cartoon playback, AuraVoice timing packages, typed assets, diagnostics, screenshots, and readiness evidence. The root engine runtime remains free of Three.js imports; Three.js migration support lives in the separately installed `@aura3d/three-compat` package.
19
+
20
+ Registry status before publish: npm `latest` still points at `@aura3d/engine@1.0.3`, and `@aura3d/cli` / `create-aura3d` must be published before the `npx ...@latest` commands below work for external users. Do not claim the 1.0.5 release is live until registry verification passes.
21
+
22
+ ## Aura3D 1.0.5 asset catalog
23
+
24
+ Aura3D 1.0.5 includes the catalog-first asset workflow for AI coding agents. When a prompt names a real object, agents should search the hosted Aura3D catalog before writing scene code:
25
+
26
+ ```bash
27
+ npx @aura3d/cli@latest assets search "battle-worn knight helmet"
28
+ npx @aura3d/cli@latest assets resolve "battle-worn knight helmet" --name helmet
29
+ ```
30
+
31
+ The resolver pulls only verified auto-pullable candidates into the existing typed asset pipeline, then scene code uses `model(assets.helmet)`. Unverified or marketplace candidates stay as deep-links until the user approves and supplies the asset.
32
+ ## Aura3D 1.0.5 runtime launch track
33
+
34
+ Aura3D 1.0.5 is the active runtime and animation evidence foundation for the next public showcase wave:
35
+
36
+ - `game runtime`: mutable runtime nodes, app-owned frame loops, input, kinematic bodies, hitboxes, combat events, camera direction, effects, and evidence for browser-native game routes.
37
+ - `fighting-game template`: `npx create-aura3d@latest my-fighter --template fighting-game` scaffolds a public-API playable starter using typed assets, `app.input(...)`, `app.onFrame(...)`, `game.kinematicBody(...)`, `game.combatWorld(...)`, and `app.evidence(...)`.
38
+ - `prompt animation`: `npx create-aura3d@latest my-episode --template prompt-cartoon-channel` scaffolds structured episode plans, storyboards, shot timelines, captions, visemes, render queues, and evidence for prompt-authored cartoon/video workflows. The shorter `cartoon-channel` template name remains supported.
39
+ - `AuraVoice bridge`: AuraVoice owns script/audio/caption/viseme timing; Aura3D owns typed scene generation, character performance, camera choreography, rendering, screenshots, and visual evidence.
40
+
41
+ Aura Clash requires Aura3D 1.0.5 runtime and animation evidence before it should be marketed as a polished public game showcase. Until the runtime, screenshot, route, GLB, package-smoke, and visual approval gates pass, Aura Clash remains a development showcase proving the direction of the public API.
19
42
 
20
43
  ## Install
21
44
 
@@ -58,20 +81,18 @@ import { createAuraApp, sceneKits } from "@aura3d/engine";
58
81
 
59
82
  ## Flagship game showcase
60
83
 
61
- World War X is Aura3D's production game proof: an original satirical 1v1 browser arena fighter built with `@aura3d/engine`.
84
+ AuraClash is the active Aura3D game-runtime proof target: an original 1v1 browser arena fighter built with `@aura3d/engine` public APIs.
62
85
 
63
86
  The showcase includes:
64
87
 
65
- - a 10-fighter G7+India+Russia+China roster;
66
- - generated fighter GLB assets;
88
+ - typed or validated stylized fighter assets;
67
89
  - typed asset members from `src/aura-assets.ts`;
68
90
  - `model(assets.x)` runtime usage;
69
91
  - arena primitives, lighting, effects, camera composition, and material polish;
70
- - arcade movement, hitboxes, projectiles, guard state, meter, AI pressure, and results;
71
- - Summit Remix prompt presets;
92
+ - arcade movement, hitboxes, guard state, meter, AI pressure, and results;
72
93
  - evidence routes, accessibility settings, poster capture, Playwright contracts, sitemap and robots integration, and marketing homepage placement.
73
94
 
74
- Open the route at `apps/world-war-x-showcase/`.
95
+ Open the source route at `apps/aura-clash-showcase/`.
75
96
 
76
97
  ## 30-second product viewer
77
98
 
@@ -89,6 +110,269 @@ createAuraApp("#app", {
89
110
 
90
111
  The safe API uses generated refs such as `assets.robot`. Do not write `model("robot")`, hand-written GLB URLs, or invented asset ids.
91
112
 
113
+ ## Aura3D 1.0.5 game runtime example
114
+
115
+ Add typed assets before writing model code:
116
+
117
+ ```bash
118
+ npx @aura3d/cli@latest assets add ./assets/fighter.glb --name fighter
119
+ npx @aura3d/cli@latest assets add ./assets/opponent.glb --name opponent
120
+ ```
121
+
122
+ Then use the public game facade and stage builders:
123
+
124
+ ```ts
125
+ import {
126
+ AnimationController,
127
+ createAuraApp,
128
+ game,
129
+ games,
130
+ lights,
131
+ model,
132
+ scene
133
+ } from "@aura3d/engine";
134
+ import { assets } from "./aura-assets";
135
+
136
+ const stage = games.fighting.stagePreset("neon-dojo");
137
+ const stageIssues = games.fighting.validateStage(stage);
138
+
139
+ const fighting = game.fighting({
140
+ playerId: "player",
141
+ opponentId: "opponent",
142
+ stage: { width: stage.combatBounds.maxX - stage.combatBounds.minX },
143
+ autoListen: true
144
+ });
145
+
146
+ const app = createAuraApp("#app", {
147
+ scene: stage.nodes
148
+ .reduce((builder, node) => builder.add(node), scene())
149
+ .add(model(assets.fighter).runtime(game.runtimeNode("player", { tags: ["fighter", "local"] })))
150
+ .add(model(assets.opponent).runtime(game.runtimeNode("opponent", { tags: ["fighter", "ai"] })))
151
+ .add(lights.studio())
152
+ });
153
+
154
+ const player = app.nodes.require("player");
155
+ const opponent = app.nodes.require("opponent");
156
+ const animation = new AnimationController({
157
+ clipRegistry: assets.fighter,
158
+ requiredClips: ["Idle", "Walk", "LightPunch"],
159
+ suppressRootMotion: true
160
+ });
161
+
162
+ const touchLayout = game.touchControls({
163
+ width: window.innerWidth,
164
+ height: window.innerHeight,
165
+ buttons: [
166
+ { action: "jump", label: "Jump", binding: "TouchJump" },
167
+ { action: "light", label: "Light", binding: "TouchLight" }
168
+ ]
169
+ });
170
+
171
+ const jumpAssist = game.jumpAssist({ coyoteMs: 100, bufferMs: 120 });
172
+ const hud = game.hud.bindings([
173
+ game.hud.health({ actorId: "player", label: "Player health" }),
174
+ game.hud.health({ actorId: "opponent", label: "Opponent health" }),
175
+ game.hud.timer({ valuePath: "round.timeRemaining" }),
176
+ game.hud.debugToggle({ action: "debug", statePath: "debug.visible" })
177
+ ]);
178
+ const accessibility = [
179
+ game.accessibility.label({ targetId: "player-health", label: "Player health", live: true }),
180
+ game.accessibility.pauseControls({ actions: ["pause", "Escape"], resumeActions: ["pause", "Enter"], menuId: "pause-menu" })
181
+ ];
182
+
183
+ app.onFrame(({ dt }) => {
184
+ const snapshot = fighting.update(dt);
185
+ animation.update(dt);
186
+
187
+ jumpAssist.update(dt, {
188
+ grounded: fighting.bodies.player.grounded,
189
+ jumpPressed: fighting.input.pressed("jump")
190
+ });
191
+ if (jumpAssist.consume()) fighting.bodies.player.jump();
192
+
193
+ if (fighting.input.pressed("light")) {
194
+ animation.crossFade("LightPunch", 0.08, { restart: true });
195
+ }
196
+
197
+ player.setPosition(snapshot.player.position[0], snapshot.player.position[1], snapshot.player.position[2]);
198
+ opponent.setPosition(snapshot.opponent.position[0], snapshot.opponent.position[1], snapshot.opponent.position[2]);
199
+ });
200
+
201
+ const replayPlan = game.inputReplay(fighting.input.recorded(), { fps: 60, label: "round-1" });
202
+ const replayInput = game.input({
203
+ actions: fighting.controls.actions,
204
+ axes: fighting.controls.axes,
205
+ autoListen: false
206
+ });
207
+ const replayDriver = game.inputReplayDriver(replayInput, replayPlan);
208
+
209
+ const colliders = [
210
+ game.collider.capsule({ id: "player-body", center: fighting.bodies.player.position, radius: 0.34, height: 1.7 }),
211
+ game.collider.capsule({ id: "opponent-body", center: fighting.bodies.opponent.position, radius: 0.34, height: 1.7 })
212
+ ];
213
+ const overlay = game.debug.overlay({
214
+ runtime: app.runtime,
215
+ input: fighting.input,
216
+ bodies: [fighting.bodies.player, fighting.bodies.opponent],
217
+ combat: fighting.combat,
218
+ effects: fighting.effects,
219
+ camera: fighting.camera,
220
+ colliders,
221
+ warnings: stageIssues.map((issue) => issue.message)
222
+ });
223
+
224
+ const evidence = app.evidence({
225
+ input: fighting.input,
226
+ bodies: [fighting.bodies.player, fighting.bodies.opponent],
227
+ combat: fighting.combat,
228
+ effects: fighting.effects,
229
+ camera: fighting.camera,
230
+ hud,
231
+ accessibility,
232
+ stage: { id: stage.id, safeZones: true, bounds: stage.combatBounds, warnings: stageIssues.map((issue) => issue.message) }
233
+ });
234
+
235
+ console.log(touchLayout.controls.length, replayDriver.snapshot(), overlay.sections, evidence.systems);
236
+ ```
237
+
238
+ ## Aura3D 1.0.5 prompt-cartoon and AuraVoice example
239
+
240
+ Prompt-cartoon routes use typed assets, contract artifacts, shot playback, captions, visemes, and AuraVoice timing packages.
241
+
242
+ ```ts
243
+ import {
244
+ collectPromptAnimationEvidence,
245
+ compilePromptEpisodePlan,
246
+ createAudioStemManifest,
247
+ createAuraApp,
248
+ createAuraVoiceBridgePackage,
249
+ createAuraVoiceVisemeTrack,
250
+ createCartoonRenderOutputPackageMetadata,
251
+ createGlbBlendshapeVisemeCue,
252
+ createPrimitiveMouthVisemeCues,
253
+ createShotPlaybackPlan,
254
+ evaluatePromptAnimationPublishReadiness,
255
+ game,
256
+ installShotPlayback,
257
+ lights,
258
+ model,
259
+ scene,
260
+ sampleAuraVoiceBridgeAtTime,
261
+ validateAuraVoiceBridgePackage
262
+ } from "@aura3d/engine";
263
+ import { assets } from "./aura-assets";
264
+
265
+ const plan = compilePromptEpisodePlan({
266
+ episodeId: "moon-garden",
267
+ title: "Moon Garden Helpers",
268
+ prompt: "Two robots clean a glowing moon garden.",
269
+ language: "en",
270
+ runtime: { duration: 30, frameRate: 30, resolution: { width: 1280, height: 720 }, maxTimingDriftFrames: 1 },
271
+ characters: [
272
+ { id: "miko", name: "Miko", role: "hero", asset: assets.miko },
273
+ { id: "luma", name: "Luma", role: "sidekick", asset: assets.luma }
274
+ ],
275
+ locations: [{ id: "moon-garden", name: "Moon Garden", mood: "soft neon bedtime" }],
276
+ beats: [
277
+ {
278
+ id: "beat-001",
279
+ locationId: "moon-garden",
280
+ summary: "Miko and Luma clean the glowing weeds.",
281
+ visualIntent: "Two readable typed characters, safe captions, and gentle light.",
282
+ duration: 8,
283
+ characters: ["miko", "luma"],
284
+ dialogue: [{ speakerId: "miko", text: "The moon garden is glowing again.", emotion: "curious" }]
285
+ }
286
+ ],
287
+ route: "/episodes/moon-garden"
288
+ });
289
+
290
+ const visemes = createAuraVoiceVisemeTrack({
291
+ episodeId: plan.episodePlan.episodeId,
292
+ language: plan.episodePlan.language,
293
+ frameRate: plan.shotTimeline.frameRate,
294
+ cues: plan.dialogueTrack.lines.flatMap((line) =>
295
+ createPrimitiveMouthVisemeCues({
296
+ characterId: line.speakerId,
297
+ speakerId: line.speakerId,
298
+ lineId: line.lineId,
299
+ startTime: line.startTime,
300
+ endTime: line.endTime
301
+ }).map((cue) => createGlbBlendshapeVisemeCue(cue))
302
+ )
303
+ });
304
+
305
+ const audioStems = createAudioStemManifest({
306
+ episodeId: plan.episodePlan.episodeId,
307
+ duration: plan.dialogueTrack.duration,
308
+ stems: plan.dialogueTrack.lines.map((line) => ({
309
+ id: `audio:${line.lineId}`,
310
+ role: "dialogue",
311
+ path: line.audioFile ?? `assets/audio/${line.language}/${line.lineId}.wav`,
312
+ startTime: line.startTime,
313
+ duration: line.endTime - line.startTime,
314
+ language: line.language
315
+ }))
316
+ });
317
+
318
+ const renderOutputPackage = createCartoonRenderOutputPackageMetadata({
319
+ episodePlan: plan.episodePlan,
320
+ shotTimeline: plan.shotTimeline,
321
+ renderQueue: plan.renderQueue
322
+ });
323
+
324
+ const bridge = createAuraVoiceBridgePackage({
325
+ episodePlan: plan.episodePlan,
326
+ storyboard: plan.storyboard,
327
+ shotTimeline: plan.shotTimeline,
328
+ dialogueTrack: plan.dialogueTrack,
329
+ captionTrack: plan.captionTrack,
330
+ visemes,
331
+ audioStems,
332
+ renderQueue: plan.renderQueue,
333
+ renderOutputPackage
334
+ });
335
+ const bridgeIssues = validateAuraVoiceBridgePackage(bridge);
336
+
337
+ const playback = createShotPlaybackPlan({
338
+ timeline: plan.shotTimeline,
339
+ performance: plan.performance,
340
+ captions: plan.captionTrack,
341
+ visemes,
342
+ runtimeNodeByCharacterId: { miko: "miko", luma: "luma" },
343
+ loop: true
344
+ });
345
+
346
+ const app = createAuraApp("#app", {
347
+ scene: scene()
348
+ .add(model(assets.miko).runtime(game.runtimeNode("miko", { tags: ["character"] })))
349
+ .add(model(assets.luma).runtime(game.runtimeNode("luma", { tags: ["character"] })))
350
+ .add(lights.studio())
351
+ });
352
+ installShotPlayback(app, playback);
353
+
354
+ const sample = sampleAuraVoiceBridgeAtTime(bridge, 3);
355
+ const evidence = collectPromptAnimationEvidence({
356
+ bridgePackage: bridge,
357
+ screenshots: [
358
+ {
359
+ id: "shot-001",
360
+ time: sample.time,
361
+ path: "artifacts/screenshots/shot-001.png",
362
+ hash: "sha256:replace-with-rendered-screenshot-hash",
363
+ width: 1280,
364
+ height: 720
365
+ }
366
+ ],
367
+ routeHealth: { status: "pass" }
368
+ });
369
+ const readiness = evaluatePromptAnimationPublishReadiness(evidence);
370
+
371
+ console.log(bridgeIssues, evidence.publishReady, readiness.ready);
372
+ ```
373
+
374
+ Do not publish placeholder screenshot hashes. Deterministic render output must replace the placeholder before a prompt-cartoon or AuraVoice route is called publish-ready.
375
+
92
376
  ## Prompt-to-3D scene kits
93
377
 
94
378
  Use scene kits when an AI prompt asks for generated 3D systems rather than a supplied model.
@@ -143,6 +427,24 @@ pnpm run check:release
143
427
 
144
428
  Use release checks to confirm package integrity, generated assets, examples, and static deployment output before shipping.
145
429
 
430
+ Aura3D 1.0.5 route-specific readiness commands:
431
+
432
+ ```bash
433
+ npx @aura3d/cli@latest assets validate-game
434
+ npx @aura3d/cli@latest assets validate-cartoon
435
+ npx @aura3d/cli@latest check-deploy --dist dist
436
+ pnpm game-runtime:docs
437
+ pnpm game-runtime:template
438
+ pnpm game-runtime:package
439
+ pnpm game-runtime:release
440
+ pnpm prompt-animation:docs
441
+ pnpm prompt-animation:template
442
+ pnpm prompt-animation:package
443
+ pnpm prompt-animation:release
444
+ ```
445
+
446
+ Do not mark a game, prompt-cartoon, or AuraVoice route launch-ready from source evidence alone. Asset readiness, package smoke, browser route health, deterministic screenshots, visual review, accessibility proof, and deployment checks must also pass.
447
+
146
448
  ## Contributing
147
449
 
148
450
  Star the repo if you want AI-native browser 3D tooling for TypeScript, WebGL, WebGPU, GLB/glTF assets, product viewers, prompt-to-3D scenes, and deployable 3D websites. Open issues with the prompt, package version, asset source or license, commands run, route-health output, screenshots, and deploy context.
@@ -0,0 +1,57 @@
1
+ export type AnimationPlaybackDirection = 1 | -1;
2
+ export type AnimationClipEventType = "marker" | "hitbox" | "hurtbox" | "footstep" | "sfx" | "vfx" | "camera" | "state" | "custom" | (string & {});
3
+ export interface AnimationClipEvent<TName extends string = string, TPayload = unknown> {
4
+ readonly id?: string;
5
+ readonly name: TName;
6
+ readonly type?: AnimationClipEventType;
7
+ readonly time: number;
8
+ readonly duration?: number;
9
+ readonly payload?: TPayload;
10
+ readonly once?: boolean;
11
+ readonly tags?: readonly string[];
12
+ }
13
+ export interface AnimationClipEventSource<TEvent extends AnimationClipEvent = AnimationClipEvent> {
14
+ readonly id: string;
15
+ readonly duration: number;
16
+ readonly events?: readonly TEvent[];
17
+ }
18
+ export interface AnimationClipEventSamplingOptions {
19
+ readonly from: number;
20
+ readonly to: number;
21
+ readonly duration?: number;
22
+ readonly loop?: boolean;
23
+ readonly direction?: AnimationPlaybackDirection;
24
+ readonly includeStart?: boolean;
25
+ readonly includeEnd?: boolean;
26
+ readonly loopCount?: number;
27
+ readonly playbackTime?: number;
28
+ }
29
+ export interface AnimationClipEventInvocation<TEvent extends AnimationClipEvent = AnimationClipEvent, TClipId extends string = string> {
30
+ readonly clipId: TClipId;
31
+ readonly event: TEvent;
32
+ readonly time: number;
33
+ readonly previousTime: number;
34
+ readonly localTime: number;
35
+ readonly normalizedTime: number;
36
+ readonly loopCount: number;
37
+ readonly direction: AnimationPlaybackDirection;
38
+ readonly playbackTime?: number;
39
+ }
40
+ export type AnimationClipEventListener<TPayload> = (payload: TPayload) => void;
41
+ export type AnimationClipEventUnsubscribe = () => void;
42
+ export declare class AnimationEventDispatcher<TEventMap = Record<string, unknown>> {
43
+ private readonly listeners;
44
+ on<K extends Extract<keyof TEventMap, string>>(type: K, listener: AnimationClipEventListener<TEventMap[K]>): AnimationClipEventUnsubscribe;
45
+ once<K extends Extract<keyof TEventMap, string>>(type: K, listener: AnimationClipEventListener<TEventMap[K]>): AnimationClipEventUnsubscribe;
46
+ off<K extends Extract<keyof TEventMap, string>>(type: K, listener: AnimationClipEventListener<TEventMap[K]>): void;
47
+ emit<K extends Extract<keyof TEventMap, string>>(type: K, payload: TEventMap[K]): void;
48
+ clear(type?: Extract<keyof TEventMap, string>): void;
49
+ listenerCount(type?: Extract<keyof TEventMap, string>): number;
50
+ }
51
+ export declare function createAnimationClipEvent<TName extends string, TPayload = unknown>(name: TName, time: number, options?: Omit<AnimationClipEvent<TName, TPayload>, "name" | "time">): AnimationClipEvent<TName, TPayload>;
52
+ export declare function normalizeClipEvents<TEvent extends AnimationClipEvent>(events?: readonly TEvent[]): readonly TEvent[];
53
+ export declare function animationClipEventKey(clipId: string, event: AnimationClipEvent): string;
54
+ export declare function sampleClipEvents<TEvent extends AnimationClipEvent, TClipId extends string = string>(source: AnimationClipEventSource<TEvent> & {
55
+ readonly id: TClipId;
56
+ }, options: AnimationClipEventSamplingOptions): AnimationClipEventInvocation<TEvent, TClipId>[];
57
+ //# sourceMappingURL=AnimationClipEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimationClipEvents.d.ts","sourceRoot":"","sources":["../../../../packages/animation/src/AnimationClipEvents.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhD,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,QAAQ,GACR,SAAS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,171 @@
1
+ export class AnimationEventDispatcher {
2
+ listeners = new Map();
3
+ on(type, listener) {
4
+ const listeners = this.listeners.get(type) ?? new Set();
5
+ listeners.add(listener);
6
+ this.listeners.set(type, listeners);
7
+ return () => {
8
+ this.off(type, listener);
9
+ };
10
+ }
11
+ once(type, listener) {
12
+ const unsubscribe = this.on(type, (payload) => {
13
+ unsubscribe();
14
+ listener(payload);
15
+ });
16
+ return unsubscribe;
17
+ }
18
+ off(type, listener) {
19
+ const listeners = this.listeners.get(type);
20
+ if (!listeners)
21
+ return;
22
+ listeners.delete(listener);
23
+ if (listeners.size === 0) {
24
+ this.listeners.delete(type);
25
+ }
26
+ }
27
+ emit(type, payload) {
28
+ const listeners = this.listeners.get(type);
29
+ if (!listeners)
30
+ return;
31
+ for (const listener of [...listeners]) {
32
+ listener(payload);
33
+ }
34
+ }
35
+ clear(type) {
36
+ if (type) {
37
+ this.listeners.delete(type);
38
+ return;
39
+ }
40
+ this.listeners.clear();
41
+ }
42
+ listenerCount(type) {
43
+ if (type) {
44
+ return this.listeners.get(type)?.size ?? 0;
45
+ }
46
+ let count = 0;
47
+ for (const listeners of this.listeners.values()) {
48
+ count += listeners.size;
49
+ }
50
+ return count;
51
+ }
52
+ }
53
+ export function createAnimationClipEvent(name, time, options = {}) {
54
+ return {
55
+ ...options,
56
+ name,
57
+ time
58
+ };
59
+ }
60
+ export function normalizeClipEvents(events = []) {
61
+ return [...events].sort((a, b) => {
62
+ if (a.time !== b.time)
63
+ return a.time - b.time;
64
+ return a.name.localeCompare(b.name);
65
+ });
66
+ }
67
+ export function animationClipEventKey(clipId, event) {
68
+ return `${clipId}:${event.id ?? event.name}:${event.type ?? "marker"}:${event.time}`;
69
+ }
70
+ export function sampleClipEvents(source, options) {
71
+ const events = normalizeClipEvents(source.events);
72
+ if (events.length === 0)
73
+ return [];
74
+ const duration = sanitizeDuration(options.duration ?? source.duration);
75
+ const direction = options.direction ?? (options.to >= options.from ? 1 : -1);
76
+ const includeStart = options.includeStart ?? false;
77
+ const includeEnd = options.includeEnd ?? true;
78
+ const loopCount = options.loopCount ?? 0;
79
+ const playbackTime = options.playbackTime;
80
+ if (duration === 0) {
81
+ return events
82
+ .filter((event) => event.time === 0 && includesBoundary(includeStart, includeEnd))
83
+ .map((event) => createInvocation(source.id, event, options.from, 0, duration, loopCount, direction, playbackTime));
84
+ }
85
+ const from = normalizeLocalTime(options.from, duration, options.loop ?? false);
86
+ const to = normalizeLocalTime(options.to, duration, options.loop ?? false);
87
+ const segments = createSamplingSegments(from, to, duration, options.loop ?? false, direction);
88
+ const invocations = [];
89
+ for (let segmentIndex = 0; segmentIndex < segments.length; segmentIndex += 1) {
90
+ const segment = segments[segmentIndex];
91
+ const segmentIncludeStart = segmentIndex === 0 ? includeStart : true;
92
+ const segmentIncludeEnd = segmentIndex === segments.length - 1 ? includeEnd : true;
93
+ const matching = events.filter((event) => eventInSegment(event.time, segment.start, segment.end, segmentIncludeStart, segmentIncludeEnd));
94
+ if (direction === -1) {
95
+ matching.reverse();
96
+ }
97
+ for (const event of matching) {
98
+ invocations.push(createInvocation(source.id, event, options.from, event.time, duration, loopCount + segment.loopOffset, direction, playbackTime));
99
+ }
100
+ }
101
+ return invocations;
102
+ }
103
+ function createSamplingSegments(from, to, duration, loop, direction) {
104
+ if (!loop) {
105
+ return [
106
+ {
107
+ start: Math.min(from, to),
108
+ end: Math.max(from, to),
109
+ loopOffset: 0
110
+ }
111
+ ];
112
+ }
113
+ if (direction === 1) {
114
+ if (to >= from) {
115
+ return [{ start: from, end: to, loopOffset: 0 }];
116
+ }
117
+ return [
118
+ { start: from, end: duration, loopOffset: 0 },
119
+ { start: 0, end: to, loopOffset: 1 }
120
+ ];
121
+ }
122
+ if (to <= from) {
123
+ return [{ start: to, end: from, loopOffset: 0 }];
124
+ }
125
+ return [
126
+ { start: 0, end: from, loopOffset: 0 },
127
+ { start: to, end: duration, loopOffset: 1 }
128
+ ];
129
+ }
130
+ function createInvocation(clipId, event, previousTime, localTime, duration, loopCount, direction, playbackTime) {
131
+ return {
132
+ clipId,
133
+ event,
134
+ time: event.time,
135
+ previousTime,
136
+ localTime,
137
+ normalizedTime: duration > 0 ? event.time / duration : 0,
138
+ loopCount,
139
+ direction,
140
+ playbackTime
141
+ };
142
+ }
143
+ function eventInSegment(time, start, end, includeStart, includeEnd) {
144
+ const startsAfter = includeStart ? time >= start : time > start;
145
+ const endsBefore = includeEnd ? time <= end : time < end;
146
+ return startsAfter && endsBefore;
147
+ }
148
+ function includesBoundary(includeStart, includeEnd) {
149
+ return includeStart || includeEnd;
150
+ }
151
+ function normalizeLocalTime(time, duration, loop) {
152
+ if (!Number.isFinite(time))
153
+ return 0;
154
+ if (!loop)
155
+ return clamp(time, 0, duration);
156
+ return positiveModulo(time, duration);
157
+ }
158
+ function sanitizeDuration(duration) {
159
+ if (!Number.isFinite(duration) || duration <= 0)
160
+ return 0;
161
+ return duration;
162
+ }
163
+ function positiveModulo(value, divisor) {
164
+ if (divisor <= 0)
165
+ return 0;
166
+ return ((value % divisor) + divisor) % divisor;
167
+ }
168
+ function clamp(value, min, max) {
169
+ return Math.min(max, Math.max(min, value));
170
+ }
171
+ //# sourceMappingURL=AnimationClipEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimationClipEvents.js","sourceRoot":"","sources":["../../../../packages/animation/src/AnimationClipEvents.ts"],"names":[],"mappings":"AA6DA,MAAM,OAAO,wBAAwB;IAClB,SAAS,GAAG,IAAI,GAAG,EAAoD,CAAC;IAEzF,EAAE,CACA,IAAO,EACP,QAAkD;QAElD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAuC,CAAC;QAC7F,SAAS,CAAC,GAAG,CAAC,QAA+C,CAAC,CAAC;QAC/D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAEpC,OAAO,GAAG,EAAE;YACV,IAAI,CAA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