@holoscript/core 2.0.1 → 2.1.0

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 (137) hide show
  1. package/dist/chunk-2XXE34KS.js +344 -0
  2. package/dist/chunk-2XXE34KS.js.map +1 -0
  3. package/dist/chunk-3X2EGU7Z.cjs +52 -0
  4. package/dist/chunk-3X2EGU7Z.cjs.map +1 -0
  5. package/dist/chunk-AFFVFO4D.js +1689 -0
  6. package/dist/chunk-AFFVFO4D.js.map +1 -0
  7. package/dist/chunk-DGUM43GV.js +10 -0
  8. package/dist/chunk-DGUM43GV.js.map +1 -0
  9. package/{src/HoloScriptDebugger.ts → dist/chunk-DOY73HDH.js} +118 -257
  10. package/dist/chunk-DOY73HDH.js.map +1 -0
  11. package/dist/chunk-JEQ2X3Z6.cjs +12 -0
  12. package/dist/chunk-JEQ2X3Z6.cjs.map +1 -0
  13. package/dist/chunk-L6VLNVKP.cjs +1691 -0
  14. package/dist/chunk-L6VLNVKP.cjs.map +1 -0
  15. package/dist/chunk-MFNO57XL.cjs +347 -0
  16. package/dist/chunk-MFNO57XL.cjs.map +1 -0
  17. package/dist/chunk-R75MREOS.cjs +424 -0
  18. package/dist/chunk-R75MREOS.cjs.map +1 -0
  19. package/dist/chunk-SATNCODL.js +45 -0
  20. package/dist/chunk-SATNCODL.js.map +1 -0
  21. package/dist/chunk-T57ZL7KR.cjs +1281 -0
  22. package/dist/chunk-T57ZL7KR.cjs.map +1 -0
  23. package/dist/chunk-U72GEJZT.js +1279 -0
  24. package/dist/chunk-U72GEJZT.js.map +1 -0
  25. package/dist/debugger.cjs +20 -0
  26. package/dist/debugger.cjs.map +1 -0
  27. package/dist/debugger.d.cts +171 -0
  28. package/dist/debugger.d.ts +171 -0
  29. package/dist/debugger.js +7 -0
  30. package/dist/debugger.js.map +1 -0
  31. package/dist/index.cjs +6803 -0
  32. package/dist/index.cjs.map +1 -0
  33. package/dist/index.d.cts +4093 -0
  34. package/dist/index.d.ts +4093 -0
  35. package/dist/index.js +6715 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/parser.cjs +14 -0
  38. package/dist/parser.cjs.map +1 -0
  39. package/dist/parser.d.cts +172 -0
  40. package/dist/parser.d.ts +172 -0
  41. package/dist/parser.js +5 -0
  42. package/dist/parser.js.map +1 -0
  43. package/dist/runtime.cjs +14 -0
  44. package/dist/runtime.cjs.map +1 -0
  45. package/dist/runtime.d.cts +200 -0
  46. package/dist/runtime.d.ts +200 -0
  47. package/dist/runtime.js +5 -0
  48. package/dist/runtime.js.map +1 -0
  49. package/dist/type-checker.cjs +17 -0
  50. package/dist/type-checker.cjs.map +1 -0
  51. package/dist/type-checker.d.cts +105 -0
  52. package/dist/type-checker.d.ts +105 -0
  53. package/dist/type-checker.js +4 -0
  54. package/dist/type-checker.js.map +1 -0
  55. package/dist/types-4h8cbtF_.d.cts +329 -0
  56. package/dist/types-4h8cbtF_.d.ts +329 -0
  57. package/package.json +17 -13
  58. package/src/HoloScript2DParser.js +0 -227
  59. package/src/HoloScript2DParser.ts +0 -261
  60. package/src/HoloScriptCodeParser.js +0 -1102
  61. package/src/HoloScriptCodeParser.ts +0 -1188
  62. package/src/HoloScriptDebugger.js +0 -458
  63. package/src/HoloScriptParser.js +0 -338
  64. package/src/HoloScriptParser.ts +0 -397
  65. package/src/HoloScriptPlusParser.js +0 -371
  66. package/src/HoloScriptPlusParser.ts +0 -543
  67. package/src/HoloScriptRuntime.js +0 -1399
  68. package/src/HoloScriptRuntime.test.js +0 -351
  69. package/src/HoloScriptRuntime.test.ts +0 -436
  70. package/src/HoloScriptRuntime.ts +0 -1653
  71. package/src/HoloScriptTypeChecker.js +0 -356
  72. package/src/HoloScriptTypeChecker.ts +0 -475
  73. package/src/__tests__/GraphicsServices.test.js +0 -357
  74. package/src/__tests__/GraphicsServices.test.ts +0 -427
  75. package/src/__tests__/HoloScriptPlusParser.test.js +0 -317
  76. package/src/__tests__/HoloScriptPlusParser.test.ts +0 -392
  77. package/src/__tests__/integration.test.js +0 -336
  78. package/src/__tests__/integration.test.ts +0 -416
  79. package/src/__tests__/performance.bench.js +0 -218
  80. package/src/__tests__/performance.bench.ts +0 -262
  81. package/src/__tests__/type-checker.test.js +0 -60
  82. package/src/__tests__/type-checker.test.ts +0 -73
  83. package/src/index.js +0 -217
  84. package/src/index.ts +0 -426
  85. package/src/interop/Interoperability.js +0 -413
  86. package/src/interop/Interoperability.ts +0 -494
  87. package/src/logger.js +0 -42
  88. package/src/logger.ts +0 -57
  89. package/src/parser/EnhancedParser.js +0 -205
  90. package/src/parser/EnhancedParser.ts +0 -251
  91. package/src/parser/HoloScriptPlusParser.js +0 -928
  92. package/src/parser/HoloScriptPlusParser.ts +0 -1089
  93. package/src/runtime/HoloScriptPlusRuntime.js +0 -674
  94. package/src/runtime/HoloScriptPlusRuntime.ts +0 -861
  95. package/src/runtime/PerformanceTelemetry.js +0 -323
  96. package/src/runtime/PerformanceTelemetry.ts +0 -467
  97. package/src/runtime/RuntimeOptimization.js +0 -361
  98. package/src/runtime/RuntimeOptimization.ts +0 -416
  99. package/src/services/HololandGraphicsPipelineService.js +0 -506
  100. package/src/services/HololandGraphicsPipelineService.ts +0 -662
  101. package/src/services/PlatformPerformanceOptimizer.js +0 -356
  102. package/src/services/PlatformPerformanceOptimizer.ts +0 -503
  103. package/src/state/ReactiveState.js +0 -427
  104. package/src/state/ReactiveState.ts +0 -572
  105. package/src/tools/DeveloperExperience.js +0 -376
  106. package/src/tools/DeveloperExperience.ts +0 -438
  107. package/src/traits/AIDriverTrait.js +0 -322
  108. package/src/traits/AIDriverTrait.test.js +0 -329
  109. package/src/traits/AIDriverTrait.test.ts +0 -357
  110. package/src/traits/AIDriverTrait.ts +0 -474
  111. package/src/traits/LightingTrait.js +0 -313
  112. package/src/traits/LightingTrait.test.js +0 -410
  113. package/src/traits/LightingTrait.test.ts +0 -462
  114. package/src/traits/LightingTrait.ts +0 -505
  115. package/src/traits/MaterialTrait.js +0 -194
  116. package/src/traits/MaterialTrait.test.js +0 -286
  117. package/src/traits/MaterialTrait.test.ts +0 -329
  118. package/src/traits/MaterialTrait.ts +0 -324
  119. package/src/traits/RenderingTrait.js +0 -356
  120. package/src/traits/RenderingTrait.test.js +0 -363
  121. package/src/traits/RenderingTrait.test.ts +0 -427
  122. package/src/traits/RenderingTrait.ts +0 -555
  123. package/src/traits/VRTraitSystem.js +0 -740
  124. package/src/traits/VRTraitSystem.ts +0 -1040
  125. package/src/traits/VoiceInputTrait.js +0 -284
  126. package/src/traits/VoiceInputTrait.test.js +0 -226
  127. package/src/traits/VoiceInputTrait.test.ts +0 -252
  128. package/src/traits/VoiceInputTrait.ts +0 -401
  129. package/src/types/AdvancedTypeSystem.js +0 -226
  130. package/src/types/AdvancedTypeSystem.ts +0 -494
  131. package/src/types/HoloScriptPlus.d.ts +0 -853
  132. package/src/types.js +0 -6
  133. package/src/types.ts +0 -369
  134. package/tsconfig.json +0 -23
  135. package/tsup.config.d.ts +0 -2
  136. package/tsup.config.js +0 -18
  137. package/tsup.config.ts +0 -19
@@ -0,0 +1,4093 @@
1
+ import { U as UI2DNode, P as Position2D, V as VoiceCommand$1, A as ASTNode, G as GestureData, S as SpatialPosition } from './types-4h8cbtF_.cjs';
2
+ export { o as CollisionEvent, k as Color, C as ConnectionNode, D as Duration, B as ExecutionResult, E as ExportNode, u as ForEachLoopNode, F as ForLoopNode, f as GateNode, h as GenericASTNode, c as GestureType, p as GrabbableTrait, d as HandType, J as HoloScriptValue, b as HologramProperties, H as HologramShape, s as HoverableTrait, v as ImportLoader, I as ImportNode, M as MethodNode, O as OrbNode, e as ParameterNode, K as ParticleSystem, r as PointableTrait, R as RotatableTrait, z as RuntimeContext, N as RuntimeSecurityLimits, t as ScalableTrait, L as SecurityConfig, a as Size2D, g as StreamNode, n as ThrowVelocity, q as ThrowableTrait, l as Transform, T as TransformationNode, x as UIElementType, y as UIStyle, m as VRHand, w as VariableDeclarationNode, j as Vector2, i as Vector3, W as WhileLoopNode } from './types-4h8cbtF_.cjs';
3
+ import { HoloScriptRuntime } from './runtime.cjs';
4
+ export { HoloScriptCodeParser, ParseError, ParseResult } from './parser.cjs';
5
+ export { HoloScriptTypeChecker, TypeCheckResult, TypeDiagnostic, TypeInfo, createTypeChecker } from './type-checker.cjs';
6
+ export { Breakpoint, DebugEvent, DebugState, HoloScriptDebugger, StackFrame, StepMode, createDebugger } from './debugger.cjs';
7
+
8
+ /**
9
+ * HoloScript+ Researcher & Viralist Traits
10
+ *
11
+ * Extended trait system for content creators, researchers, and viral content production.
12
+ * These traits enable recording, analytics, social sharing, effects, and AI-powered features.
13
+ *
14
+ * @version 2.0.0
15
+ * @license MIT
16
+ */
17
+
18
+
19
+
20
+ // =============================================================================
21
+ // MEDIA PRODUCTION TRAITS
22
+ // =============================================================================
23
+
24
+ /**
25
+ * @recordable - Capture scene/viewport for viral clips
26
+ */
27
+ interface RecordableTrait {
28
+ /** Capture mode - 360 panoramic, viewport only, or fixed camera angle */
29
+ capture_mode?: '360' | 'viewport' | 'fixed_camera' | 'follow_target';
30
+
31
+ /** Output resolution */
32
+ resolution?: Vector2;
33
+
34
+ /** Frames per second */
35
+ fps?: 30 | 60 | 120;
36
+
37
+ /** Output format */
38
+ format?: 'mp4' | 'webm' | 'gif' | 'png_sequence';
39
+
40
+ /** Maximum recording duration */
41
+ max_duration?: Duration;
42
+
43
+ /** Include audio in recording */
44
+ include_audio?: boolean;
45
+
46
+ /** Auto-start recording on scene load */
47
+ auto_record?: boolean;
48
+
49
+ /** Hotkey to toggle recording */
50
+ hotkey?: string;
51
+
52
+ /** Watermark configuration */
53
+ watermark?: {
54
+ image?: string;
55
+ position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
56
+ opacity?: number;
57
+ };
58
+
59
+ /** Quality preset */
60
+ quality?: 'low' | 'medium' | 'high' | 'ultra';
61
+
62
+ /** Enable highlight detection for auto-clipping */
63
+ highlight_detection?: boolean;
64
+ }
65
+
66
+ /**
67
+ * @streamable - Live streaming to platforms
68
+ */
69
+ interface StreamableTrait {
70
+ /** Target platform */
71
+ platform?: 'twitch' | 'youtube' | 'kick' | 'custom';
72
+
73
+ /** Custom RTMP URL for streaming */
74
+ rtmp_url?: string;
75
+
76
+ /** Stream key (should be env variable reference) */
77
+ stream_key_env?: string;
78
+
79
+ /** Bitrate in kbps */
80
+ bitrate?: number;
81
+
82
+ /** Resolution */
83
+ resolution?: Vector2;
84
+
85
+ /** Enable chat overlay */
86
+ chat_overlay?: boolean;
87
+
88
+ /** Viewer count display */
89
+ show_viewer_count?: boolean;
90
+
91
+ /** Auto-start streaming */
92
+ auto_start?: boolean;
93
+
94
+ /** Low latency mode */
95
+ low_latency?: boolean;
96
+ }
97
+
98
+ /**
99
+ * @camera - Virtual camera control for cinematic shots
100
+ */
101
+ interface CameraTrait {
102
+ /** Camera movement mode */
103
+ mode?: 'static' | 'orbit' | 'dolly' | 'crane' | 'handheld' | 'follow' | 'first_person';
104
+
105
+ /** Target object to follow/orbit */
106
+ target?: string;
107
+
108
+ /** Orbit distance from target */
109
+ orbit_distance?: number;
110
+
111
+ /** Auto-rotate around target */
112
+ auto_rotate?: boolean;
113
+
114
+ /** Rotation speed (degrees per second) */
115
+ rotation_speed?: number;
116
+
117
+ /** Smooth follow interpolation */
118
+ smooth_follow?: boolean;
119
+
120
+ /** Follow smoothness (0-1) */
121
+ follow_smoothness?: number;
122
+
123
+ /** Camera shake intensity */
124
+ shake_intensity?: number;
125
+
126
+ /** Shake frequency */
127
+ shake_frequency?: number;
128
+
129
+ /** Field of view */
130
+ fov?: number;
131
+
132
+ /** Depth of field settings */
133
+ depth_of_field?: {
134
+ enabled?: boolean;
135
+ focus_distance?: number;
136
+ aperture?: number;
137
+ blur_intensity?: number;
138
+ };
139
+
140
+ /** Cinematic bars (letterbox) */
141
+ letterbox?: boolean;
142
+
143
+ /** Letterbox ratio */
144
+ aspect_ratio?: '16:9' | '21:9' | '2.35:1' | 'custom';
145
+
146
+ /** Path following */
147
+ path?: Vector3$1[];
148
+
149
+ /** Path animation duration */
150
+ path_duration?: Duration;
151
+
152
+ /** Path easing */
153
+ path_easing?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
154
+ }
155
+
156
+ /**
157
+ * @video - Video playback in scene
158
+ */
159
+ interface VideoTrait {
160
+ /** Video source URL */
161
+ source: string;
162
+
163
+ /** Auto-play on load */
164
+ autoplay?: boolean;
165
+
166
+ /** Loop video */
167
+ loop?: boolean;
168
+
169
+ /** Muted by default */
170
+ muted?: boolean;
171
+
172
+ /** Volume (0-1) */
173
+ volume?: number;
174
+
175
+ /** Spatial audio for video */
176
+ spatial?: boolean;
177
+
178
+ /** Playback controls visible */
179
+ controls?: boolean;
180
+
181
+ /** Projection type */
182
+ projection?: 'flat' | '360' | '180' | 'dome';
183
+
184
+ /** Chroma key (green screen) */
185
+ chroma_key?: {
186
+ enabled?: boolean;
187
+ color?: Color$1;
188
+ threshold?: number;
189
+ };
190
+ }
191
+
192
+ // =============================================================================
193
+ // ANALYTICS & RESEARCH TRAITS
194
+ // =============================================================================
195
+
196
+ /**
197
+ * @trackable - User engagement tracking
198
+ */
199
+ interface TrackableTrait {
200
+ /** Events to track */
201
+ track_events?: Array<'grab' | 'look' | 'interact' | 'hover' | 'click' | 'proximity' | 'time_spent'>;
202
+
203
+ /** Enable heatmap generation */
204
+ heatmap?: boolean;
205
+
206
+ /** Heatmap resolution */
207
+ heatmap_resolution?: 'low' | 'medium' | 'high';
208
+
209
+ /** Session recording */
210
+ session_recording?: boolean;
211
+
212
+ /** Track gaze/eye direction */
213
+ gaze_tracking?: boolean;
214
+
215
+ /** Minimum dwell time to count as engagement (ms) */
216
+ dwell_threshold?: number;
217
+
218
+ /** Export format for analytics data */
219
+ export_format?: 'json' | 'csv' | 'parquet';
220
+
221
+ /** Real-time analytics endpoint */
222
+ realtime_endpoint?: string;
223
+
224
+ /** Batch analytics endpoint */
225
+ batch_endpoint?: string;
226
+
227
+ /** Anonymous tracking (no user IDs) */
228
+ anonymous?: boolean;
229
+
230
+ /** GDPR compliance mode */
231
+ gdpr_compliant?: boolean;
232
+
233
+ /** Custom event properties */
234
+ custom_properties?: Record<string, unknown>;
235
+ }
236
+
237
+ /**
238
+ * @survey - In-VR research surveys
239
+ */
240
+ interface SurveyTrait {
241
+ /** Survey questions */
242
+ questions: SurveyQuestion[];
243
+
244
+ /** When to trigger survey */
245
+ trigger?: 'on_enter' | 'on_exit' | 'after_task' | 'timed' | 'manual';
246
+
247
+ /** Delay before showing (for timed trigger) */
248
+ delay?: Duration;
249
+
250
+ /** Survey title */
251
+ title?: string;
252
+
253
+ /** Survey description */
254
+ description?: string;
255
+
256
+ /** Submit endpoint */
257
+ submit_endpoint?: string;
258
+
259
+ /** Allow skip */
260
+ skippable?: boolean;
261
+
262
+ /** Show progress indicator */
263
+ show_progress?: boolean;
264
+
265
+ /** Randomize question order */
266
+ randomize?: boolean;
267
+
268
+ /** Thank you message after completion */
269
+ thank_you_message?: string;
270
+
271
+ /** Reward for completion */
272
+ completion_reward?: {
273
+ type?: 'badge' | 'item' | 'points';
274
+ value?: string | number;
275
+ };
276
+ }
277
+
278
+ interface SurveyQuestion {
279
+ /** Question type */
280
+ type: 'rating' | 'choice' | 'multi_choice' | 'open' | 'slider' | 'likert' | 'nps';
281
+
282
+ /** Question text */
283
+ text: string;
284
+
285
+ /** Question ID for data export */
286
+ id?: string;
287
+
288
+ /** Required question */
289
+ required?: boolean;
290
+
291
+ /** Options for choice questions */
292
+ options?: string[];
293
+
294
+ /** Scale for rating/slider questions */
295
+ scale?: number;
296
+
297
+ /** Min/max labels for scales */
298
+ scale_labels?: { min?: string; max?: string };
299
+
300
+ /** Conditional display based on previous answer */
301
+ show_if?: { question_id: string; answer: string | number };
302
+ }
303
+
304
+ /**
305
+ * @abtest - A/B testing framework
306
+ */
307
+ interface ABTestTrait {
308
+ /** Test name/ID */
309
+ test_id: string;
310
+
311
+ /** Variant configurations */
312
+ variants: Record<string, Record<string, unknown>>;
313
+
314
+ /** Traffic split percentages */
315
+ split?: Record<string, number>;
316
+
317
+ /** Metric to track for success */
318
+ track_metric?: 'engagement_time' | 'conversion' | 'completion' | 'custom';
319
+
320
+ /** Custom metric name */
321
+ custom_metric?: string;
322
+
323
+ /** Minimum sample size before concluding */
324
+ min_sample_size?: number;
325
+
326
+ /** Statistical significance threshold */
327
+ significance_threshold?: number;
328
+
329
+ /** Sticky assignment (same user always sees same variant) */
330
+ sticky?: boolean;
331
+
332
+ /** Analytics endpoint */
333
+ analytics_endpoint?: string;
334
+ }
335
+
336
+ /**
337
+ * @heatmap - Spatial engagement heatmap
338
+ */
339
+ interface HeatmapTrait {
340
+ /** Heatmap type */
341
+ type?: 'position' | 'gaze' | 'interaction' | 'time_spent';
342
+
343
+ /** Resolution of the heatmap grid */
344
+ resolution?: number;
345
+
346
+ /** Color gradient */
347
+ colors?: Color$1[];
348
+
349
+ /** Opacity */
350
+ opacity?: number;
351
+
352
+ /** Real-time visualization */
353
+ realtime?: boolean;
354
+
355
+ /** Export heatmap data */
356
+ export?: boolean;
357
+
358
+ /** 3D volumetric heatmap */
359
+ volumetric?: boolean;
360
+
361
+ /** Decay rate for time-based heatmaps */
362
+ decay_rate?: number;
363
+ }
364
+
365
+ // =============================================================================
366
+ // SOCIAL & VIRAL TRAITS
367
+ // =============================================================================
368
+
369
+ /**
370
+ * @shareable - Social sharing capabilities
371
+ */
372
+ interface ShareableTrait {
373
+ /** Target platforms */
374
+ platforms?: Array<'twitter' | 'tiktok' | 'instagram' | 'discord' | 'facebook' | 'linkedin' | 'reddit' | 'clipboard'>;
375
+
376
+ /** Auto-generate clip on share */
377
+ auto_clip?: {
378
+ enabled?: boolean;
379
+ duration?: number;
380
+ trigger?: 'highlight' | 'manual' | 'interval';
381
+ };
382
+
383
+ /** Watermark on shared content */
384
+ watermark?: string;
385
+
386
+ /** Caption template (supports variables) */
387
+ caption_template?: string;
388
+
389
+ /** Hashtags to include */
390
+ hashtags?: string[];
391
+
392
+ /** Share button visibility */
393
+ share_button?: {
394
+ visible?: boolean;
395
+ position?: Vector3$1;
396
+ style?: 'minimal' | 'full' | 'floating';
397
+ };
398
+
399
+ /** Track shares */
400
+ track_shares?: boolean;
401
+
402
+ /** Referral tracking */
403
+ referral_tracking?: boolean;
404
+ }
405
+
406
+ /**
407
+ * @embeddable - Generate embed codes
408
+ */
409
+ interface EmbeddableTrait {
410
+ /** Allow iframe embedding */
411
+ iframe_allowed?: boolean;
412
+
413
+ /** Minimum embed width */
414
+ min_width?: number;
415
+
416
+ /** Minimum embed height */
417
+ min_height?: number;
418
+
419
+ /** Responsive sizing */
420
+ responsive?: boolean;
421
+
422
+ /** Allowed domains for embedding */
423
+ allowed_domains?: string[];
424
+
425
+ /** Controls to show in embed */
426
+ controls?: Array<'fullscreen' | 'vr_toggle' | 'mute' | 'share'>;
427
+
428
+ /** Auto-play in embed */
429
+ autoplay?: boolean;
430
+
431
+ /** Show branding */
432
+ show_branding?: boolean;
433
+ }
434
+
435
+ /**
436
+ * @qr - Generate QR codes
437
+ */
438
+ interface QRTrait {
439
+ /** Content for QR code (URL, text, etc.) */
440
+ content: string;
441
+
442
+ /** QR code size in world units */
443
+ size?: number;
444
+
445
+ /** Error correction level */
446
+ error_correction?: 'L' | 'M' | 'Q' | 'H';
447
+
448
+ /** Foreground color */
449
+ foreground_color?: Color$1;
450
+
451
+ /** Background color */
452
+ background_color?: Color$1;
453
+
454
+ /** Include logo in center */
455
+ logo?: string;
456
+
457
+ /** Dynamic content (updates on state change) */
458
+ dynamic?: boolean;
459
+
460
+ /** Track scans */
461
+ track_scans?: boolean;
462
+ }
463
+
464
+ /**
465
+ * @collaborative - Real-time co-editing
466
+ */
467
+ interface CollaborativeTrait {
468
+ /** Maximum simultaneous editors */
469
+ max_editors?: number;
470
+
471
+ /** Permission model */
472
+ permission_model?: 'owner' | 'open' | 'invite' | 'role_based';
473
+
474
+ /** Sync mode */
475
+ sync_mode?: 'realtime' | 'turn_based' | 'async';
476
+
477
+ /** Show other users' cursors */
478
+ show_cursors?: boolean;
479
+
480
+ /** Cursor colors for different users */
481
+ cursor_colors?: Color$1[];
482
+
483
+ /** Voice chat for collaborators */
484
+ voice_chat?: boolean;
485
+
486
+ /** Text chat */
487
+ text_chat?: boolean;
488
+
489
+ /** Conflict resolution strategy */
490
+ conflict_resolution?: 'last_write_wins' | 'merge' | 'manual';
491
+
492
+ /** Version history */
493
+ version_history?: boolean;
494
+
495
+ /** Undo/redo sync */
496
+ sync_undo?: boolean;
497
+ }
498
+
499
+ // =============================================================================
500
+ // EFFECTS & POLISH TRAITS
501
+ // =============================================================================
502
+
503
+ /**
504
+ * @particle - Particle system
505
+ */
506
+ interface ParticleTrait {
507
+ /** Particle emission type */
508
+ type?: 'burst' | 'continuous' | 'trail';
509
+
510
+ /** Emitter shape */
511
+ shape?: 'point' | 'sphere' | 'box' | 'cone' | 'circle' | 'edge' | 'mesh';
512
+
513
+ /** Emission rate (particles per second) */
514
+ rate?: number;
515
+
516
+ /** Burst count (for burst type) */
517
+ burst_count?: number;
518
+
519
+ /** Particle lifetime */
520
+ lifetime?: Duration;
521
+
522
+ /** Lifetime randomness (0-1) */
523
+ lifetime_randomness?: number;
524
+
525
+ /** Start size */
526
+ start_size?: number;
527
+
528
+ /** End size */
529
+ end_size?: number;
530
+
531
+ /** Size randomness */
532
+ size_randomness?: number;
533
+
534
+ /** Start color */
535
+ start_color?: Color$1;
536
+
537
+ /** End color */
538
+ end_color?: Color$1;
539
+
540
+ /** Color over lifetime gradient */
541
+ color_over_lifetime?: Color$1[];
542
+
543
+ /** Start velocity */
544
+ velocity?: Vector3$1;
545
+
546
+ /** Velocity randomness */
547
+ velocity_randomness?: number;
548
+
549
+ /** Gravity effect */
550
+ gravity?: number;
551
+
552
+ /** Particle texture/sprite */
553
+ texture?: string;
554
+
555
+ /** Blend mode */
556
+ blend_mode?: 'additive' | 'alpha' | 'multiply';
557
+
558
+ /** Max particles */
559
+ max_particles?: number;
560
+
561
+ /** Collision with scene */
562
+ collision?: boolean;
563
+
564
+ /** Inherit velocity from parent */
565
+ inherit_velocity?: boolean;
566
+
567
+ /** World or local space */
568
+ simulation_space?: 'world' | 'local';
569
+ }
570
+
571
+ /**
572
+ * @transition - Scene/object transitions
573
+ */
574
+ interface TransitionTrait {
575
+ /** Enter transition effect */
576
+ enter?: 'fade' | 'zoom' | 'portal' | 'dissolve' | 'slide' | 'flip' | 'morph' | 'glitch';
577
+
578
+ /** Exit transition effect */
579
+ exit?: 'fade' | 'shrink' | 'portal' | 'dissolve' | 'slide' | 'flip' | 'explode';
580
+
581
+ /** Transition duration */
582
+ duration?: Duration;
583
+
584
+ /** Transition easing */
585
+ easing?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'bounce' | 'elastic';
586
+
587
+ /** Delay before transition */
588
+ delay?: Duration;
589
+
590
+ /** Transition direction (for slide) */
591
+ direction?: 'up' | 'down' | 'left' | 'right';
592
+
593
+ /** Portal color (for portal transition) */
594
+ portal_color?: Color$1;
595
+
596
+ /** Stagger children transitions */
597
+ stagger?: Duration;
598
+
599
+ /** Stagger order */
600
+ stagger_order?: 'forward' | 'reverse' | 'random';
601
+ }
602
+
603
+ /**
604
+ * @filter - Post-processing effects
605
+ */
606
+ interface FilterTrait {
607
+ /** Bloom effect */
608
+ bloom?: {
609
+ enabled?: boolean;
610
+ intensity?: number;
611
+ threshold?: number;
612
+ radius?: number;
613
+ };
614
+
615
+ /** Vignette effect */
616
+ vignette?: {
617
+ enabled?: boolean;
618
+ intensity?: number;
619
+ smoothness?: number;
620
+ };
621
+
622
+ /** Color grading preset */
623
+ color_grading?: 'none' | 'cinematic' | 'vibrant' | 'noir' | 'vintage' | 'cyberpunk' | 'warm' | 'cool';
624
+
625
+ /** Custom LUT texture */
626
+ lut?: string;
627
+
628
+ /** Chromatic aberration */
629
+ chromatic_aberration?: {
630
+ enabled?: boolean;
631
+ intensity?: number;
632
+ };
633
+
634
+ /** Film grain */
635
+ grain?: {
636
+ enabled?: boolean;
637
+ intensity?: number;
638
+ size?: number;
639
+ };
640
+
641
+ /** Motion blur */
642
+ motion_blur?: {
643
+ enabled?: boolean;
644
+ intensity?: number;
645
+ samples?: number;
646
+ };
647
+
648
+ /** Ambient occlusion */
649
+ ambient_occlusion?: {
650
+ enabled?: boolean;
651
+ intensity?: number;
652
+ radius?: number;
653
+ };
654
+
655
+ /** Pixelation */
656
+ pixelate?: {
657
+ enabled?: boolean;
658
+ size?: number;
659
+ };
660
+
661
+ /** Custom shader */
662
+ custom_shader?: string;
663
+ }
664
+
665
+ /**
666
+ * @trail - Motion trail effect
667
+ */
668
+ interface TrailTrait {
669
+ /** Trail length (number of points) */
670
+ length?: number;
671
+
672
+ /** Trail width */
673
+ width?: number;
674
+
675
+ /** Width curve over length */
676
+ width_curve?: number[];
677
+
678
+ /** Trail color */
679
+ color?: Color$1;
680
+
681
+ /** Color gradient over length */
682
+ color_gradient?: Color$1[];
683
+
684
+ /** Trail fade */
685
+ fade?: boolean;
686
+
687
+ /** Fade curve */
688
+ fade_curve?: number[];
689
+
690
+ /** Emit when moving threshold */
691
+ emit_threshold?: number;
692
+
693
+ /** Trail texture */
694
+ texture?: string;
695
+
696
+ /** Minimum vertex distance */
697
+ min_vertex_distance?: number;
698
+
699
+ /** Auto-destruct when stopped */
700
+ auto_destruct?: boolean;
701
+ }
702
+
703
+ // =============================================================================
704
+ // AUDIO TRAITS
705
+ // =============================================================================
706
+
707
+ /**
708
+ * @spatial_audio - 3D positional audio
709
+ */
710
+ interface SpatialAudioTrait {
711
+ /** Audio source URL */
712
+ source: string;
713
+
714
+ /** Volume (0-1) */
715
+ volume?: number;
716
+
717
+ /** Pitch */
718
+ pitch?: number;
719
+
720
+ /** Loop audio */
721
+ loop?: boolean;
722
+
723
+ /** Spatial blend (0 = 2D, 1 = 3D) */
724
+ spatial_blend?: number;
725
+
726
+ /** Distance falloff type */
727
+ falloff?: 'linear' | 'logarithmic' | 'custom';
728
+
729
+ /** Minimum distance for falloff */
730
+ min_distance?: number;
731
+
732
+ /** Maximum distance for falloff */
733
+ max_distance?: number;
734
+
735
+ /** Reverb zone */
736
+ reverb?: {
737
+ enabled?: boolean;
738
+ preset?: 'room' | 'hall' | 'cave' | 'outdoor' | 'underwater';
739
+ wet_level?: number;
740
+ };
741
+
742
+ /** Doppler effect */
743
+ doppler?: number;
744
+
745
+ /** Spread angle (degrees) */
746
+ spread?: number;
747
+
748
+ /** Occlusion (sound blocked by objects) */
749
+ occlusion?: boolean;
750
+ }
751
+
752
+ /**
753
+ * @voice - Voice chat
754
+ */
755
+ interface VoiceTrait {
756
+ /** Voice chat mode */
757
+ mode?: 'proximity' | 'global' | 'channel' | 'team';
758
+
759
+ /** Spatial voice positioning */
760
+ spatial?: boolean;
761
+
762
+ /** Push-to-talk */
763
+ push_to_talk?: boolean;
764
+
765
+ /** Push-to-talk key */
766
+ ptt_key?: string;
767
+
768
+ /** Voice activation threshold */
769
+ activation_threshold?: number;
770
+
771
+ /** Echo cancellation */
772
+ echo_cancellation?: boolean;
773
+
774
+ /** Noise suppression */
775
+ noise_suppression?: boolean;
776
+
777
+ /** Auto gain control */
778
+ auto_gain?: boolean;
779
+
780
+ /** Channel name (for channel mode) */
781
+ channel?: string;
782
+
783
+ /** Maximum distance for proximity mode */
784
+ proximity_distance?: number;
785
+
786
+ /** Voice indicator visible */
787
+ show_indicator?: boolean;
788
+ }
789
+
790
+ /**
791
+ * @reactive_audio - Audio-reactive visuals
792
+ */
793
+ interface ReactiveAudioTrait {
794
+ /** Audio source */
795
+ source?: 'microphone' | 'audio_element' | 'system' | 'custom';
796
+
797
+ /** Audio element ID (for audio_element source) */
798
+ audio_element?: string;
799
+
800
+ /** Number of frequency bands to analyze */
801
+ frequency_bands?: number;
802
+
803
+ /** FFT size */
804
+ fft_size?: 256 | 512 | 1024 | 2048 | 4096;
805
+
806
+ /** Smoothing time constant */
807
+ smoothing?: number;
808
+
809
+ /** Beat detection */
810
+ beat_detection?: boolean;
811
+
812
+ /** Beat threshold */
813
+ beat_threshold?: number;
814
+
815
+ /** Min decibels */
816
+ min_decibels?: number;
817
+
818
+ /** Max decibels */
819
+ max_decibels?: number;
820
+
821
+ /** Frequency range to analyze */
822
+ frequency_range?: { min?: number; max?: number };
823
+ }
824
+
825
+ // =============================================================================
826
+ // AI & GENERATIVE TRAITS
827
+ // =============================================================================
828
+
829
+ /**
830
+ * @narrator - AI narration
831
+ */
832
+ interface NarratorTrait {
833
+ /** Voice preset */
834
+ voice?: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer' | 'custom';
835
+
836
+ /** Custom voice ID */
837
+ custom_voice_id?: string;
838
+
839
+ /** Narration script */
840
+ script?: string;
841
+
842
+ /** Dynamic script (generated from context) */
843
+ dynamic_script?: boolean;
844
+
845
+ /** Script generation prompt */
846
+ script_prompt?: string;
847
+
848
+ /** Trigger condition */
849
+ trigger?: 'on_enter' | 'on_approach' | 'on_interact' | 'on_event' | 'manual';
850
+
851
+ /** Trigger distance (for on_approach) */
852
+ trigger_distance?: number;
853
+
854
+ /** Subtitles display */
855
+ subtitles?: boolean;
856
+
857
+ /** Subtitle style */
858
+ subtitle_style?: {
859
+ position?: 'top' | 'bottom' | 'floating';
860
+ font_size?: number;
861
+ background?: boolean;
862
+ };
863
+
864
+ /** Speed */
865
+ speed?: number;
866
+
867
+ /** Language */
868
+ language?: string;
869
+
870
+ /** Queue multiple narrations */
871
+ queue?: boolean;
872
+
873
+ /** Interruptible */
874
+ interruptible?: boolean;
875
+ }
876
+
877
+ /**
878
+ * @responsive - AI conversational responses
879
+ */
880
+ interface ResponsiveTrait {
881
+ /** AI personality description */
882
+ personality?: string;
883
+
884
+ /** System prompt */
885
+ system_prompt?: string;
886
+
887
+ /** Knowledge base reference */
888
+ knowledge_base?: string;
889
+
890
+ /** Model to use */
891
+ model?: 'gpt-4' | 'claude' | 'gemini' | 'local' | 'custom';
892
+
893
+ /** Custom model endpoint */
894
+ custom_endpoint?: string;
895
+
896
+ /** Voice enabled for responses */
897
+ voice_enabled?: boolean;
898
+
899
+ /** Voice preset */
900
+ voice?: string;
901
+
902
+ /** Listen for voice input */
903
+ voice_input?: boolean;
904
+
905
+ /** Max response tokens */
906
+ max_tokens?: number;
907
+
908
+ /** Temperature */
909
+ temperature?: number;
910
+
911
+ /** Context window (conversation history) */
912
+ context_messages?: number;
913
+
914
+ /** Response format */
915
+ response_format?: 'text' | 'json' | 'action';
916
+
917
+ /** Available actions the AI can trigger */
918
+ available_actions?: string[];
919
+
920
+ /** Fallback response */
921
+ fallback?: string;
922
+ }
923
+
924
+ /**
925
+ * @procedural - Procedural generation
926
+ */
927
+ interface ProceduralTrait {
928
+ /** Generation algorithm */
929
+ algorithm?: 'perlin' | 'simplex' | 'voronoi' | 'wave_function_collapse' | 'l_system' | 'custom';
930
+
931
+ /** Random seed */
932
+ seed?: number;
933
+
934
+ /** Generation parameters */
935
+ params?: Record<string, number>;
936
+
937
+ /** Regeneration trigger */
938
+ regenerate_on?: 'click' | 'timer' | 'state_change' | 'manual';
939
+
940
+ /** Timer interval for regeneration */
941
+ regenerate_interval?: Duration;
942
+
943
+ /** Animate generation */
944
+ animate?: boolean;
945
+
946
+ /** Animation duration */
947
+ animation_duration?: Duration;
948
+
949
+ /** LOD (level of detail) */
950
+ lod?: number;
951
+
952
+ /** Bounds for generation */
953
+ bounds?: { min: Vector3$1; max: Vector3$1 };
954
+
955
+ /** Tile seamlessly */
956
+ tileable?: boolean;
957
+ }
958
+
959
+ /**
960
+ * @captioned - Auto-captions for media
961
+ */
962
+ interface CaptionedTrait {
963
+ /** Caption source */
964
+ source?: 'auto' | 'file' | 'api';
965
+
966
+ /** Caption file URL (for file source) */
967
+ caption_file?: string;
968
+
969
+ /** Language */
970
+ language?: string;
971
+
972
+ /** Auto-translate to other languages */
973
+ translate?: string[];
974
+
975
+ /** Caption style */
976
+ style?: {
977
+ position?: 'top' | 'bottom' | 'auto';
978
+ font_size?: 'small' | 'medium' | 'large';
979
+ background?: boolean;
980
+ background_color?: Color$1;
981
+ text_color?: Color$1;
982
+ };
983
+
984
+ /** Word-by-word highlighting */
985
+ highlight_words?: boolean;
986
+
987
+ /** Speaker identification */
988
+ speaker_labels?: boolean;
989
+
990
+ /** Profanity filter */
991
+ profanity_filter?: boolean;
992
+ }
993
+
994
+ // =============================================================================
995
+ // TIMELINE & SEQUENCING TRAITS
996
+ // =============================================================================
997
+
998
+ /**
999
+ * @timeline - Animation timeline
1000
+ */
1001
+ interface TimelineTrait {
1002
+ /** Total duration */
1003
+ duration: Duration;
1004
+
1005
+ /** Loop timeline */
1006
+ loop?: boolean;
1007
+
1008
+ /** Loop count (0 = infinite) */
1009
+ loop_count?: number;
1010
+
1011
+ /** Playback speed */
1012
+ speed?: number;
1013
+
1014
+ /** Auto-play */
1015
+ autoplay?: boolean;
1016
+
1017
+ /** Delay before starting */
1018
+ delay?: Duration;
1019
+
1020
+ /** Pause on hover */
1021
+ pause_on_hover?: boolean;
1022
+
1023
+ /** Allow seeking */
1024
+ seekable?: boolean;
1025
+
1026
+ /** Show playback controls */
1027
+ controls?: boolean;
1028
+
1029
+ /** Trigger condition to start */
1030
+ trigger?: 'immediate' | 'on_enter' | 'on_interact' | 'manual';
1031
+ }
1032
+
1033
+ /**
1034
+ * @choreography - Sequenced multi-object animations
1035
+ */
1036
+ interface ChoreographyTrait {
1037
+ /** Objects to choreograph */
1038
+ objects: string[];
1039
+
1040
+ /** Sequence of actions */
1041
+ sequence: ChoreographyStep[];
1042
+
1043
+ /** Sync to audio track */
1044
+ sync_to?: string;
1045
+
1046
+ /** BPM for music sync */
1047
+ bpm?: number;
1048
+
1049
+ /** Loop choreography */
1050
+ loop?: boolean;
1051
+
1052
+ /** Formation presets */
1053
+ formation?: 'line' | 'circle' | 'grid' | 'v_shape' | 'custom';
1054
+
1055
+ /** Formation spacing */
1056
+ spacing?: number;
1057
+ }
1058
+
1059
+ interface ChoreographyStep {
1060
+ /** Time offset */
1061
+ time: Duration;
1062
+
1063
+ /** Action to perform */
1064
+ action: string;
1065
+
1066
+ /** Action parameters */
1067
+ params?: Record<string, unknown>;
1068
+
1069
+ /** Which objects (indices or 'all') */
1070
+ targets?: number[] | 'all';
1071
+
1072
+ /** Stagger delay between objects */
1073
+ stagger?: Duration;
1074
+ }
1075
+
1076
+ /**
1077
+ * HoloScript+ Type Definitions
1078
+ *
1079
+ * Enhanced HoloScript with VR interactions, state management, and TypeScript interop.
1080
+ * Backward compatible with original HoloScript - new features are opt-in via @ directives.
1081
+ */
1082
+
1083
+
1084
+
1085
+ type Vector3$1 = [number, number, number];
1086
+ type Vector2 = [number, number];
1087
+ type Color$1 = string;
1088
+ type Duration = `${number}${'ms' | 's' | 'm'}`;
1089
+
1090
+ /**
1091
+ * VR interaction types
1092
+ */
1093
+ interface VRHand {
1094
+ id: 'left' | 'right';
1095
+ position: Vector3$1;
1096
+ rotation: Vector3$1;
1097
+ velocity: Vector3$1;
1098
+ grip: number;
1099
+ trigger: number;
1100
+ }
1101
+
1102
+ interface ThrowVelocity {
1103
+ direction: Vector3$1;
1104
+ magnitude: number;
1105
+ angularVelocity: Vector3$1;
1106
+ }
1107
+
1108
+ interface CollisionEvent {
1109
+ target: HSPlusNode;
1110
+ point: Vector3$1;
1111
+ normal: Vector3$1;
1112
+ impulse: number;
1113
+ relativeVelocity: Vector3$1;
1114
+ }
1115
+
1116
+ interface StackableTrait {
1117
+ stack_axis?: 'x' | 'y' | 'z';
1118
+ stack_offset?: number;
1119
+ max_stack?: number;
1120
+ snap_distance?: number;
1121
+ }
1122
+
1123
+ interface SnappableTrait {
1124
+ snap_points?: Vector3$1[];
1125
+ snap_distance?: number;
1126
+ snap_rotation?: boolean;
1127
+ magnetic?: boolean;
1128
+ }
1129
+
1130
+ interface BreakableTrait {
1131
+ break_velocity?: number;
1132
+ fragments?: number;
1133
+ fragment_mesh?: string;
1134
+ sound_on_break?: string;
1135
+ respawn?: boolean;
1136
+ respawn_delay?: Duration;
1137
+ }
1138
+
1139
+ /**
1140
+ * @stretchable - Deformable mesh manipulation for molding, building atoms, and creative sculpting
1141
+ *
1142
+ * Use cases:
1143
+ * - Atomic/molecular building (stretch bonds between atoms)
1144
+ * - Clay/putty sculpting
1145
+ * - Elastic objects that deform under force
1146
+ * - Scientific visualization of molecular structures
1147
+ *
1148
+ * @example
1149
+ * ```holoscript
1150
+ * sphere#atom @stretchable(mode: "bond", snap_to: "atoms", elasticity: 0.8) {
1151
+ * color: "#ff0000"
1152
+ * @on_stretch(delta) => update_bond_visualization(delta)
1153
+ * }
1154
+ * ```
1155
+ */
1156
+ interface StretchableTrait {
1157
+ /** Stretch mode: 'free' | 'axis' | 'bond' | 'surface' | 'volume' */
1158
+ mode?: 'free' | 'axis' | 'bond' | 'surface' | 'volume';
1159
+ /** Which axis/axes to allow stretching on */
1160
+ axis?: 'x' | 'y' | 'z' | 'xy' | 'xz' | 'yz' | 'all';
1161
+ /** Minimum stretch factor (0.1 = can shrink to 10%) */
1162
+ min_stretch?: number;
1163
+ /** Maximum stretch factor (10 = can grow to 1000%) */
1164
+ max_stretch?: number;
1165
+ /** Elasticity - how much it snaps back (0 = permanent, 1 = fully elastic) */
1166
+ elasticity?: number;
1167
+ /** Snap distance for connecting to other stretchable objects */
1168
+ snap_distance?: number;
1169
+ /** Object types/tags this can snap/bond to */
1170
+ snap_to?: string | string[];
1171
+ /** Whether to preserve volume when stretching (like clay) */
1172
+ preserve_volume?: boolean;
1173
+ /** Resolution of deformation mesh (higher = smoother but more expensive) */
1174
+ mesh_resolution?: number;
1175
+ /** Haptic feedback intensity when stretching */
1176
+ haptic_feedback?: number;
1177
+ /** Sound to play while stretching */
1178
+ stretch_sound?: string;
1179
+ /** Visual indicator for stretch limits */
1180
+ show_stretch_limits?: boolean;
1181
+ /** Color gradient for stretch visualization (cold to hot) */
1182
+ stretch_colors?: [Color$1, Color$1];
1183
+ /** Whether two hands are required to stretch */
1184
+ two_handed?: boolean;
1185
+ /** Bond type for molecular building: 'single' | 'double' | 'triple' | 'ionic' */
1186
+ bond_type?: 'single' | 'double' | 'triple' | 'ionic' | 'hydrogen' | 'custom';
1187
+ /** Visual style for bonds */
1188
+ bond_style?: 'stick' | 'ball-stick' | 'space-fill' | 'wireframe';
1189
+ }
1190
+
1191
+ /**
1192
+ * @moldable - Advanced sculpting trait for clay-like deformation
1193
+ *
1194
+ * @example
1195
+ * ```holoscript
1196
+ * mesh#clay @moldable(tool: "fingers", softness: 0.7) {
1197
+ * @on_sculpt(region, pressure) => update_mesh(region, pressure)
1198
+ * }
1199
+ * ```
1200
+ */
1201
+ interface MoldableTrait {
1202
+ /** Sculpting tool type */
1203
+ tool?: 'fingers' | 'brush' | 'knife' | 'smooth' | 'pinch' | 'inflate';
1204
+ /** How soft/deformable the material is (0 = hard, 1 = very soft) */
1205
+ softness?: number;
1206
+ /** Brush/tool radius */
1207
+ tool_radius?: number;
1208
+ /** Pressure sensitivity multiplier */
1209
+ pressure_sensitivity?: number;
1210
+ /** Whether to enable symmetry sculpting */
1211
+ symmetry?: boolean | 'x' | 'y' | 'z';
1212
+ /** Maximum deformation depth */
1213
+ max_depth?: number;
1214
+ /** Enable undo history */
1215
+ undo_enabled?: boolean;
1216
+ /** Number of undo steps to keep */
1217
+ undo_steps?: number;
1218
+ /** Auto-smooth after sculpting */
1219
+ auto_smooth?: boolean;
1220
+ /** Material properties for rendering */
1221
+ material?: 'clay' | 'metal' | 'organic' | 'crystal';
1222
+ }
1223
+
1224
+ // ============================================================================
1225
+ // HUMANOID / AVATAR TRAITS - Building human-like features
1226
+ // ============================================================================
1227
+
1228
+ /**
1229
+ * @skeleton - Rigging and skeletal system for humanoid characters
1230
+ *
1231
+ * @example
1232
+ * ```holoscript
1233
+ * avatar#player @skeleton(type: "humanoid", ik_enabled: true) {
1234
+ * @on_pose_change(pose) => sync_animation(pose)
1235
+ * }
1236
+ * ```
1237
+ */
1238
+ interface SkeletonTrait {
1239
+ /** Skeleton type preset */
1240
+ type?: 'humanoid' | 'quadruped' | 'bird' | 'spider' | 'custom';
1241
+ /** Enable inverse kinematics */
1242
+ ik_enabled?: boolean;
1243
+ /** IK targets for limbs */
1244
+ ik_targets?: {
1245
+ left_hand?: string;
1246
+ right_hand?: string;
1247
+ left_foot?: string;
1248
+ right_foot?: string;
1249
+ head?: string;
1250
+ spine?: string;
1251
+ };
1252
+ /** Bone constraints */
1253
+ constraints?: Record<string, { min: Vector3$1; max: Vector3$1 }>;
1254
+ /** Root bone name */
1255
+ root_bone?: string;
1256
+ /** Enable physics-based secondary motion (hair, cloth, etc.) */
1257
+ secondary_motion?: boolean;
1258
+ /** Retargeting source for animations */
1259
+ retarget_source?: string;
1260
+ }
1261
+
1262
+ /**
1263
+ * @body - Body configuration for humanoid avatars
1264
+ *
1265
+ * @example
1266
+ * ```holoscript
1267
+ * avatar#custom @body(preset: "athletic", height: 1.8, proportions: "realistic") {
1268
+ * skin_tone: "#e8beac"
1269
+ * body_type: "mesomorph"
1270
+ * }
1271
+ * ```
1272
+ */
1273
+ interface BodyTrait {
1274
+ /** Body preset */
1275
+ preset?: 'default' | 'athletic' | 'slim' | 'heavy' | 'child' | 'elderly' | 'custom';
1276
+ /** Height in meters */
1277
+ height?: number;
1278
+ /** Body proportions style */
1279
+ proportions?: 'realistic' | 'stylized' | 'cartoon' | 'chibi' | 'heroic';
1280
+ /** Body type/somatotype */
1281
+ body_type?: 'ectomorph' | 'mesomorph' | 'endomorph' | 'average';
1282
+ /** Muscle definition (0-1) */
1283
+ muscle_definition?: number;
1284
+ /** Body fat percentage visual (0-1) */
1285
+ body_fat?: number;
1286
+ /** Shoulder width multiplier */
1287
+ shoulder_width?: number;
1288
+ /** Hip width multiplier */
1289
+ hip_width?: number;
1290
+ /** Limb length multipliers */
1291
+ limb_proportions?: {
1292
+ arms?: number;
1293
+ legs?: number;
1294
+ torso?: number;
1295
+ neck?: number;
1296
+ };
1297
+ /** Gender presentation */
1298
+ gender_expression?: 'masculine' | 'feminine' | 'androgynous' | 'neutral';
1299
+ /** Age appearance (affects skin, posture, etc.) */
1300
+ apparent_age?: number;
1301
+ }
1302
+
1303
+ /**
1304
+ * @face - Facial features and structure
1305
+ *
1306
+ * @example
1307
+ * ```holoscript
1308
+ * head#playerHead @face(shape: "oval", ethnicity_blend: ["european", "asian"]) {
1309
+ * eye_color: "#3b7a57"
1310
+ * @expressive(auto_blink: true, lip_sync: true)
1311
+ * }
1312
+ * ```
1313
+ */
1314
+ interface FaceTrait {
1315
+ /** Face shape preset */
1316
+ shape?: 'oval' | 'round' | 'square' | 'heart' | 'oblong' | 'diamond' | 'triangle';
1317
+ /** Ethnicity blend for facial features (can mix multiple) */
1318
+ ethnicity_blend?: string[];
1319
+ /** Eye settings */
1320
+ eyes?: {
1321
+ shape?: 'almond' | 'round' | 'hooded' | 'monolid' | 'upturned' | 'downturned';
1322
+ color?: Color$1;
1323
+ size?: number;
1324
+ spacing?: number;
1325
+ iris_detail?: 'simple' | 'detailed' | 'realistic';
1326
+ heterochromia?: boolean;
1327
+ secondary_color?: Color$1;
1328
+ };
1329
+ /** Nose settings */
1330
+ nose?: {
1331
+ shape?: 'straight' | 'roman' | 'button' | 'aquiline' | 'flat' | 'upturned';
1332
+ width?: number;
1333
+ length?: number;
1334
+ bridge_height?: number;
1335
+ };
1336
+ /** Mouth/lips settings */
1337
+ mouth?: {
1338
+ shape?: 'thin' | 'full' | 'bow' | 'wide' | 'small';
1339
+ width?: number;
1340
+ lip_thickness?: { upper: number; lower: number };
1341
+ };
1342
+ /** Jaw and chin */
1343
+ jaw?: {
1344
+ width?: number;
1345
+ chin_shape?: 'pointed' | 'rounded' | 'square' | 'cleft';
1346
+ chin_prominence?: number;
1347
+ };
1348
+ /** Cheekbone prominence */
1349
+ cheekbones?: number;
1350
+ /** Brow settings */
1351
+ brow?: {
1352
+ thickness?: number;
1353
+ arch?: number;
1354
+ spacing?: number;
1355
+ };
1356
+ /** Ear settings */
1357
+ ears?: {
1358
+ size?: number;
1359
+ shape?: 'attached' | 'free' | 'pointed' | 'rounded';
1360
+ protrusion?: number;
1361
+ };
1362
+ /** Forehead height */
1363
+ forehead_height?: number;
1364
+ /** Facial hair (for applicable characters) */
1365
+ facial_hair?: {
1366
+ type?: 'none' | 'stubble' | 'beard' | 'mustache' | 'goatee' | 'full';
1367
+ density?: number;
1368
+ color?: Color$1;
1369
+ style?: string;
1370
+ };
1371
+ /** Skin details */
1372
+ skin?: {
1373
+ tone?: Color$1;
1374
+ texture?: 'smooth' | 'normal' | 'rough' | 'weathered';
1375
+ freckles?: number;
1376
+ moles?: Array<{ position: Vector2; size: number }>;
1377
+ wrinkles?: number;
1378
+ pores?: number;
1379
+ subsurface_scattering?: number;
1380
+ };
1381
+ }
1382
+
1383
+ /**
1384
+ * @expressive - Facial expressions and emotion system
1385
+ *
1386
+ * @example
1387
+ * ```holoscript
1388
+ * avatar#npc @expressive(blend_shapes: true, micro_expressions: true) {
1389
+ * @on_emotion_change(emotion) => play_expression(emotion)
1390
+ * }
1391
+ * ```
1392
+ */
1393
+ interface ExpressiveTrait {
1394
+ /** Enable blend shape morphs */
1395
+ blend_shapes?: boolean;
1396
+ /** Emotion presets available */
1397
+ emotions?: Array<'happy' | 'sad' | 'angry' | 'surprised' | 'disgusted' | 'fearful' | 'neutral' | 'contempt'>;
1398
+ /** Custom blend shape mappings */
1399
+ blend_shape_map?: Record<string, string>;
1400
+ /** Auto-blink behavior */
1401
+ auto_blink?: boolean;
1402
+ /** Blink frequency (per minute) */
1403
+ blink_rate?: number;
1404
+ /** Enable micro-expressions for realism */
1405
+ micro_expressions?: boolean;
1406
+ /** Eye movement behavior */
1407
+ eye_behavior?: {
1408
+ look_at_target?: boolean;
1409
+ saccades?: boolean;
1410
+ pupil_dilation?: boolean;
1411
+ };
1412
+ /** Lip sync configuration */
1413
+ lip_sync?: boolean | {
1414
+ method?: 'viseme' | 'phoneme' | 'ai';
1415
+ smoothing?: number;
1416
+ exaggeration?: number;
1417
+ };
1418
+ /** Breathing animation */
1419
+ breathing?: boolean;
1420
+ /** Current emotion state */
1421
+ default_emotion?: string;
1422
+ /** Emotion transition speed */
1423
+ transition_speed?: number;
1424
+ }
1425
+
1426
+ /**
1427
+ * @hair - Hair and hairstyle system
1428
+ *
1429
+ * @example
1430
+ * ```holoscript
1431
+ * hair#playerHair @hair(style: "long_wavy", physics: true) {
1432
+ * color: "#2c1810"
1433
+ * highlights: "#4a3728"
1434
+ * }
1435
+ * ```
1436
+ */
1437
+ interface HairTrait {
1438
+ /** Hair style preset */
1439
+ style?: string; // 'short' | 'medium' | 'long' | 'buzz' | 'bald' | 'afro' | 'braids' | 'ponytail' | etc.
1440
+ /** Primary hair color */
1441
+ color?: Color$1;
1442
+ /** Highlight/secondary color */
1443
+ highlights?: Color$1;
1444
+ /** Hair texture */
1445
+ texture?: 'straight' | 'wavy' | 'curly' | 'coily' | 'kinky';
1446
+ /** Hair thickness/density */
1447
+ density?: number;
1448
+ /** Strand thickness */
1449
+ thickness?: number;
1450
+ /** Hair length (0-1 normalized) */
1451
+ length?: number;
1452
+ /** Enable physics simulation */
1453
+ physics?: boolean;
1454
+ /** Physics stiffness */
1455
+ stiffness?: number;
1456
+ /** Wind/movement response */
1457
+ wind_response?: number;
1458
+ /** Hair shine/specular */
1459
+ shine?: number;
1460
+ /** Render method */
1461
+ render_method?: 'cards' | 'strands' | 'mesh';
1462
+ /** LOD levels for performance */
1463
+ lod_levels?: number;
1464
+ }
1465
+
1466
+ /**
1467
+ * @clothing - Clothing and outfit system
1468
+ *
1469
+ * @example
1470
+ * ```holoscript
1471
+ * outfit#casual @clothing(type: "full_body", physics: "cloth") {
1472
+ * style: "casual_modern"
1473
+ * fit: "relaxed"
1474
+ * }
1475
+ * ```
1476
+ */
1477
+ interface ClothingTrait {
1478
+ /** Clothing slot type */
1479
+ type?: 'full_body' | 'top' | 'bottom' | 'shoes' | 'accessory' | 'hat' | 'glasses' | 'jewelry';
1480
+ /** Clothing style category */
1481
+ style?: string;
1482
+ /** Fit type */
1483
+ fit?: 'tight' | 'fitted' | 'relaxed' | 'loose' | 'oversized';
1484
+ /** Primary color/material */
1485
+ color?: Color$1;
1486
+ /** Material type */
1487
+ material?: 'cotton' | 'silk' | 'leather' | 'denim' | 'wool' | 'synthetic' | 'metal';
1488
+ /** Physics simulation type */
1489
+ physics?: 'none' | 'cloth' | 'rigid' | 'soft_body';
1490
+ /** Cloth simulation settings */
1491
+ cloth_settings?: {
1492
+ stiffness?: number;
1493
+ damping?: number;
1494
+ collision_margin?: number;
1495
+ wind_response?: number;
1496
+ };
1497
+ /** Layer order (for layered clothing) */
1498
+ layer?: number;
1499
+ /** Body parts this hides/masks */
1500
+ masks_body?: string[];
1501
+ /** Pattern/texture overlay */
1502
+ pattern?: string;
1503
+ }
1504
+
1505
+ /**
1506
+ * @hands - Detailed hand configuration and gestures
1507
+ *
1508
+ * @example
1509
+ * ```holoscript
1510
+ * hands#playerHands @hands(tracking: "full", gestures: true) {
1511
+ * @on_gesture(type) => handle_gesture(type)
1512
+ * }
1513
+ * ```
1514
+ */
1515
+ interface HandsTrait {
1516
+ /** Hand tracking mode */
1517
+ tracking?: 'controller' | 'skeletal' | 'full' | 'none';
1518
+ /** Enable gesture recognition */
1519
+ gestures?: boolean;
1520
+ /** Available gestures */
1521
+ gesture_set?: Array<'point' | 'fist' | 'open' | 'pinch' | 'thumbs_up' | 'peace' | 'ok' | 'custom'>;
1522
+ /** Custom gesture definitions */
1523
+ custom_gestures?: Record<string, unknown>;
1524
+ /** Finger curl tracking precision */
1525
+ finger_precision?: 'low' | 'medium' | 'high';
1526
+ /** Hand size multiplier */
1527
+ size?: number;
1528
+ /** Nail appearance */
1529
+ nails?: {
1530
+ length?: 'short' | 'medium' | 'long';
1531
+ shape?: 'square' | 'rounded' | 'pointed' | 'almond';
1532
+ color?: Color$1;
1533
+ };
1534
+ /** Skin details for hands */
1535
+ skin_detail?: 'low' | 'medium' | 'high';
1536
+ /** Ring/jewelry attachment points */
1537
+ accessory_slots?: string[];
1538
+ }
1539
+
1540
+ /**
1541
+ * @voice - Voice and speech synthesis for characters
1542
+ *
1543
+ * @example
1544
+ * ```holoscript
1545
+ * avatar#assistant @voice(type: "synthesis", voice_id: "aria") {
1546
+ * @on_speak(text) => animate_lip_sync(text)
1547
+ * }
1548
+ * ```
1549
+ */
1550
+ interface CharacterVoiceTrait {
1551
+ /** Voice type */
1552
+ type?: 'recorded' | 'synthesis' | 'clone' | 'realtime';
1553
+ /** Voice ID for synthesis */
1554
+ voice_id?: string;
1555
+ /** Voice preset characteristics */
1556
+ preset?: 'male_deep' | 'male_tenor' | 'female_alto' | 'female_soprano' | 'child' | 'robot' | 'custom';
1557
+ /** Pitch adjustment (-1 to 1) */
1558
+ pitch?: number;
1559
+ /** Speaking rate (0.5 to 2) */
1560
+ rate?: number;
1561
+ /** Voice warmth/coldness */
1562
+ warmth?: number;
1563
+ /** Breathiness */
1564
+ breathiness?: number;
1565
+ /** Accent/dialect */
1566
+ accent?: string;
1567
+ /** Language */
1568
+ language?: string;
1569
+ /** Enable emotion in voice */
1570
+ emotional?: boolean;
1571
+ /** SSML support */
1572
+ ssml_enabled?: boolean;
1573
+ }
1574
+
1575
+ /**
1576
+ * @locomotion - Movement and animation system
1577
+ *
1578
+ * @example
1579
+ * ```holoscript
1580
+ * avatar#player @locomotion(style: "realistic", root_motion: true) {
1581
+ * walk_speed: 1.4
1582
+ * run_speed: 5.0
1583
+ * }
1584
+ * ```
1585
+ */
1586
+ interface LocomotionTrait {
1587
+ /** Movement style */
1588
+ style?: 'realistic' | 'stylized' | 'robotic' | 'floaty' | 'heavy';
1589
+ /** Use root motion from animations */
1590
+ root_motion?: boolean;
1591
+ /** Walking speed (m/s) */
1592
+ walk_speed?: number;
1593
+ /** Running speed (m/s) */
1594
+ run_speed?: number;
1595
+ /** Jump height (m) */
1596
+ jump_height?: number;
1597
+ /** Turn speed (degrees/second) */
1598
+ turn_speed?: number;
1599
+ /** Acceleration */
1600
+ acceleration?: number;
1601
+ /** Enable procedural foot placement (IK) */
1602
+ foot_ik?: boolean;
1603
+ /** Terrain adaptation */
1604
+ terrain_adaptation?: boolean;
1605
+ /** Idle animations */
1606
+ idle_variations?: number;
1607
+ /** Breathing motion in idle */
1608
+ idle_breathing?: boolean;
1609
+ /** Weight shift in idle */
1610
+ weight_shift?: boolean;
1611
+ /** Stamina system */
1612
+ stamina?: {
1613
+ max?: number;
1614
+ drain_rate?: number;
1615
+ recovery_rate?: number;
1616
+ };
1617
+ }
1618
+
1619
+ /**
1620
+ * @poseable - Manual posing system for characters
1621
+ *
1622
+ * @example
1623
+ * ```holoscript
1624
+ * avatar#model @poseable(mode: "ik", snap_to_presets: true) {
1625
+ * @on_pose_save(pose) => save_to_library(pose)
1626
+ * }
1627
+ * ```
1628
+ */
1629
+ interface PoseableTrait {
1630
+ /** Posing mode */
1631
+ mode?: 'fk' | 'ik' | 'hybrid';
1632
+ /** Enable preset pose snapping */
1633
+ snap_to_presets?: boolean;
1634
+ /** Preset poses available */
1635
+ presets?: string[];
1636
+ /** Symmetry posing */
1637
+ symmetry?: boolean;
1638
+ /** Pin/lock specific bones */
1639
+ pinned_bones?: string[];
1640
+ /** Enable physics preview */
1641
+ physics_preview?: boolean;
1642
+ /** Pose blending between presets */
1643
+ blend_enabled?: boolean;
1644
+ /** Save custom poses */
1645
+ custom_poses?: Record<string, unknown>;
1646
+ }
1647
+
1648
+ /**
1649
+ * @morph - Shape morphing and body customization
1650
+ *
1651
+ * @example
1652
+ * ```holoscript
1653
+ * avatar#custom @morph(targets: ["body_shape", "face_detail"]) {
1654
+ * @on_morph_change(target, value) => update_avatar(target, value)
1655
+ * }
1656
+ * ```
1657
+ */
1658
+ interface MorphTrait {
1659
+ /** Available morph targets */
1660
+ targets?: string[];
1661
+ /** Morph target values (0-1) */
1662
+ values?: Record<string, number>;
1663
+ /** Morph presets */
1664
+ presets?: Record<string, Record<string, number>>;
1665
+ /** Enable real-time preview */
1666
+ realtime_preview?: boolean;
1667
+ /** Morph transition speed */
1668
+ transition_speed?: number;
1669
+ /** Clamp values to valid ranges */
1670
+ clamp_values?: boolean;
1671
+ /** Linked morphs (one affects another) */
1672
+ linked_morphs?: Record<string, string[]>;
1673
+ }
1674
+
1675
+ interface NetworkedTrait {
1676
+ sync_mode?: 'reliable' | 'unreliable' | 'state-only';
1677
+ authority?: 'client' | 'server' | 'owner';
1678
+ sync_interval?: number;
1679
+ interpolated?: boolean;
1680
+ }
1681
+
1682
+ interface ProactiveTrait {
1683
+ intelligence_tier?: 'basic' | 'advanced' | 'quantum';
1684
+ observation_range?: number;
1685
+ learning_rate?: number;
1686
+ auto_suggest?: boolean;
1687
+ context_window?: number;
1688
+ }
1689
+
1690
+ /**
1691
+ * State Management
1692
+ */
1693
+ interface StateDeclaration {
1694
+ [key: string]: unknown;
1695
+ }
1696
+
1697
+ interface ReactiveState$1<T extends StateDeclaration> {
1698
+ get<K extends keyof T>(key: K): T[K];
1699
+ set<K extends keyof T>(key: K, value: T[K]): void;
1700
+ subscribe(callback: (state: T) => void): () => void;
1701
+ }
1702
+
1703
+ /**
1704
+ * Lifecycle Hooks
1705
+ */
1706
+ type LifecycleHook = 'on_mount' | 'on_unmount' | 'on_update' | 'on_data_update';
1707
+ type VRLifecycleHook = 'on_grab' | 'on_release' | 'on_hover_enter' | 'on_hover_exit' | 'on_point_enter' | 'on_point_exit' | 'on_collision' | 'on_trigger_enter' | 'on_trigger_exit' | 'on_click' | 'on_double_click';
1708
+ type ControllerHook = 'on_controller_button' | 'on_trigger_hold' | 'on_trigger_release' | 'on_grip_hold' | 'on_grip_release';
1709
+
1710
+ // Media Production Hooks
1711
+ type MediaLifecycleHook = 'on_record_start' | 'on_record_stop' | 'on_record_pause' | 'on_stream_start' | 'on_stream_stop' | 'on_viewer_join' | 'on_viewer_leave' | 'on_chat_message' | 'on_camera_switch' | 'on_video_end' | 'on_video_error';
1712
+
1713
+ // Analytics Hooks
1714
+ type AnalyticsLifecycleHook = 'on_track_event' | 'on_survey_start' | 'on_survey_complete' | 'on_survey_skip' | 'on_variant_assigned' | 'on_conversion' | 'on_hotspot_detected';
1715
+
1716
+ // Social Hooks
1717
+ type SocialLifecycleHook = 'on_share' | 'on_share_complete' | 'on_embed' | 'on_scan' | 'on_user_join' | 'on_user_leave' | 'on_draw_stroke' | 'on_object_lock' | 'on_object_unlock';
1718
+
1719
+ // Effects Hooks
1720
+ type EffectsLifecycleHook = 'on_particle_spawn' | 'on_particle_death' | 'on_transition_start' | 'on_transition_complete' | 'on_filter_change';
1721
+
1722
+ // Audio Hooks
1723
+ type AudioLifecycleHook = 'on_audio_start' | 'on_audio_end' | 'on_voice_command' | 'on_speech_start' | 'on_speech_end' | 'on_beat' | 'on_frequency_peak';
1724
+
1725
+ // AI Hooks
1726
+ type AILifecycleHook = 'on_narration_start' | 'on_narration_end' | 'on_user_question' | 'on_response_ready' | 'on_emotion_change' | 'on_generation_complete';
1727
+
1728
+ // Timeline Hooks
1729
+ type TimelineLifecycleHook = 'on_timeline_start' | 'on_timeline_complete' | 'on_keyframe_hit' | 'on_keyframe_add' | 'on_beat_sync' | 'on_move_complete';
1730
+
1731
+ // Combined hook type for all lifecycle hooks
1732
+ type AllLifecycleHooks =
1733
+ | LifecycleHook
1734
+ | VRLifecycleHook
1735
+ | ControllerHook
1736
+ | MediaLifecycleHook
1737
+ | AnalyticsLifecycleHook
1738
+ | SocialLifecycleHook
1739
+ | EffectsLifecycleHook
1740
+ | AudioLifecycleHook
1741
+ | AILifecycleHook
1742
+ | TimelineLifecycleHook;
1743
+
1744
+ /**
1745
+ * AST Node Types
1746
+ */
1747
+ type HSPlusDirective =
1748
+ | { type: 'state'; body: StateDeclaration }
1749
+ | { type: 'for'; variable: string; iterable: string; body: HSPlusNode[] }
1750
+ | { type: 'if'; condition: string; body: HSPlusNode[]; else?: HSPlusNode[] }
1751
+ | { type: 'import'; path: string; alias: string }
1752
+ | { type: 'lifecycle'; hook: AllLifecycleHooks; params?: string[]; body: string }
1753
+ | { type: 'trait'; name: VRTraitName$1; config: Record<string, unknown> }
1754
+ | { type: 'external_api'; url: string; method?: string; interval?: string }
1755
+ | { type: 'generate'; prompt: string; context?: string; target?: string };
1756
+
1757
+ type VRTraitName$1 =
1758
+ // Core VR Interaction Traits
1759
+ | 'grabbable'
1760
+ | 'throwable'
1761
+ | 'pointable'
1762
+ | 'hoverable'
1763
+ | 'scalable'
1764
+ | 'rotatable'
1765
+ | 'stackable'
1766
+ | 'snappable'
1767
+ | 'breakable'
1768
+ | 'stretchable'
1769
+ | 'moldable'
1770
+ // Humanoid/Avatar Traits
1771
+ | 'skeleton'
1772
+ | 'body'
1773
+ | 'face'
1774
+ | 'expressive'
1775
+ | 'hair'
1776
+ | 'clothing'
1777
+ | 'hands'
1778
+ | 'character_voice'
1779
+ | 'locomotion'
1780
+ | 'poseable'
1781
+ | 'morph'
1782
+ | 'networked'
1783
+ | 'proactive'
1784
+ // Media Production Traits
1785
+ | 'recordable'
1786
+ | 'streamable'
1787
+ | 'camera'
1788
+ | 'video'
1789
+ // Analytics & Research Traits
1790
+ | 'trackable'
1791
+ | 'survey'
1792
+ | 'abtest'
1793
+ | 'heatmap'
1794
+ // Social & Viral Traits
1795
+ | 'shareable'
1796
+ | 'embeddable'
1797
+ | 'qr'
1798
+ | 'collaborative'
1799
+ // Effects Traits
1800
+ | 'particle'
1801
+ | 'transition'
1802
+ | 'filter'
1803
+ | 'trail'
1804
+ // Audio Traits
1805
+ | 'spatial_audio'
1806
+ | 'voice'
1807
+ | 'reactive_audio'
1808
+ // AI & Generative Traits
1809
+ | 'narrator'
1810
+ | 'responsive'
1811
+ | 'procedural'
1812
+ | 'captioned'
1813
+ // Timeline & Choreography Traits
1814
+ | 'timeline'
1815
+ | 'choreography';
1816
+
1817
+ interface HSPlusNode {
1818
+ type: string;
1819
+ id?: string;
1820
+ properties: Record<string, unknown>;
1821
+ directives: HSPlusDirective[];
1822
+ children: HSPlusNode[];
1823
+ traits: Map<VRTraitName$1, unknown>;
1824
+ loc?: {
1825
+ start: { line: number; column: number };
1826
+ end: { line: number; column: number };
1827
+ };
1828
+ }
1829
+
1830
+ interface HSPlusAST {
1831
+ version: '1.0';
1832
+ root: HSPlusNode;
1833
+ imports: Array<{ path: string; alias: string }>;
1834
+ hasState: boolean;
1835
+ hasVRTraits: boolean;
1836
+ hasControlFlow: boolean;
1837
+ }
1838
+
1839
+ // Supporting types for builtins
1840
+ interface RecordingClip {
1841
+ id: string;
1842
+ duration: number;
1843
+ format: string;
1844
+ url: string;
1845
+ thumbnail?: string;
1846
+ }
1847
+
1848
+ interface ShareContent {
1849
+ title?: string;
1850
+ description?: string;
1851
+ url?: string;
1852
+ media?: string;
1853
+ }
1854
+
1855
+ interface ShareResult {
1856
+ success: boolean;
1857
+ platform: string;
1858
+ shareUrl?: string;
1859
+ error?: string;
1860
+ }
1861
+
1862
+ interface ParticleConfig {
1863
+ type: string;
1864
+ rate?: number;
1865
+ color?: Color$1 | Color$1[];
1866
+ size?: number;
1867
+ lifetime?: number;
1868
+ }
1869
+
1870
+ interface HSPlusRuntime {
1871
+ mount: (container: unknown) => void;
1872
+ unmount: () => void;
1873
+ updateData: (data: unknown) => void;
1874
+ getState: () => StateDeclaration;
1875
+ setState: (updates: Partial<StateDeclaration>) => void;
1876
+ emit: (event: string, payload?: unknown) => void;
1877
+ updateEntity: (id: string, properties: Partial<Record<string, unknown>>) => boolean;
1878
+ on: (event: string, handler: (payload: unknown) => void) => () => void;
1879
+ }
1880
+
1881
+ /**
1882
+ * HoloScript 2D Parser Extension
1883
+ *
1884
+ * Adds support for 2D UI elements to HoloScript for desktop/mobile apps.
1885
+ * Works alongside 3D VR syntax for hybrid applications.
1886
+ */
1887
+
1888
+ declare class HoloScript2DParser {
1889
+ private uiElements;
1890
+ /**
1891
+ * Parse 2D UI element from HoloScript code
1892
+ */
1893
+ parse2DElement(code: string, depth?: number): UI2DNode | null;
1894
+ private splitIntoLogicalBlocks;
1895
+ /**
1896
+ * Parse voice command for 2D UI creation
1897
+ */
1898
+ parse2DVoiceCommand(command: string): UI2DNode | null;
1899
+ /**
1900
+ * Parse gesture for 2D UI interaction
1901
+ */
1902
+ parse2DGesture(gestureType: string, position: Position2D): UI2DNode | null;
1903
+ private createQuick2DElement;
1904
+ private isValidUIElementType;
1905
+ private parsePropertyValue;
1906
+ private getDefaultProperties;
1907
+ getUIElements(): Map<string, UI2DNode>;
1908
+ findElement(name: string): UI2DNode | null;
1909
+ clear(): void;
1910
+ }
1911
+
1912
+ /**
1913
+ * HoloScript Parser
1914
+ *
1915
+ * Parses voice commands, gestures, and code into HoloScript AST.
1916
+ * Supports both 3D VR and 2D UI elements.
1917
+ */
1918
+
1919
+ declare class HoloScriptParser {
1920
+ private ast;
1921
+ private parser2D;
1922
+ constructor();
1923
+ /**
1924
+ * Parse voice command into AST nodes
1925
+ */
1926
+ parseVoiceCommand(command: VoiceCommand$1): ASTNode[];
1927
+ private parse2DUICommand;
1928
+ /**
1929
+ * Parse gesture input
1930
+ */
1931
+ parseGesture(gesture: GestureData): ASTNode[];
1932
+ private parseCreateCommand;
1933
+ private parseConnectCommand;
1934
+ private createOrbNode;
1935
+ private createFunctionNode;
1936
+ private createGateNode;
1937
+ private createStreamNode;
1938
+ private createGenericNode;
1939
+ private createServerNode;
1940
+ private createDatabaseNode;
1941
+ private createFetchNode;
1942
+ private parsePinchGesture;
1943
+ private parseSwipeGesture;
1944
+ private parseRotateGesture;
1945
+ private parseGrabGesture;
1946
+ private tokenizeCommand;
1947
+ private sanitizeTokens;
1948
+ private parseExecuteCommand;
1949
+ private parseDebugCommand;
1950
+ private parseVisualizeCommand;
1951
+ private parseGenericCommand;
1952
+ private parseComposition;
1953
+ private parseEnvironment;
1954
+ private parseTemplate;
1955
+ private parseGlobalHandler;
1956
+ private parseScale;
1957
+ private parseFocus;
1958
+ private parseStateDirective;
1959
+ private extractDirectives;
1960
+ private isTrait;
1961
+ private isLifecycleHook;
1962
+ private parseLiteral;
1963
+ private parseProperties;
1964
+ private findClosingBrace;
1965
+ getAST(): ASTNode[];
1966
+ addNode(node: ASTNode): void;
1967
+ clear(): void;
1968
+ findNode(name: string): ASTNode | null;
1969
+ getNodesAtPosition(position: SpatialPosition, radius?: number): ASTNode[];
1970
+ parse2DCode(code: string): UI2DNode | null;
1971
+ get2DParser(): HoloScript2DParser;
1972
+ }
1973
+
1974
+ declare const VR_TRAITS: readonly ["grabbable", "throwable", "pointable", "hoverable", "scalable", "rotatable", "stackable", "snappable", "breakable", "stretchable", "moldable", "skeleton", "body", "face", "expressive", "hair", "clothing", "hands", "character_voice", "locomotion", "poseable", "morph", "networked", "proactive", "recordable", "streamable", "camera", "video", "trackable", "survey", "abtest", "heatmap", "shareable", "embeddable", "qr", "collaborative", "particle", "transition", "filter", "trail", "spatial_audio", "voice", "reactive_audio", "narrator", "responsive", "procedural", "captioned", "timeline", "choreography"];
1975
+ type VRTraitName = typeof VR_TRAITS[number];
1976
+ declare const LIFECYCLE_HOOKS: readonly ["on_mount", "on_unmount", "on_update", "on_data_update", "on_grab", "on_release", "on_hover_enter", "on_hover_exit", "on_point_enter", "on_point_exit", "on_collision", "on_trigger_enter", "on_trigger_exit", "on_click", "on_double_click", "on_controller_button", "on_trigger_hold", "on_trigger_release", "on_grip_hold", "on_grip_release", "on_stretch", "on_sculpt", "on_pose_change", "on_expression_change", "on_gesture", "on_speak", "on_pose_save", "on_morph_change", "on_record_start", "on_record_stop", "on_record_pause", "on_stream_start", "on_stream_stop", "on_viewer_join", "on_viewer_leave", "on_chat_message", "on_camera_switch", "on_video_end", "on_video_error", "on_track_event", "on_survey_start", "on_survey_complete", "on_survey_skip", "on_variant_assigned", "on_conversion", "on_hotspot_detected", "on_share", "on_share_complete", "on_embed", "on_scan", "on_user_join", "on_user_leave", "on_draw_stroke", "on_object_lock", "on_object_unlock", "on_particle_spawn", "on_particle_death", "on_transition_start", "on_transition_complete", "on_filter_change", "on_audio_start", "on_audio_end", "on_voice_command", "on_speech_start", "on_speech_end", "on_beat", "on_frequency_peak", "on_narration_start", "on_narration_end", "on_user_question", "on_response_ready", "on_emotion_change", "on_generation_complete", "on_timeline_start", "on_timeline_complete", "on_keyframe_hit", "on_keyframe_add", "on_beat_sync", "on_move_complete"];
1977
+ type LifecycleHookName = typeof LIFECYCLE_HOOKS[number];
1978
+
1979
+ /**
1980
+ * HoloScript Validator
1981
+ * Performs static analysis on HoloScript code to detect syntax and semantic errors.
1982
+ */
1983
+ interface ValidationError {
1984
+ line: number;
1985
+ column: number;
1986
+ message: string;
1987
+ severity: 'error' | 'warning';
1988
+ }
1989
+ declare class HoloScriptValidator {
1990
+ private parser;
1991
+ private static VALID_DIRECTIVES;
1992
+ private static VALID_KEYWORDS;
1993
+ constructor();
1994
+ /**
1995
+ * Validates source code and returns a list of errors.
1996
+ */
1997
+ validate(code: string): ValidationError[];
1998
+ }
1999
+
2000
+ interface HSPlusCompileResult {
2001
+ success: boolean;
2002
+ code?: string;
2003
+ sourceMap?: any;
2004
+ errors: Array<{
2005
+ message: string;
2006
+ line: number;
2007
+ column: number;
2008
+ }>;
2009
+ ast?: any;
2010
+ compiledExpressions?: any;
2011
+ requiredCompanions?: string[];
2012
+ features?: any;
2013
+ warnings?: any[];
2014
+ [key: string]: any;
2015
+ }
2016
+ interface HSPlusParserOptions {
2017
+ sourceMap?: boolean;
2018
+ strict?: boolean;
2019
+ enableTypeScriptImports?: boolean;
2020
+ enableVRTraits?: boolean;
2021
+ }
2022
+
2023
+ /**
2024
+ * HoloScript+ Parser
2025
+ *
2026
+ * Parses HoloScript+ source code into an AST with support for:
2027
+ * - Standard HoloScript syntax (backward compatible)
2028
+ * - @ directive parsing for VR traits, state, control flow
2029
+ * - Expression interpolation with ${...}
2030
+ * - TypeScript companion imports
2031
+ *
2032
+ * @version 1.0.0
2033
+ */
2034
+
2035
+ declare class HoloScriptPlusParser$1 {
2036
+ private tokens;
2037
+ private pos;
2038
+ private options;
2039
+ private errors;
2040
+ private warnings;
2041
+ private imports;
2042
+ private hasState;
2043
+ private hasVRTraits;
2044
+ private hasControlFlow;
2045
+ private compiledExpressions;
2046
+ constructor(options?: HSPlusParserOptions);
2047
+ parse(source: string): HSPlusCompileResult;
2048
+ private parseDocument;
2049
+ private parseNode;
2050
+ private parseDirective;
2051
+ private parsePropsBlock;
2052
+ private parseDialogBlock;
2053
+ private parseTraitConfig;
2054
+ private parseStateBlock;
2055
+ private parseControlFlowBody;
2056
+ private parseCodeBlock;
2057
+ private parseInlineExpression;
2058
+ private parseValue;
2059
+ private parseArray;
2060
+ private parseObject;
2061
+ private current;
2062
+ private check;
2063
+ private advance;
2064
+ private expect;
2065
+ private skipNewlines;
2066
+ private error;
2067
+ private warn;
2068
+ }
2069
+ declare function createParser(options?: HSPlusParserOptions): HoloScriptPlusParser$1;
2070
+ declare function parse(source: string, options?: HSPlusParserOptions): HSPlusCompileResult;
2071
+
2072
+ /**
2073
+ * @holoscript/core Material Trait
2074
+ *
2075
+ * Enables advanced material and shader properties for photorealistic rendering
2076
+ * Supports PBR (Physically Based Rendering) workflows
2077
+ */
2078
+ type MaterialType = 'pbr' | 'standard' | 'unlit' | 'transparent' | 'custom';
2079
+ type TextureChannel = 'baseColor' | 'normalMap' | 'roughnessMap' | 'metallicMap' | 'ambientOcclusionMap' | 'emissionMap' | 'heightMap';
2080
+ /**
2081
+ * Texture map configuration
2082
+ */
2083
+ interface TextureMap {
2084
+ /** Texture path or URL */
2085
+ path: string;
2086
+ /** Channel this texture maps to */
2087
+ channel: TextureChannel;
2088
+ /** UV scale (tiling) */
2089
+ scale?: {
2090
+ x: number;
2091
+ y: number;
2092
+ };
2093
+ /** UV offset */
2094
+ offset?: {
2095
+ x: number;
2096
+ y: number;
2097
+ };
2098
+ /** Texture filtering: linear, nearest, anisotropic */
2099
+ filter?: 'linear' | 'nearest' | 'anisotropic';
2100
+ /** Anisotropic level (1-16) */
2101
+ anisotropy?: number;
2102
+ }
2103
+ /**
2104
+ * PBR Material properties
2105
+ */
2106
+ interface PBRMaterial {
2107
+ /** Base color in linear space [0-1] */
2108
+ baseColor: {
2109
+ r: number;
2110
+ g: number;
2111
+ b: number;
2112
+ a?: number;
2113
+ };
2114
+ /** Metallic value 0-1 */
2115
+ metallic: number;
2116
+ /** Roughness value 0-1 */
2117
+ roughness: number;
2118
+ /** Ambient occlusion 0-1 */
2119
+ ambientOcclusion?: number;
2120
+ /** Emission color and intensity */
2121
+ emission?: {
2122
+ color: {
2123
+ r: number;
2124
+ g: number;
2125
+ b: number;
2126
+ };
2127
+ intensity: number;
2128
+ };
2129
+ /** Normal map strength */
2130
+ normalStrength?: number;
2131
+ /** Parallax/height map strength */
2132
+ parallaxHeight?: number;
2133
+ /** Index of refraction for transmission */
2134
+ ior?: number;
2135
+ /** Transmission amount for transparent materials */
2136
+ transmission?: number;
2137
+ }
2138
+ /**
2139
+ * Material configuration
2140
+ */
2141
+ interface MaterialConfig {
2142
+ /** Material type */
2143
+ type: MaterialType;
2144
+ /** Material name for reuse */
2145
+ name?: string;
2146
+ /** PBR properties (for PBR materials) */
2147
+ pbr?: PBRMaterial;
2148
+ /** Texture maps */
2149
+ textures?: TextureMap[];
2150
+ /** Double-sided rendering */
2151
+ doubleSided?: boolean;
2152
+ /** Blend mode for transparency */
2153
+ blendMode?: 'opaque' | 'blend' | 'additive' | 'multiply';
2154
+ /** Custom shader code/reference */
2155
+ customShader?: {
2156
+ vertex?: string;
2157
+ fragment?: string;
2158
+ shaderLanguage?: 'glsl' | 'hlsl' | 'shadergraph';
2159
+ };
2160
+ /** GPU memory optimization hints */
2161
+ optimization?: {
2162
+ /** Stream textures if needed */
2163
+ streamTextures?: boolean;
2164
+ /** Compress textures */
2165
+ compression?: 'none' | 'dxt' | 'astc' | 'basis';
2166
+ /** Instance this material */
2167
+ instanced?: boolean;
2168
+ /** LOD bias for texture streaming */
2169
+ lodBias?: number;
2170
+ };
2171
+ }
2172
+ /**
2173
+ * MaterialTrait - Enables photorealistic material rendering
2174
+ */
2175
+ declare class MaterialTrait {
2176
+ private material;
2177
+ private textureCache;
2178
+ constructor(config: MaterialConfig);
2179
+ /**
2180
+ * Get material properties
2181
+ */
2182
+ getMaterial(): MaterialConfig;
2183
+ /**
2184
+ * Update material property
2185
+ */
2186
+ setProperty<K extends keyof MaterialConfig>(key: K, value: MaterialConfig[K]): void;
2187
+ /**
2188
+ * Get PBR properties
2189
+ */
2190
+ getPBRProperties(): PBRMaterial | undefined;
2191
+ /**
2192
+ * Update PBR material
2193
+ */
2194
+ updatePBR(pbr: Partial<PBRMaterial>): void;
2195
+ /**
2196
+ * Add texture map
2197
+ */
2198
+ addTexture(texture: TextureMap): void;
2199
+ /**
2200
+ * Get all textures
2201
+ */
2202
+ getTextures(): TextureMap[];
2203
+ /**
2204
+ * Clear texture cache (for memory optimization)
2205
+ */
2206
+ clearTextureCache(): void;
2207
+ /**
2208
+ * Get shader code if custom
2209
+ */
2210
+ getCustomShader(): {
2211
+ vertex?: string;
2212
+ fragment?: string;
2213
+ shaderLanguage?: "glsl" | "hlsl" | "shadergraph";
2214
+ } | undefined;
2215
+ /**
2216
+ * Set custom shader
2217
+ */
2218
+ setCustomShader(shader: MaterialConfig['customShader']): void;
2219
+ /**
2220
+ * Get optimization hints
2221
+ */
2222
+ getOptimization(): MaterialConfig['optimization'];
2223
+ /**
2224
+ * Enable/disable texture streaming
2225
+ */
2226
+ setTextureStreaming(enabled: boolean): void;
2227
+ /**
2228
+ * Set texture compression
2229
+ */
2230
+ setCompression(compression: 'none' | 'dxt' | 'astc' | 'basis'): void;
2231
+ /**
2232
+ * Enable material instancing for performance
2233
+ */
2234
+ setInstanced(instanced: boolean): void;
2235
+ /**
2236
+ * Dispose and cleanup
2237
+ */
2238
+ dispose(): void;
2239
+ }
2240
+ /**
2241
+ * HoloScript+ @material trait factory
2242
+ */
2243
+ declare function createMaterialTrait(config: MaterialConfig): MaterialTrait;
2244
+ /**
2245
+ * Preset materials for common use cases
2246
+ */
2247
+ declare const MATERIAL_PRESETS: {
2248
+ /** Shiny metal */
2249
+ chrome: () => MaterialConfig;
2250
+ /** Rough plastic */
2251
+ plastic: () => MaterialConfig;
2252
+ /** Wood texture */
2253
+ wood: () => MaterialConfig;
2254
+ /** Glass */
2255
+ glass: () => MaterialConfig;
2256
+ /** Emissive (glowing) */
2257
+ emissive: () => MaterialConfig;
2258
+ /** Skin material */
2259
+ skin: () => MaterialConfig;
2260
+ };
2261
+
2262
+ /**
2263
+ * @holoscript/core Lighting Trait
2264
+ *
2265
+ * Enables dynamic lighting with support for multiple light types,
2266
+ * shadows, and global illumination
2267
+ */
2268
+ type LightType = 'directional' | 'point' | 'spot' | 'area' | 'probe';
2269
+ type ShadowType = 'none' | 'hard' | 'soft' | 'raytraced';
2270
+ /**
2271
+ * Color definition
2272
+ */
2273
+ interface Color {
2274
+ r: number;
2275
+ g: number;
2276
+ b: number;
2277
+ a?: number;
2278
+ }
2279
+ /**
2280
+ * Vector3 position or direction
2281
+ */
2282
+ interface Vector3 {
2283
+ x: number;
2284
+ y: number;
2285
+ z: number;
2286
+ }
2287
+ /**
2288
+ * Shadow configuration
2289
+ */
2290
+ interface ShadowConfig {
2291
+ /** Shadow type */
2292
+ type: ShadowType;
2293
+ /** Shadow map resolution */
2294
+ resolution?: number;
2295
+ /** Shadow bias to prevent artifacts */
2296
+ bias?: number;
2297
+ /** Softness/blur radius */
2298
+ softness?: number;
2299
+ /** Max shadow distance */
2300
+ maxDistance?: number;
2301
+ /** Cascade levels for directional lights */
2302
+ cascades?: number;
2303
+ }
2304
+ /**
2305
+ * Light source definition
2306
+ */
2307
+ interface LightSource {
2308
+ /** Light type */
2309
+ type: LightType;
2310
+ /** Light name */
2311
+ name?: string;
2312
+ /** Position in world space */
2313
+ position?: Vector3;
2314
+ /** Direction (for directional/spot) */
2315
+ direction?: Vector3;
2316
+ /** Color */
2317
+ color: Color;
2318
+ /** Intensity/brightness 0-1+ */
2319
+ intensity: number;
2320
+ /** Attenuation range (point/spot) */
2321
+ range?: number;
2322
+ /** Spot angle in degrees */
2323
+ spotAngle?: number;
2324
+ /** Inner spot angle */
2325
+ innerSpotAngle?: number;
2326
+ /** Shadow configuration */
2327
+ shadow?: ShadowConfig;
2328
+ /** Light cookie/projection */
2329
+ cookie?: string;
2330
+ /** Enable volumetric fog interaction */
2331
+ volumetric?: boolean;
2332
+ /** Light priority for batching */
2333
+ priority?: number;
2334
+ }
2335
+ /**
2336
+ * Global illumination configuration
2337
+ */
2338
+ interface GlobalIlluminationConfig {
2339
+ /** Enable global illumination */
2340
+ enabled: boolean;
2341
+ /** Intensity multiplier */
2342
+ intensity?: number;
2343
+ /** Sky color for ambient light */
2344
+ skyColor?: Color;
2345
+ /** Sky intensity */
2346
+ skyIntensity?: number;
2347
+ /** Ground color for ambient light */
2348
+ groundColor?: Color;
2349
+ /** Ground intensity */
2350
+ groundIntensity?: number;
2351
+ /** Use light probes */
2352
+ probes?: boolean;
2353
+ /** Indirect diffuse intensity */
2354
+ indirectDiffuse?: number;
2355
+ /** Indirect specular intensity */
2356
+ indirectSpecular?: number;
2357
+ /** Ambient occlusion intensity */
2358
+ aoIntensity?: number;
2359
+ /** Use screen-space AO */
2360
+ screenSpaceAO?: boolean;
2361
+ }
2362
+ /**
2363
+ * LightingTrait - Manages dynamic lighting and illumination
2364
+ */
2365
+ declare class LightingTrait {
2366
+ private lights;
2367
+ private globalIllumination;
2368
+ private lightIdCounter;
2369
+ constructor(config?: GlobalIlluminationConfig);
2370
+ /**
2371
+ * Add a light to the scene
2372
+ */
2373
+ addLight(light: LightSource): string;
2374
+ /**
2375
+ * Get light by ID
2376
+ */
2377
+ getLight(id: string): LightSource | undefined;
2378
+ /**
2379
+ * Get all lights
2380
+ */
2381
+ getLights(): LightSource[];
2382
+ /**
2383
+ * Get lights by type
2384
+ */
2385
+ getLightsByType(type: LightType): LightSource[];
2386
+ /**
2387
+ * Update light properties
2388
+ */
2389
+ updateLight(id: string, updates: Partial<LightSource>): boolean;
2390
+ /**
2391
+ * Remove light
2392
+ */
2393
+ removeLight(id: string): boolean;
2394
+ /**
2395
+ * Clear all lights
2396
+ */
2397
+ clearLights(): void;
2398
+ /**
2399
+ * Get global illumination config
2400
+ */
2401
+ getGlobalIllumination(): GlobalIlluminationConfig;
2402
+ /**
2403
+ * Update global illumination
2404
+ */
2405
+ updateGlobalIllumination(updates: Partial<GlobalIlluminationConfig>): void;
2406
+ /**
2407
+ * Enable/disable GI
2408
+ */
2409
+ setGIEnabled(enabled: boolean): void;
2410
+ /**
2411
+ * Set ambient light colors (skybox mode)
2412
+ */
2413
+ setAmbientLight(skyColor: Color, groundColor: Color, intensity?: number): void;
2414
+ /**
2415
+ * Enable/disable screen-space ambient occlusion
2416
+ */
2417
+ setScreenSpaceAO(enabled: boolean, intensity?: number): void;
2418
+ /**
2419
+ * Create directional light (sun)
2420
+ */
2421
+ createDirectionalLight(direction: Vector3, color: Color, intensity?: number, castShadows?: boolean): string;
2422
+ /**
2423
+ * Create point light
2424
+ */
2425
+ createPointLight(position: Vector3, color: Color, intensity: number, range: number, castShadows?: boolean): string;
2426
+ /**
2427
+ * Create spot light
2428
+ */
2429
+ createSpotLight(position: Vector3, direction: Vector3, color: Color, intensity: number, range: number, spotAngle?: number, castShadows?: boolean): string;
2430
+ /**
2431
+ * Create area light for soft lighting
2432
+ */
2433
+ createAreaLight(position: Vector3, color: Color, intensity: number, width: number, height: number): string;
2434
+ /**
2435
+ * Get shadow-casting lights
2436
+ */
2437
+ getShadowCastingLights(): LightSource[];
2438
+ /**
2439
+ * Get light count by type
2440
+ */
2441
+ getLightCount(): {
2442
+ [key in LightType]: number;
2443
+ };
2444
+ /**
2445
+ * Estimate light impact for performance optimization
2446
+ */
2447
+ getPerformanceImpact(): {
2448
+ totalLights: number;
2449
+ shadowCasters: number;
2450
+ estimatedGPUCost: 'low' | 'medium' | 'high';
2451
+ };
2452
+ /**
2453
+ * Get scene complexity info
2454
+ */
2455
+ getSceneInfo(): string;
2456
+ /**
2457
+ * Dispose and cleanup
2458
+ */
2459
+ dispose(): void;
2460
+ }
2461
+ /**
2462
+ * HoloScript+ @lighting trait factory
2463
+ */
2464
+ declare function createLightingTrait(config?: GlobalIlluminationConfig): LightingTrait;
2465
+ /**
2466
+ * Preset lighting configurations
2467
+ */
2468
+ declare const LIGHTING_PRESETS: {
2469
+ /** Neutral studio lighting */
2470
+ studio: () => GlobalIlluminationConfig;
2471
+ /** Bright outdoor lighting */
2472
+ outdoor: () => GlobalIlluminationConfig;
2473
+ /** Dim interior lighting */
2474
+ interior: () => GlobalIlluminationConfig;
2475
+ /** Night scene */
2476
+ night: () => GlobalIlluminationConfig;
2477
+ /** Sunset/golden hour */
2478
+ sunset: () => GlobalIlluminationConfig;
2479
+ };
2480
+
2481
+ /**
2482
+ * @holoscript/core Rendering Trait
2483
+ *
2484
+ * Enables GPU optimization directives, level of detail management,
2485
+ * and rendering performance tuning
2486
+ */
2487
+ type CullingMode = 'none' | 'back' | 'front' | 'both';
2488
+ type LodStrategy = 'automatic' | 'manual' | 'disabled';
2489
+ type GPUResourceTier = 'low' | 'medium' | 'high' | 'ultra';
2490
+ /**
2491
+ * Level of Detail configuration
2492
+ */
2493
+ interface LODLevel {
2494
+ /** LOD level (0 = highest detail) */
2495
+ level: number;
2496
+ /** Screen-relative size threshold for this LOD */
2497
+ screenRelativeSize: number;
2498
+ /** Polygon reduction ratio (0-1) */
2499
+ polygonReduction?: number;
2500
+ /** Disable features at this LOD */
2501
+ disabledFeatures?: ('shadows' | 'normals' | 'specular' | 'animation')[];
2502
+ /** Texture resolution multiplier (0.25 = 1/4 resolution) */
2503
+ textureScale?: number;
2504
+ }
2505
+ /**
2506
+ * Culling configuration
2507
+ */
2508
+ interface CullingConfig {
2509
+ /** Face culling mode */
2510
+ mode: CullingMode;
2511
+ /** Frustum culling */
2512
+ frustum?: boolean;
2513
+ /** Occlusion culling */
2514
+ occlusion?: boolean;
2515
+ /** Occlusion query distance in units */
2516
+ occlusionDistance?: number;
2517
+ /** Hierarchical Z-buffer culling */
2518
+ hierarchicalZ?: boolean;
2519
+ }
2520
+ /**
2521
+ * Batching configuration
2522
+ */
2523
+ interface BatchingConfig {
2524
+ /** Static batching (for non-moving objects) */
2525
+ static?: boolean;
2526
+ /** Dynamic batching */
2527
+ dynamic?: boolean;
2528
+ /** Max batch size in vertices */
2529
+ maxBatchSize?: number;
2530
+ /** GPU instancing */
2531
+ instancing?: boolean;
2532
+ /** Instancing buffer size */
2533
+ maxInstanceCount?: number;
2534
+ }
2535
+ /**
2536
+ * Texture optimization
2537
+ */
2538
+ interface TextureOptimization {
2539
+ /** Enable texture streaming */
2540
+ streaming?: boolean;
2541
+ /** Streaming budget in MB */
2542
+ streamingBudget?: number;
2543
+ /** Virtual texture paging */
2544
+ virtualTexturing?: boolean;
2545
+ /** Texture compression */
2546
+ compression?: 'none' | 'dxt' | 'astc' | 'basis' | 'auto';
2547
+ /** Mipmap generation */
2548
+ mipmaps?: boolean;
2549
+ /** Max texture resolution */
2550
+ maxResolution?: 256 | 512 | 1024 | 2048 | 4096;
2551
+ }
2552
+ /**
2553
+ * Shader optimization
2554
+ */
2555
+ interface ShaderOptimization {
2556
+ /** Shader LOD bias */
2557
+ lodBias?: number;
2558
+ /** Use simplified shaders for distant objects */
2559
+ simplifiedShaders?: boolean;
2560
+ /** Compile shader variants for performance */
2561
+ variants?: {
2562
+ [key: string]: {
2563
+ enabled: boolean;
2564
+ cost?: 'low' | 'medium' | 'high';
2565
+ };
2566
+ };
2567
+ }
2568
+ /**
2569
+ * Rendering optimization hints
2570
+ */
2571
+ interface RenderingOptimization {
2572
+ /** LOD strategy */
2573
+ lodStrategy?: LodStrategy;
2574
+ /** LOD levels */
2575
+ lodLevels?: LODLevel[];
2576
+ /** Culling configuration */
2577
+ culling?: CullingConfig;
2578
+ /** Batching configuration */
2579
+ batching?: BatchingConfig;
2580
+ /** Texture optimization */
2581
+ textures?: TextureOptimization;
2582
+ /** Shader optimization */
2583
+ shaders?: ShaderOptimization;
2584
+ /** Target GPU tier */
2585
+ targetGPUTier?: GPUResourceTier;
2586
+ /** Fixed time-step rendering (for VR/AR) */
2587
+ fixedTimestep?: number;
2588
+ /** Enable adaptive quality */
2589
+ adaptiveQuality?: boolean;
2590
+ /** Target frame rate */
2591
+ targetFrameRate?: number;
2592
+ }
2593
+ /**
2594
+ * RenderingTrait - Manages GPU optimization and rendering performance
2595
+ */
2596
+ declare class RenderingTrait {
2597
+ private optimization;
2598
+ constructor(config?: RenderingOptimization);
2599
+ /**
2600
+ * Get rendering optimization config
2601
+ */
2602
+ getOptimization(): RenderingOptimization;
2603
+ /**
2604
+ * Update rendering configuration
2605
+ */
2606
+ updateOptimization(updates: Partial<RenderingOptimization>): void;
2607
+ /**
2608
+ * Setup LOD levels (3 levels is typical)
2609
+ */
2610
+ setupLODLevels(strategy?: LodStrategy): void;
2611
+ /**
2612
+ * Get LOD levels
2613
+ */
2614
+ getLODLevels(): LODLevel[];
2615
+ /**
2616
+ * Configure culling
2617
+ */
2618
+ setCulling(config: Partial<CullingConfig>): void;
2619
+ /**
2620
+ * Enable frustum culling
2621
+ */
2622
+ setFrustumCulling(enabled: boolean): void;
2623
+ /**
2624
+ * Enable occlusion culling
2625
+ */
2626
+ setOcclusionCulling(enabled: boolean, distance?: number): void;
2627
+ /**
2628
+ * Configure batching
2629
+ */
2630
+ setBatching(config: Partial<BatchingConfig>): void;
2631
+ /**
2632
+ * Enable GPU instancing
2633
+ */
2634
+ setInstancing(enabled: boolean, maxInstances?: number): void;
2635
+ /**
2636
+ * Configure texture optimization
2637
+ */
2638
+ setTextureOptimization(config: Partial<TextureOptimization>): void;
2639
+ /**
2640
+ * Enable texture streaming
2641
+ */
2642
+ setTextureStreaming(enabled: boolean, budgetMB?: number): void;
2643
+ /**
2644
+ * Set texture compression
2645
+ */
2646
+ setTextureCompression(compression: 'none' | 'dxt' | 'astc' | 'basis' | 'auto'): void;
2647
+ /**
2648
+ * Set max texture resolution
2649
+ */
2650
+ setMaxTextureResolution(resolution: 256 | 512 | 1024 | 2048 | 4096): void;
2651
+ /**
2652
+ * Configure shader optimization
2653
+ */
2654
+ setShaderOptimization(config: Partial<ShaderOptimization>): void;
2655
+ /**
2656
+ * Set target GPU tier
2657
+ */
2658
+ setTargetGPUTier(tier: GPUResourceTier): void;
2659
+ /**
2660
+ * Enable adaptive quality (adjust based on frame rate)
2661
+ */
2662
+ setAdaptiveQuality(enabled: boolean, targetFrameRate?: number): void;
2663
+ /**
2664
+ * Set fixed timestep for VR/AR
2665
+ */
2666
+ setFixedTimestep(timestep: number): void;
2667
+ /**
2668
+ * Get rendering preset for quality level
2669
+ */
2670
+ getPresetForQuality(quality: 'low' | 'medium' | 'high' | 'ultra'): RenderingOptimization;
2671
+ /**
2672
+ * Apply quality preset
2673
+ */
2674
+ applyQualityPreset(quality: 'low' | 'medium' | 'high' | 'ultra'): void;
2675
+ /**
2676
+ * Estimate GPU memory usage
2677
+ */
2678
+ estimateGPUMemory(): {
2679
+ textureMemory: number;
2680
+ vertexBuffers: number;
2681
+ estimatedTotal: number;
2682
+ };
2683
+ /**
2684
+ * Get rendering statistics/info
2685
+ */
2686
+ getInfo(): string;
2687
+ /**
2688
+ * Optimize for VR/AR (fixed timestep, fast culling)
2689
+ */
2690
+ optimizeForVRAR(targetFPS?: number): void;
2691
+ /**
2692
+ * Optimize for mobile (lower resources)
2693
+ */
2694
+ optimizeForMobile(): void;
2695
+ /**
2696
+ * Optimize for desktop (higher resources)
2697
+ */
2698
+ optimizeForDesktop(): void;
2699
+ /**
2700
+ * Dispose and cleanup
2701
+ */
2702
+ dispose(): void;
2703
+ }
2704
+ /**
2705
+ * HoloScript+ @rendering trait factory
2706
+ */
2707
+ declare function createRenderingTrait(config?: RenderingOptimization): RenderingTrait;
2708
+
2709
+ /**
2710
+ * HoloScriptPlus Parser - Extended DSL with Trait Annotations
2711
+ *
2712
+ * Extends HoloScript with support for:
2713
+ * - @material trait annotations for PBR materials
2714
+ * - @lighting trait annotations for dynamic lighting
2715
+ * - @rendering trait annotations for GPU optimization
2716
+ *
2717
+ * Syntax:
2718
+ * orb#sphere {
2719
+ * @material { type: pbr, metallic: 0.5, roughness: 0.4 }
2720
+ * @lighting { preset: studio, shadows: true }
2721
+ * @rendering { quality: high, lod: true }
2722
+ * }
2723
+ */
2724
+
2725
+ interface TraitAnnotation {
2726
+ type: 'material' | 'lighting' | 'rendering';
2727
+ config: Record<string, unknown>;
2728
+ line?: number;
2729
+ column?: number;
2730
+ }
2731
+ interface MaterialTraitAnnotation extends TraitAnnotation {
2732
+ type: 'material';
2733
+ config: {
2734
+ type?: string;
2735
+ pbr?: {
2736
+ baseColor?: {
2737
+ r: number;
2738
+ g: number;
2739
+ b: number;
2740
+ };
2741
+ metallic?: number;
2742
+ roughness?: number;
2743
+ ambientOcclusion?: number;
2744
+ emission?: {
2745
+ r: number;
2746
+ g: number;
2747
+ b: number;
2748
+ };
2749
+ emissionStrength?: number;
2750
+ };
2751
+ textures?: Array<{
2752
+ path: string;
2753
+ channel: string;
2754
+ }>;
2755
+ compression?: 'none' | 'dxt' | 'astc' | 'basis';
2756
+ instancing?: boolean;
2757
+ streaming?: boolean;
2758
+ };
2759
+ }
2760
+ interface LightingTraitAnnotation extends TraitAnnotation {
2761
+ type: 'lighting';
2762
+ config: {
2763
+ preset?: 'studio' | 'outdoor' | 'interior' | 'night' | 'sunset';
2764
+ lights?: Array<{
2765
+ type: 'directional' | 'point' | 'spot' | 'area' | 'ambient';
2766
+ position?: {
2767
+ x: number;
2768
+ y: number;
2769
+ z: number;
2770
+ };
2771
+ direction?: {
2772
+ x: number;
2773
+ y: number;
2774
+ z: number;
2775
+ };
2776
+ color?: {
2777
+ r: number;
2778
+ g: number;
2779
+ b: number;
2780
+ };
2781
+ intensity?: number;
2782
+ range?: number;
2783
+ shadows?: boolean;
2784
+ }>;
2785
+ globalIllumination?: {
2786
+ skyColor?: {
2787
+ r: number;
2788
+ g: number;
2789
+ b: number;
2790
+ };
2791
+ groundColor?: {
2792
+ r: number;
2793
+ g: number;
2794
+ b: number;
2795
+ };
2796
+ probes?: number;
2797
+ };
2798
+ shadows?: boolean;
2799
+ ao?: boolean;
2800
+ };
2801
+ }
2802
+ interface RenderingTraitAnnotation extends TraitAnnotation {
2803
+ type: 'rendering';
2804
+ config: {
2805
+ quality?: 'low' | 'medium' | 'high' | 'ultra';
2806
+ platform?: 'mobile' | 'vr' | 'desktop';
2807
+ lod?: boolean;
2808
+ culling?: boolean;
2809
+ batching?: boolean;
2810
+ instancing?: boolean;
2811
+ maxTextureResolution?: number;
2812
+ compression?: 'none' | 'dxt' | 'astc' | 'basis';
2813
+ targetFPS?: number;
2814
+ };
2815
+ }
2816
+ type AnyTraitAnnotation = MaterialTraitAnnotation | LightingTraitAnnotation | RenderingTraitAnnotation;
2817
+ interface GraphicsConfiguration {
2818
+ material?: MaterialTraitAnnotation['config'];
2819
+ lighting?: LightingTraitAnnotation['config'];
2820
+ rendering?: RenderingTraitAnnotation['config'];
2821
+ }
2822
+ declare class HoloScriptPlusParser {
2823
+ private baseParser;
2824
+ constructor();
2825
+ /**
2826
+ * Parse HoloScript+ code with trait annotations
2827
+ */
2828
+ parse(code: string): ASTNode[];
2829
+ /**
2830
+ * Enhance AST nodes with trait annotations
2831
+ */
2832
+ private enhanceWithTraits;
2833
+ /**
2834
+ * Enhance OrbNode with trait annotations
2835
+ */
2836
+ private enhanceOrbNodeWithTraits;
2837
+ /**
2838
+ * Extract trait annotations from code
2839
+ */
2840
+ extractTraitAnnotations(code: string, _orbLine?: number): AnyTraitAnnotation[];
2841
+ /**
2842
+ * Parse object literal from string
2843
+ * Supports nested objects and arrays
2844
+ */
2845
+ parseObjectLiteral(str: string): Record<string, unknown>;
2846
+ /**
2847
+ * Parse individual values
2848
+ */
2849
+ parseValue(str: string): unknown;
2850
+ /**
2851
+ * Build GraphicsConfiguration from trait annotations
2852
+ */
2853
+ buildGraphicsConfig(traits: AnyTraitAnnotation[]): GraphicsConfiguration;
2854
+ /**
2855
+ * Validate trait annotation configuration
2856
+ */
2857
+ validateTraitAnnotation(trait: AnyTraitAnnotation): {
2858
+ valid: boolean;
2859
+ errors: string[];
2860
+ };
2861
+ /**
2862
+ * Validate material trait configuration
2863
+ */
2864
+ private validateMaterialTrait;
2865
+ /**
2866
+ * Validate lighting trait configuration
2867
+ */
2868
+ private validateLightingTrait;
2869
+ /**
2870
+ * Validate rendering trait configuration
2871
+ */
2872
+ private validateRenderingTrait;
2873
+ /**
2874
+ * Get trait annotations as graphics traits
2875
+ */
2876
+ createGraphicsTraits(config: GraphicsConfiguration): {
2877
+ material: MaterialTrait | null;
2878
+ lighting: LightingTrait | null;
2879
+ rendering: RenderingTrait | null;
2880
+ };
2881
+ /**
2882
+ * Create MaterialTrait from config
2883
+ */
2884
+ private createMaterialTrait;
2885
+ /**
2886
+ * Create LightingTrait from config
2887
+ */
2888
+ private createLightingTrait;
2889
+ /**
2890
+ * Create RenderingTrait from config
2891
+ */
2892
+ private createRenderingTrait;
2893
+ }
2894
+
2895
+ /**
2896
+ * VR Trait System
2897
+ *
2898
+ * Implements VR interaction traits for HoloScript+ objects:
2899
+ * - @grabbable - Hand grab interactions
2900
+ * - @throwable - Physics-based throwing
2901
+ * - @pointable - Laser pointer interactions
2902
+ * - @hoverable - Hover state and highlights
2903
+ * - @scalable - Two-handed scaling
2904
+ * - @rotatable - Rotation interactions
2905
+ * - @stackable - Stacking behavior
2906
+ * - @snappable - Snap-to-point behavior
2907
+ * - @breakable - Destruction on impact
2908
+ *
2909
+ * @version 1.0.0
2910
+ */
2911
+
2912
+ interface TraitHandler<TConfig = unknown> {
2913
+ name: VRTraitName$1;
2914
+ defaultConfig: TConfig;
2915
+ onAttach?: (node: HSPlusNode, config: TConfig, context: TraitContext) => void;
2916
+ onDetach?: (node: HSPlusNode, config: TConfig, context: TraitContext) => void;
2917
+ onUpdate?: (node: HSPlusNode, config: TConfig, context: TraitContext, delta: number) => void;
2918
+ onEvent?: (node: HSPlusNode, config: TConfig, context: TraitContext, event: TraitEvent) => void;
2919
+ }
2920
+ interface TraitContext {
2921
+ vr: VRContext;
2922
+ physics: PhysicsContext;
2923
+ audio: AudioContext;
2924
+ haptics: HapticsContext;
2925
+ emit: (event: string, payload?: unknown) => void;
2926
+ getState: () => Record<string, unknown>;
2927
+ setState: (updates: Record<string, unknown>) => void;
2928
+ getScaleMultiplier: () => number;
2929
+ setScaleContext: (magnitude: string) => void;
2930
+ }
2931
+ interface VRContext {
2932
+ hands: {
2933
+ left: VRHand | null;
2934
+ right: VRHand | null;
2935
+ };
2936
+ headset: {
2937
+ position: Vector3$1;
2938
+ rotation: Vector3$1;
2939
+ };
2940
+ getPointerRay: (hand: 'left' | 'right') => {
2941
+ origin: Vector3$1;
2942
+ direction: Vector3$1;
2943
+ } | null;
2944
+ getDominantHand: () => VRHand | null;
2945
+ }
2946
+ interface PhysicsContext {
2947
+ applyVelocity: (node: HSPlusNode, velocity: Vector3$1) => void;
2948
+ applyAngularVelocity: (node: HSPlusNode, angularVelocity: Vector3$1) => void;
2949
+ setKinematic: (node: HSPlusNode, kinematic: boolean) => void;
2950
+ raycast: (origin: Vector3$1, direction: Vector3$1, maxDistance: number) => RaycastHit | null;
2951
+ }
2952
+ interface RaycastHit {
2953
+ node: HSPlusNode;
2954
+ point: Vector3$1;
2955
+ normal: Vector3$1;
2956
+ distance: number;
2957
+ }
2958
+ interface AudioContext {
2959
+ playSound: (source: string, options?: {
2960
+ position?: Vector3$1;
2961
+ volume?: number;
2962
+ spatial?: boolean;
2963
+ }) => void;
2964
+ }
2965
+ interface HapticsContext {
2966
+ pulse: (hand: 'left' | 'right', intensity: number, duration?: number) => void;
2967
+ rumble: (hand: 'left' | 'right', intensity: number) => void;
2968
+ }
2969
+ type TraitEvent = {
2970
+ type: 'grab_start';
2971
+ hand: VRHand;
2972
+ } | {
2973
+ type: 'grab_end';
2974
+ hand: VRHand;
2975
+ velocity: ThrowVelocity;
2976
+ } | {
2977
+ type: 'hover_enter';
2978
+ hand: VRHand;
2979
+ } | {
2980
+ type: 'hover_exit';
2981
+ hand: VRHand;
2982
+ } | {
2983
+ type: 'point_enter';
2984
+ hand: VRHand;
2985
+ } | {
2986
+ type: 'point_exit';
2987
+ hand: VRHand;
2988
+ } | {
2989
+ type: 'collision';
2990
+ data: CollisionEvent;
2991
+ } | {
2992
+ type: 'trigger_enter';
2993
+ other: HSPlusNode;
2994
+ } | {
2995
+ type: 'trigger_exit';
2996
+ other: HSPlusNode;
2997
+ } | {
2998
+ type: 'click';
2999
+ hand: VRHand;
3000
+ } | {
3001
+ type: 'scale_start';
3002
+ hands: {
3003
+ left: VRHand;
3004
+ right: VRHand;
3005
+ };
3006
+ } | {
3007
+ type: 'scale_update';
3008
+ scale: number;
3009
+ } | {
3010
+ type: 'scale_end';
3011
+ finalScale: number;
3012
+ } | {
3013
+ type: 'rotate_start';
3014
+ hand: VRHand;
3015
+ } | {
3016
+ type: 'rotate_update';
3017
+ rotation: Vector3$1;
3018
+ } | {
3019
+ type: 'rotate_end';
3020
+ finalRotation: Vector3$1;
3021
+ };
3022
+ declare class VRTraitRegistry {
3023
+ private handlers;
3024
+ constructor();
3025
+ register<T>(handler: TraitHandler<T>): void;
3026
+ getHandler(name: VRTraitName$1): TraitHandler | undefined;
3027
+ attachTrait(node: HSPlusNode, traitName: VRTraitName$1, config: unknown, context: TraitContext): void;
3028
+ detachTrait(node: HSPlusNode, traitName: VRTraitName$1, context: TraitContext): void;
3029
+ updateTrait(node: HSPlusNode, traitName: VRTraitName$1, context: TraitContext, delta: number): void;
3030
+ handleEvent(node: HSPlusNode, traitName: VRTraitName$1, context: TraitContext, event: TraitEvent): void;
3031
+ updateAllTraits(node: HSPlusNode, context: TraitContext, delta: number): void;
3032
+ handleEventForAllTraits(node: HSPlusNode, context: TraitContext, event: TraitEvent): void;
3033
+ }
3034
+
3035
+ /**
3036
+ * HoloScript+ Runtime Engine
3037
+ *
3038
+ * Executes parsed HoloScript+ AST with:
3039
+ * - Control flow (@for, @if) evaluation
3040
+ * - Lifecycle hook management
3041
+ * - VR trait integration
3042
+ * - Reactive state binding
3043
+ * - TypeScript companion integration
3044
+ *
3045
+ * @version 1.0.0
3046
+ */
3047
+
3048
+ interface RuntimeOptions {
3049
+ renderer?: Renderer;
3050
+ vrEnabled?: boolean;
3051
+ companions?: Record<string, Record<string, (...args: unknown[]) => unknown>>;
3052
+ }
3053
+ interface Renderer {
3054
+ createElement(type: string, properties: Record<string, unknown>): unknown;
3055
+ updateElement(element: unknown, properties: Record<string, unknown>): void;
3056
+ appendChild(parent: unknown, child: unknown): void;
3057
+ removeChild(parent: unknown, child: unknown): void;
3058
+ destroy(element: unknown): void;
3059
+ }
3060
+ declare class HoloScriptPlusRuntimeImpl implements HSPlusRuntime {
3061
+ private ast;
3062
+ private options;
3063
+ private state;
3064
+ private evaluator;
3065
+ private builtins;
3066
+ private traitRegistry;
3067
+ private rootInstance;
3068
+ private eventHandlers;
3069
+ private templates;
3070
+ private updateLoopId;
3071
+ private lastUpdateTime;
3072
+ private companions;
3073
+ private networkSync;
3074
+ private mounted;
3075
+ private scaleMultiplier;
3076
+ vrContext: {
3077
+ hands: {
3078
+ left: VRHand | null;
3079
+ right: VRHand | null;
3080
+ };
3081
+ headset: {
3082
+ position: Vector3$1;
3083
+ rotation: Vector3$1;
3084
+ };
3085
+ controllers: {
3086
+ left: unknown;
3087
+ right: unknown;
3088
+ };
3089
+ };
3090
+ constructor(ast: HSPlusAST, options?: RuntimeOptions);
3091
+ private initializeState;
3092
+ private loadImports;
3093
+ mount(container: unknown): void;
3094
+ unmount(): void;
3095
+ private instantiateNode;
3096
+ private processDirectives;
3097
+ private registerLifecycleHandler;
3098
+ private processControlFlow;
3099
+ private cloneNodeWithContext;
3100
+ private interpolateString;
3101
+ private interpolateProperties;
3102
+ private evaluateExpression;
3103
+ private evaluateProperties;
3104
+ private callLifecycle;
3105
+ private startUpdateLoop;
3106
+ private stopUpdateLoop;
3107
+ update(delta: number): void;
3108
+ private updateInstance;
3109
+ private syncAvatarParts;
3110
+ private generatedNodes;
3111
+ private processGenerateDirectives;
3112
+ private apiPollingTimers;
3113
+ private updateExternalApis;
3114
+ private executeExternalApi;
3115
+ private parseDurationToMs;
3116
+ private createTraitContext;
3117
+ private destroyInstance;
3118
+ updateData(data: unknown): void;
3119
+ getState(): StateDeclaration;
3120
+ getVariable(name: string): unknown;
3121
+ setVariable(name: string, value: unknown): void;
3122
+ getContext(): any;
3123
+ reset(): void;
3124
+ updateAnimations(): void;
3125
+ updateParticles(delta: number): void;
3126
+ getHologramStates(): Map<string, any>;
3127
+ setState(updates: Partial<StateDeclaration>): void;
3128
+ emit(event: string, payload?: unknown): void;
3129
+ updateEntity(id: string, properties: Partial<Record<string, unknown>>): boolean;
3130
+ on(event: string, handler: (payload: unknown) => void): () => void;
3131
+ updateVRContext(context: typeof this.vrContext): void;
3132
+ handleVREvent(event: TraitEvent, node: HSPlusNode): void;
3133
+ private findInstance;
3134
+ registerTemplate(name: string, node: HSPlusNode): void;
3135
+ spawnTemplate(name: string, position: Vector3$1): HSPlusNode;
3136
+ destroyNode(node: HSPlusNode): void;
3137
+ }
3138
+
3139
+ /**
3140
+ * Reactive State System for HoloScript+
3141
+ *
3142
+ * Provides reactive state management with:
3143
+ * - Proxy-based reactivity
3144
+ * - Computed properties
3145
+ * - Effect system for side effects
3146
+ * - Batched updates for performance
3147
+ *
3148
+ * @version 1.0.0
3149
+ */
3150
+
3151
+ type Subscriber<T> = (state: T, changedKey?: keyof T) => void;
3152
+ type UnsubscribeFunc = () => void;
3153
+ type EffectFunc = () => void | (() => void);
3154
+ type ComputedFunc<T> = () => T;
3155
+ interface EffectOptions {
3156
+ immediate?: boolean;
3157
+ deep?: boolean;
3158
+ }
3159
+ declare class ReactiveState<T extends StateDeclaration> implements ReactiveState$1<T> {
3160
+ private state;
3161
+ private proxy;
3162
+ private subscribers;
3163
+ private computedCache;
3164
+ private watchCleanups;
3165
+ constructor(initialState: T);
3166
+ get<K extends keyof T>(key: K): T[K];
3167
+ set<K extends keyof T>(key: K, value: T[K]): void;
3168
+ update(updates: Partial<T>): void;
3169
+ subscribe(callback: Subscriber<T>): UnsubscribeFunc;
3170
+ private notifySubscribers;
3171
+ computed<R>(key: string, getter: ComputedFunc<R>): R;
3172
+ watch<K extends keyof T>(key: K, handler: (newValue: T[K], oldValue: T[K]) => void, options?: EffectOptions): UnsubscribeFunc;
3173
+ watchEffect(effect: EffectFunc, _options?: EffectOptions): UnsubscribeFunc;
3174
+ getSnapshot(): T;
3175
+ reset(newState?: T): void;
3176
+ destroy(): void;
3177
+ }
3178
+ declare function createState<T extends StateDeclaration>(initialState: T): ReactiveState<T>;
3179
+ declare function reactive<T extends object>(target: T): T;
3180
+ declare function effect(fn: EffectFunc, _options?: EffectOptions): UnsubscribeFunc;
3181
+ declare function computed<T>(getter: ComputedFunc<T>): {
3182
+ readonly value: T;
3183
+ };
3184
+ interface StateBinding<T> {
3185
+ get: () => T;
3186
+ set: (value: T) => void;
3187
+ subscribe: (callback: (value: T) => void) => UnsubscribeFunc;
3188
+ }
3189
+ declare function bind<T extends StateDeclaration, K extends keyof T>(state: ReactiveState<T>, key: K): StateBinding<T[K]>;
3190
+
3191
+ /**
3192
+ * @holoscript/core VoiceInput Trait
3193
+ *
3194
+ * Enables voice-driven interactions for HoloScript+ objects
3195
+ * Integrates speech recognition with confidence-based command parsing
3196
+ */
3197
+ type VoiceInputMode = 'continuous' | 'push-to-talk' | 'always-listening';
3198
+ type ConfidenceThreshold = number;
3199
+ /**
3200
+ * Voice input configuration for HoloScript+ objects
3201
+ */
3202
+ interface VoiceInputConfig {
3203
+ /** Speech recognition mode */
3204
+ mode: VoiceInputMode;
3205
+ /** Minimum confidence level (0-1) to trigger command */
3206
+ confidenceThreshold: ConfidenceThreshold;
3207
+ /** Languages supported (BCP 47 codes) */
3208
+ languages?: string[];
3209
+ /** Commands this object responds to */
3210
+ commands?: VoiceCommand[];
3211
+ /** Enable speech-to-text display */
3212
+ showTranscript?: boolean;
3213
+ /** Audio feedback (beep on recognition) */
3214
+ audioFeedback?: boolean;
3215
+ /** Max command processing time (ms) */
3216
+ timeout?: number;
3217
+ }
3218
+ /**
3219
+ * Voice command definition
3220
+ */
3221
+ interface VoiceCommand {
3222
+ /** Primary trigger phrase */
3223
+ phrase: string;
3224
+ /** Alternative phrases (fuzzy matching) */
3225
+ aliases?: string[];
3226
+ /** Confidence threshold for this specific command */
3227
+ confidence?: number;
3228
+ /** Action to execute */
3229
+ action: string;
3230
+ /** Parameters extracted from command */
3231
+ params?: Record<string, string>;
3232
+ }
3233
+ /**
3234
+ * Voice recognition result
3235
+ */
3236
+ interface VoiceRecognitionResult {
3237
+ /** Transcribed text */
3238
+ transcript: string;
3239
+ /** Confidence (0-1) */
3240
+ confidence: number;
3241
+ /** Is final result or interim? */
3242
+ isFinal: boolean;
3243
+ /** Language detected */
3244
+ language: string;
3245
+ /** Matched command if any */
3246
+ matchedCommand?: VoiceCommand;
3247
+ /** Timestamp */
3248
+ timestamp: number;
3249
+ }
3250
+ /**
3251
+ * Voice input event
3252
+ */
3253
+ interface VoiceInputEvent {
3254
+ type: 'start' | 'interim' | 'final' | 'error' | 'timeout';
3255
+ result: VoiceRecognitionResult;
3256
+ hologramId: string;
3257
+ }
3258
+ /**
3259
+ * VoiceInputTrait - Enables speech recognition on HoloScript+ objects
3260
+ */
3261
+ declare class VoiceInputTrait {
3262
+ private config;
3263
+ private recognition;
3264
+ private isListening;
3265
+ private listeners;
3266
+ private interimTranscript;
3267
+ private commandCache;
3268
+ constructor(config: VoiceInputConfig);
3269
+ /**
3270
+ * Initialize Web Speech API
3271
+ */
3272
+ private initializeRecognition;
3273
+ /**
3274
+ * Setup Web Speech API event handlers
3275
+ */
3276
+ private setupRecognitionHandlers;
3277
+ /**
3278
+ * Process voice command with fuzzy matching
3279
+ */
3280
+ private processVoiceCommand;
3281
+ /**
3282
+ * Fuzzy string matching (simple Levenshtein-like approach)
3283
+ */
3284
+ private fuzzyMatch;
3285
+ /**
3286
+ * Build command index for faster lookup
3287
+ */
3288
+ private buildCommandCache;
3289
+ /**
3290
+ * Start listening for voice input
3291
+ */
3292
+ startListening(): void;
3293
+ /**
3294
+ * Stop listening for voice input
3295
+ */
3296
+ stopListening(): void;
3297
+ /**
3298
+ * Toggle listening state
3299
+ */
3300
+ toggleListening(): void;
3301
+ /**
3302
+ * Add command listener
3303
+ */
3304
+ on(listener: (event: VoiceInputEvent) => void): void;
3305
+ /**
3306
+ * Remove command listener
3307
+ */
3308
+ off(listener: (event: VoiceInputEvent) => void): void;
3309
+ /**
3310
+ * Emit voice event to all listeners
3311
+ */
3312
+ private emitEvent;
3313
+ /**
3314
+ * Play audio feedback beep
3315
+ */
3316
+ private playBeep;
3317
+ /**
3318
+ * Get current listening state
3319
+ */
3320
+ isActive(): boolean;
3321
+ /**
3322
+ * Dispose and cleanup
3323
+ */
3324
+ dispose(): void;
3325
+ }
3326
+ /**
3327
+ * HoloScript+ @voice_input trait factory
3328
+ */
3329
+ declare function createVoiceInputTrait(config: VoiceInputConfig): VoiceInputTrait;
3330
+
3331
+ /**
3332
+ * @holoscript/core AI-Driven NPC Trait
3333
+ *
3334
+ * Enables intelligent NPC behaviors using behavior trees and goal planning
3335
+ * Integrates with Infinity Assistant service for agent-based decision making
3336
+ */
3337
+ type BehaviorState = 'idle' | 'moving' | 'acting' | 'talking' | 'reacting';
3338
+ type DecisionMode = 'reactive' | 'goal-driven' | 'learning' | 'hybrid';
3339
+ /**
3340
+ * Behavior tree node
3341
+ */
3342
+ interface BehaviorNode {
3343
+ id: string;
3344
+ type: 'sequence' | 'selector' | 'parallel' | 'action' | 'condition';
3345
+ children?: BehaviorNode[];
3346
+ action?: (context: NPCContext) => Promise<boolean>;
3347
+ condition?: (context: NPCContext) => boolean;
3348
+ metadata?: Record<string, unknown>;
3349
+ }
3350
+ /**
3351
+ * NPC Context for behavior execution
3352
+ */
3353
+ interface NPCContext {
3354
+ npcId: string;
3355
+ position: [number, number, number];
3356
+ rotation: [number, number, number];
3357
+ targetId?: string;
3358
+ targetPosition?: [number, number, number];
3359
+ memory: Map<string, unknown>;
3360
+ state: BehaviorState;
3361
+ energy: number;
3362
+ mood: number;
3363
+ perception: {
3364
+ nearbyEntities: string[];
3365
+ visibleEntities: string[];
3366
+ hearableVoice?: string;
3367
+ };
3368
+ dialogue?: {
3369
+ lastSaid?: string;
3370
+ lastHeard?: string;
3371
+ conversationHistory: Array<{
3372
+ speaker: string;
3373
+ text: string;
3374
+ }>;
3375
+ };
3376
+ }
3377
+ /**
3378
+ * Goal for GOAP-style planning
3379
+ */
3380
+ interface NPCGoal {
3381
+ id: string;
3382
+ name: string;
3383
+ priority: number;
3384
+ preconditions: Map<string, unknown>;
3385
+ effects: Map<string, unknown>;
3386
+ cost: number;
3387
+ timeoutMs?: number;
3388
+ }
3389
+ /**
3390
+ * AI-Driven NPC configuration
3391
+ */
3392
+ interface AIDriverConfig {
3393
+ /** NPC identifier */
3394
+ npcId: string;
3395
+ /** Decision making mode */
3396
+ decisionMode: DecisionMode;
3397
+ /** Base behavior tree */
3398
+ behaviorTree?: BehaviorNode;
3399
+ /** Available goals */
3400
+ goals?: NPCGoal[];
3401
+ /** Personality traits */
3402
+ personality?: {
3403
+ sociability: number;
3404
+ aggression: number;
3405
+ curiosity: number;
3406
+ loyalty: number;
3407
+ };
3408
+ /** Response to stimuli */
3409
+ stimuliThresholds?: {
3410
+ hearing: number;
3411
+ sight: number;
3412
+ touch: number;
3413
+ };
3414
+ /** Learning config */
3415
+ enableLearning?: boolean;
3416
+ learningRate?: number;
3417
+ /** Infinity Assistant integration */
3418
+ agentId?: string;
3419
+ }
3420
+ /**
3421
+ * Behavior tree runner
3422
+ */
3423
+ declare class BehaviorTreeRunner {
3424
+ private rootNode;
3425
+ constructor(rootNode: BehaviorNode);
3426
+ tick(context: NPCContext): Promise<boolean>;
3427
+ private executeNode;
3428
+ }
3429
+ /**
3430
+ * Goal-Oriented Action Planning (GOAP)
3431
+ */
3432
+ declare class GOAPPlanner {
3433
+ private goals;
3434
+ constructor(goals: NPCGoal[]);
3435
+ /**
3436
+ * Plan a sequence of actions to reach goal
3437
+ */
3438
+ planGoal(currentState: Map<string, unknown>, _goal: NPCGoal): NPCGoal[];
3439
+ private canAchieve;
3440
+ }
3441
+ /**
3442
+ * AIDriverTrait - Enables intelligent NPC behaviors
3443
+ */
3444
+ declare class AIDriverTrait {
3445
+ private config;
3446
+ private context;
3447
+ private behaviorRunner;
3448
+ private goapPlanner;
3449
+ private updateInterval;
3450
+ private learningModel;
3451
+ constructor(config: AIDriverConfig);
3452
+ /**
3453
+ * Start NPC AI loop
3454
+ */
3455
+ startAI(): void;
3456
+ /**
3457
+ * Stop NPC AI loop
3458
+ */
3459
+ stopAI(): void;
3460
+ /**
3461
+ * Main AI tick
3462
+ */
3463
+ private tick;
3464
+ /**
3465
+ * Reactive decision: immediate response to stimuli
3466
+ */
3467
+ private reactiveDecision;
3468
+ /**
3469
+ * Goal-driven decision: plan towards objectives
3470
+ */
3471
+ private goalDrivenDecision;
3472
+ /**
3473
+ * Learning decision: adapt behavior from experience
3474
+ */
3475
+ private learningDecision;
3476
+ /**
3477
+ * Hybrid decision: combination of reactive and goal-driven
3478
+ */
3479
+ private hybridDecision;
3480
+ /**
3481
+ * Build world state for planning
3482
+ */
3483
+ private buildWorldState;
3484
+ /**
3485
+ * Update learning model from interactions
3486
+ */
3487
+ private updateLearningModel;
3488
+ /**
3489
+ * Calculate immediate reward
3490
+ */
3491
+ private calculateReward;
3492
+ /**
3493
+ * Set NPC position
3494
+ */
3495
+ setPosition(position: [number, number, number]): void;
3496
+ /**
3497
+ * Update perception (nearby entities, visible targets)
3498
+ */
3499
+ updatePerception(nearbyEntities: string[], visibleEntities: string[]): void;
3500
+ /**
3501
+ * Add dialogue to conversation history
3502
+ */
3503
+ speak(text: string): void;
3504
+ /**
3505
+ * Receive dialogue from another entity
3506
+ */
3507
+ hear(speaker: string, text: string): void;
3508
+ /**
3509
+ * Get current NPC context
3510
+ */
3511
+ getContext(): Readonly<NPCContext>;
3512
+ /**
3513
+ * Dispose and cleanup
3514
+ */
3515
+ dispose(): void;
3516
+ }
3517
+ /**
3518
+ * HoloScript+ @ai_driven trait factory
3519
+ */
3520
+ declare function createAIDriverTrait(config: AIDriverConfig): AIDriverTrait;
3521
+
3522
+ /**
3523
+ * @holoscript/core Performance Telemetry
3524
+ *
3525
+ * Real-time performance monitoring, profiling, and metrics collection
3526
+ * Exports metrics to analytics platforms and provides performance budgets
3527
+ */
3528
+ type MetricType = 'gauge' | 'counter' | 'histogram' | 'timer';
3529
+ type SeverityLevel = 'info' | 'warning' | 'critical';
3530
+ /**
3531
+ * Performance metric
3532
+ */
3533
+ interface Metric {
3534
+ name: string;
3535
+ type: MetricType;
3536
+ value: number;
3537
+ timestamp: number;
3538
+ tags?: Record<string, string>;
3539
+ unit?: string;
3540
+ }
3541
+ /**
3542
+ * Performance budget threshold
3543
+ */
3544
+ interface PerformanceBudget {
3545
+ metricName: string;
3546
+ maxValue: number;
3547
+ severity: SeverityLevel;
3548
+ enabled: boolean;
3549
+ }
3550
+ /**
3551
+ * Frame timing information
3552
+ */
3553
+ interface FrameTiming {
3554
+ frameNumber: number;
3555
+ fps: number;
3556
+ frameDuration: number;
3557
+ cpuTime: number;
3558
+ gpuTime: number;
3559
+ renderTime: number;
3560
+ logicTime: number;
3561
+ timestamp: number;
3562
+ }
3563
+ /**
3564
+ * Memory snapshot
3565
+ */
3566
+ interface MemorySnapshot {
3567
+ usedJSHeapSize: number;
3568
+ totalJSHeapSize: number;
3569
+ jsHeapSizeLimit: number;
3570
+ objectCount: number;
3571
+ gcEventsSinceLastSnapshot: number;
3572
+ timestamp: number;
3573
+ }
3574
+ /**
3575
+ * Performance analytics exporter
3576
+ */
3577
+ interface AnalyticsExporter {
3578
+ export(metrics: Metric[]): Promise<void>;
3579
+ flush(): Promise<void>;
3580
+ }
3581
+ /**
3582
+ * PerformanceTelemetry - Monitor and analyze runtime performance
3583
+ */
3584
+ declare class PerformanceTelemetry {
3585
+ private metrics;
3586
+ private budgets;
3587
+ private frameTimings;
3588
+ private memorySnapshots;
3589
+ private exporters;
3590
+ private frameCounter;
3591
+ private lastFrameTime;
3592
+ private frameTimes;
3593
+ private maxFrameHistory;
3594
+ private monitoringEnabled;
3595
+ private exportInterval;
3596
+ private exportIntervalMs;
3597
+ constructor();
3598
+ /**
3599
+ * Initialize default performance budgets
3600
+ */
3601
+ private initializeDefaultBudgets;
3602
+ /**
3603
+ * Start performance monitoring
3604
+ */
3605
+ startMonitoring(): void;
3606
+ /**
3607
+ * Stop performance monitoring
3608
+ */
3609
+ stopMonitoring(): void;
3610
+ /**
3611
+ * Record frame timing
3612
+ */
3613
+ recordFrame(cpuTime: number, gpuTime: number, renderTime: number, logicTime: number): void;
3614
+ /**
3615
+ * Record custom metric
3616
+ */
3617
+ recordMetric(metric: Omit<Metric, 'timestamp'> & {
3618
+ timestamp?: number;
3619
+ }): void;
3620
+ /**
3621
+ * Record memory snapshot
3622
+ */
3623
+ recordMemorySnapshot(): void;
3624
+ /**
3625
+ * Check frame metrics against budgets
3626
+ */
3627
+ private checkBudgets;
3628
+ /**
3629
+ * Emit budget violation warning
3630
+ */
3631
+ private emitBudgetViolation;
3632
+ /**
3633
+ * Set or update performance budget
3634
+ */
3635
+ setBudget(budget: PerformanceBudget): void;
3636
+ /**
3637
+ * Get average FPS over recent frames
3638
+ */
3639
+ getAverageFPS(): number;
3640
+ /**
3641
+ * Get memory usage stats
3642
+ */
3643
+ getMemoryStats(): {
3644
+ used: number;
3645
+ total: number;
3646
+ limit: number;
3647
+ percentage: number;
3648
+ };
3649
+ /**
3650
+ * Get recent frame timings
3651
+ */
3652
+ getRecentFrameTimings(count?: number): FrameTiming[];
3653
+ /**
3654
+ * Add analytics exporter
3655
+ */
3656
+ addExporter(exporter: AnalyticsExporter): void;
3657
+ /**
3658
+ * Export all metrics to registered exporters
3659
+ */
3660
+ exportMetrics(): Promise<void>;
3661
+ /**
3662
+ * Generate performance report
3663
+ */
3664
+ generateReport(): string;
3665
+ /**
3666
+ * Dispose and cleanup
3667
+ */
3668
+ dispose(): void;
3669
+ }
3670
+ /**
3671
+ * Get or create telemetry instance
3672
+ */
3673
+ declare function getPerformanceTelemetry(): PerformanceTelemetry;
3674
+
3675
+ /**
3676
+ * Hololand Graphics Pipeline Service
3677
+ *
3678
+ * Core service for managing graphics rendering pipeline in Hololand.
3679
+ * Integrates HoloScript graphics traits with Hololand's rendering backend.
3680
+ *
3681
+ * Responsibilities:
3682
+ * - Material management and asset pipeline
3683
+ * - Light management and shadow mapping
3684
+ * - GPU memory optimization
3685
+ * - Performance monitoring and profiling
3686
+ * - Cross-platform optimization (mobile/VR/desktop)
3687
+ */
3688
+
3689
+ interface GPUMemoryEstimate {
3690
+ textureMemory: number;
3691
+ geometryMemory: number;
3692
+ bufferMemory: number;
3693
+ estimatedTotal: number;
3694
+ budget: number;
3695
+ utilization: number;
3696
+ }
3697
+ interface MaterialAsset {
3698
+ id: string;
3699
+ name: string;
3700
+ material: MaterialTrait;
3701
+ shaders: ShaderProgram[];
3702
+ textures: TextureAsset[];
3703
+ instances: number;
3704
+ gpuMemory: number;
3705
+ lastUsed: number;
3706
+ }
3707
+ interface TextureAsset {
3708
+ id: string;
3709
+ path: string;
3710
+ format: 'RGBA8' | 'RGB565' | 'BC1' | 'BC3' | 'ASTC' | 'PVRTC';
3711
+ width: number;
3712
+ height: number;
3713
+ mipLevels: number;
3714
+ gpuMemory: number;
3715
+ loaded: boolean;
3716
+ }
3717
+ interface ShaderProgram {
3718
+ id: string;
3719
+ name: string;
3720
+ vertexShader: string;
3721
+ fragmentShader: string;
3722
+ uniforms: Record<string, string>;
3723
+ compiled: boolean;
3724
+ compilationTime: number;
3725
+ }
3726
+ interface PerformanceMetrics {
3727
+ drawCalls: number;
3728
+ trianglesRendered: number;
3729
+ gpuFrameTime: number;
3730
+ cpuFrameTime: number;
3731
+ fps: number;
3732
+ gpuMemoryUsed: number;
3733
+ textureBinds: number;
3734
+ shaderSwitches: number;
3735
+ batchCount: number;
3736
+ }
3737
+ type Platform = 'mobile' | 'vr' | 'desktop';
3738
+ interface PlatformConfig {
3739
+ platform: Platform;
3740
+ maxGPUMemory: number;
3741
+ maxDrawCalls: number;
3742
+ maxTextureResolution: number;
3743
+ targetFPS: number;
3744
+ shadowQuality: 'none' | 'low' | 'medium' | 'high';
3745
+ textureCompression: 'none' | 'dxt' | 'astc' | 'basis';
3746
+ instancingEnabled: boolean;
3747
+ maxLights: number;
3748
+ maxShadowCasters: number;
3749
+ }
3750
+ declare class HololandGraphicsPipelineService {
3751
+ private materialCache;
3752
+ private textureCache;
3753
+ private shaderCache;
3754
+ private platformConfig;
3755
+ private metrics;
3756
+ private memoryUsed;
3757
+ constructor(platform?: Platform);
3758
+ /**
3759
+ * Initialize graphics pipeline with configuration
3760
+ */
3761
+ initialize(config: GraphicsConfiguration): void;
3762
+ /**
3763
+ * Initialize materials from configuration
3764
+ */
3765
+ private initializeMaterials;
3766
+ /**
3767
+ * Initialize lighting from configuration
3768
+ */
3769
+ private initializeLighting;
3770
+ /**
3771
+ * Initialize rendering from configuration
3772
+ */
3773
+ private initializeRendering;
3774
+ /**
3775
+ * Create material asset from configuration
3776
+ */
3777
+ private createMaterialAsset;
3778
+ /**
3779
+ * Generate shaders from material configuration
3780
+ */
3781
+ private generateShaders;
3782
+ /**
3783
+ * Generate PBR shader program
3784
+ */
3785
+ private generatePBRShader;
3786
+ /**
3787
+ * Load textures from configuration
3788
+ */
3789
+ private loadTexturesFromConfig;
3790
+ /**
3791
+ * Select appropriate texture format based on compression type
3792
+ */
3793
+ private selectTextureFormat;
3794
+ /**
3795
+ * Estimate texture memory usage
3796
+ */
3797
+ private estimateTextureMemory;
3798
+ /**
3799
+ * Estimate material GPU memory
3800
+ */
3801
+ private estimateMaterialMemory;
3802
+ /**
3803
+ * Compile shader program
3804
+ */
3805
+ private compileShader;
3806
+ /**
3807
+ * Load texture into GPU memory
3808
+ */
3809
+ private loadTexture;
3810
+ /**
3811
+ * Setup shadow mapping
3812
+ */
3813
+ private setupShadowMapping;
3814
+ /**
3815
+ * Get shadow map resolution for quality level
3816
+ */
3817
+ /**
3818
+ * Setup global illumination
3819
+ */
3820
+ private setupGlobalIllumination;
3821
+ /**
3822
+ * Apply quality preset
3823
+ */
3824
+ private applyQualityPreset;
3825
+ /**
3826
+ * Enable LOD system
3827
+ */
3828
+ private enableLOD;
3829
+ /**
3830
+ * Enable culling
3831
+ */
3832
+ private enableCulling;
3833
+ /**
3834
+ * Get platform-specific configuration
3835
+ */
3836
+ private getPlatformConfig;
3837
+ /**
3838
+ * Initialize performance metrics
3839
+ */
3840
+ private initializeMetrics;
3841
+ /**
3842
+ * Get current GPU memory estimate
3843
+ */
3844
+ getGPUMemoryEstimate(): GPUMemoryEstimate;
3845
+ /**
3846
+ * Get performance metrics
3847
+ */
3848
+ getPerformanceMetrics(): PerformanceMetrics;
3849
+ /**
3850
+ * Set memory budget
3851
+ */
3852
+ setMemoryBudget(budget: number): void;
3853
+ /**
3854
+ * Optimize for specific platform
3855
+ */
3856
+ optimizePlatform(platform: Platform): void;
3857
+ }
3858
+
3859
+ /**
3860
+ * Platform Performance Optimization System
3861
+ *
3862
+ * Provides adaptive quality and performance tuning for:
3863
+ * - Mobile devices (battery/bandwidth constrained)
3864
+ * - VR/AR platforms (latency-critical, 90 FPS required)
3865
+ * - Desktop (quality-focused, high resolution)
3866
+ *
3867
+ * Features:
3868
+ * - Automatic quality adjustment based on device
3869
+ * - Performance profiling and analysis
3870
+ * - Bottleneck detection and mitigation
3871
+ * - Cross-platform benchmark testing
3872
+ */
3873
+ interface DeviceInfo {
3874
+ platform: 'mobile' | 'vr' | 'desktop';
3875
+ gpuVendor: string;
3876
+ gpuModel: string;
3877
+ gpuMemory: number;
3878
+ cpuCores: number;
3879
+ ramTotal: number;
3880
+ screenResolution: {
3881
+ width: number;
3882
+ height: number;
3883
+ };
3884
+ refreshRate: number;
3885
+ isLowPowerMode?: boolean;
3886
+ }
3887
+ interface DeviceCapabilities {
3888
+ maxTextureResolution: number;
3889
+ supportsCompression: boolean;
3890
+ compressionFormats: string[];
3891
+ maxSimultaneousLights: number;
3892
+ shadowsSupported: boolean;
3893
+ computeShaderSupported: boolean;
3894
+ rayTracingSupported: boolean;
3895
+ estimatedMemory: number;
3896
+ }
3897
+ interface PerformanceProfile {
3898
+ device: DeviceInfo;
3899
+ capabilities: DeviceCapabilities;
3900
+ targetFPS: number;
3901
+ qualityLevel: 'low' | 'medium' | 'high' | 'ultra';
3902
+ adaptiveQuality: boolean;
3903
+ fpsTarget: number;
3904
+ fpsMin: number;
3905
+ cpuBudget: number;
3906
+ gpuBudget: number;
3907
+ }
3908
+ interface BenchmarkResult {
3909
+ testName: string;
3910
+ platform: string;
3911
+ fps: number;
3912
+ gpuFrameTime: number;
3913
+ cpuFrameTime: number;
3914
+ gpuMemoryUsed: number;
3915
+ trianglesPerSecond: number;
3916
+ drawCallsPerSecond: number;
3917
+ qualityLevel: string;
3918
+ passed: boolean;
3919
+ }
3920
+ interface AdaptiveQualitySettings {
3921
+ enabled: boolean;
3922
+ checkInterval: number;
3923
+ fpsDeltaThreshold: number;
3924
+ memoryThreshold: number;
3925
+ temperatureThreshold?: number;
3926
+ }
3927
+ type CompressionFormat = 'none' | 'lz4' | 'zstd' | 'bc1' | 'bc7' | 'astc' | 'etc2' | 'pvrtc';
3928
+ interface PerformanceRecommendation {
3929
+ category: 'texture' | 'geometry' | 'shader' | 'memory' | 'rendering';
3930
+ priority: 'low' | 'medium' | 'high' | 'critical';
3931
+ recommendation: string;
3932
+ expectedImprovement: number;
3933
+ estimatedCost: string;
3934
+ }
3935
+ declare class PlatformPerformanceOptimizer {
3936
+ private deviceInfo;
3937
+ private capabilities;
3938
+ private profile;
3939
+ private adaptiveSettings;
3940
+ private currentFPS;
3941
+ private frameHistory;
3942
+ private lastAdaptTime;
3943
+ constructor(device: DeviceInfo);
3944
+ /**
3945
+ * Detect device capabilities
3946
+ */
3947
+ private detectCapabilities;
3948
+ /**
3949
+ * Create performance profile for device
3950
+ */
3951
+ private createProfile;
3952
+ /**
3953
+ * Get adaptive quality settings for platform
3954
+ */
3955
+ private getAdaptiveSettings;
3956
+ /**
3957
+ * Optimize for device - returns recommended rendering settings
3958
+ */
3959
+ optimizeForDevice(): any;
3960
+ /**
3961
+ * Select best compression format for platform
3962
+ */
3963
+ private selectCompression;
3964
+ /**
3965
+ * Update frame metrics for adaptive quality
3966
+ */
3967
+ updateFrameMetrics(fps: number, gpuMemoryUsed: number, gpuFrameTime: number): void;
3968
+ /**
3969
+ * Check and adapt quality settings
3970
+ */
3971
+ private checkAndAdapt;
3972
+ /**
3973
+ * Degrade quality for better performance
3974
+ */
3975
+ private degradeQuality;
3976
+ /**
3977
+ * Improve quality for better visuals
3978
+ */
3979
+ private improveQuality;
3980
+ /**
3981
+ * Get average FPS from history
3982
+ */
3983
+ private getAverageFPS;
3984
+ /**
3985
+ * Run performance benchmark
3986
+ */
3987
+ runBenchmark(name: string, renderFunc: (iterations: number) => Promise<{
3988
+ fps: number;
3989
+ gpuTime: number;
3990
+ cpuTime: number;
3991
+ triangles: number;
3992
+ drawCalls: number;
3993
+ }>): Promise<BenchmarkResult>;
3994
+ /**
3995
+ * Get benchmark iterations based on platform
3996
+ */
3997
+ private getBenchmarkIterations;
3998
+ /**
3999
+ * Get current performance profile
4000
+ */
4001
+ getProfile(): PerformanceProfile;
4002
+ /**
4003
+ * Get optimization recommendations
4004
+ */
4005
+ getRecommendations(): string[];
4006
+ }
4007
+
4008
+ /**
4009
+ * @holoscript/core Logger
4010
+ *
4011
+ * Simple pluggable logger for HoloScript
4012
+ */
4013
+ interface HoloScriptLogger {
4014
+ debug(message: string, meta?: Record<string, unknown>): void;
4015
+ info(message: string, meta?: Record<string, unknown>): void;
4016
+ warn(message: string, meta?: Record<string, unknown>): void;
4017
+ error(message: string, meta?: Record<string, unknown>): void;
4018
+ }
4019
+ declare class NoOpLogger implements HoloScriptLogger {
4020
+ debug(): void;
4021
+ info(): void;
4022
+ warn(): void;
4023
+ error(): void;
4024
+ }
4025
+ declare class ConsoleLogger implements HoloScriptLogger {
4026
+ debug(message: string, meta?: Record<string, unknown>): void;
4027
+ info(message: string, meta?: Record<string, unknown>): void;
4028
+ warn(message: string, meta?: Record<string, unknown>): void;
4029
+ error(message: string, meta?: Record<string, unknown>): void;
4030
+ }
4031
+ declare function setHoloScriptLogger(logger: HoloScriptLogger): void;
4032
+ declare function enableConsoleLogging(): void;
4033
+ declare function resetLogger(): void;
4034
+ declare const logger: HoloScriptLogger;
4035
+
4036
+ /**
4037
+ * @holoscript/core
4038
+ *
4039
+ * HoloScript+ - VR language with declarative syntax, state management, and VR interactions.
4040
+ * Enhanced version of HoloScript with:
4041
+ * - VR interaction traits (@grabbable, @throwable, @hoverable, etc.)
4042
+ * - Reactive state management (@state { ... })
4043
+ * - Control flow (@for, @if directives)
4044
+ * - TypeScript companion imports
4045
+ * - Expression interpolation ${...}
4046
+ *
4047
+ * Fully backward compatible with original HoloScript syntax.
4048
+ *
4049
+ * @example
4050
+ * ```typescript
4051
+ * import { HoloScriptPlusParser, HoloScriptPlusRuntime } from '@holoscript/core';
4052
+ *
4053
+ * const parser = new HoloScriptPlusParser();
4054
+ * const result = parser.parse(`
4055
+ * orb#myOrb {
4056
+ * position: [0, 0, 0]
4057
+ * @grabbable(snap_to_hand: true)
4058
+ * @throwable(bounce: true)
4059
+ * }
4060
+ * `);
4061
+ *
4062
+ * const runtime = new HoloScriptPlusRuntime(result.ast);
4063
+ * await runtime.mount(document.body);
4064
+ * ```
4065
+ *
4066
+ * @packageDocumentation
4067
+ */
4068
+
4069
+ declare const HOLOSCRIPT_VERSION = "1.0.0-alpha.1";
4070
+ declare const HOLOSCRIPT_SUPPORTED_PLATFORMS: readonly ["WebXR", "Oculus Quest", "HTC Vive", "Valve Index", "Apple Vision Pro", "Windows Mixed Reality"];
4071
+ declare const HOLOSCRIPT_VOICE_COMMANDS: readonly ["create orb [name]", "summon function [name]", "connect [from] to [to]", "execute [function]", "debug program", "visualize [data]", "gate [condition]", "stream [source] through [transformations]", "create button [name]", "add textinput [name]", "create panel [name]", "add slider [name]"];
4072
+ declare const HOLOSCRIPT_GESTURES: readonly ["pinch - create object", "swipe - connect objects", "rotate - modify properties", "grab - select object", "spread - expand view", "fist - execute action"];
4073
+ declare const HOLOSCRIPT_DEMO_SCRIPTS: {
4074
+ readonly helloWorld: "orb greeting {\n message: \"Hello, HoloScript World!\"\n color: \"#00ffff\"\n glow: true\n}\n\nfunction displayGreeting() {\n show greeting\n}";
4075
+ readonly aiAgent: "orb agentCore {\n personality: \"helpful\"\n capabilities: [\"conversation\", \"problem_solving\", \"learning\"]\n energy: 100\n}\n\nfunction processQuery(query: string): string {\n analyze query\n generate response\n return response\n}";
4076
+ readonly neuralNetwork: "orb inputLayer { neurons: 784 }\norb hiddenLayer { neurons: 128 }\norb outputLayer { neurons: 10 }\n\nconnect inputLayer to hiddenLayer as \"weights\"\nconnect hiddenLayer to outputLayer as \"weights\"\n\nfunction trainNetwork(data: array): object {\n forward_pass data\n calculate_loss\n backward_pass\n update_weights\n return metrics\n}";
4077
+ readonly loginForm: "button loginBtn {\n text: \"Login\"\n x: 100\n y: 150\n width: 200\n height: 40\n onClick: handleLogin\n}\n\ntextinput usernameInput {\n placeholder: \"Username\"\n x: 100\n y: 50\n width: 200\n height: 36\n}\n\ntextinput passwordInput {\n placeholder: \"Password\"\n x: 100\n y: 100\n width: 200\n height: 36\n}";
4078
+ readonly dashboard: "panel sidebar {\n x: 0\n y: 0\n width: 200\n height: 600\n backgroundColor: \"#2c3e50\"\n}\n\ntext title {\n content: \"Dashboard\"\n x: 220\n y: 20\n fontSize: 24\n color: \"#34495e\"\n}\n\nbutton refreshBtn {\n text: \"Refresh Data\"\n x: 220\n y: 60\n onClick: refreshData\n}";
4079
+ };
4080
+ /**
4081
+ * Create a pre-configured HoloScript environment
4082
+ */
4083
+ declare function createHoloScriptEnvironment(): {
4084
+ parser: HoloScriptParser;
4085
+ runtime: HoloScriptRuntime;
4086
+ version: string;
4087
+ };
4088
+ /**
4089
+ * Check if the current environment supports VR/XR
4090
+ */
4091
+ declare function isHoloScriptSupported(): boolean;
4092
+
4093
+ export { type ABTestTrait, type AIDriverConfig, AIDriverTrait, type AILifecycleHook, ASTNode, type AdaptiveQualitySettings, type AllLifecycleHooks, type AnalyticsExporter, type AnalyticsLifecycleHook, type AudioLifecycleHook, type BatchingConfig, type BehaviorNode, type BehaviorState, BehaviorTreeRunner, type BenchmarkResult, type BodyTrait, type BreakableTrait, type CameraTrait, type CaptionedTrait, type CharacterVoiceTrait, type ChoreographyTrait, type ClothingTrait, type CollaborativeTrait, type CompressionFormat, ConsoleLogger, type CullingConfig, type CullingMode, type DecisionMode, type DeviceCapabilities, type DeviceInfo, type EffectsLifecycleHook, type EmbeddableTrait, type ExpressiveTrait, type FaceTrait, type FilterTrait, type FrameTiming, GOAPPlanner, type GPUMemoryEstimate, type GPUResourceTier, GestureData, type GlobalIlluminationConfig, type GraphicsConfiguration, HOLOSCRIPT_DEMO_SCRIPTS, HOLOSCRIPT_GESTURES, HOLOSCRIPT_SUPPORTED_PLATFORMS, HOLOSCRIPT_VERSION, HOLOSCRIPT_VOICE_COMMANDS, type HairTrait, type HandsTrait, type HeatmapTrait, HoloScript2DParser, type HoloScriptLogger, HoloScriptParser, HoloScriptPlusParser$1 as HoloScriptPlusParser, HoloScriptPlusRuntimeImpl, HoloScriptRuntime, HoloScriptPlusParser as HoloScriptTraitAnnotationParser, HoloScriptValidator, HololandGraphicsPipelineService, LIFECYCLE_HOOKS, LIGHTING_PRESETS, type LODLevel, type LifecycleHookName, type LightSource, type LightType, LightingTrait, type LightingTraitAnnotation, type LocomotionTrait, type LodStrategy, MATERIAL_PRESETS, type MaterialAsset, type MaterialConfig, MaterialTrait, type MaterialTraitAnnotation, type MaterialType, type MediaLifecycleHook, type MemorySnapshot, type Metric, type MetricType, type MoldableTrait, type MorphTrait, type NPCContext, type NPCGoal, type NarratorTrait, type NetworkedTrait, NoOpLogger, type PBRMaterial, type ParticleConfig, type ParticleTrait, type PerformanceBudget, type PerformanceMetrics, type PerformanceProfile, type PerformanceRecommendation, PerformanceTelemetry, type PlatformConfig, PlatformPerformanceOptimizer, type PoseableTrait, Position2D, type ProactiveTrait, type ProceduralTrait, type QRTrait, type ReactiveAudioTrait, ReactiveState, type RecordableTrait, type RecordingClip, type RenderingOptimization, RenderingTrait, type RenderingTraitAnnotation, type ResponsiveTrait, type SeverityLevel, type ShaderOptimization, type ShaderProgram, type ShadowConfig, type ShadowType, type ShareContent, type ShareResult, type ShareableTrait, type SkeletonTrait, type SnappableTrait, type SocialLifecycleHook, type SpatialAudioTrait, SpatialPosition, type StackableTrait, type StreamableTrait, type StretchableTrait, type SurveyTrait, type TextureAsset, type TextureChannel, type TextureMap, type TextureOptimization, type TimelineLifecycleHook, type TimelineTrait, type TrackableTrait, type TrailTrait, type TransitionTrait, UI2DNode, type VRTraitName, VRTraitRegistry, VR_TRAITS, type ValidationError, type VideoTrait, VoiceCommand$1 as VoiceCommand, type VoiceInputConfig, type VoiceInputEvent, type VoiceInputMode, VoiceInputTrait, type VoiceRecognitionResult, type VoiceTrait, bind, computed, createAIDriverTrait, createHoloScriptEnvironment, createLightingTrait, createMaterialTrait, createParser, createRenderingTrait, createState, createVoiceInputTrait, effect, enableConsoleLogging, getPerformanceTelemetry, isHoloScriptSupported, logger, parse as parseHoloScriptPlus, reactive, resetLogger, setHoloScriptLogger };