@fps-games/editor 0.2.1-beta.1 → 0.2.1-beta.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 (245) hide show
  1. package/dist/agent-bridge/capabilities/ui-regions.d.ts.map +1 -1
  2. package/dist/agent-bridge/capabilities/ui-regions.js +16 -0
  3. package/dist/agent-bridge/capabilities/ui-regions.js.map +1 -1
  4. package/dist/build-info.json +43 -43
  5. package/dist/internal/material-preview.d.ts +22 -0
  6. package/dist/internal/material-preview.d.ts.map +1 -0
  7. package/dist/internal/material-preview.js +186 -0
  8. package/dist/internal/material-preview.js.map +1 -0
  9. package/dist/internal/project-model-preview.d.ts +4 -0
  10. package/dist/internal/project-model-preview.d.ts.map +1 -0
  11. package/dist/internal/project-model-preview.js +359 -0
  12. package/dist/internal/project-model-preview.js.map +1 -0
  13. package/dist/local-editor-agent-context.d.ts +12 -1
  14. package/dist/local-editor-agent-context.d.ts.map +1 -1
  15. package/dist/local-editor-agent-context.js +47 -0
  16. package/dist/local-editor-agent-context.js.map +1 -1
  17. package/dist/local-editor-harness.d.ts +15 -2
  18. package/dist/local-editor-harness.d.ts.map +1 -1
  19. package/dist/local-editor-harness.js +310 -21
  20. package/dist/local-editor-harness.js.map +1 -1
  21. package/dist/local-editor-tools.d.ts +1 -0
  22. package/dist/local-editor-tools.d.ts.map +1 -1
  23. package/dist/local-editor-tools.js +3 -0
  24. package/dist/local-editor-tools.js.map +1 -1
  25. package/dist/playable-local-editor-host.d.ts +4 -0
  26. package/dist/playable-local-editor-host.d.ts.map +1 -1
  27. package/dist/playable-local-editor-host.js +27 -0
  28. package/dist/playable-local-editor-host.js.map +1 -1
  29. package/dist/playable-product-scene-capabilities.d.ts.map +1 -1
  30. package/dist/playable-product-scene-capabilities.js +9 -3
  31. package/dist/playable-product-scene-capabilities.js.map +1 -1
  32. package/dist/playable-standard-project.d.ts.map +1 -1
  33. package/dist/playable-standard-project.js +5 -2
  34. package/dist/playable-standard-project.js.map +1 -1
  35. package/node_modules/@fps-games/babylon-renderer/package.json +7 -7
  36. package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.js +24 -0
  37. package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.js.map +1 -1
  38. package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +10 -1
  39. package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -1
  40. package/node_modules/@fps-games/editor-babylon/dist/projection.js +96 -1
  41. package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
  42. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.d.ts.map +1 -1
  43. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.js +85 -22
  44. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.js.map +1 -1
  45. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts +2 -0
  46. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts.map +1 -1
  47. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js +150 -4
  48. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js.map +1 -1
  49. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts +1 -0
  50. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts.map +1 -1
  51. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js +249 -15
  52. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js.map +1 -1
  53. package/node_modules/@fps-games/editor-babylon/dist/types.d.ts +1 -1
  54. package/node_modules/@fps-games/editor-babylon/dist/types.d.ts.map +1 -1
  55. package/node_modules/@fps-games/editor-babylon/dist/types.js.map +1 -1
  56. package/node_modules/@fps-games/editor-babylon/package.json +6 -6
  57. package/node_modules/@fps-games/editor-browser/dist/index.d.ts +5 -0
  58. package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -1
  59. package/node_modules/@fps-games/editor-browser/dist/index.js +3 -0
  60. package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -1
  61. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.d.ts +35 -0
  62. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.d.ts.map +1 -0
  63. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.js +136 -0
  64. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.js.map +1 -0
  65. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.d.ts +46 -0
  66. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.d.ts.map +1 -0
  67. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.js +283 -0
  68. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.js.map +1 -0
  69. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.d.ts +12 -0
  70. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.d.ts.map +1 -0
  71. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.js +67 -0
  72. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.js.map +1 -0
  73. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.d.ts +6 -0
  74. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.d.ts.map +1 -0
  75. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.js +9 -0
  76. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.js.map +1 -0
  77. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.d.ts +7 -0
  78. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.d.ts.map +1 -0
  79. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.js +20 -0
  80. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.js.map +1 -0
  81. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.d.ts +9 -0
  82. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.d.ts.map +1 -0
  83. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.js +219 -0
  84. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.js.map +1 -0
  85. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.d.ts +14 -0
  86. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.d.ts.map +1 -0
  87. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.js +42 -0
  88. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.js.map +1 -0
  89. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.d.ts.map +1 -1
  90. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.js +2 -0
  91. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.js.map +1 -1
  92. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.d.ts +27 -0
  93. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.d.ts.map +1 -0
  94. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.js +288 -0
  95. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.js.map +1 -0
  96. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts +1 -1
  97. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts.map +1 -1
  98. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js +29 -0
  99. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js.map +1 -1
  100. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts +20 -1
  101. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts.map +1 -1
  102. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js +321 -60
  103. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js.map +1 -1
  104. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts +2 -1
  105. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts.map +1 -1
  106. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js +4 -2
  107. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js.map +1 -1
  108. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +63 -3
  109. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts.map +1 -1
  110. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js.map +1 -1
  111. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts +9 -0
  112. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts.map +1 -1
  113. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js +88 -16
  114. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js.map +1 -1
  115. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +2 -1
  116. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts.map +1 -1
  117. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js +1463 -356
  118. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -1
  119. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.d.ts +13 -0
  120. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.d.ts.map +1 -0
  121. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.js +15 -0
  122. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.js.map +1 -0
  123. package/node_modules/@fps-games/editor-browser/package.json +7 -7
  124. package/node_modules/@fps-games/editor-core/dist/editor-tools.d.ts +1 -0
  125. package/node_modules/@fps-games/editor-core/dist/editor-tools.d.ts.map +1 -1
  126. package/node_modules/@fps-games/editor-core/dist/editor-tools.js +3 -1
  127. package/node_modules/@fps-games/editor-core/dist/editor-tools.js.map +1 -1
  128. package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts +11 -2
  129. package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts.map +1 -1
  130. package/node_modules/@fps-games/editor-core/dist/viewport-tools.js +12 -1
  131. package/node_modules/@fps-games/editor-core/dist/viewport-tools.js.map +1 -1
  132. package/node_modules/@fps-games/editor-core/package.json +6 -6
  133. package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
  134. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.d.ts +1 -0
  135. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.d.ts.map +1 -1
  136. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.js +5 -0
  137. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.js.map +1 -1
  138. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.d.ts +1 -1
  139. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.d.ts.map +1 -1
  140. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.js +1 -1
  141. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.js.map +1 -1
  142. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.d.ts.map +1 -1
  143. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.js +15 -1
  144. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.js.map +1 -1
  145. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.d.ts.map +1 -1
  146. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.js +3 -0
  147. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.js.map +1 -1
  148. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.d.ts +6 -1
  149. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.d.ts.map +1 -1
  150. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.js.map +1 -1
  151. package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts +1 -0
  152. package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts.map +1 -1
  153. package/node_modules/@fps-games/editor-playable-sdk/dist/index.js +1 -0
  154. package/node_modules/@fps-games/editor-playable-sdk/dist/index.js.map +1 -1
  155. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.d.ts +4 -0
  156. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.d.ts.map +1 -1
  157. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.js +10 -1
  158. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.js.map +1 -1
  159. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.d.ts +4 -0
  160. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.d.ts.map +1 -0
  161. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.js +4 -0
  162. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.js.map +1 -0
  163. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.d.ts +4 -0
  164. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.d.ts.map +1 -0
  165. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.js +86 -0
  166. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.js.map +1 -0
  167. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.d.ts +9 -0
  168. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.d.ts.map +1 -0
  169. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.js +76 -0
  170. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.js.map +1 -0
  171. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.d.ts +34 -0
  172. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.d.ts.map +1 -0
  173. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.js +2 -0
  174. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.js.map +1 -0
  175. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts +4 -0
  176. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts.map +1 -1
  177. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js +40 -0
  178. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js.map +1 -1
  179. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts +1 -0
  180. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts.map +1 -1
  181. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js +1 -0
  182. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js.map +1 -1
  183. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts +1 -0
  184. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts.map +1 -1
  185. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js +94 -0
  186. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js.map +1 -1
  187. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.d.ts +14 -0
  188. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.d.ts.map +1 -0
  189. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.js +101 -0
  190. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.js.map +1 -0
  191. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.d.ts +23 -0
  192. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.d.ts.map +1 -0
  193. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.js +180 -0
  194. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.js.map +1 -0
  195. package/node_modules/@fps-games/editor-playable-sdk/package.json +6 -6
  196. package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts +23 -3
  197. package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts.map +1 -1
  198. package/node_modules/@fps-games/editor-protocol/dist/agent.js.map +1 -1
  199. package/node_modules/@fps-games/editor-protocol/package.json +2 -2
  200. package/node_modules/@fps-games/editor-tooling/package.json +3 -3
  201. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.d.ts.map +1 -1
  202. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.js +103 -10
  203. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.js.map +1 -1
  204. package/node_modules/@fps-games/editor-ui/package.json +1 -1
  205. package/node_modules/@fps-games/playable-assets/package.json +1 -1
  206. package/node_modules/@fps-games/playable-contracts/package.json +1 -1
  207. package/node_modules/@fps-games/playable-rendering/package.json +2 -2
  208. package/node_modules/@fps-games/playable-runtime/package.json +12 -12
  209. package/node_modules/@fps-games/playable-runtime-data/package.json +4 -4
  210. package/node_modules/@fps-games/playable-scene/package.json +2 -2
  211. package/node_modules/@fps-games/plugin-api/package.json +1 -1
  212. package/node_modules/@fps-games/plugin-assets/dist/version.d.ts +1 -1
  213. package/node_modules/@fps-games/plugin-assets/dist/version.js +1 -1
  214. package/node_modules/@fps-games/plugin-assets/dist/version.js.map +1 -1
  215. package/node_modules/@fps-games/plugin-assets/package.json +5 -5
  216. package/node_modules/@fps-games/plugin-hierarchy/dist/version.d.ts +1 -1
  217. package/node_modules/@fps-games/plugin-hierarchy/dist/version.js +1 -1
  218. package/node_modules/@fps-games/plugin-hierarchy/dist/version.js.map +1 -1
  219. package/node_modules/@fps-games/plugin-hierarchy/package.json +5 -5
  220. package/node_modules/@fps-games/plugin-host/package.json +2 -2
  221. package/node_modules/@fps-games/plugin-markers/dist/version.d.ts +1 -1
  222. package/node_modules/@fps-games/plugin-markers/dist/version.js +1 -1
  223. package/node_modules/@fps-games/plugin-markers/dist/version.js.map +1 -1
  224. package/node_modules/@fps-games/plugin-markers/package.json +5 -5
  225. package/node_modules/@fps-games/plugin-materials/dist/version.d.ts +1 -1
  226. package/node_modules/@fps-games/plugin-materials/dist/version.js +1 -1
  227. package/node_modules/@fps-games/plugin-materials/dist/version.js.map +1 -1
  228. package/node_modules/@fps-games/plugin-materials/package.json +5 -5
  229. package/node_modules/@fps-games/plugin-rendering/dist/version.d.ts +1 -1
  230. package/node_modules/@fps-games/plugin-rendering/dist/version.js +1 -1
  231. package/node_modules/@fps-games/plugin-rendering/dist/version.js.map +1 -1
  232. package/node_modules/@fps-games/plugin-rendering/package.json +5 -5
  233. package/node_modules/@fps-games/plugin-scene/dist/version.d.ts +1 -1
  234. package/node_modules/@fps-games/plugin-scene/dist/version.js +1 -1
  235. package/node_modules/@fps-games/plugin-scene/dist/version.js.map +1 -1
  236. package/node_modules/@fps-games/plugin-scene/package.json +5 -5
  237. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.d.ts +1 -1
  238. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js +1 -1
  239. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js.map +1 -1
  240. package/node_modules/@fps-games/plugin-shadow-map-experiment/package.json +5 -5
  241. package/node_modules/@fps-games/plugin-shadows/dist/version.d.ts +1 -1
  242. package/node_modules/@fps-games/plugin-shadows/dist/version.js +1 -1
  243. package/node_modules/@fps-games/plugin-shadows/dist/version.js.map +1 -1
  244. package/node_modules/@fps-games/plugin-shadows/package.json +7 -7
  245. package/package.json +22 -22
@@ -0,0 +1,101 @@
1
+ import { constants } from 'node:fs';
2
+ import fs, {} from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ export const DEFAULT_EDITOR_PROJECT_MEDIA_MAX_BYTES = 128 * 1024 * 1024;
5
+ const MAX_EDITOR_PROJECT_MEDIA_MAX_BYTES = 512 * 1024 * 1024;
6
+ export async function closeEditorProjectFileHandle(handle) {
7
+ const errors = [];
8
+ for (let attempt = 0; attempt < 2; attempt += 1) {
9
+ try {
10
+ await handle.close();
11
+ return;
12
+ }
13
+ catch (error) {
14
+ errors.push(error);
15
+ }
16
+ }
17
+ const error = new Error('project_file_close_failed');
18
+ error.errors = errors;
19
+ throw error;
20
+ }
21
+ export function normalizeEditorProjectFileReadPath(requestedPath) {
22
+ const candidate = requestedPath.trim();
23
+ if (!candidate
24
+ || candidate !== requestedPath
25
+ || candidate.includes('\0')
26
+ || candidate.includes('\\')
27
+ || path.posix.isAbsolute(candidate)
28
+ || /^[A-Za-z]:\//.test(candidate)) {
29
+ throw new Error('project_file_path_invalid');
30
+ }
31
+ const segments = candidate.split('/');
32
+ if (segments.some(segment => !segment || segment === '.' || segment === '..')) {
33
+ throw new Error('project_file_path_invalid');
34
+ }
35
+ return segments.join('/');
36
+ }
37
+ export function resolveEditorProjectMediaMaxBytes(value) {
38
+ if (value === undefined)
39
+ return DEFAULT_EDITOR_PROJECT_MEDIA_MAX_BYTES;
40
+ if (!Number.isSafeInteger(value) || value <= 0)
41
+ throw new Error('project_file_media_limit_invalid');
42
+ return Math.min(value, MAX_EDITOR_PROJECT_MEDIA_MAX_BYTES);
43
+ }
44
+ export async function openVerifiedEditorProjectFile(projectRoot, requestedPath) {
45
+ const relativePath = normalizeEditorProjectFileReadPath(requestedPath);
46
+ const root = await fs.realpath(path.resolve(projectRoot));
47
+ const absolutePath = path.resolve(root, ...relativePath.split('/'));
48
+ assertPathWithinProjectRoot(root, absolutePath);
49
+ await assertEditorProjectFilePathHasNoSymlinks(root, relativePath);
50
+ let handle;
51
+ try {
52
+ handle = await fs.open(absolutePath, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
53
+ }
54
+ catch (error) {
55
+ if (error?.code === 'ELOOP') {
56
+ throw new Error('project_file_symlink_unsupported');
57
+ }
58
+ throw error;
59
+ }
60
+ try {
61
+ const stat = await handle.stat();
62
+ if (!stat.isFile())
63
+ throw new Error('project_file_not_found');
64
+ const resolvedPath = await fs.realpath(absolutePath);
65
+ assertPathWithinProjectRoot(root, resolvedPath);
66
+ if (resolvedPath !== absolutePath)
67
+ throw new Error('project_file_symlink_unsupported');
68
+ const resolvedStat = await fs.stat(resolvedPath);
69
+ if (resolvedStat.dev !== stat.dev || resolvedStat.ino !== stat.ino) {
70
+ throw new Error('project_file_changed_during_read');
71
+ }
72
+ return { absolutePath, handle, relativePath, stat };
73
+ }
74
+ catch (error) {
75
+ try {
76
+ await closeEditorProjectFileHandle(handle);
77
+ }
78
+ catch (closeError) {
79
+ const aggregate = new Error('project_file_close_failed');
80
+ aggregate.errors = [error, closeError];
81
+ throw aggregate;
82
+ }
83
+ throw error;
84
+ }
85
+ }
86
+ function assertPathWithinProjectRoot(root, candidate) {
87
+ const relative = path.relative(root, candidate);
88
+ if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
89
+ throw new Error('project_file_path_invalid');
90
+ }
91
+ }
92
+ async function assertEditorProjectFilePathHasNoSymlinks(root, relativePath) {
93
+ let current = root;
94
+ for (const segment of relativePath.split('/')) {
95
+ current = path.join(current, segment);
96
+ const stat = await fs.lstat(current);
97
+ if (stat.isSymbolicLink())
98
+ throw new Error('project_file_symlink_unsupported');
99
+ }
100
+ }
101
+ //# sourceMappingURL=project-file-handle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-file-handle.js","sourceRoot":"","sources":["../../src/vite/project-file-handle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,EAAE,EAAmB,MAAM,kBAAkB,CAAC;AACvD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,sCAAsC,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AACxE,MAAM,kCAAkC,GAAG,GAAG,GAAG,IAAI,GAAG,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AC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxG,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,KAAK,UAAU,wCAAwC,CAAC,IAAY,EAAE,YAAoB;IACxF,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,KAAK,MAAM,OAAO,IAAI,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9C,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,IAAI,CAAC,cAAc,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACjF,CAAC;AACH,CAAC","sourcesContent":["import { constants, type Stats } from 'node:fs';\nimport fs, { type FileHandle } from 'node:fs/promises';\nimport path from 'node:path';\n\nexport const DEFAULT_EDITOR_PROJECT_MEDIA_MAX_BYTES = 128 * 1024 * 1024;\nconst MAX_EDITOR_PROJECT_MEDIA_MAX_BYTES = 512 * 1024 * 1024;\n\nexport interface OpenedVerifiedEditorProjectFile {\n absolutePath: string;\n handle: FileHandle;\n relativePath: string;\n stat: Stats;\n}\n\nexport async function closeEditorProjectFileHandle(\n handle: Pick<FileHandle, 'close'>,\n): Promise<void> {\n const errors: unknown[] = [];\n for (let attempt = 0; attempt < 2; attempt += 1) {\n try {\n await handle.close();\n return;\n } catch (error) {\n errors.push(error);\n }\n }\n const error = new Error('project_file_close_failed') as Error & { errors: unknown[] };\n error.errors = errors;\n throw error;\n}\n\nexport function normalizeEditorProjectFileReadPath(requestedPath: string): string {\n const candidate = requestedPath.trim();\n if (!candidate\n || candidate !== requestedPath\n || candidate.includes('\\0')\n || candidate.includes('\\\\')\n || path.posix.isAbsolute(candidate)\n || /^[A-Za-z]:\\//.test(candidate)) {\n throw new Error('project_file_path_invalid');\n }\n const segments = candidate.split('/');\n if (segments.some(segment => !segment || segment === '.' || segment === '..')) {\n throw new Error('project_file_path_invalid');\n }\n return segments.join('/');\n}\n\nexport function resolveEditorProjectMediaMaxBytes(value?: number): number {\n if (value === undefined) return DEFAULT_EDITOR_PROJECT_MEDIA_MAX_BYTES;\n if (!Number.isSafeInteger(value) || value <= 0) throw new Error('project_file_media_limit_invalid');\n return Math.min(value, MAX_EDITOR_PROJECT_MEDIA_MAX_BYTES);\n}\n\nexport async function openVerifiedEditorProjectFile(\n projectRoot: string,\n requestedPath: string,\n): Promise<OpenedVerifiedEditorProjectFile> {\n const relativePath = normalizeEditorProjectFileReadPath(requestedPath);\n const root = await fs.realpath(path.resolve(projectRoot));\n const absolutePath = path.resolve(root, ...relativePath.split('/'));\n assertPathWithinProjectRoot(root, absolutePath);\n await assertEditorProjectFilePathHasNoSymlinks(root, relativePath);\n\n let handle: FileHandle;\n try {\n handle = await fs.open(absolutePath, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));\n } catch (error) {\n if ((error as NodeJS.ErrnoException)?.code === 'ELOOP') {\n throw new Error('project_file_symlink_unsupported');\n }\n throw error;\n }\n\n try {\n const stat = await handle.stat();\n if (!stat.isFile()) throw new Error('project_file_not_found');\n\n const resolvedPath = await fs.realpath(absolutePath);\n assertPathWithinProjectRoot(root, resolvedPath);\n if (resolvedPath !== absolutePath) throw new Error('project_file_symlink_unsupported');\n\n const resolvedStat = await fs.stat(resolvedPath);\n if (resolvedStat.dev !== stat.dev || resolvedStat.ino !== stat.ino) {\n throw new Error('project_file_changed_during_read');\n }\n return { absolutePath, handle, relativePath, stat };\n } catch (error) {\n try {\n await closeEditorProjectFileHandle(handle);\n } catch (closeError) {\n const aggregate = new Error('project_file_close_failed') as Error & { errors: unknown[] };\n aggregate.errors = [error, closeError];\n throw aggregate;\n }\n throw error;\n }\n}\n\nfunction assertPathWithinProjectRoot(root: string, candidate: string): void {\n const relative = path.relative(root, candidate);\n if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {\n throw new Error('project_file_path_invalid');\n }\n}\n\nasync function assertEditorProjectFilePathHasNoSymlinks(root: string, relativePath: string): Promise<void> {\n let current = root;\n for (const segment of relativePath.split('/')) {\n current = path.join(current, segment);\n const stat = await fs.lstat(current);\n if (stat.isSymbolicLink()) throw new Error('project_file_symlink_unsupported');\n }\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import type { EditorProjectFileContent, EditorProjectFileSnapshot } from '../project-files/index';
2
+ export interface ScanEditorProjectFilesOptions {
3
+ ignoredNames?: readonly string[];
4
+ maxEntries?: number;
5
+ }
6
+ export interface ReadEditorProjectFileOptions {
7
+ maxBytes?: number;
8
+ }
9
+ export interface ResolveEditorProjectMediaFileOptions {
10
+ maxBytes?: number;
11
+ }
12
+ export interface ResolvedEditorProjectMediaFile {
13
+ relativePath: string;
14
+ name: string;
15
+ extension: string;
16
+ kind: 'image' | 'model' | 'audio';
17
+ mimeType: string;
18
+ size: number;
19
+ }
20
+ export declare function scanEditorProjectFiles(projectRoot: string, options?: ScanEditorProjectFilesOptions): Promise<EditorProjectFileSnapshot>;
21
+ export declare function readEditorProjectFile(projectRoot: string, requestedPath: string, options?: ReadEditorProjectFileOptions): Promise<EditorProjectFileContent>;
22
+ export declare function resolveEditorProjectMediaFile(projectRoot: string, requestedPath: string, options?: ResolveEditorProjectMediaFileOptions): Promise<ResolvedEditorProjectMediaFile>;
23
+ //# sourceMappingURL=project-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-files.d.ts","sourceRoot":"","sources":["../../src/vite/project-files.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EAExB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAahC,MAAM,WAAW,6BAA6B;IAC5C,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAmBD,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,yBAAyB,CAAC,CA8CpC;AA6BD,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,4BAAiC,GACzC,OAAO,CAAC,wBAAwB,CAAC,CAgCnC;AAED,wBAAsB,6BAA6B,CACjD,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,oCAAyC,GACjD,OAAO,CAAC,8BAA8B,CAAC,CAqBzC"}
@@ -0,0 +1,180 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { isEditorProjectFilePreviewable, resolveEditorProjectMediaSupport, resolveEditorProjectFileExtension, resolveEditorProjectFileLanguage, } from '../project-files/index.js';
4
+ import { closeEditorProjectFileHandle, openVerifiedEditorProjectFile, resolveEditorProjectMediaMaxBytes, } from './project-file-handle.js';
5
+ const DEFAULT_PROJECT_FILE_MAX_BYTES = 512 * 1024;
6
+ const DEFAULT_IGNORED_NAMES = new Set([
7
+ '.DS_Store',
8
+ '.cache',
9
+ '.git',
10
+ '.next',
11
+ '.nuxt',
12
+ '.parcel-cache',
13
+ '.turbo',
14
+ '.vite',
15
+ 'build',
16
+ 'coverage',
17
+ 'dist',
18
+ 'node_modules',
19
+ ]);
20
+ export async function scanEditorProjectFiles(projectRoot, options = {}) {
21
+ const root = await fs.realpath(path.resolve(projectRoot));
22
+ const maxEntries = Math.max(1, options.maxEntries ?? 20000);
23
+ const ignoredNames = options.ignoredNames
24
+ ? new Set(options.ignoredNames)
25
+ : DEFAULT_IGNORED_NAMES;
26
+ const entries = [];
27
+ let truncated = false;
28
+ const visit = async (relativeDirectory) => {
29
+ if (truncated)
30
+ return;
31
+ const absoluteDirectory = path.resolve(root, relativeDirectory);
32
+ const children = await readVerifiedEditorProjectDirectoryEntries(root, absoluteDirectory);
33
+ if (!children)
34
+ return;
35
+ children.sort((a, b) => {
36
+ const kindDifference = Number(b.isDirectory()) - Number(a.isDirectory());
37
+ return kindDifference || a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' });
38
+ });
39
+ for (const child of children) {
40
+ if (ignoredNames.has(child.name) || child.isSymbolicLink())
41
+ continue;
42
+ if (entries.length >= maxEntries) {
43
+ truncated = true;
44
+ return;
45
+ }
46
+ const relativePath = path.posix.join(relativeDirectory.split(path.sep).join('/'), child.name);
47
+ const absolutePath = path.resolve(root, ...relativePath.split('/'));
48
+ const kind = await readSafeEditorProjectScanEntryKind(root, absolutePath);
49
+ if (!kind)
50
+ continue;
51
+ const extension = kind === 'file' ? path.extname(child.name).slice(1).toLowerCase() : '';
52
+ entries.push({
53
+ path: relativePath,
54
+ name: child.name,
55
+ parentPath: relativeDirectory ? relativeDirectory.split(path.sep).join('/') : null,
56
+ kind,
57
+ ...(extension ? { extension } : {}),
58
+ });
59
+ if (kind === 'directory')
60
+ await visit(relativePath);
61
+ }
62
+ };
63
+ await visit('');
64
+ return {
65
+ rootName: path.basename(root) || 'Project',
66
+ entries,
67
+ truncated,
68
+ };
69
+ }
70
+ async function readVerifiedEditorProjectDirectoryEntries(root, absoluteDirectory) {
71
+ try {
72
+ const before = await fs.lstat(absoluteDirectory);
73
+ if (before.isSymbolicLink() || !before.isDirectory())
74
+ return null;
75
+ const resolvedBefore = await fs.realpath(absoluteDirectory);
76
+ if (resolvedBefore !== absoluteDirectory || !isEditorProjectScanPathContained(root, resolvedBefore))
77
+ return null;
78
+ const children = await fs.readdir(absoluteDirectory, { withFileTypes: true });
79
+ const after = await fs.lstat(absoluteDirectory);
80
+ const resolvedAfter = await fs.realpath(absoluteDirectory);
81
+ if (after.isSymbolicLink()
82
+ || !after.isDirectory()
83
+ || before.dev !== after.dev
84
+ || before.ino !== after.ino
85
+ || resolvedBefore !== resolvedAfter
86
+ || resolvedAfter !== absoluteDirectory
87
+ || !isEditorProjectScanPathContained(root, resolvedAfter))
88
+ return null;
89
+ return children;
90
+ }
91
+ catch {
92
+ return null;
93
+ }
94
+ }
95
+ export async function readEditorProjectFile(projectRoot, requestedPath, options = {}) {
96
+ const opened = await openVerifiedEditorProjectFile(projectRoot, requestedPath);
97
+ const { handle, relativePath, stat } = opened;
98
+ if (!isEditorProjectFilePreviewable(relativePath)) {
99
+ await closeEditorProjectFileHandle(handle);
100
+ throw new Error('project_file_preview_unsupported');
101
+ }
102
+ let maxBytes = DEFAULT_PROJECT_FILE_MAX_BYTES;
103
+ let buffer;
104
+ let bytesRead = 0;
105
+ try {
106
+ maxBytes = Math.max(1, Math.min(options.maxBytes ?? DEFAULT_PROJECT_FILE_MAX_BYTES, 4 * 1024 * 1024));
107
+ const bytesToRead = Math.min(stat.size, maxBytes);
108
+ buffer = Buffer.alloc(bytesToRead);
109
+ if (bytesToRead > 0) {
110
+ ({ bytesRead } = await handle.read(buffer, 0, bytesToRead, 0));
111
+ }
112
+ }
113
+ finally {
114
+ await closeEditorProjectFileHandle(handle);
115
+ }
116
+ const name = path.basename(relativePath);
117
+ return {
118
+ path: relativePath,
119
+ name,
120
+ extension: resolveEditorProjectFileExtension(name),
121
+ language: resolveEditorProjectFileLanguage(name) ?? 'text',
122
+ text: buffer.subarray(0, bytesRead).toString('utf8'),
123
+ size: stat.size,
124
+ truncated: stat.size > bytesRead,
125
+ };
126
+ }
127
+ export async function resolveEditorProjectMediaFile(projectRoot, requestedPath, options = {}) {
128
+ const opened = await openVerifiedEditorProjectFile(projectRoot, requestedPath);
129
+ const { handle, relativePath, stat } = opened;
130
+ const support = resolveEditorProjectMediaSupport(relativePath);
131
+ try {
132
+ if (!support)
133
+ throw new Error('project_file_media_unsupported');
134
+ if (stat.size > resolveEditorProjectMediaMaxBytes(options.maxBytes)) {
135
+ throw new Error('project_file_media_too_large');
136
+ }
137
+ const name = path.basename(relativePath);
138
+ return {
139
+ relativePath,
140
+ name,
141
+ extension: resolveEditorProjectFileExtension(name),
142
+ kind: support.kind,
143
+ mimeType: support.mimeType,
144
+ size: stat.size,
145
+ };
146
+ }
147
+ finally {
148
+ await closeEditorProjectFileHandle(handle);
149
+ }
150
+ }
151
+ async function readSafeEditorProjectScanEntryKind(root, absolutePath) {
152
+ try {
153
+ const entryStat = await fs.lstat(absolutePath);
154
+ if (entryStat.isSymbolicLink())
155
+ return null;
156
+ const resolvedPath = await fs.realpath(absolutePath);
157
+ if (resolvedPath === root || !isEditorProjectScanPathContained(root, resolvedPath))
158
+ return null;
159
+ if (resolvedPath !== absolutePath)
160
+ return null;
161
+ const resolvedStat = await fs.stat(resolvedPath);
162
+ if (resolvedStat.dev !== entryStat.dev || resolvedStat.ino !== entryStat.ino)
163
+ return null;
164
+ if (resolvedStat.isDirectory())
165
+ return 'directory';
166
+ if (resolvedStat.isFile())
167
+ return 'file';
168
+ return null;
169
+ }
170
+ catch {
171
+ return null;
172
+ }
173
+ }
174
+ function isEditorProjectScanPathContained(root, candidate) {
175
+ const relative = path.relative(root, candidate);
176
+ return relative === '' || (relative !== '..'
177
+ && !relative.startsWith(`..${path.sep}`)
178
+ && !path.isAbsolute(relative));
179
+ }
180
+ //# sourceMappingURL=project-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-files.js","sourceRoot":"","sources":["../../src/vite/project-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAElC,OAA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M,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,gCAAgC,CAAC,IAAY,EAAE,SAAiB;IACvE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAChD,OAAO,QAAQ,KAAK,EAAE,IAAI,CACxB,QAAQ,KAAK,IAAI;WACd,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC;WACrC,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["import fs from 'node:fs/promises';\nimport type { Dirent } from 'node:fs';\nimport path from 'node:path';\nimport type {\n EditorProjectFileContent,\n EditorProjectFileEntry,\n EditorProjectFileSnapshot,\n} from '../project-files/index';\nimport {\n isEditorProjectFilePreviewable,\n resolveEditorProjectMediaSupport,\n resolveEditorProjectFileExtension,\n resolveEditorProjectFileLanguage,\n} from '../project-files/index';\nimport {\n closeEditorProjectFileHandle,\n openVerifiedEditorProjectFile,\n resolveEditorProjectMediaMaxBytes,\n} from './project-file-handle';\n\nexport interface ScanEditorProjectFilesOptions {\n ignoredNames?: readonly string[];\n maxEntries?: number;\n}\n\nexport interface ReadEditorProjectFileOptions {\n maxBytes?: number;\n}\n\nexport interface ResolveEditorProjectMediaFileOptions {\n maxBytes?: number;\n}\n\nexport interface ResolvedEditorProjectMediaFile {\n relativePath: string;\n name: string;\n extension: string;\n kind: 'image' | 'model' | 'audio';\n mimeType: string;\n size: number;\n}\n\nconst DEFAULT_PROJECT_FILE_MAX_BYTES = 512 * 1024;\n\nconst DEFAULT_IGNORED_NAMES = new Set([\n '.DS_Store',\n '.cache',\n '.git',\n '.next',\n '.nuxt',\n '.parcel-cache',\n '.turbo',\n '.vite',\n 'build',\n 'coverage',\n 'dist',\n 'node_modules',\n]);\n\nexport async function scanEditorProjectFiles(\n projectRoot: string,\n options: ScanEditorProjectFilesOptions = {},\n): Promise<EditorProjectFileSnapshot> {\n const root = await fs.realpath(path.resolve(projectRoot));\n const maxEntries = Math.max(1, options.maxEntries ?? 20_000);\n const ignoredNames = options.ignoredNames\n ? new Set(options.ignoredNames)\n : DEFAULT_IGNORED_NAMES;\n const entries: EditorProjectFileEntry[] = [];\n let truncated = false;\n\n const visit = async (relativeDirectory: string): Promise<void> => {\n if (truncated) return;\n const absoluteDirectory = path.resolve(root, relativeDirectory);\n const children = await readVerifiedEditorProjectDirectoryEntries(root, absoluteDirectory);\n if (!children) return;\n children.sort((a, b) => {\n const kindDifference = Number(b.isDirectory()) - Number(a.isDirectory());\n return kindDifference || a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' });\n });\n for (const child of children) {\n if (ignoredNames.has(child.name) || child.isSymbolicLink()) continue;\n if (entries.length >= maxEntries) {\n truncated = true;\n return;\n }\n const relativePath = path.posix.join(relativeDirectory.split(path.sep).join('/'), child.name);\n const absolutePath = path.resolve(root, ...relativePath.split('/'));\n const kind = await readSafeEditorProjectScanEntryKind(root, absolutePath);\n if (!kind) continue;\n const extension = kind === 'file' ? path.extname(child.name).slice(1).toLowerCase() : '';\n entries.push({\n path: relativePath,\n name: child.name,\n parentPath: relativeDirectory ? relativeDirectory.split(path.sep).join('/') : null,\n kind,\n ...(extension ? { extension } : {}),\n });\n if (kind === 'directory') await visit(relativePath);\n }\n };\n\n await visit('');\n return {\n rootName: path.basename(root) || 'Project',\n entries,\n truncated,\n };\n}\n\nasync function readVerifiedEditorProjectDirectoryEntries(\n root: string,\n absoluteDirectory: string,\n): Promise<Dirent[] | null> {\n try {\n const before = await fs.lstat(absoluteDirectory);\n if (before.isSymbolicLink() || !before.isDirectory()) return null;\n const resolvedBefore = await fs.realpath(absoluteDirectory);\n if (resolvedBefore !== absoluteDirectory || !isEditorProjectScanPathContained(root, resolvedBefore)) return null;\n const children = await fs.readdir(absoluteDirectory, { withFileTypes: true });\n const after = await fs.lstat(absoluteDirectory);\n const resolvedAfter = await fs.realpath(absoluteDirectory);\n if (\n after.isSymbolicLink()\n || !after.isDirectory()\n || before.dev !== after.dev\n || before.ino !== after.ino\n || resolvedBefore !== resolvedAfter\n || resolvedAfter !== absoluteDirectory\n || !isEditorProjectScanPathContained(root, resolvedAfter)\n ) return null;\n return children;\n } catch {\n return null;\n }\n}\n\nexport async function readEditorProjectFile(\n projectRoot: string,\n requestedPath: string,\n options: ReadEditorProjectFileOptions = {},\n): Promise<EditorProjectFileContent> {\n const opened = await openVerifiedEditorProjectFile(projectRoot, requestedPath);\n const { handle, relativePath, stat } = opened;\n if (!isEditorProjectFilePreviewable(relativePath)) {\n await closeEditorProjectFileHandle(handle);\n throw new Error('project_file_preview_unsupported');\n }\n\n let maxBytes = DEFAULT_PROJECT_FILE_MAX_BYTES;\n let buffer: Buffer;\n let bytesRead = 0;\n try {\n maxBytes = Math.max(1, Math.min(options.maxBytes ?? DEFAULT_PROJECT_FILE_MAX_BYTES, 4 * 1024 * 1024));\n const bytesToRead = Math.min(stat.size, maxBytes);\n buffer = Buffer.alloc(bytesToRead);\n if (bytesToRead > 0) {\n ({ bytesRead } = await handle.read(buffer, 0, bytesToRead, 0));\n }\n } finally {\n await closeEditorProjectFileHandle(handle);\n }\n\n const name = path.basename(relativePath);\n return {\n path: relativePath,\n name,\n extension: resolveEditorProjectFileExtension(name),\n language: resolveEditorProjectFileLanguage(name) ?? 'text',\n text: buffer.subarray(0, bytesRead).toString('utf8'),\n size: stat.size,\n truncated: stat.size > bytesRead,\n };\n}\n\nexport async function resolveEditorProjectMediaFile(\n projectRoot: string,\n requestedPath: string,\n options: ResolveEditorProjectMediaFileOptions = {},\n): Promise<ResolvedEditorProjectMediaFile> {\n const opened = await openVerifiedEditorProjectFile(projectRoot, requestedPath);\n const { handle, relativePath, stat } = opened;\n const support = resolveEditorProjectMediaSupport(relativePath);\n try {\n if (!support) throw new Error('project_file_media_unsupported');\n if (stat.size > resolveEditorProjectMediaMaxBytes(options.maxBytes)) {\n throw new Error('project_file_media_too_large');\n }\n const name = path.basename(relativePath);\n return {\n relativePath,\n name,\n extension: resolveEditorProjectFileExtension(name),\n kind: support.kind,\n mimeType: support.mimeType,\n size: stat.size,\n };\n } finally {\n await closeEditorProjectFileHandle(handle);\n }\n}\n\nasync function readSafeEditorProjectScanEntryKind(\n root: string,\n absolutePath: string,\n): Promise<'directory' | 'file' | null> {\n try {\n const entryStat = await fs.lstat(absolutePath);\n if (entryStat.isSymbolicLink()) return null;\n const resolvedPath = await fs.realpath(absolutePath);\n if (resolvedPath === root || !isEditorProjectScanPathContained(root, resolvedPath)) return null;\n if (resolvedPath !== absolutePath) return null;\n const resolvedStat = await fs.stat(resolvedPath);\n if (resolvedStat.dev !== entryStat.dev || resolvedStat.ino !== entryStat.ino) return null;\n if (resolvedStat.isDirectory()) return 'directory';\n if (resolvedStat.isFile()) return 'file';\n return null;\n } catch {\n return null;\n }\n}\n\nfunction isEditorProjectScanPathContained(root: string, candidate: string): boolean {\n const relative = path.relative(root, candidate);\n return relative === '' || (\n relative !== '..'\n && !relative.startsWith(`..${path.sep}`)\n && !path.isAbsolute(relative)\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fps-games/editor-playable-sdk",
3
- "version": "0.2.1-beta.1",
3
+ "version": "0.2.1-beta.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "Playable project integration SDK for fps-game-editor.",
@@ -27,11 +27,11 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@babel/parser": "^7.28.5",
30
- "@fps-games/editor-core": "0.2.1-beta.1",
31
- "@fps-games/editor-protocol": "0.2.1-beta.1",
32
- "@fps-games/playable-assets": "0.2.1-beta.1",
33
- "@fps-games/playable-rendering": "0.2.1-beta.1",
34
- "@fps-games/plugin-api": "0.2.1-beta.1"
30
+ "@fps-games/editor-core": "0.2.1-beta.2",
31
+ "@fps-games/editor-protocol": "0.2.1-beta.2",
32
+ "@fps-games/playable-assets": "0.2.1-beta.2",
33
+ "@fps-games/playable-rendering": "0.2.1-beta.2",
34
+ "@fps-games/plugin-api": "0.2.1-beta.2"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "vite": "^5.4.21"
@@ -27,7 +27,7 @@ export interface EditorAgentBounds {
27
27
  }
28
28
  export interface EditorAgentSource {
29
29
  editor: 'fps-game-editor';
30
- surface: 'hierarchy' | 'selection' | 'region-binding' | 'marker' | 'marker-graph';
30
+ surface: 'hierarchy' | 'selection' | 'region-binding' | 'marker' | 'marker-graph' | 'project-files';
31
31
  projectId?: string;
32
32
  projectName?: string;
33
33
  }
@@ -125,6 +125,26 @@ export interface EditorAgentSpatialRelationGraphContext extends EditorAgentConte
125
125
  graphIssues?: EditorAgentSpatialGraphIssue[];
126
126
  focusSummaries?: EditorAgentSpatialRelationSummary[];
127
127
  }
128
+ export interface EditorAgentProjectEntry {
129
+ path: string;
130
+ name: string;
131
+ entryKind: 'file' | 'directory';
132
+ extension?: string;
133
+ assetId?: string;
134
+ assetKind?: string;
135
+ }
136
+ export interface EditorAgentProjectFileContext extends EditorAgentContextBase {
137
+ kind: 'project-file';
138
+ entry: EditorAgentProjectEntry & {
139
+ entryKind: 'file';
140
+ };
141
+ }
142
+ export interface EditorAgentProjectDirectoryContext extends EditorAgentContextBase {
143
+ kind: 'project-directory';
144
+ entry: EditorAgentProjectEntry & {
145
+ entryKind: 'directory';
146
+ };
147
+ }
128
148
  export interface EditorAgentSpatialRelationEndpointSummary {
129
149
  kind: string;
130
150
  id: string;
@@ -158,8 +178,8 @@ export interface EditorAgentSpatialRelationNeighborhood {
158
178
  localSummaries?: EditorAgentSpatialRelationSummary[];
159
179
  graphIssues?: EditorAgentSpatialGraphIssue[];
160
180
  }
161
- export type EditorAgentContext = EditorAgentSceneObjectContext | EditorAgentSceneObjectSetContext | EditorAgentRegionBindingContext | EditorAgentSpatialMarkerContext | EditorAgentSpatialRelationGraphContext;
162
- export type EditorAgentContextKind = 'scene-object' | 'scene-object-set' | 'region-binding' | 'spatial-marker' | 'spatial-relation-graph';
181
+ export type EditorAgentContext = EditorAgentSceneObjectContext | EditorAgentSceneObjectSetContext | EditorAgentRegionBindingContext | EditorAgentSpatialMarkerContext | EditorAgentSpatialRelationGraphContext | EditorAgentProjectFileContext | EditorAgentProjectDirectoryContext;
182
+ export type EditorAgentContextKind = 'scene-object' | 'scene-object-set' | 'region-binding' | 'spatial-marker' | 'spatial-relation-graph' | 'project-file' | 'project-directory';
163
183
  export interface EditorAgentContextAddEvent {
164
184
  name: typeof EDITOR_AGENT_EVENT_NAME.CONTEXT_ADD;
165
185
  context: EditorAgentContext;
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,eAAe,EACf,6BAA6B,EAC9B,MAAM,gBAAgB,CAAC;AAExB,eAAO,MAAM,mCAAmC,EAAG,CAAU,CAAC;AAE9D,eAAO,MAAM,uBAAuB;;CAE1B,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,OAAO,uBAAuB,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC;AAExG,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AACxE,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GAAG,qBAAqB,GAAG,oBAAoB,EAAE,CAAC;AAC7G,MAAM,WAAW,qBAAqB;IAAG,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAAA;CAAE;AAE1F,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,KA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E,kBAAkB,CAAC;CAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAU,CAAC;AAE9D,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,WAAW,EAAE,mBAAmB;CACxB,CAAC","sourcesContent":["import type {\n ResolvedSpatialMarkerGraph,\n ResolvedSpatialMarkerNode,\n SpatialMarkerTypeDefinition,\n SpatialRelation,\n SpatialRelationTypeDefinition,\n} from './marker-graph';\n\nexport const EDITOR_AGENT_CONTEXT_SCHEMA_VERSION = 1 as const;\n\nexport const EDITOR_AGENT_EVENT_NAME = {\n CONTEXT_ADD: 'agent.context.add',\n} as const;\n\nexport type EditorAgentEventName = typeof EDITOR_AGENT_EVENT_NAME[keyof typeof EDITOR_AGENT_EVENT_NAME];\n\nexport type EditorAgentJsonPrimitive = string | number | boolean | null;\nexport type EditorAgentJsonValue = EditorAgentJsonPrimitive | EditorAgentJsonObject | EditorAgentJsonValue[];\nexport interface EditorAgentJsonObject { [key: string]: EditorAgentJsonValue | undefined }\n\nexport interface EditorAgentVec3 {\n x: number;\n y: number;\n z: number;\n}\n\nexport interface EditorAgentTransform {\n position?: EditorAgentVec3;\n rotation?: EditorAgentVec3;\n scale?: EditorAgentVec3;\n}\n\nexport interface EditorAgentBounds {\n min?: EditorAgentVec3;\n max?: EditorAgentVec3;\n size?: EditorAgentVec3;\n center?: EditorAgentVec3;\n}\n\nexport interface EditorAgentSource {\n editor: 'fps-game-editor';\n surface: 'hierarchy' | 'selection' | 'region-binding' | 'marker' | 'marker-graph';\n projectId?: string;\n projectName?: string;\n}\n\nexport interface EditorAgentBindingCandidate {\n kind: string;\n id?: string;\n label?: string;\n path?: string;\n}\n\nexport interface EditorAgentSourceRef {\n kind: string;\n path?: string;\n jsonPath?: string;\n section?: string;\n label?: string;\n}\n\nexport interface EditorAgentRelationshipHint {\n type: string;\n description?: string;\n primaryObjectId?: string;\n supportingObjectIds?: string[];\n}\n\nexport interface EditorAgentContextSemantics {\n domainKind?: string;\n domainRole?: string;\n functionLabel?: string;\n functionDescription?: string;\n domainHints?: string[];\n bindingCandidates?: EditorAgentBindingCandidate[];\n sourceRefs?: EditorAgentSourceRef[];\n relationshipHints?: EditorAgentRelationshipHint[];\n metadata?: EditorAgentJsonObject;\n}\n\nexport interface EditorAgentContextBase extends EditorAgentContextSemantics {\n schemaVersion: typeof EDITOR_AGENT_CONTEXT_SCHEMA_VERSION;\n id: string;\n kind: EditorAgentContextKind;\n label: string;\n summary: string;\n createdAt: number;\n source: EditorAgentSource;\n}\n\nexport interface EditorAgentSceneObject {\n id: string;\n name?: string;\n label?: string;\n hierarchyPath?: string;\n objectKind?: string;\n transform?: EditorAgentTransform;\n bounds?: EditorAgentBounds;\n assetRefs?: string[];\n}\n\nexport interface EditorAgentRegion {\n id: string;\n label: string;\n bounds?: EditorAgentBounds;\n objectIds: string[];\n description?: string;\n}\n\nexport interface EditorAgentRegionRelationship {\n type: string;\n description?: string;\n}\n\nexport interface EditorAgentSceneObjectContext extends EditorAgentContextBase {\n kind: 'scene-object';\n object: EditorAgentSceneObject;\n}\n\nexport interface EditorAgentSceneObjectSetContext extends EditorAgentContextBase {\n kind: 'scene-object-set';\n objectIds: string[];\n objects: EditorAgentSceneObject[];\n}\n\nexport interface EditorAgentRegionBindingContext extends EditorAgentContextBase {\n kind: 'region-binding';\n region: EditorAgentRegion;\n relationship: EditorAgentRegionRelationship;\n}\n\nexport interface EditorAgentSpatialMarkerContext extends EditorAgentContextBase {\n kind: 'spatial-marker';\n marker: ResolvedSpatialMarkerNode;\n directRelations: SpatialRelation[];\n relatedMarkerIds?: string[];\n relatedObjectIds?: string[];\n markerTypes?: SpatialMarkerTypeDefinition[];\n relationTypes?: SpatialRelationTypeDefinition[];\n relationNeighborhood?: EditorAgentSpatialRelationNeighborhood;\n}\n\nexport interface EditorAgentSpatialRelationGraphContext extends EditorAgentContextBase {\n kind: 'spatial-relation-graph';\n graph: ResolvedSpatialMarkerGraph;\n focusMarkerIds?: string[];\n focusObjectIds?: string[];\n markerTypes?: SpatialMarkerTypeDefinition[];\n relationTypes?: SpatialRelationTypeDefinition[];\n graphIssues?: EditorAgentSpatialGraphIssue[];\n focusSummaries?: EditorAgentSpatialRelationSummary[];\n}\n\nexport interface EditorAgentSpatialRelationEndpointSummary {\n kind: string;\n id: string;\n label?: string;\n}\n\nexport interface EditorAgentSpatialRelationSummary {\n relationId?: string;\n relationType?: string;\n relationLabel?: string;\n directed?: boolean;\n from?: EditorAgentSpatialRelationEndpointSummary;\n to?: EditorAgentSpatialRelationEndpointSummary;\n summary: string;\n count?: number;\n}\n\nexport interface EditorAgentSpatialGraphIssue {\n code: string;\n severity: 'warning' | 'error';\n message: string;\n relationId?: string;\n markerId?: string;\n endpoint?: EditorAgentSpatialRelationEndpointSummary;\n}\n\nexport interface EditorAgentSpatialRelationNeighborhood {\n markerId: string;\n markerLabel?: string;\n oneHopRelations: SpatialRelation[];\n relatedMarkerIds?: string[];\n relatedObjectIds?: string[];\n twoHopSummaries?: EditorAgentSpatialRelationSummary[];\n localSummaries?: EditorAgentSpatialRelationSummary[];\n graphIssues?: EditorAgentSpatialGraphIssue[];\n}\n\nexport type EditorAgentContext =\n | EditorAgentSceneObjectContext\n | EditorAgentSceneObjectSetContext\n | EditorAgentRegionBindingContext\n | EditorAgentSpatialMarkerContext\n | EditorAgentSpatialRelationGraphContext;\n\nexport type EditorAgentContextKind =\n | 'scene-object'\n | 'scene-object-set'\n | 'region-binding'\n | 'spatial-marker'\n | 'spatial-relation-graph';\n\nexport interface EditorAgentContextAddEvent {\n name: typeof EDITOR_AGENT_EVENT_NAME.CONTEXT_ADD;\n context: EditorAgentContext;\n}\n"]}
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAU,CAAC;AAE9D,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,WAAW,EAAE,mBAAmB;CACxB,CAAC","sourcesContent":["import type {\n ResolvedSpatialMarkerGraph,\n ResolvedSpatialMarkerNode,\n SpatialMarkerTypeDefinition,\n SpatialRelation,\n SpatialRelationTypeDefinition,\n} from './marker-graph';\n\nexport const EDITOR_AGENT_CONTEXT_SCHEMA_VERSION = 1 as const;\n\nexport const EDITOR_AGENT_EVENT_NAME = {\n CONTEXT_ADD: 'agent.context.add',\n} as const;\n\nexport type EditorAgentEventName = typeof EDITOR_AGENT_EVENT_NAME[keyof typeof EDITOR_AGENT_EVENT_NAME];\n\nexport type EditorAgentJsonPrimitive = string | number | boolean | null;\nexport type EditorAgentJsonValue = EditorAgentJsonPrimitive | EditorAgentJsonObject | EditorAgentJsonValue[];\nexport interface EditorAgentJsonObject { [key: string]: EditorAgentJsonValue | undefined }\n\nexport interface EditorAgentVec3 {\n x: number;\n y: number;\n z: number;\n}\n\nexport interface EditorAgentTransform {\n position?: EditorAgentVec3;\n rotation?: EditorAgentVec3;\n scale?: EditorAgentVec3;\n}\n\nexport interface EditorAgentBounds {\n min?: EditorAgentVec3;\n max?: EditorAgentVec3;\n size?: EditorAgentVec3;\n center?: EditorAgentVec3;\n}\n\nexport interface EditorAgentSource {\n editor: 'fps-game-editor';\n surface: 'hierarchy' | 'selection' | 'region-binding' | 'marker' | 'marker-graph' | 'project-files';\n projectId?: string;\n projectName?: string;\n}\n\nexport interface EditorAgentBindingCandidate {\n kind: string;\n id?: string;\n label?: string;\n path?: string;\n}\n\nexport interface EditorAgentSourceRef {\n kind: string;\n path?: string;\n jsonPath?: string;\n section?: string;\n label?: string;\n}\n\nexport interface EditorAgentRelationshipHint {\n type: string;\n description?: string;\n primaryObjectId?: string;\n supportingObjectIds?: string[];\n}\n\nexport interface EditorAgentContextSemantics {\n domainKind?: string;\n domainRole?: string;\n functionLabel?: string;\n functionDescription?: string;\n domainHints?: string[];\n bindingCandidates?: EditorAgentBindingCandidate[];\n sourceRefs?: EditorAgentSourceRef[];\n relationshipHints?: EditorAgentRelationshipHint[];\n metadata?: EditorAgentJsonObject;\n}\n\nexport interface EditorAgentContextBase extends EditorAgentContextSemantics {\n schemaVersion: typeof EDITOR_AGENT_CONTEXT_SCHEMA_VERSION;\n id: string;\n kind: EditorAgentContextKind;\n label: string;\n summary: string;\n createdAt: number;\n source: EditorAgentSource;\n}\n\nexport interface EditorAgentSceneObject {\n id: string;\n name?: string;\n label?: string;\n hierarchyPath?: string;\n objectKind?: string;\n transform?: EditorAgentTransform;\n bounds?: EditorAgentBounds;\n assetRefs?: string[];\n}\n\nexport interface EditorAgentRegion {\n id: string;\n label: string;\n bounds?: EditorAgentBounds;\n objectIds: string[];\n description?: string;\n}\n\nexport interface EditorAgentRegionRelationship {\n type: string;\n description?: string;\n}\n\nexport interface EditorAgentSceneObjectContext extends EditorAgentContextBase {\n kind: 'scene-object';\n object: EditorAgentSceneObject;\n}\n\nexport interface EditorAgentSceneObjectSetContext extends EditorAgentContextBase {\n kind: 'scene-object-set';\n objectIds: string[];\n objects: EditorAgentSceneObject[];\n}\n\nexport interface EditorAgentRegionBindingContext extends EditorAgentContextBase {\n kind: 'region-binding';\n region: EditorAgentRegion;\n relationship: EditorAgentRegionRelationship;\n}\n\nexport interface EditorAgentSpatialMarkerContext extends EditorAgentContextBase {\n kind: 'spatial-marker';\n marker: ResolvedSpatialMarkerNode;\n directRelations: SpatialRelation[];\n relatedMarkerIds?: string[];\n relatedObjectIds?: string[];\n markerTypes?: SpatialMarkerTypeDefinition[];\n relationTypes?: SpatialRelationTypeDefinition[];\n relationNeighborhood?: EditorAgentSpatialRelationNeighborhood;\n}\n\nexport interface EditorAgentSpatialRelationGraphContext extends EditorAgentContextBase {\n kind: 'spatial-relation-graph';\n graph: ResolvedSpatialMarkerGraph;\n focusMarkerIds?: string[];\n focusObjectIds?: string[];\n markerTypes?: SpatialMarkerTypeDefinition[];\n relationTypes?: SpatialRelationTypeDefinition[];\n graphIssues?: EditorAgentSpatialGraphIssue[];\n focusSummaries?: EditorAgentSpatialRelationSummary[];\n}\n\nexport interface EditorAgentProjectEntry {\n path: string;\n name: string;\n entryKind: 'file' | 'directory';\n extension?: string;\n assetId?: string;\n assetKind?: string;\n}\n\nexport interface EditorAgentProjectFileContext extends EditorAgentContextBase {\n kind: 'project-file';\n entry: EditorAgentProjectEntry & { entryKind: 'file' };\n}\n\nexport interface EditorAgentProjectDirectoryContext extends EditorAgentContextBase {\n kind: 'project-directory';\n entry: EditorAgentProjectEntry & { entryKind: 'directory' };\n}\n\nexport interface EditorAgentSpatialRelationEndpointSummary {\n kind: string;\n id: string;\n label?: string;\n}\n\nexport interface EditorAgentSpatialRelationSummary {\n relationId?: string;\n relationType?: string;\n relationLabel?: string;\n directed?: boolean;\n from?: EditorAgentSpatialRelationEndpointSummary;\n to?: EditorAgentSpatialRelationEndpointSummary;\n summary: string;\n count?: number;\n}\n\nexport interface EditorAgentSpatialGraphIssue {\n code: string;\n severity: 'warning' | 'error';\n message: string;\n relationId?: string;\n markerId?: string;\n endpoint?: EditorAgentSpatialRelationEndpointSummary;\n}\n\nexport interface EditorAgentSpatialRelationNeighborhood {\n markerId: string;\n markerLabel?: string;\n oneHopRelations: SpatialRelation[];\n relatedMarkerIds?: string[];\n relatedObjectIds?: string[];\n twoHopSummaries?: EditorAgentSpatialRelationSummary[];\n localSummaries?: EditorAgentSpatialRelationSummary[];\n graphIssues?: EditorAgentSpatialGraphIssue[];\n}\n\nexport type EditorAgentContext =\n | EditorAgentSceneObjectContext\n | EditorAgentSceneObjectSetContext\n | EditorAgentRegionBindingContext\n | EditorAgentSpatialMarkerContext\n | EditorAgentSpatialRelationGraphContext\n | EditorAgentProjectFileContext\n | EditorAgentProjectDirectoryContext;\n\nexport type EditorAgentContextKind =\n | 'scene-object'\n | 'scene-object-set'\n | 'region-binding'\n | 'spatial-marker'\n | 'spatial-relation-graph'\n | 'project-file'\n | 'project-directory';\n\nexport interface EditorAgentContextAddEvent {\n name: typeof EDITOR_AGENT_EVENT_NAME.CONTEXT_ADD;\n context: EditorAgentContext;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fps-games/editor-protocol",
3
- "version": "0.2.1-beta.1",
3
+ "version": "0.2.1-beta.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "Shared protocol types for fps-game-editor runtimes, adapters, and Forge Play bridges.",
@@ -14,6 +14,6 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@fps-games/playable-contracts": "0.2.1-beta.1"
17
+ "@fps-games/playable-contracts": "0.2.1-beta.2"
18
18
  }
19
19
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fps-games/editor-tooling",
3
- "version": "0.2.1-beta.1",
3
+ "version": "0.2.1-beta.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "Static Plugin manifest planning and tooling host for fps-game-editor.",
@@ -22,8 +22,8 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
- "@fps-games/plugin-api": "0.2.1-beta.1",
26
- "@fps-games/plugin-host": "0.2.1-beta.1"
25
+ "@fps-games/plugin-api": "0.2.1-beta.2",
26
+ "@fps-games/plugin-host": "0.2.1-beta.2"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "vite": "^5.4.21"
@@ -1 +1 @@
1
- {"version":3,"file":"editor-ui-theme.d.ts","sourceRoot":"","sources":["../src/editor-ui-theme.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,gCAAgC,CAAC;AAsoBhE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAM7D"}
1
+ {"version":3,"file":"editor-ui-theme.d.ts","sourceRoot":"","sources":["../src/editor-ui-theme.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,gCAAgC,CAAC;AAmuBhE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAM7D"}