@holoscript/core 7.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/bin/holoscript.cjs +3 -0
- package/dist/GLTFPipeline-N6B6PJ6G.cjs +38 -0
- package/dist/GLTFPipeline-P3WMNYCN.js +17 -0
- package/dist/HoloScriptPlusParser-7FBIFUFC.js +693 -0
- package/dist/HoloScriptPlusParser-A2W7OCN2.cjs +698 -0
- package/dist/HoloScriptPlusParser-F2Z56FJR.js +10 -0
- package/dist/HoloScriptPlusParser-WKHRIH6T.cjs +27 -0
- package/dist/HoloScriptRuntime-CBYJX3LZ.js +10 -0
- package/dist/HoloScriptRuntime-VJ374RER.cjs +19 -0
- package/dist/USDZExporter-3FWJ25JI.cjs +1037 -0
- package/dist/USDZExporter-D2HQLQYK.js +1035 -0
- package/dist/agents/index.cjs +19 -0
- package/dist/agents/index.d.ts +100 -0
- package/dist/agents/index.js +17 -0
- package/dist/chunk-2BSMSUCE.js +1941 -0
- package/dist/chunk-2IWC4FP7.cjs +1189 -0
- package/dist/chunk-2M2DPHKB.js +762 -0
- package/dist/chunk-2X7NGX3M.js +2426 -0
- package/dist/chunk-2YSNA2F2.cjs +1274 -0
- package/dist/chunk-3FOKASKO.cjs +348 -0
- package/dist/chunk-3WZEJHUQ.cjs +116 -0
- package/dist/chunk-4C57PR42.js +468 -0
- package/dist/chunk-4GU5GCIY.js +1384 -0
- package/dist/chunk-4N4SXXWF.js +769 -0
- package/dist/chunk-4PDEPEQW.cjs +41 -0
- package/dist/chunk-4R6SBXDB.js +45 -0
- package/dist/chunk-4SDKXQ4C.js +811 -0
- package/dist/chunk-4V2E7U7Q.cjs +2015 -0
- package/dist/chunk-5FSKKMR7.cjs +2092 -0
- package/dist/chunk-5GLCTO44.js +161 -0
- package/dist/chunk-5H2G27PK.cjs +627 -0
- package/dist/chunk-5JEU52DW.js +382 -0
- package/dist/chunk-5NWINHR5.cjs +689 -0
- package/dist/chunk-5S7RKFGR.cjs +446 -0
- package/dist/chunk-5WUNN6ZN.cjs +428 -0
- package/dist/chunk-6CTRH7HT.cjs +1985 -0
- package/dist/chunk-6EX3I5P4.cjs +130 -0
- package/dist/chunk-6Q7RC2MK.cjs +1418 -0
- package/dist/chunk-7H33U5SM.cjs +413 -0
- package/dist/chunk-7M3PNU2M.cjs +672 -0
- package/dist/chunk-7T25IEZ2.js +449 -0
- package/dist/chunk-7V4JI5TB.cjs +6947 -0
- package/dist/chunk-A6KINLZJ.js +236 -0
- package/dist/chunk-ADADVMXY.js +404 -0
- package/dist/chunk-AIA52I7T.cjs +543 -0
- package/dist/chunk-ALC6K7GL.cjs +4402 -0
- package/dist/chunk-ANXZFVY2.js +113 -0
- package/dist/chunk-AOVGZ25K.cjs +56583 -0
- package/dist/chunk-AVJHHUC5.cjs +718 -0
- package/dist/chunk-BGY3SDG3.js +4396 -0
- package/dist/chunk-BOVPWH4H.js +3857 -0
- package/dist/chunk-BRQJKJGT.cjs +20 -0
- package/dist/chunk-C37BHB7N.cjs +636 -0
- package/dist/chunk-CBJY23VL.js +126 -0
- package/dist/chunk-CCATWPXM.js +778 -0
- package/dist/chunk-CIWWXYHZ.cjs +50 -0
- package/dist/chunk-CMT5NMMS.js +669 -0
- package/dist/chunk-CR4FMIWL.cjs +1049 -0
- package/dist/chunk-CR7XRXRN.cjs +639 -0
- package/dist/chunk-CSD27UNQ.js +2176 -0
- package/dist/chunk-D3STJ56J.js +714 -0
- package/dist/chunk-DAJXW4KX.js +725 -0
- package/dist/chunk-DHO2YRIM.js +756 -0
- package/dist/chunk-DTGBOSEM.cjs +319 -0
- package/dist/chunk-E6XXE66V.js +2252 -0
- package/dist/chunk-E7JP3BS3.cjs +61 -0
- package/dist/chunk-EKBKLK7P.js +1169 -0
- package/dist/chunk-EKYL4PE3.cjs +404 -0
- package/dist/chunk-EXKSFGSX.cjs +274 -0
- package/dist/chunk-EXUP2BUM.cjs +1173 -0
- package/dist/chunk-FDSGHPAK.js +130 -0
- package/dist/chunk-FEWUHQNM.cjs +144 -0
- package/dist/chunk-FFAOS5HQ.js +70 -0
- package/dist/chunk-FGGJQRLZ.js +270 -0
- package/dist/chunk-FHP6LXJS.js +415 -0
- package/dist/chunk-FJPADH77.cjs +666 -0
- package/dist/chunk-FL33V6U7.js +421 -0
- package/dist/chunk-FYSPZT4V.cjs +169 -0
- package/dist/chunk-GIOYPNTH.js +5575 -0
- package/dist/chunk-GJNCFRJU.cjs +125 -0
- package/dist/chunk-GMP623FG.cjs +1508 -0
- package/dist/chunk-GQHQOPXZ.cjs +5580 -0
- package/dist/chunk-GTU2Z2WW.cjs +262 -0
- package/dist/chunk-GYZE55MO.js +2007 -0
- package/dist/chunk-GZG4KA4E.js +529 -0
- package/dist/chunk-H652NHX5.js +600 -0
- package/dist/chunk-HCCQLAA4.cjs +74 -0
- package/dist/chunk-HKEXJUWS.cjs +4007 -0
- package/dist/chunk-HNDK4IQU.cjs +5737 -0
- package/dist/chunk-HR2OSYVQ.js +56165 -0
- package/dist/chunk-HYNTS5CP.js +422 -0
- package/dist/chunk-I6XZ5DZF.cjs +488 -0
- package/dist/chunk-ILRBGFVD.cjs +72 -0
- package/dist/chunk-IUDGEUDO.cjs +1409 -0
- package/dist/chunk-IUTY5WQ2.cjs +424 -0
- package/dist/chunk-IVY74O6C.js +247 -0
- package/dist/chunk-IWC5DM2M.cjs +611 -0
- package/dist/chunk-J32ZJZJH.js +554 -0
- package/dist/chunk-J52VSAQ7.js +6884 -0
- package/dist/chunk-J6M4FPK5.js +421 -0
- package/dist/chunk-J7XZV333.js +844 -0
- package/dist/chunk-JBNDTXXV.cjs +2433 -0
- package/dist/chunk-JC5YBPSF.cjs +984 -0
- package/dist/chunk-JD7CIZ33.js +1949 -0
- package/dist/chunk-JIBL5LRK.js +4287 -0
- package/dist/chunk-JIYN45TV.cjs +2525 -0
- package/dist/chunk-K574J76X.cjs +457 -0
- package/dist/chunk-KHDZJE5D.cjs +2196 -0
- package/dist/chunk-KKFZ3B6J.cjs +557 -0
- package/dist/chunk-KKP7JKN4.cjs +6002 -0
- package/dist/chunk-KPJL34Y7.cjs +186 -0
- package/dist/chunk-KQCN6AKJ.cjs +3042 -0
- package/dist/chunk-L5LKKENW.cjs +424 -0
- package/dist/chunk-LHAXPADA.js +882 -0
- package/dist/chunk-LM2VU56C.cjs +37 -0
- package/dist/chunk-M56JSP4A.js +400 -0
- package/dist/chunk-MBOOR7X4.js +18 -0
- package/dist/chunk-MQWAT42R.cjs +4310 -0
- package/dist/chunk-MXFUTKCO.js +56 -0
- package/dist/chunk-MYY4PMWX.cjs +264 -0
- package/dist/chunk-N75IH2HY.js +258 -0
- package/dist/chunk-NCWCUZNS.cjs +72 -0
- package/dist/chunk-NG77ATEW.cjs +778 -0
- package/dist/chunk-NW5G5FBQ.js +215 -0
- package/dist/chunk-OBIYPYYS.cjs +1993 -0
- package/dist/chunk-OH2FAIVU.js +608 -0
- package/dist/chunk-OIQYIIO3.cjs +473 -0
- package/dist/chunk-OL46QLBJ.js +61 -0
- package/dist/chunk-OMXII44L.js +5386 -0
- package/dist/chunk-OSYNRVOV.cjs +243 -0
- package/dist/chunk-PGANYCAG.cjs +220 -0
- package/dist/chunk-PHENW4MQ.js +65 -0
- package/dist/chunk-PY37LNDP.js +686 -0
- package/dist/chunk-Q56TT7IL.js +483 -0
- package/dist/chunk-QD32ADK6.js +1046 -0
- package/dist/chunk-QPOQ7VPI.js +1491 -0
- package/dist/chunk-QPSKHBJP.js +5963 -0
- package/dist/chunk-QXH7QDSZ.js +1989 -0
- package/dist/chunk-R24NNAEG.js +1399 -0
- package/dist/chunk-R75BSDH7.cjs +50 -0
- package/dist/chunk-RARB3MBR.js +207 -0
- package/dist/chunk-ROHLEP2W.cjs +847 -0
- package/dist/chunk-S3MDHNKB.cjs +490 -0
- package/dist/chunk-S6YWHCKV.cjs +410 -0
- package/dist/chunk-SIEXCILW.js +229 -0
- package/dist/chunk-SLU6UPJI.cjs +410 -0
- package/dist/chunk-SMIWS6DE.cjs +212 -0
- package/dist/chunk-T5J7ZKP3.cjs +4885 -0
- package/dist/chunk-TDCNJHWO.js +341 -0
- package/dist/chunk-TG7O4WBC.js +406 -0
- package/dist/chunk-THCK6ECW.js +2085 -0
- package/dist/chunk-TJHVSBP2.js +439 -0
- package/dist/chunk-TVHSPJ4N.cjs +606 -0
- package/dist/chunk-TWUXUCEW.cjs +781 -0
- package/dist/chunk-U44IKGG7.cjs +5390 -0
- package/dist/chunk-UFZZ7TSN.cjs +886 -0
- package/dist/chunk-UJXISJBN.js +487 -0
- package/dist/chunk-UOIGFQXC.cjs +9750 -0
- package/dist/chunk-URG2SJLK.js +2521 -0
- package/dist/chunk-UWJHCOH2.js +623 -0
- package/dist/chunk-V6MKC2FZ.js +979 -0
- package/dist/chunk-VJ3L7CHT.cjs +169 -0
- package/dist/chunk-VMLKSV26.js +1216 -0
- package/dist/chunk-VVKVQZI6.js +55 -0
- package/dist/chunk-W6RW64BB.cjs +1219 -0
- package/dist/chunk-WKX5AMOY.js +309 -0
- package/dist/chunk-WNNE3PO3.js +34 -0
- package/dist/chunk-WRKUDAZJ.js +3038 -0
- package/dist/chunk-WRLUBRKS.cjs +1943 -0
- package/dist/chunk-WRNEH5MO.js +3169 -0
- package/dist/chunk-WRWEX5ZF.js +658 -0
- package/dist/chunk-X3GJPRVK.cjs +3246 -0
- package/dist/chunk-X3UVCWNL.cjs +2257 -0
- package/dist/chunk-XB274MW5.cjs +814 -0
- package/dist/chunk-XHIV6326.cjs +793 -0
- package/dist/chunk-XIVIE43A.cjs +729 -0
- package/dist/chunk-XJAN7CZG.cjs +432 -0
- package/dist/chunk-XKTPFXGA.js +164 -0
- package/dist/chunk-XL6INWKT.js +121 -0
- package/dist/chunk-XSFNHP2E.js +632 -0
- package/dist/chunk-XT6JY5W5.js +9684 -0
- package/dist/chunk-XUILI4KB.cjs +430 -0
- package/dist/chunk-YF2I3MV3.js +46 -0
- package/dist/chunk-YIMN575O.js +4847 -0
- package/dist/chunk-YIVFJNYV.js +176 -0
- package/dist/chunk-YKGPCZEE.cjs +237 -0
- package/dist/chunk-YN2YWTXW.js +5731 -0
- package/dist/chunk-YN6V7R3L.cjs +327 -0
- package/dist/chunk-YQELFNJV.js +39 -0
- package/dist/chunk-YVD3CSO3.js +1183 -0
- package/dist/chunk-YVOAF4ML.js +623 -0
- package/dist/chunk-YWOBW2PV.cjs +759 -0
- package/dist/chunk-YYXH45E2.js +426 -0
- package/dist/chunk-ZDSYWBIE.cjs +69 -0
- package/dist/chunk-ZU7NIRT6.js +325 -0
- package/dist/chunk-ZZ7RO2UQ.js +1243 -0
- package/dist/cli/holoscript-runner.cjs +2255 -0
- package/dist/cli/holoscript-runner.js +2230 -0
- package/dist/codebase/index.cjs +336 -0
- package/dist/codebase/index.js +331 -0
- package/dist/compiler/agent-inference.cjs +31 -0
- package/dist/compiler/agent-inference.js +8 -0
- package/dist/compiler/android-xr.cjs +24 -0
- package/dist/compiler/android-xr.js +14 -0
- package/dist/compiler/android.cjs +24 -0
- package/dist/compiler/android.js +14 -0
- package/dist/compiler/ar.cjs +23 -0
- package/dist/compiler/ar.js +11 -0
- package/dist/compiler/babylon.cjs +21 -0
- package/dist/compiler/babylon.js +15 -0
- package/dist/compiler/business-quest.cjs +43 -0
- package/dist/compiler/business-quest.js +4 -0
- package/dist/compiler/coco.cjs +27 -0
- package/dist/compiler/coco.js +4 -0
- package/dist/compiler/context.cjs +25 -0
- package/dist/compiler/context.d.ts +28 -0
- package/dist/compiler/context.js +8 -0
- package/dist/compiler/domain-block-utils.cjs +609 -0
- package/dist/compiler/domain-block-utils.js +11 -0
- package/dist/compiler/dtdl.cjs +27 -0
- package/dist/compiler/dtdl.js +11 -0
- package/dist/compiler/gltf-pipeline.cjs +39 -0
- package/dist/compiler/gltf-pipeline.js +4 -0
- package/dist/compiler/godot.cjs +18 -0
- package/dist/compiler/godot.js +12 -0
- package/dist/compiler/incremental.cjs +34 -0
- package/dist/compiler/incremental.js +9 -0
- package/dist/compiler/index.cjs +5408 -0
- package/dist/compiler/index.d.ts +334 -21
- package/dist/compiler/index.js +5069 -0
- package/dist/compiler/ios.cjs +23 -0
- package/dist/compiler/ios.js +13 -0
- package/dist/compiler/llm-provider-capabilities.cjs +25 -0
- package/dist/compiler/llm-provider-capabilities.d.ts +43 -0
- package/dist/compiler/llm-provider-capabilities.js +8 -0
- package/dist/compiler/multi-layer.cjs +24 -0
- package/dist/compiler/multi-layer.js +15 -0
- package/dist/compiler/nodetoy.cjs +23 -0
- package/dist/compiler/nodetoy.d.ts +69 -0
- package/dist/compiler/nodetoy.js +4 -0
- package/dist/compiler/openxr.cjs +19 -0
- package/dist/compiler/openxr.js +13 -0
- package/dist/compiler/playcanvas.cjs +19 -0
- package/dist/compiler/playcanvas.js +13 -0
- package/dist/compiler/r3f.cjs +39 -0
- package/dist/compiler/r3f.d.ts +22 -0
- package/dist/compiler/r3f.js +17 -0
- package/dist/compiler/remotion.cjs +23 -0
- package/dist/compiler/remotion.js +4 -0
- package/dist/compiler/reproducibility.cjs +39 -0
- package/dist/compiler/reproducibility.js +4 -0
- package/dist/compiler/sdf.cjs +24 -0
- package/dist/compiler/sdf.js +12 -0
- package/dist/compiler/semantic-scene.cjs +31 -0
- package/dist/compiler/semantic-scene.js +4 -0
- package/dist/compiler/state.cjs +21 -0
- package/dist/compiler/state.js +11 -0
- package/dist/compiler/trait-composition.cjs +30 -0
- package/dist/compiler/trait-composition.js +9 -0
- package/dist/compiler/unity.cjs +19 -0
- package/dist/compiler/unity.js +13 -0
- package/dist/compiler/unreal.cjs +23 -0
- package/dist/compiler/unreal.js +13 -0
- package/dist/compiler/urdf.cjs +52 -0
- package/dist/compiler/urdf.js +12 -0
- package/dist/compiler/usd-physics.cjs +26 -0
- package/dist/compiler/usd-physics.js +9 -0
- package/dist/compiler/visionos.cjs +19 -0
- package/dist/compiler/visionos.js +13 -0
- package/dist/compiler/vrchat.cjs +22 -0
- package/dist/compiler/vrchat.js +12 -0
- package/dist/compiler/vrr.cjs +24 -0
- package/dist/compiler/vrr.js +12 -0
- package/dist/compiler/wasm.cjs +36 -0
- package/dist/compiler/wasm.js +12 -0
- package/dist/compiler/webgpu.cjs +18 -0
- package/dist/compiler/webgpu.js +12 -0
- package/dist/coordinators/index.cjs +1266 -0
- package/dist/coordinators/index.d.ts +72 -1
- package/dist/coordinators/index.js +1259 -0
- package/dist/debugger.cjs +24 -0
- package/dist/debugger.js +11 -0
- package/dist/dist-ACXG6IH5.cjs +3113 -0
- package/dist/dist-VD4L6V7Q.js +3076 -0
- package/dist/entries/interop.cjs +64 -0
- package/dist/entries/interop.js +7 -0
- package/dist/entries/scripting.cjs +55 -0
- package/dist/entries/scripting.js +10 -0
- package/dist/hololand/index.cjs +146 -0
- package/dist/hololand/index.d.ts +70 -0
- package/dist/hololand/index.js +5 -0
- package/dist/index.cjs +44660 -0
- package/dist/index.d.ts +978 -21
- package/dist/index.js +41422 -0
- package/dist/math/tropical-spmv.cjs +45 -0
- package/dist/math/tropical-spmv.js +4 -0
- package/dist/math/vec3.cjs +57 -0
- package/dist/math/vec3.js +4 -0
- package/dist/ml-dsa-FSKBTE3W.cjs +1265 -0
- package/dist/ml-dsa-Z7JDKW4L.js +1265 -0
- package/dist/paper-0c-spike/index.cjs +150 -0
- package/dist/paper-0c-spike/index.js +141 -0
- package/dist/parser.cjs +61 -0
- package/dist/parser.d.ts +11 -0
- package/dist/parser.js +12 -0
- package/dist/playwright-3AT3AKTV.cjs +98673 -0
- package/dist/playwright-VZPDVUEQ.js +98660 -0
- package/dist/reconstruction/index.cjs +153 -0
- package/dist/reconstruction/index.d.ts +29 -2
- package/dist/reconstruction/index.js +8 -0
- package/dist/runtime.cjs +316 -0
- package/dist/runtime.d.ts +61 -0
- package/dist/runtime.js +31 -0
- package/dist/self-improvement/index.cjs +563 -0
- package/dist/self-improvement/index.js +545 -0
- package/dist/src-4ROC227P.cjs +2094 -0
- package/dist/src-HCCCSYP7.js +2073 -0
- package/dist/storage/index.cjs +38 -0
- package/dist/storage/index.js +5 -0
- package/dist/testing.cjs +25 -0
- package/dist/testing.d.ts +70 -0
- package/dist/testing.js +4 -0
- package/dist/traitDocs/traitDocs.cjs +33 -0
- package/dist/traitDocs/traitDocs.js +7 -0
- package/dist/traits/botanical-lotus.cjs +177 -0
- package/dist/traits/botanical-lotus.d.ts +502 -0
- package/dist/traits/botanical-lotus.js +7 -0
- package/dist/traits/engines/index.cjs +520 -0
- package/dist/traits/engines/index.js +380 -0
- package/dist/traits/index.cjs +24548 -0
- package/dist/traits/index.d.ts +171 -35
- package/dist/traits/index.js +21638 -0
- package/dist/traits/simulation-solver-factory.cjs +13 -0
- package/dist/traits/simulation-solver-factory.d.ts +23 -0
- package/dist/traits/simulation-solver-factory.js +4 -0
- package/dist/traits/webcam-gaze.cjs +35 -0
- package/dist/traits/webcam-gaze.d.ts +17 -0
- package/dist/traits/webcam-gaze.js +4 -0
- package/dist/type-checker.cjs +19 -0
- package/dist/type-checker.js +6 -0
- package/dist/world/index.cjs +947 -0
- package/dist/world/index.d.ts +147 -0
- package/dist/world/index.js +939 -0
- package/dist/world-model/index.cjs +1446 -0
- package/dist/world-model/index.d.ts +119 -0
- package/dist/world-model/index.js +1414 -0
- package/dist/wot/index.cjs +29 -0
- package/dist/wot/index.js +4 -0
- package/package.json +93 -49
|
@@ -0,0 +1,769 @@
|
|
|
1
|
+
import { init_constants, VR_TRAITS } from './chunk-2BSMSUCE.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
|
+
"instanced_object",
|
|
264
|
+
"group",
|
|
265
|
+
"template",
|
|
266
|
+
"state",
|
|
267
|
+
"logic",
|
|
268
|
+
"environment",
|
|
269
|
+
"timeline",
|
|
270
|
+
"zone",
|
|
271
|
+
"audio",
|
|
272
|
+
"ui_panel",
|
|
273
|
+
"ui_button",
|
|
274
|
+
"ui_text",
|
|
275
|
+
"ui_slider",
|
|
276
|
+
"ui_input",
|
|
277
|
+
"ui_image",
|
|
278
|
+
"ui_chart",
|
|
279
|
+
"import",
|
|
280
|
+
"using",
|
|
281
|
+
"action",
|
|
282
|
+
"on",
|
|
283
|
+
"if",
|
|
284
|
+
"else",
|
|
285
|
+
"for",
|
|
286
|
+
"while",
|
|
287
|
+
"animate",
|
|
288
|
+
"emit",
|
|
289
|
+
"spawn",
|
|
290
|
+
"transition"
|
|
291
|
+
];
|
|
292
|
+
var VALID_GEOMETRIES = [
|
|
293
|
+
"cube",
|
|
294
|
+
"box",
|
|
295
|
+
"sphere",
|
|
296
|
+
"cylinder",
|
|
297
|
+
"cone",
|
|
298
|
+
"torus",
|
|
299
|
+
"plane",
|
|
300
|
+
"text",
|
|
301
|
+
"model",
|
|
302
|
+
"sparkles",
|
|
303
|
+
"particles"
|
|
304
|
+
];
|
|
305
|
+
var VALID_TRAITS = [...VR_TRAITS];
|
|
306
|
+
var COMMON_PROPERTIES = [
|
|
307
|
+
"position",
|
|
308
|
+
"rotation",
|
|
309
|
+
"scale",
|
|
310
|
+
"color",
|
|
311
|
+
"material",
|
|
312
|
+
"geometry",
|
|
313
|
+
"mesh",
|
|
314
|
+
"model",
|
|
315
|
+
"src",
|
|
316
|
+
"text",
|
|
317
|
+
"content",
|
|
318
|
+
"width",
|
|
319
|
+
"height",
|
|
320
|
+
"radius",
|
|
321
|
+
"size",
|
|
322
|
+
"opacity",
|
|
323
|
+
"visible",
|
|
324
|
+
"name",
|
|
325
|
+
"id"
|
|
326
|
+
];
|
|
327
|
+
var ERROR_PATTERNS = [
|
|
328
|
+
// Missing closing brace
|
|
329
|
+
{
|
|
330
|
+
pattern: /unexpected end of input/i,
|
|
331
|
+
code: "MISSING_BRACE",
|
|
332
|
+
message: () => "Missing closing brace. Check that all { have matching }.",
|
|
333
|
+
suggestions: () => [
|
|
334
|
+
{
|
|
335
|
+
description: "Add closing brace at the end",
|
|
336
|
+
fix: "Add } to close the block"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
description: "Check for unclosed nested blocks",
|
|
340
|
+
fix: "Ensure each { has a corresponding }"
|
|
341
|
+
}
|
|
342
|
+
]
|
|
343
|
+
},
|
|
344
|
+
// Missing colon in property
|
|
345
|
+
{
|
|
346
|
+
pattern: /expected.*:/i,
|
|
347
|
+
code: "MISSING_COLON",
|
|
348
|
+
message: () => "Missing colon after property name.",
|
|
349
|
+
suggestions: () => [
|
|
350
|
+
{
|
|
351
|
+
description: "Add colon after property name",
|
|
352
|
+
fix: "propertyName: value"
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
// Unclosed string
|
|
357
|
+
{
|
|
358
|
+
pattern: /unterminated string|unexpected newline in string/i,
|
|
359
|
+
code: "MISSING_QUOTE",
|
|
360
|
+
message: () => "Unclosed string literal. Make sure strings have closing quotes.",
|
|
361
|
+
suggestions: () => [
|
|
362
|
+
{
|
|
363
|
+
description: "Add closing quote",
|
|
364
|
+
fix: `Ensure string ends with matching " or '`
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
description: "For multi-line strings, use template literals",
|
|
368
|
+
fix: "Use backticks ` for multi-line strings"
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
// Unknown keyword
|
|
373
|
+
{
|
|
374
|
+
pattern: /unexpected identifier ["']?(\w+)["']?/i,
|
|
375
|
+
code: "UNKNOWN_KEYWORD",
|
|
376
|
+
message: (match) => `Unknown keyword: ${match[1]}`,
|
|
377
|
+
suggestions: (match) => {
|
|
378
|
+
const word = match[1];
|
|
379
|
+
const similar = findSimilar(word, VALID_KEYWORDS);
|
|
380
|
+
return similar.map((s) => ({
|
|
381
|
+
description: `Did you mean '${s}'?`,
|
|
382
|
+
fix: `Replace '${word}' with '${s}'`
|
|
383
|
+
}));
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
];
|
|
387
|
+
var ErrorRecovery = class {
|
|
388
|
+
constructor() {
|
|
389
|
+
this.errors = [];
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Create an enhanced error with suggestions
|
|
393
|
+
*/
|
|
394
|
+
createError(code, message, line, column, source) {
|
|
395
|
+
const error = {
|
|
396
|
+
code,
|
|
397
|
+
message,
|
|
398
|
+
line,
|
|
399
|
+
column,
|
|
400
|
+
source,
|
|
401
|
+
suggestions: this.getSuggestions(code, message, source)
|
|
402
|
+
};
|
|
403
|
+
this.errors.push(error);
|
|
404
|
+
return error;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Get suggestions based on error type
|
|
408
|
+
*/
|
|
409
|
+
getSuggestions(code, message, _source) {
|
|
410
|
+
const suggestions = [];
|
|
411
|
+
switch (code) {
|
|
412
|
+
case "UNKNOWN_TRAIT":
|
|
413
|
+
const traitMatch = message.match(/trait.*["'](\w+)["']/i);
|
|
414
|
+
if (traitMatch) {
|
|
415
|
+
const similar = findSimilar(traitMatch[1], VALID_TRAITS);
|
|
416
|
+
suggestions.push(
|
|
417
|
+
...similar.map((s) => ({
|
|
418
|
+
description: `Did you mean '@${s}'?`,
|
|
419
|
+
fix: `Replace with @${s}`
|
|
420
|
+
}))
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
break;
|
|
424
|
+
case "UNKNOWN_GEOMETRY":
|
|
425
|
+
const geoMatch = message.match(/geometry.*["'](\w+)["']/i);
|
|
426
|
+
if (geoMatch) {
|
|
427
|
+
const similar = findSimilar(geoMatch[1], VALID_GEOMETRIES);
|
|
428
|
+
suggestions.push(
|
|
429
|
+
...similar.map((s) => ({
|
|
430
|
+
description: `Did you mean '${s}'?`,
|
|
431
|
+
fix: `geometry: "${s}"`
|
|
432
|
+
}))
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
break;
|
|
436
|
+
case "INVALID_PROPERTY":
|
|
437
|
+
const propMatch = message.match(/property.*["'](\w+)["']/i);
|
|
438
|
+
if (propMatch) {
|
|
439
|
+
const similar = findSimilar(propMatch[1], COMMON_PROPERTIES);
|
|
440
|
+
suggestions.push(
|
|
441
|
+
...similar.map((s) => ({
|
|
442
|
+
description: `Did you mean '${s}'?`,
|
|
443
|
+
fix: `${s}: value`
|
|
444
|
+
}))
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
break;
|
|
448
|
+
case "TRAIT_CONFLICT":
|
|
449
|
+
suggestions.push({
|
|
450
|
+
description: "Remove one of the conflicting traits",
|
|
451
|
+
fix: "Check trait documentation for compatibility"
|
|
452
|
+
});
|
|
453
|
+
break;
|
|
454
|
+
case "TRAIT_REQUIRES":
|
|
455
|
+
suggestions.push({
|
|
456
|
+
description: "Add the required trait",
|
|
457
|
+
fix: "Some traits depend on others (e.g., @throwable requires @grabbable)"
|
|
458
|
+
});
|
|
459
|
+
break;
|
|
460
|
+
case "MISSING_BRACE":
|
|
461
|
+
suggestions.push({
|
|
462
|
+
description: "Check for matching braces",
|
|
463
|
+
fix: "Every { must have a corresponding }"
|
|
464
|
+
});
|
|
465
|
+
break;
|
|
466
|
+
case "MISSING_COLON":
|
|
467
|
+
suggestions.push({
|
|
468
|
+
description: "Add colon after property name",
|
|
469
|
+
fix: "Format: propertyName: value"
|
|
470
|
+
});
|
|
471
|
+
break;
|
|
472
|
+
case "MISSING_QUOTE":
|
|
473
|
+
suggestions.push({
|
|
474
|
+
description: "Close the string with matching quote",
|
|
475
|
+
fix: "Strings must end with the same quote they started with"
|
|
476
|
+
});
|
|
477
|
+
break;
|
|
478
|
+
case "INVALID_VALUE":
|
|
479
|
+
suggestions.push({
|
|
480
|
+
description: "Check value type",
|
|
481
|
+
fix: 'position expects [x, y, z], color expects "#rrggbb"'
|
|
482
|
+
});
|
|
483
|
+
break;
|
|
484
|
+
case "DUPLICATE_NAME":
|
|
485
|
+
suggestions.push({
|
|
486
|
+
description: "Use unique names for objects",
|
|
487
|
+
fix: "Each object in a composition must have a unique name"
|
|
488
|
+
});
|
|
489
|
+
break;
|
|
490
|
+
case "MISSING_REQUIRED":
|
|
491
|
+
suggestions.push({
|
|
492
|
+
description: "Add required properties",
|
|
493
|
+
fix: "Some blocks require certain properties to be defined"
|
|
494
|
+
});
|
|
495
|
+
break;
|
|
496
|
+
case "UNKNOWN_KEYWORD": {
|
|
497
|
+
const kwMatch = message.match(/keyword.*[:"']?\s*(\w+)/i);
|
|
498
|
+
if (kwMatch) {
|
|
499
|
+
const similar = findSimilar(kwMatch[1], VALID_KEYWORDS);
|
|
500
|
+
suggestions.push(
|
|
501
|
+
...similar.map((s) => ({
|
|
502
|
+
description: `Did you mean '${s}'?`,
|
|
503
|
+
fix: `Replace with ${s}`
|
|
504
|
+
}))
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
if (suggestions.length === 0) {
|
|
508
|
+
suggestions.push({
|
|
509
|
+
description: "Check available keywords",
|
|
510
|
+
fix: "Valid keywords: composition, object, group, template, etc."
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
case "SYNTAX_ERROR":
|
|
516
|
+
suggestions.push({
|
|
517
|
+
description: "Check syntax around this location",
|
|
518
|
+
fix: "Verify braces, quotes, and property format"
|
|
519
|
+
});
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
return suggestions;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Analyze raw error message and enhance it
|
|
526
|
+
*/
|
|
527
|
+
analyzeError(rawMessage, source, line, column) {
|
|
528
|
+
for (const pattern of ERROR_PATTERNS) {
|
|
529
|
+
const match = rawMessage.match(pattern.pattern);
|
|
530
|
+
if (match) {
|
|
531
|
+
const context = { source, line, column };
|
|
532
|
+
return {
|
|
533
|
+
code: pattern.code,
|
|
534
|
+
message: pattern.message(match),
|
|
535
|
+
line,
|
|
536
|
+
column,
|
|
537
|
+
source,
|
|
538
|
+
suggestions: pattern.suggestions(match, context)
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return {
|
|
543
|
+
code: "SYNTAX_ERROR",
|
|
544
|
+
message: rawMessage,
|
|
545
|
+
line,
|
|
546
|
+
column,
|
|
547
|
+
source,
|
|
548
|
+
suggestions: [
|
|
549
|
+
{
|
|
550
|
+
description: "Check syntax around this location",
|
|
551
|
+
fix: "Verify braces, quotes, and property format"
|
|
552
|
+
}
|
|
553
|
+
]
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Format error for display
|
|
558
|
+
*/
|
|
559
|
+
formatError(error) {
|
|
560
|
+
const lines = [];
|
|
561
|
+
lines.push(`[${error.code}] ${error.message}`);
|
|
562
|
+
lines.push(` at line ${error.line}, column ${error.column}`);
|
|
563
|
+
if (error.source) {
|
|
564
|
+
lines.push("");
|
|
565
|
+
lines.push(` ${error.source}`);
|
|
566
|
+
lines.push(` ${" ".repeat(error.column - 1)}^`);
|
|
567
|
+
}
|
|
568
|
+
if (error.suggestions && error.suggestions.length > 0) {
|
|
569
|
+
lines.push("");
|
|
570
|
+
lines.push("Suggestions:");
|
|
571
|
+
for (const suggestion of error.suggestions) {
|
|
572
|
+
lines.push(` \u2022 ${suggestion.description}`);
|
|
573
|
+
if (suggestion.fix) {
|
|
574
|
+
lines.push(` Fix: ${suggestion.fix}`);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return lines.join("\n");
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Get all collected errors
|
|
582
|
+
*/
|
|
583
|
+
getErrors() {
|
|
584
|
+
return [...this.errors];
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Clear collected errors
|
|
588
|
+
*/
|
|
589
|
+
clear() {
|
|
590
|
+
this.errors = [];
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Check if there are any errors
|
|
594
|
+
*/
|
|
595
|
+
hasErrors() {
|
|
596
|
+
return this.errors.length > 0;
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
function findSimilar(input, candidates, maxDistance = 3) {
|
|
600
|
+
const results = [];
|
|
601
|
+
for (const candidate of candidates) {
|
|
602
|
+
const distance = levenshteinDistance(input.toLowerCase(), candidate.toLowerCase());
|
|
603
|
+
if (distance <= maxDistance) {
|
|
604
|
+
results.push({ word: candidate, distance });
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return results.sort((a, b) => a.distance - b.distance).slice(0, 3).map((r) => r.word);
|
|
608
|
+
}
|
|
609
|
+
function levenshteinDistance(a, b) {
|
|
610
|
+
const matrix = [];
|
|
611
|
+
for (let i = 0; i <= b.length; i++) {
|
|
612
|
+
matrix[i] = [i];
|
|
613
|
+
}
|
|
614
|
+
for (let j = 0; j <= a.length; j++) {
|
|
615
|
+
matrix[0][j] = j;
|
|
616
|
+
}
|
|
617
|
+
for (let i = 1; i <= b.length; i++) {
|
|
618
|
+
for (let j = 1; j <= a.length; j++) {
|
|
619
|
+
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
|
620
|
+
matrix[i][j] = matrix[i - 1][j - 1];
|
|
621
|
+
} else {
|
|
622
|
+
matrix[i][j] = Math.min(
|
|
623
|
+
matrix[i - 1][j - 1] + 1,
|
|
624
|
+
// substitution
|
|
625
|
+
matrix[i][j - 1] + 1,
|
|
626
|
+
// insertion
|
|
627
|
+
matrix[i - 1][j] + 1
|
|
628
|
+
// deletion
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return matrix[b.length][a.length];
|
|
634
|
+
}
|
|
635
|
+
function enrichErrorWithSuggestions(error, source) {
|
|
636
|
+
if (error.suggestions && error.suggestions.length > 0) {
|
|
637
|
+
return error;
|
|
638
|
+
}
|
|
639
|
+
const suggestions = [];
|
|
640
|
+
switch (error.code) {
|
|
641
|
+
case "UNKNOWN_TRAIT":
|
|
642
|
+
const traitMatch = error.message.match(/trait.*["'](\w+)["']/i);
|
|
643
|
+
if (traitMatch) {
|
|
644
|
+
const similar = findSimilar(traitMatch[1], VALID_TRAITS);
|
|
645
|
+
suggestions.push(
|
|
646
|
+
...similar.map((s) => ({
|
|
647
|
+
description: `Did you mean '@${s}'?`,
|
|
648
|
+
fix: `Replace with @${s}`
|
|
649
|
+
}))
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
break;
|
|
653
|
+
case "UNKNOWN_KEYWORD":
|
|
654
|
+
const keywordMatch = error.message.match(/keyword.*["'](\w+)["']/i);
|
|
655
|
+
if (keywordMatch) {
|
|
656
|
+
const similar = findSimilar(keywordMatch[1], VALID_KEYWORDS);
|
|
657
|
+
suggestions.push(
|
|
658
|
+
...similar.map((s) => ({
|
|
659
|
+
description: `Did you mean '${s}'?`,
|
|
660
|
+
fix: `Replace with ${s}`
|
|
661
|
+
}))
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
break;
|
|
665
|
+
case "UNKNOWN_GEOMETRY":
|
|
666
|
+
const geomMatch = error.message.match(/geometry.*["'](\w+)["']/i);
|
|
667
|
+
if (geomMatch) {
|
|
668
|
+
const similar = findSimilar(geomMatch[1], VALID_GEOMETRIES);
|
|
669
|
+
suggestions.push(
|
|
670
|
+
...similar.map((s) => ({
|
|
671
|
+
description: `Did you mean '${s}'?`,
|
|
672
|
+
fix: `Replace with ${s}`
|
|
673
|
+
}))
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
break;
|
|
677
|
+
case "MISSING_BRACE":
|
|
678
|
+
suggestions.push({
|
|
679
|
+
description: "Add closing brace at the end",
|
|
680
|
+
fix: "Add } to close the block"
|
|
681
|
+
});
|
|
682
|
+
break;
|
|
683
|
+
case "MISSING_COLON":
|
|
684
|
+
suggestions.push({
|
|
685
|
+
description: "Add colon after property name",
|
|
686
|
+
fix: "propertyName: value"
|
|
687
|
+
});
|
|
688
|
+
break;
|
|
689
|
+
case "MISSING_QUOTE":
|
|
690
|
+
suggestions.push({
|
|
691
|
+
description: "Add closing quote",
|
|
692
|
+
fix: `Ensure string ends with matching " or '`
|
|
693
|
+
});
|
|
694
|
+
break;
|
|
695
|
+
}
|
|
696
|
+
for (const pattern of ERROR_PATTERNS) {
|
|
697
|
+
const match = error.message.match(pattern.pattern);
|
|
698
|
+
if (match) {
|
|
699
|
+
const context = {
|
|
700
|
+
source,
|
|
701
|
+
line: error.line,
|
|
702
|
+
column: error.column
|
|
703
|
+
};
|
|
704
|
+
suggestions.push(...pattern.suggestions(match, context));
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
return {
|
|
709
|
+
...error,
|
|
710
|
+
suggestions: suggestions.length > 0 ? suggestions : error.suggestions
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
function generateQuickFixes(error, source) {
|
|
714
|
+
const fixes = [];
|
|
715
|
+
switch (error.code) {
|
|
716
|
+
case "MISSING_BRACE":
|
|
717
|
+
fixes.push({
|
|
718
|
+
title: "Add closing brace",
|
|
719
|
+
edit: {
|
|
720
|
+
range: { start: source.length, end: source.length },
|
|
721
|
+
newText: "\n}"
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
break;
|
|
725
|
+
case "MISSING_COLON":
|
|
726
|
+
const lineStart = getLineStart(source, error.line);
|
|
727
|
+
const lineEnd = source.indexOf("\n", lineStart);
|
|
728
|
+
const line = source.substring(lineStart, lineEnd === -1 ? void 0 : lineEnd);
|
|
729
|
+
const match = line.match(/^\s*(\w+)\s+/);
|
|
730
|
+
if (match) {
|
|
731
|
+
fixes.push({
|
|
732
|
+
title: "Add colon after property",
|
|
733
|
+
edit: {
|
|
734
|
+
range: { start: lineStart + match[0].length - 1, end: lineStart + match[0].length - 1 },
|
|
735
|
+
newText: ":"
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
break;
|
|
740
|
+
case "MISSING_QUOTE":
|
|
741
|
+
fixes.push({
|
|
742
|
+
title: "Add closing quote",
|
|
743
|
+
edit: {
|
|
744
|
+
range: { start: source.length, end: source.length },
|
|
745
|
+
newText: '"'
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
750
|
+
return fixes;
|
|
751
|
+
}
|
|
752
|
+
function getLineStart(source, lineNumber) {
|
|
753
|
+
let line = 1;
|
|
754
|
+
let pos = 0;
|
|
755
|
+
while (line < lineNumber && pos < source.length) {
|
|
756
|
+
if (source[pos] === "\n") {
|
|
757
|
+
line++;
|
|
758
|
+
}
|
|
759
|
+
pos++;
|
|
760
|
+
}
|
|
761
|
+
return pos;
|
|
762
|
+
}
|
|
763
|
+
var HOLOSCHEMA_KEYWORDS = VALID_KEYWORDS;
|
|
764
|
+
var HOLOSCHEMA_GEOMETRIES = VALID_GEOMETRIES;
|
|
765
|
+
var HOLOSCHEMA_PROPERTIES = COMMON_PROPERTIES;
|
|
766
|
+
|
|
767
|
+
export { ErrorRecovery, HOLOSCHEMA_GEOMETRIES, HOLOSCHEMA_KEYWORDS, HOLOSCHEMA_PROPERTIES, LIFECYCLE_HOOKS, STRUCTURAL_DIRECTIVES, enrichErrorWithSuggestions, generateQuickFixes };
|
|
768
|
+
//# sourceMappingURL=chunk-4N4SXXWF.js.map
|
|
769
|
+
//# sourceMappingURL=chunk-4N4SXXWF.js.map
|