@holoscript/core 6.0.3 → 6.0.4
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.
- package/README.md +38 -38
- package/dist/GLTFPipeline-DEN36VNK.js +12 -0
- package/dist/GLTFPipeline-YPCAK236.cjs +33 -0
- package/dist/{HoloScriptPlusParser-BZR5DELQ.js → HoloScriptPlusParser-BN6KVRCM.js} +5 -5
- package/dist/{HoloScriptPlusParser-SBMYDNXO.cjs → HoloScriptPlusParser-NC5FE6AL.cjs} +16 -16
- package/dist/{USDZExporter-YA55ZS35.js → USDZExporter-NTMBNTDB.js} +3 -3
- package/dist/{USDZExporter-MHEHXZB4.cjs → USDZExporter-UWGWNMMD.cjs} +3 -3
- package/dist/{chunk-32TWR3HE.js → chunk-2CWOLHTE.js} +3 -4
- package/dist/{chunk-2UX5LRAP.cjs → chunk-33LSUQDD.cjs} +33 -31
- package/dist/{chunk-LBPEZQAF.js → chunk-3FJCK5XA.js} +7 -7
- package/dist/{chunk-EGIZHYJP.cjs → chunk-3SAK5KFL.cjs} +2 -4
- package/dist/{chunk-PJMOXFPR.cjs → chunk-4XSNJCLC.cjs} +25 -27
- package/dist/{chunk-HKCVM6OK.cjs → chunk-5BGSECRJ.cjs} +21 -21
- package/dist/{chunk-EMO7HAKJ.cjs → chunk-5O6TQC6M.cjs} +26 -30
- package/dist/{chunk-XSUZMPVQ.cjs → chunk-5OEOHAAW.cjs} +26 -26
- package/dist/{chunk-EJA7G2C4.cjs → chunk-5WUNN6ZN.cjs} +2 -2
- package/dist/{chunk-CQDOF3G7.cjs → chunk-6TZPZCOJ.cjs} +18 -18
- package/dist/{chunk-NRUB55IT.cjs → chunk-6UEHYZ7V.cjs} +18 -16
- package/dist/{chunk-V42NTCFH.js → chunk-6XSERL6L.js} +4230 -2197
- package/dist/{chunk-X4YVN7H3.cjs → chunk-72EQECGT.cjs} +37 -17
- package/dist/{chunk-4KJ2R7VP.cjs → chunk-7AGYRWKW.cjs} +19 -19
- package/dist/{chunk-UQW6SLM5.js → chunk-A7PIMZGU.js} +110 -19
- package/dist/{chunk-RT7LJRSF.cjs → chunk-ATSKSYVE.cjs} +1013 -6708
- package/dist/{chunk-WN3YF33G.cjs → chunk-B5TCIAPQ.cjs} +9 -10
- package/dist/{chunk-AIUXRS74.cjs → chunk-BF2235SI.cjs} +4275 -2242
- package/dist/{chunk-DIEDKX5B.cjs → chunk-BND3ST2K.cjs} +18 -16
- package/dist/{chunk-EPWRXL6S.js → chunk-BU7VWW2K.js} +29 -29
- package/dist/{chunk-6OQBLABR.js → chunk-BWFJEM5A.js} +368 -189
- package/dist/{chunk-ARNKA274.cjs → chunk-CAUCGUEA.cjs} +6 -6
- package/dist/{chunk-YCMQQQ5U.cjs → chunk-CBJSLA2E.cjs} +398 -219
- package/dist/{chunk-BU5ZAFMC.js → chunk-CDPGV4DN.js} +6 -7
- package/dist/{chunk-CO2VM2DK.js → chunk-CS2EMTGF.js} +10 -9
- package/dist/{chunk-AW7WAELW.js → chunk-DMG7C4H2.js} +4 -4
- package/dist/{chunk-XSF76QRU.js → chunk-DXJQDCFL.js} +3 -3
- package/dist/{chunk-4FCZDTD5.js → chunk-E3FWRT3Z.js} +7 -9
- package/dist/{chunk-KYM4XRFG.js → chunk-E3UALNFA.js} +4 -4
- package/dist/{chunk-GC3YU46J.js → chunk-EONILVMF.js} +2 -2
- package/dist/{chunk-VJVCD5T5.cjs → chunk-EQV4R3EV.cjs} +22 -22
- package/dist/{chunk-FEFHPUEM.cjs → chunk-F3HH56EB.cjs} +74 -658
- package/dist/{chunk-WYH4GVZ5.js → chunk-F4IULT7N.js} +2 -2
- package/dist/{chunk-XDXZM3ZP.cjs → chunk-FFKU7BTK.cjs} +19 -19
- package/dist/{chunk-NKRKT6V2.js → chunk-FHQVYCH2.js} +11 -10
- package/dist/{chunk-7H5UNJZD.cjs → chunk-FSF7EQVA.cjs} +11 -10
- package/dist/{chunk-KUJRR4FJ.js → chunk-G4VZTCIB.js} +9 -7
- package/dist/{chunk-A6GO3DPZ.cjs → chunk-G7CT3EMP.cjs} +4 -4
- package/dist/{chunk-EUFLX2PI.js → chunk-GGHSW2NN.js} +989 -6611
- package/dist/chunk-GVUR45UF.cjs +777 -0
- package/dist/{chunk-ODGMVILH.js → chunk-H5Z7NASB.js} +3 -3
- package/dist/{chunk-7KPI4EKH.cjs → chunk-HE7ULERA.cjs} +45 -49
- package/dist/{chunk-26TLYBFD.js → chunk-HPS76H7Q.js} +3 -3
- package/dist/{chunk-RE3OKSYF.cjs → chunk-HQUEA5R6.cjs} +6 -6
- package/dist/{chunk-ZGTGVSTZ.js → chunk-HYNTS5CP.js} +2 -2
- package/dist/{chunk-PBA6NXCT.cjs → chunk-IBDG74G2.cjs} +6 -3
- package/dist/chunk-IFNQFCTM.js +3098 -0
- package/dist/{chunk-ZL6VJ6SN.js → chunk-IWI6J7FX.js} +5 -5
- package/dist/{chunk-3KEU5QYY.cjs → chunk-K3JDKWGI.cjs} +118 -23
- package/dist/{chunk-NLPSZT4C.js → chunk-K6EKD26I.js} +6 -6
- package/dist/chunk-KCQ5NDYC.cjs +3172 -0
- package/dist/{chunk-ELLQPFAF.js → chunk-KED34ILP.js} +11 -9
- package/dist/{chunk-BY3B7ZYV.cjs → chunk-KSGXLT74.cjs} +3 -3
- package/dist/{chunk-65RFOWZI.js → chunk-L4G4RLXX.js} +9 -7
- package/dist/{chunk-4SMUJFHL.js → chunk-LDP5OK6G.js} +6 -3
- package/dist/{chunk-VZNKJZTT.cjs → chunk-LGGRPKTV.cjs} +82 -96
- package/dist/{chunk-C2QHVHZF.js → chunk-LSW7P7ML.js} +23 -414
- package/dist/{chunk-HHS6FMOU.cjs → chunk-LXJ4667L.cjs} +83 -22
- package/dist/{chunk-H6WMMLQK.cjs → chunk-LZ266PCM.cjs} +20 -13
- package/dist/{chunk-V2ILLPHK.cjs → chunk-MD6KDHVE.cjs} +10 -10
- package/dist/{chunk-6WNCRE6F.js → chunk-MEASWI2Y.js} +5 -5
- package/dist/chunk-MPXBVFHQ.js +768 -0
- package/dist/{chunk-WUXIRGZP.cjs → chunk-NCUKG4SK.cjs} +304 -144
- package/dist/chunk-NDQNIJEH.js +1715 -0
- package/dist/{chunk-Y5MUAYTO.js → chunk-NOZZ46QU.js} +9 -8
- package/dist/{chunk-F5LVGHNT.js → chunk-OFKWH2IP.js} +3 -3
- package/dist/{chunk-SPDELRRV.cjs → chunk-PMGODDJA.cjs} +12 -12
- package/dist/{chunk-I3XGTIHM.cjs → chunk-Q4QX3AET.cjs} +2 -2
- package/dist/{chunk-Y7VK5TH3.cjs → chunk-Q5JT3YML.cjs} +10 -10
- package/dist/{chunk-TSWTWZ42.cjs → chunk-Q5SJOGHQ.cjs} +247 -205
- package/dist/{chunk-M6FU6S22.js → chunk-QGKNANZ3.js} +251 -91
- package/dist/{chunk-WFJIDI2N.cjs → chunk-QLEAOI3Q.cjs} +10 -10
- package/dist/{chunk-VK5AXKO3.js → chunk-R7MA7QWV.js} +70 -84
- package/dist/{chunk-W76ETJTI.js → chunk-RVYPEYPX.js} +6 -6
- package/dist/{chunk-MWEFR6YQ.js → chunk-S2N5TNMA.js} +7 -9
- package/dist/{chunk-NCUHGRTZ.js → chunk-S565K7NK.js} +7 -7
- package/dist/{chunk-AC4BSHFV.js → chunk-SDAMZIRE.js} +5 -5
- package/dist/{chunk-HBZYCASG.js → chunk-T36DDXSF.js} +75 -33
- package/dist/{chunk-BO2OKHIY.js → chunk-T4NKMBDL.js} +30 -611
- package/dist/{chunk-7X2IEJIE.cjs → chunk-T7LEXZUZ.cjs} +29 -29
- package/dist/{chunk-HUFNKFA6.js → chunk-TEWCN33Y.js} +8 -12
- package/dist/{chunk-L3Z2HIWJ.cjs → chunk-TQSZUOW5.cjs} +2 -2
- package/dist/chunk-TSH3MSQU.cjs +129 -0
- package/dist/{chunk-PLMYCCA4.js → chunk-UERJ3YJV.js} +6 -6
- package/dist/{chunk-7N3JIJMT.js → chunk-UPJBDCVF.js} +6 -6
- package/dist/{chunk-CMYAWUX3.js → chunk-V3NN3HPP.js} +12 -5
- package/dist/{chunk-SUCBB66F.js → chunk-WB4Z63GG.js} +3 -3
- package/dist/{chunk-PPULB4GG.cjs → chunk-WDW67DZB.cjs} +68 -68
- package/dist/chunk-WGMEAYBG.js +126 -0
- package/dist/{chunk-VSXOIUCF.cjs → chunk-X4ZF6CNE.cjs} +7 -7
- package/dist/{chunk-HF4OFY25.cjs → chunk-X6SEAXAX.cjs} +29 -445
- package/dist/{chunk-C7BNX4XJ.js → chunk-XCWFGZAA.js} +6 -6
- package/dist/{chunk-CNVM7J3M.js → chunk-XD6IYDUX.js} +34 -14
- package/dist/chunk-XG23EUQX.cjs +1717 -0
- package/dist/{chunk-DN7UFU63.cjs → chunk-XRKWN5PL.cjs} +12 -11
- package/dist/{chunk-XNMEH2BI.js → chunk-XUTX5CBW.js} +3 -3
- package/dist/{chunk-PQLGZKMC.cjs → chunk-XWPNTWDN.cjs} +26 -26
- package/dist/{chunk-NTMZSDXM.cjs → chunk-XXINBTZK.cjs} +43 -43
- package/dist/{chunk-74YCHHTE.js → chunk-YCXFCXDS.js} +8 -12
- package/dist/{chunk-KDB6BUMB.js → chunk-YQK5JNFK.js} +77 -18
- package/dist/{chunk-DH5G2JUA.cjs → chunk-Z34RLXRA.cjs} +44 -46
- package/dist/{chunk-XH7SE4HH.cjs → chunk-ZP4D3CSX.cjs} +19 -19
- package/dist/cli/holoscript-runner.cjs +33 -32
- package/dist/cli/holoscript-runner.js +13 -12
- package/dist/codebase/index.cjs +1 -1
- package/dist/codebase/index.d.ts +25 -0
- package/dist/codebase/index.js +1 -1
- package/dist/compiler/agent-inference.cjs +7 -8
- package/dist/compiler/agent-inference.js +3 -4
- package/dist/compiler/android-xr.cjs +7 -8
- package/dist/compiler/android-xr.js +5 -6
- package/dist/compiler/android.cjs +8 -9
- package/dist/compiler/android.js +6 -7
- package/dist/compiler/ar.cjs +6 -7
- package/dist/compiler/ar.js +4 -5
- package/dist/compiler/babylon.cjs +8 -9
- package/dist/compiler/babylon.js +7 -8
- package/dist/compiler/coco.cjs +1 -1
- package/dist/compiler/coco.js +1 -1
- package/dist/compiler/domain-block-utils.cjs +158 -151
- package/dist/compiler/domain-block-utils.js +4 -5
- package/dist/compiler/dtdl.cjs +7 -8
- package/dist/compiler/dtdl.js +4 -5
- package/dist/compiler/gltf-pipeline.cjs +9 -9
- package/dist/compiler/gltf-pipeline.js +2 -2
- package/dist/compiler/godot.cjs +6 -7
- package/dist/compiler/godot.js +5 -6
- package/dist/compiler/incremental.cjs +7 -8
- package/dist/compiler/incremental.js +2 -3
- package/dist/compiler/index.cjs +1934 -878
- package/dist/compiler/index.js +1904 -842
- package/dist/compiler/ios.cjs +8 -9
- package/dist/compiler/ios.js +6 -7
- package/dist/compiler/multi-layer.cjs +10 -17
- package/dist/compiler/multi-layer.js +9 -10
- package/dist/compiler/nodetoy.cjs +1 -1
- package/dist/compiler/nodetoy.js +1 -1
- package/dist/compiler/openxr.cjs +6 -7
- package/dist/compiler/openxr.js +5 -6
- package/dist/compiler/playcanvas.cjs +7 -8
- package/dist/compiler/playcanvas.js +6 -7
- package/dist/compiler/r3f.cjs +13 -14
- package/dist/compiler/r3f.js +8 -9
- package/dist/compiler/remotion.cjs +1 -1
- package/dist/compiler/remotion.js +1 -1
- package/dist/compiler/reproducibility.cjs +1 -1
- package/dist/compiler/reproducibility.js +1 -1
- package/dist/compiler/sdf.cjs +7 -8
- package/dist/compiler/sdf.js +5 -6
- package/dist/compiler/semantic-scene.cjs +7 -7
- package/dist/compiler/semantic-scene.js +2 -2
- package/dist/compiler/state.cjs +5 -6
- package/dist/compiler/state.js +3 -4
- package/dist/compiler/trait-composition.cjs +7 -8
- package/dist/compiler/trait-composition.js +3 -4
- package/dist/compiler/unity.cjs +6 -7
- package/dist/compiler/unity.js +5 -6
- package/dist/compiler/unreal.cjs +7 -8
- package/dist/compiler/unreal.js +5 -6
- package/dist/compiler/urdf.cjs +13 -14
- package/dist/compiler/urdf.js +5 -6
- package/dist/compiler/usd-physics.cjs +7 -8
- package/dist/compiler/usd-physics.js +4 -5
- package/dist/compiler/visionos.cjs +6 -7
- package/dist/compiler/visionos.js +5 -6
- package/dist/compiler/vrchat.cjs +7 -8
- package/dist/compiler/vrchat.js +5 -6
- package/dist/compiler/vrr.cjs +7 -8
- package/dist/compiler/vrr.js +5 -6
- package/dist/compiler/wasm.cjs +10 -11
- package/dist/compiler/wasm.js +5 -6
- package/dist/compiler/webgpu.cjs +6 -7
- package/dist/compiler/webgpu.js +5 -6
- package/dist/constants.d.ts +3 -0
- package/dist/debugger.cjs +7 -7
- package/dist/debugger.js +5 -5
- package/dist/entries/interop.cjs +1 -1
- package/dist/entries/interop.d.ts +9 -0
- package/dist/entries/interop.js +1 -1
- package/dist/entries/scripting.cjs +18 -17
- package/dist/entries/scripting.d.ts +7 -0
- package/dist/entries/scripting.js +8 -7
- package/dist/index.cjs +6773 -27555
- package/dist/index.d.ts +19 -0
- package/dist/index.js +5212 -26101
- package/dist/math/vec3.cjs +1 -1
- package/dist/math/vec3.js +1 -1
- package/dist/ml-dsa-PHCWUBPX.cjs +1178 -0
- package/dist/ml-dsa-WYLJHJO6.js +1178 -0
- package/dist/parser.cjs +11 -10
- package/dist/parser.js +8 -7
- package/dist/{playwright-BIZXMLD2.js → playwright-5OSAPTNH.js} +3 -3
- package/dist/{playwright-7DTEQCBD.cjs → playwright-RL6GY4F7.cjs} +1985 -1985
- package/dist/runtime.cjs +5 -5
- package/dist/runtime.js +4 -4
- package/dist/self-improvement/index.d.ts +0 -48
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.d.ts +24 -0
- package/dist/storage/index.js +1 -1
- package/dist/tools/index.d.ts +12 -0
- package/dist/traits/index.cjs +925 -607
- package/dist/traits/index.js +137 -20
- package/dist/type-checker.cjs +4 -4
- package/dist/type-checker.js +2 -2
- package/package.json +56 -21
- package/LICENSE +0 -21
- package/dist/GLTFPipeline-3KLWWUQO.cjs +0 -34
- package/dist/GLTFPipeline-LYII2ZVQ.js +0 -13
- package/dist/chunk-CN4NOESF.cjs +0 -416
- package/dist/chunk-DXVCEFZB.js +0 -2027
- package/dist/chunk-ENV7K6XA.js +0 -282
- package/dist/chunk-H7XMORZI.js +0 -2731
- package/dist/chunk-HAN4V3PF.cjs +0 -2037
- package/dist/chunk-LER4WXW5.cjs +0 -286
- package/dist/chunk-QHVVVN47.cjs +0 -2033
- package/dist/chunk-QWKUKVRE.js +0 -2026
- package/dist/chunk-UITWA6DV.cjs +0 -2829
- package/dist/chunk-X67XRI2T.js +0 -410
- package/dist/post-quantum-JTTAAGO3.cjs +0 -6
- package/dist/post-quantum-RVPVDEPI.js +0 -4
- package/dist/wot/index.cjs +0 -29
- package/dist/wot/index.js +0 -4
|
@@ -0,0 +1,768 @@
|
|
|
1
|
+
import { init_constants, VR_TRAITS } from './chunk-NDQNIJEH.js';
|
|
2
|
+
|
|
3
|
+
// src/constants.ts
|
|
4
|
+
init_constants();
|
|
5
|
+
init_constants();
|
|
6
|
+
var STRUCTURAL_DIRECTIVES = [
|
|
7
|
+
// Asset & Manifest
|
|
8
|
+
"manifest",
|
|
9
|
+
"asset",
|
|
10
|
+
// Semantic Annotations
|
|
11
|
+
"semantic",
|
|
12
|
+
"annotate",
|
|
13
|
+
"semantic_ref",
|
|
14
|
+
"bindings",
|
|
15
|
+
"artwork_metadata",
|
|
16
|
+
"npc_behavior",
|
|
17
|
+
// World Definition
|
|
18
|
+
"world_metadata",
|
|
19
|
+
"world_config",
|
|
20
|
+
"zones",
|
|
21
|
+
"spawn_points",
|
|
22
|
+
// Environment Lighting
|
|
23
|
+
"skybox",
|
|
24
|
+
"ambient_light",
|
|
25
|
+
"directional_light",
|
|
26
|
+
"fog",
|
|
27
|
+
// Advanced Simulation & AI
|
|
28
|
+
"time_zones",
|
|
29
|
+
"reality_capture",
|
|
30
|
+
"reality_mesh",
|
|
31
|
+
"reality_blend",
|
|
32
|
+
"diminished_reality",
|
|
33
|
+
"reality_portals",
|
|
34
|
+
"reality_effects",
|
|
35
|
+
"consciousness_model",
|
|
36
|
+
"global_workspace",
|
|
37
|
+
"attention_schema",
|
|
38
|
+
"predictive_mind",
|
|
39
|
+
"information_integration",
|
|
40
|
+
"qualia_generator",
|
|
41
|
+
"swarm_config",
|
|
42
|
+
"minimal_brain",
|
|
43
|
+
"rules",
|
|
44
|
+
"pheromone_system",
|
|
45
|
+
"emergence_detector",
|
|
46
|
+
"collective_memory",
|
|
47
|
+
"swarm_optimization",
|
|
48
|
+
"time_engine",
|
|
49
|
+
"time_buffer",
|
|
50
|
+
"time_abilities",
|
|
51
|
+
"paradox_prevention",
|
|
52
|
+
"knowledge_integration",
|
|
53
|
+
"neural_device",
|
|
54
|
+
"signal_processor",
|
|
55
|
+
"decoder",
|
|
56
|
+
"thought_mapping",
|
|
57
|
+
"haptic_feedback",
|
|
58
|
+
"visual_prosthesis",
|
|
59
|
+
"memory_interface",
|
|
60
|
+
"affective_computing",
|
|
61
|
+
"quantum_backend",
|
|
62
|
+
"quantum_rng",
|
|
63
|
+
"quantum_optimization",
|
|
64
|
+
"quantum_ml",
|
|
65
|
+
"quantum_simulation",
|
|
66
|
+
"quantum_crypto"
|
|
67
|
+
];
|
|
68
|
+
var LIFECYCLE_HOOKS = [
|
|
69
|
+
// Standard lifecycle
|
|
70
|
+
"on_mount",
|
|
71
|
+
"on_unmount",
|
|
72
|
+
"on_update",
|
|
73
|
+
"on_data_update",
|
|
74
|
+
"on_tick",
|
|
75
|
+
"on_activate",
|
|
76
|
+
"on_deactivate",
|
|
77
|
+
"on_detected",
|
|
78
|
+
// VR lifecycle
|
|
79
|
+
"on_grab",
|
|
80
|
+
"on_release",
|
|
81
|
+
"on_hover_enter",
|
|
82
|
+
"on_hover_exit",
|
|
83
|
+
"on_point_enter",
|
|
84
|
+
"on_point_exit",
|
|
85
|
+
"on_collision",
|
|
86
|
+
"on_trigger_enter",
|
|
87
|
+
"on_trigger_exit",
|
|
88
|
+
"on_click",
|
|
89
|
+
"on_double_click",
|
|
90
|
+
// Controller hooks
|
|
91
|
+
"on_controller_button",
|
|
92
|
+
"on_trigger_hold",
|
|
93
|
+
"on_trigger_release",
|
|
94
|
+
"on_grip_hold",
|
|
95
|
+
"on_grip_release",
|
|
96
|
+
// Stretchable/Moldable hooks
|
|
97
|
+
"on_stretch",
|
|
98
|
+
"on_sculpt",
|
|
99
|
+
// Humanoid/Avatar hooks
|
|
100
|
+
"on_pose_change",
|
|
101
|
+
"on_expression_change",
|
|
102
|
+
"on_gesture",
|
|
103
|
+
"on_speak",
|
|
104
|
+
"on_pose_save",
|
|
105
|
+
"on_morph_change",
|
|
106
|
+
// Media Production hooks
|
|
107
|
+
"on_record_start",
|
|
108
|
+
"on_record_stop",
|
|
109
|
+
"on_record_pause",
|
|
110
|
+
"on_stream_start",
|
|
111
|
+
"on_stream_stop",
|
|
112
|
+
"on_viewer_join",
|
|
113
|
+
"on_viewer_leave",
|
|
114
|
+
"on_chat_message",
|
|
115
|
+
"on_camera_switch",
|
|
116
|
+
"on_video_end",
|
|
117
|
+
"on_video_error",
|
|
118
|
+
// Analytics hooks
|
|
119
|
+
"on_track_event",
|
|
120
|
+
"on_survey_start",
|
|
121
|
+
"on_survey_complete",
|
|
122
|
+
"on_survey_skip",
|
|
123
|
+
"on_variant_assigned",
|
|
124
|
+
"on_conversion",
|
|
125
|
+
"on_hotspot_detected",
|
|
126
|
+
// Social hooks
|
|
127
|
+
"on_share",
|
|
128
|
+
"on_share_complete",
|
|
129
|
+
"on_embed",
|
|
130
|
+
"on_scan",
|
|
131
|
+
"on_user_join",
|
|
132
|
+
"on_user_leave",
|
|
133
|
+
"on_draw_stroke",
|
|
134
|
+
"on_object_lock",
|
|
135
|
+
"on_object_unlock",
|
|
136
|
+
// Effects hooks
|
|
137
|
+
"on_particle_spawn",
|
|
138
|
+
"on_particle_death",
|
|
139
|
+
"on_transition_start",
|
|
140
|
+
"on_transition_complete",
|
|
141
|
+
"on_filter_change",
|
|
142
|
+
// Audio hooks
|
|
143
|
+
"on_audio_start",
|
|
144
|
+
"on_audio_end",
|
|
145
|
+
"on_voice_command",
|
|
146
|
+
"on_speech_start",
|
|
147
|
+
"on_speech_end",
|
|
148
|
+
"on_beat",
|
|
149
|
+
"on_frequency_peak",
|
|
150
|
+
// AI hooks
|
|
151
|
+
"on_narration_start",
|
|
152
|
+
"on_narration_end",
|
|
153
|
+
"on_user_question",
|
|
154
|
+
"on_response_ready",
|
|
155
|
+
"on_emotion_change",
|
|
156
|
+
"on_generation_complete",
|
|
157
|
+
// Timeline hooks
|
|
158
|
+
"on_timeline_start",
|
|
159
|
+
"on_timeline_complete",
|
|
160
|
+
"on_keyframe_hit",
|
|
161
|
+
"on_keyframe_add",
|
|
162
|
+
"on_beat_sync",
|
|
163
|
+
"on_move_complete",
|
|
164
|
+
// Environment Understanding hooks
|
|
165
|
+
"on_plane_detected",
|
|
166
|
+
"on_plane_lost",
|
|
167
|
+
"on_plane_updated",
|
|
168
|
+
"on_mesh_detected",
|
|
169
|
+
"on_mesh_updated",
|
|
170
|
+
"on_anchor_created",
|
|
171
|
+
"on_anchor_resolved",
|
|
172
|
+
"on_anchor_lost",
|
|
173
|
+
"on_anchor_shared",
|
|
174
|
+
"on_light_estimated",
|
|
175
|
+
"on_occlusion_updated",
|
|
176
|
+
// Input Modality hooks
|
|
177
|
+
"on_gaze_enter",
|
|
178
|
+
"on_gaze_exit",
|
|
179
|
+
"on_gaze_dwell",
|
|
180
|
+
"on_hand_gesture",
|
|
181
|
+
"on_hand_pinch",
|
|
182
|
+
"on_hand_lost",
|
|
183
|
+
"on_body_pose_update",
|
|
184
|
+
"on_face_expression",
|
|
185
|
+
"on_controller_vibrate",
|
|
186
|
+
"on_accessory_input",
|
|
187
|
+
// Accessibility hooks
|
|
188
|
+
"on_accessibility_announce",
|
|
189
|
+
"on_subtitle_display",
|
|
190
|
+
"on_magnify",
|
|
191
|
+
"on_contrast_change",
|
|
192
|
+
"on_motion_reduce",
|
|
193
|
+
"on_screen_reader_focus",
|
|
194
|
+
"on_sonification_update",
|
|
195
|
+
// Gaussian Splatting & Volumetric hooks
|
|
196
|
+
"on_splat_loaded",
|
|
197
|
+
"on_nerf_ready",
|
|
198
|
+
"on_volume_frame",
|
|
199
|
+
"on_point_cloud_loaded",
|
|
200
|
+
"on_capture_complete",
|
|
201
|
+
// WebGPU Compute hooks
|
|
202
|
+
"on_compute_complete",
|
|
203
|
+
"on_buffer_ready",
|
|
204
|
+
"on_gpu_error",
|
|
205
|
+
// Digital Twin & IoT hooks
|
|
206
|
+
"on_sensor_update",
|
|
207
|
+
"on_data_change",
|
|
208
|
+
"on_alert_triggered",
|
|
209
|
+
"on_twin_sync",
|
|
210
|
+
"on_heatmap_update",
|
|
211
|
+
// Autonomous Agent hooks
|
|
212
|
+
"on_goal_completed",
|
|
213
|
+
"on_goal_failed",
|
|
214
|
+
"on_perception_change",
|
|
215
|
+
"on_emotion_shift",
|
|
216
|
+
"on_faction_change",
|
|
217
|
+
"on_patrol_waypoint",
|
|
218
|
+
"on_llm_response",
|
|
219
|
+
"on_memory_recalled",
|
|
220
|
+
"on_dialogue_start",
|
|
221
|
+
"on_dialogue_end",
|
|
222
|
+
// Advanced Spatial Audio hooks
|
|
223
|
+
"on_reverb_enter",
|
|
224
|
+
"on_reverb_exit",
|
|
225
|
+
"on_audio_occluded",
|
|
226
|
+
"on_audio_portal_enter",
|
|
227
|
+
// OpenUSD & Interoperability hooks
|
|
228
|
+
"on_asset_loaded",
|
|
229
|
+
"on_format_converted",
|
|
230
|
+
"on_scene_composed",
|
|
231
|
+
// Co-Presence & Shared Experience hooks
|
|
232
|
+
"on_co_presence_joined",
|
|
233
|
+
"on_co_presence_left",
|
|
234
|
+
"on_voice_proximity_change",
|
|
235
|
+
"on_role_change",
|
|
236
|
+
"on_spectator_join",
|
|
237
|
+
"on_avatar_sync",
|
|
238
|
+
// Geospatial & AR Cloud hooks
|
|
239
|
+
"on_vps_localized",
|
|
240
|
+
"on_poi_proximity",
|
|
241
|
+
"on_terrain_resolved",
|
|
242
|
+
"on_rooftop_resolved",
|
|
243
|
+
// Web3 & Ownership hooks
|
|
244
|
+
"on_wallet_connected",
|
|
245
|
+
"on_token_verified",
|
|
246
|
+
"on_nft_transferred",
|
|
247
|
+
"on_purchase_complete",
|
|
248
|
+
"on_asset_ported",
|
|
249
|
+
// Physics Expansion hooks
|
|
250
|
+
"on_cloth_tear",
|
|
251
|
+
"on_fluid_splash",
|
|
252
|
+
"on_soft_body_deform",
|
|
253
|
+
"on_rope_snap",
|
|
254
|
+
"on_wind_change",
|
|
255
|
+
"on_submerge",
|
|
256
|
+
"on_destruction_complete"
|
|
257
|
+
];
|
|
258
|
+
|
|
259
|
+
// src/parser/ErrorRecovery.ts
|
|
260
|
+
var VALID_KEYWORDS = [
|
|
261
|
+
"composition",
|
|
262
|
+
"object",
|
|
263
|
+
"group",
|
|
264
|
+
"template",
|
|
265
|
+
"state",
|
|
266
|
+
"logic",
|
|
267
|
+
"environment",
|
|
268
|
+
"timeline",
|
|
269
|
+
"zone",
|
|
270
|
+
"audio",
|
|
271
|
+
"ui_panel",
|
|
272
|
+
"ui_button",
|
|
273
|
+
"ui_text",
|
|
274
|
+
"ui_slider",
|
|
275
|
+
"ui_input",
|
|
276
|
+
"ui_image",
|
|
277
|
+
"ui_chart",
|
|
278
|
+
"import",
|
|
279
|
+
"using",
|
|
280
|
+
"action",
|
|
281
|
+
"on",
|
|
282
|
+
"if",
|
|
283
|
+
"else",
|
|
284
|
+
"for",
|
|
285
|
+
"while",
|
|
286
|
+
"animate",
|
|
287
|
+
"emit",
|
|
288
|
+
"spawn",
|
|
289
|
+
"transition"
|
|
290
|
+
];
|
|
291
|
+
var VALID_GEOMETRIES = [
|
|
292
|
+
"cube",
|
|
293
|
+
"box",
|
|
294
|
+
"sphere",
|
|
295
|
+
"cylinder",
|
|
296
|
+
"cone",
|
|
297
|
+
"torus",
|
|
298
|
+
"plane",
|
|
299
|
+
"text",
|
|
300
|
+
"model",
|
|
301
|
+
"sparkles",
|
|
302
|
+
"particles"
|
|
303
|
+
];
|
|
304
|
+
var VALID_TRAITS = [...VR_TRAITS];
|
|
305
|
+
var COMMON_PROPERTIES = [
|
|
306
|
+
"position",
|
|
307
|
+
"rotation",
|
|
308
|
+
"scale",
|
|
309
|
+
"color",
|
|
310
|
+
"material",
|
|
311
|
+
"geometry",
|
|
312
|
+
"mesh",
|
|
313
|
+
"model",
|
|
314
|
+
"src",
|
|
315
|
+
"text",
|
|
316
|
+
"content",
|
|
317
|
+
"width",
|
|
318
|
+
"height",
|
|
319
|
+
"radius",
|
|
320
|
+
"size",
|
|
321
|
+
"opacity",
|
|
322
|
+
"visible",
|
|
323
|
+
"name",
|
|
324
|
+
"id"
|
|
325
|
+
];
|
|
326
|
+
var ERROR_PATTERNS = [
|
|
327
|
+
// Missing closing brace
|
|
328
|
+
{
|
|
329
|
+
pattern: /unexpected end of input/i,
|
|
330
|
+
code: "MISSING_BRACE",
|
|
331
|
+
message: () => "Missing closing brace. Check that all { have matching }.",
|
|
332
|
+
suggestions: () => [
|
|
333
|
+
{
|
|
334
|
+
description: "Add closing brace at the end",
|
|
335
|
+
fix: "Add } to close the block"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
description: "Check for unclosed nested blocks",
|
|
339
|
+
fix: "Ensure each { has a corresponding }"
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
},
|
|
343
|
+
// Missing colon in property
|
|
344
|
+
{
|
|
345
|
+
pattern: /expected.*:/i,
|
|
346
|
+
code: "MISSING_COLON",
|
|
347
|
+
message: () => "Missing colon after property name.",
|
|
348
|
+
suggestions: () => [
|
|
349
|
+
{
|
|
350
|
+
description: "Add colon after property name",
|
|
351
|
+
fix: "propertyName: value"
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
// Unclosed string
|
|
356
|
+
{
|
|
357
|
+
pattern: /unterminated string|unexpected newline in string/i,
|
|
358
|
+
code: "MISSING_QUOTE",
|
|
359
|
+
message: () => "Unclosed string literal. Make sure strings have closing quotes.",
|
|
360
|
+
suggestions: () => [
|
|
361
|
+
{
|
|
362
|
+
description: "Add closing quote",
|
|
363
|
+
fix: `Ensure string ends with matching " or '`
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
description: "For multi-line strings, use template literals",
|
|
367
|
+
fix: "Use backticks ` for multi-line strings"
|
|
368
|
+
}
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
// Unknown keyword
|
|
372
|
+
{
|
|
373
|
+
pattern: /unexpected identifier ["']?(\w+)["']?/i,
|
|
374
|
+
code: "UNKNOWN_KEYWORD",
|
|
375
|
+
message: (match) => `Unknown keyword: ${match[1]}`,
|
|
376
|
+
suggestions: (match) => {
|
|
377
|
+
const word = match[1];
|
|
378
|
+
const similar = findSimilar(word, VALID_KEYWORDS);
|
|
379
|
+
return similar.map((s) => ({
|
|
380
|
+
description: `Did you mean '${s}'?`,
|
|
381
|
+
fix: `Replace '${word}' with '${s}'`
|
|
382
|
+
}));
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
];
|
|
386
|
+
var ErrorRecovery = class {
|
|
387
|
+
constructor() {
|
|
388
|
+
this.errors = [];
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Create an enhanced error with suggestions
|
|
392
|
+
*/
|
|
393
|
+
createError(code, message, line, column, source) {
|
|
394
|
+
const error = {
|
|
395
|
+
code,
|
|
396
|
+
message,
|
|
397
|
+
line,
|
|
398
|
+
column,
|
|
399
|
+
source,
|
|
400
|
+
suggestions: this.getSuggestions(code, message, source)
|
|
401
|
+
};
|
|
402
|
+
this.errors.push(error);
|
|
403
|
+
return error;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Get suggestions based on error type
|
|
407
|
+
*/
|
|
408
|
+
getSuggestions(code, message, _source) {
|
|
409
|
+
const suggestions = [];
|
|
410
|
+
switch (code) {
|
|
411
|
+
case "UNKNOWN_TRAIT":
|
|
412
|
+
const traitMatch = message.match(/trait.*["'](\w+)["']/i);
|
|
413
|
+
if (traitMatch) {
|
|
414
|
+
const similar = findSimilar(traitMatch[1], VALID_TRAITS);
|
|
415
|
+
suggestions.push(
|
|
416
|
+
...similar.map((s) => ({
|
|
417
|
+
description: `Did you mean '@${s}'?`,
|
|
418
|
+
fix: `Replace with @${s}`
|
|
419
|
+
}))
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
423
|
+
case "UNKNOWN_GEOMETRY":
|
|
424
|
+
const geoMatch = message.match(/geometry.*["'](\w+)["']/i);
|
|
425
|
+
if (geoMatch) {
|
|
426
|
+
const similar = findSimilar(geoMatch[1], VALID_GEOMETRIES);
|
|
427
|
+
suggestions.push(
|
|
428
|
+
...similar.map((s) => ({
|
|
429
|
+
description: `Did you mean '${s}'?`,
|
|
430
|
+
fix: `geometry: "${s}"`
|
|
431
|
+
}))
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
break;
|
|
435
|
+
case "INVALID_PROPERTY":
|
|
436
|
+
const propMatch = message.match(/property.*["'](\w+)["']/i);
|
|
437
|
+
if (propMatch) {
|
|
438
|
+
const similar = findSimilar(propMatch[1], COMMON_PROPERTIES);
|
|
439
|
+
suggestions.push(
|
|
440
|
+
...similar.map((s) => ({
|
|
441
|
+
description: `Did you mean '${s}'?`,
|
|
442
|
+
fix: `${s}: value`
|
|
443
|
+
}))
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
break;
|
|
447
|
+
case "TRAIT_CONFLICT":
|
|
448
|
+
suggestions.push({
|
|
449
|
+
description: "Remove one of the conflicting traits",
|
|
450
|
+
fix: "Check trait documentation for compatibility"
|
|
451
|
+
});
|
|
452
|
+
break;
|
|
453
|
+
case "TRAIT_REQUIRES":
|
|
454
|
+
suggestions.push({
|
|
455
|
+
description: "Add the required trait",
|
|
456
|
+
fix: "Some traits depend on others (e.g., @throwable requires @grabbable)"
|
|
457
|
+
});
|
|
458
|
+
break;
|
|
459
|
+
case "MISSING_BRACE":
|
|
460
|
+
suggestions.push({
|
|
461
|
+
description: "Check for matching braces",
|
|
462
|
+
fix: "Every { must have a corresponding }"
|
|
463
|
+
});
|
|
464
|
+
break;
|
|
465
|
+
case "MISSING_COLON":
|
|
466
|
+
suggestions.push({
|
|
467
|
+
description: "Add colon after property name",
|
|
468
|
+
fix: "Format: propertyName: value"
|
|
469
|
+
});
|
|
470
|
+
break;
|
|
471
|
+
case "MISSING_QUOTE":
|
|
472
|
+
suggestions.push({
|
|
473
|
+
description: "Close the string with matching quote",
|
|
474
|
+
fix: "Strings must end with the same quote they started with"
|
|
475
|
+
});
|
|
476
|
+
break;
|
|
477
|
+
case "INVALID_VALUE":
|
|
478
|
+
suggestions.push({
|
|
479
|
+
description: "Check value type",
|
|
480
|
+
fix: 'position expects [x, y, z], color expects "#rrggbb"'
|
|
481
|
+
});
|
|
482
|
+
break;
|
|
483
|
+
case "DUPLICATE_NAME":
|
|
484
|
+
suggestions.push({
|
|
485
|
+
description: "Use unique names for objects",
|
|
486
|
+
fix: "Each object in a composition must have a unique name"
|
|
487
|
+
});
|
|
488
|
+
break;
|
|
489
|
+
case "MISSING_REQUIRED":
|
|
490
|
+
suggestions.push({
|
|
491
|
+
description: "Add required properties",
|
|
492
|
+
fix: "Some blocks require certain properties to be defined"
|
|
493
|
+
});
|
|
494
|
+
break;
|
|
495
|
+
case "UNKNOWN_KEYWORD": {
|
|
496
|
+
const kwMatch = message.match(/keyword.*[:"']?\s*(\w+)/i);
|
|
497
|
+
if (kwMatch) {
|
|
498
|
+
const similar = findSimilar(kwMatch[1], VALID_KEYWORDS);
|
|
499
|
+
suggestions.push(
|
|
500
|
+
...similar.map((s) => ({
|
|
501
|
+
description: `Did you mean '${s}'?`,
|
|
502
|
+
fix: `Replace with ${s}`
|
|
503
|
+
}))
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
if (suggestions.length === 0) {
|
|
507
|
+
suggestions.push({
|
|
508
|
+
description: "Check available keywords",
|
|
509
|
+
fix: "Valid keywords: composition, object, group, template, etc."
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
case "SYNTAX_ERROR":
|
|
515
|
+
suggestions.push({
|
|
516
|
+
description: "Check syntax around this location",
|
|
517
|
+
fix: "Verify braces, quotes, and property format"
|
|
518
|
+
});
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
return suggestions;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Analyze raw error message and enhance it
|
|
525
|
+
*/
|
|
526
|
+
analyzeError(rawMessage, source, line, column) {
|
|
527
|
+
for (const pattern of ERROR_PATTERNS) {
|
|
528
|
+
const match = rawMessage.match(pattern.pattern);
|
|
529
|
+
if (match) {
|
|
530
|
+
const context = { source, line, column };
|
|
531
|
+
return {
|
|
532
|
+
code: pattern.code,
|
|
533
|
+
message: pattern.message(match),
|
|
534
|
+
line,
|
|
535
|
+
column,
|
|
536
|
+
source,
|
|
537
|
+
suggestions: pattern.suggestions(match, context)
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
return {
|
|
542
|
+
code: "SYNTAX_ERROR",
|
|
543
|
+
message: rawMessage,
|
|
544
|
+
line,
|
|
545
|
+
column,
|
|
546
|
+
source,
|
|
547
|
+
suggestions: [
|
|
548
|
+
{
|
|
549
|
+
description: "Check syntax around this location",
|
|
550
|
+
fix: "Verify braces, quotes, and property format"
|
|
551
|
+
}
|
|
552
|
+
]
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Format error for display
|
|
557
|
+
*/
|
|
558
|
+
formatError(error) {
|
|
559
|
+
const lines = [];
|
|
560
|
+
lines.push(`[${error.code}] ${error.message}`);
|
|
561
|
+
lines.push(` at line ${error.line}, column ${error.column}`);
|
|
562
|
+
if (error.source) {
|
|
563
|
+
lines.push("");
|
|
564
|
+
lines.push(` ${error.source}`);
|
|
565
|
+
lines.push(` ${" ".repeat(error.column - 1)}^`);
|
|
566
|
+
}
|
|
567
|
+
if (error.suggestions && error.suggestions.length > 0) {
|
|
568
|
+
lines.push("");
|
|
569
|
+
lines.push("Suggestions:");
|
|
570
|
+
for (const suggestion of error.suggestions) {
|
|
571
|
+
lines.push(` \u2022 ${suggestion.description}`);
|
|
572
|
+
if (suggestion.fix) {
|
|
573
|
+
lines.push(` Fix: ${suggestion.fix}`);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return lines.join("\n");
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Get all collected errors
|
|
581
|
+
*/
|
|
582
|
+
getErrors() {
|
|
583
|
+
return [...this.errors];
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Clear collected errors
|
|
587
|
+
*/
|
|
588
|
+
clear() {
|
|
589
|
+
this.errors = [];
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Check if there are any errors
|
|
593
|
+
*/
|
|
594
|
+
hasErrors() {
|
|
595
|
+
return this.errors.length > 0;
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
function findSimilar(input, candidates, maxDistance = 3) {
|
|
599
|
+
const results = [];
|
|
600
|
+
for (const candidate of candidates) {
|
|
601
|
+
const distance = levenshteinDistance(input.toLowerCase(), candidate.toLowerCase());
|
|
602
|
+
if (distance <= maxDistance) {
|
|
603
|
+
results.push({ word: candidate, distance });
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return results.sort((a, b) => a.distance - b.distance).slice(0, 3).map((r) => r.word);
|
|
607
|
+
}
|
|
608
|
+
function levenshteinDistance(a, b) {
|
|
609
|
+
const matrix = [];
|
|
610
|
+
for (let i = 0; i <= b.length; i++) {
|
|
611
|
+
matrix[i] = [i];
|
|
612
|
+
}
|
|
613
|
+
for (let j = 0; j <= a.length; j++) {
|
|
614
|
+
matrix[0][j] = j;
|
|
615
|
+
}
|
|
616
|
+
for (let i = 1; i <= b.length; i++) {
|
|
617
|
+
for (let j = 1; j <= a.length; j++) {
|
|
618
|
+
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
|
619
|
+
matrix[i][j] = matrix[i - 1][j - 1];
|
|
620
|
+
} else {
|
|
621
|
+
matrix[i][j] = Math.min(
|
|
622
|
+
matrix[i - 1][j - 1] + 1,
|
|
623
|
+
// substitution
|
|
624
|
+
matrix[i][j - 1] + 1,
|
|
625
|
+
// insertion
|
|
626
|
+
matrix[i - 1][j] + 1
|
|
627
|
+
// deletion
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return matrix[b.length][a.length];
|
|
633
|
+
}
|
|
634
|
+
function enrichErrorWithSuggestions(error, source) {
|
|
635
|
+
if (error.suggestions && error.suggestions.length > 0) {
|
|
636
|
+
return error;
|
|
637
|
+
}
|
|
638
|
+
const suggestions = [];
|
|
639
|
+
switch (error.code) {
|
|
640
|
+
case "UNKNOWN_TRAIT":
|
|
641
|
+
const traitMatch = error.message.match(/trait.*["'](\w+)["']/i);
|
|
642
|
+
if (traitMatch) {
|
|
643
|
+
const similar = findSimilar(traitMatch[1], VALID_TRAITS);
|
|
644
|
+
suggestions.push(
|
|
645
|
+
...similar.map((s) => ({
|
|
646
|
+
description: `Did you mean '@${s}'?`,
|
|
647
|
+
fix: `Replace with @${s}`
|
|
648
|
+
}))
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
break;
|
|
652
|
+
case "UNKNOWN_KEYWORD":
|
|
653
|
+
const keywordMatch = error.message.match(/keyword.*["'](\w+)["']/i);
|
|
654
|
+
if (keywordMatch) {
|
|
655
|
+
const similar = findSimilar(keywordMatch[1], VALID_KEYWORDS);
|
|
656
|
+
suggestions.push(
|
|
657
|
+
...similar.map((s) => ({
|
|
658
|
+
description: `Did you mean '${s}'?`,
|
|
659
|
+
fix: `Replace with ${s}`
|
|
660
|
+
}))
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
break;
|
|
664
|
+
case "UNKNOWN_GEOMETRY":
|
|
665
|
+
const geomMatch = error.message.match(/geometry.*["'](\w+)["']/i);
|
|
666
|
+
if (geomMatch) {
|
|
667
|
+
const similar = findSimilar(geomMatch[1], VALID_GEOMETRIES);
|
|
668
|
+
suggestions.push(
|
|
669
|
+
...similar.map((s) => ({
|
|
670
|
+
description: `Did you mean '${s}'?`,
|
|
671
|
+
fix: `Replace with ${s}`
|
|
672
|
+
}))
|
|
673
|
+
);
|
|
674
|
+
}
|
|
675
|
+
break;
|
|
676
|
+
case "MISSING_BRACE":
|
|
677
|
+
suggestions.push({
|
|
678
|
+
description: "Add closing brace at the end",
|
|
679
|
+
fix: "Add } to close the block"
|
|
680
|
+
});
|
|
681
|
+
break;
|
|
682
|
+
case "MISSING_COLON":
|
|
683
|
+
suggestions.push({
|
|
684
|
+
description: "Add colon after property name",
|
|
685
|
+
fix: "propertyName: value"
|
|
686
|
+
});
|
|
687
|
+
break;
|
|
688
|
+
case "MISSING_QUOTE":
|
|
689
|
+
suggestions.push({
|
|
690
|
+
description: "Add closing quote",
|
|
691
|
+
fix: `Ensure string ends with matching " or '`
|
|
692
|
+
});
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
for (const pattern of ERROR_PATTERNS) {
|
|
696
|
+
const match = error.message.match(pattern.pattern);
|
|
697
|
+
if (match) {
|
|
698
|
+
const context = {
|
|
699
|
+
source,
|
|
700
|
+
line: error.line,
|
|
701
|
+
column: error.column
|
|
702
|
+
};
|
|
703
|
+
suggestions.push(...pattern.suggestions(match, context));
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return {
|
|
708
|
+
...error,
|
|
709
|
+
suggestions: suggestions.length > 0 ? suggestions : error.suggestions
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
function generateQuickFixes(error, source) {
|
|
713
|
+
const fixes = [];
|
|
714
|
+
switch (error.code) {
|
|
715
|
+
case "MISSING_BRACE":
|
|
716
|
+
fixes.push({
|
|
717
|
+
title: "Add closing brace",
|
|
718
|
+
edit: {
|
|
719
|
+
range: { start: source.length, end: source.length },
|
|
720
|
+
newText: "\n}"
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
break;
|
|
724
|
+
case "MISSING_COLON":
|
|
725
|
+
const lineStart = getLineStart(source, error.line);
|
|
726
|
+
const lineEnd = source.indexOf("\n", lineStart);
|
|
727
|
+
const line = source.substring(lineStart, lineEnd === -1 ? void 0 : lineEnd);
|
|
728
|
+
const match = line.match(/^\s*(\w+)\s+/);
|
|
729
|
+
if (match) {
|
|
730
|
+
fixes.push({
|
|
731
|
+
title: "Add colon after property",
|
|
732
|
+
edit: {
|
|
733
|
+
range: { start: lineStart + match[0].length - 1, end: lineStart + match[0].length - 1 },
|
|
734
|
+
newText: ":"
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
break;
|
|
739
|
+
case "MISSING_QUOTE":
|
|
740
|
+
fixes.push({
|
|
741
|
+
title: "Add closing quote",
|
|
742
|
+
edit: {
|
|
743
|
+
range: { start: source.length, end: source.length },
|
|
744
|
+
newText: '"'
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
break;
|
|
748
|
+
}
|
|
749
|
+
return fixes;
|
|
750
|
+
}
|
|
751
|
+
function getLineStart(source, lineNumber) {
|
|
752
|
+
let line = 1;
|
|
753
|
+
let pos = 0;
|
|
754
|
+
while (line < lineNumber && pos < source.length) {
|
|
755
|
+
if (source[pos] === "\n") {
|
|
756
|
+
line++;
|
|
757
|
+
}
|
|
758
|
+
pos++;
|
|
759
|
+
}
|
|
760
|
+
return pos;
|
|
761
|
+
}
|
|
762
|
+
var HOLOSCHEMA_KEYWORDS = VALID_KEYWORDS;
|
|
763
|
+
var HOLOSCHEMA_GEOMETRIES = VALID_GEOMETRIES;
|
|
764
|
+
var HOLOSCHEMA_PROPERTIES = COMMON_PROPERTIES;
|
|
765
|
+
|
|
766
|
+
export { ErrorRecovery, HOLOSCHEMA_GEOMETRIES, HOLOSCHEMA_KEYWORDS, HOLOSCHEMA_PROPERTIES, LIFECYCLE_HOOKS, STRUCTURAL_DIRECTIVES, enrichErrorWithSuggestions, generateQuickFixes };
|
|
767
|
+
//# sourceMappingURL=chunk-MPXBVFHQ.js.map
|
|
768
|
+
//# sourceMappingURL=chunk-MPXBVFHQ.js.map
|