@holoscript/core 6.0.4 → 6.1.2

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 (351) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -3
  3. package/bin/holoscript.cjs +3 -0
  4. package/dist/GLTFPipeline-SFIORFJU.js +16 -0
  5. package/dist/GLTFPipeline-VNNDPONV.cjs +37 -0
  6. package/dist/{HoloScriptPlusParser-BN6KVRCM.js → HoloScriptPlusParser-7FBIFUFC.js} +6 -5
  7. package/dist/{HoloScriptPlusParser-NC5FE6AL.cjs → HoloScriptPlusParser-A2W7OCN2.cjs} +17 -16
  8. package/dist/HoloScriptPlusParser-F2Z56FJR.js +10 -0
  9. package/dist/HoloScriptPlusParser-WKHRIH6T.cjs +27 -0
  10. package/dist/{USDZExporter-UWGWNMMD.cjs → USDZExporter-3FWJ25JI.cjs} +344 -16
  11. package/dist/{USDZExporter-NTMBNTDB.js → USDZExporter-D2HQLQYK.js} +344 -16
  12. package/dist/agents/index.cjs +19 -0
  13. package/dist/agents/index.d.ts +100 -0
  14. package/dist/agents/index.js +17 -0
  15. package/dist/chunk-22W6NGYN.js +725 -0
  16. package/dist/{chunk-5OEOHAAW.cjs → chunk-27MPVJVZ.cjs} +64 -28
  17. package/dist/{chunk-RVYPEYPX.js → chunk-2A7FURVO.js} +44 -8
  18. package/dist/{chunk-XCWFGZAA.js → chunk-2B7WVIDZ.js} +11 -8
  19. package/dist/{chunk-NDQNIJEH.js → chunk-2BSMSUCE.js} +250 -24
  20. package/dist/chunk-2HLIGOKU.cjs +5546 -0
  21. package/dist/{chunk-EONILVMF.js → chunk-2M2DPHKB.js} +4 -4
  22. package/dist/{chunk-G7CT3EMP.cjs → chunk-2YSNA2F2.cjs} +319 -47
  23. package/dist/{chunk-IWI6J7FX.js → chunk-33XCOVE3.js} +5 -5
  24. package/dist/chunk-3FOKASKO.cjs +348 -0
  25. package/dist/{chunk-DXJQDCFL.js → chunk-4C57PR42.js} +3 -3
  26. package/dist/{chunk-MPXBVFHQ.js → chunk-4N4SXXWF.js} +4 -3
  27. package/dist/chunk-4PDEPEQW.cjs +41 -0
  28. package/dist/chunk-4R6HPSHJ.js +2176 -0
  29. package/dist/chunk-4R6SBXDB.js +45 -0
  30. package/dist/chunk-4SY77NA4.cjs +413 -0
  31. package/dist/{chunk-YCXFCXDS.js → chunk-4UUKPCY4.js} +668 -110
  32. package/dist/{chunk-LGGRPKTV.cjs → chunk-52ULD552.cjs} +114 -35
  33. package/dist/{chunk-L4G4RLXX.js → chunk-5CKA5SXU.js} +438 -22
  34. package/dist/chunk-5FSKKMR7.cjs +2092 -0
  35. package/dist/{chunk-FF3Q7ADR.js → chunk-5JEU52DW.js} +5 -3
  36. package/dist/chunk-5N54COB6.cjs +327 -0
  37. package/dist/chunk-5S7RKFGR.cjs +446 -0
  38. package/dist/{chunk-KED34ILP.js → chunk-6ASWLXXN.js} +21 -9
  39. package/dist/chunk-6CTRH7HT.cjs +1985 -0
  40. package/dist/{chunk-CAUCGUEA.cjs → chunk-6EX3I5P4.cjs} +6 -6
  41. package/dist/chunk-6FGQNDR4.js +5731 -0
  42. package/dist/{chunk-72EQECGT.cjs → chunk-6KMK2UXT.cjs} +122 -46
  43. package/dist/{chunk-G4VZTCIB.js → chunk-6L4VE27M.js} +33 -23
  44. package/dist/{chunk-ATSKSYVE.cjs → chunk-6S6TKNEA.cjs} +6478 -1738
  45. package/dist/chunk-77V4GTCA.js +596 -0
  46. package/dist/{chunk-ZP4D3CSX.cjs → chunk-7AD52FRS.cjs} +16 -16
  47. package/dist/chunk-A6KINLZJ.js +236 -0
  48. package/dist/chunk-AIA52I7T.cjs +543 -0
  49. package/dist/chunk-AIX25INK.cjs +602 -0
  50. package/dist/{chunk-B5TCIAPQ.cjs → chunk-AO4I2Z7M.cjs} +17 -18
  51. package/dist/{chunk-Q5SJOGHQ.cjs → chunk-BPICAGBV.cjs} +324 -199
  52. package/dist/chunk-BRQJKJGT.cjs +20 -0
  53. package/dist/{chunk-3FXV5S25.cjs → chunk-C37BHB7N.cjs} +6 -3
  54. package/dist/{chunk-XUTX5CBW.js → chunk-CBJY23VL.js} +3 -3
  55. package/dist/chunk-CIWWXYHZ.cjs +50 -0
  56. package/dist/{chunk-XXINBTZK.cjs → chunk-DIL6DDDN.cjs} +101 -45
  57. package/dist/chunk-DMXC24WV.js +404 -0
  58. package/dist/{chunk-PMGODDJA.cjs → chunk-DTGBOSEM.cjs} +12 -12
  59. package/dist/chunk-E7JP3BS3.cjs +61 -0
  60. package/dist/{chunk-HJJLD366.js → chunk-EKBKLK7P.js} +3 -3
  61. package/dist/chunk-EKYL4PE3.cjs +404 -0
  62. package/dist/{chunk-UPJBDCVF.js → chunk-EMMC5CSQ.js} +12 -8
  63. package/dist/{chunk-GGHSW2NN.js → chunk-EOBB6A4B.js} +6389 -1718
  64. package/dist/chunk-EOFNVCM6.js +325 -0
  65. package/dist/{chunk-FHQVYCH2.js → chunk-ER4GATIU.js} +7 -7
  66. package/dist/{chunk-N5FTS757.cjs → chunk-EXKSFGSX.cjs} +7 -148
  67. package/dist/{chunk-LK5IAVH6.cjs → chunk-EXUP2BUM.cjs} +27 -27
  68. package/dist/chunk-FDSGHPAK.js +130 -0
  69. package/dist/chunk-FEWUHQNM.cjs +144 -0
  70. package/dist/{chunk-5TOFIR6L.js → chunk-FGGJQRLZ.js} +5 -142
  71. package/dist/chunk-FHP6LXJS.js +415 -0
  72. package/dist/{chunk-7LCYLPW2.cjs → chunk-FJPADH77.cjs} +7 -4
  73. package/dist/{chunk-T36DDXSF.js → chunk-FXKTYFYA.js} +150 -25
  74. package/dist/chunk-G2LS3RFO.js +623 -0
  75. package/dist/chunk-GCMWDSBZ.cjs +729 -0
  76. package/dist/chunk-GJNCFRJU.cjs +125 -0
  77. package/dist/{chunk-Q4QX3AET.cjs → chunk-GMP623FG.cjs} +16 -13
  78. package/dist/{chunk-XD6IYDUX.js → chunk-GN3KDX4W.js} +119 -43
  79. package/dist/{chunk-QLEAOI3Q.cjs → chunk-GQYKQSTC.cjs} +10 -10
  80. package/dist/chunk-GTU2Z2WW.cjs +262 -0
  81. package/dist/chunk-GZG4KA4E.js +529 -0
  82. package/dist/{chunk-BND3ST2K.cjs → chunk-H3MGK7TX.cjs} +42 -32
  83. package/dist/{chunk-XRKWN5PL.cjs → chunk-H5DZIHJP.cjs} +14 -18
  84. package/dist/{chunk-Z34RLXRA.cjs → chunk-HANL7K2Q.cjs} +65 -50
  85. package/dist/{chunk-3SAK5KFL.cjs → chunk-HCCQLAA4.cjs} +2 -11
  86. package/dist/{chunk-LXJ4667L.cjs → chunk-HGVXZDSK.cjs} +108 -20
  87. package/dist/{chunk-3FJCK5XA.js → chunk-HRODTEEO.js} +30 -10
  88. package/dist/{chunk-HQUEA5R6.cjs → chunk-HZCQO4JM.cjs} +6 -6
  89. package/dist/{chunk-S565K7NK.js → chunk-I2O7TW6B.js} +12 -8
  90. package/dist/chunk-IHESJZSW.js +4490 -0
  91. package/dist/{chunk-FSF7EQVA.cjs → chunk-IRWWS72C.cjs} +63 -22
  92. package/dist/{chunk-5O6TQC6M.cjs → chunk-IVIA7K75.cjs} +689 -127
  93. package/dist/chunk-IVY74O6C.js +247 -0
  94. package/dist/chunk-J32ZJZJH.js +554 -0
  95. package/dist/chunk-J56PTA46.cjs +639 -0
  96. package/dist/chunk-JD7CIZ33.js +1949 -0
  97. package/dist/{chunk-T7LEXZUZ.cjs → chunk-JIYN45TV.cjs} +14 -15
  98. package/dist/{chunk-FFKU7BTK.cjs → chunk-KHPCJRI3.cjs} +24 -21
  99. package/dist/chunk-KKFZ3B6J.cjs +557 -0
  100. package/dist/chunk-KPJL34Y7.cjs +186 -0
  101. package/dist/{chunk-HE7ULERA.cjs → chunk-KQTPCYTG.cjs} +128 -44
  102. package/dist/{chunk-OFKWH2IP.js → chunk-KX76JUQY.js} +3 -3
  103. package/dist/{chunk-33LSUQDD.cjs → chunk-L63H3SQ4.cjs} +43 -31
  104. package/dist/{chunk-K6EKD26I.js → chunk-LAOCQJ2M.js} +64 -8
  105. package/dist/chunk-LM2VU56C.cjs +37 -0
  106. package/dist/chunk-M56JSP4A.js +400 -0
  107. package/dist/chunk-MBOOR7X4.js +18 -0
  108. package/dist/{chunk-XWPNTWDN.cjs → chunk-MJVIRCUV.cjs} +31 -27
  109. package/dist/{chunk-SDAMZIRE.js → chunk-MSMIFMBL.js} +135 -18
  110. package/dist/{chunk-56IF4NTA.js → chunk-MXFUTKCO.js} +18 -18
  111. package/dist/{chunk-6UEHYZ7V.cjs → chunk-MXJ5SS53.cjs} +447 -31
  112. package/dist/chunk-MYY4PMWX.cjs +264 -0
  113. package/dist/chunk-N75IH2HY.js +258 -0
  114. package/dist/{chunk-GVUR45UF.cjs → chunk-NG77ATEW.cjs} +7 -6
  115. package/dist/chunk-NW5G5FBQ.js +215 -0
  116. package/dist/{chunk-E3FWRT3Z.js → chunk-OEFY723R.js} +28 -13
  117. package/dist/chunk-OEV5RMZO.cjs +3042 -0
  118. package/dist/{chunk-X4ZF6CNE.cjs → chunk-OIQYIIO3.cjs} +7 -7
  119. package/dist/{chunk-2CWOLHTE.js → chunk-OL46QLBJ.js} +3 -11
  120. package/dist/chunk-OPZ7XDDI.js +487 -0
  121. package/dist/chunk-OSYNRVOV.cjs +243 -0
  122. package/dist/{chunk-TEWCN33Y.js → chunk-P7YIA5LN.js} +91 -7
  123. package/dist/chunk-PGANYCAG.cjs +220 -0
  124. package/dist/{chunk-CS2EMTGF.js → chunk-QAVXL2IH.js} +62 -21
  125. package/dist/{chunk-T4NKMBDL.js → chunk-QCCBXSCE.js} +1666 -756
  126. package/dist/{chunk-F4IULT7N.js → chunk-QPOQ7VPI.js} +16 -13
  127. package/dist/{chunk-6XSERL6L.js → chunk-QTPMJRGS.js} +3108 -2827
  128. package/dist/{chunk-F3HH56EB.cjs → chunk-QWNQ523V.cjs} +1730 -823
  129. package/dist/{chunk-R7MA7QWV.js → chunk-R3IVNY6P.js} +102 -23
  130. package/dist/chunk-R75BSDH7.cjs +50 -0
  131. package/dist/chunk-RAXUF5DF.cjs +2196 -0
  132. package/dist/{chunk-BF2235SI.cjs → chunk-RMHC2VG7.cjs} +2876 -2592
  133. package/dist/chunk-RUXGBKPS.cjs +4517 -0
  134. package/dist/{chunk-UERJ3YJV.js → chunk-S5IFXW6E.js} +113 -9
  135. package/dist/{chunk-27LWW5FU.cjs → chunk-S6YWHCKV.cjs} +5 -5
  136. package/dist/{chunk-WB4Z63GG.js → chunk-SIEXCILW.js} +3 -3
  137. package/dist/{chunk-CLYEIWA5.cjs → chunk-SLU6UPJI.cjs} +5 -3
  138. package/dist/{chunk-LZ266PCM.cjs → chunk-T5J7ZKP3.cjs} +446 -60
  139. package/dist/chunk-TDCNJHWO.js +341 -0
  140. package/dist/{chunk-IHOUYQIA.js → chunk-TG7O4WBC.js} +5 -5
  141. package/dist/chunk-THCK6ECW.js +2085 -0
  142. package/dist/chunk-TJHVSBP2.js +439 -0
  143. package/dist/chunk-TK74TR4H.js +5541 -0
  144. package/dist/{chunk-CDPGV4DN.js → chunk-U4NBQJBY.js} +14 -15
  145. package/dist/{chunk-NOZZ46QU.js → chunk-UD3DSHZM.js} +10 -14
  146. package/dist/chunk-UDMYRFDZ.js +3038 -0
  147. package/dist/{chunk-WDW67DZB.cjs → chunk-UOIGFQXC.cjs} +90 -68
  148. package/dist/{chunk-BU7VWW2K.js → chunk-URG2SJLK.js} +14 -15
  149. package/dist/{chunk-EQV4R3EV.cjs → chunk-V73NPPTM.cjs} +152 -35
  150. package/dist/chunk-VECQYRXL.js +474 -0
  151. package/dist/chunk-VEXPG4WN.js +1989 -0
  152. package/dist/{chunk-LDP5OK6G.js → chunk-VMLKSV26.js} +5 -5
  153. package/dist/{chunk-5BGSECRJ.cjs → chunk-VSK7W3O5.cjs} +47 -27
  154. package/dist/chunk-VVKVQZI6.js +55 -0
  155. package/dist/{chunk-YQK5JNFK.js → chunk-W55Z7QIX.js} +103 -15
  156. package/dist/{chunk-KSGXLT74.cjs → chunk-W6P2GBHH.cjs} +3 -3
  157. package/dist/{chunk-IBDG74G2.cjs → chunk-W6RW64BB.cjs} +7 -7
  158. package/dist/chunk-WDT3JTGM.cjs +483 -0
  159. package/dist/{chunk-HPS76H7Q.js → chunk-WKX5AMOY.js} +3 -3
  160. package/dist/chunk-WNNE3PO3.js +34 -0
  161. package/dist/{chunk-XG23EUQX.cjs → chunk-WRLUBRKS.cjs} +538 -312
  162. package/dist/{chunk-IFNQFCTM.js → chunk-WRNEH5MO.js} +79 -8
  163. package/dist/{chunk-54FHG2MX.js → chunk-WRWEX5ZF.js} +7 -4
  164. package/dist/{chunk-KCQ5NDYC.cjs → chunk-X3GJPRVK.cjs} +154 -80
  165. package/dist/{chunk-7AGYRWKW.cjs → chunk-XFXGA5IW.cjs} +126 -22
  166. package/dist/{chunk-TQSZUOW5.cjs → chunk-XHIV6326.cjs} +4 -4
  167. package/dist/chunk-XJAN7CZG.cjs +432 -0
  168. package/dist/chunk-XL6INWKT.js +121 -0
  169. package/dist/{chunk-E3UALNFA.js → chunk-XMWZG36H.js} +4 -4
  170. package/dist/{chunk-BKIGPPVM.js → chunk-XSFNHP2E.js} +6 -3
  171. package/dist/{chunk-H5Z7NASB.js → chunk-XT6JY5W5.js} +25 -3
  172. package/dist/chunk-XXZJEFKW.cjs +490 -0
  173. package/dist/chunk-Y3MWXQSB.cjs +5737 -0
  174. package/dist/chunk-YF2I3MV3.js +46 -0
  175. package/dist/{chunk-V3NN3HPP.js → chunk-YIMN575O.js} +437 -52
  176. package/dist/chunk-YIVFJNYV.js +176 -0
  177. package/dist/{chunk-MD6KDHVE.cjs → chunk-YKGPCZEE.cjs} +10 -10
  178. package/dist/chunk-YQELFNJV.js +39 -0
  179. package/dist/chunk-Z5XMPRNC.cjs +5390 -0
  180. package/dist/{chunk-3FYZOR7S.cjs → chunk-ZDSYWBIE.cjs} +18 -18
  181. package/dist/{chunk-6TZPZCOJ.cjs → chunk-ZKSS47EV.cjs} +24 -19
  182. package/dist/chunk-ZUL5AVTX.cjs +1993 -0
  183. package/dist/chunk-ZXBZVXDW.js +5386 -0
  184. package/dist/{chunk-DMG7C4H2.js → chunk-ZZ7RO2UQ.js} +312 -44
  185. package/dist/cli/holoscript-runner.cjs +200 -204
  186. package/dist/cli/holoscript-runner.js +144 -148
  187. package/dist/codebase/index.cjs +1 -1
  188. package/dist/codebase/index.js +1 -1
  189. package/dist/compiler/agent-inference.cjs +10 -7
  190. package/dist/compiler/agent-inference.js +6 -3
  191. package/dist/compiler/android-xr.cjs +12 -7
  192. package/dist/compiler/android-xr.js +10 -5
  193. package/dist/compiler/android.cjs +12 -8
  194. package/dist/compiler/android.js +10 -6
  195. package/dist/compiler/ar.cjs +9 -6
  196. package/dist/compiler/ar.js +7 -4
  197. package/dist/compiler/babylon.cjs +12 -8
  198. package/dist/compiler/babylon.js +11 -7
  199. package/dist/compiler/business-quest.cjs +43 -0
  200. package/dist/compiler/business-quest.js +4 -0
  201. package/dist/compiler/coco.cjs +1 -1
  202. package/dist/compiler/coco.js +1 -1
  203. package/dist/compiler/context.cjs +25 -0
  204. package/dist/compiler/context.d.ts +28 -0
  205. package/dist/compiler/context.js +8 -0
  206. package/dist/compiler/domain-block-utils.cjs +155 -152
  207. package/dist/compiler/domain-block-utils.js +7 -4
  208. package/dist/compiler/dtdl.cjs +10 -7
  209. package/dist/compiler/dtdl.js +7 -4
  210. package/dist/compiler/gltf-pipeline.cjs +9 -9
  211. package/dist/compiler/gltf-pipeline.js +2 -2
  212. package/dist/compiler/godot.cjs +9 -6
  213. package/dist/compiler/godot.js +8 -5
  214. package/dist/compiler/incremental.cjs +12 -7
  215. package/dist/compiler/incremental.js +7 -2
  216. package/dist/compiler/index.cjs +3550 -268
  217. package/dist/compiler/index.d.ts +404 -21
  218. package/dist/compiler/index.js +3280 -138
  219. package/dist/compiler/ios.cjs +11 -8
  220. package/dist/compiler/ios.js +9 -6
  221. package/dist/compiler/llm-provider-capabilities.cjs +25 -0
  222. package/dist/compiler/llm-provider-capabilities.d.ts +43 -0
  223. package/dist/compiler/llm-provider-capabilities.js +8 -0
  224. package/dist/compiler/multi-layer.cjs +14 -10
  225. package/dist/compiler/multi-layer.js +13 -9
  226. package/dist/compiler/nodetoy.cjs +5 -5
  227. package/dist/compiler/nodetoy.js +2 -2
  228. package/dist/compiler/openxr.cjs +10 -6
  229. package/dist/compiler/openxr.js +9 -5
  230. package/dist/compiler/playcanvas.cjs +10 -7
  231. package/dist/compiler/playcanvas.js +9 -6
  232. package/dist/compiler/r3f.cjs +17 -13
  233. package/dist/compiler/r3f.d.ts +22 -0
  234. package/dist/compiler/r3f.js +12 -8
  235. package/dist/compiler/remotion.cjs +1 -1
  236. package/dist/compiler/remotion.js +1 -1
  237. package/dist/compiler/reproducibility.cjs +1 -1
  238. package/dist/compiler/reproducibility.js +1 -1
  239. package/dist/compiler/sdf.cjs +10 -7
  240. package/dist/compiler/sdf.js +8 -5
  241. package/dist/compiler/semantic-scene.cjs +1 -1
  242. package/dist/compiler/semantic-scene.js +1 -1
  243. package/dist/compiler/state.cjs +9 -5
  244. package/dist/compiler/state.js +7 -3
  245. package/dist/compiler/trait-composition.cjs +11 -7
  246. package/dist/compiler/trait-composition.js +7 -3
  247. package/dist/compiler/unity.cjs +10 -6
  248. package/dist/compiler/unity.js +9 -5
  249. package/dist/compiler/unreal.cjs +11 -7
  250. package/dist/compiler/unreal.js +9 -5
  251. package/dist/compiler/urdf.cjs +20 -13
  252. package/dist/compiler/urdf.js +8 -5
  253. package/dist/compiler/usd-physics.cjs +10 -7
  254. package/dist/compiler/usd-physics.js +7 -4
  255. package/dist/compiler/visionos.cjs +10 -6
  256. package/dist/compiler/visionos.js +9 -5
  257. package/dist/compiler/vrchat.cjs +10 -7
  258. package/dist/compiler/vrchat.js +8 -5
  259. package/dist/compiler/vrr.cjs +10 -7
  260. package/dist/compiler/vrr.js +8 -5
  261. package/dist/compiler/wasm.cjs +13 -10
  262. package/dist/compiler/wasm.js +8 -5
  263. package/dist/compiler/webgpu.cjs +9 -6
  264. package/dist/compiler/webgpu.js +8 -5
  265. package/dist/constants.d.ts +3 -2
  266. package/dist/coordinators/index.cjs +1266 -0
  267. package/dist/coordinators/index.d.ts +260 -0
  268. package/dist/coordinators/index.js +1259 -0
  269. package/dist/debugger.cjs +9 -7
  270. package/dist/debugger.js +7 -5
  271. package/dist/entries/interop.cjs +23 -21
  272. package/dist/entries/interop.js +5 -3
  273. package/dist/entries/scripting.cjs +18 -18
  274. package/dist/entries/scripting.js +8 -8
  275. package/dist/hololand/index.cjs +146 -0
  276. package/dist/hololand/index.d.ts +70 -0
  277. package/dist/hololand/index.js +5 -0
  278. package/dist/index.cjs +20332 -18121
  279. package/dist/index.d.ts +1477 -40
  280. package/dist/index.js +19451 -17638
  281. package/dist/math/tropical-spmv.cjs +45 -0
  282. package/dist/math/tropical-spmv.js +4 -0
  283. package/dist/math/vec3.cjs +14 -14
  284. package/dist/math/vec3.js +2 -2
  285. package/dist/{ml-dsa-PHCWUBPX.cjs → ml-dsa-FSKBTE3W.cjs} +177 -90
  286. package/dist/{ml-dsa-WYLJHJO6.js → ml-dsa-Z7JDKW4L.js} +158 -71
  287. package/dist/paper-0c-spike/index.cjs +150 -0
  288. package/dist/paper-0c-spike/index.d.ts +29 -0
  289. package/dist/paper-0c-spike/index.js +141 -0
  290. package/dist/parser.cjs +45 -11
  291. package/dist/parser.d.ts +11 -0
  292. package/dist/parser.js +10 -8
  293. package/dist/{playwright-RL6GY4F7.cjs → playwright-3AT3AKTV.cjs} +1985 -1985
  294. package/dist/{playwright-5OSAPTNH.js → playwright-VZPDVUEQ.js} +3 -3
  295. package/dist/reconstruction/index.cjs +153 -0
  296. package/dist/reconstruction/index.d.ts +105 -0
  297. package/dist/reconstruction/index.js +8 -0
  298. package/dist/runtime.cjs +7 -5
  299. package/dist/runtime.js +6 -4
  300. package/dist/self-improvement/index.cjs +563 -0
  301. package/dist/self-improvement/index.js +545 -0
  302. package/dist/storage/index.cjs +10 -9
  303. package/dist/storage/index.js +3 -2
  304. package/dist/testing.cjs +25 -0
  305. package/dist/testing.d.ts +70 -0
  306. package/dist/testing.js +4 -0
  307. package/dist/tools/index.d.ts +22 -1
  308. package/dist/traitDocs/traitDocs.cjs +33 -0
  309. package/dist/traitDocs/traitDocs.d.ts +69 -0
  310. package/dist/traitDocs/traitDocs.js +7 -0
  311. package/dist/traits/botanical-lotus.cjs +41 -0
  312. package/dist/traits/botanical-lotus.d.ts +172 -0
  313. package/dist/traits/botanical-lotus.js +4 -0
  314. package/dist/traits/engines/index.cjs +520 -0
  315. package/dist/traits/engines/index.js +380 -0
  316. package/dist/traits/index.cjs +17630 -7881
  317. package/dist/traits/index.d.ts +197 -0
  318. package/dist/traits/index.js +16573 -7193
  319. package/dist/traits/simulation-solver-factory.cjs +13 -0
  320. package/dist/traits/simulation-solver-factory.d.ts +23 -0
  321. package/dist/traits/simulation-solver-factory.js +4 -0
  322. package/dist/traits/webcam-gaze.cjs +35 -0
  323. package/dist/traits/webcam-gaze.d.ts +17 -0
  324. package/dist/traits/webcam-gaze.js +4 -0
  325. package/dist/type-checker.cjs +6 -5
  326. package/dist/type-checker.js +4 -3
  327. package/dist/world/index.cjs +947 -0
  328. package/dist/world/index.d.ts +147 -0
  329. package/dist/world/index.js +939 -0
  330. package/dist/world-model/index.cjs +1446 -0
  331. package/dist/world-model/index.d.ts +119 -0
  332. package/dist/world-model/index.js +1414 -0
  333. package/dist/wot/index.cjs +29 -0
  334. package/dist/wot/index.js +4 -0
  335. package/package.json +153 -61
  336. package/dist/GLTFPipeline-DEN36VNK.js +0 -12
  337. package/dist/GLTFPipeline-YPCAK236.cjs +0 -33
  338. package/dist/chunk-4XSNJCLC.cjs +0 -1859
  339. package/dist/chunk-A7PIMZGU.js +0 -263
  340. package/dist/chunk-BWFJEM5A.js +0 -5419
  341. package/dist/chunk-CBJSLA2E.cjs +0 -5423
  342. package/dist/chunk-K3JDKWGI.cjs +0 -270
  343. package/dist/chunk-LSW7P7ML.js +0 -3675
  344. package/dist/chunk-MEASWI2Y.js +0 -126
  345. package/dist/chunk-NCUKG4SK.cjs +0 -3075
  346. package/dist/chunk-Q5JT3YML.cjs +0 -129
  347. package/dist/chunk-QGKNANZ3.js +0 -3071
  348. package/dist/chunk-S2N5TNMA.js +0 -1855
  349. package/dist/chunk-TSH3MSQU.cjs +0 -129
  350. package/dist/chunk-WGMEAYBG.js +0 -126
  351. package/dist/chunk-X6SEAXAX.cjs +0 -3681
@@ -1,61 +1,86 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkVJ3L7CHT_cjs = require('../chunk-VJ3L7CHT.cjs');
4
- var chunkKSGXLT74_cjs = require('../chunk-KSGXLT74.cjs');
5
- var chunk27LWW5FU_cjs = require('../chunk-27LWW5FU.cjs');
6
- var chunkF3HH56EB_cjs = require('../chunk-F3HH56EB.cjs');
7
- var chunkLK5IAVH6_cjs = require('../chunk-LK5IAVH6.cjs');
8
- var chunkXUILI4KB_cjs = require('../chunk-XUILI4KB.cjs');
4
+ var chunkZUL5AVTX_cjs = require('../chunk-ZUL5AVTX.cjs');
5
+ var chunkGCMWDSBZ_cjs = require('../chunk-GCMWDSBZ.cjs');
6
+ var chunkW6P2GBHH_cjs = require('../chunk-W6P2GBHH.cjs');
7
+ var chunk4SY77NA4_cjs = require('../chunk-4SY77NA4.cjs');
8
+ var chunkS6YWHCKV_cjs = require('../chunk-S6YWHCKV.cjs');
9
+ var chunk5N54COB6_cjs = require('../chunk-5N54COB6.cjs');
10
+ var chunkQWNQ523V_cjs = require('../chunk-QWNQ523V.cjs');
11
+ var chunkEXUP2BUM_cjs = require('../chunk-EXUP2BUM.cjs');
9
12
  var chunk5WUNN6ZN_cjs = require('../chunk-5WUNN6ZN.cjs');
10
- require('../chunk-72EQECGT.cjs');
13
+ require('../chunk-6KMK2UXT.cjs');
14
+ var chunkBRQJKJGT_cjs = require('../chunk-BRQJKJGT.cjs');
11
15
  var chunkI6XZ5DZF_cjs = require('../chunk-I6XZ5DZF.cjs');
12
- var chunkQLEAOI3Q_cjs = require('../chunk-QLEAOI3Q.cjs');
13
- var chunk6TZPZCOJ_cjs = require('../chunk-6TZPZCOJ.cjs');
14
- var chunkEQV4R3EV_cjs = require('../chunk-EQV4R3EV.cjs');
15
- var chunk7AGYRWKW_cjs = require('../chunk-7AGYRWKW.cjs');
16
- var chunkB5TCIAPQ_cjs = require('../chunk-B5TCIAPQ.cjs');
17
- var chunkXRKWN5PL_cjs = require('../chunk-XRKWN5PL.cjs');
18
- var chunkFSF7EQVA_cjs = require('../chunk-FSF7EQVA.cjs');
19
- var chunkQ5SJOGHQ_cjs = require('../chunk-Q5SJOGHQ.cjs');
20
- require('../chunk-WDW67DZB.cjs');
21
- var chunkXWPNTWDN_cjs = require('../chunk-XWPNTWDN.cjs');
22
- var chunkNCUKG4SK_cjs = require('../chunk-NCUKG4SK.cjs');
23
- var chunk4XSNJCLC_cjs = require('../chunk-4XSNJCLC.cjs');
24
- var chunkCBJSLA2E_cjs = require('../chunk-CBJSLA2E.cjs');
25
- var chunk5O6TQC6M_cjs = require('../chunk-5O6TQC6M.cjs');
26
- var chunk6UEHYZ7V_cjs = require('../chunk-6UEHYZ7V.cjs');
27
- var chunkBND3ST2K_cjs = require('../chunk-BND3ST2K.cjs');
28
- var chunkZP4D3CSX_cjs = require('../chunk-ZP4D3CSX.cjs');
29
- var chunkQ5JT3YML_cjs = require('../chunk-Q5JT3YML.cjs');
30
- var chunkFFKU7BTK_cjs = require('../chunk-FFKU7BTK.cjs');
31
- var chunkZ34RLXRA_cjs = require('../chunk-Z34RLXRA.cjs');
32
- var chunk33LSUQDD_cjs = require('../chunk-33LSUQDD.cjs');
33
- require('../chunk-K3JDKWGI.cjs');
34
- require('../chunk-X4ZF6CNE.cjs');
35
- var chunkHE7ULERA_cjs = require('../chunk-HE7ULERA.cjs');
36
- var chunk5OEOHAAW_cjs = require('../chunk-5OEOHAAW.cjs');
37
- var chunkXXINBTZK_cjs = require('../chunk-XXINBTZK.cjs');
38
- require('../chunk-3FYZOR7S.cjs');
39
- var chunkXG23EUQX_cjs = require('../chunk-XG23EUQX.cjs');
40
- require('../chunk-KCQ5NDYC.cjs');
41
- require('../chunk-PMGODDJA.cjs');
42
- require('../chunk-MD6KDHVE.cjs');
43
- require('../chunk-CAUCGUEA.cjs');
44
- var chunkLGGRPKTV_cjs = require('../chunk-LGGRPKTV.cjs');
45
- require('../chunk-LXJ4667L.cjs');
46
- var chunkBF2235SI_cjs = require('../chunk-BF2235SI.cjs');
47
- var chunk3SAK5KFL_cjs = require('../chunk-3SAK5KFL.cjs');
16
+ var chunkXUILI4KB_cjs = require('../chunk-XUILI4KB.cjs');
17
+ var chunk6S6TKNEA_cjs = require('../chunk-6S6TKNEA.cjs');
18
+ require('../chunk-GMP623FG.cjs');
19
+ var chunkCIWWXYHZ_cjs = require('../chunk-CIWWXYHZ.cjs');
20
+ require('../chunk-3FOKASKO.cjs');
21
+ require('../chunk-WDT3JTGM.cjs');
22
+ require('../chunk-4PDEPEQW.cjs');
23
+ require('../chunk-XJAN7CZG.cjs');
24
+ var chunkIRWWS72C_cjs = require('../chunk-IRWWS72C.cjs');
25
+ require('../chunk-XHIV6326.cjs');
26
+ require('../chunk-R75BSDH7.cjs');
27
+ var chunkMXJ5SS53_cjs = require('../chunk-MXJ5SS53.cjs');
28
+ var chunkH3MGK7TX_cjs = require('../chunk-H3MGK7TX.cjs');
29
+ var chunkGQYKQSTC_cjs = require('../chunk-GQYKQSTC.cjs');
30
+ var chunkZKSS47EV_cjs = require('../chunk-ZKSS47EV.cjs');
31
+ var chunkV73NPPTM_cjs = require('../chunk-V73NPPTM.cjs');
32
+ var chunkXFXGA5IW_cjs = require('../chunk-XFXGA5IW.cjs');
33
+ var chunkAO4I2Z7M_cjs = require('../chunk-AO4I2Z7M.cjs');
34
+ var chunkH5DZIHJP_cjs = require('../chunk-H5DZIHJP.cjs');
35
+ var chunk27MPVJVZ_cjs = require('../chunk-27MPVJVZ.cjs');
36
+ var chunkDIL6DDDN_cjs = require('../chunk-DIL6DDDN.cjs');
37
+ var chunkBPICAGBV_cjs = require('../chunk-BPICAGBV.cjs');
38
+ require('../chunk-UOIGFQXC.cjs');
39
+ var chunkMJVIRCUV_cjs = require('../chunk-MJVIRCUV.cjs');
40
+ var chunkOEV5RMZO_cjs = require('../chunk-OEV5RMZO.cjs');
41
+ var chunkY3MWXQSB_cjs = require('../chunk-Y3MWXQSB.cjs');
42
+ require('../chunk-FEWUHQNM.cjs');
43
+ var chunkZ5XMPRNC_cjs = require('../chunk-Z5XMPRNC.cjs');
44
+ var chunkIVIA7K75_cjs = require('../chunk-IVIA7K75.cjs');
45
+ var chunk7AD52FRS_cjs = require('../chunk-7AD52FRS.cjs');
46
+ var chunk52ULD552_cjs = require('../chunk-52ULD552.cjs');
47
+ var chunkXXZJEFKW_cjs = require('../chunk-XXZJEFKW.cjs');
48
+ var chunkKHPCJRI3_cjs = require('../chunk-KHPCJRI3.cjs');
49
+ var chunkHANL7K2Q_cjs = require('../chunk-HANL7K2Q.cjs');
50
+ var chunkL63H3SQ4_cjs = require('../chunk-L63H3SQ4.cjs');
51
+ require('../chunk-5S7RKFGR.cjs');
52
+ require('../chunk-OIQYIIO3.cjs');
53
+ var chunkKQTPCYTG_cjs = require('../chunk-KQTPCYTG.cjs');
54
+ var chunkAIA52I7T_cjs = require('../chunk-AIA52I7T.cjs');
55
+ require('../chunk-HGVXZDSK.cjs');
56
+ var chunkRMHC2VG7_cjs = require('../chunk-RMHC2VG7.cjs');
57
+ var chunk5FSKKMR7_cjs = require('../chunk-5FSKKMR7.cjs');
58
+ require('../chunk-GTU2Z2WW.cjs');
59
+ require('../chunk-ZDSYWBIE.cjs');
60
+ require('../chunk-KKFZ3B6J.cjs');
61
+ var chunkWRLUBRKS_cjs = require('../chunk-WRLUBRKS.cjs');
62
+ require('../chunk-X3GJPRVK.cjs');
63
+ require('../chunk-DTGBOSEM.cjs');
64
+ require('../chunk-YKGPCZEE.cjs');
65
+ require('../chunk-6EX3I5P4.cjs');
66
+ var chunkGJNCFRJU_cjs = require('../chunk-GJNCFRJU.cjs');
67
+ require('../chunk-AIX25INK.cjs');
68
+ require('../chunk-ILRBGFVD.cjs');
69
+ var chunkE7JP3BS3_cjs = require('../chunk-E7JP3BS3.cjs');
70
+ var chunkHCCQLAA4_cjs = require('../chunk-HCCQLAA4.cjs');
71
+ var ans = require('@holoscript/core-types/ans');
48
72
 
49
73
  // src/compiler/Native2DCompiler.ts
50
74
  var Native2DCompiler_exports = {};
51
- chunk3SAK5KFL_cjs.__export(Native2DCompiler_exports, {
75
+ chunkHCCQLAA4_cjs.__export(Native2DCompiler_exports, {
52
76
  Native2DCompiler: () => exports.Native2DCompiler
53
77
  });
54
78
  exports.Native2DCompiler = void 0;
55
- var init_Native2DCompiler = chunk3SAK5KFL_cjs.__esm({
79
+ var init_Native2DCompiler = chunkHCCQLAA4_cjs.__esm({
56
80
  "src/compiler/Native2DCompiler.ts"() {
57
- chunkBF2235SI_cjs.init_CompilerBase();
58
- exports.Native2DCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
81
+ chunkRMHC2VG7_cjs.init_CompilerBase();
82
+ chunkE7JP3BS3_cjs.init_safeJsonParse();
83
+ exports.Native2DCompiler = class extends chunkRMHC2VG7_cjs.CompilerBase {
59
84
  constructor() {
60
85
  super(...arguments);
61
86
  this.compilerName = "Native2DCompiler";
@@ -75,24 +100,11 @@ var init_Native2DCompiler = chunk3SAK5KFL_cjs.__esm({
75
100
  const isReact = options?.format === "react";
76
101
  const elements = composition.ui?.elements || composition.objects || [];
77
102
  if (isReact) {
78
- const code = this.generateReactComponent(composition.name, elements, composition, options);
79
- if (options?.generateDocs) {
80
- return {
81
- output: code,
82
- documentation: this.generateDocumentation(composition, code, options.docsOptions)
83
- };
84
- }
85
- return code;
86
- } else {
87
- const code = this.generateHTMLPage(composition.name, elements, composition);
88
- if (options?.generateDocs) {
89
- return {
90
- output: code,
91
- documentation: this.generateDocumentation(composition, code, options.docsOptions)
92
- };
93
- }
94
- return code;
103
+ const code2 = this.generateReactComponent(composition.name, elements, composition, options);
104
+ return this.withTripleOutputIfRequested(composition, code2, options);
95
105
  }
106
+ const code = this.generateHTMLPage(composition.name, elements, composition);
107
+ return this.withTripleOutputIfRequested(composition, code, options);
96
108
  }
97
109
  generateReactComponent(name, objects, composition, options) {
98
110
  this._slotImports.clear();
@@ -232,7 +244,7 @@ export default ${safeName}Component;
232
244
  }
233
245
  if (traits.theme?.attributes) {
234
246
  try {
235
- const parsedAttrs = JSON.parse(traits.theme.attributes);
247
+ const parsedAttrs = chunkE7JP3BS3_cjs.readJson(traits.theme.attributes);
236
248
  for (const [key, value] of Object.entries(parsedAttrs)) {
237
249
  props += ` ${key}="${value}"`;
238
250
  }
@@ -373,7 +385,7 @@ export default ${safeName}Component;
373
385
  }
374
386
  if (traits.theme?.attributes) {
375
387
  try {
376
- const parsedAttrs = JSON.parse(traits.theme.attributes);
388
+ const parsedAttrs = chunkE7JP3BS3_cjs.readJson(traits.theme.attributes);
377
389
  for (const [key, value] of Object.entries(parsedAttrs)) {
378
390
  props += ` ${key}="${value}"`;
379
391
  }
@@ -516,8 +528,8 @@ export default ${safeName}Component;
516
528
 
517
529
  // src/compiler/NextJSAPICompiler.ts
518
530
  var NextJSAPICompiler_exports = {};
519
- chunk3SAK5KFL_cjs.__export(NextJSAPICompiler_exports, {
520
- NextJSAPICompiler: () => NextJSAPICompiler,
531
+ chunkHCCQLAA4_cjs.__export(NextJSAPICompiler_exports, {
532
+ NextJSAPICompiler: () => exports.NextJSAPICompiler,
521
533
  compileAllToNextJSAPI: () => compileAllToNextJSAPI,
522
534
  compileToNextJSAPI: () => compileToNextJSAPI
523
535
  });
@@ -542,6 +554,19 @@ function buildPropMap(obj) {
542
554
  }
543
555
  return map;
544
556
  }
557
+ function toStringArray(val) {
558
+ if (val === void 0 || val === null) return void 0;
559
+ if (!Array.isArray(val)) return void 0;
560
+ const out = [];
561
+ for (const item of val) {
562
+ if (typeof item === "string") out.push(item);
563
+ }
564
+ return out.length ? out : void 0;
565
+ }
566
+ function parseResponseMode(raw) {
567
+ if (raw === "echo" || raw === "message") return raw;
568
+ return void 0;
569
+ }
545
570
  function toApiRouteSegment(name, override) {
546
571
  if (override) {
547
572
  return override.replace(/^\/+api\/+/, "").replace(/^\/+/, "").replace(/\/+$/, "");
@@ -562,7 +587,9 @@ function extractHandlers(composition) {
562
587
  byMethod.set(method, {
563
588
  method,
564
589
  statusCode: Number(toScalar(rootHttp["statusCode"]) ?? toScalar(rootHttp["status"]) ?? 200),
565
- description: String(toScalar(rootHttp["description"]) ?? "")
590
+ description: String(toScalar(rootHttp["description"]) ?? ""),
591
+ requiredBodyKeys: toStringArray(rootHttp["requiredBodyKeys"]),
592
+ responseMode: parseResponseMode(String(toScalar(rootHttp["responseMode"]) ?? "")) ?? (rootHttp["echoBody"] === true ? "echo" : void 0)
566
593
  });
567
594
  }
568
595
  }
@@ -576,21 +603,28 @@ function extractHandlers(composition) {
576
603
  if (!method) continue;
577
604
  const traitStatus = toScalar(traitConfig["statusCode"] ?? traitConfig["status"]);
578
605
  const propStatus = props.get("statusCode") ?? props.get("status");
606
+ const objRequired = toStringArray(traitConfig["requiredBodyKeys"]);
607
+ const mode = parseResponseMode(String(toScalar(traitConfig["responseMode"]) ?? "")) ?? (traitConfig["echoBody"] === true ? "echo" : void 0);
579
608
  byMethod.set(method, {
580
609
  method,
581
610
  statusCode: Number(traitStatus ?? propStatus ?? 200),
582
611
  description: String(
583
612
  props.get("description") ?? toScalar(traitConfig["description"]) ?? obj.name ?? ""
584
- )
613
+ ),
614
+ requiredBodyKeys: objRequired,
615
+ responseMode: mode
585
616
  });
586
617
  }
587
618
  return [...byMethod.values()];
588
619
  }
589
- function emitHandler(handler) {
590
- const { method, statusCode, description } = handler;
620
+ function emitHandler(handler, meta, opts) {
621
+ const { method, statusCode, description, requiredBodyKeys = [], responseMode } = handler;
591
622
  const lines = [];
592
623
  const hasBody = BODY_METHODS.has(method);
593
624
  const isPassthrough = PASSTHROUGH_METHODS.has(method);
625
+ const mode = responseMode ?? (requiredBodyKeys.length > 0 ? "message" : "echo");
626
+ const keysJson = JSON.stringify(requiredBodyKeys);
627
+ const useEcho = mode === "echo";
594
628
  if (description) {
595
629
  lines.push(`/** ${description} */`);
596
630
  }
@@ -606,18 +640,48 @@ function emitHandler(handler) {
606
640
  lines.push(` try {`);
607
641
  lines.push(` body = await _request.json();`);
608
642
  lines.push(` } catch {`);
609
- lines.push(` return NextResponse.json({ error: 'Invalid JSON body' }, { status: 400 });`);
643
+ lines.push(` return NextResponse.json({ ok: false, error: 'Invalid JSON body' }, { status: 400 });`);
610
644
  lines.push(` }`);
611
- lines.push(``);
612
- lines.push(` void body; // TODO: validate and process body`);
613
- lines.push(``);
614
- lines.push(` return NextResponse.json(`);
615
- lines.push(` { /* TODO: return response data */ },`);
616
- lines.push(` { status: ${statusCode} }`);
617
- lines.push(` );`);
645
+ lines.push(` const record = typeof body === 'object' && body !== null ? (body as Record<string, unknown>) : null;`);
646
+ lines.push(` if (!record) {`);
647
+ lines.push(
648
+ ` return NextResponse.json({ ok: false, error: 'JSON body must be an object' }, { status: 400 });`
649
+ );
650
+ lines.push(` }`);
651
+ if (opts.includeValidation) {
652
+ lines.push(` const spatialValidation = validateSpatialRequestBody(record);`);
653
+ lines.push(` if (!spatialValidation.valid) {`);
654
+ lines.push(
655
+ ` return NextResponse.json({ ok: false, error: spatialValidation.error, field: spatialValidation.field }, { status: 400 });`
656
+ );
657
+ lines.push(` }`);
658
+ }
659
+ lines.push(` const requiredKeys = ${keysJson} as const;`);
660
+ lines.push(` for (const key of requiredKeys) {`);
661
+ lines.push(` if (!(key in record)) {`);
662
+ lines.push(
663
+ ` return NextResponse.json({ ok: false, error: 'Missing required field', field: key }, { status: 400 });`
664
+ );
665
+ lines.push(` }`);
666
+ lines.push(` }`);
667
+ if (useEcho) {
668
+ lines.push(` return NextResponse.json(`);
669
+ lines.push(` { ok: true, route: ${JSON.stringify(meta.routeSegment)}, data: record },`);
670
+ lines.push(` { status: ${statusCode} }`);
671
+ lines.push(` );`);
672
+ } else {
673
+ lines.push(` return NextResponse.json(`);
674
+ lines.push(
675
+ ` { ok: true, route: ${JSON.stringify(meta.routeSegment)}, composition: ${JSON.stringify(meta.compositionName)}, message: ${JSON.stringify(description || "Accepted")}, receivedKeys: Object.keys(record) },`
676
+ );
677
+ lines.push(` { status: ${statusCode} }`);
678
+ lines.push(` );`);
679
+ }
618
680
  } else {
619
681
  lines.push(` return NextResponse.json(`);
620
- lines.push(` { /* TODO: return response data */ },`);
682
+ lines.push(
683
+ ` { ok: true, route: ${JSON.stringify(meta.routeSegment)}, composition: ${JSON.stringify(meta.compositionName)}, message: ${JSON.stringify(description || "OK")} },`
684
+ );
621
685
  lines.push(` { status: ${statusCode} }`);
622
686
  lines.push(` );`);
623
687
  }
@@ -638,6 +702,9 @@ function compileToNextJSAPI(composition, options = {}) {
638
702
  const routeSegment = toApiRouteSegment(composition.name, options.apiRoute);
639
703
  const outputBase = options.outputDir ? options.outputDir.replace(/\/$/, "") : "api";
640
704
  const filePath = `${outputBase}/${routeSegment}/route.ts`;
705
+ const meta = { routeSegment, compositionName: composition.name };
706
+ const includeValidation = options.includeValidation !== false;
707
+ const hasBodyHandlers = handlers.some((h) => BODY_METHODS.has(h.method));
641
708
  const lines = [];
642
709
  if (options.includeJsDoc !== false) {
643
710
  lines.push(`// @generated by HoloScript NextJSAPICompiler \u2014 DO NOT EDIT`);
@@ -652,8 +719,40 @@ function compileToNextJSAPI(composition, options = {}) {
652
719
  lines.push(`import { NextResponse } from 'next/server';`);
653
720
  }
654
721
  lines.push(``);
722
+ if (includeValidation && hasBodyHandlers) {
723
+ lines.push(`function isTuple3(value: unknown): value is [number, number, number] {`);
724
+ lines.push(` return Array.isArray(value) && value.length === 3 && value.every((n) => typeof n === 'number');`);
725
+ lines.push(`}`);
726
+ lines.push(``);
727
+ lines.push(`function isTuple4(value: unknown): value is [number, number, number, number] {`);
728
+ lines.push(` return Array.isArray(value) && value.length === 4 && value.every((n) => typeof n === 'number');`);
729
+ lines.push(`}`);
730
+ lines.push(``);
731
+ lines.push(
732
+ `function validateSpatialRequestBody(record: Record<string, unknown>): { valid: true } | { valid: false; error: string; field: string } {`
733
+ );
734
+ lines.push(` if ('position' in record && !isTuple3(record.position)) {`);
735
+ lines.push(` return { valid: false, error: 'position must be [x, y, z] numeric tuple', field: 'position' };`);
736
+ lines.push(` }`);
737
+ lines.push(` if ('scale' in record && !isTuple3(record.scale)) {`);
738
+ lines.push(` return { valid: false, error: 'scale must be [x, y, z] numeric tuple', field: 'scale' };`);
739
+ lines.push(` }`);
740
+ lines.push(` if ('rotation' in record) {`);
741
+ lines.push(` const rotation = record.rotation;`);
742
+ lines.push(` const isEuler = isTuple3(rotation);`);
743
+ lines.push(` const isQuat = isTuple4(rotation);`);
744
+ lines.push(` if (!isEuler && !isQuat) {`);
745
+ lines.push(
746
+ ` return { valid: false, error: 'rotation must be [x, y, z] or [x, y, z, w] numeric tuple', field: 'rotation' };`
747
+ );
748
+ lines.push(` }`);
749
+ lines.push(` }`);
750
+ lines.push(` return { valid: true };`);
751
+ lines.push(`}`);
752
+ lines.push(``);
753
+ }
655
754
  for (let i = 0; i < handlers.length; i++) {
656
- lines.push(...emitHandler(handlers[i]));
755
+ lines.push(...emitHandler(handlers[i], meta, { includeValidation }));
657
756
  if (i < handlers.length - 1) {
658
757
  lines.push(``);
659
758
  }
@@ -666,10 +765,10 @@ function compileToNextJSAPI(composition, options = {}) {
666
765
  function compileAllToNextJSAPI(compositions, options = {}) {
667
766
  return compositions.map(({ composition }) => compileToNextJSAPI(composition, options));
668
767
  }
669
- var VALID_METHODS, BODY_METHODS, PASSTHROUGH_METHODS, NextJSAPICompiler;
670
- var init_NextJSAPICompiler = chunk3SAK5KFL_cjs.__esm({
768
+ var VALID_METHODS, BODY_METHODS, PASSTHROUGH_METHODS; exports.NextJSAPICompiler = void 0;
769
+ var init_NextJSAPICompiler = chunkHCCQLAA4_cjs.__esm({
671
770
  "src/compiler/NextJSAPICompiler.ts"() {
672
- chunkBF2235SI_cjs.init_CompilerBase();
771
+ chunkRMHC2VG7_cjs.init_CompilerBase();
673
772
  VALID_METHODS = /* @__PURE__ */ new Set([
674
773
  "GET",
675
774
  "POST",
@@ -681,43 +780,50 @@ var init_NextJSAPICompiler = chunk3SAK5KFL_cjs.__esm({
681
780
  ]);
682
781
  BODY_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH"]);
683
782
  PASSTHROUGH_METHODS = /* @__PURE__ */ new Set(["HEAD", "DELETE"]);
684
- NextJSAPICompiler = class extends chunkBF2235SI_cjs.CompilerBase {
783
+ exports.NextJSAPICompiler = class extends chunkRMHC2VG7_cjs.CompilerBase {
685
784
  constructor(options = {}) {
686
785
  super();
687
786
  this.options = options;
787
+ this.compilerName = "NextJSAPICompiler";
688
788
  }
689
- get name() {
690
- return "nextjs-api";
691
- }
692
- compile(composition, agentToken) {
693
- const comp = composition;
694
- const result = compileAllToNextJSAPI(comp);
695
- return {
696
- code: result.map((r) => r.code).join("\n\n"),
697
- files: result.map((r) => ({ path: r.routePath, content: r.code }))
698
- };
789
+ compile(composition, agentToken, outputPath, _sceneGraph) {
790
+ this.validateCompilerAccess(agentToken, outputPath);
791
+ const result = compileToNextJSAPI(composition, this.options);
792
+ return { [result.path]: result.code };
699
793
  }
700
- compileSingle(composition, agentToken) {
701
- const comp = composition;
702
- return compileToNextJSAPI(comp);
794
+ /** Multi-composition helper (not used by CompilerBase). */
795
+ compileAll(compositions, agentToken, outputPath) {
796
+ this.validateCompilerAccess(agentToken, outputPath);
797
+ const files = {};
798
+ for (const row of compileAllToNextJSAPI(compositions, this.options)) {
799
+ files[row.path] = row.code;
800
+ }
801
+ return files;
703
802
  }
704
803
  };
705
804
  }
706
805
  });
707
806
 
807
+ // src/compiler/identity/index.ts
808
+ var init_identity = chunkHCCQLAA4_cjs.__esm({
809
+ "src/compiler/identity/index.ts"() {
810
+ chunkRMHC2VG7_cjs.init_ANSNamespace();
811
+ }
812
+ });
813
+
708
814
  // src/compiler/NodeServiceCompiler.ts
709
815
  var NodeServiceCompiler_exports = {};
710
- chunk3SAK5KFL_cjs.__export(NodeServiceCompiler_exports, {
816
+ chunkHCCQLAA4_cjs.__export(NodeServiceCompiler_exports, {
711
817
  NodeServiceCompiler: () => exports.NodeServiceCompiler
712
818
  });
713
819
  exports.NodeServiceCompiler = void 0;
714
- var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
820
+ var init_NodeServiceCompiler = chunkHCCQLAA4_cjs.__esm({
715
821
  "src/compiler/NodeServiceCompiler.ts"() {
716
- chunkBF2235SI_cjs.init_CompilerBase();
717
- chunkBF2235SI_cjs.init_identity();
822
+ chunkRMHC2VG7_cjs.init_CompilerBase();
823
+ init_identity();
718
824
  init_DialectRegistry();
719
- chunkXG23EUQX_cjs.init_constants();
720
- exports.NodeServiceCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
825
+ chunkWRLUBRKS_cjs.init_constants();
826
+ exports.NodeServiceCompiler = class extends chunkRMHC2VG7_cjs.CompilerBase {
721
827
  constructor(options = {}) {
722
828
  super();
723
829
  this.compilerName = "NodeServiceCompiler";
@@ -732,10 +838,9 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
732
838
  };
733
839
  }
734
840
  getRequiredCapability() {
735
- return chunkBF2235SI_cjs.ANSCapabilityPath.NODE_SERVICE;
841
+ return chunkRMHC2VG7_cjs.ANSCapabilityPath.NODE_SERVICE;
736
842
  }
737
843
  compile(composition, agentToken, outputPath) {
738
- console.log("DEBUG: Composition:", JSON.stringify(composition, null, 2));
739
844
  this.validateCompilerAccess(agentToken, outputPath);
740
845
  this.services = [];
741
846
  this.extractServices(composition);
@@ -802,7 +907,16 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
802
907
  }
803
908
  hasServiceTraits(obj) {
804
909
  if (!obj.traits) return false;
805
- const serviceTraits = ["service", "endpoint", "http", "handler", "route", "connector", "env", "deploy"];
910
+ const serviceTraits = [
911
+ "service",
912
+ "endpoint",
913
+ "http",
914
+ "handler",
915
+ "route",
916
+ "connector",
917
+ "env",
918
+ "deploy"
919
+ ];
806
920
  return obj.traits.some((t) => serviceTraits.includes(t.name));
807
921
  }
808
922
  parseServiceBlock(block) {
@@ -842,7 +956,10 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
842
956
  if (obj.traits) {
843
957
  const traitNames = obj.traits.map((t) => t.name);
844
958
  service.middleware = this.extractMiddlewareFromTraits(traitNames);
845
- service.connectors = this.extractConnectors(traitNames, this.objectPropsToMap(obj.properties));
959
+ service.connectors = this.extractConnectors(
960
+ traitNames,
961
+ this.objectPropsToMap(obj.properties)
962
+ );
846
963
  service.envVars = this.extractEnvVars(traitNames, this.objectPropsToMap(obj.properties));
847
964
  service.deploy = this.extractDeploy(traitNames, this.objectPropsToMap(obj.properties));
848
965
  }
@@ -852,16 +969,20 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
852
969
  }
853
970
  extractRoute(obj, serviceName) {
854
971
  const propMap = this.objectPropsToMap(obj.properties);
855
- const traits = (obj.traits || []).map((t) => t.name);
972
+ const traitObjects = obj.traits || [];
973
+ const traits = traitObjects.map((t) => t.name);
974
+ const handlerTrait = this.findTrait(traitObjects, "handler");
856
975
  const method = this.resolveString(propMap.get("method"))?.toUpperCase() || "GET";
857
976
  const path = this.resolveString(propMap.get("path")) || `/${this.toKebab(obj.name)}`;
858
- const handlerName = this.resolveString(propMap.get("handler")) || this.toCamelCase(obj.name);
977
+ const handlerName = this.resolveString(propMap.get("handler")) || this.resolveString(this.readTraitConfig(handlerTrait, "name", "handler")) || this.resolveString(this.readTraitConfig(handlerTrait, "_arg0")) || this.toCamelCase(obj.name);
859
978
  const hasHttpInfo = propMap.has("method") || propMap.has("path") || traits.includes("http") || traits.includes("route");
860
979
  if (!hasHttpInfo) return null;
861
980
  return {
862
981
  method,
863
982
  path,
864
983
  handlerName,
984
+ handlerBody: this.extractRouteHandlerBody(obj, propMap, handlerName),
985
+ handlerState: this.extractRouteState(obj),
865
986
  middleware: this.extractMiddlewareFromTraits(traits),
866
987
  serviceName
867
988
  };
@@ -869,14 +990,111 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
869
990
  extractInlineRoute(block) {
870
991
  const props = block.properties;
871
992
  if (!props["method"] && !props["path"]) return null;
993
+ const handlerName = this.resolveString(props["handler"]) || this.toCamelCase(block.name);
872
994
  return {
873
995
  method: this.resolveString(props["method"])?.toUpperCase() || "GET",
874
996
  path: this.resolveString(props["path"]) || `/${this.toKebab(block.name)}`,
875
- handlerName: this.resolveString(props["handler"]) || this.toCamelCase(block.name),
997
+ handlerName,
998
+ handlerBody: this.extractBlockHandlerBody(block, handlerName),
876
999
  middleware: [],
877
1000
  serviceName: block.name
878
1001
  };
879
1002
  }
1003
+ extractRouteHandlerBody(obj, propMap, handlerName) {
1004
+ const directBody = this.handlerBodyFromValue(
1005
+ this.readMapValue(propMap, "handlerBody", "handler_body", "body")
1006
+ );
1007
+ if (directBody) return directBody;
1008
+ const handlerTrait = this.findTrait(obj.traits || [], "handler");
1009
+ const traitBody = this.handlerBodyFromValue(
1010
+ this.readTraitConfig(handlerTrait, "body", "code", "implementation")
1011
+ );
1012
+ if (traitBody) return traitBody;
1013
+ for (const directive of obj.directives ?? []) {
1014
+ const body = this.handlerBodyFromDirective(directive, handlerName);
1015
+ if (body) return body;
1016
+ }
1017
+ return this.handlerBodyFromEventHandlers(
1018
+ obj.eventHandlers,
1019
+ handlerName
1020
+ );
1021
+ }
1022
+ extractBlockHandlerBody(block, handlerName) {
1023
+ const directBody = this.handlerBodyFromValue(
1024
+ this.readRecordValue(block.properties, "handlerBody", "handler_body", "body")
1025
+ );
1026
+ if (directBody) return directBody;
1027
+ return this.handlerBodyFromEventHandlers(block.eventHandlers, handlerName);
1028
+ }
1029
+ handlerBodyFromDirective(directive, handlerName) {
1030
+ if (!directive || typeof directive !== "object") return void 0;
1031
+ const record = directive;
1032
+ const name = String(record["name"] ?? record["handlerName"] ?? "");
1033
+ const type = String(record["type"] ?? "");
1034
+ if (type === "method" && name === handlerName) {
1035
+ return this.handlerBodyFromValue(record["body"]);
1036
+ }
1037
+ if (type === "trait" && name === "handler") {
1038
+ return this.handlerBodyFromValue(
1039
+ this.readRecordValue(record["config"] ?? {}, "body", "code")
1040
+ );
1041
+ }
1042
+ return void 0;
1043
+ }
1044
+ handlerBodyFromEventHandlers(handlers, handlerName) {
1045
+ for (const handler of handlers ?? []) {
1046
+ if (handler.event === handlerName || handler.name === handlerName) {
1047
+ const body = this.handlerBodyFromValue(handler.body);
1048
+ if (body) return body;
1049
+ }
1050
+ }
1051
+ return void 0;
1052
+ }
1053
+ handlerBodyFromValue(value) {
1054
+ if (value === void 0 || value === null) return void 0;
1055
+ if (typeof value === "string") {
1056
+ const trimmed = value.trim();
1057
+ return trimmed.length > 0 ? trimmed : void 0;
1058
+ }
1059
+ if (Array.isArray(value)) {
1060
+ const lines = value.map((statement) => this.emitHoloStatement(statement)).filter((line) => Boolean(line));
1061
+ return lines.length > 0 ? lines.join("\n") : void 0;
1062
+ }
1063
+ if (typeof value === "object") {
1064
+ const record = value;
1065
+ return this.handlerBodyFromValue(
1066
+ record["body"] ?? record["code"] ?? record["implementation"] ?? record["value"]
1067
+ );
1068
+ }
1069
+ return void 0;
1070
+ }
1071
+ extractRouteState(obj) {
1072
+ if (!obj.state?.properties?.length) return void 0;
1073
+ const state = {};
1074
+ for (const prop of obj.state.properties) {
1075
+ state[prop.key] = prop.value;
1076
+ }
1077
+ return state;
1078
+ }
1079
+ findTrait(traits, name) {
1080
+ return traits.find((trait) => trait.name.replace(/^@/, "") === name);
1081
+ }
1082
+ readTraitConfig(trait, ...keys) {
1083
+ if (!trait?.config) return void 0;
1084
+ return this.readRecordValue(trait.config, ...keys);
1085
+ }
1086
+ readMapValue(map, ...keys) {
1087
+ for (const key of keys) {
1088
+ if (map.has(key)) return map.get(key);
1089
+ }
1090
+ return void 0;
1091
+ }
1092
+ readRecordValue(record, ...keys) {
1093
+ for (const key of keys) {
1094
+ if (Object.prototype.hasOwnProperty.call(record, key)) return record[key];
1095
+ }
1096
+ return void 0;
1097
+ }
880
1098
  extractMiddlewareFromTraits(traits) {
881
1099
  const mw = [];
882
1100
  for (const t of traits) {
@@ -1047,10 +1265,7 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
1047
1265
  `router.${methodLower}('${this.escapeStringValue(route.path, "TypeScript")}', ${mwArgs}(req, res) => {`
1048
1266
  );
1049
1267
  }
1050
- lines.push(` // TODO: Implement ${route.handlerName}`);
1051
- lines.push(
1052
- ` res.json({ message: '${this.escapeStringValue(route.handlerName, "TypeScript")} not implemented' });`
1053
- );
1268
+ lines.push(...this.emitExpressRouteBody(route));
1054
1269
  lines.push(`});`);
1055
1270
  lines.push("");
1056
1271
  }
@@ -1078,10 +1293,7 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
1078
1293
  lines.push(
1079
1294
  ` app.${methodLower}('${this.escapeStringValue(route.path, "TypeScript")}', async (request, reply) => {`
1080
1295
  );
1081
- lines.push(` // TODO: Implement ${route.handlerName}`);
1082
- lines.push(
1083
- ` return { message: '${this.escapeStringValue(route.handlerName, "TypeScript")} not implemented' };`
1084
- );
1296
+ lines.push(...this.emitFastifyRouteBody(route));
1085
1297
  lines.push(` });`);
1086
1298
  lines.push("");
1087
1299
  }
@@ -1098,6 +1310,90 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
1098
1310
  }
1099
1311
  return lines.join("\n");
1100
1312
  }
1313
+ emitExpressRouteBody(route) {
1314
+ if (route.handlerBody) {
1315
+ return [
1316
+ ` // Handler: ${route.handlerName}`,
1317
+ ...this.emitHandlerState(route, " "),
1318
+ ...this.indentHandlerBody(route.handlerBody, " ")
1319
+ ];
1320
+ }
1321
+ return [
1322
+ ` // Placeholder \u2014 replace with ${route.handlerName} logic`,
1323
+ ` res.status(501).json({ error: 'not_implemented', handler: '${this.escapeStringValue(route.handlerName, "TypeScript")}' });`
1324
+ ];
1325
+ }
1326
+ emitFastifyRouteBody(route) {
1327
+ if (route.handlerBody) {
1328
+ return [
1329
+ ` // Handler: ${route.handlerName}`,
1330
+ ...this.emitHandlerState(route, " "),
1331
+ ...this.indentHandlerBody(route.handlerBody, " ")
1332
+ ];
1333
+ }
1334
+ return [
1335
+ ` // Placeholder \u2014 replace with ${route.handlerName} logic`,
1336
+ ` return reply.code(501).send({ error: 'not_implemented', handler: '${this.escapeStringValue(route.handlerName, "TypeScript")}' });`
1337
+ ];
1338
+ }
1339
+ indentHandlerBody(body, indent) {
1340
+ return body.split(/\r?\n/).map((line) => line.trimEnd()).filter((line) => line.length > 0).map((line) => `${indent}${line}`);
1341
+ }
1342
+ emitHandlerState(route, indent) {
1343
+ if (!route.handlerState || Object.keys(route.handlerState).length === 0) return [];
1344
+ return [
1345
+ `${indent}const state = ${JSON.stringify(route.handlerState, null, 2).replace(/\n/g, `
1346
+ ${indent}`)};`
1347
+ ];
1348
+ }
1349
+ emitHoloStatement(statement) {
1350
+ switch (statement.type) {
1351
+ case "Assignment":
1352
+ return `${statement.target} ${statement.operator} ${this.emitHoloExpression(statement.value)};`;
1353
+ case "VariableDeclaration":
1354
+ return `${statement.kind} ${statement.name}${statement.value ? ` = ${this.emitHoloExpression(statement.value)}` : ""};`;
1355
+ case "ReturnStatement":
1356
+ return `return ${statement.value ? this.emitHoloExpression(statement.value) : ""};`;
1357
+ case "EmitStatement":
1358
+ return `emit(${JSON.stringify(statement.event)}, ${statement.data ? this.emitHoloExpression(statement.data) : "undefined"});`;
1359
+ case "ExpressionStatement":
1360
+ return `${this.emitHoloExpression(statement.expression)};`;
1361
+ case "MethodCall": {
1362
+ const target = statement.object ? `${statement.object}.` : "";
1363
+ return `${target}${statement.method}(${statement.arguments.map((arg) => this.emitHoloExpression(arg)).join(", ")});`;
1364
+ }
1365
+ default:
1366
+ return `// Unsupported handler statement: ${statement.type}`;
1367
+ }
1368
+ }
1369
+ emitHoloExpression(expression) {
1370
+ switch (expression.type) {
1371
+ case "Literal":
1372
+ return JSON.stringify(expression.value);
1373
+ case "Identifier":
1374
+ return expression.name;
1375
+ case "BinaryExpression":
1376
+ return `(${this.emitHoloExpression(expression.left)} ${expression.operator} ${this.emitHoloExpression(expression.right)})`;
1377
+ case "UnaryExpression":
1378
+ return `(${expression.operator}${this.emitHoloExpression(expression.argument)})`;
1379
+ case "MemberExpression":
1380
+ return expression.computed ? `${this.emitHoloExpression(expression.object)}[${JSON.stringify(expression.property)}]` : `${this.emitHoloExpression(expression.object)}.${expression.property}`;
1381
+ case "CallExpression":
1382
+ return `${this.emitHoloExpression(expression.callee)}(${expression.arguments.map((arg) => this.emitHoloExpression(arg)).join(", ")})`;
1383
+ case "ArrayExpression":
1384
+ return `[${expression.elements.map((element) => this.emitHoloExpression(element)).join(", ")}]`;
1385
+ case "ObjectExpression":
1386
+ return `{ ${expression.properties.map((prop) => `${JSON.stringify(prop.key)}: ${this.emitHoloExpression(prop.value)}`).join(", ")} }`;
1387
+ case "ConditionalExpression":
1388
+ return `(${this.emitHoloExpression(expression.test)} ? ${this.emitHoloExpression(expression.consequent)} : ${this.emitHoloExpression(expression.alternate)})`;
1389
+ case "UpdateExpression":
1390
+ return expression.prefix ? `${expression.operator}${this.emitHoloExpression(expression.argument)}` : `${this.emitHoloExpression(expression.argument)}${expression.operator}`;
1391
+ case "BindExpression":
1392
+ return expression.source;
1393
+ default:
1394
+ return "undefined";
1395
+ }
1396
+ }
1101
1397
  emitMiddlewareIndex(middleware) {
1102
1398
  const lines = [];
1103
1399
  lines.push(`/**`);
@@ -1111,7 +1407,7 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
1111
1407
  for (const mw of middleware) {
1112
1408
  const fnName = this.toCamelCase(mw) + "Middleware";
1113
1409
  lines.push(`export function ${fnName}(req: Request, _res: Response, next: NextFunction) {`);
1114
- lines.push(` // TODO: Implement ${mw} middleware`);
1410
+ lines.push(` // Pass-through placeholder for ${mw} \u2014 add auth/limits here`);
1115
1411
  lines.push(` next();`);
1116
1412
  lines.push(`}`);
1117
1413
  lines.push("");
@@ -1126,7 +1422,7 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
1126
1422
  lines.push(
1127
1423
  `export function ${fnName}(request: FastifyRequest, _reply: FastifyReply, done: HookHandlerDoneFunction) {`
1128
1424
  );
1129
- lines.push(` // TODO: Implement ${mw} middleware`);
1425
+ lines.push(` // Pass-through placeholder for ${mw} \u2014 add auth/limits here`);
1130
1426
  lines.push(` done();`);
1131
1427
  lines.push(`}`);
1132
1428
  lines.push("");
@@ -1140,7 +1436,7 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
1140
1436
  const dependencies = isExpress ? { express: "^4.21.0", dotenv: "^16.4.0" } : { fastify: "^5.0.0", dotenv: "^16.4.0" };
1141
1437
  const connectors = this.collectConnectors();
1142
1438
  for (const conn of connectors) {
1143
- const pkg2 = chunkXG23EUQX_cjs.CONNECTOR_PACKAGES[conn.name];
1439
+ const pkg2 = chunkWRLUBRKS_cjs.CONNECTOR_PACKAGES[conn.name];
1144
1440
  if (pkg2) {
1145
1441
  dependencies[pkg2] = "latest";
1146
1442
  }
@@ -1217,7 +1513,7 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
1217
1513
  map.set(env.name, env);
1218
1514
  }
1219
1515
  for (const conn of service.connectors) {
1220
- const requirements = chunkXG23EUQX_cjs.CONNECTOR_ENV_REQUIREMENTS[conn.name] || [];
1516
+ const requirements = chunkWRLUBRKS_cjs.CONNECTOR_ENV_REQUIREMENTS[conn.name] || [];
1221
1517
  for (const req of requirements) {
1222
1518
  if (!map.has(req)) {
1223
1519
  map.set(req, { name: req, required: true });
@@ -1276,7 +1572,7 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
1276
1572
  lines.push(` */`);
1277
1573
  lines.push(``);
1278
1574
  for (const conn of connectors) {
1279
- const pkg = chunkXG23EUQX_cjs.CONNECTOR_PACKAGES[conn.name];
1575
+ const pkg = chunkWRLUBRKS_cjs.CONNECTOR_PACKAGES[conn.name];
1280
1576
  if (pkg) {
1281
1577
  lines.push(`import { ${this.toClassName(conn.name)}Connector } from '${pkg}';`);
1282
1578
  }
@@ -1373,10 +1669,12 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
1373
1669
  const envVars = this.collectEnvVars();
1374
1670
  const envMap = new Map(envVars.map((ev) => [ev.name, ev]));
1375
1671
  for (const conn of connectors) {
1376
- if (!chunkXG23EUQX_cjs.KNOWN_CONNECTORS.includes(conn.name)) {
1377
- console.warn(`[NodeServiceCompiler] Warning: Unknown connector '${conn.name}'. Package dependency will not be added.`);
1672
+ if (!chunkWRLUBRKS_cjs.KNOWN_CONNECTORS.includes(conn.name)) {
1673
+ console.warn(
1674
+ `[NodeServiceCompiler] Warning: Unknown connector '${conn.name}'. Package dependency will not be added.`
1675
+ );
1378
1676
  } else {
1379
- const requirements = chunkXG23EUQX_cjs.CONNECTOR_ENV_REQUIREMENTS[conn.name] || [];
1677
+ const requirements = chunkWRLUBRKS_cjs.CONNECTOR_ENV_REQUIREMENTS[conn.name] || [];
1380
1678
  for (const req of requirements) {
1381
1679
  if (!envMap.has(req)) {
1382
1680
  throw new Error(`Connector '${conn.name}' requires environment variable '${req}'`);
@@ -1427,7 +1725,7 @@ var init_NodeServiceCompiler = chunk3SAK5KFL_cjs.__esm({
1427
1725
 
1428
1726
  // src/compiler/registerBuiltinDialects.ts
1429
1727
  var registerBuiltinDialects_exports = {};
1430
- chunk3SAK5KFL_cjs.__export(registerBuiltinDialects_exports, {
1728
+ chunkHCCQLAA4_cjs.__export(registerBuiltinDialects_exports, {
1431
1729
  registerBuiltinDialects: () => registerBuiltinDialects
1432
1730
  });
1433
1731
  function registerBuiltinDialects() {
@@ -1457,7 +1755,7 @@ function registerBuiltinDialects() {
1457
1755
  ],
1458
1756
  riskTier: "standard",
1459
1757
  factory: (opts) => {
1460
- const { UnityCompiler: UnityCompiler2 } = (chunkHE7ULERA_cjs.init_UnityCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkHE7ULERA_cjs.UnityCompiler_exports));
1758
+ const { UnityCompiler: UnityCompiler2 } = (chunkKQTPCYTG_cjs.init_UnityCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkKQTPCYTG_cjs.UnityCompiler_exports));
1461
1759
  return new UnityCompiler2(opts);
1462
1760
  },
1463
1761
  outputExtensions: [".cs"]
@@ -1482,7 +1780,7 @@ function registerBuiltinDialects() {
1482
1780
  ],
1483
1781
  riskTier: "standard",
1484
1782
  factory: (opts) => {
1485
- const { UnrealCompiler } = (chunk5OEOHAAW_cjs.init_UnrealCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunk5OEOHAAW_cjs.UnrealCompiler_exports));
1783
+ const { UnrealCompiler } = (chunk27MPVJVZ_cjs.init_UnrealCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunk27MPVJVZ_cjs.UnrealCompiler_exports));
1486
1784
  return new UnrealCompiler(opts);
1487
1785
  },
1488
1786
  outputExtensions: [".cpp", ".h"]
@@ -1504,7 +1802,7 @@ function registerBuiltinDialects() {
1504
1802
  ],
1505
1803
  riskTier: "standard",
1506
1804
  factory: (opts) => {
1507
- const { GodotCompiler: GodotCompiler2 } = (chunkXXINBTZK_cjs.init_GodotCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkXXINBTZK_cjs.GodotCompiler_exports));
1805
+ const { GodotCompiler: GodotCompiler2 } = (chunkDIL6DDDN_cjs.init_GodotCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkDIL6DDDN_cjs.GodotCompiler_exports));
1508
1806
  return new GodotCompiler2(opts);
1509
1807
  },
1510
1808
  outputExtensions: [".gd", ".tscn"]
@@ -1531,7 +1829,7 @@ function registerBuiltinDialects() {
1531
1829
  ],
1532
1830
  riskTier: "standard",
1533
1831
  factory: (opts) => {
1534
- const { R3FCompiler: R3FCompiler2 } = (chunkQ5SJOGHQ_cjs.init_R3FCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkQ5SJOGHQ_cjs.R3FCompiler_exports));
1832
+ const { R3FCompiler: R3FCompiler2 } = (chunkBPICAGBV_cjs.init_R3FCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkBPICAGBV_cjs.R3FCompiler_exports));
1535
1833
  return new R3FCompiler2(opts);
1536
1834
  },
1537
1835
  outputExtensions: [".tsx", ".jsx"]
@@ -1551,7 +1849,7 @@ function registerBuiltinDialects() {
1551
1849
  ],
1552
1850
  riskTier: "standard",
1553
1851
  factory: (opts) => {
1554
- const { BabylonCompiler: BabylonCompiler2 } = (chunk33LSUQDD_cjs.init_BabylonCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunk33LSUQDD_cjs.BabylonCompiler_exports));
1852
+ const { BabylonCompiler: BabylonCompiler2 } = (chunkL63H3SQ4_cjs.init_BabylonCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkL63H3SQ4_cjs.BabylonCompiler_exports));
1555
1853
  return new BabylonCompiler2(opts);
1556
1854
  },
1557
1855
  outputExtensions: [".ts", ".js"]
@@ -1563,11 +1861,33 @@ function registerBuiltinDialects() {
1563
1861
  supportedTraits: ["physics", "collidable", "audio", "animation", "material"],
1564
1862
  riskTier: "standard",
1565
1863
  factory: (opts) => {
1566
- const { PlayCanvasCompiler: PlayCanvasCompiler2 } = (chunkXWPNTWDN_cjs.init_PlayCanvasCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkXWPNTWDN_cjs.PlayCanvasCompiler_exports));
1864
+ const { PlayCanvasCompiler: PlayCanvasCompiler2 } = (chunkMJVIRCUV_cjs.init_PlayCanvasCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkMJVIRCUV_cjs.PlayCanvasCompiler_exports));
1567
1865
  return new PlayCanvasCompiler2(opts);
1568
1866
  },
1569
1867
  outputExtensions: [".js"]
1570
1868
  },
1869
+ {
1870
+ name: "threejs",
1871
+ domain: "web3d",
1872
+ description: "Compiles to vanilla Three.js TypeScript (bypasses R3F for bundle-critical deployments)",
1873
+ supportedTraits: [
1874
+ "physics",
1875
+ "collidable",
1876
+ "grabbable",
1877
+ "hoverable",
1878
+ "audio",
1879
+ "animation",
1880
+ "particles",
1881
+ "material",
1882
+ "shadow"
1883
+ ],
1884
+ riskTier: "standard",
1885
+ factory: (opts) => {
1886
+ const { ThreeJSCompiler } = (chunkQWNQ523V_cjs.init_ThreeJSCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkQWNQ523V_cjs.ThreeJSCompiler_exports));
1887
+ return new ThreeJSCompiler(opts);
1888
+ },
1889
+ outputExtensions: [".ts"]
1890
+ },
1571
1891
  // ── VR/XR ─────────────────────────────────────────────────────────────
1572
1892
  {
1573
1893
  name: "openxr",
@@ -1583,7 +1903,7 @@ function registerBuiltinDialects() {
1583
1903
  ],
1584
1904
  riskTier: "standard",
1585
1905
  factory: (opts) => {
1586
- const { OpenXRCompiler: OpenXRCompiler2 } = (chunkFFKU7BTK_cjs.init_OpenXRCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkFFKU7BTK_cjs.OpenXRCompiler_exports));
1906
+ const { OpenXRCompiler: OpenXRCompiler2 } = (chunkKHPCJRI3_cjs.init_OpenXRCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkKHPCJRI3_cjs.OpenXRCompiler_exports));
1587
1907
  return new OpenXRCompiler2(opts);
1588
1908
  },
1589
1909
  outputExtensions: [".cpp", ".h"]
@@ -1591,7 +1911,7 @@ function registerBuiltinDialects() {
1591
1911
  {
1592
1912
  name: "vrchat",
1593
1913
  domain: "social-vr",
1594
- description: "Compiles to VRChat UdonSharp scripts",
1914
+ description: "Compiles to VRChat SDK3. Current implementation emits legacy UdonSharp C#; Byte/Udon output is gated on the artifact contract.",
1595
1915
  supportedTraits: [
1596
1916
  "physics",
1597
1917
  "collidable",
@@ -1604,7 +1924,7 @@ function registerBuiltinDialects() {
1604
1924
  ],
1605
1925
  riskTier: "standard",
1606
1926
  factory: (opts) => {
1607
- const { VRChatCompiler: VRChatCompiler2 } = (chunkZ34RLXRA_cjs.init_VRChatCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkZ34RLXRA_cjs.VRChatCompiler_exports));
1927
+ const { VRChatCompiler: VRChatCompiler2 } = (chunkHANL7K2Q_cjs.init_VRChatCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkHANL7K2Q_cjs.VRChatCompiler_exports));
1608
1928
  return new VRChatCompiler2(opts);
1609
1929
  },
1610
1930
  outputExtensions: [".cs"]
@@ -1623,7 +1943,7 @@ function registerBuiltinDialects() {
1623
1943
  ],
1624
1944
  riskTier: "standard",
1625
1945
  factory: (opts) => {
1626
- const { VisionOSCompiler: VisionOSCompiler2 } = (chunk5O6TQC6M_cjs.init_VisionOSCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunk5O6TQC6M_cjs.VisionOSCompiler_exports));
1946
+ const { VisionOSCompiler: VisionOSCompiler2 } = (chunkIVIA7K75_cjs.init_VisionOSCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkIVIA7K75_cjs.VisionOSCompiler_exports));
1627
1947
  return new VisionOSCompiler2(opts);
1628
1948
  },
1629
1949
  outputExtensions: [".swift"]
@@ -1635,7 +1955,7 @@ function registerBuiltinDialects() {
1635
1955
  supportedTraits: ["physics", "hand_tracking", "spatial_anchor", "input", "collidable"],
1636
1956
  riskTier: "standard",
1637
1957
  factory: (opts) => {
1638
- const { AndroidXRCompiler: AndroidXRCompiler2 } = (chunk4XSNJCLC_cjs.init_AndroidXRCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunk4XSNJCLC_cjs.AndroidXRCompiler_exports));
1958
+ const { AndroidXRCompiler: AndroidXRCompiler2 } = (chunkY3MWXQSB_cjs.init_AndroidXRCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkY3MWXQSB_cjs.AndroidXRCompiler_exports));
1639
1959
  return new AndroidXRCompiler2(opts);
1640
1960
  },
1641
1961
  outputExtensions: [".kt"]
@@ -1648,7 +1968,7 @@ function registerBuiltinDialects() {
1648
1968
  supportedTraits: ["physics", "ar_anchor", "animation", "material", "collidable"],
1649
1969
  riskTier: "standard",
1650
1970
  factory: (opts) => {
1651
- const { IOSCompiler: IOSCompiler2 } = (chunkCBJSLA2E_cjs.init_IOSCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkCBJSLA2E_cjs.IOSCompiler_exports));
1971
+ const { IOSCompiler: IOSCompiler2 } = (chunkZ5XMPRNC_cjs.init_IOSCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkZ5XMPRNC_cjs.IOSCompiler_exports));
1652
1972
  return new IOSCompiler2(opts);
1653
1973
  },
1654
1974
  outputExtensions: [".swift"]
@@ -1660,7 +1980,7 @@ function registerBuiltinDialects() {
1660
1980
  supportedTraits: ["physics", "ar_anchor", "animation", "material", "collidable"],
1661
1981
  riskTier: "standard",
1662
1982
  factory: (opts) => {
1663
- const { AndroidCompiler: AndroidCompiler2 } = (chunkNCUKG4SK_cjs.init_AndroidCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkNCUKG4SK_cjs.AndroidCompiler_exports));
1983
+ const { AndroidCompiler: AndroidCompiler2 } = (chunkOEV5RMZO_cjs.init_AndroidCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkOEV5RMZO_cjs.AndroidCompiler_exports));
1664
1984
  return new AndroidCompiler2(opts);
1665
1985
  },
1666
1986
  outputExtensions: [".kt"]
@@ -1672,7 +1992,7 @@ function registerBuiltinDialects() {
1672
1992
  supportedTraits: ["physics", "ar_anchor", "spatial_anchor", "collidable", "material"],
1673
1993
  riskTier: "standard",
1674
1994
  factory: (opts) => {
1675
- const { ARCompiler: ARCompiler2 } = (chunkQ5JT3YML_cjs.init_ARCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkQ5JT3YML_cjs.ARCompiler_exports));
1995
+ const { ARCompiler: ARCompiler2 } = (chunkXXZJEFKW_cjs.init_ARCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkXXZJEFKW_cjs.ARCompiler_exports));
1676
1996
  return new ARCompiler2(opts);
1677
1997
  },
1678
1998
  outputExtensions: [".ts"]
@@ -1685,7 +2005,7 @@ function registerBuiltinDialects() {
1685
2005
  supportedTraits: ["physics", "animation", "audio"],
1686
2006
  riskTier: "high",
1687
2007
  factory: (opts) => {
1688
- const { WASMCompiler: WASMCompiler2 } = (chunk6UEHYZ7V_cjs.init_WASMCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunk6UEHYZ7V_cjs.WASMCompiler_exports));
2008
+ const { WASMCompiler: WASMCompiler2 } = (chunkMXJ5SS53_cjs.init_WASMCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkMXJ5SS53_cjs.WASMCompiler_exports));
1689
2009
  return new WASMCompiler2(opts);
1690
2010
  },
1691
2011
  outputExtensions: [".wasm", ".js"]
@@ -1697,7 +2017,7 @@ function registerBuiltinDialects() {
1697
2017
  supportedTraits: ["physics", "particles", "fluid", "material", "compute"],
1698
2018
  riskTier: "standard",
1699
2019
  factory: (opts) => {
1700
- const { WebGPUCompiler: WebGPUCompiler2 } = (chunkBND3ST2K_cjs.init_WebGPUCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkBND3ST2K_cjs.WebGPUCompiler_exports));
2020
+ const { WebGPUCompiler: WebGPUCompiler2 } = (chunkH3MGK7TX_cjs.init_WebGPUCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkH3MGK7TX_cjs.WebGPUCompiler_exports));
1701
2021
  return new WebGPUCompiler2(opts);
1702
2022
  },
1703
2023
  outputExtensions: [".wgsl", ".ts"]
@@ -1710,7 +2030,7 @@ function registerBuiltinDialects() {
1710
2030
  supportedTraits: ["joint", "actuator", "sensor", "collider", "end_effector"],
1711
2031
  riskTier: "standard",
1712
2032
  factory: (opts) => {
1713
- const { URDFCompiler: URDFCompiler2 } = (chunk6TZPZCOJ_cjs.init_URDFCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunk6TZPZCOJ_cjs.URDFCompiler_exports));
2033
+ const { URDFCompiler: URDFCompiler2 } = (chunkZKSS47EV_cjs.init_URDFCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkZKSS47EV_cjs.URDFCompiler_exports));
1714
2034
  return new URDFCompiler2(opts);
1715
2035
  },
1716
2036
  outputExtensions: [".urdf"]
@@ -1722,7 +2042,7 @@ function registerBuiltinDialects() {
1722
2042
  supportedTraits: ["joint", "actuator", "sensor", "collider", "physics", "environment"],
1723
2043
  riskTier: "standard",
1724
2044
  factory: (opts) => {
1725
- const { SDFCompiler: SDFCompiler2 } = (chunk7AGYRWKW_cjs.init_SDFCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunk7AGYRWKW_cjs.SDFCompiler_exports));
2045
+ const { SDFCompiler: SDFCompiler2 } = (chunkXFXGA5IW_cjs.init_SDFCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkXFXGA5IW_cjs.SDFCompiler_exports));
1726
2046
  return new SDFCompiler2(opts);
1727
2047
  },
1728
2048
  outputExtensions: [".sdf"]
@@ -1734,7 +2054,7 @@ function registerBuiltinDialects() {
1734
2054
  supportedTraits: ["sensor", "telemetry", "property", "command", "relationship"],
1735
2055
  riskTier: "standard",
1736
2056
  factory: (opts) => {
1737
- const { DTDLCompiler: DTDLCompiler2 } = (chunkQLEAOI3Q_cjs.init_DTDLCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkQLEAOI3Q_cjs.DTDLCompiler_exports));
2057
+ const { DTDLCompiler: DTDLCompiler2 } = (chunkGQYKQSTC_cjs.init_DTDLCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkGQYKQSTC_cjs.DTDLCompiler_exports));
1738
2058
  return new DTDLCompiler2(opts);
1739
2059
  },
1740
2060
  outputExtensions: [".json"]
@@ -1747,7 +2067,7 @@ function registerBuiltinDialects() {
1747
2067
  supportedTraits: ["state", "bind", "reactive"],
1748
2068
  riskTier: "standard",
1749
2069
  factory: (opts) => {
1750
- const { StateCompiler: StateCompiler2 } = (chunkB5TCIAPQ_cjs.init_StateCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkB5TCIAPQ_cjs.StateCompiler_exports));
2070
+ const { StateCompiler: StateCompiler2 } = (chunkAO4I2Z7M_cjs.init_StateCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkAO4I2Z7M_cjs.StateCompiler_exports));
1751
2071
  return new StateCompiler2(opts);
1752
2072
  },
1753
2073
  outputExtensions: [".json"]
@@ -1759,7 +2079,7 @@ function registerBuiltinDialects() {
1759
2079
  supportedTraits: ["agent", "skill", "capability"],
1760
2080
  riskTier: "standard",
1761
2081
  factory: (opts) => {
1762
- const { A2AAgentCardCompiler } = (chunkF3HH56EB_cjs.init_A2AAgentCardCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkF3HH56EB_cjs.A2AAgentCardCompiler_exports));
2082
+ const { A2AAgentCardCompiler } = (chunkQWNQ523V_cjs.init_A2AAgentCardCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkQWNQ523V_cjs.A2AAgentCardCompiler_exports));
1763
2083
  return new A2AAgentCardCompiler(opts);
1764
2084
  },
1765
2085
  outputExtensions: [".json"]
@@ -1771,7 +2091,7 @@ function registerBuiltinDialects() {
1771
2091
  supportedTraits: ["snn", "neuron", "synapse", "spike_train"],
1772
2092
  riskTier: "high",
1773
2093
  factory: (opts) => {
1774
- const { NIRCompiler } = (chunkF3HH56EB_cjs.init_NIRCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkF3HH56EB_cjs.NIRCompiler_exports));
2094
+ const { NIRCompiler } = (chunkQWNQ523V_cjs.init_NIRCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunkQWNQ523V_cjs.NIRCompiler_exports));
1775
2095
  return new NIRCompiler(opts);
1776
2096
  },
1777
2097
  outputExtensions: [".json"]
@@ -1783,8 +2103,8 @@ function registerBuiltinDialects() {
1783
2103
  supportedTraits: ["physics", "material", "lod", "rendering"],
1784
2104
  riskTier: "standard",
1785
2105
  factory: (opts) => {
1786
- const { VRRCompiler } = (chunkLGGRPKTV_cjs.init_VRRCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(chunkLGGRPKTV_cjs.VRRCompiler_exports));
1787
- return new VRRCompiler(opts);
2106
+ const { VRRCompiler: VRRCompiler2 } = (chunk52ULD552_cjs.init_VRRCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(chunk52ULD552_cjs.VRRCompiler_exports));
2107
+ return new VRRCompiler2(opts);
1788
2108
  },
1789
2109
  outputExtensions: [".ts"]
1790
2110
  },
@@ -1795,7 +2115,7 @@ function registerBuiltinDialects() {
1795
2115
  supportedTraits: ["layout", "style", "animation", "interaction"],
1796
2116
  riskTier: "standard",
1797
2117
  factory: (opts) => {
1798
- const { Native2DCompiler: Native2DCompiler2 } = (init_Native2DCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(Native2DCompiler_exports));
2118
+ const { Native2DCompiler: Native2DCompiler2 } = (init_Native2DCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(Native2DCompiler_exports));
1799
2119
  return new Native2DCompiler2(opts);
1800
2120
  },
1801
2121
  outputExtensions: [".tsx", ".html"]
@@ -1807,11 +2127,9 @@ function registerBuiltinDialects() {
1807
2127
  description: "Compiles @http traits to Next.js App Router API route handlers (route.ts)",
1808
2128
  supportedTraits: ["http", "handler", "middleware", "auth", "rate_limit", "cors"],
1809
2129
  riskTier: "standard",
1810
- factory: () => {
1811
- const { compileToNextJSAPI: compileToNextJSAPI2 } = (init_NextJSAPICompiler(), chunk3SAK5KFL_cjs.__toCommonJS(NextJSAPICompiler_exports));
1812
- return {
1813
- compile: (composition, _token) => compileToNextJSAPI2(composition)
1814
- };
2130
+ factory: (opts) => {
2131
+ const { NextJSAPICompiler: NextJSAPICompiler2 } = (init_NextJSAPICompiler(), chunkHCCQLAA4_cjs.__toCommonJS(NextJSAPICompiler_exports));
2132
+ return new NextJSAPICompiler2(opts);
1815
2133
  },
1816
2134
  outputExtensions: [".ts"],
1817
2135
  experimental: true
@@ -1833,7 +2151,7 @@ function registerBuiltinDialects() {
1833
2151
  ],
1834
2152
  riskTier: "standard",
1835
2153
  factory: (opts) => {
1836
- const { NodeServiceCompiler: NodeServiceCompiler2 } = (init_NodeServiceCompiler(), chunk3SAK5KFL_cjs.__toCommonJS(NodeServiceCompiler_exports));
2154
+ const { NodeServiceCompiler: NodeServiceCompiler2 } = (init_NodeServiceCompiler(), chunkHCCQLAA4_cjs.__toCommonJS(NodeServiceCompiler_exports));
1837
2155
  return new NodeServiceCompiler2(opts);
1838
2156
  },
1839
2157
  outputExtensions: [".ts", ".js"],
@@ -1847,7 +2165,7 @@ function registerBuiltinDialects() {
1847
2165
  }
1848
2166
  }
1849
2167
  var _registered;
1850
- var init_registerBuiltinDialects = chunk3SAK5KFL_cjs.__esm({
2168
+ var init_registerBuiltinDialects = chunkHCCQLAA4_cjs.__esm({
1851
2169
  "src/compiler/registerBuiltinDialects.ts"() {
1852
2170
  init_DialectRegistry();
1853
2171
  _registered = false;
@@ -1859,13 +2177,13 @@ function ensureDialectsBooted() {
1859
2177
  if (_autoBooted) return;
1860
2178
  _autoBooted = true;
1861
2179
  try {
1862
- const { registerBuiltinDialects: registerBuiltinDialects2 } = (init_registerBuiltinDialects(), chunk3SAK5KFL_cjs.__toCommonJS(registerBuiltinDialects_exports));
2180
+ const { registerBuiltinDialects: registerBuiltinDialects2 } = (init_registerBuiltinDialects(), chunkHCCQLAA4_cjs.__toCommonJS(registerBuiltinDialects_exports));
1863
2181
  registerBuiltinDialects2();
1864
2182
  } catch {
1865
2183
  }
1866
2184
  }
1867
2185
  var DialectRegistryImpl; exports.DialectRegistry = void 0; var _autoBooted;
1868
- var init_DialectRegistry = chunk3SAK5KFL_cjs.__esm({
2186
+ var init_DialectRegistry = chunkHCCQLAA4_cjs.__esm({
1869
2187
  "src/compiler/DialectRegistry.ts"() {
1870
2188
  DialectRegistryImpl = class {
1871
2189
  constructor() {
@@ -2016,29 +2334,31 @@ var init_DialectRegistry = chunk3SAK5KFL_cjs.__esm({
2016
2334
  });
2017
2335
 
2018
2336
  // src/compiler/index.ts
2019
- chunkBF2235SI_cjs.init_CompilerBase();
2020
- chunkBF2235SI_cjs.init_CompilerDocumentationGenerator();
2021
- chunkQ5SJOGHQ_cjs.init_R3FCompiler();
2022
- chunkHE7ULERA_cjs.init_UnityCompiler();
2023
- chunkXXINBTZK_cjs.init_GodotCompiler();
2024
- chunk33LSUQDD_cjs.init_BabylonCompiler();
2025
- chunkXWPNTWDN_cjs.init_PlayCanvasCompiler();
2026
- chunkQ5JT3YML_cjs.init_ARCompiler();
2027
- chunkFFKU7BTK_cjs.init_OpenXRCompiler();
2028
- chunkZ34RLXRA_cjs.init_VRChatCompiler();
2029
- chunk5O6TQC6M_cjs.init_VisionOSCompiler();
2030
- chunkNCUKG4SK_cjs.init_AndroidCompiler();
2031
- chunk4XSNJCLC_cjs.init_AndroidXRCompiler();
2032
- chunkCBJSLA2E_cjs.init_IOSCompiler();
2033
- chunk6UEHYZ7V_cjs.init_WASMCompiler();
2034
- chunkBND3ST2K_cjs.init_WebGPUCompiler();
2035
- chunk7AGYRWKW_cjs.init_SDFCompiler();
2036
- chunkQLEAOI3Q_cjs.init_DTDLCompiler();
2037
- chunk6TZPZCOJ_cjs.init_URDFCompiler();
2038
- chunkB5TCIAPQ_cjs.init_StateCompiler();
2337
+ chunkRMHC2VG7_cjs.init_CompilerBase();
2338
+ chunkRMHC2VG7_cjs.init_CompilerDocumentationGenerator();
2339
+ chunkBPICAGBV_cjs.init_R3FCompiler();
2340
+ chunkKQTPCYTG_cjs.init_UnityCompiler();
2341
+ chunkDIL6DDDN_cjs.init_GodotCompiler();
2342
+ chunkL63H3SQ4_cjs.init_BabylonCompiler();
2343
+ chunkMJVIRCUV_cjs.init_PlayCanvasCompiler();
2344
+ chunkXXZJEFKW_cjs.init_ARCompiler();
2345
+ chunkKHPCJRI3_cjs.init_OpenXRCompiler();
2346
+ chunkHANL7K2Q_cjs.init_VRChatCompiler();
2347
+ chunk52ULD552_cjs.init_VRRCompiler();
2348
+ chunkIVIA7K75_cjs.init_VisionOSCompiler();
2349
+ chunkOEV5RMZO_cjs.init_AndroidCompiler();
2350
+ chunkY3MWXQSB_cjs.init_AndroidXRCompiler();
2351
+ chunkZ5XMPRNC_cjs.init_IOSCompiler();
2352
+ chunkMXJ5SS53_cjs.init_WASMCompiler();
2353
+ chunkH3MGK7TX_cjs.init_WebGPUCompiler();
2354
+ chunkAIA52I7T_cjs.init_PlatformConditionalCompilerMixin();
2355
+ chunkXFXGA5IW_cjs.init_SDFCompiler();
2356
+ chunkGQYKQSTC_cjs.init_DTDLCompiler();
2357
+ chunkZKSS47EV_cjs.init_URDFCompiler();
2358
+ chunkAO4I2Z7M_cjs.init_StateCompiler();
2039
2359
 
2040
2360
  // src/compiler/NextJSCompiler.ts
2041
- chunkBF2235SI_cjs.init_CompilerBase();
2361
+ chunkRMHC2VG7_cjs.init_CompilerBase();
2042
2362
  init_Native2DCompiler();
2043
2363
  function findTrait(composition, traitName) {
2044
2364
  const traits = composition.traits;
@@ -2046,7 +2366,7 @@ function findTrait(composition, traitName) {
2046
2366
  const found = traits.find((t) => t.name === traitName);
2047
2367
  return found?.config || null;
2048
2368
  }
2049
- var NextJSCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
2369
+ var NextJSCompiler = class extends chunkRMHC2VG7_cjs.CompilerBase {
2050
2370
  constructor(options = {}) {
2051
2371
  super();
2052
2372
  this.options = options;
@@ -2153,9 +2473,9 @@ var NextJSCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
2153
2473
  init_NextJSAPICompiler();
2154
2474
 
2155
2475
  // src/compiler/MCPConfigCompiler.ts
2156
- chunkBF2235SI_cjs.init_CompilerBase();
2476
+ chunkRMHC2VG7_cjs.init_CompilerBase();
2157
2477
  init_DialectRegistry();
2158
- var MCPConfigCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
2478
+ var MCPConfigCompiler = class extends chunkRMHC2VG7_cjs.CompilerBase {
2159
2479
  constructor(options = {}) {
2160
2480
  super();
2161
2481
  this.compilerName = "MCPConfigCompiler";
@@ -2191,7 +2511,7 @@ var MCPConfigCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
2191
2511
  extractServersFromBlock(block) {
2192
2512
  if (!block.children) return;
2193
2513
  for (const child of block.children) {
2194
- if ("type" in child && child.type === "ObjectDecl") {
2514
+ if ("type" in child && child.type === "Object") {
2195
2515
  const obj = child;
2196
2516
  this.servers.push(this.extractServerFromObject(obj));
2197
2517
  }
@@ -2238,6 +2558,11 @@ var MCPConfigCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
2238
2558
  }
2239
2559
  const config = {
2240
2560
  _generated: "HoloScript MCPConfigCompiler",
2561
+ _configKind: "mcp-client-connection-config",
2562
+ _limitations: [
2563
+ "emits IDE client mcpServers connection entries only",
2564
+ "does not emit MCP server manifests, tools, input schemas, or resources"
2565
+ ],
2241
2566
  _target: this.options.target,
2242
2567
  _updated: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
2243
2568
  mcpServers
@@ -2347,106 +2672,2997 @@ var MCPConfigCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
2347
2672
  exports.DialectRegistry.register({
2348
2673
  name: "mcp-config",
2349
2674
  domain: "configuration",
2350
- description: "Compiles .holo server definitions to IDE-specific MCP config JSON",
2675
+ description: "Compiles .holo MCP server connection definitions to IDE-specific client config JSON",
2351
2676
  supportedTraits: ["connector", "env"],
2677
+ riskTier: "standard",
2352
2678
  factory: (options) => new MCPConfigCompiler(options),
2353
- inputFormats: [".holo"],
2354
- outputFormat: ".json"
2679
+ outputExtensions: [".json"]
2355
2680
  });
2356
2681
 
2357
2682
  // src/compiler/index.ts
2683
+ chunkAIA52I7T_cjs.init_PlatformConditionalCompilerMixin();
2358
2684
  init_Native2DCompiler();
2685
+
2686
+ // src/compiler/SCMCompiler.ts
2687
+ chunkRMHC2VG7_cjs.init_CompilerBase();
2688
+ var SCMCompiler = class extends chunkRMHC2VG7_cjs.CompilerBase {
2689
+ constructor(options = {}) {
2690
+ super();
2691
+ this.compilerName = "SCMCompiler";
2692
+ this.nodes = [];
2693
+ this.edges = [];
2694
+ this.options = {
2695
+ modelName: options.modelName || "HoloScript_SCM_DAG",
2696
+ affectiveContext: options.affectiveContext || {
2697
+ valence: 0,
2698
+ arousal: 0,
2699
+ dominantEmotion: "calm"
2700
+ },
2701
+ privacyMask: options.privacyMask || false
2702
+ };
2703
+ }
2704
+ getRequiredCapability() {
2705
+ return ans.ANSCapabilityPath.SCM;
2706
+ }
2707
+ // Helper to extract traits consistently
2708
+ getTraitName(trait) {
2709
+ return typeof trait === "string" ? trait : trait.name;
2710
+ }
2711
+ hasTrait(obj, traitName) {
2712
+ return obj.traits?.some((t) => this.getTraitName(t) === traitName) ?? false;
2713
+ }
2714
+ compile(composition, agentToken, outputPath) {
2715
+ this.validateCompilerAccess(agentToken, outputPath);
2716
+ this.nodes = [];
2717
+ this.edges = [];
2718
+ this.extractNodes(composition);
2719
+ this.extractEdges(composition);
2720
+ this.applyAffectivePruning();
2721
+ this.applyPrivacyMask();
2722
+ const dag = {
2723
+ metadata: {
2724
+ model_name: this.options.modelName,
2725
+ generated_at: (/* @__PURE__ */ new Date()).toISOString(),
2726
+ affective_context: this.options.affectiveContext
2727
+ },
2728
+ nodes: this.nodes,
2729
+ edges: this.edges
2730
+ };
2731
+ return JSON.stringify(dag, null, 2);
2732
+ }
2733
+ applyAffectivePruning() {
2734
+ const state = this.options.affectiveContext;
2735
+ if (state.dominantEmotion === "frustrated" || state.dominantEmotion === "anxious") {
2736
+ this.nodes = this.nodes.filter(
2737
+ (n) => n.do_capable || n.properties.context_group === "global"
2738
+ );
2739
+ this.edges = this.edges.filter((e) => {
2740
+ const targetNode = this.nodes.find((n) => n.id === e.target);
2741
+ return targetNode && (targetNode.do_capable === true || e.weight > 1);
2742
+ });
2743
+ }
2744
+ if (state.dominantEmotion === "engaged") {
2745
+ this.edges = this.edges.map((e) => ({
2746
+ ...e,
2747
+ weight: e.weight * 1.5
2748
+ // Engaged awareness strengthens correlations
2749
+ }));
2750
+ }
2751
+ }
2752
+ applyPrivacyMask() {
2753
+ if (!this.options.privacyMask) return;
2754
+ const idMap = /* @__PURE__ */ new Map();
2755
+ let counter = 0;
2756
+ for (const node of this.nodes) {
2757
+ if (!idMap.has(node.id)) {
2758
+ idMap.set(node.id, `NODE_${counter++}`);
2759
+ }
2760
+ node.id = idMap.get(node.id);
2761
+ node.properties = {};
2762
+ }
2763
+ for (const edge of this.edges) {
2764
+ edge.source = idMap.get(edge.source) || `UNKNOWN_${counter++}`;
2765
+ edge.target = idMap.get(edge.target) || `UNKNOWN_${counter++}`;
2766
+ }
2767
+ }
2768
+ extractNodes(composition) {
2769
+ if (composition.objects) {
2770
+ for (const obj of composition.objects) {
2771
+ this.processNode(obj, "global");
2772
+ }
2773
+ }
2774
+ if (composition.spatialGroups) {
2775
+ for (const group of composition.spatialGroups) {
2776
+ if (group.objects) {
2777
+ for (const obj of group.objects) {
2778
+ this.processNode(obj, group.name);
2779
+ }
2780
+ }
2781
+ }
2782
+ }
2783
+ }
2784
+ processNode(obj, contextGroup) {
2785
+ const isInterventionCapable = this.hasTrait(obj, "ai_agent") || this.hasTrait(obj, "interactive") || this.hasTrait(obj, "causal");
2786
+ const node = {
2787
+ id: obj.name,
2788
+ type: isInterventionCapable ? "mechanism_variable" : "static_variable",
2789
+ do_capable: isInterventionCapable,
2790
+ properties: {
2791
+ context_group: contextGroup
2792
+ }
2793
+ };
2794
+ for (const prop of obj.properties) {
2795
+ if (typeof prop.value === "number" || typeof prop.value === "string" || typeof prop.value === "boolean") {
2796
+ node.properties[prop.key] = prop.value;
2797
+ }
2798
+ }
2799
+ this.nodes.push(node);
2800
+ }
2801
+ extractEdges(composition) {
2802
+ if (composition.spatialGroups) {
2803
+ for (const group of composition.spatialGroups) {
2804
+ if (group.objects) {
2805
+ for (const childObj of group.objects) {
2806
+ this.edges.push({
2807
+ source: group.name,
2808
+ target: childObj.name,
2809
+ relation: "dictates_context",
2810
+ weight: 1
2811
+ });
2812
+ }
2813
+ }
2814
+ }
2815
+ }
2816
+ }
2817
+ };
2818
+
2819
+ // src/compiler/social-causality.ts
2820
+ var DEFAULT_THRESHOLD = 0.5;
2821
+ var EDGE_KEY = (e) => `${e.source}\0${e.target}\0${e.relation}`;
2822
+ function mergeSocialCausalModels(agentDags, options = {}) {
2823
+ const threshold = options.consensusThreshold ?? DEFAULT_THRESHOLD;
2824
+ if (threshold <= 0 || threshold > 1) {
2825
+ throw new RangeError(
2826
+ `consensusThreshold must be in (0, 1]; got ${threshold}`
2827
+ );
2828
+ }
2829
+ const agentCount = agentDags.length;
2830
+ const minObservers = Math.min(
2831
+ agentCount,
2832
+ Math.floor(threshold * agentCount) + 1
2833
+ );
2834
+ if (agentCount === 0) {
2835
+ return {
2836
+ dag: emptyDag(options.modelName),
2837
+ report: {
2838
+ agents: 0,
2839
+ threshold,
2840
+ nodes: { kept: 0, dropped: 0 },
2841
+ edges: { kept: 0, dropped: 0, smoothed: 0 }
2842
+ }
2843
+ };
2844
+ }
2845
+ const nodeObservers = /* @__PURE__ */ new Map();
2846
+ const nodeRepresentative = /* @__PURE__ */ new Map();
2847
+ for (const dag of agentDags) {
2848
+ const seenInThisAgent = /* @__PURE__ */ new Set();
2849
+ for (const node of dag.nodes) {
2850
+ if (seenInThisAgent.has(node.id)) continue;
2851
+ seenInThisAgent.add(node.id);
2852
+ nodeObservers.set(node.id, (nodeObservers.get(node.id) ?? 0) + 1);
2853
+ if (!nodeRepresentative.has(node.id)) {
2854
+ nodeRepresentative.set(node.id, node);
2855
+ }
2856
+ }
2857
+ }
2858
+ const consensusNodes = [];
2859
+ let nodesDropped = 0;
2860
+ for (const [id, count] of nodeObservers) {
2861
+ if (count >= minObservers) {
2862
+ consensusNodes.push(cloneNode(nodeRepresentative.get(id)));
2863
+ } else {
2864
+ nodesDropped += 1;
2865
+ }
2866
+ }
2867
+ const consensusNodeIds = new Set(consensusNodes.map((n) => n.id));
2868
+ const edgeAccumulators = /* @__PURE__ */ new Map();
2869
+ for (const dag of agentDags) {
2870
+ const seenInThisAgent = /* @__PURE__ */ new Set();
2871
+ for (const edge of dag.edges) {
2872
+ const key = EDGE_KEY(edge);
2873
+ if (seenInThisAgent.has(key)) continue;
2874
+ seenInThisAgent.add(key);
2875
+ let acc = edgeAccumulators.get(key);
2876
+ if (!acc) {
2877
+ acc = {
2878
+ template: edge,
2879
+ weights: [],
2880
+ observers: 0,
2881
+ distinctWeights: /* @__PURE__ */ new Set()
2882
+ };
2883
+ edgeAccumulators.set(key, acc);
2884
+ }
2885
+ acc.weights.push(edge.weight);
2886
+ acc.distinctWeights.add(edge.weight);
2887
+ acc.observers += 1;
2888
+ }
2889
+ }
2890
+ const consensusEdges = [];
2891
+ let edgesDropped = 0;
2892
+ let edgesSmoothed = 0;
2893
+ for (const [, acc] of edgeAccumulators) {
2894
+ if (acc.observers < minObservers) {
2895
+ edgesDropped += 1;
2896
+ continue;
2897
+ }
2898
+ if (!consensusNodeIds.has(acc.template.source) || !consensusNodeIds.has(acc.template.target)) {
2899
+ edgesDropped += 1;
2900
+ continue;
2901
+ }
2902
+ const smoothed = acc.distinctWeights.size > 1;
2903
+ if (smoothed) edgesSmoothed += 1;
2904
+ consensusEdges.push({
2905
+ source: acc.template.source,
2906
+ target: acc.template.target,
2907
+ relation: acc.template.relation,
2908
+ weight: average(acc.weights)
2909
+ });
2910
+ }
2911
+ return {
2912
+ dag: {
2913
+ metadata: {
2914
+ model_name: options.modelName ?? "Social_Consensus_DAG",
2915
+ generated_at: (/* @__PURE__ */ new Date()).toISOString()
2916
+ },
2917
+ nodes: consensusNodes,
2918
+ edges: consensusEdges
2919
+ },
2920
+ report: {
2921
+ agents: agentCount,
2922
+ threshold,
2923
+ nodes: { kept: consensusNodes.length, dropped: nodesDropped },
2924
+ edges: {
2925
+ kept: consensusEdges.length,
2926
+ dropped: edgesDropped,
2927
+ smoothed: edgesSmoothed
2928
+ }
2929
+ }
2930
+ };
2931
+ }
2932
+ function average(xs) {
2933
+ let sum = 0;
2934
+ for (const x of xs) sum += x;
2935
+ return sum / xs.length;
2936
+ }
2937
+ function cloneNode(node) {
2938
+ return {
2939
+ id: node.id,
2940
+ type: node.type,
2941
+ do_capable: node.do_capable,
2942
+ properties: { ...node.properties }
2943
+ };
2944
+ }
2945
+ function emptyDag(modelName) {
2946
+ return {
2947
+ metadata: {
2948
+ model_name: modelName ?? "Social_Consensus_DAG",
2949
+ generated_at: (/* @__PURE__ */ new Date()).toISOString()
2950
+ },
2951
+ nodes: [],
2952
+ edges: []
2953
+ };
2954
+ }
2955
+
2956
+ // src/compiler/social-causality-byzantine.ts
2957
+ var DEFAULT_OUTLIER_SIGMA = 1.5;
2958
+ var DEFAULT_DECAY = 0.1;
2959
+ var DEFAULT_DROP_THRESHOLD = 0.3;
2960
+ var DEFAULT_MIN_CLUSTER = 3;
2961
+ var EDGE_KEY2 = (e) => `${e.source} ${e.target} ${e.relation}`;
2962
+ var AgentTrustLedger = class {
2963
+ constructor() {
2964
+ this.entries = /* @__PURE__ */ new Map();
2965
+ }
2966
+ /**
2967
+ * Get a snapshot of an agent's trust state. Returns undefined if the
2968
+ * agent has never been observed.
2969
+ */
2970
+ get(agentId) {
2971
+ const e = this.entries.get(agentId);
2972
+ return e ? { ...e } : void 0;
2973
+ }
2974
+ /**
2975
+ * Get a snapshot of every agent's trust state. Mutating the returned
2976
+ * object does NOT mutate the ledger.
2977
+ */
2978
+ snapshot() {
2979
+ const out = {};
2980
+ for (const [id, e] of this.entries) out[id] = { ...e };
2981
+ return out;
2982
+ }
2983
+ /**
2984
+ * Forget an agent's history entirely. Use to pardon an agent that was
2985
+ * dropped — see "Recovery semantics" in the file header.
2986
+ */
2987
+ reset(agentId) {
2988
+ this.entries.delete(agentId);
2989
+ }
2990
+ /** Forget every agent. */
2991
+ resetAll() {
2992
+ this.entries.clear();
2993
+ }
2994
+ /** @internal — used by {@link byzantineResilientMerge}. */
2995
+ observe(agentId, hostileThisEpoch, decay) {
2996
+ let e = this.entries.get(agentId);
2997
+ if (!e) {
2998
+ e = { score: 1, epochs: 0, hostileEpochs: 0 };
2999
+ this.entries.set(agentId, e);
3000
+ }
3001
+ e.epochs += 1;
3002
+ if (hostileThisEpoch) {
3003
+ e.hostileEpochs += 1;
3004
+ e.score = Math.max(0, e.score - decay);
3005
+ }
3006
+ }
3007
+ /** @internal — used by {@link byzantineResilientMerge}. */
3008
+ isTrusted(agentId, threshold) {
3009
+ const e = this.entries.get(agentId);
3010
+ if (!e) return true;
3011
+ return e.score >= threshold;
3012
+ }
3013
+ };
3014
+ function byzantineResilientMerge(agentDags, ledger, options = {}) {
3015
+ const sigma = options.outlierSigma ?? DEFAULT_OUTLIER_SIGMA;
3016
+ const decay = options.decayPerEpoch ?? DEFAULT_DECAY;
3017
+ const dropThreshold = options.dropThreshold ?? DEFAULT_DROP_THRESHOLD;
3018
+ const minCluster = options.minClusterAgents ?? DEFAULT_MIN_CLUSTER;
3019
+ if (sigma <= 0) {
3020
+ throw new RangeError(`outlierSigma must be > 0; got ${sigma}`);
3021
+ }
3022
+ if (decay < 0 || decay > 1) {
3023
+ throw new RangeError(`decayPerEpoch must be in [0, 1]; got ${decay}`);
3024
+ }
3025
+ if (dropThreshold < 0 || dropThreshold > 1) {
3026
+ throw new RangeError(
3027
+ `dropThreshold must be in [0, 1]; got ${dropThreshold}`
3028
+ );
3029
+ }
3030
+ if (minCluster < 2 || !Number.isInteger(minCluster)) {
3031
+ throw new RangeError(
3032
+ `minClusterAgents must be an integer >= 2; got ${minCluster}`
3033
+ );
3034
+ }
3035
+ const agentIds = /* @__PURE__ */ new Map();
3036
+ const seenIds = /* @__PURE__ */ new Set();
3037
+ agentDags.forEach((dag, idx) => {
3038
+ let id = dag.metadata.model_name?.trim();
3039
+ if (!id || seenIds.has(id)) {
3040
+ id = `agent#${idx}`;
3041
+ }
3042
+ seenIds.add(id);
3043
+ agentIds.set(dag, id);
3044
+ });
3045
+ const edgeObservations = /* @__PURE__ */ new Map();
3046
+ for (const dag of agentDags) {
3047
+ const agentId = agentIds.get(dag);
3048
+ const seenInThisAgent = /* @__PURE__ */ new Set();
3049
+ for (const edge of dag.edges) {
3050
+ const key = EDGE_KEY2(edge);
3051
+ if (seenInThisAgent.has(key)) continue;
3052
+ seenInThisAgent.add(key);
3053
+ const obs = edgeObservations.get(key) ?? [];
3054
+ obs.push({ agentId, weight: edge.weight });
3055
+ edgeObservations.set(key, obs);
3056
+ }
3057
+ }
3058
+ const outliersByEdge = {};
3059
+ const hostileThisEpoch = /* @__PURE__ */ new Set();
3060
+ for (const [edgeKey, obs] of edgeObservations) {
3061
+ if (obs.length < minCluster) continue;
3062
+ const mean2 = obs.reduce((s, o) => s + o.weight, 0) / obs.length;
3063
+ const variance = obs.reduce((s, o) => s + (o.weight - mean2) ** 2, 0) / obs.length;
3064
+ const std = Math.sqrt(variance);
3065
+ if (std === 0) continue;
3066
+ const cutoff = sigma * std;
3067
+ const outliers = [];
3068
+ for (const o of obs) {
3069
+ if (Math.abs(o.weight - mean2) > cutoff) {
3070
+ outliers.push(o.agentId);
3071
+ hostileThisEpoch.add(o.agentId);
3072
+ }
3073
+ }
3074
+ if (outliers.length > 0) outliersByEdge[edgeKey] = outliers;
3075
+ }
3076
+ const seenThisEpoch = /* @__PURE__ */ new Set();
3077
+ for (const dag of agentDags) {
3078
+ const agentId = agentIds.get(dag);
3079
+ if (seenThisEpoch.has(agentId)) continue;
3080
+ seenThisEpoch.add(agentId);
3081
+ ledger.observe(agentId, hostileThisEpoch.has(agentId), decay);
3082
+ }
3083
+ const dropped = [];
3084
+ const survivors = [];
3085
+ for (const dag of agentDags) {
3086
+ const agentId = agentIds.get(dag);
3087
+ if (ledger.isTrusted(agentId, dropThreshold)) {
3088
+ survivors.push(dag);
3089
+ } else {
3090
+ dropped.push(agentId);
3091
+ }
3092
+ }
3093
+ const merged = mergeSocialCausalModels(survivors, options);
3094
+ return {
3095
+ dag: merged.dag,
3096
+ report: {
3097
+ ledger: ledger.snapshot(),
3098
+ dropped: Array.from(new Set(dropped)),
3099
+ flaggedThisEpoch: Array.from(hostileThisEpoch),
3100
+ outliersByEdge,
3101
+ consensus: merged.report
3102
+ }
3103
+ };
3104
+ }
3105
+
3106
+ // src/compiler/index.ts
2359
3107
  init_NodeServiceCompiler();
2360
3108
  init_DialectRegistry();
2361
3109
  init_registerBuiltinDialects();
2362
3110
 
2363
- Object.defineProperty(exports, "createReproducibilityContext", {
2364
- enumerable: true,
2365
- get: function () { return chunkVJ3L7CHT_cjs.createReproducibilityContext; }
2366
- });
2367
- Object.defineProperty(exports, "parseReproducibilityFlags", {
2368
- enumerable: true,
2369
- get: function () { return chunkVJ3L7CHT_cjs.parseReproducibilityFlags; }
2370
- });
2371
- Object.defineProperty(exports, "GLTF_PIPELINE_TOOLS", {
2372
- enumerable: true,
2373
- get: function () { return chunkKSGXLT74_cjs.GLTF_PIPELINE_TOOLS; }
2374
- });
2375
- Object.defineProperty(exports, "registerGLTFTools", {
2376
- enumerable: true,
2377
- get: function () { return chunkKSGXLT74_cjs.registerGLTFTools; }
2378
- });
2379
- Object.defineProperty(exports, "NodeToyMapper", {
2380
- enumerable: true,
2381
- get: function () { return chunk27LWW5FU_cjs.NodeToyMapper; }
2382
- });
2383
- Object.defineProperty(exports, "mapNodeToyToShader", {
2384
- enumerable: true,
2385
- get: function () { return chunk27LWW5FU_cjs.mapNodeToyToShader; }
2386
- });
3111
+ // src/compiler/FlatSemanticCompiler.ts
3112
+ chunkRMHC2VG7_cjs.init_CompilerBase();
3113
+ function isFlatSemanticCompilerOptions(value) {
3114
+ if (!value || typeof value !== "object") return false;
3115
+ return "format" in value || "generateDocs" in value || "docsOptions" in value || "provenanceHash" in value;
3116
+ }
3117
+ var FlatSemanticCompiler = class extends chunkRMHC2VG7_cjs.CompilerBase {
3118
+ constructor() {
3119
+ super(...arguments);
3120
+ this.compilerName = "FlatSemanticCompiler";
3121
+ }
3122
+ compile(composition, agentToken, outputPath, sceneGraphOrOptions, options) {
3123
+ this.validateCompilerAccess(agentToken, outputPath);
3124
+ const compileOptions = options ?? (isFlatSemanticCompilerOptions(sceneGraphOrOptions) ? sceneGraphOrOptions : void 0);
3125
+ const elements = composition.ui?.elements || composition.objects || [];
3126
+ const traits = this.extractTraits(composition);
3127
+ const canvasConfig = traits["2d_canvas"] || {};
3128
+ const code = this.generateReactComponent(composition.name, elements, canvasConfig);
3129
+ if (compileOptions?.generateDocs) {
3130
+ return {
3131
+ output: code,
3132
+ documentation: this.generateDocumentation(composition, code, compileOptions.docsOptions)
3133
+ };
3134
+ }
3135
+ return code;
3136
+ }
3137
+ extractTraits(obj) {
3138
+ const map = {};
3139
+ if (!obj.traits) return map;
3140
+ for (const t of obj.traits) {
3141
+ map[t.name] = t.config || {};
3142
+ }
3143
+ return map;
3144
+ }
3145
+ // ============================================================================
3146
+ // CODE GENERATION
3147
+ // ============================================================================
3148
+ generateReactComponent(name, objects, _canvasConfig) {
3149
+ const safeName = name.replace(/[^a-zA-Z0-9]/g, "");
3150
+ const semanticNodes = objects.map((obj) => this.generateSemanticNode(obj)).join("\n ");
3151
+ return `import React, { useRef, useState, useEffect } from 'react';
3152
+ import { Canvas, useFrame } from '@react-three/fiber';
3153
+ import { Html, Float, Sparkles, MeshDistortMaterial } from '@react-three/drei';
3154
+
3155
+ /**
3156
+ * HoloScript V6 2D UI Revolution
3157
+ * Flat-Semantic Projection of: ${name}
3158
+ *
3159
+ * Auto-generated by FlatSemanticCompiler
3160
+ */
3161
+
3162
+ // Procedural Field Background Component
3163
+ function ProceduralField({ turbulence = 0.3, intensity = 1.0 }) {
3164
+ const meshRef = useRef<any>(null);
3165
+ useFrame((state) => {
3166
+ if (meshRef.current) {
3167
+ meshRef.current.rotation.x = state.clock.getElapsedTime() * 0.1 * turbulence;
3168
+ meshRef.current.rotation.y = state.clock.getElapsedTime() * 0.15 * turbulence;
3169
+ }
3170
+ });
3171
+
3172
+ return (
3173
+ <mesh ref={meshRef} scale={[15, 15, 1]} position={[0, 0, -5]}>
3174
+ <planeGeometry args={[2, 2, 32, 32]} />
3175
+ <MeshDistortMaterial
3176
+ color="#1a0b2e"
3177
+ emissive="#0a0515"
3178
+ distort={turbulence}
3179
+ speed={intensity * 2}
3180
+ roughness={0.2}
3181
+ />
3182
+ <Sparkles count={100} scale={20} size={2} color="#8b5cf6" speed={0.4} opacity={0.5} />
3183
+ </mesh>
3184
+ );
3185
+ }
3186
+
3187
+ export function ${safeName}Component() {
3188
+ const [bountyPools, setBountyPools] = useState<Record<string, number>>({});
3189
+
3190
+ return (
3191
+ <div className="holoscript-v6-root w-full h-screen bg-[#050505] overflow-hidden text-white font-sans">
3192
+ <Canvas orthographic camera={{ zoom: 100, position: [0, 0, 100] }}>
3193
+ <ambientLight intensity={0.5} />
3194
+ <directionalLight position={[10, 10, 5]} intensity={1} />
3195
+
3196
+ {/* Simulation Layer */}
3197
+ <ProceduralField turbulence={0.3} intensity={1.0} />
3198
+
3199
+ {/* Semantic 2D Projection Layer */}
3200
+ <Html fullscreen zIndexRange={[100, 0]} className="pointer-events-none">
3201
+ <div className="w-full h-full relative pointer-events-auto overflow-y-auto">
3202
+ ${semanticNodes}
3203
+ </div>
3204
+ </Html>
3205
+ </Canvas>
3206
+ </div>
3207
+ );
3208
+ }
3209
+
3210
+ export default ${safeName}Component;
3211
+ `;
3212
+ }
3213
+ generateSemanticNode(obj) {
3214
+ const traits = this.extractTraits(obj);
3215
+ !!traits["semantic_entity"];
3216
+ const type = traits["semantic_entity"]?.type || "generic";
3217
+ let classes = "relative ";
3218
+ if (traits.tailwind?.classes) classes += traits.tailwind.classes + " ";
3219
+ const layout = traits["semantic_layout"];
3220
+ if (layout) {
3221
+ const flow = layout.flow || "semantic";
3222
+ if (flow === "cluster") classes += "flex flex-wrap gap-4 justify-center items-center ";
3223
+ else if (flow === "priority") classes += "flex flex-col gap-3 ";
3224
+ else if (flow === "radial")
3225
+ classes += "grid place-items-center gap-4 p-8 rounded-full border border-white/10 ";
3226
+ else classes += "flex flex-row gap-4 items-start ";
3227
+ const spacing = layout.spacing || 12;
3228
+ classes += `p-[${spacing}px] `;
3229
+ }
3230
+ const hasSwarm = !!traits["agent_attention"];
3231
+ let rawChildren = obj.children || obj.objects || [];
3232
+ if (rawChildren.length === 0 && traits["semantic_entity"]?.children) {
3233
+ rawChildren = traits["semantic_entity"].children;
3234
+ }
3235
+ const childrenMarkup = rawChildren.map((child) => this.generateSemanticNode(child)).join("\n");
3236
+ let content = traits.text?.content || "";
3237
+ if (content)
3238
+ content = "{`" + content.replace(new RegExp("`", "g"), "\\`").replace(/\\$/g, "\\\\$") + "`}";
3239
+ if (type === "data-cluster" || type === "section") {
3240
+ return '<section className="' + classes + '">\n' + content + "\n" + childrenMarkup + "\n</section>";
3241
+ }
3242
+ if (type === "metric-card") {
3243
+ return '<div className="lift-card p-6 bg-white/5 border border-white/10 rounded-xl hover:bg-white/10 transition-all ' + classes + '">\n' + content + "\n" + childrenMarkup + "\n</div>";
3244
+ }
3245
+ let interactionProps = "";
3246
+ if (traits["agent_attention"] && traits["agent_attention"].bounty_threshold) {
3247
+ interactionProps = " onClick={() => alert('Bounty Negotiated: " + traits["agent_attention"].bounty_threshold + " credits')} ";
3248
+ } else if (traits["intent_driven"]) {
3249
+ interactionProps = " onClick={() => console.log('Intent Emitted: " + (traits["intent_driven"].intents?.[0] || "action") + "')} ";
3250
+ }
3251
+ if (traits.link || type === "link") {
3252
+ return '<a href="' + (traits.link?.href || "#") + '" className="' + classes + '"' + interactionProps + ">\n" + content + "\n" + childrenMarkup + "\n</a>";
3253
+ }
3254
+ if (traits.image) {
3255
+ return '<img src="' + traits.image.src + '" className="' + classes + '" alt="' + (traits.image.alt || "") + '" />';
3256
+ }
3257
+ const swarmHtml = hasSwarm ? '<div className="text-xs text-purple-400 mt-2 font-mono flex items-center gap-2"><span className="w-2 h-2 rounded-full bg-purple-500 animate-pulse"></span> Agent Swarm Active</div>' : "";
3258
+ return '<div className="' + classes + '"' + interactionProps + ">\n" + content + "\n" + swarmHtml + "\n" + childrenMarkup + "\n</div>";
3259
+ }
3260
+ };
3261
+
3262
+ // src/compiler/dispatch/DispatchPolicy.ts
3263
+ var DispatchTier = /* @__PURE__ */ ((DispatchTier2) => {
3264
+ DispatchTier2["TIER_1_NEUROMORPHIC"] = "tier-1-neuromorphic";
3265
+ DispatchTier2["TIER_1_BROWSER"] = "tier-1-browser";
3266
+ DispatchTier2["TIER_1_WASM"] = "tier-1-wasm";
3267
+ DispatchTier2["TIER_2_SPECULATIVE"] = "tier-2-speculative";
3268
+ DispatchTier2["TIER_3_CPU_DIRECT"] = "tier-3-cpu-direct";
3269
+ return DispatchTier2;
3270
+ })(DispatchTier || {});
3271
+ var AlphaTracker = class {
3272
+ constructor(size = 50) {
3273
+ this.window = [];
3274
+ this.size = size;
3275
+ }
3276
+ recordAttempt(success) {
3277
+ this.window.push(success);
3278
+ if (this.window.length > this.size) {
3279
+ this.window.shift();
3280
+ }
3281
+ }
3282
+ getAlpha() {
3283
+ if (this.window.length === 0) return 0;
3284
+ const successes = this.window.filter((s) => s).length;
3285
+ return successes / this.window.length;
3286
+ }
3287
+ get windowLength() {
3288
+ return this.window.length;
3289
+ }
3290
+ };
3291
+ var DispatchPolicy = class {
3292
+ constructor(config = {}) {
3293
+ this.config = {
3294
+ tier1BrowserEnabled: false,
3295
+ tier1WasmEnabled: false,
3296
+ tier1NeuromorphicEnabled: false,
3297
+ tier2Enabled: false,
3298
+ tier2AlphaThreshold: 0.85,
3299
+ alphaWindowSize: 50,
3300
+ ...config
3301
+ };
3302
+ this.alphaTracker = new AlphaTracker(this.config.alphaWindowSize);
3303
+ }
3304
+ /**
3305
+ * Route an operation to the highest viable tier, falling back as needed.
3306
+ */
3307
+ async route(op) {
3308
+ const start = performance.now();
3309
+ let lastRejectionReason;
3310
+ let lastRejectionMetrics;
3311
+ if (this.config.tier1NeuromorphicEnabled) {
3312
+ const decision2 = await this.tryTier1Neuromorphic(op);
3313
+ if (decision2.accepted) {
3314
+ decision2.metrics.latencyEstimateMs = performance.now() - start;
3315
+ return decision2;
3316
+ }
3317
+ lastRejectionReason = decision2.metrics.fallbackReason;
3318
+ lastRejectionMetrics = {
3319
+ neuromorphicProbe: decision2.metrics.neuromorphicProbe
3320
+ };
3321
+ }
3322
+ if (this.config.tier1BrowserEnabled) {
3323
+ const decision2 = await this.tryTier1Browser(op);
3324
+ if (decision2.accepted) {
3325
+ decision2.metrics.latencyEstimateMs = performance.now() - start;
3326
+ return decision2;
3327
+ }
3328
+ lastRejectionReason = decision2.metrics.fallbackReason;
3329
+ lastRejectionMetrics = void 0;
3330
+ }
3331
+ if (this.config.tier1WasmEnabled) {
3332
+ const decision2 = await this.tryTier1Wasm(op);
3333
+ if (decision2.accepted) {
3334
+ decision2.metrics.latencyEstimateMs = performance.now() - start;
3335
+ return decision2;
3336
+ }
3337
+ lastRejectionReason = decision2.metrics.fallbackReason;
3338
+ lastRejectionMetrics = {
3339
+ wasmProbe: decision2.metrics.wasmProbe,
3340
+ wasmEmulator: decision2.metrics.wasmEmulator
3341
+ };
3342
+ }
3343
+ if (this.config.tier2Enabled) {
3344
+ const decision2 = await this.tryTier2(op);
3345
+ if (decision2.accepted) {
3346
+ decision2.metrics.latencyEstimateMs = performance.now() - start;
3347
+ return decision2;
3348
+ }
3349
+ lastRejectionReason = decision2.metrics.fallbackReason;
3350
+ lastRejectionMetrics = {
3351
+ alpha: decision2.metrics.alpha,
3352
+ verifierPassed: decision2.metrics.verifierPassed,
3353
+ traitEquivalence: decision2.metrics.traitEquivalence
3354
+ };
3355
+ }
3356
+ const decision = await this.fallbackTier3(
3357
+ op,
3358
+ lastRejectionReason ?? "No higher tier accepted or enabled",
3359
+ lastRejectionMetrics
3360
+ );
3361
+ decision.metrics.latencyEstimateMs = performance.now() - start;
3362
+ return decision;
3363
+ }
3364
+ /** Current speculative-decoding alpha (Tier-2 acceptance rate). */
3365
+ getAlpha() {
3366
+ return this.alphaTracker.getAlpha();
3367
+ }
3368
+ // ---------------------------------------------------------------------------
3369
+ // TIER ATTEMPTERS
3370
+ // ---------------------------------------------------------------------------
3371
+ async tryTier1Neuromorphic(op) {
3372
+ const probe = await this.probeNeuromorphicRuntime();
3373
+ const deviceMatches = probe.available && (!this.config.tier1NeuromorphicDevice || probe.device === this.config.tier1NeuromorphicDevice);
3374
+ const traitCompatible = this.isTraitSnnCompatible(op.trait);
3375
+ const accepted = deviceMatches && traitCompatible;
3376
+ const reason = accepted ? void 0 : this.describeNeuromorphicRejection(probe, traitCompatible);
3377
+ return this.buildDecision("tier-1-neuromorphic" /* TIER_1_NEUROMORPHIC */, accepted, op, reason, void 0, {
3378
+ neuromorphicProbe: probe
3379
+ });
3380
+ }
3381
+ async tryTier1Browser(op) {
3382
+ const available = chunkCIWWXYHZ_cjs.isWebGpuEnvironmentPresent();
3383
+ const traitCompatible = this.isTraitSnnCompatible(op.trait);
3384
+ if (!available || !traitCompatible) {
3385
+ const reason = !available ? "WebGPU not available" : "Trait is not mapped to the SNN/WebGPU hot path";
3386
+ return this.buildDecision("tier-1-browser" /* TIER_1_BROWSER */, false, op, reason);
3387
+ }
3388
+ const executor = this.config.tier1BrowserExecutor ?? runTier1BrowserSnn;
3389
+ try {
3390
+ const result = await executor(op);
3391
+ const reason = result.accepted ? void 0 : result.reason ?? "Tier-1 browser executor rejected dispatch";
3392
+ return this.buildDecision(
3393
+ "tier-1-browser" /* TIER_1_BROWSER */,
3394
+ result.accepted,
3395
+ op,
3396
+ reason,
3397
+ void 0,
3398
+ { browserExecutor: result }
3399
+ );
3400
+ } catch (error) {
3401
+ const message = error instanceof Error ? error.message : String(error);
3402
+ return this.buildDecision("tier-1-browser" /* TIER_1_BROWSER */, false, op, message, void 0, {
3403
+ browserExecutor: { accepted: false, source: "tier-1-browser-error", reason: message }
3404
+ });
3405
+ }
3406
+ }
3407
+ async tryTier1Wasm(op) {
3408
+ const runtime = await this.probeWasmRuntime();
3409
+ const traitCompatible = this.isTraitSnnCompatible(op.trait);
3410
+ if (!runtime.available || !traitCompatible) {
3411
+ const reason2 = this.describeWasmRejection(runtime, traitCompatible);
3412
+ return this.buildDecision("tier-1-wasm" /* TIER_1_WASM */, false, op, reason2, void 0, {
3413
+ wasmProbe: runtime
3414
+ });
3415
+ }
3416
+ const emulator = await this.runTier1WasmEmulator(op, runtime);
3417
+ const reason = emulator.accepted ? void 0 : emulator.reason ?? "compiler-wasm SNN emulator rejected dispatch";
3418
+ return this.buildDecision(
3419
+ "tier-1-wasm" /* TIER_1_WASM */,
3420
+ emulator.accepted,
3421
+ op,
3422
+ reason,
3423
+ void 0,
3424
+ {
3425
+ wasmProbe: runtime,
3426
+ wasmEmulator: emulator
3427
+ }
3428
+ );
3429
+ }
3430
+ async tryTier2(op) {
3431
+ const provider = this.config.llmProposalProvider;
3432
+ const proposal = provider ? await provider(op) ?? null : null;
3433
+ if (!proposal) {
3434
+ this.alphaTracker.recordAttempt(false);
3435
+ const alpha2 = this.alphaTracker.getAlpha();
3436
+ return this.buildDecision(
3437
+ "tier-2-speculative" /* TIER_2_SPECULATIVE */,
3438
+ false,
3439
+ op,
3440
+ `LLM proposal failed; alpha ${alpha2.toFixed(2)} < threshold ${this.config.tier2AlphaThreshold}`,
3441
+ alpha2,
3442
+ {
3443
+ verifierPassed: false,
3444
+ traitEquivalence: {
3445
+ equivalent: false,
3446
+ source: "dispatch-policy",
3447
+ reason: "LLM proposal provider returned no output",
3448
+ score: 0
3449
+ }
3450
+ }
3451
+ );
3452
+ }
3453
+ const verifierPassed = await this.runCpuVerifier(op, proposal);
3454
+ const tier3Output = await this.runTier3CpuDirect(op);
3455
+ const traitEquivalence = await this.evaluateTraitEquivalence(op, proposal, tier3Output);
3456
+ this.alphaTracker.recordAttempt(traitEquivalence.equivalent);
3457
+ const alpha = this.alphaTracker.getAlpha();
3458
+ const accepted = verifierPassed && traitEquivalence.equivalent && alpha >= this.config.tier2AlphaThreshold;
3459
+ const reason = accepted ? void 0 : this.describeTier2Rejection(verifierPassed, traitEquivalence, alpha);
3460
+ return this.buildDecision("tier-2-speculative" /* TIER_2_SPECULATIVE */, accepted, op, reason, alpha, {
3461
+ verifierPassed,
3462
+ traitEquivalence
3463
+ });
3464
+ }
3465
+ async fallbackTier3(op, reason, extraMetrics = {}) {
3466
+ return this.buildDecision(
3467
+ "tier-3-cpu-direct" /* TIER_3_CPU_DIRECT */,
3468
+ true,
3469
+ op,
3470
+ reason,
3471
+ void 0,
3472
+ extraMetrics
3473
+ );
3474
+ }
3475
+ // ---------------------------------------------------------------------------
3476
+ // VERIFIERS & HELPERS
3477
+ // ---------------------------------------------------------------------------
3478
+ async probeNeuromorphicRuntime() {
3479
+ const probe = this.config.neuromorphicRuntimeProbe ?? detectNeuromorphicRuntime;
3480
+ return probe(this.config.tier1NeuromorphicDevice);
3481
+ }
3482
+ async probeWasmRuntime() {
3483
+ const probe = this.config.tier1WasmRuntimeProbe ?? detectWasmRuntime;
3484
+ return probe();
3485
+ }
3486
+ async runTier1WasmEmulator(op, runtime) {
3487
+ const executor = this.config.tier1WasmExecutor ?? runCompilerWasmSnnEmulator;
3488
+ try {
3489
+ return await executor(op, runtime);
3490
+ } catch (error) {
3491
+ return {
3492
+ accepted: false,
3493
+ source: "compiler-wasm-snn-emulator",
3494
+ runtime,
3495
+ reason: error instanceof Error ? error.message : String(error)
3496
+ };
3497
+ }
3498
+ }
3499
+ describeNeuromorphicRejection(probe, traitCompatible) {
3500
+ if (!probe.available) {
3501
+ return probe.reason ?? "Neuromorphic runtime device not discovered";
3502
+ }
3503
+ if (this.config.tier1NeuromorphicDevice && probe.device !== this.config.tier1NeuromorphicDevice) {
3504
+ return `NIR runtime discovered ${probe.device ?? "unknown"} but requires ${this.config.tier1NeuromorphicDevice}`;
3505
+ }
3506
+ if (!traitCompatible) {
3507
+ return "Trait is not mapped to the SNN/NIR hot path";
3508
+ }
3509
+ return "Neuromorphic runtime probe did not accept dispatch";
3510
+ }
3511
+ describeWasmRejection(runtime, traitCompatible) {
3512
+ if (!runtime.available) {
3513
+ return runtime.reason ?? "WebAssembly runtime unavailable for Tier-1 WASM fallback";
3514
+ }
3515
+ if (!traitCompatible) {
3516
+ return "Trait is not mapped to the SNN/WASM hot path";
3517
+ }
3518
+ return "compiler-wasm SNN emulator did not accept dispatch";
3519
+ }
3520
+ isTraitSnnCompatible(trait) {
3521
+ const snnTraits = /* @__PURE__ */ new Set(["grabbable", "hoverable", "clickable", "draggable", "throwable"]);
3522
+ return snnTraits.has(trait);
3523
+ }
3524
+ async runCpuVerifier(op, _proposal) {
3525
+ let anyVerifierWired = false;
3526
+ if (this.config.effectVerifier) {
3527
+ anyVerifierWired = true;
3528
+ const effectResult = await this.config.effectVerifier([op.trait]);
3529
+ if (!effectResult || !effectResult.passed) return false;
3530
+ }
3531
+ if (op.manifest && this.config.simulationContractVerifier) {
3532
+ anyVerifierWired = true;
3533
+ const scPassed = await this.config.simulationContractVerifier(op.manifest);
3534
+ if (!scPassed) return false;
3535
+ } else if (op.manifest) {
3536
+ anyVerifierWired = true;
3537
+ try {
3538
+ chunkBRQJKJGT_cjs.assertHoloMapManifestContract(op.manifest);
3539
+ } catch {
3540
+ return false;
3541
+ }
3542
+ }
3543
+ return anyVerifierWired;
3544
+ }
3545
+ async runTier3CpuDirect(op) {
3546
+ const executor = this.config.tier3CpuExecutor ?? runTier3CpuDirectExecutor;
3547
+ return executor(op);
3548
+ }
3549
+ async evaluateTraitEquivalence(op, proposal, tier3Output) {
3550
+ const oracle = this.config.traitEquivalenceOracle ?? defaultTraitEquivalenceOracle;
3551
+ try {
3552
+ return await oracle({ operation: op, proposal, tier3Output });
3553
+ } catch (error) {
3554
+ return {
3555
+ equivalent: false,
3556
+ source: "trait-equivalence-oracle",
3557
+ reason: error instanceof Error ? error.message : String(error),
3558
+ score: 0
3559
+ };
3560
+ }
3561
+ }
3562
+ describeTier2Rejection(verifierPassed, equivalence, alpha) {
3563
+ const parts = [
3564
+ `Verifier ${verifierPassed ? "passed" : "rejected"}`,
3565
+ `equivalence ${equivalence.equivalent ? "passed" : "failed"}`,
3566
+ `alpha ${alpha.toFixed(2)} < threshold ${this.config.tier2AlphaThreshold}`
3567
+ ];
3568
+ if (equivalence.reason) {
3569
+ parts.push(equivalence.reason);
3570
+ }
3571
+ return parts.join("; ");
3572
+ }
3573
+ // ---------------------------------------------------------------------------
3574
+ // PROVENANCE BUILDER
3575
+ // ---------------------------------------------------------------------------
3576
+ async buildDecision(tier, accepted, op, fallbackReason, alpha, extraMetrics = {}) {
3577
+ const metrics = {
3578
+ tierAttempted: tier,
3579
+ tierAccepted: accepted,
3580
+ fallbackReason,
3581
+ latencyEstimateMs: 0,
3582
+ alpha,
3583
+ ...extraMetrics
3584
+ };
3585
+ const provenanceContext = op.provenanceContext ?? {
3586
+ authorityLevel: 50,
3587
+ // AGENT default
3588
+ sourceType: "system"
3589
+ };
3590
+ const provenance = {
3591
+ value: { tier, accepted, nodeId: op.nodeId, trait: op.trait },
3592
+ source: "dispatch-policy",
3593
+ context: provenanceContext
3594
+ };
3595
+ const replayFingerprint = await this.hashDecision(provenance);
3596
+ return {
3597
+ tier,
3598
+ accepted,
3599
+ provenance,
3600
+ metrics,
3601
+ replayFingerprint
3602
+ };
3603
+ }
3604
+ async hashDecision(provenance) {
3605
+ const value = provenance.value;
3606
+ const canonical = stableStringify(value);
3607
+ return `sha256:${await sha256Hex(canonical)}`;
3608
+ }
3609
+ };
3610
+ function createTier3CpuDirectOutput(op) {
3611
+ return {
3612
+ trait: op.trait,
3613
+ nodeId: op.nodeId,
3614
+ config: op.config ?? {}
3615
+ };
3616
+ }
3617
+ async function runTier3CpuDirectExecutor(op) {
3618
+ const evaluator = new chunkGJNCFRJU_cjs.ExpressionEvaluator(op.config ?? {});
3619
+ const evaluatedConfig = {};
3620
+ for (const [key, value] of Object.entries(op.config ?? {})) {
3621
+ if (typeof value === "string") {
3622
+ evaluatedConfig[key] = evaluator.evaluate(value);
3623
+ } else {
3624
+ evaluatedConfig[key] = value;
3625
+ }
3626
+ }
3627
+ return {
3628
+ trait: op.trait,
3629
+ nodeId: op.nodeId,
3630
+ config: evaluatedConfig
3631
+ };
3632
+ }
3633
+ async function runTier1BrowserSnn(op) {
3634
+ try {
3635
+ const snnWebgpu = await import('@holoscript/snn-webgpu');
3636
+ const { GPUContext, LIFSimulator, DEFAULT_LIF_PARAMS } = snnWebgpu;
3637
+ const ctx = new GPUContext();
3638
+ await ctx.initialize();
3639
+ const simulator = new LIFSimulator(ctx, 1, DEFAULT_LIF_PARAMS);
3640
+ await simulator.initialize();
3641
+ const input = stableStringify({ trait: op.trait, nodeId: op.nodeId, config: op.config });
3642
+ const steps = Math.max(1, Math.min(64, input.length));
3643
+ await simulator.stepN(steps);
3644
+ return { accepted: true, source: "snn-webgpu", steps };
3645
+ } catch (error) {
3646
+ return {
3647
+ accepted: false,
3648
+ source: "snn-webgpu",
3649
+ reason: normalizeTier1BrowserReason(error)
3650
+ };
3651
+ }
3652
+ }
3653
+ function normalizeTier1BrowserReason(error) {
3654
+ const message = error instanceof Error ? error.message : String(error);
3655
+ if (message.includes("@holoscript/snn-webgpu") && message.includes("Cannot find package")) {
3656
+ return `WebGPU SNN runtime unavailable: ${message}`;
3657
+ }
3658
+ return message;
3659
+ }
3660
+ function detectWasmRuntime() {
3661
+ const runtime = globalThis;
3662
+ const validate = runtime.WebAssembly?.validate;
3663
+ if (typeof validate !== "function") {
3664
+ return {
3665
+ available: false,
3666
+ source: "global-webassembly",
3667
+ reason: "WebAssembly.validate is unavailable"
3668
+ };
3669
+ }
3670
+ const moduleValidated = validate(MINIMAL_WASM_MODULE);
3671
+ return {
3672
+ available: moduleValidated,
3673
+ source: "global-webassembly",
3674
+ moduleValidated,
3675
+ reason: moduleValidated ? void 0 : "Minimal WebAssembly module failed validation"
3676
+ };
3677
+ }
3678
+ function runCompilerWasmSnnEmulator(op, runtime) {
3679
+ if (!runtime.available) {
3680
+ return {
3681
+ accepted: false,
3682
+ source: "compiler-wasm-snn-emulator",
3683
+ runtime,
3684
+ reason: runtime.reason ?? "WebAssembly runtime unavailable"
3685
+ };
3686
+ }
3687
+ const input = stableStringify({
3688
+ trait: op.trait,
3689
+ nodeId: op.nodeId,
3690
+ config: op.config ?? {}
3691
+ });
3692
+ const steps = Math.max(1, Math.min(64, input.length));
3693
+ const state = emulateLifSteps(input, steps);
3694
+ return {
3695
+ accepted: true,
3696
+ source: "compiler-wasm-snn-emulator",
3697
+ runtime,
3698
+ steps,
3699
+ spikeCount: state.spikeCount,
3700
+ membranePotential: state.membranePotential,
3701
+ inputChecksum: state.inputChecksum
3702
+ };
3703
+ }
3704
+ async function defaultTraitEquivalenceOracle(input) {
3705
+ const proposalCanonical = stableStringify(input.proposal);
3706
+ const tier3Canonical = stableStringify(input.tier3Output);
3707
+ const equivalent = proposalCanonical === tier3Canonical;
3708
+ return {
3709
+ equivalent,
3710
+ source: "canonical-json",
3711
+ reason: equivalent ? "canonical outputs match" : "canonical outputs differ",
3712
+ score: equivalent ? 1 : 0,
3713
+ proposalFingerprint: `sha256:${await sha256Hex(proposalCanonical)}`,
3714
+ tier3Fingerprint: `sha256:${await sha256Hex(tier3Canonical)}`
3715
+ };
3716
+ }
3717
+ function stableStringify(value) {
3718
+ return JSON.stringify(canonicalize(value)) ?? "undefined";
3719
+ }
3720
+ function canonicalize(value) {
3721
+ if (Array.isArray(value)) {
3722
+ return value.map((entry) => canonicalize(entry));
3723
+ }
3724
+ if (!value || typeof value !== "object") {
3725
+ return value;
3726
+ }
3727
+ const record = value;
3728
+ const sorted = {};
3729
+ for (const key of Object.keys(record).sort()) {
3730
+ sorted[key] = canonicalize(record[key]);
3731
+ }
3732
+ return sorted;
3733
+ }
3734
+ async function sha256Hex(input) {
3735
+ const subtle = globalThis.crypto?.subtle;
3736
+ if (subtle) {
3737
+ const digest = await subtle.digest("SHA-256", new TextEncoder().encode(input));
3738
+ return bytesToHex(new Uint8Array(digest));
3739
+ }
3740
+ const { createHash } = await import('crypto');
3741
+ return createHash("sha256").update(input).digest("hex");
3742
+ }
3743
+ function bytesToHex(bytes) {
3744
+ return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
3745
+ }
3746
+ var MINIMAL_WASM_MODULE = new Uint8Array([
3747
+ 0,
3748
+ 97,
3749
+ 115,
3750
+ 109,
3751
+ 1,
3752
+ 0,
3753
+ 0,
3754
+ 0
3755
+ ]);
3756
+ function emulateLifSteps(input, steps) {
3757
+ const vRest = -65;
3758
+ const vReset = -65;
3759
+ const vThreshold = -50;
3760
+ const tau = 12;
3761
+ let membranePotential = vRest;
3762
+ let spikeCount = 0;
3763
+ let inputChecksum = 2166136261;
3764
+ for (let i = 0; i < steps; i += 1) {
3765
+ const code = input.charCodeAt(i % input.length);
3766
+ inputChecksum ^= code;
3767
+ inputChecksum = Math.imul(inputChecksum, 16777619) >>> 0;
3768
+ const inputCurrent = 12 + code % 17;
3769
+ membranePotential += (vRest - membranePotential + inputCurrent) / tau;
3770
+ if (membranePotential >= vThreshold) {
3771
+ spikeCount += 1;
3772
+ membranePotential = vReset;
3773
+ }
3774
+ }
3775
+ return {
3776
+ spikeCount,
3777
+ membranePotential: Number(membranePotential.toFixed(6)),
3778
+ inputChecksum
3779
+ };
3780
+ }
3781
+ function detectNeuromorphicRuntime(preferredDevice) {
3782
+ const globalDevices = readGlobalNeuromorphicDevices();
3783
+ const envDevices = readEnvNeuromorphicDevices();
3784
+ const devices = [...globalDevices, ...envDevices].filter((device) => device.available !== false).sort((a, b) => deviceRank(a.target) - deviceRank(b.target));
3785
+ const selected = preferredDevice ? devices.find((device) => device.target === preferredDevice) : devices[0];
3786
+ if (selected) {
3787
+ return {
3788
+ available: true,
3789
+ device: selected.target,
3790
+ source: selected.source ?? "runtime",
3791
+ devices
3792
+ };
3793
+ }
3794
+ return {
3795
+ available: false,
3796
+ source: devices.length ? "runtime" : "none",
3797
+ reason: preferredDevice ? `No ${preferredDevice} NIR runtime device discovered` : "No NIR runtime device discovered",
3798
+ devices
3799
+ };
3800
+ }
3801
+ function readGlobalNeuromorphicDevices() {
3802
+ const runtime = globalThis;
3803
+ return parseNeuromorphicDevices(runtime.__HOLOSCRIPT_NIR_DEVICES__, "global");
3804
+ }
3805
+ function readEnvNeuromorphicDevices() {
3806
+ const env = typeof process !== "undefined" ? process.env : void 0;
3807
+ if (!env) return [];
3808
+ const configured = parseNeuromorphicDevices(env.HOLOSCRIPT_NIR_DEVICE ?? env.NIR_DEVICE, "env");
3809
+ const detected = [...configured];
3810
+ if (env.LOIHI2_HOST) {
3811
+ detected.push({ target: "loihi", id: env.LOIHI2_HOST, available: true, source: "env" });
3812
+ }
3813
+ if (env.SPINNAKER_BOARD) {
3814
+ detected.push({ target: "spinnaker", id: env.SPINNAKER_BOARD, available: true, source: "env" });
3815
+ }
3816
+ if (env.SYNSENSE_DEVICE) {
3817
+ detected.push({ target: "synsense", id: env.SYNSENSE_DEVICE, available: true, source: "env" });
3818
+ }
3819
+ if (env.AKIDA_DEVICE) {
3820
+ detected.push({ target: "akida", id: env.AKIDA_DEVICE, available: true, source: "env" });
3821
+ }
3822
+ return detected;
3823
+ }
3824
+ function parseNeuromorphicDevices(value, source) {
3825
+ if (!value) return [];
3826
+ if (typeof value === "string") {
3827
+ return value.split(",").map((entry) => toNeuromorphicDevice(entry.trim(), source)).filter((device) => Boolean(device));
3828
+ }
3829
+ if (Array.isArray(value)) {
3830
+ return value.map((entry) => toNeuromorphicDevice(entry, source)).filter((device) => Boolean(device));
3831
+ }
3832
+ return [];
3833
+ }
3834
+ function toNeuromorphicDevice(value, source) {
3835
+ if (typeof value === "string") {
3836
+ const target2 = normalizeNeuromorphicTarget(value);
3837
+ return target2 ? { target: target2, available: true, source } : null;
3838
+ }
3839
+ if (!value || typeof value !== "object") return null;
3840
+ const record = value;
3841
+ const target = normalizeNeuromorphicTarget(record.target ?? record.device ?? record.kind);
3842
+ if (!target) return null;
3843
+ return {
3844
+ target,
3845
+ id: typeof record.id === "string" ? record.id : void 0,
3846
+ available: record.available === false ? false : true,
3847
+ source: typeof record.source === "string" ? record.source : source
3848
+ };
3849
+ }
3850
+ function normalizeNeuromorphicTarget(value) {
3851
+ if (typeof value !== "string") return null;
3852
+ const normalized = value.toLowerCase().replace(/[\s_-]+/g, "");
3853
+ if (normalized === "loihi" || normalized === "loihi2") return "loihi";
3854
+ if (normalized === "spinnaker" || normalized === "spinnaker2") return "spinnaker";
3855
+ if (normalized === "synsense" || normalized === "synsensespeck" || normalized === "synsensexylo") {
3856
+ return "synsense";
3857
+ }
3858
+ if (normalized === "akida") return "akida";
3859
+ return null;
3860
+ }
3861
+ function deviceRank(device) {
3862
+ return ["loihi", "spinnaker", "synsense", "akida"].indexOf(device);
3863
+ }
3864
+
3865
+ // src/compiler/dispatch/DispatchPolicyBenchmark.ts
3866
+ var DEFAULT_ITERATIONS = 100;
3867
+ var DEFAULT_WARMUP_ITERATIONS = 10;
3868
+ var DEFAULT_DISPATCH_LATENCY_OPERATION = {
3869
+ trait: "grabbable",
3870
+ nodeId: "dispatch-policy-latency-benchmark"
3871
+ };
3872
+ function createDefaultDispatchLatencyScenarios(options = {}) {
3873
+ const alphaWindowSize = (options.iterations ?? DEFAULT_ITERATIONS) + (options.warmupIterations ?? DEFAULT_WARMUP_ITERATIONS);
3874
+ return [
3875
+ {
3876
+ id: "tier-1-neuromorphic-synsense",
3877
+ tier: "tier-1-neuromorphic" /* TIER_1_NEUROMORPHIC */,
3878
+ config: {
3879
+ tier1NeuromorphicEnabled: true,
3880
+ tier1NeuromorphicDevice: "synsense",
3881
+ neuromorphicRuntimeProbe: async () => ({
3882
+ available: true,
3883
+ device: "synsense",
3884
+ source: "dispatch-latency-benchmark",
3885
+ devices: [{ target: "synsense", id: "benchmark-synsense", source: "benchmark" }]
3886
+ })
3887
+ }
3888
+ },
3889
+ {
3890
+ id: "tier-1-browser-webgpu",
3891
+ tier: "tier-1-browser" /* TIER_1_BROWSER */,
3892
+ config: {
3893
+ tier1BrowserEnabled: true
3894
+ }
3895
+ },
3896
+ {
3897
+ id: "tier-1-wasm-fallback",
3898
+ tier: "tier-1-wasm" /* TIER_1_WASM */,
3899
+ config: {
3900
+ tier1WasmEnabled: true
3901
+ }
3902
+ },
3903
+ {
3904
+ id: "tier-2-speculative",
3905
+ tier: "tier-2-speculative" /* TIER_2_SPECULATIVE */,
3906
+ config: {
3907
+ tier2Enabled: true,
3908
+ llmProposalProvider: (op) => createTier3CpuDirectOutput(op),
3909
+ tier2AlphaThreshold: 0,
3910
+ alphaWindowSize,
3911
+ effectVerifier: async () => ({ passed: true })
3912
+ }
3913
+ },
3914
+ {
3915
+ id: "tier-3-cpu-direct",
3916
+ tier: "tier-3-cpu-direct" /* TIER_3_CPU_DIRECT */,
3917
+ config: {
3918
+ tier1BrowserEnabled: false,
3919
+ tier1NeuromorphicEnabled: false,
3920
+ tier2Enabled: false
3921
+ }
3922
+ }
3923
+ ];
3924
+ }
3925
+ async function runDispatchPolicyLatencyBenchmark(options = {}) {
3926
+ const iterations = options.iterations ?? DEFAULT_ITERATIONS;
3927
+ const warmupIterations = options.warmupIterations ?? DEFAULT_WARMUP_ITERATIONS;
3928
+ const operation = options.operation ?? DEFAULT_DISPATCH_LATENCY_OPERATION;
3929
+ const scenarios = options.scenarios ?? createDefaultDispatchLatencyScenarios({ iterations, warmupIterations });
3930
+ const summaries = [];
3931
+ for (const scenario of scenarios) {
3932
+ const policy = new DispatchPolicy(scenario.config);
3933
+ const scenarioOperation = scenario.operation ?? operation;
3934
+ for (let i = 0; i < warmupIterations; i += 1) {
3935
+ await policy.route(scenarioOperation);
3936
+ }
3937
+ const samples = [];
3938
+ for (let i = 0; i < iterations; i += 1) {
3939
+ samples.push(await measureDispatchSample(policy, scenario, scenarioOperation, i, options.now));
3940
+ }
3941
+ summaries.push(summarizeDispatchSamples(scenario, samples));
3942
+ }
3943
+ return {
3944
+ operationTrait: operation.trait,
3945
+ iterations,
3946
+ warmupIterations,
3947
+ summaries,
3948
+ recommendation: recommendDispatchPolicyDefaults(summaries)
3949
+ };
3950
+ }
3951
+ function recommendDispatchPolicyDefaults(summaries) {
3952
+ const tier2 = summaries.find((summary) => summary.requestedTier === "tier-2-speculative" /* TIER_2_SPECULATIVE */);
3953
+ const tier3 = summaries.find((summary) => summary.requestedTier === "tier-3-cpu-direct" /* TIER_3_CPU_DIRECT */);
3954
+ if (!tier2) {
3955
+ return {
3956
+ tier2DefaultEnabled: false,
3957
+ reason: "Tier 2 benchmark summary missing; keep speculative dispatch disabled by default."
3958
+ };
3959
+ }
3960
+ if (!tier3) {
3961
+ return {
3962
+ tier2DefaultEnabled: false,
3963
+ reason: "Tier 3 CPU-direct baseline missing; keep speculative dispatch disabled by default."
3964
+ };
3965
+ }
3966
+ const tier2Comparable = tier2.acceptedSamples > 0;
3967
+ const tier3Comparable = tier3.acceptedSamples > 0;
3968
+ if (!tier2Comparable || !tier3Comparable) {
3969
+ return {
3970
+ tier2DefaultEnabled: false,
3971
+ reason: "Tier 2 or Tier 3 did not accept benchmark samples; keep speculative dispatch disabled by default.",
3972
+ tier2MeanLatencyMs: tier2.meanLatencyMs,
3973
+ tier3MeanLatencyMs: tier3.meanLatencyMs,
3974
+ tier2P95LatencyMs: tier2.p95LatencyMs,
3975
+ tier3P95LatencyMs: tier3.p95LatencyMs
3976
+ };
3977
+ }
3978
+ const tier2Faster = tier2.meanLatencyMs < tier3.meanLatencyMs && tier2.p95LatencyMs < tier3.p95LatencyMs;
3979
+ if (!tier2Faster) {
3980
+ return {
3981
+ tier2DefaultEnabled: false,
3982
+ reason: "Tier 2 speculative dispatch is not faster than Tier 3 CPU direct on mean and p95 latency; keep Tier 2 disabled by default.",
3983
+ tier2MeanLatencyMs: tier2.meanLatencyMs,
3984
+ tier3MeanLatencyMs: tier3.meanLatencyMs,
3985
+ tier2P95LatencyMs: tier2.p95LatencyMs,
3986
+ tier3P95LatencyMs: tier3.p95LatencyMs
3987
+ };
3988
+ }
3989
+ return {
3990
+ tier2DefaultEnabled: true,
3991
+ reason: "Tier 2 speculative dispatch beat Tier 3 CPU direct on mean and p95 latency.",
3992
+ tier2MeanLatencyMs: tier2.meanLatencyMs,
3993
+ tier3MeanLatencyMs: tier3.meanLatencyMs,
3994
+ tier2P95LatencyMs: tier2.p95LatencyMs,
3995
+ tier3P95LatencyMs: tier3.p95LatencyMs
3996
+ };
3997
+ }
3998
+ function formatDispatchLatencyBenchmarkReport(report) {
3999
+ const lines = [
4000
+ `DispatchPolicy @${report.operationTrait} latency benchmark`,
4001
+ `iterations=${report.iterations} warmup=${report.warmupIterations}`,
4002
+ "",
4003
+ "requested tier | accepted samples | mean ms | p50 ms | p95 ms | max ms | accepted tiers"
4004
+ ];
4005
+ for (const summary of report.summaries) {
4006
+ lines.push(
4007
+ [
4008
+ summary.requestedTier,
4009
+ `${summary.acceptedSamples}/${summary.samples}`,
4010
+ formatMs(summary.meanLatencyMs),
4011
+ formatMs(summary.p50LatencyMs),
4012
+ formatMs(summary.p95LatencyMs),
4013
+ formatMs(summary.maxLatencyMs),
4014
+ formatTierCounts(summary.acceptedTierCounts)
4015
+ ].join(" | ")
4016
+ );
4017
+ }
4018
+ lines.push("");
4019
+ lines.push(
4020
+ `Tier 2 default: ${report.recommendation.tier2DefaultEnabled ? "enabled" : "disabled"}`
4021
+ );
4022
+ lines.push(report.recommendation.reason);
4023
+ return lines.join("\n");
4024
+ }
4025
+ async function measureDispatchSample(policy, scenario, operation, iteration, now) {
4026
+ const clock = now ?? (() => performance.now());
4027
+ const started = clock();
4028
+ const decision = await policy.route(operation);
4029
+ const latencyMs = Math.max(0, clock() - started);
4030
+ return toLatencySample(iteration, scenario.tier, decision, latencyMs);
4031
+ }
4032
+ function toLatencySample(iteration, requestedTier, decision, latencyMs) {
4033
+ return {
4034
+ iteration,
4035
+ requestedTier,
4036
+ acceptedTier: decision.tier,
4037
+ accepted: decision.accepted,
4038
+ latencyMs,
4039
+ decisionLatencyMs: decision.metrics.latencyEstimateMs,
4040
+ fallbackReason: decision.metrics.fallbackReason,
4041
+ alpha: decision.metrics.alpha,
4042
+ replayFingerprint: decision.replayFingerprint
4043
+ };
4044
+ }
4045
+ function summarizeDispatchSamples(scenario, samples) {
4046
+ const latencies = samples.map((sample) => sample.latencyMs).sort((a, b) => a - b);
4047
+ const acceptedTierCounts = {};
4048
+ const fallbackReasons = {};
4049
+ let acceptedSamples = 0;
4050
+ for (const sample of samples) {
4051
+ acceptedTierCounts[sample.acceptedTier] = (acceptedTierCounts[sample.acceptedTier] ?? 0) + 1;
4052
+ if (sample.accepted) acceptedSamples += 1;
4053
+ if (sample.fallbackReason) {
4054
+ fallbackReasons[sample.fallbackReason] = (fallbackReasons[sample.fallbackReason] ?? 0) + 1;
4055
+ }
4056
+ }
4057
+ return {
4058
+ id: scenario.id,
4059
+ requestedTier: scenario.tier,
4060
+ samples: samples.length,
4061
+ acceptedSamples,
4062
+ acceptedTierCounts,
4063
+ fallbackReasons,
4064
+ minLatencyMs: latencies[0] ?? 0,
4065
+ meanLatencyMs: mean(latencies),
4066
+ p50LatencyMs: percentile(latencies, 0.5),
4067
+ p95LatencyMs: percentile(latencies, 0.95),
4068
+ maxLatencyMs: latencies[latencies.length - 1] ?? 0
4069
+ };
4070
+ }
4071
+ function mean(values) {
4072
+ if (values.length === 0) return 0;
4073
+ return values.reduce((sum, value) => sum + value, 0) / values.length;
4074
+ }
4075
+ function percentile(sortedValues, percentileValue) {
4076
+ if (sortedValues.length === 0) return 0;
4077
+ const index = Math.min(
4078
+ sortedValues.length - 1,
4079
+ Math.max(0, Math.ceil(sortedValues.length * percentileValue) - 1)
4080
+ );
4081
+ return sortedValues[index] ?? 0;
4082
+ }
4083
+ function formatMs(value) {
4084
+ return value.toFixed(3);
4085
+ }
4086
+ function formatTierCounts(counts) {
4087
+ return Object.entries(counts).map(([tier, count]) => `${tier}:${count}`).join(",");
4088
+ }
4089
+
4090
+ // src/compiler/MatterpakCompiler.ts
4091
+ chunkRMHC2VG7_cjs.init_CompilerBase();
4092
+ function parseOBJExtended(text) {
4093
+ const allVertices = [];
4094
+ const allNormals = [];
4095
+ const allUVs = [];
4096
+ const groups = [];
4097
+ let currentGroup = null;
4098
+ let currentMaterial;
4099
+ function flushGroup() {
4100
+ if (currentGroup && (currentGroup.triangles.length > 0 || currentGroup.vertices.length > 0)) {
4101
+ groups.push(currentGroup);
4102
+ }
4103
+ }
4104
+ function startGroup(name) {
4105
+ flushGroup();
4106
+ currentGroup = {
4107
+ name,
4108
+ vertices: new Float64Array(0),
4109
+ normals: new Float64Array(0),
4110
+ uvs: new Float64Array(0),
4111
+ triangles: new Uint32Array(0),
4112
+ materialName: currentMaterial
4113
+ };
4114
+ }
4115
+ const lines = text.split("\n");
4116
+ for (let i = 0; i < lines.length; i++) {
4117
+ const line = lines[i].trim();
4118
+ if (line.length === 0 || line.startsWith("#")) continue;
4119
+ const parts = line.split(/\s+/);
4120
+ const cmd = parts[0];
4121
+ if (cmd === "v" && parts.length >= 4) {
4122
+ allVertices.push(
4123
+ parseFloat(parts[1]),
4124
+ parseFloat(parts[2]),
4125
+ parseFloat(parts[3])
4126
+ );
4127
+ } else if (cmd === "vn" && parts.length >= 4) {
4128
+ allNormals.push(
4129
+ parseFloat(parts[1]),
4130
+ parseFloat(parts[2]),
4131
+ parseFloat(parts[3])
4132
+ );
4133
+ } else if (cmd === "vt" && parts.length >= 3) {
4134
+ allUVs.push(
4135
+ parseFloat(parts[1]),
4136
+ parseFloat(parts[2])
4137
+ );
4138
+ } else if (cmd === "g" || cmd === "o") {
4139
+ const name = parts.slice(1).join(" ") || `group_${groups.length}`;
4140
+ startGroup(name);
4141
+ } else if (cmd === "usemtl" && parts.length >= 2) {
4142
+ currentMaterial = parts[1];
4143
+ const grp = currentGroup;
4144
+ if (grp !== null) {
4145
+ grp.materialName = currentMaterial;
4146
+ }
4147
+ } else if (cmd === "f" && parts.length >= 4) {
4148
+ if (!currentGroup) {
4149
+ startGroup("default");
4150
+ }
4151
+ const indices = parts.slice(1).map((p) => {
4152
+ const vStr = p.split("/")[0];
4153
+ const vIdx = parseInt(vStr, 10);
4154
+ return vIdx > 0 ? vIdx - 1 : allVertices.length / 3 + vIdx;
4155
+ });
4156
+ for (let t = 1; t < indices.length - 1; t++) {
4157
+ currentGroup.triangles = appendTri(currentGroup.triangles, indices[0], indices[t], indices[t + 1]);
4158
+ }
4159
+ }
4160
+ }
4161
+ flushGroup();
4162
+ for (const g of groups) {
4163
+ const usedVerts = /* @__PURE__ */ new Set();
4164
+ for (let i = 0; i < g.triangles.length; i++) {
4165
+ usedVerts.add(g.triangles[i]);
4166
+ }
4167
+ const remap = /* @__PURE__ */ new Map();
4168
+ let next = 0;
4169
+ const verts = [];
4170
+ for (const idx of usedVerts) {
4171
+ remap.set(idx, next++);
4172
+ verts.push(
4173
+ allVertices[idx * 3],
4174
+ allVertices[idx * 3 + 1],
4175
+ allVertices[idx * 3 + 2]
4176
+ );
4177
+ }
4178
+ g.vertices = new Float64Array(verts);
4179
+ for (let i = 0; i < g.triangles.length; i++) {
4180
+ g.triangles[i] = remap.get(g.triangles[i]);
4181
+ }
4182
+ }
4183
+ return groups.length > 0 ? groups : [{
4184
+ name: "default",
4185
+ vertices: new Float64Array(allVertices),
4186
+ normals: new Float64Array(allNormals),
4187
+ uvs: new Float64Array(allUVs),
4188
+ triangles: new Uint32Array(0),
4189
+ materialName: currentMaterial
4190
+ }];
4191
+ }
4192
+ function appendTri(arr, a, b, c) {
4193
+ const next = new Uint32Array(arr.length + 3);
4194
+ next.set(arr);
4195
+ next[arr.length] = a;
4196
+ next[arr.length + 1] = b;
4197
+ next[arr.length + 2] = c;
4198
+ return next;
4199
+ }
4200
+ function parseMTL(text) {
4201
+ const materials = /* @__PURE__ */ new Map();
4202
+ let current = null;
4203
+ const lines = text.split("\n");
4204
+ for (const raw of lines) {
4205
+ const line = raw.trim();
4206
+ if (line.length === 0 || line.startsWith("#")) continue;
4207
+ const parts = line.split(/\s+/);
4208
+ const cmd = parts[0];
4209
+ if (cmd === "newmtl" && parts.length >= 2) {
4210
+ current = parts[1];
4211
+ materials.set(current, {
4212
+ baseColor: [0.8, 0.8, 0.8],
4213
+ metallic: 0,
4214
+ roughness: 0.5
4215
+ });
4216
+ } else if (current) {
4217
+ const mat = materials.get(current);
4218
+ if (cmd === "Kd" && parts.length >= 4) {
4219
+ mat.baseColor = [
4220
+ parseFloat(parts[1]),
4221
+ parseFloat(parts[2]),
4222
+ parseFloat(parts[3])
4223
+ ];
4224
+ } else if (cmd === "map_Kd" && parts.length >= 2) {
4225
+ mat.textureMap = parts.slice(1).join(" ");
4226
+ } else if (cmd === "map_Bump" && parts.length >= 2) {
4227
+ mat.normalMap = parts.slice(1).join(" ");
4228
+ }
4229
+ if (cmd === "Ns" && parts.length >= 2) {
4230
+ const ns = parseFloat(parts[1]);
4231
+ mat.roughness = Math.max(0, 1 - ns / 1e3);
4232
+ }
4233
+ }
4234
+ }
4235
+ return { materials };
4236
+ }
4237
+ function parseXYZ(text) {
4238
+ const points = [];
4239
+ const colors = [];
4240
+ let hasColor = true;
4241
+ const lines = text.split("\n");
4242
+ for (const raw of lines) {
4243
+ const line = raw.trim();
4244
+ if (line.length === 0 || line.startsWith("#")) continue;
4245
+ const parts = line.split(/\s+/);
4246
+ if (parts.length < 3) continue;
4247
+ points.push(
4248
+ parseFloat(parts[0]),
4249
+ parseFloat(parts[1]),
4250
+ parseFloat(parts[2])
4251
+ );
4252
+ if (parts.length >= 6) {
4253
+ colors.push(
4254
+ parseInt(parts[3], 10),
4255
+ parseInt(parts[4], 10),
4256
+ parseInt(parts[5], 10)
4257
+ );
4258
+ } else {
4259
+ hasColor = false;
4260
+ }
4261
+ }
4262
+ return {
4263
+ points: new Float64Array(points),
4264
+ colors: hasColor ? new Uint8Array(colors) : void 0,
4265
+ count: points.length / 3
4266
+ };
4267
+ }
4268
+ function parseE57(buffer) {
4269
+ const view = new DataView(buffer);
4270
+ const bytes = new Uint8Array(buffer);
4271
+ const text = new TextDecoder().decode(bytes.slice(0, Math.min(1024, buffer.byteLength)));
4272
+ if (!text.includes("e57")) {
4273
+ return { points: new Float64Array(0), count: 0 };
4274
+ }
4275
+ const points = [];
4276
+ const len = Math.min(buffer.byteLength, 5e7);
4277
+ for (let off = 0; off <= len - 24; off += 8) {
4278
+ const x = view.getFloat64(off, true);
4279
+ const y = view.getFloat64(off + 8, true);
4280
+ const z = view.getFloat64(off + 16, true);
4281
+ if (isFinite(x) && isFinite(y) && isFinite(z) && Math.abs(x) < 1e6 && Math.abs(y) < 1e6 && Math.abs(z) < 1e6 && (x !== 0 || y !== 0 || z !== 0)) {
4282
+ points.push(x, y, z);
4283
+ off += 16;
4284
+ }
4285
+ }
4286
+ return {
4287
+ points: new Float64Array(points),
4288
+ count: points.length / 3
4289
+ };
4290
+ }
4291
+ var MatterpakCompiler = class extends chunkRMHC2VG7_cjs.CompilerBase {
4292
+ constructor(options = {}) {
4293
+ super();
4294
+ this.compilerName = "matterpak";
4295
+ this.version = "1.0.0";
4296
+ this.options = {
4297
+ scale: 1,
4298
+ rotationY: 0,
4299
+ centerOrigin: true,
4300
+ groupAsRooms: true,
4301
+ pointCloudAsParticles: true,
4302
+ maxPointsPerSystem: 1e5,
4303
+ downsampleLargeClouds: true,
4304
+ ...options
4305
+ };
4306
+ }
4307
+ /**
4308
+ * Satisfy CompilerBase abstract method — MatterpakCompiler is a format-ingest
4309
+ * compiler (bundle → HoloComposition) rather than a target compiler
4310
+ * (HoloComposition → output). Use compileBundle() for ingestion.
4311
+ */
4312
+ compile(..._args) {
4313
+ throw new Error(
4314
+ "MatterpakCompiler.compile() is not supported. Use compileBundle(bundle: MatterpakBundle) to ingest a Matterpak bundle into a HoloComposition AST."
4315
+ );
4316
+ }
4317
+ /**
4318
+ * Compile a Matterpak bundle into a HoloComposition AST.
4319
+ */
4320
+ compileBundle(bundle) {
4321
+ const warnings = [];
4322
+ const errors = [];
4323
+ const stats = {
4324
+ meshGroups: 0,
4325
+ vertices: 0,
4326
+ triangles: 0,
4327
+ pointCount: 0,
4328
+ materials: 0,
4329
+ rooms: 0
4330
+ };
4331
+ const objGroups = parseOBJExtended(bundle.obj);
4332
+ stats.meshGroups = objGroups.length;
4333
+ stats.vertices = objGroups.reduce((sum, g) => sum + g.vertices.length / 3, 0);
4334
+ stats.triangles = objGroups.reduce((sum, g) => sum + g.triangles.length / 3, 0);
4335
+ const mtl = bundle.mtl ? parseMTL(bundle.mtl) : { materials: /* @__PURE__ */ new Map() };
4336
+ stats.materials = mtl.materials.size;
4337
+ let xyzCloud;
4338
+ let e57Cloud;
4339
+ if (bundle.xyz) {
4340
+ xyzCloud = parseXYZ(bundle.xyz);
4341
+ stats.pointCount += xyzCloud.count;
4342
+ }
4343
+ if (bundle.e57) {
4344
+ e57Cloud = parseE57(bundle.e57);
4345
+ if (e57Cloud.count > 0) {
4346
+ stats.pointCount += e57Cloud.count;
4347
+ } else {
4348
+ warnings.push("E57 parsing produced zero points (header-only or unsupported format variant)");
4349
+ }
4350
+ }
4351
+ const objects = [];
4352
+ const spatialGroups = [];
4353
+ const lights = [];
4354
+ let minX = Infinity, minY = Infinity, minZ = Infinity;
4355
+ let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;
4356
+ for (const g of objGroups) {
4357
+ for (let i = 0; i < g.vertices.length; i += 3) {
4358
+ const x = g.vertices[i];
4359
+ const y = g.vertices[i + 1];
4360
+ const z = g.vertices[i + 2];
4361
+ if (x < minX) minX = x;
4362
+ if (x > maxX) maxX = x;
4363
+ if (y < minY) minY = y;
4364
+ if (y > maxY) maxY = y;
4365
+ if (z < minZ) minZ = z;
4366
+ if (z > maxZ) maxZ = z;
4367
+ }
4368
+ }
4369
+ const cx = (minX + maxX) / 2;
4370
+ const cy = minY;
4371
+ const cz = (minZ + maxZ) / 2;
4372
+ const scale = this.options.scale ?? 1;
4373
+ const rotY = this.options.rotationY ?? 0;
4374
+ if (this.options.groupAsRooms) {
4375
+ for (const g of objGroups) {
4376
+ const traits = [];
4377
+ const matName = g.materialName;
4378
+ if (matName && mtl.materials.has(matName)) {
4379
+ const mat = mtl.materials.get(matName);
4380
+ const matConfig = {
4381
+ baseColor: mat.baseColor,
4382
+ metallic: mat.metallic,
4383
+ roughness: mat.roughness
4384
+ };
4385
+ if (mat.textureMap !== void 0) matConfig.textureMap = mat.textureMap;
4386
+ if (mat.normalMap !== void 0) matConfig.normalMap = mat.normalMap;
4387
+ traits.push({
4388
+ type: "ObjectTrait",
4389
+ name: "material",
4390
+ config: matConfig
4391
+ });
4392
+ }
4393
+ traits.push({
4394
+ type: "ObjectTrait",
4395
+ name: "geometry",
4396
+ config: {
4397
+ primitive: "mesh",
4398
+ vertices: Array.from(g.vertices),
4399
+ indices: Array.from(g.triangles)
4400
+ }
4401
+ });
4402
+ let gx = 0, gy = 0, gz = 0;
4403
+ for (let i = 0; i < g.vertices.length; i += 3) {
4404
+ gx += g.vertices[i];
4405
+ gy += g.vertices[i + 1];
4406
+ gz += g.vertices[i + 2];
4407
+ }
4408
+ const vc = g.vertices.length / 3;
4409
+ gx /= vc;
4410
+ gy /= vc;
4411
+ gz /= vc;
4412
+ const obj = {
4413
+ type: "ObjectDecl",
4414
+ id: `obj_${g.name}`,
4415
+ name: g.name,
4416
+ properties: [],
4417
+ position: {
4418
+ x: (gx - cx) * scale,
4419
+ y: (gy - cy) * scale,
4420
+ z: (gz - cz) * scale
4421
+ },
4422
+ scale: { x: scale, y: scale, z: scale },
4423
+ rotation: { x: 0, y: rotY, z: 0 },
4424
+ traits
4425
+ };
4426
+ objects.push(obj);
4427
+ spatialGroups.push({
4428
+ type: "SpatialGroup",
4429
+ id: `room_${g.name}`,
4430
+ name: g.name,
4431
+ properties: [],
4432
+ objects: [obj]
4433
+ });
4434
+ }
4435
+ stats.rooms = spatialGroups.length;
4436
+ } else {
4437
+ for (const g of objGroups) {
4438
+ const traits = [{
4439
+ type: "ObjectTrait",
4440
+ name: "geometry",
4441
+ config: {
4442
+ primitive: "mesh",
4443
+ vertices: Array.from(g.vertices),
4444
+ indices: Array.from(g.triangles)
4445
+ }
4446
+ }];
4447
+ const matName = g.materialName;
4448
+ if (matName && mtl.materials.has(matName)) {
4449
+ const mat = mtl.materials.get(matName);
4450
+ const matConfig = {
4451
+ baseColor: mat.baseColor,
4452
+ metallic: mat.metallic,
4453
+ roughness: mat.roughness
4454
+ };
4455
+ if (mat.textureMap !== void 0) matConfig.textureMap = mat.textureMap;
4456
+ if (mat.normalMap !== void 0) matConfig.normalMap = mat.normalMap;
4457
+ traits.push({
4458
+ type: "ObjectTrait",
4459
+ name: "material",
4460
+ config: matConfig
4461
+ });
4462
+ }
4463
+ objects.push({
4464
+ type: "ObjectDecl",
4465
+ id: `obj_${g.name}`,
4466
+ name: g.name,
4467
+ properties: [],
4468
+ position: { x: 0, y: 0, z: 0 },
4469
+ scale: { x: scale, y: scale, z: scale },
4470
+ rotation: { x: 0, y: rotY, z: 0 },
4471
+ traits
4472
+ });
4473
+ }
4474
+ spatialGroups.push({
4475
+ type: "SpatialGroup",
4476
+ id: "room_all",
4477
+ name: "Full Property",
4478
+ properties: [],
4479
+ objects: [...objects]
4480
+ });
4481
+ stats.rooms = 1;
4482
+ }
4483
+ const pointClouds = [];
4484
+ if (xyzCloud && xyzCloud.count > 0) pointClouds.push(xyzCloud);
4485
+ if (e57Cloud && e57Cloud.count > 0) pointClouds.push(e57Cloud);
4486
+ if (this.options.pointCloudAsParticles && pointClouds.length > 0) {
4487
+ let systemIndex = 0;
4488
+ for (const pc of pointClouds) {
4489
+ const maxPts = this.options.maxPointsPerSystem ?? 1e5;
4490
+ let stride = 1;
4491
+ if (this.options.downsampleLargeClouds && pc.count > maxPts) {
4492
+ stride = Math.ceil(pc.count / maxPts);
4493
+ }
4494
+ const particles = [];
4495
+ const particleColors = [];
4496
+ for (let i = 0; i < pc.count; i += stride) {
4497
+ const x = pc.points[i * 3];
4498
+ const y = pc.points[i * 3 + 1];
4499
+ const z = pc.points[i * 3 + 2];
4500
+ particles.push(
4501
+ (x - cx) * scale,
4502
+ (y - cy) * scale,
4503
+ (z - cz) * scale
4504
+ );
4505
+ if (pc.colors) {
4506
+ particleColors.push(
4507
+ pc.colors[i * 3] / 255,
4508
+ pc.colors[i * 3 + 1] / 255,
4509
+ pc.colors[i * 3 + 2] / 255
4510
+ );
4511
+ }
4512
+ }
4513
+ objects.push({
4514
+ type: "ObjectDecl",
4515
+ id: `pointcloud_${systemIndex}`,
4516
+ name: `Point Cloud ${systemIndex}`,
4517
+ properties: [],
4518
+ position: { x: 0, y: 0, z: 0 },
4519
+ scale: { x: 1, y: 1, z: 1 },
4520
+ rotation: { x: 0, y: 0, z: 0 },
4521
+ traits: [{
4522
+ type: "ObjectTrait",
4523
+ name: "particleSystem",
4524
+ config: {
4525
+ count: particles.length / 3,
4526
+ positions: particles,
4527
+ ...particleColors.length > 0 ? { colors: particleColors } : {},
4528
+ size: 0.02 * scale,
4529
+ billboard: true
4530
+ }
4531
+ }]
4532
+ });
4533
+ systemIndex++;
4534
+ }
4535
+ }
4536
+ const camera = {
4537
+ type: "Camera",
4538
+ cameraType: "perspective",
4539
+ properties: [],
4540
+ position: { x: 0, y: 1.6 * scale, z: 3 * scale },
4541
+ target: { x: 0, y: 0.5 * scale, z: 0 },
4542
+ fov: 70,
4543
+ near: 0.01,
4544
+ far: 1e3
4545
+ };
4546
+ lights.push({
4547
+ type: "Light",
4548
+ id: "ambient_main",
4549
+ name: "ambient_main",
4550
+ lightType: "ambient",
4551
+ properties: [
4552
+ { type: "LightProperty", key: "color", value: "#ffffff" },
4553
+ { type: "LightProperty", key: "intensity", value: 0.6 }
4554
+ ]
4555
+ });
4556
+ lights.push({
4557
+ type: "Light",
4558
+ id: "directional_main",
4559
+ name: "directional_main",
4560
+ lightType: "directional",
4561
+ properties: [
4562
+ { type: "LightProperty", key: "color", value: "#ffffff" },
4563
+ { type: "LightProperty", key: "intensity", value: 0.8 },
4564
+ { type: "LightProperty", key: "position", value: [5 * scale, 10 * scale, 5 * scale] }
4565
+ ]
4566
+ });
4567
+ const composition = {
4568
+ type: "Composition",
4569
+ name: "Matterpak Import",
4570
+ environment: {
4571
+ type: "Environment",
4572
+ properties: [
4573
+ { type: "EnvironmentProperty", key: "background", value: "#202020" },
4574
+ { type: "EnvironmentProperty", key: "fogColor", value: "#202020" },
4575
+ { type: "EnvironmentProperty", key: "fogNear", value: 10 * scale },
4576
+ { type: "EnvironmentProperty", key: "fogFar", value: 50 * scale }
4577
+ ]
4578
+ },
4579
+ templates: [],
4580
+ objects,
4581
+ spatialGroups,
4582
+ lights,
4583
+ camera,
4584
+ effects: {
4585
+ type: "Effects",
4586
+ effects: [
4587
+ { type: "Effect", effectType: "shadows", properties: { enabled: true } },
4588
+ { type: "Effect", effectType: "ambientOcclusion", properties: { enabled: true } }
4589
+ ]
4590
+ },
4591
+ imports: [],
4592
+ timelines: [],
4593
+ audio: [],
4594
+ zones: [],
4595
+ worlds: [{
4596
+ type: "World",
4597
+ id: "property_world",
4598
+ name: "Imported Property",
4599
+ properties: [
4600
+ { type: "WorldProperty", key: "gravityX", value: 0 },
4601
+ { type: "WorldProperty", key: "gravityY", value: -9.81 },
4602
+ { type: "WorldProperty", key: "gravityZ", value: 0 },
4603
+ { type: "WorldProperty", key: "boundsMinX", value: (minX - cx) * scale },
4604
+ { type: "WorldProperty", key: "boundsMinY", value: (minY - cy) * scale },
4605
+ { type: "WorldProperty", key: "boundsMinZ", value: (minZ - cz) * scale },
4606
+ { type: "WorldProperty", key: "boundsMaxX", value: (maxX - cx) * scale },
4607
+ { type: "WorldProperty", key: "boundsMaxY", value: (maxY - cy) * scale },
4608
+ { type: "WorldProperty", key: "boundsMaxZ", value: (maxZ - cz) * scale }
4609
+ ]
4610
+ }],
4611
+ ui: {
4612
+ type: "UI",
4613
+ elements: []
4614
+ },
4615
+ transitions: [],
4616
+ conditionals: [],
4617
+ iterators: [],
4618
+ npcs: [],
4619
+ quests: [],
4620
+ abilities: [],
4621
+ dialogues: [],
4622
+ stateMachines: [],
4623
+ achievements: [],
4624
+ talentTrees: [],
4625
+ shapes: []
4626
+ };
4627
+ return {
4628
+ success: errors.length === 0,
4629
+ composition,
4630
+ stats,
4631
+ warnings,
4632
+ errors
4633
+ };
4634
+ }
4635
+ };
4636
+ function createMatterpakCompiler(options) {
4637
+ return new MatterpakCompiler(options);
4638
+ }
4639
+
4640
+ // src/compiler/HoloGramMLSCompiler.ts
4641
+ chunkRMHC2VG7_cjs.init_CompilerBase();
4642
+ function groupPhotosByRoom(photos) {
4643
+ const groups = /* @__PURE__ */ new Map();
4644
+ for (const p of photos) {
4645
+ const room = p.room?.trim() || "Uncategorized";
4646
+ if (!groups.has(room)) groups.set(room, []);
4647
+ groups.get(room).push(p);
4648
+ }
4649
+ return groups;
4650
+ }
4651
+ function computeRoomGrid(rooms, spacing) {
4652
+ const positions = /* @__PURE__ */ new Map();
4653
+ const cols = Math.ceil(Math.sqrt(rooms.length));
4654
+ const offsetX = (cols - 1) * spacing / 2;
4655
+ const offsetZ = (Math.ceil(rooms.length / cols) - 1) * spacing / 2;
4656
+ for (let i = 0; i < rooms.length; i++) {
4657
+ const col = i % cols;
4658
+ const row = Math.floor(i / cols);
4659
+ positions.set(rooms[i], {
4660
+ x: col * spacing - offsetX,
4661
+ z: row * spacing - offsetZ
4662
+ });
4663
+ }
4664
+ return positions;
4665
+ }
4666
+ function aspectScale(photo) {
4667
+ const w = photo.width ?? 1024;
4668
+ const h = photo.height ?? 768;
4669
+ const base = 2;
4670
+ if (w >= h) {
4671
+ return { x: base, y: base * h / w };
4672
+ }
4673
+ return { x: base * w / h, y: base };
4674
+ }
4675
+ function placePhotosInRoom(photos, roomSize) {
4676
+ const placements = [];
4677
+ const half = roomSize / 2 - 0.5;
4678
+ const wallHeight = 1.6;
4679
+ if (photos.length === 1) {
4680
+ placements.push({
4681
+ photo: photos[0],
4682
+ position: { x: 0, y: wallHeight, z: -half },
4683
+ rotation: { x: 0, y: 0, z: 0 }
4684
+ });
4685
+ } else if (photos.length === 2) {
4686
+ placements.push({
4687
+ photo: photos[0],
4688
+ position: { x: -half, y: wallHeight, z: 0 },
4689
+ rotation: { x: 0, y: 90, z: 0 }
4690
+ });
4691
+ placements.push({
4692
+ photo: photos[1],
4693
+ position: { x: half, y: wallHeight, z: 0 },
4694
+ rotation: { x: 0, y: -90, z: 0 }
4695
+ });
4696
+ } else {
4697
+ const wallOrder = [
4698
+ { x: 0, z: -half, ry: 0 },
4699
+ { x: -half, z: 0, ry: 90 },
4700
+ { x: half, z: 0, ry: -90 },
4701
+ { x: 0, z: half, ry: 180 }
4702
+ ];
4703
+ for (let i = 0; i < photos.length; i++) {
4704
+ const wall = wallOrder[i % wallOrder.length];
4705
+ const offsetIndex = Math.floor(i / wallOrder.length);
4706
+ const offset = (offsetIndex % 2 === 0 ? -1 : 1) * (0.6 + offsetIndex * 0.3);
4707
+ placements.push({
4708
+ photo: photos[i],
4709
+ position: {
4710
+ x: wall.x === 0 ? offset : wall.x,
4711
+ y: wallHeight + offsetIndex * 0.3,
4712
+ z: wall.z === 0 ? offset : wall.z
4713
+ },
4714
+ rotation: { x: 0, y: wall.ry, z: 0 }
4715
+ });
4716
+ }
4717
+ }
4718
+ return placements;
4719
+ }
4720
+ var HoloGramMLSCompiler = class extends chunkRMHC2VG7_cjs.CompilerBase {
4721
+ constructor(options = {}) {
4722
+ super();
4723
+ this.compilerName = "hologram_mls";
4724
+ this.version = "1.0.0";
4725
+ this.options = {
4726
+ photoScale: 1,
4727
+ roomSpacing: 8,
4728
+ depthModel: "depth-anything-v2-small",
4729
+ depthBackend: "webgpu",
4730
+ displacementScale: 0.3,
4731
+ displacementSegments: 128,
4732
+ walkable: true,
4733
+ ambientLight: 0.4,
4734
+ spotLighting: true,
4735
+ floorColor: "#1a1a2e",
4736
+ environment: "night",
4737
+ ...options
4738
+ };
4739
+ }
4740
+ /**
4741
+ * Satisfy CompilerBase abstract method — HoloGramMLSCompiler is a format-ingest
4742
+ * compiler (bundle → HoloComposition). Use compileBundle() for ingestion.
4743
+ */
4744
+ compile(..._args) {
4745
+ throw new Error(
4746
+ "HoloGramMLSCompiler.compile() is not supported. Use compileBundle(bundle: HoloGramMLSBundle) to ingest an MLS bundle."
4747
+ );
4748
+ }
4749
+ compileBundle(bundle) {
4750
+ const warnings = [];
4751
+ const errors = [];
4752
+ const stats = { photos: 0, rooms: 0, waypoints: 0, lights: 0 };
4753
+ if (!bundle.photos || bundle.photos.length === 0) {
4754
+ warnings.push("No photos provided; returning empty gallery");
4755
+ return {
4756
+ success: true,
4757
+ composition: this.buildEmptyComposition(),
4758
+ stats,
4759
+ warnings,
4760
+ errors
4761
+ };
4762
+ }
4763
+ const roomGroups = groupPhotosByRoom(bundle.photos);
4764
+ const roomNames = Array.from(roomGroups.keys());
4765
+ stats.photos = bundle.photos.length;
4766
+ stats.rooms = roomNames.length;
4767
+ const roomPositions = computeRoomGrid(roomNames, this.options.roomSpacing);
4768
+ const objects = [];
4769
+ const spatialGroups = [];
4770
+ const lights = [];
4771
+ const waypoints = [];
4772
+ const wpPoints = [];
4773
+ for (const roomName of roomNames) {
4774
+ const photos = roomGroups.get(roomName);
4775
+ const pos = roomPositions.get(roomName);
4776
+ const roomSize = Math.min(this.options.roomSpacing * 0.8, 6);
4777
+ objects.push({
4778
+ type: "ObjectDecl",
4779
+ id: `floor_${roomName.replace(/\s+/g, "_")}`,
4780
+ name: `${roomName} Floor`,
4781
+ position: { x: pos.x, y: 0, z: pos.z },
4782
+ scale: { x: roomSize, y: 1, z: roomSize },
4783
+ rotation: { x: -90, y: 0, z: 0 },
4784
+ properties: [],
4785
+ traits: [
4786
+ { type: "ObjectTrait", name: "collidable", config: {}, params: {} },
4787
+ { type: "ObjectTrait", name: "static", config: {}, params: {} },
4788
+ {
4789
+ type: "ObjectTrait",
4790
+ name: "geometry",
4791
+ config: {},
4792
+ params: { primitive: "plane" }
4793
+ },
4794
+ {
4795
+ type: "ObjectTrait",
4796
+ name: "material",
4797
+ config: {},
4798
+ params: {
4799
+ color: this.options.floorColor,
4800
+ roughness: 0.1,
4801
+ metalness: 0.6
4802
+ }
4803
+ }
4804
+ ]
4805
+ });
4806
+ const placements = placePhotosInRoom(photos, roomSize);
4807
+ for (const placement of placements) {
4808
+ const scale = aspectScale(placement.photo);
4809
+ const traits = [
4810
+ {
4811
+ type: "ObjectTrait",
4812
+ name: "image",
4813
+ config: {},
4814
+ params: { src: placement.photo.url }
4815
+ },
4816
+ {
4817
+ type: "ObjectTrait",
4818
+ name: "depth_estimation",
4819
+ config: {},
4820
+ params: {
4821
+ model: this.options.depthModel,
4822
+ backend: this.options.depthBackend
4823
+ }
4824
+ },
4825
+ {
4826
+ type: "ObjectTrait",
4827
+ name: "displacement",
4828
+ config: {},
4829
+ params: {
4830
+ scale: this.options.displacementScale,
4831
+ segments: this.options.displacementSegments
4832
+ }
4833
+ },
4834
+ {
4835
+ type: "ObjectTrait",
4836
+ name: "depth_to_normal",
4837
+ config: {},
4838
+ params: {}
4839
+ },
4840
+ {
4841
+ type: "ObjectTrait",
4842
+ name: "geometry",
4843
+ config: {},
4844
+ params: { primitive: "plane" }
4845
+ }
4846
+ ];
4847
+ if (placement.photo.caption) {
4848
+ traits.push({
4849
+ type: "ObjectTrait",
4850
+ name: "billboard",
4851
+ config: {},
4852
+ params: { label: placement.photo.caption }
4853
+ });
4854
+ }
4855
+ objects.push({
4856
+ type: "ObjectDecl",
4857
+ id: `photo_${objects.length}`,
4858
+ name: placement.photo.caption || `Photo ${objects.length}`,
4859
+ position: {
4860
+ x: pos.x + placement.position.x,
4861
+ y: placement.position.y,
4862
+ z: pos.z + placement.position.z
4863
+ },
4864
+ scale: {
4865
+ x: scale.x * this.options.photoScale,
4866
+ y: scale.y * this.options.photoScale,
4867
+ z: 1
4868
+ },
4869
+ rotation: placement.rotation,
4870
+ properties: [],
4871
+ traits
4872
+ });
4873
+ }
4874
+ objects.push({
4875
+ type: "ObjectDecl",
4876
+ id: `label_${roomName.replace(/\s+/g, "_")}`,
4877
+ name: `${roomName} Label`,
4878
+ position: { x: pos.x, y: 2.8, z: pos.z },
4879
+ scale: { x: 2, y: 0.4, z: 0.01 },
4880
+ rotation: { x: 0, y: 0, z: 0 },
4881
+ properties: [],
4882
+ traits: [
4883
+ { type: "ObjectTrait", name: "billboard", config: {}, params: {} },
4884
+ {
4885
+ type: "ObjectTrait",
4886
+ name: "material",
4887
+ config: {},
4888
+ params: { color: "#0a0a20", emissive: "#4422cc", emissiveIntensity: 1.2 }
4889
+ }
4890
+ ]
4891
+ });
4892
+ if (this.options.spotLighting) {
4893
+ lights.push({
4894
+ type: "Light",
4895
+ id: `spot_${roomName.replace(/\s+/g, "_")}`,
4896
+ lightType: "spot",
4897
+ name: `${roomName} Spot`,
4898
+ properties: [
4899
+ { type: "LightProperty", key: "position", value: [pos.x, 4, pos.z] },
4900
+ { type: "LightProperty", key: "target", value: [pos.x, 0, pos.z] },
4901
+ { type: "LightProperty", key: "color", value: "#ffffff" },
4902
+ { type: "LightProperty", key: "intensity", value: 1.2 },
4903
+ { type: "LightProperty", key: "angle", value: Math.PI / 3 },
4904
+ { type: "LightProperty", key: "penumbra", value: 0.3 }
4905
+ ]
4906
+ });
4907
+ stats.lights++;
4908
+ }
4909
+ spatialGroups.push({
4910
+ type: "SpatialGroup",
4911
+ id: `room_${roomName.replace(/\s+/g, "_")}`,
4912
+ name: roomName,
4913
+ objects: objects.filter((o) => o.id?.startsWith(`floor_${roomName.replace(/\s+/g, "_")}`) || o.id?.startsWith(`label_${roomName.replace(/\s+/g, "_")}`) || o.traits?.some((t) => t.name === "image") && Math.abs((o.position?.x ?? 0) - pos.x) < roomSize && Math.abs((o.position?.z ?? 0) - pos.z) < roomSize),
4914
+ properties: []
4915
+ });
4916
+ wpPoints.push([pos.x, 0.1, pos.z]);
4917
+ }
4918
+ if (this.options.walkable && wpPoints.length > 1) {
4919
+ waypoints.push({
4920
+ type: "Waypoints",
4921
+ name: "room_navigation",
4922
+ points: wpPoints
4923
+ });
4924
+ stats.waypoints = wpPoints.length;
4925
+ }
4926
+ lights.push({
4927
+ type: "Light",
4928
+ id: "ambient_main",
4929
+ lightType: "ambient",
4930
+ name: "Ambient",
4931
+ properties: [
4932
+ { type: "LightProperty", key: "color", value: "#ffffff" },
4933
+ { type: "LightProperty", key: "intensity", value: this.options.ambientLight }
4934
+ ]
4935
+ });
4936
+ stats.lights++;
4937
+ lights.push({
4938
+ type: "Light",
4939
+ id: "directional_main",
4940
+ lightType: "directional",
4941
+ name: "Directional",
4942
+ properties: [
4943
+ { type: "LightProperty", key: "color", value: "#ffffff" },
4944
+ { type: "LightProperty", key: "intensity", value: 0.8 },
4945
+ { type: "LightProperty", key: "position", value: [5, 10, 5] }
4946
+ ]
4947
+ });
4948
+ stats.lights++;
4949
+ const firstRoom = roomPositions.get(roomNames[0]);
4950
+ const camera = {
4951
+ type: "Camera",
4952
+ cameraType: "perspective",
4953
+ position: { x: firstRoom.x, y: 1.6, z: firstRoom.z + this.options.roomSpacing * 0.4 },
4954
+ target: { x: firstRoom.x, y: 1.2, z: firstRoom.z },
4955
+ fov: 70,
4956
+ near: 0.01,
4957
+ far: 1e3,
4958
+ properties: []
4959
+ };
4960
+ const composition = {
4961
+ type: "Composition",
4962
+ name: "HoloGram MLS Gallery",
4963
+ objects,
4964
+ spatialGroups,
4965
+ lights,
4966
+ camera,
4967
+ waypointSets: waypoints,
4968
+ worlds: [{
4969
+ type: "World",
4970
+ name: "gallery_world",
4971
+ bounds: {
4972
+ minX: -this.options.roomSpacing * 2,
4973
+ minY: 0,
4974
+ minZ: -this.options.roomSpacing * 2,
4975
+ maxX: this.options.roomSpacing * 2,
4976
+ maxY: 10,
4977
+ maxZ: this.options.roomSpacing * 2
4978
+ }
4979
+ }],
4980
+ templates: [],
4981
+ imports: [],
4982
+ transitions: [],
4983
+ conditionals: [],
4984
+ iterators: [],
4985
+ timelines: [],
4986
+ audio: [],
4987
+ zones: [],
4988
+ npcs: [],
4989
+ quests: [],
4990
+ abilities: [],
4991
+ dialogues: [],
4992
+ stateMachines: [],
4993
+ achievements: [],
4994
+ talentTrees: [],
4995
+ shapes: [],
4996
+ metadata: {
4997
+ ...bundle.propertyMetadata,
4998
+ compiler: "hologram_mls",
4999
+ version: "1.0.0"
5000
+ }
5001
+ };
5002
+ return {
5003
+ success: true,
5004
+ composition,
5005
+ stats,
5006
+ warnings,
5007
+ errors
5008
+ };
5009
+ }
5010
+ buildEmptyComposition() {
5011
+ return {
5012
+ type: "Composition",
5013
+ name: "HoloGram MLS Gallery (Empty)",
5014
+ objects: [],
5015
+ spatialGroups: [],
5016
+ lights: [],
5017
+ templates: [],
5018
+ imports: [],
5019
+ transitions: [],
5020
+ conditionals: [],
5021
+ iterators: [],
5022
+ timelines: [],
5023
+ audio: [],
5024
+ zones: [],
5025
+ npcs: [],
5026
+ quests: [],
5027
+ abilities: [],
5028
+ dialogues: [],
5029
+ stateMachines: [],
5030
+ achievements: [],
5031
+ talentTrees: [],
5032
+ shapes: []
5033
+ };
5034
+ }
5035
+ };
5036
+ function createHoloGramMLSCompiler(options) {
5037
+ return new HoloGramMLSCompiler(options);
5038
+ }
5039
+
5040
+ // src/compiler/TraitRegistryBridge.ts
5041
+ chunkY3MWXQSB_cjs.init_AndroidXRTraitMap();
5042
+ chunkIVIA7K75_cjs.init_VisionOSTraitMap();
5043
+ chunk5FSKKMR7_cjs.init_traitDocs();
5044
+ function normaliseTraitName(name) {
5045
+ return name.toLowerCase().replace(/^@/, "").replace(/trait$/i, "").replace(/_/g, "-").trim();
5046
+ }
5047
+ function queryTrait(name, opts = {}) {
5048
+ const target = opts.target || "core";
5049
+ if (target === "android-xr") {
5050
+ const map = chunkY3MWXQSB_cjs.getTraitMapping(name);
5051
+ if (map) {
5052
+ return {
5053
+ name,
5054
+ exists: true,
5055
+ level: map.level,
5056
+ codegen: opts.includeCodegen ? map.generate?.(name, {}) : void 0,
5057
+ sourceMap: "AndroidXRTraitMap"
5058
+ };
5059
+ }
5060
+ }
5061
+ if (target === "visionos") {
5062
+ const map = chunkIVIA7K75_cjs.getTraitMapping(name);
5063
+ if (map) {
5064
+ return {
5065
+ name,
5066
+ exists: true,
5067
+ level: map.level,
5068
+ codegen: opts.includeCodegen ? map.generate?.(name, {}) : void 0,
5069
+ sourceMap: "VisionOSTraitMap"
5070
+ };
5071
+ }
5072
+ return { name, exists: false, sourceMap: "VisionOSTraitMap" };
5073
+ }
5074
+ const normalised = normaliseTraitName(name);
5075
+ if (chunk6S6TKNEA_cjs.vrTraitRegistry.has(normalised)) {
5076
+ const handler = chunk6S6TKNEA_cjs.vrTraitRegistry.getHandler(normalised);
5077
+ const doc2 = chunk5FSKKMR7_cjs.getTraitDoc(name);
5078
+ return {
5079
+ name,
5080
+ exists: true,
5081
+ sourceMap: "VRTraitRegistry",
5082
+ level: handler?.defaultConfig ? String(handler.defaultConfig.level ?? "core") : "core",
5083
+ description: doc2?.description,
5084
+ category: doc2?.category,
5085
+ annotation: doc2?.annotation
5086
+ };
5087
+ }
5088
+ const doc = chunk5FSKKMR7_cjs.getTraitDoc(name);
5089
+ if (doc) {
5090
+ return {
5091
+ name,
5092
+ exists: true,
5093
+ sourceMap: "traitDocs",
5094
+ description: doc.description,
5095
+ category: doc.category,
5096
+ annotation: doc.annotation
5097
+ };
5098
+ }
5099
+ return {
5100
+ name,
5101
+ exists: false,
5102
+ sourceMap: "core-traits (not found in any registry)"
5103
+ };
5104
+ }
5105
+ function generateTraitForTarget(name, target, config = {}) {
5106
+ if (target === "android-xr" || target === "android") {
5107
+ return chunkY3MWXQSB_cjs.getTraitMapping(name)?.generate?.(name, config) ?? [
5108
+ `// @${name} not yet mapped for android-xr (see AndroidXRTraitMap)`
5109
+ ];
5110
+ }
5111
+ if (target === "visionos") {
5112
+ return chunkIVIA7K75_cjs.generateTraitCode(name, name, config) ?? [
5113
+ `// @${name} not yet mapped for visionos (see VisionOSTraitMap)`
5114
+ ];
5115
+ }
5116
+ const info = queryTrait(name, { target: "core" });
5117
+ if (info.exists) {
5118
+ return [
5119
+ `// @${name} \u2014 core trait (registered in ${info.sourceMap}), no platform-specific codegen for "${target}"`,
5120
+ `// trait level: ${info.level ?? "unknown"}, category: ${info.category ?? "unknown"}`
5121
+ ];
5122
+ }
5123
+ return [`// @${name} \u2014 no codegen path registered for target "${target}" yet`];
5124
+ }
5125
+ function listTraitsForTarget(target) {
5126
+ if (target === "android-xr") {
5127
+ return Object.keys(chunkY3MWXQSB_cjs.ANDROIDXR_TRAIT_MAP);
5128
+ }
5129
+ if (target === "visionos") {
5130
+ return chunkIVIA7K75_cjs.listAllTraits ? chunkIVIA7K75_cjs.listAllTraits() : [];
5131
+ }
5132
+ if (target === "core") {
5133
+ const seen = /* @__PURE__ */ new Set();
5134
+ const result = [];
5135
+ for (const name of chunk6S6TKNEA_cjs.vrTraitRegistry.getRegisteredTraits()) {
5136
+ const norm = normaliseTraitName(name);
5137
+ if (!seen.has(norm)) {
5138
+ seen.add(norm);
5139
+ result.push(name);
5140
+ }
5141
+ }
5142
+ for (const annotation of chunk5FSKKMR7_cjs.getAllTraitNames()) {
5143
+ const norm = normaliseTraitName(annotation);
5144
+ if (!seen.has(norm)) {
5145
+ seen.add(norm);
5146
+ result.push(annotation);
5147
+ }
5148
+ }
5149
+ return result;
5150
+ }
5151
+ return [];
5152
+ }
5153
+ function traitExists(name) {
5154
+ const normalised = normaliseTraitName(name);
5155
+ if (chunk6S6TKNEA_cjs.vrTraitRegistry.has(normalised)) {
5156
+ return true;
5157
+ }
5158
+ const doc = chunk5FSKKMR7_cjs.getTraitDoc(name);
5159
+ if (doc) {
5160
+ return true;
5161
+ }
5162
+ if (chunkY3MWXQSB_cjs.getTraitMapping(name)) {
5163
+ return true;
5164
+ }
5165
+ if (chunkIVIA7K75_cjs.getTraitMapping(name)) {
5166
+ return true;
5167
+ }
5168
+ return false;
5169
+ }
5170
+ function getTraitInfo(name) {
5171
+ const info = queryTrait(name, { target: "core" });
5172
+ if (!info.exists) return void 0;
5173
+ return info;
5174
+ }
5175
+
5176
+ // src/compiler/platform/PlatformCompilerPlugin.ts
5177
+ var PlatformPluginRegistry = class {
5178
+ constructor() {
5179
+ this.plugins = /* @__PURE__ */ new Map();
5180
+ this.targetIndex = /* @__PURE__ */ new Map();
5181
+ }
5182
+ /**
5183
+ * Register a plugin. Indexes by name and by each target.
5184
+ * Overwrites any existing plugin with the same name.
5185
+ */
5186
+ register(plugin) {
5187
+ const { name } = plugin.metadata;
5188
+ const existing = this.plugins.get(name);
5189
+ if (existing) {
5190
+ for (const target of existing.metadata.targets) {
5191
+ this.targetIndex.delete(target);
5192
+ }
5193
+ }
5194
+ this.plugins.set(name, plugin);
5195
+ for (const target of plugin.metadata.targets) {
5196
+ this.targetIndex.set(target, plugin);
5197
+ }
5198
+ }
5199
+ /** Get a plugin by its unique name */
5200
+ getByName(name) {
5201
+ return this.plugins.get(name);
5202
+ }
5203
+ /** Get the plugin that handles a given target */
5204
+ getPluginForTarget(target) {
5205
+ return this.targetIndex.get(target);
5206
+ }
5207
+ /** List all registered plugin names */
5208
+ listPluginNames() {
5209
+ return [...this.plugins.keys()];
5210
+ }
5211
+ /** Get all registered plugins */
5212
+ listPlugins() {
5213
+ return [...this.plugins.values()];
5214
+ }
5215
+ /** Get all supported targets across all plugins */
5216
+ listAllTargets() {
5217
+ return [...this.targetIndex.keys()];
5218
+ }
5219
+ /** Unregister a plugin by name, cleaning up target index */
5220
+ unregister(name) {
5221
+ const plugin = this.plugins.get(name);
5222
+ if (plugin) {
5223
+ for (const target of plugin.metadata.targets) {
5224
+ this.targetIndex.delete(target);
5225
+ }
5226
+ this.plugins.delete(name);
5227
+ }
5228
+ }
5229
+ /** Unregister all plugins */
5230
+ clear() {
5231
+ this.plugins.clear();
5232
+ this.targetIndex.clear();
5233
+ }
5234
+ };
5235
+ var platformPluginRegistry = new PlatformPluginRegistry();
5236
+ function manifestFromPlugin(plugin) {
5237
+ const { name, version, targets, sizeKB, integrity } = plugin.metadata;
5238
+ const shortName = name.replace(/^holoscript-plugin-/, "");
5239
+ return {
5240
+ name,
5241
+ version,
5242
+ targets,
5243
+ wasmUrl: `plugins/holoscript-plugin-${shortName}.component.wasm`,
5244
+ sizeKB,
5245
+ integrity
5246
+ };
5247
+ }
5248
+ function getAllManifests() {
5249
+ return platformPluginRegistry.listPlugins().map(manifestFromPlugin);
5250
+ }
5251
+
5252
+ // src/compiler/platform/plugins/WebGPUWGSLPlugin.ts
5253
+ chunkH3MGK7TX_cjs.init_WebGPUCompiler();
5254
+ var WEBGPU_WGSL_METADATA = {
5255
+ name: "holoscript-plugin-webgpu-wgsl",
5256
+ version: "1.0.0",
5257
+ targets: ["web"],
5258
+ // webgpu-wgsl maps to 'web' in PlatformTarget
5259
+ sizeKB: 220,
5260
+ minCoreVersion: "6.0.0"
5261
+ };
5262
+ var WebGPUWGSLPlugin = class {
5263
+ constructor() {
5264
+ this.metadata = WEBGPU_WGSL_METADATA;
5265
+ }
5266
+ // ─────────────────────────────────────────────────────────────────────
5267
+ // Core compilation
5268
+ // ─────────────────────────────────────────────────────────────────────
5269
+ compile(astJson, target) {
5270
+ let ast;
5271
+ try {
5272
+ ast = JSON.parse(astJson);
5273
+ } catch {
5274
+ return {
5275
+ type: "error",
5276
+ diagnostics: [{ severity: "error", message: "WebGPU plugin: invalid AST JSON input" }]
5277
+ };
5278
+ }
5279
+ switch (target) {
5280
+ case "web": {
5281
+ try {
5282
+ const compiler = new chunkH3MGK7TX_cjs.WebGPUCompiler({ enableCompute: true });
5283
+ const result = compiler.compile(ast, "");
5284
+ return { type: "text", data: result };
5285
+ } catch (err) {
5286
+ return {
5287
+ type: "error",
5288
+ diagnostics: [
5289
+ {
5290
+ severity: "error",
5291
+ message: `WebGPU compilation failed: ${err instanceof Error ? err.message : String(err)}`
5292
+ }
5293
+ ]
5294
+ };
5295
+ }
5296
+ }
5297
+ default:
5298
+ return {
5299
+ type: "error",
5300
+ diagnostics: [
5301
+ {
5302
+ severity: "error",
5303
+ message: `WebGPU plugin: unsupported target '${target}'. Supported: web`
5304
+ }
5305
+ ]
5306
+ };
5307
+ }
5308
+ }
5309
+ // ─────────────────────────────────────────────────────────────────────
5310
+ // Trait evaluation (delegates to TraitRegistryBridge)
5311
+ // ─────────────────────────────────────────────────────────────────────
5312
+ traitExists(name) {
5313
+ return traitExists(name);
5314
+ }
5315
+ traitQuery(name, opts) {
5316
+ return queryTrait(name, { target: "webgpu", ...opts });
5317
+ }
5318
+ traitList() {
5319
+ return listTraitsForTarget("core");
5320
+ }
5321
+ // ─────────────────────────────────────────────────────────────────────
5322
+ // Trait codegen (WGSL-specific)
5323
+ // ─────────────────────────────────────────────────────────────────────
5324
+ traitCodegen(traitName, context) {
5325
+ const { target, config, format } = context;
5326
+ if (!this.traitExists(traitName)) {
5327
+ return {
5328
+ code: [`// @${traitName} \u2014 trait not found in any registry`],
5329
+ language: "wgsl",
5330
+ fidelity: "stub",
5331
+ sourceMap: "WebGPUWGSLPlugin"
5332
+ };
5333
+ }
5334
+ const webgpuCode = generateTraitForTarget(traitName, "webgpu-wgsl", config);
5335
+ if (webgpuCode.length > 0 && !webgpuCode[0].startsWith("//")) {
5336
+ return {
5337
+ code: webgpuCode,
5338
+ language: "wgsl",
5339
+ fidelity: "full",
5340
+ sourceMap: "TraitRegistryBridge/webgpu-wgsl",
5341
+ ...context.includeProvenance && {
5342
+ provenance: {
5343
+ pluginName: this.metadata.name,
5344
+ pluginVersion: this.metadata.version,
5345
+ traitName,
5346
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5347
+ }
5348
+ }
5349
+ };
5350
+ }
5351
+ const coreCode = generateTraitForTarget(traitName, "core", config);
5352
+ return {
5353
+ code: coreCode,
5354
+ language: "wgsl",
5355
+ fidelity: coreCode[0]?.startsWith("//") ? "stub" : "partial",
5356
+ sourceMap: "TraitRegistryBridge/core",
5357
+ ...context.includeProvenance && {
5358
+ provenance: {
5359
+ pluginName: this.metadata.name,
5360
+ pluginVersion: this.metadata.version,
5361
+ traitName,
5362
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5363
+ }
5364
+ }
5365
+ };
5366
+ }
5367
+ // ─────────────────────────────────────────────────────────────────────
5368
+ // Lifecycle
5369
+ // ─────────────────────────────────────────────────────────────────────
5370
+ unload() {
5371
+ }
5372
+ };
5373
+ platformPluginRegistry.register(new WebGPUWGSLPlugin());
5374
+
5375
+ // src/compiler/platform/plugins/AndroidARCorePlugin.ts
5376
+ chunkY3MWXQSB_cjs.init_AndroidXRCompiler();
5377
+ var ANDROID_ARCORE_METADATA = {
5378
+ name: "holoscript-plugin-android-arcore",
5379
+ version: "1.0.0",
5380
+ targets: ["android-xr", "android-xr-ar"],
5381
+ sizeKB: 300,
5382
+ minCoreVersion: "6.0.0"
5383
+ };
5384
+ var AndroidARCorePlugin = class {
5385
+ constructor() {
5386
+ this.metadata = ANDROID_ARCORE_METADATA;
5387
+ }
5388
+ // ─────────────────────────────────────────────────────────────────────
5389
+ // Core compilation
5390
+ // ─────────────────────────────────────────────────────────────────────
5391
+ compile(astJson, target) {
5392
+ let ast;
5393
+ try {
5394
+ ast = JSON.parse(astJson);
5395
+ } catch {
5396
+ return {
5397
+ type: "error",
5398
+ diagnostics: [
5399
+ { severity: "error", message: "Android/ARCore plugin: invalid AST JSON input" }
5400
+ ]
5401
+ };
5402
+ }
5403
+ switch (target) {
5404
+ case "android-xr":
5405
+ case "android-xr-ar": {
5406
+ try {
5407
+ const compiler = new chunkY3MWXQSB_cjs.AndroidXRCompiler({
5408
+ formFactor: target === "android-xr-ar" ? "glasses" : "headset"
5409
+ });
5410
+ const result = compiler.compile(ast, "apl-plugin-token");
5411
+ const output = typeof result === "string" ? result : JSON.stringify(result, null, 2);
5412
+ return { type: "text", data: output };
5413
+ } catch (err) {
5414
+ return {
5415
+ type: "error",
5416
+ diagnostics: [
5417
+ {
5418
+ severity: "error",
5419
+ message: `Android/ARCore compilation failed: ${err instanceof Error ? err.message : String(err)}`
5420
+ }
5421
+ ]
5422
+ };
5423
+ }
5424
+ }
5425
+ default:
5426
+ return {
5427
+ type: "error",
5428
+ diagnostics: [
5429
+ {
5430
+ severity: "error",
5431
+ message: `Android/ARCore plugin: unsupported target '${target}'. Supported: android-xr, android-xr-ar`
5432
+ }
5433
+ ]
5434
+ };
5435
+ }
5436
+ }
5437
+ // ─────────────────────────────────────────────────────────────────────
5438
+ // Trait evaluation (delegates to TraitRegistryBridge)
5439
+ // ─────────────────────────────────────────────────────────────────────
5440
+ traitExists(name) {
5441
+ return traitExists(name);
5442
+ }
5443
+ traitQuery(name, opts) {
5444
+ return queryTrait(name, { target: "android-xr", ...opts });
5445
+ }
5446
+ traitList() {
5447
+ return listTraitsForTarget("android-xr");
5448
+ }
5449
+ // ─────────────────────────────────────────────────────────────────────
5450
+ // Trait codegen (Kotlin/ARCore-specific)
5451
+ // ─────────────────────────────────────────────────────────────────────
5452
+ traitCodegen(traitName, context) {
5453
+ const { target, config, format } = context;
5454
+ if (!this.traitExists(traitName)) {
5455
+ return {
5456
+ code: [`// @${traitName} \u2014 trait not found in any registry`],
5457
+ language: "kotlin",
5458
+ fidelity: "stub",
5459
+ sourceMap: "AndroidARCorePlugin"
5460
+ };
5461
+ }
5462
+ const androidCode = generateTraitForTarget(traitName, "android-xr", config);
5463
+ if (androidCode.length > 0 && !androidCode[0].startsWith("//")) {
5464
+ return {
5465
+ code: androidCode,
5466
+ language: "kotlin",
5467
+ fidelity: "full",
5468
+ sourceMap: "AndroidXRTraitMap",
5469
+ ...context.includeProvenance && {
5470
+ provenance: {
5471
+ pluginName: this.metadata.name,
5472
+ pluginVersion: this.metadata.version,
5473
+ traitName,
5474
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5475
+ }
5476
+ }
5477
+ };
5478
+ }
5479
+ const coreCode = generateTraitForTarget(traitName, "core", config);
5480
+ return {
5481
+ code: coreCode,
5482
+ language: "kotlin",
5483
+ fidelity: coreCode[0]?.startsWith("//") ? "stub" : "partial",
5484
+ sourceMap: "TraitRegistryBridge/core",
5485
+ ...context.includeProvenance && {
5486
+ provenance: {
5487
+ pluginName: this.metadata.name,
5488
+ pluginVersion: this.metadata.version,
5489
+ traitName,
5490
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5491
+ }
5492
+ }
5493
+ };
5494
+ }
5495
+ // ─────────────────────────────────────────────────────────────────────
5496
+ // Lifecycle
5497
+ // ─────────────────────────────────────────────────────────────────────
5498
+ unload() {
5499
+ }
5500
+ };
5501
+ platformPluginRegistry.register(new AndroidARCorePlugin());
5502
+
5503
+ Object.defineProperty(exports, "createReproducibilityContext", {
5504
+ enumerable: true,
5505
+ get: function () { return chunkVJ3L7CHT_cjs.createReproducibilityContext; }
5506
+ });
5507
+ Object.defineProperty(exports, "parseReproducibilityFlags", {
5508
+ enumerable: true,
5509
+ get: function () { return chunkVJ3L7CHT_cjs.parseReproducibilityFlags; }
5510
+ });
5511
+ Object.defineProperty(exports, "ContextCompileError", {
5512
+ enumerable: true,
5513
+ get: function () { return chunkZUL5AVTX_cjs.ContextCompileError; }
5514
+ });
5515
+ Object.defineProperty(exports, "ContextCompiler", {
5516
+ enumerable: true,
5517
+ get: function () { return chunkZUL5AVTX_cjs.ContextCompiler; }
5518
+ });
5519
+ Object.defineProperty(exports, "createContextCompiler", {
5520
+ enumerable: true,
5521
+ get: function () { return chunkZUL5AVTX_cjs.createContextCompiler; }
5522
+ });
5523
+ Object.defineProperty(exports, "LLMCapabilityCompileError", {
5524
+ enumerable: true,
5525
+ get: function () { return chunkGCMWDSBZ_cjs.LLMCapabilityCompileError; }
5526
+ });
5527
+ Object.defineProperty(exports, "LLMProviderCapabilitiesCompiler", {
5528
+ enumerable: true,
5529
+ get: function () { return chunkGCMWDSBZ_cjs.LLMProviderCapabilitiesCompiler; }
5530
+ });
5531
+ Object.defineProperty(exports, "createLLMProviderCapabilitiesCompiler", {
5532
+ enumerable: true,
5533
+ get: function () { return chunkGCMWDSBZ_cjs.createLLMProviderCapabilitiesCompiler; }
5534
+ });
5535
+ Object.defineProperty(exports, "GLTF_PIPELINE_TOOLS", {
5536
+ enumerable: true,
5537
+ get: function () { return chunkW6P2GBHH_cjs.GLTF_PIPELINE_TOOLS; }
5538
+ });
5539
+ Object.defineProperty(exports, "registerGLTFTools", {
5540
+ enumerable: true,
5541
+ get: function () { return chunkW6P2GBHH_cjs.registerGLTFTools; }
5542
+ });
5543
+ Object.defineProperty(exports, "BUSINESS_QUEST_TOOLS", {
5544
+ enumerable: true,
5545
+ get: function () { return chunk4SY77NA4_cjs.BUSINESS_QUEST_TOOLS; }
5546
+ });
5547
+ Object.defineProperty(exports, "buildVRRCompositionFromDraft", {
5548
+ enumerable: true,
5549
+ get: function () { return chunk4SY77NA4_cjs.buildVRRCompositionFromDraft; }
5550
+ });
5551
+ Object.defineProperty(exports, "businessVRRDraftSchema", {
5552
+ enumerable: true,
5553
+ get: function () { return chunk4SY77NA4_cjs.businessVRRDraftSchema; }
5554
+ });
5555
+ Object.defineProperty(exports, "draftToHoloPreview", {
5556
+ enumerable: true,
5557
+ get: function () { return chunk4SY77NA4_cjs.draftToHoloPreview; }
5558
+ });
5559
+ Object.defineProperty(exports, "handleBusinessQuestToolCall", {
5560
+ enumerable: true,
5561
+ get: function () { return chunk4SY77NA4_cjs.handleBusinessQuestToolCall; }
5562
+ });
5563
+ Object.defineProperty(exports, "registerBusinessQuestTools", {
5564
+ enumerable: true,
5565
+ get: function () { return chunk4SY77NA4_cjs.registerBusinessQuestTools; }
5566
+ });
5567
+ Object.defineProperty(exports, "validateBusinessVRRDraft", {
5568
+ enumerable: true,
5569
+ get: function () { return chunk4SY77NA4_cjs.validateBusinessVRRDraft; }
5570
+ });
5571
+ Object.defineProperty(exports, "NodeToyMapper", {
5572
+ enumerable: true,
5573
+ get: function () { return chunkS6YWHCKV_cjs.NodeToyMapper; }
5574
+ });
5575
+ Object.defineProperty(exports, "mapNodeToyToShader", {
5576
+ enumerable: true,
5577
+ get: function () { return chunkS6YWHCKV_cjs.mapNodeToyToShader; }
5578
+ });
5579
+ Object.defineProperty(exports, "QuantumCircuitCompiler", {
5580
+ enumerable: true,
5581
+ get: function () { return chunk5N54COB6_cjs.QuantumCircuitCompiler; }
5582
+ });
2387
5583
  Object.defineProperty(exports, "CompilerBridge", {
2388
5584
  enumerable: true,
2389
- get: function () { return chunkF3HH56EB_cjs.CompilerBridge; }
5585
+ get: function () { return chunkQWNQ523V_cjs.CompilerBridge; }
5586
+ });
5587
+ Object.defineProperty(exports, "GaussianSplattingCompiler", {
5588
+ enumerable: true,
5589
+ get: function () { return chunkQWNQ523V_cjs.GaussianSplattingCompiler; }
5590
+ });
5591
+ Object.defineProperty(exports, "SHARED_SORT_SHADER_PATH", {
5592
+ enumerable: true,
5593
+ get: function () { return chunkQWNQ523V_cjs.SHARED_SORT_SHADER_PATH; }
5594
+ });
5595
+ Object.defineProperty(exports, "SpatialPartitionPass", {
5596
+ enumerable: true,
5597
+ get: function () { return chunkQWNQ523V_cjs.SpatialPartitionPass; }
2390
5598
  });
2391
5599
  Object.defineProperty(exports, "USDZPipeline", {
2392
5600
  enumerable: true,
2393
- get: function () { return chunkF3HH56EB_cjs.USDZPipeline; }
5601
+ get: function () { return chunkQWNQ523V_cjs.USDZPipeline; }
2394
5602
  });
2395
5603
  Object.defineProperty(exports, "bestCategoryForTraits", {
2396
5604
  enumerable: true,
2397
- get: function () { return chunkF3HH56EB_cjs.bestCategoryForTraits; }
5605
+ get: function () { return chunkQWNQ523V_cjs.bestCategoryForTraits; }
2398
5606
  });
2399
5607
  Object.defineProperty(exports, "compilePipelineSource", {
2400
5608
  enumerable: true,
2401
- get: function () { return chunkF3HH56EB_cjs.compilePipelineSource; }
5609
+ get: function () { return chunkQWNQ523V_cjs.compilePipelineSource; }
2402
5610
  });
2403
5611
  Object.defineProperty(exports, "compilePipelineSourceToNode", {
2404
5612
  enumerable: true,
2405
- get: function () { return chunkF3HH56EB_cjs.compilePipelineSourceToNode; }
5613
+ get: function () { return chunkQWNQ523V_cjs.compilePipelineSourceToNode; }
2406
5614
  });
2407
5615
  Object.defineProperty(exports, "compilePipelineSourceToPython", {
2408
5616
  enumerable: true,
2409
- get: function () { return chunkF3HH56EB_cjs.compilePipelineSourceToPython; }
5617
+ get: function () { return chunkQWNQ523V_cjs.compilePipelineSourceToPython; }
2410
5618
  });
2411
5619
  Object.defineProperty(exports, "compilePipelineToNode", {
2412
5620
  enumerable: true,
2413
- get: function () { return chunkF3HH56EB_cjs.compilePipelineToNode; }
5621
+ get: function () { return chunkQWNQ523V_cjs.compilePipelineToNode; }
2414
5622
  });
2415
5623
  Object.defineProperty(exports, "compilePipelineToPython", {
2416
5624
  enumerable: true,
2417
- get: function () { return chunkF3HH56EB_cjs.compilePipelineToPython; }
5625
+ get: function () { return chunkQWNQ523V_cjs.compilePipelineToPython; }
5626
+ });
5627
+ Object.defineProperty(exports, "createGaussianSplattingCompiler", {
5628
+ enumerable: true,
5629
+ get: function () { return chunkQWNQ523V_cjs.createGaussianSplattingCompiler; }
5630
+ });
5631
+ Object.defineProperty(exports, "detectMultiUserSharedSort", {
5632
+ enumerable: true,
5633
+ get: function () { return chunkQWNQ523V_cjs.detectMultiUserSharedSort; }
2418
5634
  });
2419
5635
  Object.defineProperty(exports, "quickSafetyCheck", {
2420
5636
  enumerable: true,
2421
- get: function () { return chunkF3HH56EB_cjs.quickSafetyCheck; }
5637
+ get: function () { return chunkQWNQ523V_cjs.quickSafetyCheck; }
2422
5638
  });
2423
5639
  Object.defineProperty(exports, "runSafetyPass", {
2424
5640
  enumerable: true,
2425
- get: function () { return chunkF3HH56EB_cjs.runSafetyPass; }
5641
+ get: function () { return chunkQWNQ523V_cjs.runSafetyPass; }
2426
5642
  });
2427
5643
  Object.defineProperty(exports, "selectModality", {
2428
5644
  enumerable: true,
2429
- get: function () { return chunkF3HH56EB_cjs.selectModality; }
5645
+ get: function () { return chunkQWNQ523V_cjs.selectModality; }
2430
5646
  });
2431
5647
  Object.defineProperty(exports, "selectModalityForAll", {
2432
5648
  enumerable: true,
2433
- get: function () { return chunkF3HH56EB_cjs.selectModalityForAll; }
5649
+ get: function () { return chunkQWNQ523V_cjs.selectModalityForAll; }
5650
+ });
5651
+ Object.defineProperty(exports, "spatialPartition", {
5652
+ enumerable: true,
5653
+ get: function () { return chunkQWNQ523V_cjs.spatialPartition; }
2434
5654
  });
2435
5655
  Object.defineProperty(exports, "generateHullGeometry", {
2436
5656
  enumerable: true,
2437
- get: function () { return chunkLK5IAVH6_cjs.generateHullGeometry; }
5657
+ get: function () { return chunkEXUP2BUM_cjs.generateHullGeometry; }
2438
5658
  });
2439
5659
  Object.defineProperty(exports, "generateMembraneGeometry", {
2440
5660
  enumerable: true,
2441
- get: function () { return chunkLK5IAVH6_cjs.generateMembraneGeometry; }
5661
+ get: function () { return chunkEXUP2BUM_cjs.generateMembraneGeometry; }
2442
5662
  });
2443
5663
  Object.defineProperty(exports, "generateSplineGeometry", {
2444
5664
  enumerable: true,
2445
- get: function () { return chunkLK5IAVH6_cjs.generateSplineGeometry; }
2446
- });
2447
- Object.defineProperty(exports, "RemotionBridge", {
2448
- enumerable: true,
2449
- get: function () { return chunkXUILI4KB_cjs.RemotionBridgeImpl; }
5665
+ get: function () { return chunkEXUP2BUM_cjs.generateSplineGeometry; }
2450
5666
  });
2451
5667
  Object.defineProperty(exports, "SemanticSceneGraph", {
2452
5668
  enumerable: true,
@@ -2456,123 +5672,189 @@ Object.defineProperty(exports, "COCOExporter", {
2456
5672
  enumerable: true,
2457
5673
  get: function () { return chunkI6XZ5DZF_cjs.COCOExporterImpl; }
2458
5674
  });
5675
+ Object.defineProperty(exports, "RemotionBridge", {
5676
+ enumerable: true,
5677
+ get: function () { return chunkXUILI4KB_cjs.RemotionBridgeImpl; }
5678
+ });
5679
+ Object.defineProperty(exports, "IncrementalCompiler", {
5680
+ enumerable: true,
5681
+ get: function () { return chunkIRWWS72C_cjs.IncrementalCompiler; }
5682
+ });
5683
+ Object.defineProperty(exports, "createIncrementalCompiler", {
5684
+ enumerable: true,
5685
+ get: function () { return chunkIRWWS72C_cjs.createIncrementalCompiler; }
5686
+ });
5687
+ Object.defineProperty(exports, "WASMCompiler", {
5688
+ enumerable: true,
5689
+ get: function () { return chunkMXJ5SS53_cjs.WASMCompiler; }
5690
+ });
5691
+ Object.defineProperty(exports, "WebGPUCompiler", {
5692
+ enumerable: true,
5693
+ get: function () { return chunkH3MGK7TX_cjs.WebGPUCompiler; }
5694
+ });
2459
5695
  Object.defineProperty(exports, "DTDLCompiler", {
2460
5696
  enumerable: true,
2461
- get: function () { return chunkQLEAOI3Q_cjs.DTDLCompiler; }
5697
+ get: function () { return chunkGQYKQSTC_cjs.DTDLCompiler; }
2462
5698
  });
2463
5699
  Object.defineProperty(exports, "URDFCompiler", {
2464
5700
  enumerable: true,
2465
- get: function () { return chunk6TZPZCOJ_cjs.URDFCompiler; }
5701
+ get: function () { return chunkZKSS47EV_cjs.URDFCompiler; }
5702
+ });
5703
+ Object.defineProperty(exports, "createURDFCompiler", {
5704
+ enumerable: true,
5705
+ get: function () { return chunkZKSS47EV_cjs.createURDFCompiler; }
2466
5706
  });
2467
5707
  Object.defineProperty(exports, "USDPhysicsCompiler", {
2468
5708
  enumerable: true,
2469
- get: function () { return chunkEQV4R3EV_cjs.USDPhysicsCompiler; }
5709
+ get: function () { return chunkV73NPPTM_cjs.USDPhysicsCompiler; }
2470
5710
  });
2471
5711
  Object.defineProperty(exports, "SDFCompiler", {
2472
5712
  enumerable: true,
2473
- get: function () { return chunk7AGYRWKW_cjs.SDFCompiler; }
5713
+ get: function () { return chunkXFXGA5IW_cjs.SDFCompiler; }
2474
5714
  });
2475
5715
  Object.defineProperty(exports, "StateCompiler", {
2476
5716
  enumerable: true,
2477
- get: function () { return chunkB5TCIAPQ_cjs.StateCompiler; }
5717
+ get: function () { return chunkAO4I2Z7M_cjs.StateCompiler; }
2478
5718
  });
2479
5719
  Object.defineProperty(exports, "TraitCompositionCompiler", {
2480
5720
  enumerable: true,
2481
- get: function () { return chunkXRKWN5PL_cjs.TraitCompositionCompiler; }
5721
+ get: function () { return chunkH5DZIHJP_cjs.TraitCompositionCompiler; }
2482
5722
  });
2483
- Object.defineProperty(exports, "IncrementalCompiler", {
5723
+ Object.defineProperty(exports, "GodotCompiler", {
2484
5724
  enumerable: true,
2485
- get: function () { return chunkFSF7EQVA_cjs.IncrementalCompiler; }
5725
+ get: function () { return chunkDIL6DDDN_cjs.GodotCompiler; }
2486
5726
  });
2487
5727
  Object.defineProperty(exports, "ENVIRONMENT_PRESETS", {
2488
5728
  enumerable: true,
2489
- get: function () { return chunkQ5SJOGHQ_cjs.ENVIRONMENT_PRESETS; }
5729
+ get: function () { return chunkBPICAGBV_cjs.ENVIRONMENT_PRESETS; }
2490
5730
  });
2491
5731
  Object.defineProperty(exports, "R3FCompiler", {
2492
5732
  enumerable: true,
2493
- get: function () { return chunkQ5SJOGHQ_cjs.R3FCompiler; }
5733
+ get: function () { return chunkBPICAGBV_cjs.R3FCompiler; }
2494
5734
  });
2495
5735
  Object.defineProperty(exports, "PlayCanvasCompiler", {
2496
5736
  enumerable: true,
2497
- get: function () { return chunkXWPNTWDN_cjs.PlayCanvasCompiler; }
5737
+ get: function () { return chunkMJVIRCUV_cjs.PlayCanvasCompiler; }
2498
5738
  });
2499
5739
  Object.defineProperty(exports, "AndroidCompiler", {
2500
5740
  enumerable: true,
2501
- get: function () { return chunkNCUKG4SK_cjs.AndroidCompiler; }
5741
+ get: function () { return chunkOEV5RMZO_cjs.AndroidCompiler; }
2502
5742
  });
2503
5743
  Object.defineProperty(exports, "AndroidXRCompiler", {
2504
5744
  enumerable: true,
2505
- get: function () { return chunk4XSNJCLC_cjs.AndroidXRCompiler; }
5745
+ get: function () { return chunkY3MWXQSB_cjs.AndroidXRCompiler; }
2506
5746
  });
2507
5747
  Object.defineProperty(exports, "IOSCompiler", {
2508
5748
  enumerable: true,
2509
- get: function () { return chunkCBJSLA2E_cjs.IOSCompiler; }
5749
+ get: function () { return chunkZ5XMPRNC_cjs.IOSCompiler; }
2510
5750
  });
2511
5751
  Object.defineProperty(exports, "VisionOSCompiler", {
2512
5752
  enumerable: true,
2513
- get: function () { return chunk5O6TQC6M_cjs.VisionOSCompiler; }
2514
- });
2515
- Object.defineProperty(exports, "WASMCompiler", {
2516
- enumerable: true,
2517
- get: function () { return chunk6UEHYZ7V_cjs.WASMCompiler; }
5753
+ get: function () { return chunkIVIA7K75_cjs.VisionOSCompiler; }
2518
5754
  });
2519
- Object.defineProperty(exports, "WebGPUCompiler", {
5755
+ Object.defineProperty(exports, "MultiLayerCompiler", {
2520
5756
  enumerable: true,
2521
- get: function () { return chunkBND3ST2K_cjs.WebGPUCompiler; }
5757
+ get: function () { return chunk7AD52FRS_cjs.MultiLayerCompiler; }
2522
5758
  });
2523
- Object.defineProperty(exports, "MultiLayerCompiler", {
5759
+ Object.defineProperty(exports, "VRRCompiler", {
2524
5760
  enumerable: true,
2525
- get: function () { return chunkZP4D3CSX_cjs.MultiLayerCompiler; }
5761
+ get: function () { return chunk52ULD552_cjs.VRRCompiler; }
2526
5762
  });
2527
5763
  Object.defineProperty(exports, "ARCompiler", {
2528
5764
  enumerable: true,
2529
- get: function () { return chunkQ5JT3YML_cjs.ARCompiler; }
5765
+ get: function () { return chunkXXZJEFKW_cjs.ARCompiler; }
2530
5766
  });
2531
5767
  Object.defineProperty(exports, "OpenXRCompiler", {
2532
5768
  enumerable: true,
2533
- get: function () { return chunkFFKU7BTK_cjs.OpenXRCompiler; }
5769
+ get: function () { return chunkKHPCJRI3_cjs.OpenXRCompiler; }
2534
5770
  });
2535
5771
  Object.defineProperty(exports, "VRChatCompiler", {
2536
5772
  enumerable: true,
2537
- get: function () { return chunkZ34RLXRA_cjs.VRChatCompiler; }
5773
+ get: function () { return chunkHANL7K2Q_cjs.VRChatCompiler; }
2538
5774
  });
2539
5775
  Object.defineProperty(exports, "BabylonCompiler", {
2540
5776
  enumerable: true,
2541
- get: function () { return chunk33LSUQDD_cjs.BabylonCompiler; }
5777
+ get: function () { return chunkL63H3SQ4_cjs.BabylonCompiler; }
2542
5778
  });
2543
5779
  Object.defineProperty(exports, "UnityCompiler", {
2544
5780
  enumerable: true,
2545
- get: function () { return chunkHE7ULERA_cjs.UnityCompiler; }
5781
+ get: function () { return chunkKQTPCYTG_cjs.UnityCompiler; }
2546
5782
  });
2547
- Object.defineProperty(exports, "GodotCompiler", {
5783
+ Object.defineProperty(exports, "PlatformConditionalCompilerMixin", {
5784
+ enumerable: true,
5785
+ get: function () { return chunkAIA52I7T_cjs.PlatformConditionalCompilerMixin; }
5786
+ });
5787
+ Object.defineProperty(exports, "createPlatformTarget", {
5788
+ enumerable: true,
5789
+ get: function () { return chunkAIA52I7T_cjs.createPlatformTarget; }
5790
+ });
5791
+ Object.defineProperty(exports, "filterCompositionForPlatform", {
5792
+ enumerable: true,
5793
+ get: function () { return chunkAIA52I7T_cjs.filterCompositionForPlatform; }
5794
+ });
5795
+ Object.defineProperty(exports, "matchesPlatformConstraint", {
5796
+ enumerable: true,
5797
+ get: function () { return chunkAIA52I7T_cjs.matchesPlatformConstraint; }
5798
+ });
5799
+ Object.defineProperty(exports, "normalizePlatformName", {
2548
5800
  enumerable: true,
2549
- get: function () { return chunkXXINBTZK_cjs.GodotCompiler; }
5801
+ get: function () { return chunkAIA52I7T_cjs.normalizePlatformName; }
2550
5802
  });
2551
5803
  Object.defineProperty(exports, "CompilerBase", {
2552
5804
  enumerable: true,
2553
- get: function () { return chunkBF2235SI_cjs.CompilerBase; }
5805
+ get: function () { return chunkRMHC2VG7_cjs.CompilerBase; }
2554
5806
  });
2555
5807
  Object.defineProperty(exports, "CompilerDocumentationGenerator", {
2556
5808
  enumerable: true,
2557
- get: function () { return chunkBF2235SI_cjs.CompilerDocumentationGenerator; }
5809
+ get: function () { return chunkRMHC2VG7_cjs.CompilerDocumentationGenerator; }
2558
5810
  });
2559
5811
  Object.defineProperty(exports, "UnauthorizedCompilerAccessError", {
2560
5812
  enumerable: true,
2561
- get: function () { return chunkBF2235SI_cjs.UnauthorizedCompilerAccessError; }
5813
+ get: function () { return chunkRMHC2VG7_cjs.UnauthorizedCompilerAccessError; }
2562
5814
  });
2563
5815
  Object.defineProperty(exports, "createTestCompilerToken", {
2564
5816
  enumerable: true,
2565
- get: function () { return chunkBF2235SI_cjs.createTestCompilerToken; }
5817
+ get: function () { return chunkRMHC2VG7_cjs.createTestCompilerToken; }
2566
5818
  });
2567
5819
  Object.defineProperty(exports, "isCapabilityTokenCredential", {
2568
5820
  enumerable: true,
2569
- get: function () { return chunkBF2235SI_cjs.isCapabilityTokenCredential; }
5821
+ get: function () { return chunkRMHC2VG7_cjs.isCapabilityTokenCredential; }
2570
5822
  });
5823
+ exports.AgentTrustLedger = AgentTrustLedger;
5824
+ exports.AlphaTracker = AlphaTracker;
5825
+ exports.AndroidARCorePlugin = AndroidARCorePlugin;
5826
+ exports.DEFAULT_DISPATCH_LATENCY_OPERATION = DEFAULT_DISPATCH_LATENCY_OPERATION;
5827
+ exports.DispatchPolicy = DispatchPolicy;
5828
+ exports.DispatchTier = DispatchTier;
5829
+ exports.FlatSemanticCompiler = FlatSemanticCompiler;
5830
+ exports.HoloGramMLSCompiler = HoloGramMLSCompiler;
2571
5831
  exports.MCPConfigCompiler = MCPConfigCompiler;
5832
+ exports.MatterpakCompiler = MatterpakCompiler;
2572
5833
  exports.NextJSCompiler = NextJSCompiler;
5834
+ exports.SCMCompiler = SCMCompiler;
5835
+ exports.WebGPUWGSLPlugin = WebGPUWGSLPlugin;
5836
+ exports.byzantineResilientMerge = byzantineResilientMerge;
2573
5837
  exports.compileAllToNextJSAPI = compileAllToNextJSAPI;
2574
5838
  exports.compileToNextJSAPI = compileToNextJSAPI;
5839
+ exports.createDefaultDispatchLatencyScenarios = createDefaultDispatchLatencyScenarios;
5840
+ exports.createHoloGramMLSCompiler = createHoloGramMLSCompiler;
5841
+ exports.createMatterpakCompiler = createMatterpakCompiler;
5842
+ exports.createTier3CpuDirectOutput = createTier3CpuDirectOutput;
5843
+ exports.detectWasmRuntime = detectWasmRuntime;
2575
5844
  exports.ensureDialectsBooted = ensureDialectsBooted;
5845
+ exports.formatDispatchLatencyBenchmarkReport = formatDispatchLatencyBenchmarkReport;
5846
+ exports.generateTraitForTarget = generateTraitForTarget;
5847
+ exports.getAllManifests = getAllManifests;
5848
+ exports.getTraitInfo = getTraitInfo;
5849
+ exports.listTraitsForTarget = listTraitsForTarget;
5850
+ exports.manifestFromPlugin = manifestFromPlugin;
5851
+ exports.mergeSocialCausalModels = mergeSocialCausalModels;
5852
+ exports.platformPluginRegistry = platformPluginRegistry;
5853
+ exports.queryTrait = queryTrait;
5854
+ exports.recommendDispatchPolicyDefaults = recommendDispatchPolicyDefaults;
2576
5855
  exports.registerBuiltinDialects = registerBuiltinDialects;
5856
+ exports.runCompilerWasmSnnEmulator = runCompilerWasmSnnEmulator;
5857
+ exports.runDispatchPolicyLatencyBenchmark = runDispatchPolicyLatencyBenchmark;
5858
+ exports.traitExists = traitExists;
2577
5859
  //# sourceMappingURL=index.cjs.map
2578
5860
  //# sourceMappingURL=index.cjs.map