@vib3code/sdk 2.0.1 → 2.0.3-canary.0a63e71

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 (192) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/DOCS/AGENT_HARNESS_ARCHITECTURE.md +245 -0
  3. package/DOCS/ANDROID_DEPLOYMENT.md +59 -0
  4. package/DOCS/ARCHITECTURE.md +1 -0
  5. package/DOCS/CI_TESTING.md +2 -0
  6. package/DOCS/CLI_ONBOARDING.md +3 -1
  7. package/DOCS/CONTROL_REFERENCE.md +2 -0
  8. package/DOCS/CROSS_SITE_DESIGN_PATTERNS.md +119 -0
  9. package/DOCS/ENV_SETUP.md +2 -0
  10. package/DOCS/EPIC_SCROLL_EVENTS.md +775 -0
  11. package/DOCS/EXPANSION_DESIGN.md +979 -0
  12. package/DOCS/EXPANSION_DESIGN_ULTRA.md +389 -0
  13. package/DOCS/EXPORT_FORMATS.md +2 -0
  14. package/DOCS/GPU_DISPOSAL_GUIDE.md +2 -0
  15. package/DOCS/HANDOFF_LANDING_PAGE.md +156 -0
  16. package/DOCS/HANDOFF_SDK_DEVELOPMENT.md +495 -0
  17. package/DOCS/LICENSING_TIERS.md +2 -0
  18. package/DOCS/MASTER_PLAN_2026-01-31.md +4 -2
  19. package/DOCS/MULTIVIZ_CHOREOGRAPHY_PATTERNS.md +939 -0
  20. package/DOCS/OBS_SETUP_GUIDE.md +2 -0
  21. package/DOCS/OPTIMIZATION_PLAN_MATH.md +119 -0
  22. package/DOCS/PRODUCT_STRATEGY.md +65 -0
  23. package/DOCS/PROJECT_SETUP.md +2 -0
  24. package/DOCS/README.md +105 -0
  25. package/DOCS/REFERENCE_SCROLL_ANALYSIS.md +99 -0
  26. package/DOCS/RENDERER_LIFECYCLE.md +2 -0
  27. package/DOCS/REPO_MANIFEST.md +2 -0
  28. package/DOCS/ROADMAP.md +113 -0
  29. package/DOCS/SCROLL_TIMELINE_v3.md +271 -0
  30. package/DOCS/SITE_REFACTOR_PLAN.md +102 -0
  31. package/DOCS/STATUS.md +26 -0
  32. package/DOCS/SYSTEM_INVENTORY.md +37 -32
  33. package/DOCS/TELEMETRY_EXPORTS.md +2 -0
  34. package/DOCS/VISUAL_ANALYSIS_CLICKERSS.md +87 -0
  35. package/DOCS/VISUAL_ANALYSIS_FACETAD.md +135 -0
  36. package/DOCS/VISUAL_ANALYSIS_SIMONE.md +97 -0
  37. package/DOCS/VISUAL_ANALYSIS_TABLESIDE.md +88 -0
  38. package/DOCS/WEBGPU_STATUS.md +121 -38
  39. package/DOCS/XR_BENCHMARKS.md +2 -0
  40. package/DOCS/archive/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +1 -0
  41. package/DOCS/archive/DEV_TRACK_ANALYSIS.md +1 -0
  42. package/DOCS/archive/DEV_TRACK_PLAN_2026-01-07.md +1 -0
  43. package/DOCS/archive/SESSION_014_PLAN.md +1 -0
  44. package/DOCS/archive/SESSION_LOG_2026-01-07.md +1 -0
  45. package/DOCS/archive/STRATEGIC_BLUEPRINT_2026-01-07.md +1 -0
  46. package/DOCS/archive/SYSTEM_AUDIT_2026-01-30.md +1 -0
  47. package/DOCS/archive/WEBGPU_STATUS_2026-02-15_STALE.md +1 -0
  48. package/DOCS/{DEV_TRACK_SESSION_2026-01-31.md → dev-tracks/DEV_TRACK_SESSION_2026-01-31.md} +3 -1
  49. package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-06.md +233 -0
  50. package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-13.md +129 -0
  51. package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-15.md +144 -0
  52. package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-16.md +110 -0
  53. package/DOCS/dev-tracks/PERF_UPGRADE_2026-02-16.md +310 -0
  54. package/DOCS/dev-tracks/README.md +12 -0
  55. package/README.md +26 -13
  56. package/cpp/CMakeLists.txt +236 -0
  57. package/cpp/bindings/embind.cpp +269 -0
  58. package/cpp/build.sh +129 -0
  59. package/cpp/geometry/Crystal.cpp +103 -0
  60. package/cpp/geometry/Fractal.cpp +136 -0
  61. package/cpp/geometry/GeometryGenerator.cpp +262 -0
  62. package/cpp/geometry/KleinBottle.cpp +71 -0
  63. package/cpp/geometry/Sphere.cpp +134 -0
  64. package/cpp/geometry/Tesseract.cpp +94 -0
  65. package/cpp/geometry/Tetrahedron.cpp +83 -0
  66. package/cpp/geometry/Torus.cpp +65 -0
  67. package/cpp/geometry/WarpFunctions.cpp +238 -0
  68. package/cpp/geometry/Wave.cpp +85 -0
  69. package/cpp/include/vib3_ffi.h +238 -0
  70. package/cpp/math/Mat4x4.cpp +409 -0
  71. package/cpp/math/Mat4x4.hpp +209 -0
  72. package/cpp/math/Projection.cpp +142 -0
  73. package/cpp/math/Projection.hpp +148 -0
  74. package/cpp/math/Rotor4D.cpp +322 -0
  75. package/cpp/math/Rotor4D.hpp +204 -0
  76. package/cpp/math/Vec4.cpp +303 -0
  77. package/cpp/math/Vec4.hpp +225 -0
  78. package/cpp/src/vib3_ffi.cpp +607 -0
  79. package/cpp/tests/Geometry_test.cpp +213 -0
  80. package/cpp/tests/Mat4x4_test.cpp +494 -0
  81. package/cpp/tests/Projection_test.cpp +298 -0
  82. package/cpp/tests/Rotor4D_test.cpp +423 -0
  83. package/cpp/tests/Vec4_test.cpp +489 -0
  84. package/docs/webgpu-live.html +1 -1
  85. package/package.json +41 -30
  86. package/src/agent/index.js +1 -3
  87. package/src/agent/mcp/MCPServer.js +1220 -144
  88. package/src/agent/mcp/index.js +1 -1
  89. package/src/agent/mcp/stdio-server.js +264 -0
  90. package/src/agent/mcp/tools.js +498 -31
  91. package/src/cli/index.js +431 -47
  92. package/src/core/CanvasManager.js +97 -204
  93. package/src/core/ErrorReporter.js +1 -1
  94. package/src/core/Parameters.js +1 -1
  95. package/src/core/VIB3Engine.js +93 -4
  96. package/src/core/VitalitySystem.js +53 -0
  97. package/src/core/index.js +18 -0
  98. package/src/core/renderers/FacetedRendererAdapter.js +10 -9
  99. package/src/core/renderers/HolographicRendererAdapter.js +13 -9
  100. package/src/core/renderers/QuantumRendererAdapter.js +11 -7
  101. package/src/creative/AestheticMapper.js +628 -0
  102. package/src/creative/ChoreographyPlayer.js +481 -0
  103. package/src/creative/index.js +11 -0
  104. package/src/experimental/GameLoop.js +72 -0
  105. package/src/experimental/LatticePhysics.js +100 -0
  106. package/src/experimental/LiveDirector.js +143 -0
  107. package/src/experimental/PlayerController4D.js +154 -0
  108. package/src/experimental/VIB3Actor.js +138 -0
  109. package/src/experimental/VIB3Compositor.js +117 -0
  110. package/src/experimental/VIB3Link.js +122 -0
  111. package/src/experimental/VIB3Orchestrator.js +146 -0
  112. package/src/experimental/VIB3Universe.js +109 -0
  113. package/src/experimental/demos/CrystalLabyrinth.js +202 -0
  114. package/src/export/TradingCardManager.js +3 -4
  115. package/src/export/index.js +11 -1
  116. package/src/faceted/FacetedSystem.js +260 -394
  117. package/src/games/glyph-war/GlyphWarVisualizer.js +641 -0
  118. package/src/geometry/generators/Crystal.js +2 -2
  119. package/src/geometry/warp/HypersphereCore.js +53 -24
  120. package/src/holograms/HolographicVisualizer.js +84 -98
  121. package/src/holograms/RealHolographicSystem.js +194 -43
  122. package/src/math/Mat4x4.js +308 -105
  123. package/src/math/Rotor4D.js +124 -40
  124. package/src/math/Vec4.js +200 -103
  125. package/src/math/index.js +7 -7
  126. package/src/polychora/PolychoraSystem.js +77 -0
  127. package/src/quantum/QuantumEngine.js +103 -66
  128. package/src/quantum/QuantumVisualizer.js +31 -22
  129. package/src/reactivity/index.js +3 -5
  130. package/src/render/LayerPresetManager.js +372 -0
  131. package/src/render/LayerReactivityBridge.js +344 -0
  132. package/src/render/LayerRelationshipGraph.js +610 -0
  133. package/src/render/MultiCanvasBridge.js +148 -25
  134. package/src/render/ShaderLoader.js +38 -0
  135. package/src/render/ShaderProgram.js +4 -4
  136. package/src/render/UnifiedRenderBridge.js +4 -1
  137. package/src/render/backends/WebGPUBackend.js +8 -4
  138. package/src/render/index.js +27 -2
  139. package/src/scene/Node4D.js +74 -24
  140. package/src/scene/index.js +4 -4
  141. package/src/shaders/common/geometry24.glsl +65 -0
  142. package/src/shaders/common/geometry24.wgsl +54 -0
  143. package/src/shaders/common/rotation4d.glsl +4 -4
  144. package/src/shaders/common/rotation4d.wgsl +2 -2
  145. package/src/shaders/common/uniforms.wgsl +15 -8
  146. package/src/shaders/faceted/faceted.frag.glsl +220 -80
  147. package/src/shaders/faceted/faceted.frag.wgsl +144 -90
  148. package/src/shaders/holographic/holographic.frag.glsl +28 -9
  149. package/src/shaders/holographic/holographic.frag.wgsl +112 -41
  150. package/src/shaders/quantum/quantum.frag.glsl +1 -0
  151. package/src/shaders/quantum/quantum.frag.wgsl +6 -4
  152. package/src/testing/ParallelTestFramework.js +2 -2
  153. package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +2 -2
  154. package/src/viewer/GalleryUI.js +17 -0
  155. package/src/viewer/ViewerPortal.js +2 -2
  156. package/src/viewer/index.js +1 -1
  157. package/tools/headless-renderer.js +258 -0
  158. package/tools/shader-sync-verify.js +14 -8
  159. package/tools/site-analysis/all-reports.json +32 -0
  160. package/tools/site-analysis/combined-analysis.md +50 -0
  161. package/tools/site-analyzer.mjs +779 -0
  162. package/tools/visual-catalog/capture.js +276 -0
  163. package/tools/visual-catalog/composite.js +138 -0
  164. package/types/adaptive-sdk.d.ts +204 -5
  165. package/types/agent/cli.d.ts +78 -0
  166. package/types/agent/index.d.ts +18 -0
  167. package/types/agent/mcp.d.ts +87 -0
  168. package/types/agent/telemetry.d.ts +190 -0
  169. package/types/core/VIB3Engine.d.ts +26 -0
  170. package/types/core/index.d.ts +261 -0
  171. package/types/creative/AestheticMapper.d.ts +72 -0
  172. package/types/creative/ChoreographyPlayer.d.ts +96 -0
  173. package/types/creative/index.d.ts +17 -0
  174. package/types/export/index.d.ts +243 -0
  175. package/types/geometry/index.d.ts +164 -0
  176. package/types/math/index.d.ts +214 -0
  177. package/types/render/LayerPresetManager.d.ts +78 -0
  178. package/types/render/LayerReactivityBridge.d.ts +85 -0
  179. package/types/render/LayerRelationshipGraph.d.ts +174 -0
  180. package/types/render/index.d.ts +3 -0
  181. package/types/scene/index.d.ts +204 -0
  182. package/types/systems/index.d.ts +244 -0
  183. package/types/variations/index.d.ts +62 -0
  184. package/types/viewer/index.d.ts +225 -0
  185. package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +0 -34
  186. package/DOCS/DEV_TRACK_ANALYSIS.md +0 -77
  187. package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +0 -42
  188. package/DOCS/SESSION_014_PLAN.md +0 -195
  189. package/DOCS/SESSION_LOG_2026-01-07.md +0 -56
  190. package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +0 -72
  191. package/DOCS/SYSTEM_AUDIT_2026-01-30.md +0 -738
  192. /package/src/viewer/{ReactivityManager.js → ViewerInputHandler.js} +0 -0
@@ -0,0 +1,225 @@
1
+ /**
2
+ * Vec4.hpp - 4D Vector for VIB3+ SDK
3
+ *
4
+ * SIMD-optimized 4D vector with full geometric operations.
5
+ * Uses float[4] for GPU compatibility and SIMD alignment.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include <array>
11
+ #include <cmath>
12
+ #include <numbers>
13
+ #include <algorithm>
14
+
15
+ #ifdef VIB3_HAS_SSE41
16
+ #include <smmintrin.h>
17
+ #endif
18
+
19
+ #ifdef __EMSCRIPTEN__
20
+ #include <wasm_simd128.h>
21
+ #endif
22
+
23
+ namespace vib3 {
24
+
25
+ /**
26
+ * 4D Vector class
27
+ *
28
+ * Layout: [x, y, z, w] where w is the 4th dimension (not homogeneous coordinate)
29
+ */
30
+ class alignas(16) Vec4 {
31
+ public:
32
+ union {
33
+ struct { float x, y, z, w; };
34
+ std::array<float, 4> data;
35
+ #ifdef VIB3_HAS_SSE41
36
+ __m128 simd;
37
+ #endif
38
+ #ifdef __EMSCRIPTEN__
39
+ v128_t simd;
40
+ #endif
41
+ };
42
+
43
+ // Constructors
44
+ constexpr Vec4() noexcept : x(0), y(0), z(0), w(0) {}
45
+ constexpr Vec4(float x, float y, float z, float w) noexcept : x(x), y(y), z(z), w(w) {}
46
+ constexpr explicit Vec4(float scalar) noexcept : x(scalar), y(scalar), z(scalar), w(scalar) {}
47
+ constexpr Vec4(const std::array<float, 4>& arr) noexcept : data(arr) {}
48
+
49
+ #ifdef VIB3_HAS_SSE41
50
+ Vec4(__m128 v) noexcept : simd(v) {}
51
+ #endif
52
+
53
+ #ifdef __EMSCRIPTEN__
54
+ Vec4(v128_t v) noexcept : simd(v) {}
55
+ #endif
56
+
57
+ // Static factories
58
+ static constexpr Vec4 zero() noexcept { return Vec4(0, 0, 0, 0); }
59
+ static constexpr Vec4 one() noexcept { return Vec4(1, 1, 1, 1); }
60
+ static constexpr Vec4 unitX() noexcept { return Vec4(1, 0, 0, 0); }
61
+ static constexpr Vec4 unitY() noexcept { return Vec4(0, 1, 0, 0); }
62
+ static constexpr Vec4 unitZ() noexcept { return Vec4(0, 0, 1, 0); }
63
+ static constexpr Vec4 unitW() noexcept { return Vec4(0, 0, 0, 1); }
64
+
65
+ /**
66
+ * Create random unit vector on S³
67
+ */
68
+ static Vec4 randomUnit() noexcept;
69
+
70
+ // Element access
71
+ constexpr float& operator[](size_t i) noexcept { return data[i]; }
72
+ constexpr const float& operator[](size_t i) const noexcept { return data[i]; }
73
+
74
+ // Arithmetic operators
75
+ Vec4 operator+(const Vec4& other) const noexcept;
76
+ Vec4 operator-(const Vec4& other) const noexcept;
77
+ Vec4 operator*(float scalar) const noexcept;
78
+ Vec4 operator/(float scalar) const noexcept;
79
+ Vec4 operator-() const noexcept;
80
+
81
+ Vec4& operator+=(const Vec4& other) noexcept;
82
+ Vec4& operator-=(const Vec4& other) noexcept;
83
+ Vec4& operator*=(float scalar) noexcept;
84
+ Vec4& operator/=(float scalar) noexcept;
85
+
86
+ // Comparison
87
+ bool operator==(const Vec4& other) const noexcept;
88
+ bool operator!=(const Vec4& other) const noexcept;
89
+
90
+ /**
91
+ * Dot product
92
+ */
93
+ float dot(const Vec4& other) const noexcept;
94
+
95
+ /**
96
+ * Squared length (magnitude²)
97
+ */
98
+ float lengthSquared() const noexcept;
99
+
100
+ /**
101
+ * Length (magnitude)
102
+ */
103
+ float length() const noexcept;
104
+
105
+ /**
106
+ * Normalize to unit length
107
+ */
108
+ Vec4 normalized() const noexcept;
109
+
110
+ /**
111
+ * Normalize in place
112
+ */
113
+ void normalize() noexcept;
114
+
115
+ /**
116
+ * Distance to another point
117
+ */
118
+ float distanceTo(const Vec4& other) const noexcept;
119
+
120
+ /**
121
+ * Squared distance to another point
122
+ */
123
+ float distanceSquaredTo(const Vec4& other) const noexcept;
124
+
125
+ /**
126
+ * Linear interpolation
127
+ */
128
+ Vec4 lerp(const Vec4& other, float t) const noexcept;
129
+
130
+ /**
131
+ * Component-wise minimum
132
+ */
133
+ Vec4 min(const Vec4& other) const noexcept;
134
+
135
+ /**
136
+ * Component-wise maximum
137
+ */
138
+ Vec4 max(const Vec4& other) const noexcept;
139
+
140
+ /**
141
+ * Component-wise clamp
142
+ */
143
+ Vec4 clamp(const Vec4& minVal, const Vec4& maxVal) const noexcept;
144
+
145
+ /**
146
+ * Component-wise absolute value
147
+ */
148
+ Vec4 abs() const noexcept;
149
+
150
+ /**
151
+ * Project onto another vector
152
+ */
153
+ Vec4 projectOnto(const Vec4& other) const noexcept;
154
+
155
+ /**
156
+ * Reflect across a normal
157
+ */
158
+ Vec4 reflect(const Vec4& normal) const noexcept;
159
+
160
+ /**
161
+ * Check if approximately zero
162
+ */
163
+ bool isZero(float epsilon = 1e-6f) const noexcept;
164
+
165
+ /**
166
+ * Check if approximately unit length
167
+ */
168
+ bool isNormalized(float epsilon = 1e-6f) const noexcept;
169
+
170
+ /**
171
+ * Get pointer to data for GPU upload
172
+ */
173
+ const float* ptr() const noexcept { return data.data(); }
174
+ float* ptr() noexcept { return data.data(); }
175
+
176
+ // Projections (4D -> 3D)
177
+
178
+ /**
179
+ * Perspective projection: X = x*d/(d-w), Y = y*d/(d-w), Z = z*d/(d-w)
180
+ */
181
+ std::array<float, 3> projectPerspective(float distance) const noexcept;
182
+
183
+ /**
184
+ * Stereographic projection: X = x/(1-w), Y = y/(1-w), Z = z/(1-w)
185
+ */
186
+ std::array<float, 3> projectStereographic() const noexcept;
187
+
188
+ /**
189
+ * Orthographic projection: X = x, Y = y, Z = z
190
+ */
191
+ std::array<float, 3> projectOrthographic() const noexcept;
192
+ };
193
+
194
+ // Free function operators
195
+ inline Vec4 operator*(float scalar, const Vec4& v) noexcept {
196
+ return v * scalar;
197
+ }
198
+
199
+ /**
200
+ * Dot product free function
201
+ */
202
+ inline float dot(const Vec4& a, const Vec4& b) noexcept {
203
+ return a.dot(b);
204
+ }
205
+
206
+ /**
207
+ * Cross product in 4D (returns bivector, not implemented here)
208
+ * Use wedge product for proper 4D cross products
209
+ */
210
+
211
+ /**
212
+ * Distance free function
213
+ */
214
+ inline float distance(const Vec4& a, const Vec4& b) noexcept {
215
+ return a.distanceTo(b);
216
+ }
217
+
218
+ /**
219
+ * Lerp free function
220
+ */
221
+ inline Vec4 lerp(const Vec4& a, const Vec4& b, float t) noexcept {
222
+ return a.lerp(b, t);
223
+ }
224
+
225
+ } // namespace vib3