@vib3code/sdk 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +34 -0
  3. package/DOCS/CI_TESTING.md +38 -0
  4. package/DOCS/CLI_ONBOARDING.md +75 -0
  5. package/DOCS/CONTROL_REFERENCE.md +64 -0
  6. package/DOCS/DEV_TRACK_ANALYSIS.md +77 -0
  7. package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +42 -0
  8. package/DOCS/DEV_TRACK_SESSION_2026-01-31.md +220 -0
  9. package/DOCS/ENV_SETUP.md +189 -0
  10. package/DOCS/EXPORT_FORMATS.md +417 -0
  11. package/DOCS/GPU_DISPOSAL_GUIDE.md +21 -0
  12. package/DOCS/LICENSING_TIERS.md +275 -0
  13. package/DOCS/MASTER_PLAN_2026-01-31.md +570 -0
  14. package/DOCS/OBS_SETUP_GUIDE.md +98 -0
  15. package/DOCS/PROJECT_SETUP.md +66 -0
  16. package/DOCS/RENDERER_LIFECYCLE.md +40 -0
  17. package/DOCS/REPO_MANIFEST.md +121 -0
  18. package/DOCS/SESSION_014_PLAN.md +195 -0
  19. package/DOCS/SESSION_LOG_2026-01-07.md +56 -0
  20. package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +72 -0
  21. package/DOCS/SYSTEM_AUDIT_2026-01-30.md +738 -0
  22. package/DOCS/SYSTEM_INVENTORY.md +520 -0
  23. package/DOCS/TELEMETRY_EXPORTS.md +34 -0
  24. package/DOCS/WEBGPU_STATUS.md +38 -0
  25. package/DOCS/XR_BENCHMARKS.md +608 -0
  26. package/LICENSE +21 -0
  27. package/README.md +426 -0
  28. package/docs/.nojekyll +0 -0
  29. package/docs/01-dissolution_of_euclidean_hegemony.html +346 -0
  30. package/docs/02-hyperspatial_ego_death.html +346 -0
  31. package/docs/03-post_cartesian_sublime.html +346 -0
  32. package/docs/04-crystalline_void_meditation.html +346 -0
  33. package/docs/05-quantum_decoherence_ballet.html +346 -0
  34. package/docs/06-dissolution_of_euclidean_hegemony.html +346 -0
  35. package/docs/07-hyperspatial_ego_death.html +346 -0
  36. package/docs/08-post_cartesian_sublime.html +346 -0
  37. package/docs/09-crystalline_void_meditation.html +346 -0
  38. package/docs/10-quantum_decoherence_ballet.html +346 -0
  39. package/docs/11-dissolution_of_euclidean_hegemony.html +346 -0
  40. package/docs/12-hyperspatial_ego_death.html +346 -0
  41. package/docs/13-post_cartesian_sublime.html +346 -0
  42. package/docs/index.html +794 -0
  43. package/docs/test-hub.html +441 -0
  44. package/docs/url-state.js +102 -0
  45. package/docs/vib3-exports/01-quantum-quantum-tetrahedron-lattice.html +489 -0
  46. package/docs/vib3-exports/02-quantum-quantum-hypersphere-matrix.html +489 -0
  47. package/docs/vib3-exports/03-quantum-quantum-hypertetra-fractal.html +489 -0
  48. package/docs/vib3-exports/04-faceted-faceted-crystal-structure.html +407 -0
  49. package/docs/vib3-exports/05-faceted-faceted-klein-bottle.html +407 -0
  50. package/docs/vib3-exports/06-faceted-faceted-hypertetra-torus.html +407 -0
  51. package/docs/vib3-exports/07-holographic-holographic-wave-field.html +457 -0
  52. package/docs/vib3-exports/08-holographic-holographic-hypersphere-sphere.html +457 -0
  53. package/docs/vib3-exports/09-holographic-holographic-hypertetra-crystal.html +457 -0
  54. package/docs/vib3-exports/index.html +238 -0
  55. package/docs/webgpu-live.html +702 -0
  56. package/package.json +367 -0
  57. package/src/advanced/AIPresetGenerator.js +777 -0
  58. package/src/advanced/MIDIController.js +703 -0
  59. package/src/advanced/OffscreenWorker.js +1051 -0
  60. package/src/advanced/WebGPUCompute.js +1051 -0
  61. package/src/advanced/WebXRRenderer.js +680 -0
  62. package/src/agent/cli/AgentCLI.js +615 -0
  63. package/src/agent/cli/index.js +14 -0
  64. package/src/agent/index.js +73 -0
  65. package/src/agent/mcp/MCPServer.js +950 -0
  66. package/src/agent/mcp/index.js +9 -0
  67. package/src/agent/mcp/tools.js +548 -0
  68. package/src/agent/telemetry/EventStream.js +669 -0
  69. package/src/agent/telemetry/Instrumentation.js +618 -0
  70. package/src/agent/telemetry/TelemetryExporters.js +427 -0
  71. package/src/agent/telemetry/TelemetryService.js +464 -0
  72. package/src/agent/telemetry/index.js +52 -0
  73. package/src/benchmarks/BenchmarkRunner.js +381 -0
  74. package/src/benchmarks/MetricsCollector.js +299 -0
  75. package/src/benchmarks/index.js +9 -0
  76. package/src/benchmarks/scenes.js +259 -0
  77. package/src/cli/index.js +675 -0
  78. package/src/config/ApiConfig.js +88 -0
  79. package/src/core/CanvasManager.js +217 -0
  80. package/src/core/ErrorReporter.js +117 -0
  81. package/src/core/ParameterMapper.js +333 -0
  82. package/src/core/Parameters.js +396 -0
  83. package/src/core/RendererContracts.js +200 -0
  84. package/src/core/UnifiedResourceManager.js +370 -0
  85. package/src/core/VIB3Engine.js +636 -0
  86. package/src/core/renderers/FacetedRendererAdapter.js +32 -0
  87. package/src/core/renderers/HolographicRendererAdapter.js +29 -0
  88. package/src/core/renderers/QuantumRendererAdapter.js +29 -0
  89. package/src/core/renderers/RendererLifecycleManager.js +63 -0
  90. package/src/creative/ColorPresetsSystem.js +980 -0
  91. package/src/creative/ParameterTimeline.js +1061 -0
  92. package/src/creative/PostProcessingPipeline.js +1113 -0
  93. package/src/creative/TransitionAnimator.js +683 -0
  94. package/src/export/CSSExporter.js +226 -0
  95. package/src/export/CardGeneratorBase.js +279 -0
  96. package/src/export/ExportManager.js +580 -0
  97. package/src/export/FacetedCardGenerator.js +279 -0
  98. package/src/export/HolographicCardGenerator.js +543 -0
  99. package/src/export/LottieExporter.js +552 -0
  100. package/src/export/QuantumCardGenerator.js +315 -0
  101. package/src/export/SVGExporter.js +519 -0
  102. package/src/export/ShaderExporter.js +903 -0
  103. package/src/export/TradingCardGenerator.js +3055 -0
  104. package/src/export/TradingCardManager.js +181 -0
  105. package/src/export/VIB3PackageExporter.js +559 -0
  106. package/src/export/index.js +14 -0
  107. package/src/export/systems/TradingCardSystemFaceted.js +494 -0
  108. package/src/export/systems/TradingCardSystemHolographic.js +452 -0
  109. package/src/export/systems/TradingCardSystemQuantum.js +411 -0
  110. package/src/faceted/FacetedSystem.js +963 -0
  111. package/src/features/CollectionManager.js +433 -0
  112. package/src/gallery/CollectionManager.js +240 -0
  113. package/src/gallery/GallerySystem.js +485 -0
  114. package/src/geometry/GeometryFactory.js +314 -0
  115. package/src/geometry/GeometryLibrary.js +72 -0
  116. package/src/geometry/buffers/BufferBuilder.js +338 -0
  117. package/src/geometry/buffers/index.js +18 -0
  118. package/src/geometry/generators/Crystal.js +420 -0
  119. package/src/geometry/generators/Fractal.js +298 -0
  120. package/src/geometry/generators/KleinBottle.js +197 -0
  121. package/src/geometry/generators/Sphere.js +192 -0
  122. package/src/geometry/generators/Tesseract.js +160 -0
  123. package/src/geometry/generators/Tetrahedron.js +225 -0
  124. package/src/geometry/generators/Torus.js +304 -0
  125. package/src/geometry/generators/Wave.js +341 -0
  126. package/src/geometry/index.js +142 -0
  127. package/src/geometry/warp/HypersphereCore.js +211 -0
  128. package/src/geometry/warp/HypertetraCore.js +386 -0
  129. package/src/geometry/warp/index.js +57 -0
  130. package/src/holograms/HolographicVisualizer.js +1073 -0
  131. package/src/holograms/RealHolographicSystem.js +966 -0
  132. package/src/holograms/variantRegistry.js +69 -0
  133. package/src/integrations/FigmaPlugin.js +854 -0
  134. package/src/integrations/OBSMode.js +754 -0
  135. package/src/integrations/ThreeJsPackage.js +660 -0
  136. package/src/integrations/TouchDesignerExport.js +552 -0
  137. package/src/integrations/frameworks/Vib3React.js +591 -0
  138. package/src/integrations/frameworks/Vib3Svelte.js +654 -0
  139. package/src/integrations/frameworks/Vib3Vue.js +628 -0
  140. package/src/llm/LLMParameterInterface.js +240 -0
  141. package/src/llm/LLMParameterUI.js +577 -0
  142. package/src/math/Mat4x4.js +708 -0
  143. package/src/math/Projection.js +341 -0
  144. package/src/math/Rotor4D.js +637 -0
  145. package/src/math/Vec4.js +476 -0
  146. package/src/math/constants.js +164 -0
  147. package/src/math/index.js +68 -0
  148. package/src/math/projections.js +54 -0
  149. package/src/math/rotations.js +196 -0
  150. package/src/quantum/QuantumEngine.js +906 -0
  151. package/src/quantum/QuantumVisualizer.js +1103 -0
  152. package/src/reactivity/ReactivityConfig.js +499 -0
  153. package/src/reactivity/ReactivityManager.js +586 -0
  154. package/src/reactivity/SpatialInputSystem.js +1783 -0
  155. package/src/reactivity/index.js +93 -0
  156. package/src/render/CommandBuffer.js +465 -0
  157. package/src/render/MultiCanvasBridge.js +340 -0
  158. package/src/render/RenderCommand.js +514 -0
  159. package/src/render/RenderResourceRegistry.js +523 -0
  160. package/src/render/RenderState.js +552 -0
  161. package/src/render/RenderTarget.js +512 -0
  162. package/src/render/ShaderLoader.js +253 -0
  163. package/src/render/ShaderProgram.js +599 -0
  164. package/src/render/UnifiedRenderBridge.js +496 -0
  165. package/src/render/backends/WebGLBackend.js +1108 -0
  166. package/src/render/backends/WebGPUBackend.js +1409 -0
  167. package/src/render/commands/CommandBufferExecutor.js +607 -0
  168. package/src/render/commands/RenderCommandBuffer.js +661 -0
  169. package/src/render/commands/index.js +17 -0
  170. package/src/render/index.js +367 -0
  171. package/src/scene/Disposable.js +498 -0
  172. package/src/scene/MemoryPool.js +618 -0
  173. package/src/scene/Node4D.js +697 -0
  174. package/src/scene/ResourceManager.js +599 -0
  175. package/src/scene/Scene4D.js +540 -0
  176. package/src/scene/index.js +98 -0
  177. package/src/schemas/error.schema.json +84 -0
  178. package/src/schemas/extension.schema.json +88 -0
  179. package/src/schemas/index.js +214 -0
  180. package/src/schemas/parameters.schema.json +142 -0
  181. package/src/schemas/tool-pack.schema.json +44 -0
  182. package/src/schemas/tool-response.schema.json +127 -0
  183. package/src/shaders/common/fullscreen.vert.glsl +5 -0
  184. package/src/shaders/common/fullscreen.vert.wgsl +17 -0
  185. package/src/shaders/common/geometry24.glsl +65 -0
  186. package/src/shaders/common/geometry24.wgsl +54 -0
  187. package/src/shaders/common/rotation4d.glsl +85 -0
  188. package/src/shaders/common/rotation4d.wgsl +86 -0
  189. package/src/shaders/common/uniforms.glsl +44 -0
  190. package/src/shaders/common/uniforms.wgsl +48 -0
  191. package/src/shaders/faceted/faceted.frag.glsl +129 -0
  192. package/src/shaders/faceted/faceted.frag.wgsl +164 -0
  193. package/src/shaders/holographic/holographic.frag.glsl +406 -0
  194. package/src/shaders/holographic/holographic.frag.wgsl +185 -0
  195. package/src/shaders/quantum/quantum.frag.glsl +513 -0
  196. package/src/shaders/quantum/quantum.frag.wgsl +361 -0
  197. package/src/testing/ParallelTestFramework.js +519 -0
  198. package/src/testing/__snapshots__/exportFormats.test.js.snap +24 -0
  199. package/src/testing/exportFormats.test.js +8 -0
  200. package/src/testing/projections.test.js +14 -0
  201. package/src/testing/rotations.test.js +37 -0
  202. package/src/ui/InteractivityMenu.js +516 -0
  203. package/src/ui/StatusManager.js +96 -0
  204. package/src/ui/adaptive/renderers/webgpu/BufferLayout.ts +252 -0
  205. package/src/ui/adaptive/renderers/webgpu/PolytopeInstanceBuffer.ts +144 -0
  206. package/src/ui/adaptive/renderers/webgpu/TripleBufferedUniform.ts +170 -0
  207. package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +735 -0
  208. package/src/ui/adaptive/renderers/webgpu/index.ts +112 -0
  209. package/src/variations/VariationManager.js +431 -0
  210. package/src/viewer/AudioReactivity.js +505 -0
  211. package/src/viewer/CardBending.js +481 -0
  212. package/src/viewer/GalleryUI.js +832 -0
  213. package/src/viewer/ReactivityManager.js +590 -0
  214. package/src/viewer/TradingCardExporter.js +600 -0
  215. package/src/viewer/ViewerPortal.js +374 -0
  216. package/src/viewer/index.js +12 -0
  217. package/src/wasm/WasmLoader.js +296 -0
  218. package/src/wasm/index.js +132 -0
  219. package/tools/agentic/mcpTools.js +88 -0
  220. package/tools/cli/agent-cli.js +92 -0
  221. package/tools/export/formats.js +24 -0
  222. package/tools/math/rotation-baseline.mjs +64 -0
  223. package/tools/shader-sync-verify.js +937 -0
  224. package/tools/telemetry/manifestPipeline.js +141 -0
  225. package/tools/telemetry/telemetryEvents.js +35 -0
  226. package/types/adaptive-sdk.d.ts +185 -0
  227. package/types/advanced/AIPresetGenerator.d.ts +81 -0
  228. package/types/advanced/MIDIController.d.ts +100 -0
  229. package/types/advanced/OffscreenWorker.d.ts +82 -0
  230. package/types/advanced/WebGPUCompute.d.ts +52 -0
  231. package/types/advanced/WebXRRenderer.d.ts +77 -0
  232. package/types/advanced/index.d.ts +46 -0
  233. package/types/core/ErrorReporter.d.ts +50 -0
  234. package/types/core/VIB3Engine.d.ts +204 -0
  235. package/types/creative/ColorPresetsSystem.d.ts +91 -0
  236. package/types/creative/ParameterTimeline.d.ts +74 -0
  237. package/types/creative/PostProcessingPipeline.d.ts +109 -0
  238. package/types/creative/TransitionAnimator.d.ts +71 -0
  239. package/types/creative/index.d.ts +35 -0
  240. package/types/integrations/FigmaPlugin.d.ts +46 -0
  241. package/types/integrations/OBSMode.d.ts +74 -0
  242. package/types/integrations/ThreeJsPackage.d.ts +62 -0
  243. package/types/integrations/TouchDesignerExport.d.ts +36 -0
  244. package/types/integrations/Vib3React.d.ts +74 -0
  245. package/types/integrations/Vib3Svelte.d.ts +63 -0
  246. package/types/integrations/Vib3Vue.d.ts +55 -0
  247. package/types/integrations/index.d.ts +52 -0
  248. package/types/reactivity/SpatialInputSystem.d.ts +173 -0
  249. package/types/reactivity/index.d.ts +394 -0
  250. package/types/render/CommandBuffer.d.ts +169 -0
  251. package/types/render/RenderCommand.d.ts +312 -0
  252. package/types/render/RenderState.d.ts +279 -0
  253. package/types/render/RenderTarget.d.ts +254 -0
  254. package/types/render/ShaderProgram.d.ts +277 -0
  255. package/types/render/UnifiedRenderBridge.d.ts +143 -0
  256. package/types/render/WebGLBackend.d.ts +168 -0
  257. package/types/render/WebGPUBackend.d.ts +186 -0
  258. package/types/render/index.d.ts +141 -0
@@ -0,0 +1,519 @@
1
+ /**
2
+ * VIB34D PARALLEL TEST FRAMEWORK
3
+ * Ultra-comprehensive testing system for identifying issues across all systems simultaneously
4
+ * Tests multiple different approaches in parallel to isolate problems
5
+ */
6
+
7
+ export class ParallelTestFramework {
8
+ constructor() {
9
+ this.testSuites = new Map();
10
+ this.testResults = new Map();
11
+ this.isRunning = false;
12
+ this.systems = ['faceted', 'quantum', 'holographic']; // 3 active (polychora TBD)
13
+ this.parameters = ['geometry', 'gridDensity', 'morphFactor', 'speed', 'hue', 'intensity', 'saturation'];
14
+ this.interactions = ['mouse', 'click', 'scroll', 'touch', 'audio'];
15
+
16
+ // Test configurations for different approaches
17
+ this.testConfigs = {
18
+ // Audio reactivity testing
19
+ audioReactivity: [
20
+ { name: 'mvep-style', approach: 'direct-render-loop' },
21
+ { name: 'central-coordinator', approach: 'distributed-system' },
22
+ { name: 'hybrid-approach', approach: 'selective-distribution' },
23
+ { name: 'isolated-processing', approach: 'per-system-audio' }
24
+ ],
25
+
26
+ // Speed control testing
27
+ speedControl: [
28
+ { name: 'base-multiplier', approach: 'baseSpeed * multiplier' },
29
+ { name: 'additive-boost', approach: 'baseSpeed + audioBoost' },
30
+ { name: 'controlled-addition', approach: '(baseSpeed * 0.2) + (audioBoost * 0.1)' },
31
+ { name: 'exponential-scaling', approach: 'baseSpeed * Math.pow(1 + audioBoost, 2)' }
32
+ ],
33
+
34
+ // Mouse interaction testing
35
+ mouseInteraction: [
36
+ { name: 'full-intensity', approach: 'mouseIntensity * 0.5' },
37
+ { name: 'half-intensity', approach: 'mouseIntensity * 0.25' },
38
+ { name: 'quarter-intensity', approach: 'mouseIntensity * 0.125' },
39
+ { name: 'adaptive-intensity', approach: 'mouseIntensity * (0.1 + smoothness * 0.4)' }
40
+ ],
41
+
42
+ // Parameter synchronization testing
43
+ parameterSync: [
44
+ { name: 'immediate-update', approach: 'direct-parameter-set' },
45
+ { name: 'smooth-transition', approach: 'lerped-parameter-update' },
46
+ { name: 'batch-update', approach: 'grouped-parameter-changes' },
47
+ { name: 'debounced-update', approach: 'delayed-parameter-application' }
48
+ ]
49
+ };
50
+
51
+ console.log('🧪 Parallel Test Framework initialized with', Object.keys(this.testConfigs).length, 'test categories');
52
+ }
53
+
54
+ /**
55
+ * Run parallel tests across all systems for a specific issue type
56
+ */
57
+ async runParallelTests(issueType, testDuration = 10000) {
58
+ if (this.isRunning) {
59
+ console.warn('🚨 Tests already running, please wait...');
60
+ return;
61
+ }
62
+
63
+ this.isRunning = true;
64
+ const testConfig = this.testConfigs[issueType];
65
+
66
+ if (!testConfig) {
67
+ console.error('❌ Unknown issue type:', issueType);
68
+ return;
69
+ }
70
+
71
+ console.log(`🚀 Starting parallel tests for: ${issueType.toUpperCase()}`);
72
+ console.log(`📊 Testing ${testConfig.length} approaches across ${this.systems.length} systems`);
73
+
74
+ const testPromises = [];
75
+
76
+ // Create parallel test instances for each approach + system combination
77
+ for (const approach of testConfig) {
78
+ for (const system of this.systems) {
79
+ const testPromise = this.runSingleTest({
80
+ issueType,
81
+ approach: approach.name,
82
+ system,
83
+ config: approach,
84
+ duration: testDuration
85
+ });
86
+ testPromises.push(testPromise);
87
+ }
88
+ }
89
+
90
+ // Run all tests in parallel
91
+ console.log(`⚡ Running ${testPromises.length} parallel test instances...`);
92
+ const results = await Promise.allSettled(testPromises);
93
+
94
+ // Analyze results
95
+ this.analyzeParallelResults(issueType, results);
96
+ this.isRunning = false;
97
+
98
+ return this.generateTestReport(issueType);
99
+ }
100
+
101
+ /**
102
+ * Run a single test instance
103
+ */
104
+ async runSingleTest(testSpec) {
105
+ const testId = `${testSpec.issueType}-${testSpec.approach}-${testSpec.system}`;
106
+ console.log(`🧪 Starting test: ${testId}`);
107
+
108
+ try {
109
+ // Create isolated test environment
110
+ const testEnvironment = await this.createTestEnvironment(testSpec);
111
+
112
+ // Apply test approach
113
+ await this.applyTestApproach(testEnvironment, testSpec);
114
+
115
+ // Run test scenarios
116
+ const results = await this.runTestScenarios(testEnvironment, testSpec);
117
+
118
+ // Cleanup
119
+ await this.cleanupTestEnvironment(testEnvironment);
120
+
121
+ return {
122
+ testId,
123
+ success: true,
124
+ results,
125
+ timestamp: Date.now()
126
+ };
127
+ } catch (error) {
128
+ console.error(`❌ Test failed: ${testId}`, error);
129
+ return {
130
+ testId,
131
+ success: false,
132
+ error: error.message,
133
+ timestamp: Date.now()
134
+ };
135
+ }
136
+ }
137
+
138
+ /**
139
+ * Create isolated test environment for a specific system
140
+ */
141
+ async createTestEnvironment(testSpec) {
142
+ const canvas = document.createElement('canvas');
143
+ canvas.width = 512;
144
+ canvas.height = 512;
145
+ canvas.id = `test-${testSpec.system}-${Date.now()}`;
146
+ canvas.style.display = 'none';
147
+ document.body.appendChild(canvas);
148
+
149
+ let testSystem;
150
+
151
+ // Create system instance based on type
152
+ switch (testSpec.system) {
153
+ case 'faceted':
154
+ const { VIB34DIntegratedEngine } = await import('../core/Engine.js');
155
+ testSystem = new VIB34DIntegratedEngine();
156
+ break;
157
+ case 'quantum':
158
+ const { QuantumEngine } = await import('../quantum/QuantumEngine.js');
159
+ testSystem = new QuantumEngine();
160
+ break;
161
+ case 'holographic':
162
+ const { RealHolographicSystem } = await import('../holograms/RealHolographicSystem.js');
163
+ testSystem = new RealHolographicSystem();
164
+ break;
165
+ // POLYCHORA: TBD placeholder - disabled
166
+ // case 'polychora':
167
+ // const { PolychoraSystem } = await import('../core/PolychoraSystem.js');
168
+ // testSystem = new PolychoraSystem();
169
+ // break;
170
+ default:
171
+ throw new Error(`Unknown system type: ${testSpec.system}`);
172
+ }
173
+
174
+ return {
175
+ canvas,
176
+ system: testSystem,
177
+ metrics: {
178
+ frameRate: 0,
179
+ responsiveness: 0,
180
+ smoothness: 0,
181
+ errors: []
182
+ }
183
+ };
184
+ }
185
+
186
+ /**
187
+ * Apply specific test approach to system
188
+ */
189
+ async applyTestApproach(testEnvironment, testSpec) {
190
+ const { system } = testEnvironment;
191
+
192
+ switch (testSpec.issueType) {
193
+ case 'audioReactivity':
194
+ await this.applyAudioReactivityApproach(system, testSpec.config);
195
+ break;
196
+ case 'speedControl':
197
+ await this.applySpeedControlApproach(system, testSpec.config);
198
+ break;
199
+ case 'mouseInteraction':
200
+ await this.applyMouseInteractionApproach(system, testSpec.config);
201
+ break;
202
+ case 'parameterSync':
203
+ await this.applyParameterSyncApproach(system, testSpec.config);
204
+ break;
205
+ }
206
+ }
207
+
208
+ /**
209
+ * Run test scenarios and collect metrics
210
+ */
211
+ async runTestScenarios(testEnvironment, testSpec) {
212
+ const scenarios = [
213
+ { name: 'baseline', description: 'System at rest' },
214
+ { name: 'parameter-changes', description: 'Rapid parameter changes' },
215
+ { name: 'audio-reactivity', description: 'Audio input simulation' },
216
+ { name: 'mouse-interaction', description: 'Mouse movement simulation' },
217
+ { name: 'stress-test', description: 'High-frequency updates' }
218
+ ];
219
+
220
+ const results = {};
221
+
222
+ for (const scenario of scenarios) {
223
+ console.log(` 📋 Running scenario: ${scenario.name}`);
224
+ results[scenario.name] = await this.runScenario(testEnvironment, scenario, testSpec);
225
+ }
226
+
227
+ return results;
228
+ }
229
+
230
+ /**
231
+ * Run individual test scenario
232
+ */
233
+ async runScenario(testEnvironment, scenario, testSpec) {
234
+ const { system, metrics } = testEnvironment;
235
+ const startTime = performance.now();
236
+ let frameCount = 0;
237
+ const errors = [];
238
+
239
+ // Reset metrics
240
+ metrics.frameRate = 0;
241
+ metrics.responsiveness = 0;
242
+ metrics.smoothness = 0;
243
+ metrics.errors = [];
244
+
245
+ // Setup scenario-specific conditions
246
+ switch (scenario.name) {
247
+ case 'parameter-changes':
248
+ await this.simulateParameterChanges(system, 1000);
249
+ break;
250
+ case 'audio-reactivity':
251
+ await this.simulateAudioInput(system, 1000);
252
+ break;
253
+ case 'mouse-interaction':
254
+ await this.simulateMouseInteraction(system, 1000);
255
+ break;
256
+ case 'stress-test':
257
+ await this.simulateStressConditions(system, 1000);
258
+ break;
259
+ }
260
+
261
+ const endTime = performance.now();
262
+ const duration = endTime - startTime;
263
+
264
+ return {
265
+ duration,
266
+ frameRate: frameCount / (duration / 1000),
267
+ responsiveness: metrics.responsiveness,
268
+ smoothness: metrics.smoothness,
269
+ errorCount: errors.length,
270
+ errors
271
+ };
272
+ }
273
+
274
+ /**
275
+ * Analyze results from all parallel tests
276
+ */
277
+ analyzeParallelResults(issueType, results) {
278
+ console.log(`📊 Analyzing results for: ${issueType.toUpperCase()}`);
279
+
280
+ const successfulTests = results.filter(r => r.status === 'fulfilled' && r.value.success);
281
+ const failedTests = results.filter(r => r.status === 'rejected' || !r.value.success);
282
+
283
+ console.log(`✅ Successful tests: ${successfulTests.length}`);
284
+ console.log(`❌ Failed tests: ${failedTests.length}`);
285
+
286
+ // Group results by approach
287
+ const resultsByApproach = new Map();
288
+
289
+ successfulTests.forEach(test => {
290
+ const result = test.value;
291
+ const approach = result.testId.split('-')[1];
292
+
293
+ if (!resultsByApproach.has(approach)) {
294
+ resultsByApproach.set(approach, []);
295
+ }
296
+ resultsByApproach.get(approach).push(result);
297
+ });
298
+
299
+ // Find best performing approaches
300
+ const performanceRankings = [];
301
+
302
+ resultsByApproach.forEach((tests, approach) => {
303
+ const avgPerformance = this.calculateAveragePerformance(tests);
304
+ performanceRankings.push({ approach, ...avgPerformance });
305
+ });
306
+
307
+ performanceRankings.sort((a, b) => b.overallScore - a.overallScore);
308
+
309
+ console.log('🏆 Performance Rankings:');
310
+ performanceRankings.forEach((ranking, index) => {
311
+ console.log(`${index + 1}. ${ranking.approach}: ${(ranking.overallScore * 100).toFixed(1)}% overall score`);
312
+ });
313
+
314
+ this.testResults.set(issueType, {
315
+ timestamp: Date.now(),
316
+ totalTests: results.length,
317
+ successfulTests: successfulTests.length,
318
+ failedTests: failedTests.length,
319
+ rankings: performanceRankings,
320
+ rawResults: results
321
+ });
322
+ }
323
+
324
+ /**
325
+ * Calculate average performance metrics
326
+ */
327
+ calculateAveragePerformance(tests) {
328
+ let totalFrameRate = 0;
329
+ let totalResponsiveness = 0;
330
+ let totalSmoothness = 0;
331
+ let totalErrors = 0;
332
+
333
+ tests.forEach(test => {
334
+ Object.values(test.results).forEach(scenario => {
335
+ totalFrameRate += scenario.frameRate || 0;
336
+ totalResponsiveness += scenario.responsiveness || 0;
337
+ totalSmoothness += scenario.smoothness || 0;
338
+ totalErrors += scenario.errorCount || 0;
339
+ });
340
+ });
341
+
342
+ const totalScenarios = tests.length * 5; // 5 scenarios per test
343
+
344
+ return {
345
+ avgFrameRate: totalFrameRate / totalScenarios,
346
+ avgResponsiveness: totalResponsiveness / totalScenarios,
347
+ avgSmoothness: totalSmoothness / totalScenarios,
348
+ avgErrors: totalErrors / totalScenarios,
349
+ overallScore: this.calculateOverallScore({
350
+ frameRate: totalFrameRate / totalScenarios,
351
+ responsiveness: totalResponsiveness / totalScenarios,
352
+ smoothness: totalSmoothness / totalScenarios,
353
+ errors: totalErrors / totalScenarios
354
+ })
355
+ };
356
+ }
357
+
358
+ /**
359
+ * Calculate overall performance score (0-1)
360
+ */
361
+ calculateOverallScore(metrics) {
362
+ const frameRateScore = Math.min(metrics.frameRate / 60, 1); // 60fps = 1.0
363
+ const responsivenessScore = Math.min(metrics.responsiveness, 1);
364
+ const smoothnessScore = Math.min(metrics.smoothness, 1);
365
+ const errorPenalty = Math.max(0, 1 - (metrics.errors * 0.1)); // -0.1 per error
366
+
367
+ return (frameRateScore * 0.3 + responsivenessScore * 0.3 + smoothnessScore * 0.3 + errorPenalty * 0.1);
368
+ }
369
+
370
+ /**
371
+ * Generate comprehensive test report
372
+ */
373
+ generateTestReport(issueType) {
374
+ const results = this.testResults.get(issueType);
375
+
376
+ if (!results) {
377
+ return null;
378
+ }
379
+
380
+ const report = {
381
+ issueType,
382
+ timestamp: results.timestamp,
383
+ summary: {
384
+ totalTests: results.totalTests,
385
+ successRate: (results.successfulTests / results.totalTests * 100).toFixed(1) + '%',
386
+ bestApproach: results.rankings[0]?.approach || 'none',
387
+ bestScore: ((results.rankings[0]?.overallScore || 0) * 100).toFixed(1) + '%'
388
+ },
389
+ rankings: results.rankings,
390
+ recommendations: this.generateRecommendations(issueType, results.rankings)
391
+ };
392
+
393
+ console.log('📋 Test Report Generated:');
394
+ console.log('Issue Type:', report.issueType);
395
+ console.log('Success Rate:', report.summary.successRate);
396
+ console.log('Best Approach:', report.summary.bestApproach);
397
+ console.log('Best Score:', report.summary.bestScore);
398
+
399
+ return report;
400
+ }
401
+
402
+ /**
403
+ * Generate recommendations based on test results
404
+ */
405
+ generateRecommendations(issueType, rankings) {
406
+ if (rankings.length === 0) {
407
+ return ['No successful tests - investigate fundamental issues'];
408
+ }
409
+
410
+ const best = rankings[0];
411
+ const recommendations = [`Use ${best.approach} approach for best performance`];
412
+
413
+ if (best.overallScore < 0.7) {
414
+ recommendations.push('Overall performance below 70% - consider additional optimizations');
415
+ }
416
+
417
+ if (best.avgErrors > 0) {
418
+ recommendations.push(`Address ${best.avgErrors.toFixed(1)} average errors per test`);
419
+ }
420
+
421
+ if (best.avgFrameRate < 30) {
422
+ recommendations.push('Frame rate below 30fps - optimize rendering performance');
423
+ }
424
+
425
+ // Compare top approaches
426
+ if (rankings.length > 1) {
427
+ const second = rankings[1];
428
+ const scoreDiff = best.overallScore - second.overallScore;
429
+
430
+ if (scoreDiff < 0.1) {
431
+ recommendations.push(`Consider ${second.approach} as alternative (${(scoreDiff * 100).toFixed(1)}% difference)`);
432
+ }
433
+ }
434
+
435
+ return recommendations;
436
+ }
437
+
438
+ /**
439
+ * Simulation methods for test scenarios
440
+ */
441
+ async simulateParameterChanges(system, duration) {
442
+ // Implementation for parameter change simulation
443
+ // Rapidly change parameters and measure response
444
+ }
445
+
446
+ async simulateAudioInput(system, duration) {
447
+ // Implementation for audio simulation
448
+ // Simulate various audio patterns and frequencies
449
+ }
450
+
451
+ async simulateMouseInteraction(system, duration) {
452
+ // Implementation for mouse simulation
453
+ // Simulate various mouse movement patterns
454
+ }
455
+
456
+ async simulateStressConditions(system, duration) {
457
+ // Implementation for stress testing
458
+ // High-frequency updates, rapid changes, etc.
459
+ }
460
+
461
+ /**
462
+ * Apply specific test approaches
463
+ */
464
+ async applyAudioReactivityApproach(system, config) {
465
+ // Implementation for audio reactivity approach testing
466
+ }
467
+
468
+ async applySpeedControlApproach(system, config) {
469
+ // Implementation for speed control approach testing
470
+ }
471
+
472
+ async applyMouseInteractionApproach(system, config) {
473
+ // Implementation for mouse interaction approach testing
474
+ }
475
+
476
+ async applyParameterSyncApproach(system, config) {
477
+ // Implementation for parameter sync approach testing
478
+ }
479
+
480
+ /**
481
+ * Cleanup test environment
482
+ */
483
+ async cleanupTestEnvironment(testEnvironment) {
484
+ if (testEnvironment.canvas) {
485
+ testEnvironment.canvas.remove();
486
+ }
487
+
488
+ if (testEnvironment.system && typeof testEnvironment.system.destroy === 'function') {
489
+ testEnvironment.system.destroy();
490
+ }
491
+ }
492
+
493
+ /**
494
+ * Quick test runner for specific issues
495
+ */
496
+ async quickTest(issueType, systems = null) {
497
+ const testSystems = systems || this.systems;
498
+ console.log(`🚀 Quick test for ${issueType} across ${testSystems.length} systems`);
499
+
500
+ return await this.runParallelTests(issueType, 3000); // 3 second tests
501
+ }
502
+
503
+ /**
504
+ * Get all available test types
505
+ */
506
+ getAvailableTests() {
507
+ return Object.keys(this.testConfigs);
508
+ }
509
+
510
+ /**
511
+ * Get test results for specific issue type
512
+ */
513
+ getTestResults(issueType) {
514
+ return this.testResults.get(issueType);
515
+ }
516
+ }
517
+
518
+ // Global instance for easy access
519
+ window.ParallelTestFramework = ParallelTestFramework;
@@ -0,0 +1,24 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`export formats > matches the export format snapshot 1`] = `
4
+ [
5
+ {
6
+ "description": "Vector sprite sheet for web and design tooling.",
7
+ "extension": ".svg",
8
+ "id": "svg-sprite",
9
+ "name": "SVG Sprite Sheet",
10
+ },
11
+ {
12
+ "description": "Motion-ready JSON payload for Lottie renderers.",
13
+ "extension": ".json",
14
+ "id": "lottie-json",
15
+ "name": "Lottie JSON",
16
+ },
17
+ {
18
+ "description": "CSS custom properties for theming pipelines.",
19
+ "extension": ".css",
20
+ "id": "css-variables",
21
+ "name": "CSS Variables",
22
+ },
23
+ ]
24
+ `;
@@ -0,0 +1,8 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { EXPORT_FORMATS } from '../../tools/export/formats.js';
3
+
4
+ describe('export formats', () => {
5
+ it('matches the export format snapshot', () => {
6
+ expect(EXPORT_FORMATS).toMatchSnapshot();
7
+ });
8
+ });
@@ -0,0 +1,14 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { perspectiveProject4D, stereographicProject4D } from '../math/projections.js';
3
+
4
+ describe('4D projections', () => {
5
+ it('clamps stereographic denominators near singularities', () => {
6
+ const result = stereographicProject4D([1, 0, 0, 1 - 1e-12], { epsilon: 1e-4 });
7
+ expect(Math.abs(result.denom)).toBeGreaterThanOrEqual(1e-4);
8
+ });
9
+
10
+ it('projects with perspective distance parameter', () => {
11
+ const result = perspectiveProject4D([2, 0, 0, 1], { distance: 4 });
12
+ expect(result.x).toBeCloseTo(2 / 3, 6);
13
+ });
14
+ });
@@ -0,0 +1,37 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import {
3
+ applyMatrix4x4,
4
+ createRotationMatrix4D,
5
+ identityMatrix4x4,
6
+ multiplyMatrix4x4,
7
+ normalizeVector4D,
8
+ transposeMatrix4x4,
9
+ vectorLength4D,
10
+ } from '../math/rotations.js';
11
+
12
+ const EPSILON = 1e-6;
13
+
14
+ describe('4D rotation matrices', () => {
15
+ it('keeps rotation matrices orthonormal', () => {
16
+ const matrix = createRotationMatrix4D('XW', Math.PI / 3);
17
+ const transpose = transposeMatrix4x4(matrix);
18
+ const product = multiplyMatrix4x4(matrix, transpose);
19
+ const identity = identityMatrix4x4();
20
+
21
+ product.forEach((value, index) => {
22
+ expect(Math.abs(value - identity[index])).toBeLessThan(1e-6);
23
+ });
24
+ });
25
+
26
+ it('preserves vector length across repeated rotations', () => {
27
+ const step = createRotationMatrix4D('YZ', Math.PI / 180);
28
+ let vector = normalizeVector4D([1, 0.2, -0.4, 0.7]);
29
+ const initialLength = vectorLength4D(vector);
30
+
31
+ for (let i = 0; i < 720; i += 1) {
32
+ vector = applyMatrix4x4(step, vector);
33
+ }
34
+
35
+ expect(Math.abs(vectorLength4D(vector) - initialLength)).toBeLessThan(EPSILON);
36
+ });
37
+ });