@holoscript/core 6.0.3 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/README.md +40 -40
  2. package/dist/codebase/index.d.ts +25 -0
  3. package/dist/compiler/index.d.ts +82 -0
  4. package/dist/constants.d.ts +4 -0
  5. package/dist/coordinators/index.d.ts +189 -0
  6. package/dist/entries/interop.d.ts +9 -0
  7. package/dist/entries/scripting.d.ts +7 -0
  8. package/dist/index.d.ts +520 -19
  9. package/dist/paper-0c-spike/index.d.ts +29 -0
  10. package/dist/reconstruction/index.d.ts +78 -0
  11. package/dist/self-improvement/index.d.ts +0 -48
  12. package/dist/storage/index.d.ts +24 -0
  13. package/dist/tools/index.d.ts +33 -0
  14. package/dist/traitDocs/traitDocs.d.ts +69 -0
  15. package/dist/traits/index.d.ts +61 -0
  16. package/package.json +102 -19
  17. package/dist/GLTFPipeline-3KLWWUQO.cjs +0 -34
  18. package/dist/GLTFPipeline-LYII2ZVQ.js +0 -13
  19. package/dist/HoloScriptPlusParser-BZR5DELQ.js +0 -692
  20. package/dist/HoloScriptPlusParser-SBMYDNXO.cjs +0 -697
  21. package/dist/USDZExporter-MHEHXZB4.cjs +0 -709
  22. package/dist/USDZExporter-YA55ZS35.js +0 -707
  23. package/dist/chunk-26TLYBFD.js +0 -309
  24. package/dist/chunk-27LWW5FU.cjs +0 -410
  25. package/dist/chunk-2UX5LRAP.cjs +0 -833
  26. package/dist/chunk-32TWR3HE.js +0 -70
  27. package/dist/chunk-3FXV5S25.cjs +0 -633
  28. package/dist/chunk-3FYZOR7S.cjs +0 -69
  29. package/dist/chunk-3KEU5QYY.cjs +0 -175
  30. package/dist/chunk-4FCZDTD5.js +0 -610
  31. package/dist/chunk-4KJ2R7VP.cjs +0 -507
  32. package/dist/chunk-4SMUJFHL.js +0 -1213
  33. package/dist/chunk-54FHG2MX.js +0 -655
  34. package/dist/chunk-56IF4NTA.js +0 -56
  35. package/dist/chunk-5GLCTO44.js +0 -161
  36. package/dist/chunk-5TOFIR6L.js +0 -407
  37. package/dist/chunk-65RFOWZI.js +0 -765
  38. package/dist/chunk-6OQBLABR.js +0 -5240
  39. package/dist/chunk-6WNCRE6F.js +0 -126
  40. package/dist/chunk-74YCHHTE.js +0 -1872
  41. package/dist/chunk-7H5UNJZD.cjs +0 -1973
  42. package/dist/chunk-7KPI4EKH.cjs +0 -701
  43. package/dist/chunk-7LCYLPW2.cjs +0 -663
  44. package/dist/chunk-7N3JIJMT.js +0 -1395
  45. package/dist/chunk-7X2IEJIE.cjs +0 -2526
  46. package/dist/chunk-A6GO3DPZ.cjs +0 -1002
  47. package/dist/chunk-AC4BSHFV.js +0 -765
  48. package/dist/chunk-AIUXRS74.cjs +0 -3681
  49. package/dist/chunk-ARNKA274.cjs +0 -130
  50. package/dist/chunk-AW7WAELW.js +0 -975
  51. package/dist/chunk-BKIGPPVM.js +0 -629
  52. package/dist/chunk-BO2OKHIY.js +0 -6055
  53. package/dist/chunk-BU5ZAFMC.js +0 -115
  54. package/dist/chunk-BY3B7ZYV.cjs +0 -457
  55. package/dist/chunk-C2QHVHZF.js +0 -4066
  56. package/dist/chunk-C7BNX4XJ.js +0 -1043
  57. package/dist/chunk-CLYEIWA5.cjs +0 -408
  58. package/dist/chunk-CMYAWUX3.js +0 -4455
  59. package/dist/chunk-CN4NOESF.cjs +0 -416
  60. package/dist/chunk-CNVM7J3M.js +0 -883
  61. package/dist/chunk-CO2VM2DK.js +0 -1965
  62. package/dist/chunk-CQDOF3G7.cjs +0 -1404
  63. package/dist/chunk-DH5G2JUA.cjs +0 -614
  64. package/dist/chunk-DIEDKX5B.cjs +0 -660
  65. package/dist/chunk-DN7UFU63.cjs +0 -172
  66. package/dist/chunk-DXVCEFZB.js +0 -2027
  67. package/dist/chunk-EGIZHYJP.cjs +0 -85
  68. package/dist/chunk-EJA7G2C4.cjs +0 -428
  69. package/dist/chunk-ELLQPFAF.js +0 -830
  70. package/dist/chunk-EMO7HAKJ.cjs +0 -1875
  71. package/dist/chunk-ENV7K6XA.js +0 -282
  72. package/dist/chunk-EPWRXL6S.js +0 -2522
  73. package/dist/chunk-EUFLX2PI.js +0 -56956
  74. package/dist/chunk-F5LVGHNT.js +0 -449
  75. package/dist/chunk-FEFHPUEM.cjs +0 -6122
  76. package/dist/chunk-FF3Q7ADR.js +0 -380
  77. package/dist/chunk-GC3YU46J.js +0 -762
  78. package/dist/chunk-H6WMMLQK.cjs +0 -4492
  79. package/dist/chunk-H7XMORZI.js +0 -2731
  80. package/dist/chunk-HAN4V3PF.cjs +0 -2037
  81. package/dist/chunk-HBZYCASG.js +0 -4208
  82. package/dist/chunk-HF4OFY25.cjs +0 -4097
  83. package/dist/chunk-HHS6FMOU.cjs +0 -3813
  84. package/dist/chunk-HJJLD366.js +0 -1169
  85. package/dist/chunk-HKCVM6OK.cjs +0 -2237
  86. package/dist/chunk-HUFNKFA6.js +0 -698
  87. package/dist/chunk-I3XGTIHM.cjs +0 -1505
  88. package/dist/chunk-I6XZ5DZF.cjs +0 -488
  89. package/dist/chunk-IHOUYQIA.js +0 -406
  90. package/dist/chunk-ILRBGFVD.cjs +0 -72
  91. package/dist/chunk-KDB6BUMB.js +0 -3666
  92. package/dist/chunk-KUJRR4FJ.js +0 -657
  93. package/dist/chunk-KYM4XRFG.js +0 -421
  94. package/dist/chunk-L3Z2HIWJ.cjs +0 -793
  95. package/dist/chunk-LBPEZQAF.js +0 -2232
  96. package/dist/chunk-LER4WXW5.cjs +0 -286
  97. package/dist/chunk-LK5IAVH6.cjs +0 -1173
  98. package/dist/chunk-M6FU6S22.js +0 -2911
  99. package/dist/chunk-MWEFR6YQ.js +0 -1857
  100. package/dist/chunk-N5FTS757.cjs +0 -415
  101. package/dist/chunk-NCUHGRTZ.js +0 -752
  102. package/dist/chunk-NKRKT6V2.js +0 -69
  103. package/dist/chunk-NLPSZT4C.js +0 -630
  104. package/dist/chunk-NRUB55IT.cjs +0 -771
  105. package/dist/chunk-NTMZSDXM.cjs +0 -633
  106. package/dist/chunk-ODGMVILH.js +0 -9662
  107. package/dist/chunk-PBA6NXCT.cjs +0 -1216
  108. package/dist/chunk-PHENW4MQ.js +0 -65
  109. package/dist/chunk-PJMOXFPR.cjs +0 -1861
  110. package/dist/chunk-PLMYCCA4.js +0 -504
  111. package/dist/chunk-PPULB4GG.cjs +0 -9728
  112. package/dist/chunk-PQLGZKMC.cjs +0 -755
  113. package/dist/chunk-Q56TT7IL.js +0 -483
  114. package/dist/chunk-QHVVVN47.cjs +0 -2033
  115. package/dist/chunk-QWKUKVRE.js +0 -2026
  116. package/dist/chunk-RE3OKSYF.cjs +0 -424
  117. package/dist/chunk-RT7LJRSF.cjs +0 -57378
  118. package/dist/chunk-SPDELRRV.cjs +0 -319
  119. package/dist/chunk-SUCBB66F.js +0 -229
  120. package/dist/chunk-TSWTWZ42.cjs +0 -4214
  121. package/dist/chunk-UITWA6DV.cjs +0 -2829
  122. package/dist/chunk-UQW6SLM5.js +0 -172
  123. package/dist/chunk-V2ILLPHK.cjs +0 -237
  124. package/dist/chunk-V42NTCFH.js +0 -3645
  125. package/dist/chunk-VJ3L7CHT.cjs +0 -169
  126. package/dist/chunk-VJVCD5T5.cjs +0 -769
  127. package/dist/chunk-VK5AXKO3.js +0 -746
  128. package/dist/chunk-VSXOIUCF.cjs +0 -473
  129. package/dist/chunk-VZNKJZTT.cjs +0 -749
  130. package/dist/chunk-W76ETJTI.js +0 -678
  131. package/dist/chunk-WFJIDI2N.cjs +0 -424
  132. package/dist/chunk-WN3YF33G.cjs +0 -118
  133. package/dist/chunk-WUXIRGZP.cjs +0 -2915
  134. package/dist/chunk-WYH4GVZ5.js +0 -1488
  135. package/dist/chunk-X4YVN7H3.cjs +0 -888
  136. package/dist/chunk-X67XRI2T.js +0 -410
  137. package/dist/chunk-XDXZM3ZP.cjs +0 -1046
  138. package/dist/chunk-XH7SE4HH.cjs +0 -72
  139. package/dist/chunk-XNMEH2BI.js +0 -126
  140. package/dist/chunk-XSF76QRU.js +0 -468
  141. package/dist/chunk-XSUZMPVQ.cjs +0 -682
  142. package/dist/chunk-XUILI4KB.cjs +0 -430
  143. package/dist/chunk-Y5MUAYTO.js +0 -167
  144. package/dist/chunk-Y7VK5TH3.cjs +0 -129
  145. package/dist/chunk-YCMQQQ5U.cjs +0 -5244
  146. package/dist/chunk-YYXH45E2.js +0 -426
  147. package/dist/chunk-ZGTGVSTZ.js +0 -422
  148. package/dist/chunk-ZL6VJ6SN.js +0 -421
  149. package/dist/cli/holoscript-runner.cjs +0 -2258
  150. package/dist/cli/holoscript-runner.js +0 -2233
  151. package/dist/codebase/index.cjs +0 -336
  152. package/dist/codebase/index.js +0 -331
  153. package/dist/compiler/agent-inference.cjs +0 -29
  154. package/dist/compiler/agent-inference.js +0 -6
  155. package/dist/compiler/android-xr.cjs +0 -20
  156. package/dist/compiler/android-xr.js +0 -10
  157. package/dist/compiler/android.cjs +0 -21
  158. package/dist/compiler/android.js +0 -11
  159. package/dist/compiler/ar.cjs +0 -21
  160. package/dist/compiler/ar.js +0 -9
  161. package/dist/compiler/babylon.cjs +0 -18
  162. package/dist/compiler/babylon.js +0 -12
  163. package/dist/compiler/coco.cjs +0 -27
  164. package/dist/compiler/coco.js +0 -4
  165. package/dist/compiler/domain-block-utils.cjs +0 -595
  166. package/dist/compiler/domain-block-utils.js +0 -9
  167. package/dist/compiler/dtdl.cjs +0 -25
  168. package/dist/compiler/dtdl.js +0 -9
  169. package/dist/compiler/gltf-pipeline.cjs +0 -39
  170. package/dist/compiler/gltf-pipeline.js +0 -4
  171. package/dist/compiler/godot.cjs +0 -16
  172. package/dist/compiler/godot.js +0 -10
  173. package/dist/compiler/incremental.cjs +0 -30
  174. package/dist/compiler/incremental.js +0 -5
  175. package/dist/compiler/index.cjs +0 -1522
  176. package/dist/compiler/index.js +0 -1321
  177. package/dist/compiler/ios.cjs +0 -21
  178. package/dist/compiler/ios.js +0 -11
  179. package/dist/compiler/multi-layer.cjs +0 -27
  180. package/dist/compiler/multi-layer.js +0 -12
  181. package/dist/compiler/nodetoy.cjs +0 -23
  182. package/dist/compiler/nodetoy.js +0 -4
  183. package/dist/compiler/openxr.cjs +0 -16
  184. package/dist/compiler/openxr.js +0 -10
  185. package/dist/compiler/playcanvas.cjs +0 -17
  186. package/dist/compiler/playcanvas.js +0 -11
  187. package/dist/compiler/r3f.cjs +0 -35
  188. package/dist/compiler/r3f.js +0 -13
  189. package/dist/compiler/remotion.cjs +0 -23
  190. package/dist/compiler/remotion.js +0 -4
  191. package/dist/compiler/reproducibility.cjs +0 -39
  192. package/dist/compiler/reproducibility.js +0 -4
  193. package/dist/compiler/sdf.cjs +0 -22
  194. package/dist/compiler/sdf.js +0 -10
  195. package/dist/compiler/semantic-scene.cjs +0 -31
  196. package/dist/compiler/semantic-scene.js +0 -4
  197. package/dist/compiler/state.cjs +0 -18
  198. package/dist/compiler/state.js +0 -8
  199. package/dist/compiler/trait-composition.cjs +0 -27
  200. package/dist/compiler/trait-composition.js +0 -6
  201. package/dist/compiler/unity.cjs +0 -16
  202. package/dist/compiler/unity.js +0 -10
  203. package/dist/compiler/unreal.cjs +0 -20
  204. package/dist/compiler/unreal.js +0 -10
  205. package/dist/compiler/urdf.cjs +0 -46
  206. package/dist/compiler/urdf.js +0 -10
  207. package/dist/compiler/usd-physics.cjs +0 -24
  208. package/dist/compiler/usd-physics.js +0 -7
  209. package/dist/compiler/visionos.cjs +0 -16
  210. package/dist/compiler/visionos.js +0 -10
  211. package/dist/compiler/vrchat.cjs +0 -20
  212. package/dist/compiler/vrchat.js +0 -10
  213. package/dist/compiler/vrr.cjs +0 -22
  214. package/dist/compiler/vrr.js +0 -10
  215. package/dist/compiler/wasm.cjs +0 -34
  216. package/dist/compiler/wasm.js +0 -10
  217. package/dist/compiler/webgpu.cjs +0 -16
  218. package/dist/compiler/webgpu.js +0 -10
  219. package/dist/debugger.cjs +0 -21
  220. package/dist/debugger.js +0 -8
  221. package/dist/entries/interop.cjs +0 -62
  222. package/dist/entries/interop.js +0 -5
  223. package/dist/entries/scripting.cjs +0 -67
  224. package/dist/entries/scripting.js +0 -10
  225. package/dist/index.cjs +0 -61703
  226. package/dist/index.js +0 -58652
  227. package/dist/math/vec3.cjs +0 -57
  228. package/dist/math/vec3.js +0 -4
  229. package/dist/parser.cjs +0 -26
  230. package/dist/parser.js +0 -9
  231. package/dist/playwright-7DTEQCBD.cjs +0 -98673
  232. package/dist/playwright-BIZXMLD2.js +0 -98660
  233. package/dist/post-quantum-JTTAAGO3.cjs +0 -6
  234. package/dist/post-quantum-RVPVDEPI.js +0 -4
  235. package/dist/runtime.cjs +0 -16
  236. package/dist/runtime.js +0 -7
  237. package/dist/storage/index.cjs +0 -37
  238. package/dist/storage/index.js +0 -4
  239. package/dist/traits/index.cjs +0 -14331
  240. package/dist/traits/index.js +0 -12126
  241. package/dist/type-checker.cjs +0 -18
  242. package/dist/type-checker.js +0 -5
  243. package/dist/wot/index.cjs +0 -29
  244. package/dist/wot/index.js +0 -4
@@ -1,633 +0,0 @@
1
- 'use strict';
2
-
3
- // src/traits/traitConstraints.ts
4
- var BUILTIN_CONSTRAINTS = [
5
- // =============================================================================
6
- // PHYSICS & INTERACTION REQUIREMENTS
7
- // =============================================================================
8
- {
9
- type: "requires",
10
- source: "physics",
11
- targets: ["collidable"],
12
- message: "Physics enabled objects must be collidable."
13
- },
14
- {
15
- type: "requires",
16
- source: "grabbable",
17
- targets: ["physics"],
18
- message: "Grabbable objects require physics to handle movement and collisions."
19
- },
20
- {
21
- type: "requires",
22
- source: "throwable",
23
- targets: ["grabbable"],
24
- message: "Throwable objects must be grabbable first."
25
- },
26
- {
27
- type: "requires",
28
- source: "stackable",
29
- targets: ["physics", "collidable"],
30
- message: "Stackable objects require physics and collision detection."
31
- },
32
- {
33
- type: "requires",
34
- source: "breakable",
35
- targets: ["physics", "collidable"],
36
- message: "Breakable objects require physics and collision to detect impacts."
37
- },
38
- {
39
- type: "requires",
40
- source: "snappable",
41
- targets: ["grabbable"],
42
- message: "Snappable objects must be grabbable to snap to positions."
43
- },
44
- // =============================================================================
45
- // CONFLICT RULES
46
- // =============================================================================
47
- {
48
- type: "conflicts",
49
- source: "static",
50
- targets: ["physics", "grabbable", "throwable", "scalable", "rotatable"],
51
- message: "Static objects cannot have physics or be interactive (grabbable/throwable/scalable/rotatable)."
52
- },
53
- {
54
- type: "conflicts",
55
- source: "kinematic",
56
- targets: ["physics"],
57
- message: "Kinematic objects handle their own motion and conflict with physics simulation."
58
- },
59
- {
60
- type: "conflicts",
61
- source: "invisible",
62
- targets: ["hoverable", "pointable"],
63
- message: "Invisible objects cannot have hover or pointer visual feedback."
64
- },
65
- // =============================================================================
66
- // PLATFORM EXCLUSIVITY
67
- // =============================================================================
68
- {
69
- type: "conflicts",
70
- source: "vr_only",
71
- targets: ["ar_only"],
72
- message: "An object cannot be marked as both VR-only and AR-only."
73
- },
74
- {
75
- type: "conflicts",
76
- source: "desktop_only",
77
- targets: ["vr_only", "ar_only"],
78
- message: "Desktop-only objects cannot also be VR-only or AR-only."
79
- },
80
- // =============================================================================
81
- // MATERIAL & MESH DEPENDENCIES
82
- // =============================================================================
83
- {
84
- type: "requires",
85
- source: "cloth",
86
- targets: ["mesh"],
87
- message: "Cloth physics requires a mesh to deform."
88
- },
89
- {
90
- type: "requires",
91
- source: "soft_body",
92
- targets: ["mesh"],
93
- message: "Soft body physics requires a mesh."
94
- },
95
- {
96
- type: "requires",
97
- source: "particle_emitter",
98
- targets: ["visible"],
99
- message: "Particle emitters must be visible to render particles."
100
- },
101
- // =============================================================================
102
- // AUDIO REQUIREMENTS
103
- // =============================================================================
104
- {
105
- type: "requires",
106
- source: "spatial_audio",
107
- targets: ["audio"],
108
- message: "Spatial audio requires an audio source."
109
- },
110
- {
111
- type: "requires",
112
- source: "audio_zone",
113
- targets: ["collidable"],
114
- message: "Audio zones require collision bounds to detect entry/exit."
115
- },
116
- // =============================================================================
117
- // INTERACTION EXCLUSIVITY (one-of rules)
118
- // =============================================================================
119
- {
120
- type: "oneof",
121
- source: "interaction_mode",
122
- targets: ["grabbable", "clickable", "draggable"],
123
- message: "Objects should have one primary interaction mode to avoid conflicts."
124
- },
125
- // =============================================================================
126
- // ANIMATION REQUIREMENTS
127
- // =============================================================================
128
- {
129
- type: "requires",
130
- source: "animated",
131
- targets: ["mesh"],
132
- message: "Animated trait requires a mesh with animation data."
133
- },
134
- // =============================================================================
135
- // NETWORKING REQUIREMENTS
136
- // =============================================================================
137
- {
138
- type: "requires",
139
- source: "networked",
140
- targets: ["physics"],
141
- message: "Networked objects require physics for state synchronization."
142
- },
143
- {
144
- type: "conflicts",
145
- source: "local_only",
146
- targets: ["networked"],
147
- message: "Local-only objects cannot be networked."
148
- },
149
- // =============================================================================
150
- // UI TRAIT CONSTRAINTS
151
- // =============================================================================
152
- {
153
- type: "conflicts",
154
- source: "ui_floating",
155
- targets: ["ui_anchored", "ui_docked"],
156
- message: "UI panels cannot be both floating and anchored/docked."
157
- },
158
- {
159
- type: "conflicts",
160
- source: "ui_anchored",
161
- targets: ["ui_floating", "ui_docked"],
162
- message: "UI panels cannot be both anchored and floating/docked."
163
- },
164
- {
165
- type: "conflicts",
166
- source: "ui_hand_menu",
167
- targets: ["ui_anchored", "ui_docked"],
168
- message: "Hand menus cannot be anchored to world or docked."
169
- },
170
- {
171
- type: "requires",
172
- source: "ui_keyboard",
173
- targets: ["ui_input"],
174
- message: "Keyboard trait requires an input element to target."
175
- },
176
- {
177
- type: "oneof",
178
- source: "ui_position_mode",
179
- targets: ["ui_floating", "ui_anchored", "ui_docked", "ui_hand_menu"],
180
- message: "UI element can only have one positioning mode."
181
- },
182
- // =============================================================================
183
- // SPATIAL CONSTRAINT TRAIT REQUIREMENTS
184
- // =============================================================================
185
- // spatial_adjacent requires collidable bounds for distance measurement
186
- {
187
- type: "requires",
188
- source: "spatial_adjacent",
189
- targets: ["collidable"],
190
- message: "spatial_adjacent requires collidable bounds to measure distance between entities.",
191
- suggestion: "Add @collidable to provide bounds for spatial adjacency checking."
192
- },
193
- // spatial_contains requires collidable bounds to define the container volume
194
- {
195
- type: "requires",
196
- source: "spatial_contains",
197
- targets: ["collidable"],
198
- message: "spatial_contains requires collidable bounds to define the container volume.",
199
- suggestion: "Add @collidable to define the bounding volume for containment checking."
200
- },
201
- // spatial_reachable requires spatial_awareness for runtime path validation
202
- {
203
- type: "requires",
204
- source: "spatial_reachable",
205
- targets: ["spatial_awareness"],
206
- message: "spatial_reachable requires spatial_awareness for runtime path and obstacle detection.",
207
- suggestion: "Add @spatial_awareness to enable spatial context for reachability checks."
208
- },
209
- // spatial_contains conflicts with static (containers may need dynamic bounds)
210
- {
211
- type: "conflicts",
212
- source: "spatial_contains",
213
- targets: ["invisible"],
214
- message: "spatial_contains containers cannot be invisible; contained entities need visible boundary reference.",
215
- suggestion: "Remove @invisible or use @spatial_adjacent instead for invisible reference points."
216
- },
217
- // Only one spatial constraint enforcement mode per entity
218
- {
219
- type: "oneof",
220
- source: "spatial_constraint_mode",
221
- targets: ["spatial_adjacent", "spatial_contains"],
222
- message: "An entity should declare either spatial_adjacent or spatial_contains, not both. Use spatial_adjacent for proximity or spatial_contains for enclosure.",
223
- suggestion: 'Choose the most appropriate spatial relationship: @spatial_adjacent for "near" or @spatial_contains for "inside".'
224
- },
225
- // =============================================================================
226
- // SPATIOTEMPORAL CONSTRAINT TRAIT REQUIREMENTS
227
- // =============================================================================
228
- // spatial_temporal_adjacent requires collidable for distance measurement
229
- {
230
- type: "requires",
231
- source: "spatial_temporal_adjacent",
232
- targets: ["collidable"],
233
- message: "spatial_temporal_adjacent requires collidable bounds to measure distance and track duration.",
234
- suggestion: "Add @collidable to provide bounds for temporal adjacency checking."
235
- },
236
- // spatial_temporal_adjacent conflicts with plain spatial_adjacent on same entity
237
- {
238
- type: "conflicts",
239
- source: "spatial_temporal_adjacent",
240
- targets: ["spatial_adjacent"],
241
- message: "spatial_temporal_adjacent supersedes spatial_adjacent. Use one or the other.",
242
- suggestion: "Remove @spatial_adjacent if duration-based adjacency is desired, or remove @spatial_temporal_adjacent for simple distance checking."
243
- },
244
- // spatial_temporal_reachable requires spatial_awareness
245
- {
246
- type: "requires",
247
- source: "spatial_temporal_reachable",
248
- targets: ["spatial_awareness"],
249
- message: "spatial_temporal_reachable requires spatial_awareness for velocity tracking and obstacle prediction.",
250
- suggestion: "Add @spatial_awareness to enable spatial context for velocity-predicted reachability."
251
- },
252
- // spatial_temporal_reachable conflicts with plain spatial_reachable
253
- {
254
- type: "conflicts",
255
- source: "spatial_temporal_reachable",
256
- targets: ["spatial_reachable"],
257
- message: "spatial_temporal_reachable supersedes spatial_reachable. Use one or the other.",
258
- suggestion: "Remove @spatial_reachable if velocity-predicted reachability is desired, or remove @spatial_temporal_reachable for static reachability."
259
- },
260
- // spatial_trajectory requires physics for velocity/acceleration data
261
- {
262
- type: "requires",
263
- source: "spatial_trajectory",
264
- targets: ["physics"],
265
- message: "spatial_trajectory requires physics for velocity and acceleration data to predict trajectories.",
266
- suggestion: "Add @physics to enable trajectory prediction from velocity data."
267
- },
268
- // spatial_trajectory requires collidable for bounds checking
269
- {
270
- type: "requires",
271
- source: "spatial_trajectory",
272
- targets: ["collidable"],
273
- message: "spatial_trajectory requires collidable bounds for keep_in/keep_out region checking.",
274
- suggestion: "Add @collidable to provide bounds for trajectory constraint checking."
275
- },
276
- // =============================================================================
277
- // ROBOTICS / URDF ROBOT MODEL CONSTRAINTS
278
- // =============================================================================
279
- {
280
- type: "conflicts",
281
- source: "urdf_robot",
282
- targets: ["cloth", "soft_body", "fluid"],
283
- message: "URDF robot models use rigid body joints and cannot have cloth, soft body, or fluid physics."
284
- },
285
- {
286
- type: "conflicts",
287
- source: "urdf_robot",
288
- targets: ["particle_emitter"],
289
- message: "URDF robot models define their own visual hierarchy and conflict with particle emitters."
290
- },
291
- // =============================================================================
292
- // CULTURAL PROFILE TRAIT CONSTRAINTS
293
- // =============================================================================
294
- // norm_compliant requires cultural_profile — agents must declare cultural identity
295
- // before they can be subject to norm compliance checking
296
- {
297
- type: "requires",
298
- source: "norm_compliant",
299
- targets: ["cultural_profile"],
300
- message: "Norm compliance requires a cultural_profile to define the agent's cultural identity.",
301
- suggestion: "Add @cultural_profile with cooperation_index, cultural_family, prompt_dialect, and norm_set."
302
- },
303
- // cultural_memory requires cultural_profile — cultural memory storage needs
304
- // a cultural identity context to organize episodic and stigmergic memories
305
- {
306
- type: "requires",
307
- source: "cultural_memory",
308
- targets: ["cultural_profile"],
309
- message: "Cultural memory requires a cultural_profile to contextualize memory storage.",
310
- suggestion: "Add @cultural_profile before using @cultural_memory on an agent."
311
- },
312
- // cultural_profile conflicts with isolationist + networked combination
313
- // (isolationist agents should not be networked — contradicts their nature)
314
- {
315
- type: "conflicts",
316
- source: "cultural_trace",
317
- targets: ["invisible"],
318
- message: "Cultural traces (stigmergic markers) must be visible for other agents to perceive them.",
319
- suggestion: "Remove @invisible from objects bearing @cultural_trace, or use a visible marker."
320
- },
321
- // =============================================================================
322
- // v6 UNIVERSAL SERVICE DOMAIN CONSTRAINTS
323
- // =============================================================================
324
- // Endpoint requires service — endpoints belong to a service context
325
- {
326
- type: "requires",
327
- source: "endpoint",
328
- targets: ["service"],
329
- message: "Endpoints must belong to a service context.",
330
- suggestion: "Wrap this endpoint in a service block or add @service trait."
331
- },
332
- // Handler requires http or route — handlers need an HTTP binding
333
- {
334
- type: "requires",
335
- source: "handler",
336
- targets: ["http"],
337
- message: "Handlers require an HTTP binding to receive requests.",
338
- suggestion: "Add @http trait with method and path properties."
339
- },
340
- // CORS requires http — CORS is HTTP-specific
341
- {
342
- type: "requires",
343
- source: "cors",
344
- targets: ["http"],
345
- message: "CORS is an HTTP-specific concern and requires an HTTP binding.",
346
- suggestion: "Add @http to enable CORS headers on HTTP responses."
347
- },
348
- // Rate limit requires http — rate limiting is HTTP-specific
349
- {
350
- type: "requires",
351
- source: "rate_limit",
352
- targets: ["http"],
353
- message: "Rate limiting requires HTTP request context.",
354
- suggestion: "Add @http to enable request-based rate limiting."
355
- },
356
- // Auth requires service or http — auth middleware needs service context
357
- {
358
- type: "requires",
359
- source: "auth",
360
- targets: ["http"],
361
- message: "Auth middleware requires an HTTP context for token validation.",
362
- suggestion: "Add @http to enable authentication on HTTP endpoints."
363
- },
364
- // Gateway conflicts with proxy — different service patterns
365
- {
366
- type: "conflicts",
367
- source: "gateway",
368
- targets: ["proxy"],
369
- message: "Gateway and proxy are mutually exclusive service patterns.",
370
- suggestion: "Use @gateway for API aggregation or @proxy for transparent forwarding, not both."
371
- },
372
- // Load balancer conflicts with gateway — different infra layers
373
- {
374
- type: "conflicts",
375
- source: "load_balancer",
376
- targets: ["gateway"],
377
- message: "Load balancer and gateway operate at different infrastructure layers.",
378
- suggestion: "Use @load_balancer for L4/L7 traffic distribution or @gateway for API aggregation."
379
- },
380
- // Service position mode — only one service architecture pattern
381
- {
382
- type: "oneof",
383
- source: "service_architecture_mode",
384
- targets: ["gateway", "proxy", "load_balancer", "middleware"],
385
- message: "Only one service architecture pattern per entity.",
386
- suggestion: "Choose one: @gateway, @proxy, @load_balancer, or @middleware."
387
- },
388
- // =============================================================================
389
- // v6 UNIVERSAL DATA DOMAIN CONSTRAINTS
390
- // =============================================================================
391
- // Data index requires data_model — index needs a model to index
392
- {
393
- type: "requires",
394
- source: "data_index",
395
- targets: ["data_model"],
396
- message: "Data indexes require a data model to define the indexed columns.",
397
- suggestion: "Define a data_model block before creating indexes on it."
398
- },
399
- // Data trigger requires data_model — trigger needs a model
400
- {
401
- type: "requires",
402
- source: "data_trigger",
403
- targets: ["data_model"],
404
- message: "Data triggers must reference a data model table.",
405
- suggestion: "Define a data_model block to provide the table for this trigger."
406
- },
407
- // Stored procedure requires data_model — SP needs model context
408
- {
409
- type: "requires",
410
- source: "stored_procedure",
411
- targets: ["data_model"],
412
- message: "Stored procedures operate on data models.",
413
- suggestion: "Define a data_model block that this stored procedure targets."
414
- },
415
- // Data view requires data_model — views derive from models
416
- {
417
- type: "requires",
418
- source: "data_view",
419
- targets: ["data_model"],
420
- message: "Data views are derived from data models.",
421
- suggestion: "Define a data_model block as the source for this view."
422
- },
423
- // Migration conflicts with seed — different lifecycle phases
424
- {
425
- type: "conflicts",
426
- source: "migration",
427
- targets: ["seed"],
428
- message: "Migrations and seeds are different lifecycle phases and should be separate blocks.",
429
- suggestion: "Define migrations and seeds in separate blocks for clear ordering."
430
- },
431
- // =============================================================================
432
- // v6 UNIVERSAL PIPELINE DOMAIN CONSTRAINTS
433
- // =============================================================================
434
- // Consumer requires queue or topic — consumers need a message source
435
- {
436
- type: "requires",
437
- source: "consumer",
438
- targets: ["queue"],
439
- message: "Consumers require a queue or topic to consume messages from.",
440
- suggestion: "Define a queue block and reference it from this consumer."
441
- },
442
- // Producer requires queue or topic — producers need a message target
443
- {
444
- type: "requires",
445
- source: "producer",
446
- targets: ["queue"],
447
- message: "Producers require a queue or topic to publish messages to.",
448
- suggestion: "Define a queue block and reference it from this producer."
449
- },
450
- // Dead letter requires queue — DLQ needs a primary queue
451
- {
452
- type: "requires",
453
- source: "dead_letter",
454
- targets: ["queue"],
455
- message: "Dead letter queues require a primary queue to catch failed messages from.",
456
- suggestion: "Define a queue block as the source for this dead letter queue."
457
- },
458
- // Stage requires pipeline — stages belong to pipelines
459
- {
460
- type: "requires",
461
- source: "stage",
462
- targets: ["pipeline"],
463
- message: "Stages must belong to a pipeline.",
464
- suggestion: "Wrap this stage in a pipeline block."
465
- },
466
- // Worker conflicts with scheduler — different execution models
467
- {
468
- type: "conflicts",
469
- source: "worker",
470
- targets: ["scheduler"],
471
- message: "Workers process jobs continuously while schedulers trigger at intervals.",
472
- suggestion: "Use @worker for continuous processing or @scheduler for cron-based execution."
473
- },
474
- // Consumer conflicts with producer on same entity — pick one direction
475
- {
476
- type: "conflicts",
477
- source: "consumer",
478
- targets: ["producer"],
479
- message: "An entity should be either a consumer or a producer, not both.",
480
- suggestion: "Split into separate consumer and producer blocks for clear message flow direction."
481
- },
482
- // =============================================================================
483
- // v6 UNIVERSAL CONTAINER/INFRA DOMAIN CONSTRAINTS
484
- // =============================================================================
485
- // Serverless conflicts with container — different deployment models
486
- {
487
- type: "conflicts",
488
- source: "serverless",
489
- targets: ["container"],
490
- message: "Serverless and container are mutually exclusive deployment models.",
491
- suggestion: "Choose @serverless for FaaS or @container for long-running services."
492
- },
493
- // Horizontal scaling requires service — scaling needs a service to scale
494
- {
495
- type: "requires",
496
- source: "horizontal_scaling",
497
- targets: ["service"],
498
- message: "Horizontal scaling requires a service to replicate.",
499
- suggestion: "Add @service to define the scalable unit."
500
- },
501
- // =============================================================================
502
- // v6 UNIVERSAL OBSERVABILITY DOMAIN CONSTRAINTS
503
- // =============================================================================
504
- // Tracing requires service or handler — tracing needs a service context
505
- {
506
- type: "requires",
507
- source: "tracing",
508
- targets: ["service"],
509
- message: "Distributed tracing requires a service context for span propagation.",
510
- suggestion: "Add @service to enable trace context propagation."
511
- },
512
- // Alerting requires metric — alerts need metrics to alert on
513
- {
514
- type: "requires",
515
- source: "alerting",
516
- targets: ["metric"],
517
- message: "Alerting rules require metrics to evaluate thresholds against.",
518
- suggestion: "Add @metric to define the values that trigger alerts."
519
- },
520
- // Health check requires service — health checks monitor services
521
- {
522
- type: "requires",
523
- source: "health_check",
524
- targets: ["service"],
525
- message: "Health checks require a service to monitor.",
526
- suggestion: "Add @service to define the monitored service endpoint."
527
- },
528
- // =============================================================================
529
- // v6 UNIVERSAL RESILIENCE DOMAIN CONSTRAINTS (v5.4)
530
- // =============================================================================
531
- // Circuit breaker requires service — wraps service calls
532
- {
533
- type: "requires",
534
- source: "circuit_breaker",
535
- targets: ["service"],
536
- message: "Circuit breakers wrap service calls to prevent cascade failures.",
537
- suggestion: "Add @service to define the protected service endpoint."
538
- },
539
- // Retry requires service or pipeline — retries need a callable context
540
- {
541
- type: "requires",
542
- source: "retry",
543
- targets: ["service"],
544
- message: "Retry policies require a service or pipeline context.",
545
- suggestion: "Add @service to define the endpoint with retry behavior."
546
- },
547
- // Timeout requires service — timeouts bound service call duration
548
- {
549
- type: "requires",
550
- source: "timeout",
551
- targets: ["service"],
552
- message: "Timeout policies require a service context to bound request duration.",
553
- suggestion: "Add @service to define the endpoint with timeout behavior."
554
- },
555
- // Bulkhead requires service — isolates concurrent requests
556
- {
557
- type: "requires",
558
- source: "bulkhead",
559
- targets: ["service"],
560
- message: "Bulkhead isolation requires a service context for concurrency partitioning.",
561
- suggestion: "Add @service to define the endpoint with bulkhead isolation."
562
- },
563
- // Middleware requires service — middleware wraps service endpoints
564
- {
565
- type: "requires",
566
- source: "middleware",
567
- targets: ["service"],
568
- message: "Middleware requires a service context to wrap endpoints.",
569
- suggestion: "Add @service to define the service where middleware is applied."
570
- },
571
- // Migration requires db — database migrations need a connection
572
- {
573
- type: "requires",
574
- source: "migration",
575
- targets: ["db"],
576
- message: "Database migrations require a database connection (@db).",
577
- suggestion: "Add @db to define the database connection for migrations."
578
- },
579
- // Saga requires db — distributed transactions need persistence
580
- {
581
- type: "requires",
582
- source: "saga",
583
- targets: ["db"],
584
- message: "Sagas require database access for transaction state management.",
585
- suggestion: "Add @db for the saga coordinator state store."
586
- },
587
- // Circuit breaker conflicts with fallback at same level
588
- {
589
- type: "conflicts",
590
- source: "circuit_breaker",
591
- targets: ["bulkhead"],
592
- message: "Circuit breaker and bulkhead should be applied at different granularity levels.",
593
- suggestion: "Apply @circuit_breaker at the service level and @bulkhead at the endpoint level, or vice versa."
594
- }
595
- ];
596
-
597
- // src/traits/constraintConfig.ts
598
- function loadConstraintsFromConfig(config) {
599
- if (!config || typeof config !== "object") return [];
600
- const raw = config;
601
- if (!Array.isArray(raw.traitConstraints)) return [];
602
- const valid = [];
603
- for (const entry of raw.traitConstraints) {
604
- if (!entry || typeof entry !== "object") continue;
605
- const { type, source, targets, message, suggestion } = entry;
606
- if ((type === "requires" || type === "conflicts" || type === "oneof") && typeof source === "string" && source.length > 0 && Array.isArray(targets) && targets.length > 0 && targets.every((t) => typeof t === "string")) {
607
- valid.push({
608
- type,
609
- source,
610
- targets,
611
- message: typeof message === "string" ? message : void 0,
612
- suggestion: typeof suggestion === "string" ? suggestion : void 0
613
- });
614
- }
615
- }
616
- return valid;
617
- }
618
- async function loadConstraintsFromFile(configPath = "holoscript.config.json") {
619
- try {
620
- const { readFileSync } = await import('fs');
621
- const raw = readFileSync(configPath, "utf-8");
622
- const parsed = JSON.parse(raw);
623
- return loadConstraintsFromConfig(parsed);
624
- } catch {
625
- return [];
626
- }
627
- }
628
-
629
- exports.BUILTIN_CONSTRAINTS = BUILTIN_CONSTRAINTS;
630
- exports.loadConstraintsFromConfig = loadConstraintsFromConfig;
631
- exports.loadConstraintsFromFile = loadConstraintsFromFile;
632
- //# sourceMappingURL=chunk-3FXV5S25.cjs.map
633
- //# sourceMappingURL=chunk-3FXV5S25.cjs.map