@vib3code/sdk 2.0.3-canary.91a95f3 → 2.0.3-canary.ae15579

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 (138) hide show
  1. package/DOCS/AGENT_HARNESS_ARCHITECTURE.md +2 -0
  2. package/DOCS/ANDROID_DEPLOYMENT.md +59 -0
  3. package/DOCS/ARCHITECTURE.md +1 -0
  4. package/DOCS/CI_TESTING.md +2 -0
  5. package/DOCS/CLI_ONBOARDING.md +2 -0
  6. package/DOCS/CONTROL_REFERENCE.md +2 -0
  7. package/DOCS/CROSS_SITE_DESIGN_PATTERNS.md +2 -0
  8. package/DOCS/ENV_SETUP.md +2 -0
  9. package/DOCS/EPIC_SCROLL_EVENTS.md +2 -0
  10. package/DOCS/EXPANSION_DESIGN.md +979 -0
  11. package/DOCS/EXPANSION_DESIGN_ULTRA.md +389 -0
  12. package/DOCS/EXPORT_FORMATS.md +2 -0
  13. package/DOCS/GPU_DISPOSAL_GUIDE.md +2 -0
  14. package/DOCS/HANDOFF_LANDING_PAGE.md +2 -0
  15. package/DOCS/HANDOFF_SDK_DEVELOPMENT.md +2 -0
  16. package/DOCS/LICENSING_TIERS.md +2 -0
  17. package/DOCS/MASTER_PLAN_2026-01-31.md +4 -2
  18. package/DOCS/MULTIVIZ_CHOREOGRAPHY_PATTERNS.md +3 -1
  19. package/DOCS/OBS_SETUP_GUIDE.md +2 -0
  20. package/DOCS/OPTIMIZATION_PLAN_MATH.md +119 -0
  21. package/DOCS/PRODUCT_STRATEGY.md +2 -0
  22. package/DOCS/PROJECT_SETUP.md +2 -0
  23. package/DOCS/README.md +5 -3
  24. package/DOCS/REFERENCE_SCROLL_ANALYSIS.md +2 -0
  25. package/DOCS/RENDERER_LIFECYCLE.md +2 -0
  26. package/DOCS/REPO_MANIFEST.md +2 -0
  27. package/DOCS/ROADMAP.md +2 -0
  28. package/DOCS/SCROLL_TIMELINE_v3.md +2 -0
  29. package/DOCS/SITE_REFACTOR_PLAN.md +2 -0
  30. package/DOCS/STATUS.md +2 -0
  31. package/DOCS/SYSTEM_INVENTORY.md +4 -2
  32. package/DOCS/TELEMETRY_EXPORTS.md +2 -0
  33. package/DOCS/VISUAL_ANALYSIS_CLICKERSS.md +2 -0
  34. package/DOCS/VISUAL_ANALYSIS_FACETAD.md +2 -0
  35. package/DOCS/VISUAL_ANALYSIS_SIMONE.md +2 -0
  36. package/DOCS/VISUAL_ANALYSIS_TABLESIDE.md +2 -0
  37. package/DOCS/WEBGPU_STATUS.md +121 -38
  38. package/DOCS/XR_BENCHMARKS.md +2 -0
  39. package/DOCS/archive/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +1 -34
  40. package/DOCS/archive/DEV_TRACK_ANALYSIS.md +1 -80
  41. package/DOCS/archive/DEV_TRACK_PLAN_2026-01-07.md +1 -42
  42. package/DOCS/archive/SESSION_014_PLAN.md +1 -195
  43. package/DOCS/archive/SESSION_LOG_2026-01-07.md +1 -56
  44. package/DOCS/archive/STRATEGIC_BLUEPRINT_2026-01-07.md +1 -72
  45. package/DOCS/archive/SYSTEM_AUDIT_2026-01-30.md +1 -741
  46. package/DOCS/archive/WEBGPU_STATUS_2026-02-15_STALE.md +1 -0
  47. package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-01-31.md +2 -0
  48. package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-06.md +2 -0
  49. package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-13.md +15 -0
  50. package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-15.md +144 -0
  51. package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-16.md +110 -0
  52. package/DOCS/dev-tracks/PERF_UPGRADE_2026-02-16.md +310 -0
  53. package/DOCS/dev-tracks/README.md +2 -0
  54. package/docs/webgpu-live.html +1 -1
  55. package/package.json +11 -4
  56. package/src/agent/index.js +1 -3
  57. package/src/agent/mcp/MCPServer.js +542 -188
  58. package/src/agent/mcp/index.js +1 -1
  59. package/src/agent/mcp/tools.js +132 -32
  60. package/src/cli/index.js +431 -47
  61. package/src/core/VIB3Engine.js +55 -3
  62. package/src/core/index.js +18 -0
  63. package/src/core/renderers/FacetedRendererAdapter.js +10 -9
  64. package/src/core/renderers/HolographicRendererAdapter.js +11 -7
  65. package/src/core/renderers/QuantumRendererAdapter.js +11 -7
  66. package/src/creative/index.js +11 -0
  67. package/src/experimental/GameLoop.js +72 -0
  68. package/src/experimental/LatticePhysics.js +100 -0
  69. package/src/experimental/LiveDirector.js +143 -0
  70. package/src/experimental/PlayerController4D.js +154 -0
  71. package/src/experimental/VIB3Actor.js +138 -0
  72. package/src/experimental/VIB3Compositor.js +117 -0
  73. package/src/experimental/VIB3Link.js +122 -0
  74. package/src/experimental/VIB3Orchestrator.js +146 -0
  75. package/src/experimental/VIB3Universe.js +109 -0
  76. package/src/experimental/demos/CrystalLabyrinth.js +202 -0
  77. package/src/export/SVGExporter.js +9 -5
  78. package/src/export/index.js +11 -1
  79. package/src/faceted/FacetedSystem.js +27 -10
  80. package/src/games/glyph-war/GlyphWarVisualizer.js +641 -0
  81. package/src/geometry/generators/Crystal.js +2 -2
  82. package/src/geometry/warp/HypersphereCore.js +53 -24
  83. package/src/holograms/HolographicVisualizer.js +58 -89
  84. package/src/holograms/RealHolographicSystem.js +126 -31
  85. package/src/math/Mat4x4.js +488 -155
  86. package/src/math/Projection.js +57 -7
  87. package/src/math/Rotor4D.js +157 -67
  88. package/src/math/Vec4.js +265 -111
  89. package/src/math/index.js +7 -7
  90. package/src/quantum/QuantumVisualizer.js +24 -20
  91. package/src/reactivity/index.js +3 -5
  92. package/src/render/LayerPresetManager.js +372 -0
  93. package/src/render/LayerReactivityBridge.js +344 -0
  94. package/src/render/LayerRelationshipGraph.js +610 -0
  95. package/src/render/MultiCanvasBridge.js +148 -25
  96. package/src/render/ShaderLoader.js +38 -0
  97. package/src/render/ShaderProgram.js +4 -4
  98. package/src/render/UnifiedRenderBridge.js +1 -1
  99. package/src/render/backends/WebGPUBackend.js +8 -4
  100. package/src/render/index.js +27 -2
  101. package/src/scene/Node4D.js +74 -24
  102. package/src/scene/index.js +4 -4
  103. package/src/shaders/common/geometry24.glsl +65 -0
  104. package/src/shaders/common/geometry24.wgsl +54 -0
  105. package/src/shaders/common/rotation4d.glsl +4 -4
  106. package/src/shaders/common/rotation4d.wgsl +2 -2
  107. package/src/shaders/common/uniforms.wgsl +15 -8
  108. package/src/shaders/faceted/faceted.frag.wgsl +19 -6
  109. package/src/shaders/holographic/holographic.frag.wgsl +7 -5
  110. package/src/shaders/quantum/quantum.frag.wgsl +7 -5
  111. package/src/testing/ParallelTestFramework.js +2 -2
  112. package/src/testing/ProjectionClass.test.js +38 -0
  113. package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +2 -2
  114. package/src/viewer/GalleryUI.js +17 -0
  115. package/src/viewer/ViewerPortal.js +2 -2
  116. package/tools/shader-sync-verify.js +6 -4
  117. package/tools/update_projection.py +109 -0
  118. package/types/adaptive-sdk.d.ts +204 -5
  119. package/types/agent/cli.d.ts +78 -0
  120. package/types/agent/index.d.ts +18 -0
  121. package/types/agent/mcp.d.ts +87 -0
  122. package/types/agent/telemetry.d.ts +190 -0
  123. package/types/core/VIB3Engine.d.ts +26 -0
  124. package/types/core/index.d.ts +261 -0
  125. package/types/creative/AestheticMapper.d.ts +72 -0
  126. package/types/creative/ChoreographyPlayer.d.ts +96 -0
  127. package/types/creative/index.d.ts +17 -0
  128. package/types/export/index.d.ts +243 -0
  129. package/types/geometry/index.d.ts +164 -0
  130. package/types/math/index.d.ts +214 -0
  131. package/types/render/LayerPresetManager.d.ts +78 -0
  132. package/types/render/LayerReactivityBridge.d.ts +85 -0
  133. package/types/render/LayerRelationshipGraph.d.ts +174 -0
  134. package/types/render/index.d.ts +3 -0
  135. package/types/scene/index.d.ts +204 -0
  136. package/types/systems/index.d.ts +244 -0
  137. package/types/variations/index.d.ts +62 -0
  138. package/types/viewer/index.d.ts +225 -0
@@ -0,0 +1,389 @@
1
+ Last reviewed: 2026-02-17
2
+
3
+ # VIB3+ Ultra — The Emergent Media Engine
4
+
5
+ **Purpose**: This document defines the **Ultra Tier** expansion for VIB3+. While the Premium Tier (`EXPANSION_DESIGN.md`) focuses on professional visualization tools, the Ultra Tier transforms the SDK into a **full-stack emergent media engine** capable of powering 4D video games, generative cartoons, and multi-user hallucinations.
6
+
7
+ **Status**: Vision Document / Technical Specification.
8
+ **Dependencies**: Requires `@vib3code/sdk` (core) and `@vib3code/premium` (for fine-grained control).
9
+
10
+ ---
11
+
12
+ ## I. Architecture: The VIB3 Universe
13
+
14
+ The core shift is from **Single Instance** to **Orchestrated Universe**.
15
+
16
+ ### The Concept
17
+ Instead of "a canvas on a page," we treat the browser window as a **Universe** containing multiple **Entities** (VIB3 instances). These entities share a clock, a physics lattice, and a narrative context.
18
+
19
+ ### The `VIB3Orchestrator`
20
+ A new singleton that manages the lifecycle and coordination of all VIB3 instances.
21
+
22
+ ```javascript
23
+ class VIB3Orchestrator {
24
+ constructor() {
25
+ this.entities = new Map(); // id -> VIB3Entity
26
+ this.clock = new MasterClock({ bpm: 120 }); // Shared beat sync
27
+ this.physics = new LatticePhysicsEngine(); // 4D collision detection
28
+ this.link = new VIB3Link(); // WebRTC multi-user sync
29
+ }
30
+
31
+ // Spawn a new entity (actor, prop, or environment)
32
+ spawn(type, config) { ... }
33
+
34
+ // Global tick loop
35
+ tick(deltaTime) {
36
+ this.physics.update(this.entities, deltaTime);
37
+ this.entities.forEach(e => e.update(deltaTime));
38
+ this.link.sync(this.entities);
39
+ }
40
+ }
41
+ ```
42
+
43
+ ---
44
+
45
+ ## II. HyperNarrative: Animating Stories & Cartoons
46
+
47
+ VIB3+ can tell stories. Characters are not mesh rigs but **VIB3 Actors** — distinct visualization instances with "souls" (parameter personalities) that express emotion through math.
48
+
49
+ ### 1. The `VIB3Actor`
50
+ Wraps a `VIB3Engine` instance with identity, role, and emotional state.
51
+
52
+ ```javascript
53
+ class VIB3Actor {
54
+ constructor(engine, personalityProfile) {
55
+ this.engine = engine;
56
+ this.profile = personalityProfile; // e.g., 'AnxiousGlitch', 'StoicCrystal'
57
+ this.emotion = { valence: 0, arousal: 0 }; // -1 to 1
58
+ this.voice = new AudioEmitter(); // Spatial audio source
59
+ }
60
+
61
+ // Express an emotion (modulates parameters based on profile)
62
+ emote(emotionName, intensity) {
63
+ const params = this.profile.mapEmotion(emotionName, intensity);
64
+ this.engine.transition(params, 500, 'easeOut');
65
+ }
66
+
67
+ // "Speak" with audio-reactive mouth modulation
68
+ speak(audioBuffer) {
69
+ this.voice.play(audioBuffer);
70
+ this.voice.onAnalysis((amplitude) => {
71
+ // Modulate geometry to simulate speech/expression
72
+ this.engine.setParameter('morphFactor', 0.5 + amplitude * 1.5);
73
+ this.engine.setParameter('intensity', 0.6 + amplitude * 0.4);
74
+ });
75
+ }
76
+ }
77
+ ```
78
+
79
+ ### 2. The Script Format (`.vib3script`)
80
+ A JSON-based screenplay format that controls actors, cameras, and environment.
81
+
82
+ ```json
83
+ {
84
+ "title": "The Geometric Encounter",
85
+ "bpm": 110,
86
+ "cast": {
87
+ "Hero": { "system": "faceted", "geometry": 0, "profile": "heroic" },
88
+ "Villain": { "system": "quantum", "geometry": 16, "profile": "chaotic" }
89
+ },
90
+ "sequence": [
91
+ {
92
+ "time": "0:00",
93
+ "action": "camera_cut",
94
+ "target": "Hero",
95
+ "shot": "close_up" // Adjusts zoom/projection
96
+ },
97
+ {
98
+ "time": "0:02",
99
+ "actor": "Hero",
100
+ "action": "speak",
101
+ "text": "Why do you disturb the lattice?",
102
+ "audio": "hero_line_1.mp3",
103
+ "emotion": "stern"
104
+ },
105
+ {
106
+ "time": "0:05",
107
+ "actor": "Villain",
108
+ "action": "emote",
109
+ "emotion": "rage",
110
+ "intensity": 0.8 // Triggers red hue, high chaos, spike geometry
111
+ }
112
+ ]
113
+ }
114
+ ```
115
+
116
+ ### 3. LipSync & Performance
117
+ Use `WebAudioAPI` analysis on dialogue tracks to drive `morphFactor` (mouth opening) and `intensity` (energy).
118
+ - **Consonants (High Freq)**: Trigger `chaos` spikes (sharp edges).
119
+ - **Vowels (Mid Freq)**: Trigger `morphFactor` swells (round shapes).
120
+ - **Volume**: Drives `gridDensity` (louder = larger/closer).
121
+
122
+ ---
123
+
124
+ ## III. HyperGame: FPV Gameplay Engine
125
+
126
+ Transform VIB3+ from a passive visualizer into an active **4D Game Engine**.
127
+
128
+ ### 1. 4D Player Controller (`FPVController`)
129
+ Maps WASD + Mouse to 6D motion, allowing navigation *through* the hyperspace lattice.
130
+
131
+ - **W/S**: Move forward/back in Z (depth).
132
+ - **A/D**: Strafe in X.
133
+ - **Space/Shift**: Move in Y (up/down).
134
+ - **Q/E**: Rotate in XW plane (portal strafe).
135
+ - **Mouse**: Rotate XY (look left/right) and YZ (look up/down).
136
+
137
+ ```javascript
138
+ // Inside game loop
139
+ if (input.forward) {
140
+ // Move "camera" through 4D noise space
141
+ // We don't move geometry; we offset the noise coordinate system!
142
+ uniforms.u_noiseOffset.z += speed * dt;
143
+ }
144
+ if (input.portalLeft) {
145
+ // Rotate the entire world in 4D
146
+ uniforms.u_rot4dXW += rotationSpeed * dt;
147
+ }
148
+ ```
149
+
150
+ ### 2. Lattice Physics (`LatticeCollider`)
151
+ Collision detection is not mesh-based (too expensive/abstract). It is **Function-Based**.
152
+ Since VIB3+ geometries are defined by math functions (SDFs or lattice grids), we check the player's coordinate against the active function.
153
+
154
+ ```javascript
155
+ function checkCollision(playerPos, activeGeometry) {
156
+ // Sample the density function at player position
157
+ const density = getDensityAt(playerPos, activeGeometry);
158
+ if (density > 0.8) {
159
+ // Hit a "solid" part of the fractal/lattice
160
+ return true;
161
+ }
162
+ return false;
163
+ }
164
+ ```
165
+
166
+ ### 3. Entity System
167
+ Game objects are lightweight VIB3 instances or simplified shader particles.
168
+ - **Projectiles**: Small `Quantum` instances (single particle geometry) moving in XYZW.
169
+ - **Pickups**: `Faceted` geometries (spinning crystals) that trigger events on collision.
170
+ - **Enemies**: `Holographic` instances that track player position.
171
+
172
+ ### 4. Game State Manager
173
+ Tracks score, health, and inventory.
174
+ - **Health**: Low health = high `chromaticAberration` + desaturation + `glitch` effect.
175
+ - **Powerup**: Ingesting a "hypercube" powerup transitions the player's view to `HyperMode` (geometry 17, max color).
176
+
177
+ ---
178
+
179
+ ## IV. Emergent Media: AI & Multi-User Sync
180
+
181
+ The final frontier: VIB3+ experiences that are alive, shared, and intelligent.
182
+
183
+ ### 1. VIB3Link (Multi-User Hallucination)
184
+ Uses WebRTC/WebSockets to synchronize the `VIB3Orchestrator` state across clients.
185
+ - **Shared Seed**: All clients start with same RNG seed.
186
+ - **Input Sync**: Player A's rotation is broadcast to Player B.
187
+ - **State Consensus**: "If Player A explodes the star, Player B sees it explode."
188
+
189
+ **Use Case**: A shared "VR" room (on flat screens) where users float in a 4D chatroom, represented by their `VIB3Actor` avatars.
190
+
191
+ ### 2. The Live Director (AI Agent)
192
+ An autonomous agent (MCP-connected) that watches the "audience" (user input, webcam, mic) and adjusts the show.
193
+
194
+ - **Sentiment Analysis**: If audience audio is loud/happy -> increase `speed` and `saturation`.
195
+ - **Attention Tracking**: If user stops interacting -> trigger `FocusLock` or `Explosion` to regain attention.
196
+ - **Generative Scripting**: The AI writes the `.vib3script` in real-time based on a prompt ("Make it scary", "Make it romantic").
197
+
198
+ ---
199
+
200
+ ## V. New MCP Tools for Ultra Tier
201
+
202
+ To empower agents to build these experiences, we add the following tools:
203
+
204
+ ### `spawn_actor`
205
+ Creates a `VIB3Actor` with a specific personality and role.
206
+ ```json
207
+ { "role": "protagonist", "personality": "glitch_witch", "system": "holographic" }
208
+ ```
209
+
210
+ ### `direct_scene`
211
+ Issues a high-level direction to the `LiveDirector`.
212
+ ```json
213
+ { "mood": "increasing_tension", "pacing": "frenetic", "focus_target": "villain" }
214
+ ```
215
+
216
+ ### `configure_game_rules`
217
+ Sets up the `HyperGame` mechanics.
218
+ ```json
219
+ { "physics": "lattice_heavy", "collision_damage": 10, "goal": "collect_shards" }
220
+ ```
221
+
222
+ ### `sync_session`
223
+ Initializes `VIB3Link` for a multi-user session.
224
+ ```json
225
+ { "room_id": "lobby_1", "max_users": 4, "sync_mode": "strict" }
226
+ ```
227
+
228
+ ---
229
+
230
+ ## VI. Deep Multilayer Architecture
231
+
232
+ To support `VIB3Universe`, we need a robust system for managing interactions between multiple VIB3 instances. This is not just visual layering; it's logic layering.
233
+
234
+ ### 1. Visual Compositing (`VIB3Compositor`)
235
+ Managing 10+ layers (e.g., 2 instances × 5 holographic layers) requires a dedicated compositor to avoid DOM explosion and Z-fighting.
236
+
237
+ * **Render Targets**: Instead of rendering directly to the DOM, each VIB3 instance renders to an offscreen canvas.
238
+ * **Unified Stage**: The Compositor draws these offscreen buffers onto a single `GlobalCanvas` using WebGL blending.
239
+ * **Depth Sorting**: Instances are sorted by their "World Z" coordinate.
240
+ * **Masking**: Instances can mask each other (e.g., a character standing behind a portal).
241
+
242
+ ```javascript
243
+ class VIB3Compositor {
244
+ registerInstance(instanceId, textureSource) { ... }
245
+ setLayerOrder(instanceIds) { ... }
246
+ render() {
247
+ // Draw background instances
248
+ // Draw foreground instances with blending
249
+ // Apply global post-processing (unifying the look)
250
+ }
251
+ }
252
+ ```
253
+
254
+ ### 2. Logic Layering (`LoopCoordinator`)
255
+ We have three distinct loops running at different frequencies:
256
+ 1. **Physics Loop (Fixed Step, 60hz)**: Collision detection, movement integration. Deterministic for multiplayer sync.
257
+ 2. **Narrative Loop (Event Driven)**: Script execution, state machine transitions.
258
+ 3. **Reactive Loop (Frame Rate)**: Audio analysis, visual parameter smoothing.
259
+
260
+ The `VIB3Orchestrator` must prioritize these:
261
+ * Physics updates *must* happen before Visual updates.
262
+ * Narrative events trigger Physics state changes.
263
+
264
+ ### 3. State Hydration (`UniverseSerializer`)
265
+ Saving a multi-instance universe is complex. We need a schema that captures the relationships, not just individual parameters.
266
+
267
+ ```json
268
+ {
269
+ "universe_id": "u_8823",
270
+ "timestamp": 12044,
271
+ "entities": [
272
+ { "id": "hero", "type": "actor", "pos": [0,0,0], "params": {...} },
273
+ { "id": "world", "type": "environment", "params": {...} }
274
+ ],
275
+ "global_state": {
276
+ "gravity": 9.8,
277
+ "tension": 0.4
278
+ }
279
+ }
280
+ ```
281
+
282
+ This allows "save games" for HyperGame and "bookmarks" for HyperNarrative.
283
+
284
+ ---
285
+
286
+ ## VII. VIB3Link Protocol
287
+
288
+ VIB3Link uses WebRTC DataChannels for low-latency state synchronization between clients in a `VIB3Universe`.
289
+
290
+ ### Protocol Message Format
291
+
292
+ Messages are JSON-encoded packets:
293
+ ```json
294
+ {
295
+ "t": "type", // 'update', 'event', 'sync'
296
+ "s": 1023, // sequence number (for ordering)
297
+ "p": { ... } // payload
298
+ }
299
+ ```
300
+
301
+ ### Core Message Types
302
+
303
+ 1. **Entity Update (`upd`)**: High-frequency (20Hz) updates of position/rotation.
304
+ ```json
305
+ { "t": "upd", "id": "actor_1", "pos": [x,y,z], "rot": [x,y,z,w] }
306
+ ```
307
+ 2. **Parameter Delta (`prm`)**: When a visual parameter changes.
308
+ ```json
309
+ { "t": "prm", "id": "actor_1", "k": "chaos", "v": 0.8 }
310
+ ```
311
+ 3. **Universe Event (`evt`)**: Narrative triggers or game events.
312
+ ```json
313
+ { "t": "evt", "n": "explosion", "loc": [10, 0, 5], "pow": 0.9 }
314
+ ```
315
+
316
+ ### Synchronization Strategy
317
+
318
+ * **Authority**: One client is the **Host** (orchestrator). Others are **Peers**.
319
+ * **Prediction**: Peers predict entity movement based on velocity.
320
+ * **Reconciliation**: If Peer state diverges > threshold from Host state, snap to Host.
321
+ * **Interpolation**: Visuals render at `t - buffer` to ensure smooth interpolation between network packets.
322
+
323
+ ---
324
+
325
+ ## VIII. HyperGame Engine
326
+
327
+ The VIB3+ Ultra HyperGame Engine enables 4D First-Person View (FPV) experiences. It decouples the physics simulation from the render loop and provides a 4D-native player controller.
328
+
329
+ ### 1. The Game Loop (`GameLoop`)
330
+ A fixed-timestep loop for physics and logic, separate from the variable-timestep render loop. This ensures deterministic physics and smooth rendering even under load.
331
+
332
+ ```javascript
333
+ class GameLoop {
334
+ constructor(updateFn, renderFn) {
335
+ this.accumulator = 0;
336
+ this.step = 1 / 60; // 60hz physics
337
+ }
338
+ // ... accumulates time and calls update() multiple times if needed
339
+ }
340
+ ```
341
+
342
+ ### 2. Lattice Physics (`LatticePhysics`)
343
+ Physics in VIB3+ is not about mesh-mesh intersection. It is about **Point-Field intersection**. We define the world as a scalar field (density) and check if the player's 4D point is inside a high-density region.
344
+
345
+ * **Collision**: `getDensity(pos) > threshold`
346
+ * **Gravity**: Constant force in -Y (or arbitrary 4D vector)
347
+ * **Friction**: Velocity decay
348
+
349
+ ### 3. Player Controller 4D (`PlayerController4D`)
350
+ Handles input mapping for 6-degree-of-freedom movement.
351
+
352
+ * **Input**: WASD (Translation), Mouse (Rotation), QE (Portal/4D Rotation).
353
+ * **State**: Position (Vec4), Rotation (Rotor4D/Quat).
354
+ * **Smoothing**: Inputs are smoothed to prevent motion sickness in 4D space.
355
+
356
+ ```javascript
357
+ update(dt) {
358
+ // Apply inputs to velocity
359
+ // Apply physics (gravity, friction)
360
+ // Integrate position: pos += vel * dt
361
+ // Resolve collisions: if (collision) pos -= normal * penetration
362
+ }
363
+ ```
364
+
365
+ ---
366
+
367
+ ## IX. Demo: The Crystal Labyrinth
368
+
369
+ A vertical slice demo showcasing all Ultra capabilities in one cohesive experience.
370
+
371
+ ### Story & Premise
372
+ The player is a **Lattice Runner** navigating a fractured 4D hyperspace maze. The goal is to collect **Resonance Crystals** (Facet engines) while avoiding **Void Shadows** (Holographic engines) that hunt based on noise (movement speed).
373
+
374
+ ### Gameplay Loop
375
+ 1. **Explore**: Navigate the 4D maze using WASD+Mouse+QE.
376
+ 2. **Collect**: Find blue crystals. Touching one triggers a `VIB3Actor` "Collection" animation (implosion + sound).
377
+ 3. **Evade**: Red "Shadows" drift towards you. If they touch you, the screen glitches (`chromaticAberration` spike) and health drops.
378
+ 4. **Win**: Collect 5 crystals to stabilize the universe (trigger "Victory" state).
379
+
380
+ ### Technical Integration
381
+ * **Universe**: One `VIB3Universe` managing the Player, 5 Crystal Actors, and 3 Shadow Actors.
382
+ * **Physics**: `LatticePhysics` handles wall collisions (fractal noise walls).
383
+ * **AI**: `LiveDirector` adjusts Shadow aggression based on player movement speed (stealth mechanic).
384
+ * **Networking**: (Optional) `VIB3Link` allows a spectator to watch the runner.
385
+
386
+ ---
387
+
388
+ *VIB3+ Ultra — The Future of Emergent Media*
389
+ *Draft v5.0 — Added Crystal Labyrinth Demo Design — Feb 16, 2026*
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # Export formats
2
4
 
3
5
  This reference documents the target export formats supported by the agentic pipelines and how they are validated.
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # GPU disposal patterns
2
4
 
3
5
  This guide documents safe GPU resource disposal patterns to prevent memory leaks across rendering backends.
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # VIB3+ Landing Page & Marketing Handoff Prompt
2
4
 
3
5
  **Copy this entire document as the initial prompt when starting a new session focused on the landing page, marketing site, and forward-facing aspects.**
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # VIB3+ SDK — Comprehensive Agent Handoff
2
4
 
3
5
  **Copy this entire document as the initial prompt when starting a new session focused on SDK development.**
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # Licensing tiers (draft)
2
4
 
3
5
  This document outlines the proposed licensing tiers for the VIB3+ SDK and agentic tooling. It is intended as a working draft for Phase 5.
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # VIB3+ CORE — Master Plan & Full Audit
2
4
 
3
5
  **Date**: January 31, 2026
@@ -19,10 +21,10 @@ The codebase is complete. The product isn't. You have 95,000+ lines of working e
19
21
  - Creative Tooling (color presets, transitions, post-processing, timeline) — complete
20
22
  - Platform Integrations (React, Vue, Svelte, Figma, Three.js, TouchDesigner, OBS) — code complete
21
23
  - Advanced Features (WebXR, WebGPU Compute, MIDI, AI Presets, OffscreenWorker) — code complete
22
- - MCP Agentic Control (14 tools) — working
24
+ - MCP Agentic Control (36 tools — 14 core + 22 added in Phases 6.5-8) — working
23
25
  - C++ WASM Core with JS fallback — working
24
26
  - Export System (SVG, CSS, Lottie, Shader, Trading Cards, VIB3Package) — working
25
- - 693+ tests passing, 34 test files
27
+ - 1762 tests passing, 77 test files (as of Feb 15, 2026)
26
28
  - 6 CI/CD workflows active
27
29
 
28
30
  **What's not done**: Everything below.
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # VIB3+ Multi-Visualizer Choreography Patterns
2
4
 
3
5
  **Generated: 2026-02-09**
@@ -11,7 +13,7 @@
11
13
  1. [Depth Illusion Engine](#1-depth-illusion-engine)
12
14
  2. [Multi-Visualizer Coordination Modes](#2-multi-visualizer-coordination-modes)
13
15
  3. [Section-by-Section Choreography Upgrades](#3-section-by-section-choreography-upgrades)
14
- 4. [Accent & Texture Effects Library](#4-accent--texture-effects-library)
16
+ 4. [Accent & Texture Effects Library](#4-accent-texture-effects-library)
15
17
  5. [Mathematical Intertwining Functions](#5-mathematical-intertwining-functions)
16
18
  6. [Implementation Priority Map](#6-implementation-priority-map)
17
19
 
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # VIB3+ OBS Setup Guide
2
4
 
3
5
  Use VIB3+ as a live visualization overlay in OBS Studio.
@@ -0,0 +1,119 @@
1
+ Last reviewed: 2026-02-17
2
+ # Optimization Plan: Core Math Library
3
+
4
+ ## 1. Add `target` Parameters for Allocation-Free Operations
5
+
6
+ **Status:** High Impact / Medium Effort
7
+ **Currently:** `Mat4x4.multiply(m)` and `Mat4x4.multiplyVec4(v)` always return a `new` instance.
8
+ **Proposed:** Add an optional `target` parameter to write the result into an existing object.
9
+
10
+ ### Implementation
11
+ ```javascript
12
+ // Before
13
+ multiply(m) {
14
+ const out = new Mat4x4();
15
+ // ... compute ...
16
+ return out;
17
+ }
18
+
19
+ // After
20
+ multiply(m, target = null) {
21
+ const out = target || new Mat4x4();
22
+ // ... compute ...
23
+ return out;
24
+ }
25
+ ```
26
+
27
+ ### Cascading Changes
28
+ * **Scene Graph (`Node4D.js`):** Update `updateWorldMatrix` to reuse a cached matrix instance instead of creating a new one every frame.
29
+ * **Physics/Animation:** Update loops to reuse vector/matrix instances.
30
+
31
+ ### Watch Outs
32
+ * **Aliasing:** If `a.multiply(b, a)` is called (writing result back to operand), ensure the implementation handles this correctly. The current `multiplyInPlace` implementation handles this by caching values in local variables before writing to the array. Ensure new methods do the same.
33
+ * **API Consistency:** Ensure `target` is consistently the last argument or follows a predictable pattern.
34
+
35
+ ## 2. Implement `Vec4` Object Pooling (or Lightweight Structure)
36
+
37
+ **Status:** High Impact / High Complexity
38
+ **Currently:** `Vec4` allocates a `Float32Array(4)` per instance. This is heavy for the JS engine and GC.
39
+ **Proposed:**
40
+ 1. **Object Pool:** `Vec4.create()` grabs from a pool, `Vec4.release(v)` returns it.
41
+ 2. **Lightweight Class:** Use plain object `{x, y, z, w}` for intermediate math, only converting to `Float32Array` when uploading to GPU.
42
+
43
+ ### Implementation (Object Pool)
44
+ ```javascript
45
+ class Vec4Pool {
46
+ static get() { return pool.pop() || new Vec4(); }
47
+ static release(v) { pool.push(v); }
48
+ }
49
+ ```
50
+
51
+ ### Cascading Changes
52
+ * **Usage:** Requires changing *every* `new Vec4()` call to `Vec4Pool.get()` and ensuring `release()` is called when done.
53
+ * **Lifecycle Management:** Extremely error-prone in JS. Missing a release leaks memory; double-release corrupts data.
54
+
55
+ ### Watch Outs
56
+ * **Manual Memory Management:** This fights against the JS GC. Only worth it in extremely hot paths (e.g., particle systems, per-vertex operations).
57
+ * **Alternatives:** Consider simply using `Float32Array` offsets directly for bulk data (Structure of Arrays).
58
+
59
+ ## 3. Cache Common Constants
60
+
61
+ **Status:** Medium Impact / Low Effort
62
+ **Currently:** `Mat4x4.identity()` creates a new matrix every call.
63
+ **Proposed:** Add static read-only constants.
64
+
65
+ ### Implementation
66
+ ```javascript
67
+ class Mat4x4 {
68
+ static get IDENTITY() {
69
+ if (!this._identity) this._identity = new Mat4x4().setIdentity();
70
+ return this._identity;
71
+ }
72
+ }
73
+ ```
74
+
75
+ ### Cascading Changes
76
+ * **Usage:** Replace `Mat4x4.identity()` with `Mat4x4.IDENTITY` where read-only access is needed.
77
+ * **Cloning:** If modification is needed, use `Mat4x4.IDENTITY.clone()`.
78
+
79
+ ### Watch Outs
80
+ * **Accidental Mutation:** If someone does `Mat4x4.IDENTITY.translate(...)`, it corrupts the constant for everyone.
81
+ * *Mitigation:* `Object.freeze()` or similar protections (though this has a perf cost). Better to rely on convention or a `ReadonlyMat4x4` type if using TS.
82
+
83
+ ## 4. Optimize Scene Graph with In-Place Operations
84
+
85
+ **Status:** High Impact / Medium Effort
86
+ **Currently:** `Node4D.updateMatrix` often chains operations: `T * R * S`.
87
+ **Proposed:** Use the new `multiplyInPlace` and `rotateXX` methods.
88
+
89
+ ### Implementation
90
+ ```javascript
91
+ // Node4D.updateLocalMatrix
92
+ this.localMatrix.setIdentity();
93
+ this.localMatrix.translate(this.position); // Needs implementation
94
+ this.localMatrix.rotateFromAngles(this.rotation); // Needs implementation/update
95
+ this.localMatrix.scale(this.scale); // Needs implementation
96
+ ```
97
+
98
+ ### Cascading Changes
99
+ * **`Mat4x4` Extensions:** Need to implement `translate(v)`, `scale(v)` as in-place methods.
100
+ * **Logic Updates:** Rewrite `Node4D` transform logic to be imperative/stateful rather than functional/immutable.
101
+
102
+ ### Watch Outs
103
+ * **Order of Operations:** Ensure `T * R * S` vs `S * R * T` order is preserved correctly when converting to in-place calls.
104
+ * **Dirty Flags:** Ensure `localMatrix` update only happens when `position`, `rotation`, or `scale` changes.
105
+
106
+ ## 5. Bulk Operations for Geometry
107
+
108
+ **Status:** High Impact / High Complexity
109
+ **Currently:** `Mat4x4.multiplyVec4` processes one vector at a time.
110
+ **Proposed:** `Mat4x4.multiplyArray(inputArray, outputArray, count)`
111
+
112
+ ### Implementation
113
+ Operate directly on flat `Float32Array` buffers.
114
+
115
+ ### Cascading Changes
116
+ * **Geometry Generators:** Update to use bulk processing.
117
+
118
+ ### Watch Outs
119
+ * **SIMD:** Browsers are starting to support SIMD via WASM. This might be a better target for heavy bulk math than optimizing JS loops.
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # Product Strategy
2
4
 
3
5
  ## Purpose
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # Project setup (GCP + Firebase)
2
4
 
3
5
  This document provides a professional, repeatable setup flow for creating and configuring a new
package/DOCS/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # Documentation Index
2
4
 
3
5
  ## Strategy & Planning
@@ -54,7 +56,7 @@ Use these canonical documents first:
54
56
  | Architecture | [`DOCS/SYSTEM_INVENTORY.md`](./SYSTEM_INVENTORY.md) | ✅ System boundaries, modules, and capabilities | SDK Architecture | 2026-02-12 |
55
57
  | Product Strategy | [`DOCS/LICENSING_TIERS.md`](./LICENSING_TIERS.md) | ✅ Packaging, positioning, and commercial model | Product | 2026-02-12 |
56
58
  | Master Plan | [`DOCS/MASTER_PLAN_2026-01-31.md`](./MASTER_PLAN_2026-01-31.md) | ✅ Program-level priorities and sequencing | Program Management | 2026-02-12 |
57
- | Dev Track | [`DOCS/DEV_TRACK_SESSION_2026-02-06.md`](./DEV_TRACK_SESSION_2026-02-06.md) | ✅ Current implementation log and execution status | Engineering | 2026-02-12 |
59
+ | Dev Track | [`DOCS/DEV_TRACK_SESSION_2026-02-06.md`](./dev-tracks/DEV_TRACK_SESSION_2026-02-06.md) | ✅ Current implementation log and execution status | Engineering | 2026-02-12 |
58
60
 
59
61
  ## Reading Paths by Persona
60
62
 
@@ -70,7 +72,7 @@ Use these canonical documents first:
70
72
  2. [`DOCS/REPO_MANIFEST.md`](./REPO_MANIFEST.md)
71
73
  3. [`DOCS/SYSTEM_INVENTORY.md`](./SYSTEM_INVENTORY.md)
72
74
  4. [`DOCS/MASTER_PLAN_2026-01-31.md`](./MASTER_PLAN_2026-01-31.md)
73
- 5. Latest dev track session (currently [`DOCS/DEV_TRACK_SESSION_2026-02-06.md`](./DEV_TRACK_SESSION_2026-02-06.md))
75
+ 5. Latest dev track session (currently [`DOCS/DEV_TRACK_SESSION_2026-02-06.md`](./dev-tracks/DEV_TRACK_SESSION_2026-02-06.md))
74
76
 
75
77
  ### Product lead
76
78
  1. [`DOCS/LICENSING_TIERS.md`](./LICENSING_TIERS.md)
@@ -91,7 +93,7 @@ Use these canonical documents first:
91
93
  | Category | Scope | Primary files |
92
94
  |---|---|---|
93
95
  | Architecture | Runtime model, systems, lifecycles, controls | [`SYSTEM_INVENTORY.md`](./SYSTEM_INVENTORY.md) **(SOT)**, [`RENDERER_LIFECYCLE.md`](./RENDERER_LIFECYCLE.md), [`CONTROL_REFERENCE.md`](./CONTROL_REFERENCE.md), [`GPU_DISPOSAL_GUIDE.md`](./GPU_DISPOSAL_GUIDE.md) |
94
- | Planning | Strategy, roadmap, execution direction | [`MASTER_PLAN_2026-01-31.md`](./MASTER_PLAN_2026-01-31.md) **(SOT)**, [`DEV_TRACK_SESSION_2026-02-06.md`](./DEV_TRACK_SESSION_2026-02-06.md) **(SOT for active sprint log)**, [`DEV_TRACK_SESSION_2026-01-31.md`](./DEV_TRACK_SESSION_2026-01-31.md), [`LICENSING_TIERS.md`](./LICENSING_TIERS.md) **(SOT for product packaging)** |
96
+ | Planning | Strategy, roadmap, execution direction | [`MASTER_PLAN_2026-01-31.md`](./MASTER_PLAN_2026-01-31.md) **(SOT)**, [`DEV_TRACK_SESSION_2026-02-06.md`](./dev-tracks/DEV_TRACK_SESSION_2026-02-06.md) **(SOT for active sprint log)**, [`DEV_TRACK_SESSION_2026-01-31.md`](./dev-tracks/DEV_TRACK_SESSION_2026-01-31.md), [`LICENSING_TIERS.md`](./LICENSING_TIERS.md) **(SOT for product packaging)** |
95
97
  | Operations | Setup, CI, runbooks, observability | [`PROJECT_SETUP.md`](./PROJECT_SETUP.md) **(SOT for project bootstrap)**, [`ENV_SETUP.md`](./ENV_SETUP.md), [`CI_TESTING.md`](./CI_TESTING.md), [`OBS_SETUP_GUIDE.md`](./OBS_SETUP_GUIDE.md), [`TELEMETRY_EXPORTS.md`](./TELEMETRY_EXPORTS.md) |
96
98
  | Analysis | Benchmarks, visual analysis, design studies | [`WEBGPU_STATUS.md`](./WEBGPU_STATUS.md), [`XR_BENCHMARKS.md`](./XR_BENCHMARKS.md), [`CROSS_SITE_DESIGN_PATTERNS.md`](./CROSS_SITE_DESIGN_PATTERNS.md), `VISUAL_ANALYSIS_*.md`, [`REFERENCE_SCROLL_ANALYSIS.md`](./REFERENCE_SCROLL_ANALYSIS.md) |
97
99
  | Archive | Historical plans and audits retained for traceability | [`archive/`](./archive/) including [`archive/SYSTEM_AUDIT_2026-01-30.md`](./archive/SYSTEM_AUDIT_2026-01-30.md), [`archive/STRATEGIC_BLUEPRINT_2026-01-07.md`](./archive/STRATEGIC_BLUEPRINT_2026-01-07.md), [`archive/SESSION_LOG_2026-01-07.md`](./archive/SESSION_LOG_2026-01-07.md) |
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # Reference Site Scroll Effect Analysis
2
4
 
3
5
  **Updated: 2026-02-10**
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # Renderer lifecycle guide
2
4
 
3
5
  This document describes the renderer lifecycle architecture used by the core visualization systems
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # Repository Manifest
2
4
 
3
5
  This document enumerates the repository's directory structure and provides a high-level purpose for
package/DOCS/ROADMAP.md CHANGED
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # Strategic Roadmap
2
4
 
3
5
  This roadmap maps product strategy goals from [`DOCS/PRODUCT_STRATEGY.md`](./PRODUCT_STRATEGY.md) to technical epics and the primary module ownership areas.
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # VIB3+ Landing Page — Complete Scroll Timeline v3
2
4
 
3
5
  ## GPU-First Redesign: Real Visualizers Everywhere
@@ -1,3 +1,5 @@
1
+ Last reviewed: 2026-02-17
2
+
1
3
  # VIB3+ Landing Page Refactor Plan
2
4
 
3
5
  **Date:** 2026-02-13