@salsita-ai/sdk 0.49.0-develop.fc391028c9 → 0.50.0-develop.0b927f4a8c

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 (383) hide show
  1. package/CHANGELOG.md +479 -0
  2. package/README.md +19 -11
  3. package/dist/application-spec/errors/diagnostic-codes.d.ts +6 -0
  4. package/dist/application-spec/errors/diagnostic-codes.js +1 -1
  5. package/dist/application-spec/errors/diagnostic-messages.d.ts +6 -0
  6. package/dist/application-spec/errors/diagnostic-messages.js +1 -1
  7. package/dist/application-spec/generate-application/code/common/index.d.ts +1 -0
  8. package/dist/application-spec/generate-application/code/common/index.js +1 -1
  9. package/dist/application-spec/generate-application/code/common/project-module-list.d.ts +8 -0
  10. package/dist/application-spec/generate-application/code/common/project-module-list.js +3 -0
  11. package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
  12. package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
  13. package/dist/application-spec/generate-application/code/templates/admin-domain-code.d.ts +1 -2
  14. package/dist/application-spec/generate-application/code/templates/admin-domain-code.js +6 -14
  15. package/dist/application-spec/generate-application/code/templates/admin-frontend-code.d.ts +1 -2
  16. package/dist/application-spec/generate-application/code/templates/admin-frontend-code.js +4 -4
  17. package/dist/application-spec/generate-application/code/templates/application-types.js +6 -6
  18. package/dist/application-spec/generate-application/code/templates/configurator-domain-code.d.ts +2 -2
  19. package/dist/application-spec/generate-application/code/templates/configurator-domain-code.js +7 -13
  20. package/dist/application-spec/generate-application/code/templates/configurator-frontend-code.d.ts +1 -2
  21. package/dist/application-spec/generate-application/code/templates/configurator-frontend-code.js +7 -9
  22. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-assistant.d.ts +2 -2
  23. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-assistant.js +1 -1
  24. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.d.ts +3 -1
  25. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.js +70 -66
  26. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.js +3 -0
  27. package/dist/application-spec/generate-application/code/templates/domain-spec.js +7 -7
  28. package/dist/application-spec/generate-application/code/templates/domain.js +4 -4
  29. package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.d.ts +11 -0
  30. package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.js +8 -0
  31. package/dist/application-spec/generate-application/code/templates/global-definition/index.d.ts +1 -0
  32. package/dist/application-spec/generate-application/code/templates/global-definition/index.js +1 -1
  33. package/dist/application-spec/generate-application/code/templates/globals.js +1 -0
  34. package/dist/application-spec/generate-application/code/templates/index.d.ts +7 -6
  35. package/dist/application-spec/generate-application/code/templates/index.js +1 -1
  36. package/dist/application-spec/generate-application/code/templates/skills/agents-md.js +2 -0
  37. package/dist/application-spec/generate-application/code/templates/skills/phoenix-cli-skill.js +1 -0
  38. package/dist/application-spec/generate-application/code/templates/{phoenix-create-configurator-skill.d.ts → skills/phoenix-create-configurator-skill.d.ts} +1 -1
  39. package/dist/application-spec/generate-application/code/templates/{phoenix-create-configurator-skill.js → skills/phoenix-create-configurator-skill.js} +43 -13
  40. package/dist/application-spec/generate-application/code/templates/skills/phoenix-feedback-skill.js +54 -0
  41. package/dist/application-spec/generate-application/code/templates/{phoenix-review-skill.js → skills/phoenix-review-skill.js} +7 -5
  42. package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -0
  43. package/dist/application-spec/generate-application/code/templates/skills/phoenix-variants-skill.d.ts +1 -0
  44. package/dist/application-spec/generate-application/code/templates/skills/phoenix-variants-skill.js +6 -0
  45. package/dist/application-spec/generate-application/code/templates/{common → skills}/sdk-content.d.ts +53 -3
  46. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +81 -0
  47. package/dist/application-spec/generate-application/code/templates/webhook-builders.js +8 -4
  48. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +2 -0
  49. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
  50. package/dist/application-spec/generate-application/runtime/sections/actions-runtime.d.ts +14 -0
  51. package/dist/application-spec/generate-application/runtime/sections/actions-runtime.js +1 -0
  52. package/dist/application-spec/generate-application/runtime/sections/assistant-runtime.d.ts +4 -3
  53. package/dist/application-spec/generate-application/runtime/sections/assistant-runtime.js +1 -1
  54. package/dist/application-spec/generate-application/runtime/sections/index.d.ts +1 -0
  55. package/dist/application-spec/generate-application/runtime/sections/index.js +1 -1
  56. package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +3 -1
  57. package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
  58. package/dist/application-spec/parse-application-files/merge/index.d.ts +1 -0
  59. package/dist/application-spec/parse-application-files/merge/index.js +1 -1
  60. package/dist/application-spec/parse-application-files/merge/merged-actions.d.ts +11 -0
  61. package/dist/application-spec/parse-application-files/merge/merged-actions.js +1 -0
  62. package/dist/application-spec/parse-application-files/merge/merged-spec.d.ts +2 -0
  63. package/dist/application-spec/parse-application-files/merge/merged-spec.js +1 -1
  64. package/dist/application-spec/parse-application-files/raw-spec/index.d.ts +1 -0
  65. package/dist/application-spec/parse-application-files/raw-spec/index.js +1 -1
  66. package/dist/application-spec/parse-application-files/raw-spec/raw-actions.d.ts +18 -0
  67. package/dist/application-spec/parse-application-files/raw-spec/raw-actions.js +1 -0
  68. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +14 -2
  69. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
  70. package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.d.ts +2 -0
  71. package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.js +1 -1
  72. package/dist/application-spec/parse-application-files/resolve/resolve-import-modules.js +1 -1
  73. package/dist/application-spec/parse-application-files/spec/application/application-spec.js +1 -1
  74. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.d.ts +4 -2
  75. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
  76. package/dist/application-spec/parse-application-files/spec/common/index.d.ts +1 -0
  77. package/dist/application-spec/parse-application-files/spec/common/index.js +1 -1
  78. package/dist/application-spec/parse-application-files/spec/common/schema-ref-resolver.d.ts +23 -0
  79. package/dist/application-spec/parse-application-files/spec/common/schema-ref-resolver.js +1 -0
  80. package/dist/application-spec/parse-application-files/spec/model/names/action-name.d.ts +10 -0
  81. package/dist/application-spec/parse-application-files/spec/model/names/action-name.js +1 -0
  82. package/dist/application-spec/parse-application-files/spec/model/names/index.d.ts +1 -0
  83. package/dist/application-spec/parse-application-files/spec/model/names/index.js +1 -1
  84. package/dist/application-spec/parse-application-files/spec/sections/actions.d.ts +35 -0
  85. package/dist/application-spec/parse-application-files/spec/sections/actions.js +1 -0
  86. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-field-type.d.ts +5 -21
  87. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-field-type.js +1 -1
  88. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.d.ts +14 -39
  89. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
  90. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-server-settings.d.ts +2 -2
  91. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant.d.ts +5 -19
  92. package/dist/application-spec/parse-application-files/spec/sections/index.d.ts +1 -0
  93. package/dist/application-spec/parse-application-files/spec/sections/index.js +1 -1
  94. package/dist/client/phoenix-api.d.ts +63 -31
  95. package/dist/configurator/application-runtime/extensions/configurator-extension-systems.d.ts +2 -1
  96. package/dist/configurator/application-runtime/extensions/configurator-extension-systems.js +1 -1
  97. package/dist/configurator/application-runtime/extensions/selectors.d.ts +2 -1
  98. package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
  99. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +180 -0
  100. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -0
  101. package/dist/configurator/{assistant → application-runtime/extensions/systems/assistant-system}/browser-details.d.ts +1 -1
  102. package/dist/configurator/application-runtime/extensions/systems/assistant-system/browser-details.js +1 -0
  103. package/dist/configurator/application-runtime/extensions/systems/assistant-system/change-recorder.d.ts +85 -0
  104. package/dist/configurator/application-runtime/extensions/systems/assistant-system/change-recorder.js +1 -0
  105. package/dist/configurator/{assistant → application-runtime/extensions/systems/assistant-system}/graphql-tools.d.ts +20 -16
  106. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -0
  107. package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.d.ts +4 -0
  108. package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.js +1 -1
  109. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +16 -1
  110. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  111. package/dist/configurator/application-runtime/extensions/systems/graphql-system/side-effects.d.ts +9 -0
  112. package/dist/configurator/application-runtime/extensions/systems/graphql-system/side-effects.js +1 -0
  113. package/dist/configurator/application-runtime/extensions/systems/index.d.ts +1 -0
  114. package/dist/configurator/application-runtime/extensions/systems/index.js +1 -1
  115. package/dist/configurator/application-runtime/extensions/systems/layout-system/layout-system.d.ts +2 -0
  116. package/dist/configurator/application-runtime/extensions/systems/layout-system/layout-system.js +1 -1
  117. package/dist/configurator/common/frontend-analytics.d.ts +21 -21
  118. package/dist/configurator/index.d.ts +0 -1
  119. package/dist/configurator/index.js +1 -1
  120. package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
  121. package/dist/configurator/scene/scene-analytics/scene-analytics.d.ts +2 -2
  122. package/dist/configurator/ui/assistant/AssistantChips.d.ts +11 -0
  123. package/dist/configurator/ui/assistant/AssistantChips.js +1 -0
  124. package/dist/configurator/ui/assistant/AssistantComposer.d.ts +6 -0
  125. package/dist/configurator/ui/assistant/AssistantComposer.js +1 -0
  126. package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +7 -0
  127. package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -0
  128. package/dist/configurator/ui/assistant/AssistantPanel.d.ts +11 -0
  129. package/dist/configurator/ui/assistant/AssistantPanel.js +1 -0
  130. package/dist/configurator/ui/assistant/AssistantThread.d.ts +6 -0
  131. package/dist/configurator/ui/assistant/AssistantThread.js +1 -0
  132. package/dist/configurator/ui/assistant/assistant-failure.d.ts +18 -0
  133. package/dist/configurator/ui/assistant/assistant-failure.js +1 -0
  134. package/dist/configurator/ui/assistant/index.d.ts +2 -0
  135. package/dist/configurator/ui/assistant/index.js +1 -0
  136. package/dist/configurator/ui/assistant/streamed-markdown.d.ts +6 -0
  137. package/dist/configurator/ui/assistant/streamed-markdown.js +2 -0
  138. package/dist/configurator/ui/assistant/theme.d.ts +2 -0
  139. package/dist/configurator/ui/assistant/theme.js +1 -0
  140. package/dist/configurator/ui/assistant/thread-items.d.ts +37 -0
  141. package/dist/configurator/ui/assistant/thread-items.js +1 -0
  142. package/dist/configurator/ui/assistant/tool-chip.d.ts +44 -0
  143. package/dist/configurator/ui/assistant/tool-chip.js +1 -0
  144. package/dist/configurator/ui/assistant/use-follow-stream.d.ts +17 -0
  145. package/dist/configurator/ui/assistant/use-follow-stream.js +1 -0
  146. package/dist/configurator/ui/assistant/use-is-assistant-panel-open.d.ts +5 -0
  147. package/dist/configurator/ui/assistant/use-is-assistant-panel-open.js +1 -0
  148. package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.js +5 -5
  149. package/dist/configurator/ui/configurator-layout/universal/MobileLayout.d.ts +2 -0
  150. package/dist/configurator/ui/configurator-layout/universal/MobileLayout.js +4 -4
  151. package/dist/configurator/ui/legacy/mobile-controls/MobileControls.d.ts +1 -1
  152. package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.d.ts +10 -0
  153. package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.js +1 -0
  154. package/dist/configurator/ui/phoenix-layout-elements/index.d.ts +1 -0
  155. package/dist/configurator/ui/phoenix-layout-elements/index.js +1 -1
  156. package/dist/docs/complex-use-cases/filtered-controls-with-fix-dialog.mdx +84 -98
  157. package/dist/docs/complex-use-cases/navigation-reset-selection.mdx +18 -12
  158. package/dist/docs/index.json +12 -2
  159. package/dist/docs/layouts/custom-price.mdx +14 -16
  160. package/dist/docs/layouts/sidebar/tabs.mdx +24 -21
  161. package/dist/docs/layouts/toolbar.mdx +6 -0
  162. package/dist/docs/other-features/domain-actions.mdx +418 -0
  163. package/dist/docs/other-features/side-effects.mdx +68 -34
  164. package/dist/docs/other-features/transformers.mdx +1 -1
  165. package/dist/docs/phoenix/admin.mdx +11 -26
  166. package/dist/docs/phoenix/best-practices.mdx +1 -0
  167. package/dist/docs/phoenix/finalization.mdx +1 -1
  168. package/dist/docs/phoenix/integration/headless-mode-external.mdx +5 -5
  169. package/dist/docs/phoenix/integration/widget-mode-external.mdx +5 -5
  170. package/dist/docs/phoenix/localization.mdx +3 -22
  171. package/dist/docs/phoenix/migrations.mdx +45 -5
  172. package/dist/docs/phoenix/phoenix-cli.mdx +139 -20
  173. package/dist/docs/phoenix/project-structure.mdx +13 -3
  174. package/dist/docs/phoenix/sdk-builder-workflow.mdx +12 -8
  175. package/dist/docs/phoenix/state-management.mdx +1 -1
  176. package/dist/docs/recipes-and-delete/recipe-hierarchy-selection.mdx +15 -13
  177. package/dist/docs/relations/hierarchy.mdx +13 -2
  178. package/dist/domain/actions/action-factory.d.ts +11 -0
  179. package/dist/domain/actions/action-factory.js +1 -0
  180. package/dist/domain/actions/prepare-action-implementations.d.ts +15 -0
  181. package/dist/domain/actions/prepare-action-implementations.js +5 -0
  182. package/dist/domain/application/application-config.d.ts +25 -73
  183. package/dist/domain/application/assistant/assistant-manifest.d.ts +61 -0
  184. package/dist/domain/application/assistant/assistant-manifest.js +1 -0
  185. package/dist/domain/application/assistant/assistant-resolved-manifest.d.ts +95 -0
  186. package/dist/domain/application/assistant/assistant-resolved-manifest.js +1 -0
  187. package/dist/domain/application/assistant/assistant-value-type.d.ts +9 -0
  188. package/dist/domain/application/assistant/assistant-value-type.js +1 -0
  189. package/dist/domain/application/assistant/build-assistant-manifest.d.ts +4 -0
  190. package/dist/domain/application/assistant/build-assistant-manifest.js +1 -0
  191. package/dist/{phoenix/application-spec → domain/application/assistant}/generate-assistant-prompt.d.ts +7 -6
  192. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -0
  193. package/dist/domain/application/assistant/index.d.ts +4 -0
  194. package/dist/domain/application/assistant/index.js +1 -0
  195. package/dist/domain/application/assistant-field-options.d.ts +1 -1
  196. package/dist/domain/application/assistant-mutations.d.ts +16 -15
  197. package/dist/domain/application/assistant-mutations.js +1 -1
  198. package/dist/domain/application/assistant-recipe-groups.d.ts +1 -1
  199. package/dist/domain/application/configurator-builder.d.ts +33 -18
  200. package/dist/domain/application/configurator-builder.js +1 -1
  201. package/dist/domain/application/element-registration.d.ts +5 -0
  202. package/dist/domain/application/element-registration.js +1 -1
  203. package/dist/domain/application/handler-registration.d.ts +5 -0
  204. package/dist/domain/application/handler-registration.js +1 -1
  205. package/dist/domain/application/index.d.ts +5 -4
  206. package/dist/domain/application/index.js +1 -1
  207. package/dist/domain/application/resolve-imported-transformers.d.ts +11 -1
  208. package/dist/domain/application/resolve-imported-transformers.js +1 -1
  209. package/dist/domain/components/domain-component-optic.d.ts +3 -0
  210. package/dist/domain/components/domain-component-optic.js +2 -2
  211. package/dist/domain/components/updates.d.ts +16 -0
  212. package/dist/domain/core/action.d.ts +67 -0
  213. package/dist/domain/core/action.js +1 -0
  214. package/dist/domain/core/domain-factory.d.ts +4 -0
  215. package/dist/domain/core/index.d.ts +1 -0
  216. package/dist/domain/domain-builder.d.ts +16 -0
  217. package/dist/domain/domain-builder.js +1 -1
  218. package/dist/domain/domain-context/action-system/action-system.d.ts +40 -0
  219. package/dist/domain/domain-context/action-system/action-system.js +1 -0
  220. package/dist/domain/domain-context/domain-context-systems.d.ts +5 -2
  221. package/dist/domain/domain-context/index.d.ts +2 -1
  222. package/dist/domain/domain-context/index.js +1 -1
  223. package/dist/domain/domain-context/store-system/store-system.js +1 -1
  224. package/dist/domain/domain-context/transformers/chain-builder.d.ts +1 -1
  225. package/dist/domain/domain-runtime/domain-context/domain-context.js +1 -1
  226. package/dist/domain/domain-runtime/domain-context/selectors.d.ts +4 -0
  227. package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
  228. package/dist/domain/domain-runtime/domain-runtime.d.ts +16 -4
  229. package/dist/domain/domain-runtime/spec/initialize.js +1 -1
  230. package/dist/domain/domain-runtime/spec/selectors.d.ts +2 -2
  231. package/dist/domain/domain-runtime/spec/selectors.js +1 -1
  232. package/dist/domain/domain-runtime/spec/types.d.ts +18 -4
  233. package/dist/domain/index.d.ts +5 -2
  234. package/dist/domain/index.js +1 -1
  235. package/dist/domain/invariants/invariants.d.ts +9 -0
  236. package/dist/domain/invariants/invariants.js +1 -1
  237. package/dist/domain/mocks/create-mock-domain-runtime.d.ts +9 -3
  238. package/dist/domain/mocks/create-mock-domain-runtime.js +1 -1
  239. package/dist/domain/project-modules/index.d.ts +1 -0
  240. package/dist/domain/project-modules/index.js +1 -0
  241. package/dist/domain/project-modules/project-modules.d.ts +41 -0
  242. package/dist/domain/project-modules/project-modules.js +1 -0
  243. package/dist/domain/system-components/phoenix-layout-elements/assistant-toolbar-button.d.ts +44 -0
  244. package/dist/domain/system-components/phoenix-layout-elements/assistant-toolbar-button.js +1 -0
  245. package/dist/domain/system-components/phoenix-layout-elements/index.d.ts +1 -0
  246. package/dist/domain/system-components/phoenix-layout-elements/index.js +1 -1
  247. package/dist/domain/system-components/phoenix-layout-elements/phoenix-layout-element.d.ts +2 -1
  248. package/dist/domain/system-components/phoenix-layout-elements/phoenix-layout-element.js +1 -1
  249. package/dist/editor/Editor.js +1 -1
  250. package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
  251. package/dist/editor/domain-editors/apply-spec-update.js +1 -1
  252. package/dist/editor/domain-editors/use-implementation-files.d.ts +11 -6
  253. package/dist/editor/domain-editors/use-implementation-files.js +1 -1
  254. package/dist/editor/graphql/GraphQLPanel.js +1 -1
  255. package/dist/editor/variants/VariantAnswerFooter.d.ts +17 -0
  256. package/dist/editor/variants/VariantAnswerFooter.js +1 -0
  257. package/dist/editor/variants/VariantPreviewHandler.d.ts +6 -0
  258. package/dist/editor/variants/VariantPreviewHandler.js +1 -0
  259. package/dist/editor/variants/variant-preview-styles.d.ts +49 -0
  260. package/dist/editor/variants/variant-preview-styles.js +1 -0
  261. package/dist/i18n/locales/cs/messages.js +1 -1
  262. package/dist/i18n/locales/da/messages.js +1 -1
  263. package/dist/i18n/locales/de/messages.js +1 -1
  264. package/dist/i18n/locales/de-AT/messages.js +1 -1
  265. package/dist/i18n/locales/en/messages.js +1 -1
  266. package/dist/i18n/locales/en-AU/messages.js +1 -1
  267. package/dist/i18n/locales/en-GB/messages.js +1 -1
  268. package/dist/i18n/locales/es/messages.js +1 -1
  269. package/dist/i18n/locales/fr/messages.js +1 -1
  270. package/dist/i18n/locales/hu/messages.js +1 -1
  271. package/dist/i18n/locales/it/messages.js +1 -1
  272. package/dist/i18n/locales/nl/messages.js +1 -1
  273. package/dist/i18n/locales/pl/messages.js +1 -1
  274. package/dist/i18n/locales/pt/messages.js +1 -1
  275. package/dist/i18n/locales/ro/messages.js +1 -1
  276. package/dist/i18n/locales/sk/messages.js +1 -1
  277. package/dist/i18n/locales/tr/messages.js +1 -1
  278. package/dist/legacy/domain-cli/gen/configurator-builder.js +21 -8
  279. package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
  280. package/dist/legacy/domain-cli/utils/cache.js +1 -1
  281. package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +6 -0
  282. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-admin.js +18 -19
  283. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-configurator.js +15 -16
  284. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-admin.js +22 -23
  285. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-configurator.js +15 -16
  286. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/generator-shared.d.ts +7 -2
  287. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/generator-shared.js +8 -12
  288. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/index.d.ts +1 -1
  289. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/index.js +1 -1
  290. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/webhook-builders.js +7 -7
  291. package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
  292. package/dist/phoenix/application-spec/resolve-deployment-data.d.ts +4 -3
  293. package/dist/phoenix/application-spec/resolve-deployment-data.js +2 -2
  294. package/dist/phoenix/cli.js +1 -1
  295. package/dist/phoenix/commands/build.d.ts +5 -0
  296. package/dist/phoenix/commands/build.js +1 -1
  297. package/dist/phoenix/commands/deploy.js +2 -2
  298. package/dist/phoenix/commands/dev.js +5 -5
  299. package/dist/phoenix/commands/feedback.d.ts +2 -1
  300. package/dist/phoenix/commands/feedback.js +1 -1
  301. package/dist/phoenix/commands/index.d.ts +1 -0
  302. package/dist/phoenix/commands/index.js +1 -1
  303. package/dist/phoenix/commands/login.d.ts +24 -6
  304. package/dist/phoenix/commands/login.js +2 -2
  305. package/dist/phoenix/commands/prepare-deployment-command.js +2 -2
  306. package/dist/phoenix/commands/prepare-local-environment-command.js +1 -1
  307. package/dist/phoenix/commands/story-dev.js +2 -2
  308. package/dist/phoenix/commands/variants.d.ts +35 -0
  309. package/dist/phoenix/commands/variants.js +1 -0
  310. package/dist/phoenix/editor-server/commands-router.d.ts +68 -1
  311. package/dist/phoenix/editor-server/commands-router.js +1 -1
  312. package/dist/phoenix/editor-server/editor-router.d.ts +65 -0
  313. package/dist/phoenix/editor-server/editor-server.d.ts +3 -3
  314. package/dist/phoenix/editor-server/editor-server.js +1 -1
  315. package/dist/phoenix/editor-server/protocol.d.ts +1 -0
  316. package/dist/phoenix/editor-server/spec-router.js +1 -1
  317. package/dist/phoenix/editor-server/trpc.d.ts +3 -0
  318. package/dist/phoenix/services/application-spec-project-watcher.d.ts +13 -2
  319. package/dist/phoenix/services/application-spec-project-watcher.js +3 -3
  320. package/dist/phoenix/services/index.d.ts +5 -0
  321. package/dist/phoenix/services/index.js +1 -1
  322. package/dist/phoenix/services/phoenix-application.d.ts +21 -0
  323. package/dist/phoenix/services/phoenix-application.js +1 -0
  324. package/dist/phoenix/services/phoenix-store.d.ts +48 -0
  325. package/dist/phoenix/services/phoenix-store.js +1 -0
  326. package/dist/phoenix/services/phx-banner-plugin.d.ts +32 -0
  327. package/dist/phoenix/services/phx-banner-plugin.js +1 -0
  328. package/dist/phoenix/services/phx-licenses-plugin.d.ts +55 -0
  329. package/dist/phoenix/services/phx-licenses-plugin.js +8 -0
  330. package/dist/phoenix/services/phx-variant-previews-plugin.d.ts +9 -0
  331. package/dist/phoenix/services/phx-variant-previews-plugin.js +1 -0
  332. package/dist/phoenix/services/prepare-development-environment.js +1 -1
  333. package/dist/phoenix/services/variant-file-session.d.ts +36 -0
  334. package/dist/phoenix/services/variant-file-session.js +1 -0
  335. package/dist/phoenix/services/variant-preview-service.d.ts +80 -0
  336. package/dist/phoenix/services/variant-preview-service.js +1 -0
  337. package/dist/phoenix/services/vite-config.d.ts +2 -0
  338. package/dist/phoenix/services/vite-config.js +1 -1
  339. package/dist/phoenix/utils/index.d.ts +1 -0
  340. package/dist/phoenix/utils/index.js +1 -1
  341. package/dist/phoenix/utils/read-git-commit.d.ts +14 -0
  342. package/dist/phoenix/utils/read-git-commit.js +1 -0
  343. package/dist/react-sdk/application-runtime/common-services/analytics/analytics-service.d.ts +2 -2
  344. package/dist/react-sdk/application-runtime/common-services/analytics/domain-controls-analytics.d.ts +21 -21
  345. package/dist/react-sdk/application-runtime/hooks/data/use-published-data.d.ts +1 -1
  346. package/dist/react-sdk/application-runtime/hooks/use-domain-application-props.d.ts +5 -2
  347. package/dist/react-sdk/application-runtime/hooks/use-spec.d.ts +1 -1
  348. package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.d.ts +1 -1
  349. package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
  350. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +16 -4
  351. package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +3 -0
  352. package/dist/ui-sdk/common/use-viewport-size.d.ts +4 -1
  353. package/dist/ui-sdk/common/use-viewport-size.js +1 -1
  354. package/dist/ui-sdk/components/mobile-controls/index.d.ts +1 -1
  355. package/dist/ui-sdk/theme/types.d.ts +4 -0
  356. package/dist/webhook/builders/common.d.ts +3 -0
  357. package/dist/webhook/builders/webhook-builder.d.ts +1 -1
  358. package/dist/webhook/builders/webhook-builder.js +1 -1
  359. package/package.json +5 -8
  360. package/schema/domain-spec.json +24 -0
  361. package/dist/application-spec/generate-application/code/templates/agents-md.js +0 -2
  362. package/dist/application-spec/generate-application/code/templates/common/sdk-content.js +0 -67
  363. package/dist/application-spec/generate-application/code/templates/phoenix-cli-skill.js +0 -1
  364. package/dist/application-spec/generate-application/code/templates/phoenix-feedback-skill.js +0 -31
  365. package/dist/application-spec/generate-application/code/templates/phoenix-skill.js +0 -1
  366. package/dist/configurator/assistant/browser-details.js +0 -1
  367. package/dist/configurator/assistant/graphql-tools.js +0 -1
  368. package/dist/configurator/assistant/index.d.ts +0 -1
  369. package/dist/configurator/assistant/index.js +0 -1
  370. package/dist/configurator/assistant/use-assistant-chat.d.ts +0 -20
  371. package/dist/configurator/assistant/use-assistant-chat.js +0 -1
  372. package/dist/extras/assistant/AssistantChat.d.ts +0 -6
  373. package/dist/extras/assistant/AssistantChat.js +0 -1
  374. package/dist/extras/assistant/index.d.ts +0 -1
  375. package/dist/extras/assistant/index.js +0 -1
  376. package/dist/phoenix/application-spec/generate-assistant-prompt.js +0 -1
  377. /package/dist/application-spec/generate-application/code/templates/{common → skills}/agent-skill.d.ts +0 -0
  378. /package/dist/application-spec/generate-application/code/templates/{common → skills}/agent-skill.js +0 -0
  379. /package/dist/application-spec/generate-application/code/templates/{agents-md.d.ts → skills/agents-md.d.ts} +0 -0
  380. /package/dist/application-spec/generate-application/code/templates/{phoenix-cli-skill.d.ts → skills/phoenix-cli-skill.d.ts} +0 -0
  381. /package/dist/application-spec/generate-application/code/templates/{phoenix-feedback-skill.d.ts → skills/phoenix-feedback-skill.d.ts} +0 -0
  382. /package/dist/application-spec/generate-application/code/templates/{phoenix-review-skill.d.ts → skills/phoenix-review-skill.d.ts} +0 -0
  383. /package/dist/application-spec/generate-application/code/templates/{phoenix-skill.d.ts → skills/phoenix-skill.d.ts} +0 -0
@@ -1,8 +1,10 @@
1
1
  export * from './core/index.js';
2
+ export { createActionFactory } from './actions/action-factory.js';
3
+ export { type ActionImplementationConflicts, findActionImplementationConflicts, } from './actions/prepare-action-implementations.js';
2
4
  export { createConstantExpressionFactory } from './expressions/constant-expressions.js';
3
5
  export { createCustomExpressionFactory } from './expressions/custom-expression.js';
4
6
  export { createCustomInvariantFactory, type StaticallyDefinedViolations } from './invariants/custom-invariants.js';
5
- export { InvariantBuilder } from './invariants/invariants.js';
7
+ export { InvariantBuilder, resolveInvariantModules } from './invariants/invariants.js';
6
8
  export type { AliasedInvariants, Invariant } from './invariants/invariants.js';
7
9
  export type { Violation, ViolationSeverity, ViolationTypesOf$Entity, EntityViolation } from './invariants/violation.js';
8
10
  export { compareSeverity } from './invariants/violation.js';
@@ -24,7 +26,7 @@ export { viewportStateComponent, isViewportStateComponentSnapshot, isSystemViewp
24
26
  export { type ComponentSystemFilterState, type ComponentSystemFilterProps, ComponentSystemFilterPropsSchema, getComponentSystemFilterState, CombinedComponentFilterSchema, type GradualComponentSystemFilter, type FilterMismatchReason, type IdOrWithId, } from './components/system-component-filter.js';
25
27
  export { ComponentSystemFilterSchema, type ComponentSystemFilter, type DeclarativeComponentSystemFilter, } from './components/legacy-filter.js';
26
28
  export type { OneComponentFilter, ManyComponentFilter, ComponentFilter, FilteredOutComponentSnapshot, FilteredOutFilterContext, } from './components/component-reader-types.js';
27
- export { DomainComponentOpticBuilder, type AnyDomainComponentOptic, type DomainComponentOptic, } from './components/domain-component-optic.js';
29
+ export { DomainComponentOpticBuilder, type AnyDomainComponentOptic, type DomainComponentOptic, resolveComponentOpticModules, } from './components/domain-component-optic.js';
28
30
  export { groupComponentsByEntityIdAndName, isEqualGroupedComponentSnapshots, type GroupedComponentSnapshots, } from './components/group-components-by-entity-id-and-name.js';
29
31
  export { SystemComponentBuilder } from './components/system-component-builder.js';
30
32
  export { type DataUpdate, type StateUpdate, type ComponentModification, isComponentModificationOfType, type DomainEntityCreation, type EntityDeletion, type DomainEntityReplacement, type DomainEntityModification, type EphemeralRecordCreation, type EphemeralRecordDeletion, type EphemeralRecordModification, type DomainEntityStateDelta, systemUpdateFactory, type UpdateFactory, createUpdateFactory, } from './components/updates.js';
@@ -39,6 +41,7 @@ export * from './sketching/index.js';
39
41
  export * from './projections/index.js';
40
42
  export * from './admin-domain/index.js';
41
43
  export * from './application/index.js';
44
+ export { type ProjectModule, resolveActionModules, resolveExpressionModules } from './project-modules/index.js';
42
45
  export * from './scene/index.js';
43
46
  export { getAllPhxDefinitions } from './system-definitions.js';
44
47
  export { availableSystemComponents, componentsByName } from './available-system-components.js';
@@ -1 +1 @@
1
- export*from"./core/index.js";export{createConstantExpressionFactory}from"./expressions/constant-expressions.js";export{createCustomExpressionFactory}from"./expressions/custom-expression.js";export{createCustomInvariantFactory}from"./invariants/custom-invariants.js";export{InvariantBuilder}from"./invariants/invariants.js";export{compareSeverity}from"./invariants/violation.js";export{violationsComponent}from"./invariants/violation-component.js";export{createRelationFactory}from"./relations/relation-factory.js";export{attachMultipleReferenceComponent,attachSingleReferenceComponent,referenceComponent}from"./relations/reference-component.js";export{composedOfComponent}from"./relations/composed-of.js";export{createSingleReferenceRead,createSingleReferenceWrite,createMultipleReferenceRead,createMultipleReferenceWrite,createSingleCompositionRead,createMultipleCompositionRead,createEmptyWrite}from"./relations/component-factories.js";export{systemVirtualEntityId}from"./components/system-virtual-entity.js";export{navigationStateComponent,isNavigationComponentSnapshot,isSystemNavigationComponentSnapshot}from"./components/navigation-state-component.js";export{hoverStateComponent,isHoverStateComponentSnapshot,isSystemHoverStateComponentSnapshot}from"./components/hover-state-component.js";export{selectionStateComponent,isSelectionComponentSnapshot,isSystemSelectionComponentSnapshot}from"./components/selection-state-component.js";export{viewStateComponent,isViewComponentSnapshot,isSystemViewComponentSnapshot}from"./components/view-state-component.js";export{toolStateComponent,isToolStateComponentSnapshot,isSystemToolStateComponentSnapshot}from"./components/tool-state-component.js";export{debugStateComponent,isDebugStateComponentSnapshot,isSystemDebugStateComponentSnapshot}from"./components/debug-state-component.js";export{fullscreenStateComponent,isFullscreenStateComponentSnapshot,isSystemFullscreenStateComponentSnapshot}from"./components/fullscreen-state-component.js";export{dragStateComponent,isDragStateComponentSnapshot,isSystemDragStateComponentSnapshot}from"./components/drag-state-component.js";export{viewportStateComponent,isViewportStateComponentSnapshot,isSystemViewportStateComponentSnapshot,VIEWPORTS}from"./components/viewport-state-component.js";export{ComponentSystemFilterPropsSchema,getComponentSystemFilterState,CombinedComponentFilterSchema}from"./components/system-component-filter.js";export{ComponentSystemFilterSchema}from"./components/legacy-filter.js";export{DomainComponentOpticBuilder}from"./components/domain-component-optic.js";export{groupComponentsByEntityIdAndName,isEqualGroupedComponentSnapshots}from"./components/group-components-by-entity-id-and-name.js";export{SystemComponentBuilder}from"./components/system-component-builder.js";export{isComponentModificationOfType,systemUpdateFactory,createUpdateFactory}from"./components/updates.js";export{DomainBuilder}from"./domain-builder.js";export{memoEval,isMemoizedArray,isMemoizedObject}from"./utils/memo-eval.js";export{cloneEvalCache,getEvalCache,setEvalCache,createEvalCacheToken}from"./utils/eval-cache.js";export{areProfilerLabelsEnabled,setProfilerLabelsEnabled}from"./utils/profiler-label.js";export*from"./dimensions/index.js";export*from"./domain-context/index.js";export*from"./system-components/index.js";export*from"./sketching/index.js";export*from"./projections/index.js";export*from"./admin-domain/index.js";export*from"./application/index.js";export*from"./scene/index.js";export{getAllPhxDefinitions}from"./system-definitions.js";export{availableSystemComponents,componentsByName}from"./available-system-components.js";export*from"./mocks/index.js";export*from"./domain-runtime/index.js";
1
+ export*from"./core/index.js";export{createActionFactory}from"./actions/action-factory.js";export{findActionImplementationConflicts}from"./actions/prepare-action-implementations.js";export{createConstantExpressionFactory}from"./expressions/constant-expressions.js";export{createCustomExpressionFactory}from"./expressions/custom-expression.js";export{createCustomInvariantFactory}from"./invariants/custom-invariants.js";export{InvariantBuilder,resolveInvariantModules}from"./invariants/invariants.js";export{compareSeverity}from"./invariants/violation.js";export{violationsComponent}from"./invariants/violation-component.js";export{createRelationFactory}from"./relations/relation-factory.js";export{attachMultipleReferenceComponent,attachSingleReferenceComponent,referenceComponent}from"./relations/reference-component.js";export{composedOfComponent}from"./relations/composed-of.js";export{createSingleReferenceRead,createSingleReferenceWrite,createMultipleReferenceRead,createMultipleReferenceWrite,createSingleCompositionRead,createMultipleCompositionRead,createEmptyWrite}from"./relations/component-factories.js";export{systemVirtualEntityId}from"./components/system-virtual-entity.js";export{navigationStateComponent,isNavigationComponentSnapshot,isSystemNavigationComponentSnapshot}from"./components/navigation-state-component.js";export{hoverStateComponent,isHoverStateComponentSnapshot,isSystemHoverStateComponentSnapshot}from"./components/hover-state-component.js";export{selectionStateComponent,isSelectionComponentSnapshot,isSystemSelectionComponentSnapshot}from"./components/selection-state-component.js";export{viewStateComponent,isViewComponentSnapshot,isSystemViewComponentSnapshot}from"./components/view-state-component.js";export{toolStateComponent,isToolStateComponentSnapshot,isSystemToolStateComponentSnapshot}from"./components/tool-state-component.js";export{debugStateComponent,isDebugStateComponentSnapshot,isSystemDebugStateComponentSnapshot}from"./components/debug-state-component.js";export{fullscreenStateComponent,isFullscreenStateComponentSnapshot,isSystemFullscreenStateComponentSnapshot}from"./components/fullscreen-state-component.js";export{dragStateComponent,isDragStateComponentSnapshot,isSystemDragStateComponentSnapshot}from"./components/drag-state-component.js";export{viewportStateComponent,isViewportStateComponentSnapshot,isSystemViewportStateComponentSnapshot,VIEWPORTS}from"./components/viewport-state-component.js";export{ComponentSystemFilterPropsSchema,getComponentSystemFilterState,CombinedComponentFilterSchema}from"./components/system-component-filter.js";export{ComponentSystemFilterSchema}from"./components/legacy-filter.js";export{DomainComponentOpticBuilder,resolveComponentOpticModules}from"./components/domain-component-optic.js";export{groupComponentsByEntityIdAndName,isEqualGroupedComponentSnapshots}from"./components/group-components-by-entity-id-and-name.js";export{SystemComponentBuilder}from"./components/system-component-builder.js";export{isComponentModificationOfType,systemUpdateFactory,createUpdateFactory}from"./components/updates.js";export{DomainBuilder}from"./domain-builder.js";export{memoEval,isMemoizedArray,isMemoizedObject}from"./utils/memo-eval.js";export{cloneEvalCache,getEvalCache,setEvalCache,createEvalCacheToken}from"./utils/eval-cache.js";export{areProfilerLabelsEnabled,setProfilerLabelsEnabled}from"./utils/profiler-label.js";export*from"./dimensions/index.js";export*from"./domain-context/index.js";export*from"./system-components/index.js";export*from"./sketching/index.js";export*from"./projections/index.js";export*from"./admin-domain/index.js";export*from"./application/index.js";export{resolveActionModules,resolveExpressionModules}from"./project-modules/index.js";export*from"./scene/index.js";export{getAllPhxDefinitions}from"./system-definitions.js";export{availableSystemComponents,componentsByName}from"./available-system-components.js";export*from"./mocks/index.js";export*from"./domain-runtime/index.js";
@@ -3,6 +3,7 @@ import { type AliasMap, type EventualAlias, type ExpandAlias, type ExtractFromAl
3
3
  import type { AnonymousExpression, ExpressionContext } from '../core/expression.js';
4
4
  import type { $DomainEntity, DomainEntity, EntityByType } from '../core/model.js';
5
5
  import type { DomainState } from '../core/state.js';
6
+ import { type ProjectModule } from '../project-modules/index.js';
6
7
  import { type Violation } from './violation.js';
7
8
  export interface Invariant<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ENTITY extends ENTITIES, VIOLATION_TYPE extends string> {
8
9
  evaluate(selfId: ENTITY['id'], state: DomainState<ENTITIES>, ctx: ExpressionContext<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA>): ReadonlyArray<Violation<VIOLATION_TYPE>>;
@@ -38,10 +39,18 @@ type ExpressionsFromInvariants<ENTITIES extends DomainEntity<string>, ALLOWED_RO
38
39
  };
39
40
  };
40
41
  type BuildViolationExpressions<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, INVARIANTS extends Partial<Record<ENTITIES['type'], ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITIES, string>>>>> = Record<never, never> extends ConflictingInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, DeclaredInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA>, INVARIANTS> ? () => ExpressionsFromInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, INVARIANTS> : never;
42
+ type AnyInvariant = Invariant<any, any, any, any, any, any, string>;
43
+ /** Validates the `src/invariants/` files and concatenates their invariants per entity type or alias. */
44
+ export declare const resolveInvariantModules: (modules: readonly ProjectModule[]) => Readonly<Record<string, readonly AnyInvariant[]>>;
41
45
  export declare class InvariantBuilder<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ALIASES extends Record<string, ENTITIES>, INVARIANTS extends Partial<Record<ENTITIES['type'], ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITIES, string>>>> = Record<never, never>> {
42
46
  private readonly aliasMap;
43
47
  private readonly invariants;
44
48
  constructor(aliasMap: AliasMap<ALIASES>, invariants?: INVARIANTS);
49
+ /**
50
+ * Adds the invariants of the `src/invariants/` files, as the generated barrel lists them, after
51
+ * checking each file against the folder's contract.
52
+ */
53
+ withInvariantModules(modules: readonly ProjectModule[]): InvariantBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, ExpandAndMergeInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, INVARIANTS, AliasedInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, string>>>;
45
54
  withInvariants<ALIASED_INVARIANTS extends AliasedInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, string>>(aliasedInvariants: ALIASED_INVARIANTS): InvariantBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, ExpandAndMergeInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, INVARIANTS, ALIASED_INVARIANTS>>;
46
55
  /**
47
56
  * DO NOT USE in runtime!
@@ -1 +1 @@
1
- import{expandAlias as a}from"../core/alias.js";export class InvariantBuilder{aliasMap;invariants;constructor(a,i={}){this.aliasMap=a,this.invariants=i}withInvariants(i){let t={...this.invariants};return Object.entries(i).forEach(([i,s])=>{a(this.aliasMap,i).forEach(a=>{t[a]=[...t[a]??[],...s]})}),new InvariantBuilder(this.aliasMap,t)}_conflicts={};buildViolationExpressions=()=>{let a={};return Object.entries(this.invariants).forEach(([i,t])=>{a[i]={$violations:{evaluate:(a,i,s)=>t.flatMap(t=>t.evaluate(a,i,s)),meta:{}}}}),a}}
1
+ import{expandAlias as t}from"../core/alias.js";import{SHARED_FOLDER_HINT as a,createContractError as e,isRecord as i}from"../project-modules/index.js";let r={expected:"an object of invariant lists keyed by entity type or alias",fix:`Create it with phx.domain.implementCustomInvariants({ ... }) (phx.domain.admin.implementCustomInvariants({ ... }) under src/admin/), ${a}.`},n=t=>i(t)&&"function"==typeof t.evaluate,s=t=>i(t)&&Object.values(t).every(t=>Array.isArray(t)&&t.every(n));export const resolveInvariantModules=t=>{let a={};for(let i of t){if(!s(i.exports))throw e(i.origin,r,i.exports);for(let[t,e]of Object.entries(i.exports))a[t]=[...a[t]??[],...e]}return a};export class InvariantBuilder{aliasMap;invariants;constructor(t,a={}){this.aliasMap=t,this.invariants=a}withInvariantModules(t){return this.withInvariants(resolveInvariantModules(t))}withInvariants(a){let e={...this.invariants};return Object.entries(a).forEach(([a,i])=>{t(this.aliasMap,a).forEach(t=>{e[t]=[...e[t]??[],...i]})}),new InvariantBuilder(this.aliasMap,e)}_conflicts={};buildViolationExpressions=()=>{let t={};return Object.entries(this.invariants).forEach(([a,e])=>{t[a]={$violations:{evaluate:(t,a,i)=>e.flatMap(e=>e.evaluate(t,a,i)),meta:{}}}}),t}}
@@ -15,7 +15,7 @@ import type { RegistrableTransformer } from '../domain-context/index.js';
15
15
  *
16
16
  * Contributing no extension systems is the same shape webhook and finalize hosts run in.
17
17
  */
18
- export declare const createMockDomainRuntime: <ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, NAVIGATION_STATES extends string, VIEW_STATES extends string, TOOL_STATES extends string, EXPORT_STATES extends string, CHAT_CONTEXT extends Record<string, unknown>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ADMIN_ENTITIES extends DomainEntity<string>, ADMIN_ALLOWED_ROOT_ENTITIES extends ADMIN_ENTITIES, ADMIN_$MAP extends Record<ADMIN_ENTITIES['type'], $DomainEntity<ADMIN_ENTITIES>>, ADMIN_NAVIGATION_STATES extends string, ADMIN_VIEW_STATES extends string>(_cfg: ApplicationConfig<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES, CHAT_CONTEXT, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ADMIN_ENTITIES, ADMIN_ALLOWED_ROOT_ENTITIES, ADMIN_$MAP, ADMIN_NAVIGATION_STATES, ADMIN_VIEW_STATES>, mocks: {
18
+ export declare const createMockDomainRuntime: <ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, NAVIGATION_STATES extends string, VIEW_STATES extends string, TOOL_STATES extends string, EXPORT_STATES extends string, CHAT_CONTEXT extends Record<string, unknown>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ADMIN_ENTITIES extends DomainEntity<string>, ADMIN_ALLOWED_ROOT_ENTITIES extends ADMIN_ENTITIES, ADMIN_$MAP extends Record<ADMIN_ENTITIES['type'], $DomainEntity<ADMIN_ENTITIES>>, ADMIN_NAVIGATION_STATES extends string, ADMIN_VIEW_STATES extends string>(config: ApplicationConfig<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES, CHAT_CONTEXT, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ADMIN_ENTITIES, ADMIN_ALLOWED_ROOT_ENTITIES, ADMIN_$MAP, ADMIN_NAVIGATION_STATES, ADMIN_VIEW_STATES>, mocks: {
19
19
  frontendData: FRONTEND_DATA;
20
20
  publishedData: PUBLISHED_DATA;
21
21
  sessionData: SESSION_DATA;
@@ -57,7 +57,7 @@ export declare const createMockDomainRuntime: <ENTITIES extends DomainEntity<str
57
57
  selectAdminPreset: import("@salsita-ai/common/utils").Selector<import("../index.js").SpecSelectorState, import("../index.js").AnyProductPreset>;
58
58
  selectAdminModelVersion: import("@salsita-ai/common/utils").Selector<import("../index.js").SpecSelectorState, number>;
59
59
  selectThemeOptions: import("@salsita-ai/common/utils").Selector<import("../index.js").SpecSelectorState, import("@mui/material").ThemeOptions>;
60
- selectAssistant: import("@salsita-ai/common/utils").Selector<import("../index.js").SpecSelectorState, import("../index.js").AssistantManifest | null>;
60
+ selectAssistant: import("@salsita-ai/common/utils").Selector<import("../index.js").SpecSelectorState, Required<import("../index.js").AssistantManifest> | null>;
61
61
  selectConfiguratorFactory: import("@salsita-ai/common/utils").Selector<import("../index.js").SpecSelectorState, import("../index.js").AnyDomainFactory>;
62
62
  selectAdminFactory: import("@salsita-ai/common/utils").Selector<import("../index.js").SpecSelectorState, import("../index.js").AnyDomainFactory>;
63
63
  selectConfiguratorComponentOptics: import("@salsita-ai/common/utils").Selector<import("../index.js").SpecSelectorState, readonly import("../index.js").AnyDomainComponentOptic[]>;
@@ -100,7 +100,7 @@ export declare const createMockDomainRuntime: <ENTITIES extends DomainEntity<str
100
100
  getAdminPreset: () => import("../index.js").AnyProductPreset;
101
101
  getAdminModelVersion: () => number;
102
102
  getThemeOptions: () => import("@mui/material").ThemeOptions;
103
- getAssistant: () => import("../index.js").AssistantManifest | null;
103
+ getAssistant: () => Required<import("../index.js").AssistantManifest> | null;
104
104
  getConfiguratorFactory: () => import("../index.js").AnyDomainFactory;
105
105
  getAdminFactory: () => import("../index.js").AnyDomainFactory;
106
106
  getConfiguratorComponentOptics: () => readonly import("../index.js").AnyDomainComponentOptic[];
@@ -394,6 +394,8 @@ export declare const createMockDomainRuntime: <ENTITIES extends DomainEntity<str
394
394
  getActiveConfigurationId: () => string;
395
395
  getFactory: () => import("../index.js").AnyDomainFactory;
396
396
  getDomainExpressions: () => import("../index.js").AnyExpressions;
397
+ getActionDefinitions: () => Readonly<Record<string, import("../index.js").ActionDefinition>>;
398
+ getActionImplementations: () => Readonly<Record<string, import("../index.js").AnyActionImplementation>>;
397
399
  getModelVersion: () => number;
398
400
  getAliasMap: () => import("../index.js").AnyAliasMap;
399
401
  getAllowedRootEntityTypes: () => import("../index.js").AnyAllowedRootEntityTypes;
@@ -434,6 +436,7 @@ export declare const createMockDomainRuntime: <ENTITIES extends DomainEntity<str
434
436
  getNavigationSystem: () => import("../domain-context/navigation-system/navigation-system.js").AnyNavigationSystem;
435
437
  getUndoSystem: () => import("../domain-context/undo-system.js").AnyUndoSystem;
436
438
  getRecipeCookerSystem: () => import("../index.js").AnyRecipeCookerSystem;
439
+ getActionSystem: () => import("../index.js").AnyActionSystem;
437
440
  getBlenderProjections: () => import("../index.js").AnyBlenderProjections;
438
441
  getExpressionContext: () => import("../index.js").AnyExpressionContext;
439
442
  getDomainSystems: () => import("../index.js").AnyDomainContextSystems;
@@ -500,6 +503,8 @@ export declare const createMockDomainRuntime: <ENTITIES extends DomainEntity<str
500
503
  getActiveConfigurationId: () => string;
501
504
  getFactory: () => import("../index.js").AnyDomainFactory;
502
505
  getDomainExpressions: () => import("../index.js").AnyExpressions;
506
+ getActionDefinitions: () => Readonly<Record<string, import("../index.js").ActionDefinition>>;
507
+ getActionImplementations: () => Readonly<Record<string, import("../index.js").AnyActionImplementation>>;
503
508
  getModelVersion: () => number;
504
509
  getAliasMap: () => import("../index.js").AnyAliasMap;
505
510
  getAllowedRootEntityTypes: () => import("../index.js").AnyAllowedRootEntityTypes;
@@ -540,6 +545,7 @@ export declare const createMockDomainRuntime: <ENTITIES extends DomainEntity<str
540
545
  getNavigationSystem: () => import("../domain-context/navigation-system/navigation-system.js").AnyNavigationSystem;
541
546
  getUndoSystem: () => import("../domain-context/undo-system.js").AnyUndoSystem;
542
547
  getRecipeCookerSystem: () => import("../index.js").AnyRecipeCookerSystem;
548
+ getActionSystem: () => import("../index.js").AnyActionSystem;
543
549
  getBlenderProjections: () => import("../index.js").AnyBlenderProjections;
544
550
  getExpressionContext: () => import("../index.js").AnyExpressionContext;
545
551
  getDomainSystems: () => import("../index.js").AnyDomainContextSystems;
@@ -1 +1 @@
1
- import{createDomainRuntime as o}from"../domain-runtime/index.js";import{createMockDomainRuntimeServices as e}from"./create-mock-domain-runtime-services.js";import{createMockSessionContext as t}from"./create-mock-session-context.js";export const createMockDomainRuntime=(i,a)=>{let{sessionData:n,mode:r,role:s}=a,c={...i,createTransformers:o=>a.transformers.map(e=>e.transformer.register(o,e.priority??1/0))},m=o({config:c,services:e()});return m.actions.sessionContext.setSessionContext(t(s,n)),m.actions.access.setConfiguratorAccessInfo({raw:"mock-access-token",viewMode:"read"===r,revisionId:void 0,configurationId:"mock"}),m.actions.domainData.setDomainData({publishedData:a.publishedData,frontendData:a.frontendData,backendData:a.backendData}),m.actions.loadedData.completeConfiguratorLoad({initialRevisionId:"mock-revision",initialEntities:a.entities,modelVersion:c.domain.domainFactory.modelVersion,rootEntityType:a.rootEntityType,schemaIdentity:c.domain.domainFactory}),m};
1
+ import{createDomainRuntime as o}from"../domain-runtime/index.js";import{createMockDomainRuntimeServices as t}from"./create-mock-domain-runtime-services.js";import{createMockSessionContext as e}from"./create-mock-session-context.js";export const createMockDomainRuntime=(a,i)=>{let{sessionData:n,mode:r,role:s}=i,c=o({config:a,services:t()}),m=c.getState().spec;return c.actions.spec.updateSpec({...m,configurator:{...m.configurator,createTransformers:o=>i.transformers.map(t=>t.transformer.register(o,t.priority??1/0))}}),c.actions.sessionContext.setSessionContext(e(s,n)),c.actions.access.setConfiguratorAccessInfo({raw:"mock-access-token",viewMode:"read"===r,revisionId:void 0,configurationId:"mock"}),c.actions.domainData.setDomainData({publishedData:i.publishedData,frontendData:i.frontendData,backendData:i.backendData}),c.actions.loadedData.completeConfiguratorLoad({initialRevisionId:"mock-revision",initialEntities:i.entities,modelVersion:a.domain.domainFactory.modelVersion,rootEntityType:i.rootEntityType,schemaIdentity:a.domain.domainFactory}),c};
@@ -0,0 +1 @@
1
+ export { type ExpressionModule, type ProjectModule, type ProjectModuleContract, SHARED_FOLDER_HINT, createContractError, isRecord, resolveActionModules, resolveExpressionModules, resolveListModule, } from './project-modules.js';
@@ -0,0 +1 @@
1
+ export{SHARED_FOLDER_HINT,createContractError,isRecord,resolveActionModules,resolveExpressionModules,resolveListModule}from"./project-modules.js";
@@ -0,0 +1,41 @@
1
+ import type { AnonymousExpression, AnyActionImplementations } from '../core/index.js';
2
+ /**
3
+ * The default export of one file in a project convention folder (`src/elements/`, `src/handlers/`,
4
+ * `src/expressions/`, …), paired with the project-relative path it was imported from.
5
+ *
6
+ * Generated barrels and the editor's hot reload hand project code to the SDK in this shape, without
7
+ * inspecting it. Each folder's resolver then checks the export against the folder's contract, so an
8
+ * invalid file fails with an error naming it instead of an unrelated crash later.
9
+ */
10
+ export interface ProjectModule {
11
+ readonly origin: string;
12
+ readonly exports: unknown;
13
+ }
14
+ /** The expressions of one validated expression file, keyed by entity type or alias, then by expression name. */
15
+ export interface ExpressionModule {
16
+ readonly origin: string;
17
+ readonly expressions: Readonly<Record<string, Readonly<Record<string, AnyAnonymousExpression>>>>;
18
+ }
19
+ type AnyAnonymousExpression = AnonymousExpression<any, any, any, any, any, any, unknown>;
20
+ /** What a convention folder requires of its files, in the words used by the contract error. */
21
+ export interface ProjectModuleContract {
22
+ readonly expected: string;
23
+ readonly fix: string;
24
+ }
25
+ export declare const SHARED_FOLDER_HINT = "or move the file to an underscore-prefixed folder such as src/_shared/ when it is shared code";
26
+ export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
27
+ export declare const createContractError: (origin: string, contract: ProjectModuleContract, received: unknown) => Error;
28
+ /**
29
+ * Checks a file of a folder whose contract is one item or an array of them, and returns its items.
30
+ * The first item that fails the check is the value the error reports.
31
+ */
32
+ export declare const resolveListModule: <Item>(module: ProjectModule, contract: ProjectModuleContract, isItem: (value: unknown) => value is Item) => readonly Item[];
33
+ /**
34
+ * Validates the `src/expressions/` files and rejects an expression that two files define for the
35
+ * same entity type. Merging stays with the caller, because the domain builder and the editor expand
36
+ * aliases at different points; within one file the builder's own duplicate check applies.
37
+ */
38
+ export declare const resolveExpressionModules: (modules: readonly ProjectModule[], aliasMap: Readonly<Record<string, readonly string[]>>) => readonly ExpressionModule[];
39
+ /** Validates the `src/actions/` files and merges their implementations by action name; a later file wins. */
40
+ export declare const resolveActionModules: (modules: readonly ProjectModule[]) => AnyActionImplementations;
41
+ export {};
@@ -0,0 +1 @@
1
+ export const SHARED_FOLDER_HINT="or move the file to an underscore-prefixed folder such as src/_shared/ when it is shared code";let e={expected:"an object of expressions keyed by entity type or alias, then by expression name",fix:`Create it with phx.domain.implementCustomExpressions({ ... }) (phx.domain.admin.implementCustomExpressions({ ... }) under src/admin/), ${SHARED_FOLDER_HINT}.`},t={expected:"an object of action implementations keyed by action name",fix:`Create it with phx.domain.implementActions({ ... }), ${SHARED_FOLDER_HINT}.`};export const isRecord=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);export const createContractError=(e,t,r)=>Error(`Invalid default export in ${e}: expected ${t.expected}, but got ${(e=>{if(void 0===e)return"nothing (the file has no default export)";if(null===e)return"null";if("function"==typeof e)return e.name?`the function "${e.name}"`:"an anonymous function";if(Array.isArray(e))return`an array of ${e.length} item(s)`;if(isRecord(e)){let t=Object.keys(e);return t.length>0?`an object with the keys ${t.join(", ")}`:"an empty object"}return`the ${typeof e} ${JSON.stringify(e)}`})(r)}. Every file in this folder is loaded by convention, so each one must default-export that shape. ${t.fix}`);export const resolveListModule=(e,t,r)=>{let o=Array.isArray(e.exports)?e.exports:[e.exports],n=[];for(let i of o){if(!r(i))throw createContractError(e.origin,t,i);n.push(i)}return n};let r=e=>isRecord(e)&&"function"==typeof e.evaluate,o=e=>isRecord(e)&&Object.values(e).every(r),n=e=>"function"==typeof e;export const resolveExpressionModules=(t,r)=>{let n=new Map;return t.map(t=>{let i;if(i=t.exports,!(isRecord(i)&&Object.values(i).every(o)))throw createContractError(t.origin,e,t.exports);for(let[e,o]of Object.entries(t.exports))for(let i of r[e]??[e])for(let e of Object.keys(o)){let r=`${i}.${e}`,o=n.get(r);if(void 0!==o&&o!==t.origin)throw Error(`Duplicate expression ${r}: it is defined in both ${o} and ${t.origin}, which would make its value depend on file order. Keep one definition and remove the other.`);n.set(r,t.origin)}return{origin:t.origin,expressions:t.exports}})};export const resolveActionModules=e=>e.reduce((e,r)=>{let o;if(o=r.exports,!(isRecord(o)&&Object.values(o).every(n)))throw createContractError(r.origin,t,r.exports);return{...e,...r.exports}},{});
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Toolbar button that opens and closes the built-in assistant panel. The default toolbar of the
3
+ * universal layout lists it, in a group of its own, when the application spec has an `assistant`
4
+ * section; a custom toolbar places it in a `toolbarButtonGroup` like any other button. It renders
5
+ * nothing in a project without an `assistant` section.
6
+ */
7
+ export interface AssistantToolbarButtonSchema {
8
+ readonly kind: 'assistantToolbarButton';
9
+ readonly props?: {
10
+ /**
11
+ * If true, the title is displayed on a desktop-sized layout; a phone or tablet-sized layout shows
12
+ * the icon only. By default true.
13
+ */
14
+ readonly showTitle?: boolean;
15
+ /**
16
+ * PHX icon name used instead of the default assistant icon.
17
+ */
18
+ readonly icon?: string;
19
+ };
20
+ }
21
+ export declare const assistantToolbarButtonSchema: {
22
+ readonly type: 'object';
23
+ readonly properties: {
24
+ readonly kind: {
25
+ readonly type: 'string';
26
+ readonly enum: ["assistantToolbarButton"];
27
+ };
28
+ readonly props: {
29
+ readonly type: 'object';
30
+ readonly properties: {
31
+ readonly showTitle: {
32
+ readonly type: 'boolean';
33
+ };
34
+ readonly icon: {
35
+ readonly type: 'string';
36
+ };
37
+ };
38
+ readonly required: [];
39
+ readonly additionalProperties: false;
40
+ };
41
+ };
42
+ readonly required: ["kind"];
43
+ readonly additionalProperties: false;
44
+ };
@@ -0,0 +1 @@
1
+ export const assistantToolbarButtonSchema={type:"object",properties:{kind:{type:"string",enum:["assistantToolbarButton"]},props:{type:"object",properties:{showTitle:{type:"boolean"},icon:{type:"string"}},required:[],additionalProperties:!1}},required:["kind"],additionalProperties:!1};
@@ -1,4 +1,5 @@
1
1
  export { type PhoenixLayoutElement, PhoenixLayoutElementSchema } from './phoenix-layout-element.js';
2
+ export { type AssistantToolbarButtonSchema, assistantToolbarButtonSchema } from './assistant-toolbar-button.js';
2
3
  export { type AdminConnectedResourcePageSchema, adminConnectedResourcePageSchema, } from './admin-connected-resource-page.js';
3
4
  export { type AdminDataTableActionsSchema, adminDataTableActionsSchema } from './admin-data-table-actions.js';
4
5
  export { type AdminDataTablePageSchema, adminDataTablePageSchema } from './admin-data-table-page.js';
@@ -1 +1 @@
1
- export{PhoenixLayoutElementSchema}from"./phoenix-layout-element.js";export{adminConnectedResourcePageSchema}from"./admin-connected-resource-page.js";export{adminDataTableActionsSchema}from"./admin-data-table-actions.js";export{adminDataTablePageSchema}from"./admin-data-table-page.js";export{adminPresetActionsSchema}from"./admin-preset-actions.js";export{adminPresetCategoryActionsSchema}from"./admin-preset-category-actions.js";export{adminPresetCategoryPageSchema}from"./admin-preset-category-page.js";export{adminPresetListPageSchema}from"./admin-preset-list-page.js";export{adminRecipeActionsSchema}from"./admin-recipe-actions.js";export{adminRecipeCollectionPageSchema}from"./admin-recipe-collection-page.js";export{customLayoutElementSchema}from"./custom-layout-element.js";export{enterSummaryButtonSchema}from"./enter-summary-button.js";export{enterFullscreenToolbarButtonSchema}from"./enter-fullscreen-toolbar-button.js";export{exitFullscreenToolbarButtonSchema}from"./exit-fullscreen-toolbar-button.js";export{footerPriceSchema}from"./footer-price.js";export{languageToolbarButtonSchema}from"./language-toolbar-button.js";export{mainFooterActionsSchema}from"./main-footer-actions.js";export{nextStepButtonSchema}from"./next-step-button.js";export{otherActionsSchema}from"./other-actions.js";export{previousStepButtonSchema}from"./previous-step-button.js";export{saveTemplateButtonSchema}from"./save-template-button.js";export{stepLabelSchema}from"./step-label.js";export{stepProgressSchema}from"./step-progress.js";export{shareToolbarButtonSchema}from"./share-toolbar-button.js";export{shareMenuActionSchema}from"./share-menu-action.js";export{toolbarButtonGroupSchema}from"./toolbar-button-group.js";export{undoToolbarButtonSchema}from"./undo-toolbar-button.js";export{redoToolbarButtonSchema}from"./redo-toolbar-button.js";export{resetCameraToolbarButtonSchema}from"./reset-camera-toolbar-button.js";export{measurementsToolbarButtonSchema}from"./measurements-toolbar-button.js";export{helpToolbarButtonSchema}from"./help-toolbar-button.js";export{measurementsMenuActionSchema}from"./measurements-menu-action.js";export{languageMenuActionSchema}from"./language-menu-action.js";export{helpMenuActionSchema}from"./help-menu-action.js";
1
+ export{PhoenixLayoutElementSchema}from"./phoenix-layout-element.js";export{assistantToolbarButtonSchema}from"./assistant-toolbar-button.js";export{adminConnectedResourcePageSchema}from"./admin-connected-resource-page.js";export{adminDataTableActionsSchema}from"./admin-data-table-actions.js";export{adminDataTablePageSchema}from"./admin-data-table-page.js";export{adminPresetActionsSchema}from"./admin-preset-actions.js";export{adminPresetCategoryActionsSchema}from"./admin-preset-category-actions.js";export{adminPresetCategoryPageSchema}from"./admin-preset-category-page.js";export{adminPresetListPageSchema}from"./admin-preset-list-page.js";export{adminRecipeActionsSchema}from"./admin-recipe-actions.js";export{adminRecipeCollectionPageSchema}from"./admin-recipe-collection-page.js";export{customLayoutElementSchema}from"./custom-layout-element.js";export{enterSummaryButtonSchema}from"./enter-summary-button.js";export{enterFullscreenToolbarButtonSchema}from"./enter-fullscreen-toolbar-button.js";export{exitFullscreenToolbarButtonSchema}from"./exit-fullscreen-toolbar-button.js";export{footerPriceSchema}from"./footer-price.js";export{languageToolbarButtonSchema}from"./language-toolbar-button.js";export{mainFooterActionsSchema}from"./main-footer-actions.js";export{nextStepButtonSchema}from"./next-step-button.js";export{otherActionsSchema}from"./other-actions.js";export{previousStepButtonSchema}from"./previous-step-button.js";export{saveTemplateButtonSchema}from"./save-template-button.js";export{stepLabelSchema}from"./step-label.js";export{stepProgressSchema}from"./step-progress.js";export{shareToolbarButtonSchema}from"./share-toolbar-button.js";export{shareMenuActionSchema}from"./share-menu-action.js";export{toolbarButtonGroupSchema}from"./toolbar-button-group.js";export{undoToolbarButtonSchema}from"./undo-toolbar-button.js";export{redoToolbarButtonSchema}from"./redo-toolbar-button.js";export{resetCameraToolbarButtonSchema}from"./reset-camera-toolbar-button.js";export{measurementsToolbarButtonSchema}from"./measurements-toolbar-button.js";export{helpToolbarButtonSchema}from"./help-toolbar-button.js";export{measurementsMenuActionSchema}from"./measurements-menu-action.js";export{languageMenuActionSchema}from"./language-menu-action.js";export{helpMenuActionSchema}from"./help-menu-action.js";
@@ -8,6 +8,7 @@ import { type AdminPresetCategoryPageSchema } from './admin-preset-category-page
8
8
  import { type AdminPresetListPageSchema } from './admin-preset-list-page.js';
9
9
  import { type AdminRecipeActionsSchema } from './admin-recipe-actions.js';
10
10
  import { type AdminRecipeCollectionPageSchema } from './admin-recipe-collection-page.js';
11
+ import { type AssistantToolbarButtonSchema } from './assistant-toolbar-button.js';
11
12
  import { type CustomLayoutElementSchema } from './custom-layout-element.js';
12
13
  import { type EnterFullscreenToolbarButtonSchema } from './enter-fullscreen-toolbar-button.js';
13
14
  import { type EnterSummaryButtonSchema } from './enter-summary-button.js';
@@ -32,5 +33,5 @@ import { type StepLabelSchema } from './step-label.js';
32
33
  import { type StepProgressSchema } from './step-progress.js';
33
34
  import { type ToolbarButtonGroupSchema } from './toolbar-button-group.js';
34
35
  import { type UndoToolbarButtonSchema } from './undo-toolbar-button.js';
35
- export type PhoenixLayoutElement = CustomLayoutElementSchema | AdminPresetCategoryPageSchema | AdminPresetCategoryActionsSchema | AdminPresetListPageSchema | AdminPresetActionsSchema | AdminRecipeCollectionPageSchema | AdminRecipeActionsSchema | AdminDataTablePageSchema | AdminDataTableActionsSchema | AdminConnectedResourcePageSchema | EnterSummaryButtonSchema | EnterFullscreenToolbarButtonSchema | ExitFullscreenToolbarButtonSchema | FooterPriceSchema | LanguageToolbarButtonSchema | MainFooterActionsSchema | NextStepButtonSchema | OtherActionsSchema | PreviousStepButtonSchema | SaveTemplateButtonSchema | StepLabelSchema | StepProgressSchema | ToolbarButtonGroupSchema | ShareMenuActionSchema | ShareToolbarButtonSchema | UndoToolbarButtonSchema | RedoToolbarButtonSchema | ResetCameraToolbarButtonSchema | MeasurementsToolbarButtonSchema | HelpToolbarButtonSchema | MeasurementsMenuActionSchema | LanguageMenuActionSchema | HelpMenuActionSchema;
36
+ export type PhoenixLayoutElement = CustomLayoutElementSchema | AdminPresetCategoryPageSchema | AdminPresetCategoryActionsSchema | AdminPresetListPageSchema | AdminPresetActionsSchema | AdminRecipeCollectionPageSchema | AdminRecipeActionsSchema | AdminDataTablePageSchema | AdminDataTableActionsSchema | AdminConnectedResourcePageSchema | EnterSummaryButtonSchema | EnterFullscreenToolbarButtonSchema | ExitFullscreenToolbarButtonSchema | FooterPriceSchema | LanguageToolbarButtonSchema | MainFooterActionsSchema | NextStepButtonSchema | OtherActionsSchema | PreviousStepButtonSchema | SaveTemplateButtonSchema | StepLabelSchema | StepProgressSchema | ToolbarButtonGroupSchema | ShareMenuActionSchema | ShareToolbarButtonSchema | UndoToolbarButtonSchema | RedoToolbarButtonSchema | ResetCameraToolbarButtonSchema | MeasurementsToolbarButtonSchema | AssistantToolbarButtonSchema | HelpToolbarButtonSchema | MeasurementsMenuActionSchema | LanguageMenuActionSchema | HelpMenuActionSchema;
36
37
  export declare const PhoenixLayoutElementSchema: ExtendedJsonSchema;
@@ -1 +1 @@
1
- import{adminConnectedResourcePageSchema as o}from"./admin-connected-resource-page.js";import{adminDataTableActionsSchema as t}from"./admin-data-table-actions.js";import{adminDataTablePageSchema as r}from"./admin-data-table-page.js";import{adminPresetActionsSchema as m}from"./admin-preset-actions.js";import{adminPresetCategoryActionsSchema as e}from"./admin-preset-category-actions.js";import{adminPresetCategoryPageSchema as s}from"./admin-preset-category-page.js";import{adminPresetListPageSchema as a}from"./admin-preset-list-page.js";import{adminRecipeActionsSchema as i}from"./admin-recipe-actions.js";import{adminRecipeCollectionPageSchema as n}from"./admin-recipe-collection-page.js";import{customLayoutElementSchema as p}from"./custom-layout-element.js";import{enterFullscreenToolbarButtonSchema as f}from"./enter-fullscreen-toolbar-button.js";import{enterSummaryButtonSchema as u}from"./enter-summary-button.js";import{exitFullscreenToolbarButtonSchema as j}from"./exit-fullscreen-toolbar-button.js";import{footerPriceSchema as l}from"./footer-price.js";import{helpMenuActionSchema as b}from"./help-menu-action.js";import{helpToolbarButtonSchema as c}from"./help-toolbar-button.js";import{languageMenuActionSchema as d}from"./language-menu-action.js";import{languageToolbarButtonSchema as g}from"./language-toolbar-button.js";import{mainFooterActionsSchema as h}from"./main-footer-actions.js";import{measurementsMenuActionSchema as y}from"./measurements-menu-action.js";import{measurementsToolbarButtonSchema as x}from"./measurements-toolbar-button.js";import{nextStepButtonSchema as E}from"./next-step-button.js";import{otherActionsSchema as L}from"./other-actions.js";import{previousStepButtonSchema as P}from"./previous-step-button.js";import{redoToolbarButtonSchema as v}from"./redo-toolbar-button.js";import{resetCameraToolbarButtonSchema as k}from"./reset-camera-toolbar-button.js";import{saveTemplateButtonSchema as O}from"./save-template-button.js";import{shareMenuActionSchema as S}from"./share-menu-action.js";import{shareToolbarButtonSchema as T}from"./share-toolbar-button.js";import{stepLabelSchema as q}from"./step-label.js";import{stepProgressSchema as w}from"./step-progress.js";import{toolbarButtonGroupSchema as z}from"./toolbar-button-group.js";import{undoToolbarButtonSchema as A}from"./undo-toolbar-button.js";export const PhoenixLayoutElementSchema={tsType:"PhoenixLayoutElement",import:[{module:"@salsita-ai/sdk/domain",member:"PhoenixLayoutElement"}],anyOf:[p,s,e,a,m,n,i,r,t,o,u,f,l,g,h,E,L,P,O,q,w,z,j,T,S,A,v,k,x,c,y,d,b]};
1
+ import{adminConnectedResourcePageSchema as o}from"./admin-connected-resource-page.js";import{adminDataTableActionsSchema as t}from"./admin-data-table-actions.js";import{adminDataTablePageSchema as r}from"./admin-data-table-page.js";import{adminPresetActionsSchema as m}from"./admin-preset-actions.js";import{adminPresetCategoryActionsSchema as e}from"./admin-preset-category-actions.js";import{adminPresetCategoryPageSchema as s}from"./admin-preset-category-page.js";import{adminPresetListPageSchema as a}from"./admin-preset-list-page.js";import{adminRecipeActionsSchema as i}from"./admin-recipe-actions.js";import{adminRecipeCollectionPageSchema as n}from"./admin-recipe-collection-page.js";import{assistantToolbarButtonSchema as p}from"./assistant-toolbar-button.js";import{customLayoutElementSchema as f}from"./custom-layout-element.js";import{enterFullscreenToolbarButtonSchema as u}from"./enter-fullscreen-toolbar-button.js";import{enterSummaryButtonSchema as j}from"./enter-summary-button.js";import{exitFullscreenToolbarButtonSchema as l}from"./exit-fullscreen-toolbar-button.js";import{footerPriceSchema as b}from"./footer-price.js";import{helpMenuActionSchema as c}from"./help-menu-action.js";import{helpToolbarButtonSchema as d}from"./help-toolbar-button.js";import{languageMenuActionSchema as g}from"./language-menu-action.js";import{languageToolbarButtonSchema as h}from"./language-toolbar-button.js";import{mainFooterActionsSchema as y}from"./main-footer-actions.js";import{measurementsMenuActionSchema as x}from"./measurements-menu-action.js";import{measurementsToolbarButtonSchema as E}from"./measurements-toolbar-button.js";import{nextStepButtonSchema as L}from"./next-step-button.js";import{otherActionsSchema as P}from"./other-actions.js";import{previousStepButtonSchema as v}from"./previous-step-button.js";import{redoToolbarButtonSchema as k}from"./redo-toolbar-button.js";import{resetCameraToolbarButtonSchema as O}from"./reset-camera-toolbar-button.js";import{saveTemplateButtonSchema as S}from"./save-template-button.js";import{shareMenuActionSchema as T}from"./share-menu-action.js";import{shareToolbarButtonSchema as q}from"./share-toolbar-button.js";import{stepLabelSchema as w}from"./step-label.js";import{stepProgressSchema as z}from"./step-progress.js";import{toolbarButtonGroupSchema as A}from"./toolbar-button-group.js";import{undoToolbarButtonSchema as B}from"./undo-toolbar-button.js";export const PhoenixLayoutElementSchema={tsType:"PhoenixLayoutElement",import:[{module:"@salsita-ai/sdk/domain",member:"PhoenixLayoutElement"}],anyOf:[f,s,e,a,m,n,i,r,t,o,j,u,b,h,y,L,P,v,S,w,z,A,l,q,T,B,k,O,E,p,d,x,g,c]};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import{Box as o,Chip as n,CssBaseline as r,IconButton as s,ThemeProvider as l,Tooltip as a,Typography as d,createTheme as c,useMediaQuery as m,useTheme as p}from"@mui/material";import{ModalProvider as f}from"mui-modal-provider";import{memo as h,useCallback as u,useEffect as g,useRef as w,useState as k}from"react";import{match as x}from"ts-pattern";import{useLocalStorage as y}from"usehooks-ts";import{PhxIcon as b,SnackbarProvider as v,createThemeWithPhoenixIcons as S}from"#package/ui-sdk";import{EditorMode as P}from"./EditorMode.js";import{EditorRuntimeProvider as j,useWebComponent as V}from"./EditorRuntimeProvider.js";import{EditorAdminContextProvider as E}from"./admin/EditorAdminContext.js";import{EditorAdminMainContent as D}from"./admin/EditorAdminMainContent.js";import{EditorAdminSidebar as C}from"./admin/EditorAdminSidebar.js";import{useEditorAdminState as T}from"./admin/use-editor-admin-state.js";import{Analytics as A}from"./analytics/Analytics.js";import{AnalyticsProvider as L}from"./analytics/AnalyticsContext.js";import{Logotype as M}from"./common/Logotype.js";import{PanelIconButton as W}from"./common/PanelIconButton.js";import{BrowserConsoleReporter as R}from"./console-reporter/BrowserConsoleReporter.js";import{DataHandler as I}from"./data/DataHandler.js";import{DebugFlags as F}from"./debug-flags/DebugFlags.js";import{DiagnosticsPanel as G}from"./diagnostics/DiagnosticsPanel.js";import{DomainEditors as z}from"./domain-editors/DomainEditors.js";import{DomainSpecProvider as B,useDomainSpecContext as Q}from"./domain-editors/DomainSpecContext.js";import{DomainReflection as H}from"./domain-reflection/DomainReflection.js";import{GraphQLPanel as U}from"./graphql/GraphQLPanel.js";import{LogsPanel as q}from"./logs/LogsPanel.js";import{EditorMockProvider as O}from"./mocks/EditorMockContext.js";import{Mocks as K}from"./mocks/Mocks.js";import{ProfilerPanel as N}from"./profiler/ProfilerPanel.js";import{RemoteFilesList as X}from"./remote-files/RemoteFilesList.js";import{SceneHandler as Y}from"./scene/SceneHandler.js";import{ScreenshotHandler as $}from"./screenshot/ScreenshotHandler.js";import{EditorConnectionProvider as J}from"./services/EditorConnectionContext.js";import{EditorActionButtons as Z}from"./sidebar/EditorActionButtons.js";import{StateInspector as _}from"./state-inspector/index.js";import{StateHandler as ee}from"./state/StateHandler.js";import{SpaTemplate as ei}from"./templates/SpaTemplate.js";import{Templates as et}from"./templates/Templates.js";import{TemplatesList as eo}from"./templates/TemplatesList.js";import{TunnelProvider as en,useTunnel as er}from"./tunnel/TunnelContext.js";import{TunnelPanel as es}from"./tunnel/TunnelPanel.js";import{hasTunnelProblem as el}from"./tunnel/tunnel-view-model.js";import{VideoStudio as ea}from"./video-studio/VideoStudio.js";import{WebSocketStatus as ed}from"./websocket-status/WebSocketStatus.js";let ec=h(()=>{let i=w(null),t=V();return g(()=>{let e=i.current;if(e&&t)return e.appendChild(t),()=>{e.contains(t)&&e.removeChild(t)}},[t]),e("div",{ref:i,style:{width:"100%",height:"100%"}})}),em=S(c());export const EditorPanelView={Files:"Files",Reflections:"Reflections",Domain:"Domain",Templates:"Templates",Mocks:"Mocks",Inspector:"Inspector",Debug:"Debug",Profiler:"Profiler",GraphQL:"GraphQL",VideoStudio:"VideoStudio",Analytics:"Analytics",Diagnostics:"Diagnostics",Logs:"Logs",Tunnel:"Tunnel",WebSocketStatus:"WebSocketStatus",Admin:"Admin"};let ep=[{key:EditorPanelView.Templates,icon:"GridFour",title:"Templates"},{key:EditorPanelView.Reflections,icon:"House",title:"Reflections"},{key:EditorPanelView.Files,icon:"List",title:"Files"},{key:EditorPanelView.Domain,icon:"Gear",title:"Domain"},{key:EditorPanelView.Mocks,icon:"TagBold",title:"Mocks"},{key:EditorPanelView.Inspector,icon:"CurrencyDollar",title:"Inspector"},{key:EditorPanelView.Debug,icon:"EyeBold",title:"Debug"},{key:EditorPanelView.Profiler,icon:"Alarm",title:"Profiler"},{key:EditorPanelView.GraphQL,icon:"MagnifyingGlassBold",title:"GraphQL"},{key:EditorPanelView.VideoStudio,icon:"CameraRotate",title:"Video Studio"},{key:EditorPanelView.Analytics,icon:"Flame",title:"Analytics"},{key:EditorPanelView.Diagnostics,icon:"WarningCircle",title:"Diagnostics"},{key:EditorPanelView.Logs,icon:"BracketsCurly",title:"Logs"},{key:EditorPanelView.Tunnel,icon:"ArrowsHorizontal",title:"Webhook Tunnel"}],ef=h(r=>{let{panelView:l,setPanelView:c,width:m,setWidth:p,selectedTemplate:f,setSelectedTemplate:h,isResizing:w,setIsResizing:y,onExit:v,enableAdmin:S}=r,P=T(S),{unreadDiagnosticCount:j,markDiagnosticsRead:V}=Q(),{state:E}=er(),L=l?Math.max(m,240):38,[R,I]=k(0),B=u(()=>I(e=>e+1),[]);return g(()=>{l===EditorPanelView.Diagnostics&&V()},[V,l]),i(o,{component:"div",sx:{display:"grid",gridTemplateColumns:`${L}px min-content auto`,gridTemplateRows:"minmax(0, 1fr)",width:"100vw",height:"100vh",backgroundColor:"#ffffff",overflow:"hidden"},onMouseMove:e=>{w&&p(e.clientX)},onMouseUp:()=>{y(!1)},children:[i(o,{component:"div",sx:{display:"grid",gridTemplateColumns:"36px auto",backgroundColor:"#f8f9fa",borderRight:"1px solid #dee2e6",boxShadow:"2px 0 8px rgba(0, 0, 0, 0.06)",overflow:"hidden",height:"100%"},children:[i("div",{style:{backgroundColor:"#f8f9fa",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 0"},children:[e("div",{style:{marginBottom:"8px"},children:e(M,{variant:"icon-only"})}),i("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"2px"},children:[S&&i(t,{children:[e(W,{icon:"SlidersHorizontal",title:"Admin",active:l===EditorPanelView.Admin,onClick:()=>{l===EditorPanelView.Admin?c(null):c(EditorPanelView.Admin)}}),e("div",{style:{borderBottom:"1px solid #dee2e6",margin:"2px 0"}})]}),ep.map(i=>e(W,{icon:i.icon,title:i.title,active:l===i.key,badgeCount:i.key===EditorPanelView.Tunnel?+!!el(E):i.key===EditorPanelView.Diagnostics?j:0,onClick:()=>{l===i.key?c(null):c(i.key)}},i.key))]}),e(Z,{reload:B}),e("div",{style:{padding:"0 2px",paddingBottom:"4px"},children:e(W,{icon:"CloudArrowUp",title:"WebSocket Status",active:l===EditorPanelView.WebSocketStatus,onClick:()=>{l===EditorPanelView.WebSocketStatus?c(null):c(EditorPanelView.WebSocketStatus)}})}),v&&e("div",{style:{padding:"0 2px",paddingBottom:"8px"},children:e(W,{icon:"SignOut",title:"Exit Editor",variant:"danger",onClick:v})})]}),l&&i(o,{component:"div",sx:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",backgroundColor:"#ffffff"},children:[e(o,{component:"div",sx:{p:1.5,borderBottom:"1px solid #e9ecef",backgroundColor:"#ffffff"},children:i(o,{component:"div",sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i(o,{component:"div",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e(d,{variant:"h6",sx:{fontSize:16,fontWeight:600,color:"#212529"},children:x(l).with("Files",()=>"Files").with("Reflections",()=>"Reflections").with("Domain",()=>"Domain").with("Templates",()=>"Templates").with("Mocks",()=>"Mocks").with("Inspector",()=>"State Inspector").with("Debug",()=>"Debug").with("Profiler",()=>"Profiler").with("GraphQL",()=>"GraphQL").with("VideoStudio",()=>"Video Studio").with("Analytics",()=>"Analytics").with("Diagnostics",()=>"Diagnostics").with("Logs",()=>"Dev Server Logs").with("Tunnel",()=>"Webhook Tunnel").with("WebSocketStatus",()=>"WebSocket Status").with("Admin",()=>"Admin").otherwise(e=>e)}),e(a,{title:x(l).with("Files",()=>"Browse and inspect loaded GLTF files and their contents").with("Reflections",()=>"Inspect internal Phoenix systems state and configuration").with("Domain",()=>"Edit YAML domain specifications and component configurations").with("Templates",()=>"Select different layout templates for the configurator interface").with("Mocks",()=>"Create and manage mock data for testing session and access configurations").with("Inspector",()=>"Walk the entity tree: fields, expressions, and children").with("Debug",()=>"Toggle scene debug visuals like offset anchors, snapping, and collision meshes").with("Profiler",()=>"Make domain expressions show up as named frames in browser CPU profiles").with("GraphQL",()=>"Run GraphQL queries against the schema generated from the assistant manifest").with("VideoStudio",()=>"Create video sequences by capturing keyframes and exporting as video").with("Analytics",()=>"View parse pipeline metrics, domain stats, and diagnostics").with("Diagnostics",()=>"View latest editor warnings and errors").with("Logs",()=>"View dev server logs: spec builds, webhooks, vite, and browser console").with("Tunnel",()=>"View webhook tunnel status and the requests routed through it").with("WebSocketStatus",()=>"View WebSocket connection status and editor mode information").with("Admin",()=>"Manage admin panel, publish data, and configure settings").otherwise(()=>"Panel information"),placement:"left",arrow:!0,children:e(s,{size:"small",sx:{ml:1,color:"#6c757d",fontSize:14,p:.25,"&:hover":{backgroundColor:"#f8f9fa",color:"#495057"}},children:e(b,{name:"Info",style:{fontSize:14}})})})]}),e(o,{component:"div",sx:{display:"flex",alignItems:"center",gap:1},children:"Templates"===l&&e(n,{label:f.charAt(0).toUpperCase()+f.slice(1),variant:"outlined",size:"small",sx:{backgroundColor:"#f8f9fa",borderColor:"#dee2e6",color:"#495057",fontWeight:500,fontSize:"0.75rem"}})})]})}),i(o,{component:"div",sx:{flex:1,backgroundColor:"#ffffff",overflow:"auto"},children:["Files"===l&&e(X,{}),"Reflections"===l&&e(H,{}),"Domain"===l&&e(z,{}),"Templates"===l&&e(eo,{selectedTemplate:f,onTemplateSelect:h}),"Mocks"===l&&e(K,{}),"Inspector"===l&&e(_,{}),"Debug"===l&&e(F,{}),"Profiler"===l&&e(N,{}),"GraphQL"===l&&e(U,{}),"VideoStudio"===l&&e(ea,{}),"Analytics"===l&&e(A,{}),"Diagnostics"===l&&e(G,{}),"Logs"===l&&e(q,{}),"Tunnel"===l&&e(es,{}),"WebSocketStatus"===l&&e(ed,{}),S&&"Admin"===l&&e(C,{...P})]})]})]}),e("div",{style:{width:"2px",backgroundColor:"#dee2e6",cursor:"ew-resize",boxShadow:"1px 0 3px rgba(0, 0, 0, 0.05)"},onMouseDown:()=>{y(!0)}}),i("div",{style:{position:"relative",overflow:"hidden"},children:[e("div",{style:{position:"absolute",inset:0,zIndex:+("Admin"!==l)},children:e(et,{selectedTemplate:f,children:e(ec,{},R)})}),S&&e("div",{style:{position:"absolute",inset:0,zIndex:+("Admin"===l)},children:e(D,{})})]})]})}),eh=h(()=>e(ei,{children:e(ec,{})})),eu=h(o=>{let{wsUrl:n="ws://localhost:3020",localMode:r=!1,domainSpec:s,initialRawProjectFiles:l,onExit:a,mockTemplates:d,autoApplyTemplate:c,environmentKey:h,tagName:u,enableAdmin:w=!0}=o,x=m(p().breakpoints.up("md")),[b,S]=y("editor-width",350),[V,D]=y("editor-view",null),[C,T]=y("editor-template","spa"),[A,M]=k(!1);return g(()=>{null===V||Object.values(EditorPanelView).some(e=>e===V)&&(w||V!==EditorPanelView.Admin)||D(null)},[w,V,D]),e(f,{children:e(v,{maxSnack:5,children:e(E,{children:e(j,{tagName:u,children:e(J,{initialWsUrl:n,localMode:r,children:e(en,{children:e(P,{children:e(L,{children:e(B,{domainSpec:s,initialRawProjectFiles:l,children:i(O,{mockTemplates:d,autoApplyTemplate:c,environmentKey:h,children:[!r&&i(t,{children:[e($,{}),e(ee,{}),e(I,{}),e(Y,{}),e(R,{})]}),x?e(ef,{panelView:V,setPanelView:D,width:b,setWidth:S,selectedTemplate:C,setSelectedTemplate:T,isResizing:A,setIsResizing:M,onExit:a,enableAdmin:w}):e(eh,{})]})})})})})})})})})})});export const Editor=h(t=>i(l,{theme:em,children:[e(r,{}),e(eu,{...t})]}));
1
+ import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import{Box as o,Chip as n,CssBaseline as r,IconButton as s,ThemeProvider as a,Tooltip as l,Typography as d,createTheme as c,useMediaQuery as m,useTheme as p}from"@mui/material";import{ModalProvider as f}from"mui-modal-provider";import{memo as h,useCallback as u,useEffect as g,useState as w}from"react";import{match as k}from"ts-pattern";import{useLocalStorage as y}from"usehooks-ts";import{PhxIcon as x,SnackbarProvider as b,createThemeWithPhoenixIcons as v}from"#package/ui-sdk";import{EditorMode as S}from"./EditorMode.js";import{EditorRuntimeProvider as P}from"./EditorRuntimeProvider.js";import{EditorAdminContextProvider as j}from"./admin/EditorAdminContext.js";import{EditorAdminMainContent as V}from"./admin/EditorAdminMainContent.js";import{EditorAdminSidebar as E}from"./admin/EditorAdminSidebar.js";import{useEditorAdminState as D}from"./admin/use-editor-admin-state.js";import{Analytics as T}from"./analytics/Analytics.js";import{AnalyticsProvider as A}from"./analytics/AnalyticsContext.js";import{Logotype as C}from"./common/Logotype.js";import{PanelIconButton as L}from"./common/PanelIconButton.js";import{BrowserConsoleReporter as M}from"./console-reporter/BrowserConsoleReporter.js";import{DataHandler as W}from"./data/DataHandler.js";import{DebugFlags as R}from"./debug-flags/DebugFlags.js";import{DiagnosticsPanel as I}from"./diagnostics/DiagnosticsPanel.js";import{DomainEditors as F}from"./domain-editors/DomainEditors.js";import{DomainSpecProvider as G,useDomainSpecContext as z}from"./domain-editors/DomainSpecContext.js";import{DomainReflection as B}from"./domain-reflection/DomainReflection.js";import{GraphQLPanel as Q}from"./graphql/GraphQLPanel.js";import{LogsPanel as H}from"./logs/LogsPanel.js";import{EditorMockProvider as U}from"./mocks/EditorMockContext.js";import{Mocks as q}from"./mocks/Mocks.js";import{ProfilerPanel as O}from"./profiler/ProfilerPanel.js";import{RemoteFilesList as K}from"./remote-files/RemoteFilesList.js";import{SceneHandler as N}from"./scene/SceneHandler.js";import{ScreenshotHandler as X}from"./screenshot/ScreenshotHandler.js";import{EditorConnectionProvider as Y}from"./services/EditorConnectionContext.js";import{EditorActionButtons as $}from"./sidebar/EditorActionButtons.js";import{StateInspector as J}from"./state-inspector/index.js";import{StateHandler as Z}from"./state/StateHandler.js";import{SpaTemplate as _}from"./templates/SpaTemplate.js";import{Templates as ee}from"./templates/Templates.js";import{TemplatesList as ei}from"./templates/TemplatesList.js";import{TunnelProvider as et,useTunnel as eo}from"./tunnel/TunnelContext.js";import{TunnelPanel as en}from"./tunnel/TunnelPanel.js";import{hasTunnelProblem as er}from"./tunnel/tunnel-view-model.js";import{HTML_VARIANT_FRAME_ATTRIBUTE as es,VariantPreviewHandler as ea,useConfiguratorContainerRef as el}from"./variants/VariantPreviewHandler.js";import{VideoStudio as ed}from"./video-studio/VideoStudio.js";import{WebSocketStatus as ec}from"./websocket-status/WebSocketStatus.js";let em=h(()=>e("div",{ref:el(),style:{width:"100%",height:"100%"}})),ep=v(c());export const EditorPanelView={Files:"Files",Reflections:"Reflections",Domain:"Domain",Templates:"Templates",Mocks:"Mocks",Inspector:"Inspector",Debug:"Debug",Profiler:"Profiler",GraphQL:"GraphQL",VideoStudio:"VideoStudio",Analytics:"Analytics",Diagnostics:"Diagnostics",Logs:"Logs",Tunnel:"Tunnel",WebSocketStatus:"WebSocketStatus",Admin:"Admin"};let ef=[{key:EditorPanelView.Templates,icon:"GridFour",title:"Templates"},{key:EditorPanelView.Reflections,icon:"House",title:"Reflections"},{key:EditorPanelView.Files,icon:"List",title:"Files"},{key:EditorPanelView.Domain,icon:"Gear",title:"Domain"},{key:EditorPanelView.Mocks,icon:"TagBold",title:"Mocks"},{key:EditorPanelView.Inspector,icon:"CurrencyDollar",title:"Inspector"},{key:EditorPanelView.Debug,icon:"EyeBold",title:"Debug"},{key:EditorPanelView.Profiler,icon:"Alarm",title:"Profiler"},{key:EditorPanelView.GraphQL,icon:"MagnifyingGlassBold",title:"GraphQL"},{key:EditorPanelView.VideoStudio,icon:"CameraRotate",title:"Video Studio"},{key:EditorPanelView.Analytics,icon:"Flame",title:"Analytics"},{key:EditorPanelView.Diagnostics,icon:"WarningCircle",title:"Diagnostics"},{key:EditorPanelView.Logs,icon:"BracketsCurly",title:"Logs"},{key:EditorPanelView.Tunnel,icon:"ArrowsHorizontal",title:"Webhook Tunnel"}],eh=h(r=>{let{panelView:a,setPanelView:c,width:m,setWidth:p,selectedTemplate:f,setSelectedTemplate:h,isResizing:y,setIsResizing:b,onExit:v,enableAdmin:S}=r,P=D(S),{unreadDiagnosticCount:j,markDiagnosticsRead:A}=z(),{state:M}=eo(),W=a?Math.max(m,240):38,[G,U]=w(0),N=u(()=>U(e=>e+1),[]);return g(()=>{a===EditorPanelView.Diagnostics&&A()},[A,a]),i(o,{component:"div",sx:{display:"grid",gridTemplateColumns:`${W}px min-content auto`,gridTemplateRows:"minmax(0, 1fr)",width:"100vw",height:"100vh",backgroundColor:"#ffffff",overflow:"hidden"},onMouseMove:e=>{y&&p(e.clientX)},onMouseUp:()=>{b(!1)},children:[i(o,{component:"div",sx:{display:"grid",gridTemplateColumns:"36px auto",backgroundColor:"#f8f9fa",borderRight:"1px solid #dee2e6",boxShadow:"2px 0 8px rgba(0, 0, 0, 0.06)",overflow:"hidden",height:"100%"},children:[i("div",{style:{backgroundColor:"#f8f9fa",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 0"},children:[e("div",{style:{marginBottom:"8px"},children:e(C,{variant:"icon-only"})}),i("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"2px"},children:[S&&i(t,{children:[e(L,{icon:"SlidersHorizontal",title:"Admin",active:a===EditorPanelView.Admin,onClick:()=>{a===EditorPanelView.Admin?c(null):c(EditorPanelView.Admin)}}),e("div",{style:{borderBottom:"1px solid #dee2e6",margin:"2px 0"}})]}),ef.map(i=>e(L,{icon:i.icon,title:i.title,active:a===i.key,badgeCount:i.key===EditorPanelView.Tunnel?+!!er(M):i.key===EditorPanelView.Diagnostics?j:0,onClick:()=>{a===i.key?c(null):c(i.key)}},i.key))]}),e($,{reload:N}),e("div",{style:{padding:"0 2px",paddingBottom:"4px"},children:e(L,{icon:"CloudArrowUp",title:"WebSocket Status",active:a===EditorPanelView.WebSocketStatus,onClick:()=>{a===EditorPanelView.WebSocketStatus?c(null):c(EditorPanelView.WebSocketStatus)}})}),v&&e("div",{style:{padding:"0 2px",paddingBottom:"8px"},children:e(L,{icon:"SignOut",title:"Exit Editor",variant:"danger",onClick:v})})]}),a&&i(o,{component:"div",sx:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",backgroundColor:"#ffffff"},children:[e(o,{component:"div",sx:{p:1.5,borderBottom:"1px solid #e9ecef",backgroundColor:"#ffffff"},children:i(o,{component:"div",sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i(o,{component:"div",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e(d,{variant:"h6",sx:{fontSize:16,fontWeight:600,color:"#212529"},children:k(a).with("Files",()=>"Files").with("Reflections",()=>"Reflections").with("Domain",()=>"Domain").with("Templates",()=>"Templates").with("Mocks",()=>"Mocks").with("Inspector",()=>"State Inspector").with("Debug",()=>"Debug").with("Profiler",()=>"Profiler").with("GraphQL",()=>"GraphQL").with("VideoStudio",()=>"Video Studio").with("Analytics",()=>"Analytics").with("Diagnostics",()=>"Diagnostics").with("Logs",()=>"Dev Server Logs").with("Tunnel",()=>"Webhook Tunnel").with("WebSocketStatus",()=>"WebSocket Status").with("Admin",()=>"Admin").otherwise(e=>e)}),e(l,{title:k(a).with("Files",()=>"Browse and inspect loaded GLTF files and their contents").with("Reflections",()=>"Inspect internal Phoenix systems state and configuration").with("Domain",()=>"Edit YAML domain specifications and component configurations").with("Templates",()=>"Select different layout templates for the configurator interface").with("Mocks",()=>"Create and manage mock data for testing session and access configurations").with("Inspector",()=>"Walk the entity tree: fields, expressions, and children").with("Debug",()=>"Toggle scene debug visuals like offset anchors, snapping, and collision meshes").with("Profiler",()=>"Make domain expressions show up as named frames in browser CPU profiles").with("GraphQL",()=>"Run GraphQL queries against the schema generated from the assistant manifest").with("VideoStudio",()=>"Create video sequences by capturing keyframes and exporting as video").with("Analytics",()=>"View parse pipeline metrics, domain stats, and diagnostics").with("Diagnostics",()=>"View latest editor warnings and errors").with("Logs",()=>"View dev server logs: spec builds, webhooks, vite, and browser console").with("Tunnel",()=>"View webhook tunnel status and the requests routed through it").with("WebSocketStatus",()=>"View WebSocket connection status and editor mode information").with("Admin",()=>"Manage admin panel, publish data, and configure settings").otherwise(()=>"Panel information"),placement:"left",arrow:!0,children:e(s,{size:"small",sx:{ml:1,color:"#6c757d",fontSize:14,p:.25,"&:hover":{backgroundColor:"#f8f9fa",color:"#495057"}},children:e(x,{name:"Info",style:{fontSize:14}})})})]}),e(o,{component:"div",sx:{display:"flex",alignItems:"center",gap:1},children:"Templates"===a&&e(n,{label:f.charAt(0).toUpperCase()+f.slice(1),variant:"outlined",size:"small",sx:{backgroundColor:"#f8f9fa",borderColor:"#dee2e6",color:"#495057",fontWeight:500,fontSize:"0.75rem"}})})]})}),i(o,{component:"div",sx:{flex:1,backgroundColor:"#ffffff",overflow:"auto"},children:["Files"===a&&e(K,{}),"Reflections"===a&&e(B,{}),"Domain"===a&&e(F,{}),"Templates"===a&&e(ei,{selectedTemplate:f,onTemplateSelect:h}),"Mocks"===a&&e(q,{}),"Inspector"===a&&e(J,{}),"Debug"===a&&e(R,{}),"Profiler"===a&&e(O,{}),"GraphQL"===a&&e(Q,{}),"VideoStudio"===a&&e(ed,{}),"Analytics"===a&&e(T,{}),"Diagnostics"===a&&e(I,{}),"Logs"===a&&e(H,{}),"Tunnel"===a&&e(en,{}),"WebSocketStatus"===a&&e(ec,{}),S&&"Admin"===a&&e(E,{...P})]})]})]}),e("div",{style:{width:"2px",backgroundColor:"#dee2e6",cursor:"ew-resize",boxShadow:"1px 0 3px rgba(0, 0, 0, 0.05)"},onMouseDown:()=>{b(!0)}}),i("div",{style:{position:"relative",overflow:"hidden"},children:[e("div",{style:{position:"absolute",inset:0,zIndex:+("Admin"!==a)},children:e(ee,{selectedTemplate:f,children:e(em,{},G)})}),S&&e("div",{style:{position:"absolute",inset:0,zIndex:+("Admin"===a)},children:e(V,{})})]})]})}),eu=h(()=>e(_,{children:e(em,{})})),eg=h(o=>{let{wsUrl:n="ws://localhost:3020",localMode:r=!1,domainSpec:s,initialRawProjectFiles:a,onExit:l,mockTemplates:d,autoApplyTemplate:c,environmentKey:h,tagName:u,enableAdmin:k=!0}=o,x=m(p().breakpoints.up("md")),[v,V]=y("editor-width",350),[E,D]=y("editor-view",null),[T,C]=y("editor-template","spa"),[L,R]=w(!1);return g(()=>{null===E||Object.values(EditorPanelView).some(e=>e===E)&&(k||E!==EditorPanelView.Admin)||D(null)},[k,E,D]),e(f,{children:e(b,{maxSnack:5,children:e(j,{children:e(P,{tagName:u,children:e(Y,{initialWsUrl:n,localMode:r,children:e(et,{children:e(S,{children:e(A,{children:e(G,{domainSpec:s,initialRawProjectFiles:a,children:i(U,{mockTemplates:d,autoApplyTemplate:c,environmentKey:h,children:[!r&&i(t,{children:[e(X,{}),e(Z,{}),e(W,{}),e(N,{}),e(M,{})]}),e(ea,{children:x?e(eh,{panelView:E,setPanelView:D,width:v,setWidth:V,selectedTemplate:T,setSelectedTemplate:C,isResizing:L,setIsResizing:R,onExit:l,enableAdmin:k}):e(eu,{})})]})})})})})})})})})})});export const Editor=h(t=>{try{if(window.frameElement?.hasAttribute(es))return e("div",{role:"alert","data-testid":"variant-page-unavailable",style:{padding:24,fontFamily:"sans-serif"},children:"This preview page is unavailable. Ask the agent to recreate it or close the comparison."})}catch{}return i(a,{theme:ep,children:[e(r,{}),e(eg,{...t})]})});
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import r from"lodash-es/debounce.js";import t from"promise-queue";import{createContext as o,useCallback as n,useContext as i,useEffect as s,useMemo as a,useRef as c,useState as l}from"react";import{match as m}from"ts-pattern";import{ApplicationRuntime as p,BinaryFile as u,RawProjectFiles as d,RuntimeReferenceStore as f,TextFile as g,buildPhoenixDefinitions as v,isConfiguratorModelSchemaCompatible as S,isTextFile as y,parseApplicationFiles as E}from"#package/application-spec";import{getAllPhxDefinitions as h}from"#package/domain";import{useApplicationRuntime as x,useMountGuard as D}from"#package/react-sdk";import{useEditorConnection as A}from"../services/EditorConnectionContext.js";import{trpc as C}from"../services/trpc.js";import{applyRuntimeReset as w,applySpecUpdate as N,prepareRuntimeRefresh as P,prepareRuntimeReset as R}from"./apply-spec-update.js";import{useDiagnostics as _}from"./use-diagnostics.js";import{useImplementationFiles as L}from"./use-implementation-files.js";import{getWasmSwcParsers as j}from"./wasm-swc-parsers.js";let k=o(null),I={debug:e=>console.debug(e)},b=e=>e instanceof Error?e.message:String(e);export const DomainSpecProvider=o=>{let{children:i,domainSpec:O,initialRawProjectFiles:T}=o,[M,$]=l(a(()=>O?[{fileName:"domain.yaml",content:O}]:T?T.files.filter(y).map(e=>({fileName:e.name,content:e.content})):[],[O,T])),[F,z]=l(null),H=a(()=>new f,[]),q=a(()=>v(h()),[]),U=c(null),G=x(),{getImplementationFiles:Q}=L(),{diagnostics:B,unreadDiagnosticCount:V,setDiagnostics:X,pushDiagnostic:Y,clearDiagnostics:Z,markDiagnosticsRead:J}=_(),K=a(()=>new t(1,1/0),[]),W=c(0),ee=c(null),{mutateAsync:er}=C.requestSpecFiles.useMutation(),{mutateAsync:et}=C.save.useMutation(),eo=D(),{localMode:en,connectionStatus:ei}=A(),{data:es}=C.getEditorConfig.useQuery(void 0,{enabled:!en&&"connected"===ei}),ea=en||es?.specSync===!0,ec=M.length>0?M:void 0,el=a(()=>M.map(e=>e.fileName),[M]),em=a(()=>r(async e=>{if(!en&&"connected"===ei&&0!==e.length)try{await et(e.map(e=>({fileName:e.fileName,content:e.content})))}catch(e){console.error("[DomainSpecContext] Failed to save files to disk:",e)}},1e3),[en,ei,et]);s(()=>()=>{em.cancel()},[em]);let ep=n(()=>{z(null)},[]),eu=n(async(e,r)=>{$(t=>{let o=t.find(r=>r.fileName===e)?t.map(t=>t.fileName===e?{...t,content:r}:t):[...t,{fileName:e,content:r}];return em(o),o})},[em]),ed=n(async(e,r)=>{let t,o,n=()=>eo()&&W.current===r;if(!n())return;let i=d(e.rawProjectFiles.files.map(e=>m(e).with({kind:"text"},e=>g(e.name,e.content)).with({kind:"binary"},e=>u(e.name)).exhaustive()));$(i.files.filter(y).map(e=>({fileName:e.name,content:e.content})));try{t=await j()}catch(e){if(!n())return;X([{code:"MODULE_ANALYZER_UNAVAILABLE",message:`The editor's module analyzer failed to load: ${e instanceof Error?e.message:String(e)}`,severity:"error",source:"spec",path:[]}]);return}if(!n())return;let s=E({rawProjectFiles:i,phxDefinitions:q},{analyzer:t.analyzer,evalExpressionParser:t.evalExpressionParser,referenceStore:H,logger:I});if(console.info(`[DomainSpecContext] Spec parsed: ${s.ok?"ok":"error"}, ${s.diagnostics.length} diagnostics`),!s.ok)return void X([...s.errors,...s.diagnostics].map(e=>({...e,source:"spec"})));Z();let{applicationSpec:a}=s.value,c=await Q({application:s.value,projectRoot:e.projectRoot});if(!n())return;if(c.errors.length>0)return void X(c.errors.map(e=>({code:e.code,message:e.message,severity:"error",source:"reload",path:[]})));let l=p(a,H,c.implementations,c.importedTransformers,c.invariantImplementations,c.adminImplementations);if(!l.ok){let e=`Missing expression implementations: ${l.missingExpressions.map(e=>`${e.entityType}.${e.exprName}`).join(", ")}`;console.error(`[DomainSpecContext] ${e}`),Y({code:"MISSING_EXPRESSION_IMPLEMENTATIONS",message:e,severity:"error",source:"runtime"});return}let{runtime:f}=l,v=null===U.current||S(U.current.configurator,a.configurator),h=G.selectors.environment.getPersistenceConfig();if(!v){let e;if("server"===h.type)return void Y({code:"HOT_RELOAD_MODEL_CHANGE_REQUIRES_RESTART",message:"Domain model changes require an application restart and were not applied.",severity:"error",source:"runtime"});if(!G.selectors.domainContext.configurator.getInitializationState().isCurrent)return void G.selectors.domainServices.getLogger().debug("[DomainSpecContext] Skipping the model reset because no configurator session is initialized; the change applies once a session loads under the new spec.");try{e=R({runtime:f,implementationFiles:c,previousSpec:G.getState().spec})}catch(e){Y({code:"HOT_RELOAD_PREPARE_FAILED",message:b(e),severity:"error",source:"runtime"});return}return G.selectors.domainServices.getLogger().debug("[DomainSpecContext] Reseeding the reset session directly from the spec preset; onPresetLoadedHandler and ProductSelected analytics are intentionally skipped."),w(G,e,G.selectors.domainApplicationContext.configurator.getConfigurationPersistSystem().revisionId$.value),void(U.current=a)}try{o=P({runtime:f,implementationFiles:c,previousSpec:G.getState().spec})}catch(e){Y({code:"HOT_RELOAD_PREPARE_FAILED",message:b(e),severity:"error",source:"runtime"});return}n()&&(N(G,o),U.current=a)},[G,Q,eo,q,Y,H,X,Z]),ef=c(null),eg=n(e=>{let r=W.current+1;W.current=r,ee.current={data:e,generation:r},K.add(async()=>{let e=ee.current;e&&e.data!==ef.current&&(ee.current=null,ef.current=e.data,await ed(e.data,e.generation))})},[ed,K]);C.onSpecChange.useSubscription(void 0,{enabled:!en&&ea,onData:eg}),s(()=>{!en&&ea&&er().catch(()=>{console.warn("[DomainSpecContext] Failed to request spec files")})},[er,en,ea]);let ev=a(()=>({files:ec,fileNames:el,updateFile:eu,parsing:!1,parseError:F,clearParseError:ep,diagnostics:B,clearDiagnostics:Z,unreadDiagnosticCount:V,markDiagnosticsRead:J}),[ec,el,eu,F,ep,B,Z,V,J]);return e(k.Provider,{value:ev,children:i})};export const useDomainSpecContext=()=>{let e=i(k);if(null===e)throw Error("useDomainSpecContext must be used within DomainSpecProvider");return e};
1
+ import{jsx as e}from"react/jsx-runtime";import t from"lodash-es/debounce.js";import r from"promise-queue";import{createContext as o,useCallback as n,useContext as i,useEffect as a,useMemo as s,useRef as c,useState as m}from"react";import{match as l}from"ts-pattern";import{ApplicationRuntime as p,BinaryFile as u,RawProjectFiles as d,RuntimeReferenceStore as g,TextFile as f,buildPhoenixDefinitions as S,isConfiguratorModelSchemaCompatible as v,isTextFile as h,parseApplicationFiles as y}from"#package/application-spec";import{findActionImplementationConflicts as E,getAllPhxDefinitions as x}from"#package/domain";import{useApplicationRuntime as A,useMountGuard as C}from"#package/react-sdk";import{useEditorConnection as D}from"../services/EditorConnectionContext.js";import{trpc as I}from"../services/trpc.js";import{applyRuntimeReset as N,applySpecUpdate as w,prepareRuntimeRefresh as P,prepareRuntimeReset as _}from"./apply-spec-update.js";import{useDiagnostics as R}from"./use-diagnostics.js";import{useImplementationFiles as j}from"./use-implementation-files.js";import{getWasmSwcParsers as L}from"./wasm-swc-parsers.js";let k=o(null),T={debug:e=>console.debug(e)},M=e=>e instanceof Error?e.message:String(e);export const DomainSpecProvider=o=>{let{children:i,domainSpec:O,initialRawProjectFiles:b}=o,[$,F]=m(s(()=>O?[{fileName:"domain.yaml",content:O}]:b?b.files.filter(h).map(e=>({fileName:e.name,content:e.content})):[],[O,b])),[z,H]=m(null),q=s(()=>new g,[]),G=s(()=>S(x()),[]),U=c(null),Q=A(),{getImplementationFiles:B}=j(),{diagnostics:V,unreadDiagnosticCount:X,setDiagnostics:Y,pushDiagnostic:Z,clearDiagnostics:J,markDiagnosticsRead:K}=R(),W=s(()=>new r(1,1/0),[]),ee=c(0),et=c(null),{mutateAsync:er}=I.requestSpecFiles.useMutation(),{mutateAsync:eo}=I.save.useMutation(),en=C(),{localMode:ei,connectionStatus:ea}=D(),{data:es}=I.getEditorConfig.useQuery(void 0,{enabled:!ei&&"connected"===ea}),ec=ei||es?.specSync===!0,em=$.length>0?$:void 0,el=s(()=>$.map(e=>e.fileName),[$]),ep=s(()=>t(async e=>{if(!ei&&"connected"===ea&&0!==e.length)try{await eo(e.map(e=>({fileName:e.fileName,content:e.content})))}catch(e){console.error("[DomainSpecContext] Failed to save files to disk:",e)}},1e3),[ei,ea,eo]);a(()=>()=>{ep.cancel()},[ep]);let eu=n(()=>{H(null)},[]),ed=n(async(e,t)=>{F(r=>{let o=r.find(t=>t.fileName===e)?r.map(r=>r.fileName===e?{...r,content:t}:r):[...r,{fileName:e,content:t}];return ep(o),o})},[ep]),eg=n(async(e,t)=>{let r,o,n=()=>en()&&ee.current===t;if(!n())return;let i=d(e.rawProjectFiles.files.map(e=>l(e).with({kind:"text"},e=>f(e.name,e.content)).with({kind:"binary"},e=>u(e.name)).exhaustive()));F(i.files.filter(h).map(e=>({fileName:e.name,content:e.content})));try{r=await L()}catch(e){if(!n())return;Y([{code:"MODULE_ANALYZER_UNAVAILABLE",message:`The editor's module analyzer failed to load: ${e instanceof Error?e.message:String(e)}`,severity:"error",source:"spec",path:[]}]);return}if(!n())return;let a=y({rawProjectFiles:i,phxDefinitions:G},{analyzer:r.analyzer,evalExpressionParser:r.evalExpressionParser,referenceStore:q,logger:T});if(console.info(`[DomainSpecContext] Spec parsed: ${a.ok?"ok":"error"}, ${a.diagnostics.length} diagnostics`),!a.ok)return void Y([...a.errors,...a.diagnostics].map(e=>({...e,source:"spec"})));J();let{applicationSpec:s}=a.value,c=await B({application:a.value,projectRoot:e.projectRoot});if(!n())return;if(c.errors.length>0)return void Y(c.errors.map(e=>({code:e.code,message:e.message,severity:"error",source:"reload",path:[]})));let m=E([...s.configurator.actions.values()].map(e=>String(e.name)),c.actionImplementations??Q.getState().spec.configurator.actionImplementations);if(m.extra.length>0&&console.error(`[DomainSpecContext] Action implementations without a declaration: ${m.extra.join(", ")}`),m.missing.length>0){let e=`Missing action implementations: ${m.missing.join(", ")}. Add each to a default export of phx.domain.implementActions({ ... }) in src/actions/.`;console.error(`[DomainSpecContext] ${e}`),Z({code:"MISSING_ACTION_IMPLEMENTATIONS",message:e,severity:"error",source:"runtime"});return}let g=p(s,q,c.implementations,c.importedTransformers,c.invariantImplementations,c.adminImplementations);if(!g.ok){let e=`Missing expression implementations: ${g.missingExpressions.map(e=>`${e.entityType}.${e.exprName}`).join(", ")}`;console.error(`[DomainSpecContext] ${e}`),Z({code:"MISSING_EXPRESSION_IMPLEMENTATIONS",message:e,severity:"error",source:"runtime"});return}let{runtime:S}=g,x=null===U.current||v(U.current.configurator,s.configurator),A=Q.selectors.environment.getPersistenceConfig();if(!x){let e;if("server"===A.type)return void Z({code:"HOT_RELOAD_MODEL_CHANGE_REQUIRES_RESTART",message:"Domain model changes require an application restart and were not applied.",severity:"error",source:"runtime"});if(!Q.selectors.domainContext.configurator.getInitializationState().isCurrent)return void Q.selectors.domainServices.getLogger().debug("[DomainSpecContext] Skipping the model reset because no configurator session is initialized; the change applies once a session loads under the new spec.");try{e=_({runtime:S,implementationFiles:c,previousSpec:Q.getState().spec})}catch(e){Z({code:"HOT_RELOAD_PREPARE_FAILED",message:M(e),severity:"error",source:"runtime"});return}return Q.selectors.domainServices.getLogger().debug("[DomainSpecContext] Reseeding the reset session directly from the spec preset; onPresetLoadedHandler and ProductSelected analytics are intentionally skipped."),N(Q,e,Q.selectors.domainApplicationContext.configurator.getConfigurationPersistSystem().revisionId$.value),void(U.current=s)}try{o=P({runtime:S,implementationFiles:c,previousSpec:Q.getState().spec})}catch(e){Z({code:"HOT_RELOAD_PREPARE_FAILED",message:M(e),severity:"error",source:"runtime"});return}n()&&(w(Q,o),U.current=s)},[Q,B,en,G,Z,q,Y,J]),ef=c(null),eS=n(e=>{let t=ee.current+1;ee.current=t,et.current={data:e,generation:t},W.add(async()=>{let e=et.current;e&&e.data!==ef.current&&(et.current=null,ef.current=e.data,await eg(e.data,e.generation))})},[eg,W]);I.onSpecChange.useSubscription(void 0,{enabled:!ei&&ec,onData:eS}),a(()=>{!ei&&ec&&er().catch(()=>{console.warn("[DomainSpecContext] Failed to request spec files")})},[er,ei,ec]);let ev=s(()=>({files:em,fileNames:el,updateFile:ed,parsing:!1,parseError:z,clearParseError:eu,diagnostics:V,clearDiagnostics:J,unreadDiagnosticCount:X,markDiagnosticsRead:K}),[em,el,ed,z,eu,V,J,X,K]);return e(k.Provider,{value:ev,children:i})};export const useDomainSpecContext=()=>{let e=i(k);if(null===e)throw Error("useDomainSpecContext must be used within DomainSpecProvider");return e};
@@ -1 +1 @@
1
- import{resolveImportedTransformers as e}from"#package/domain";import{getPhoenixThemes as t}from"#package/ui-sdk";import{getCustomComponentOptics as n}from"./use-implementation-files.js";let s=s=>{var o;let a,i,{runtime:r,implementationFiles:m,previousSpec:p}=s,c=r.configurator,l=p.configurator,u=m.handlers?.handlers??l.handlers,d=m.handlers?((e,t,n)=>{let s={};for(let o of e)s[o.name]=t?.[o.name]??n?.[o.name]??o.name;return s})(u,m.handlers.nameHashes,l.handlerHashes):l.handlerHashes,f=m.elements?.elements??l.elements,h=m.elements?((e,t,n)=>{let s={},o=0;for(let a of e)if("entity"===a.type||"layout"===a.type)s[a.name]=t?.[a.name]??n?.[a.name]??a.name;else{let e=`icon:${o}`;s[e]=t?.[e]??n?.[e]??`${e}:${a.elements.length}`,o+=1}return s})(f,m.elements.nameHashes,l.elementHashes):l.elementHashes,g=null!==m.customComponentOptics,R=c.componentOptics.changed||g?[...c.componentOptics.optics.map(e=>e.optic),...m.customComponentOptics??n(l.componentOptics)]:l.componentOptics,x=c.transformersRuntime.changed?t=>e(c.transformersRuntime.importedTransformers,c.transformersRuntime.specTransformers,t):l.createTransformers;return{presets:c.presetRuntime.changed?c.presetRuntime.presets:l.presets,theme:c.themeRuntime.changed?(o=c.themeRuntime,a=t(),i=Object.entries(a).find(([e])=>e===o.preset)?.[1]??{},Object.keys(o.options).length>0?{...i,...o.options}:i):l.theme,assistant:c.assistantRuntime.changed?c.assistantRuntime.assistant:l.assistant,navigationStates:c.statesRuntime.changed?c.statesRuntime.navigationStates:l.navigationStates,viewStates:c.statesRuntime.changed?c.statesRuntime.viewStates:l.viewStates,toolStates:c.statesRuntime.changed?c.statesRuntime.toolStates:l.toolStates,exportStates:c.statesRuntime.changed?c.statesRuntime.exportStates:l.exportStates,componentOptics:R,createTransformers:x,handlers:u,handlerHashes:d,elements:f,elementHashes:h}};export const prepareRuntimeRefresh=e=>{let{runtime:t,previousSpec:n}=e,o=n.configurator,a=s(e),i=t.configurator.expressionRuntime.changed?t.configurator.expressionRuntime.merged:o.expressions;return{nextSpec:{...n,configurator:{...o,...a,expressions:i}}}};export const prepareRuntimeReset=e=>{let{runtime:t,previousSpec:n}=e,o=n.configurator,a=s(e),i=t.configurator.expressionRuntime.merged,r=t.configurator.modelRuntime.domainBuilder.withExpressions(i).build(),m=a.presets[0];if(void 0===m)throw Error("Cannot reset the configurator after a model change because the application spec has no presets.");return{firstPreset:m,nextSpec:{...n,configurator:{...o,...a,modelVersion:r.context.modelVersion,factory:r,aliasMap:r.context.aliasMap,entityReflections:r.context.entityReflections,$entityReflections:r.context.$entityReflections,expressions:i,allowedRootEntityTypes:r.context.allowedRootEntityTypes,migrate:r.context.migrate}}}};let o=(e,t)=>{e.actions.spec.updateSpec(t)};export const applyRuntimeRefresh=(e,t)=>o(e,t.nextSpec);export const applyRuntimeReset=(e,t,n)=>{o(e,t.nextSpec),e.actions.loadedData.completeConfiguratorLoad({initialRevisionId:n,initialEntities:t.firstPreset.initialDomainEntities,modelVersion:t.nextSpec.configurator.modelVersion,rootEntityType:t.firstPreset.rootEntityType,schemaIdentity:t.nextSpec.configurator.factory})};export const applySpecUpdate=(e,t)=>o(e,t.nextSpec);
1
+ import{resolveImportedTransformers as e}from"#package/domain";import{getPhoenixThemes as t}from"#package/ui-sdk";import{getCustomComponentOptics as n}from"./use-implementation-files.js";let s=s=>{var o;let i,a,{runtime:r,implementationFiles:m,previousSpec:c}=s,p=r.configurator,l=c.configurator,u=m.handlers?.handlers??l.handlers,f=m.handlers?((e,t,n)=>{let s={};for(let o of e)s[o.name]=t?.[o.name]??n?.[o.name]??o.name;return s})(u,m.handlers.nameHashes,l.handlerHashes):l.handlerHashes,d=m.elements?.elements??l.elements,h=m.elements?((e,t,n)=>{let s={},o=0;for(let i of e)if("entity"===i.type||"layout"===i.type)s[i.name]=t?.[i.name]??n?.[i.name]??i.name;else{let e=`icon:${o}`;s[e]=t?.[e]??n?.[e]??`${e}:${i.elements.length}`,o+=1}return s})(d,m.elements.nameHashes,l.elementHashes):l.elementHashes,g=null!==m.customComponentOptics,R=p.componentOptics.changed||g?[...p.componentOptics.optics.map(e=>e.optic),...m.customComponentOptics??n(l.componentOptics)]:l.componentOptics,x=p.transformersRuntime.changed?t=>e(p.transformersRuntime.importedTransformers,p.transformersRuntime.specTransformers,t):l.createTransformers;return{presets:p.presetRuntime.changed?p.presetRuntime.presets:l.presets,theme:p.themeRuntime.changed?(o=p.themeRuntime,i=t(),a=Object.entries(i).find(([e])=>e===o.preset)?.[1]??{},Object.keys(o.options).length>0?{...a,...o.options}:a):l.theme,assistant:p.assistantRuntime.changed?p.assistantRuntime.assistant:l.assistant,navigationStates:p.statesRuntime.changed?p.statesRuntime.navigationStates:l.navigationStates,viewStates:p.statesRuntime.changed?p.statesRuntime.viewStates:l.viewStates,toolStates:p.statesRuntime.changed?p.statesRuntime.toolStates:l.toolStates,exportStates:p.statesRuntime.changed?p.statesRuntime.exportStates:l.exportStates,componentOptics:R,createTransformers:x,handlers:u,handlerHashes:f,elements:d,elementHashes:h}};export const prepareRuntimeRefresh=e=>{let{runtime:t,previousSpec:n}=e,o=n.configurator,i=s(e),a=t.configurator.expressionRuntime.changed?t.configurator.expressionRuntime.merged:o.expressions,r=t.configurator.actionsRuntime.changed?t.configurator.actionsRuntime.definitions:o.actions,m=e.implementationFiles.actionImplementations??o.actionImplementations;return{nextSpec:{...n,configurator:{...o,...i,expressions:a,actions:r,actionImplementations:m}}}};export const prepareRuntimeReset=e=>{let{runtime:t,previousSpec:n}=e,o=n.configurator,i=s(e),a=t.configurator.expressionRuntime.merged,r=t.configurator.actionsRuntime.definitions,m=e.implementationFiles.actionImplementations??o.actionImplementations,c=t.configurator.modelRuntime.domainBuilder.withExpressions(a).withActions(Object.values(r)).withActionImplementations(m).build(),p=i.presets[0];if(void 0===p)throw Error("Cannot reset the configurator after a model change because the application spec has no presets.");return{firstPreset:p,nextSpec:{...n,configurator:{...o,...i,modelVersion:c.context.modelVersion,factory:c,aliasMap:c.context.aliasMap,entityReflections:c.context.entityReflections,$entityReflections:c.context.$entityReflections,expressions:a,actions:r,actionImplementations:m,allowedRootEntityTypes:c.context.allowedRootEntityTypes,migrate:c.context.migrate}}}};let o=(e,t)=>{e.actions.spec.updateSpec(t)};export const applyRuntimeRefresh=(e,t)=>o(e,t.nextSpec);export const applyRuntimeReset=(e,t,n)=>{o(e,t.nextSpec),e.actions.loadedData.completeConfiguratorLoad({initialRevisionId:n,initialEntities:t.firstPreset.initialDomainEntities,modelVersion:t.nextSpec.configurator.modelVersion,rootEntityType:t.firstPreset.rootEntityType,schemaIdentity:t.nextSpec.configurator.factory})};export const applySpecUpdate=(e,t)=>o(e,t.nextSpec);
@@ -1,5 +1,5 @@
1
1
  import type { Application, ExpressionImplementations, InvariantImplementations } from '#package/application-spec';
2
- import { type DomainComponentOptic, type DomainEntity, type ElementRegistration, type HandlerRegistration, type ImportedTransformer, type SystemComponentTypeConstraint } from '#package/domain';
2
+ import { type AnyActionImplementations, type DomainComponentOptic, type DomainEntity, type ElementRegistration, type HandlerRegistration, type ImportedTransformer, type ProjectModule, type SystemComponentTypeConstraint } from '#package/domain';
3
3
  type AnyImportedTransformer = ImportedTransformer<any, any, any, any, any, any, any>;
4
4
  type RuntimeData = Record<string, unknown>;
5
5
  type RuntimeEntity = DomainEntity<string>;
@@ -23,11 +23,13 @@ export interface ReloadError {
23
23
  * The freshly reloaded (or cached) implementation files needed to build an `ApplicationRuntime`.
24
24
  *
25
25
  * `implementations`, `adminImplementations`, `invariantImplementations`, `importedTransformers` and `customComponentOptics` always contain the latest
26
- * successfully loaded values.
26
+ * successfully loaded values. So does `actionImplementations`, which is `null` only until the first successful load: a round
27
+ * that loaded them may be dropped before it is applied, and the next round must still carry them.
27
28
  * `handlers`/`elements` are `null` when their category did not change this round.
28
29
  */
29
30
  export interface ImplementationFiles {
30
31
  readonly implementations: ExpressionImplementations;
32
+ readonly actionImplementations: AnyActionImplementations | null;
31
33
  readonly adminImplementations?: ExpressionImplementations;
32
34
  readonly invariantImplementations: InvariantImplementations;
33
35
  readonly importedTransformers: readonly AnyImportedTransformer[];
@@ -40,17 +42,20 @@ export interface GetImplementationFilesProps {
40
42
  readonly application: Application;
41
43
  readonly projectRoot: string;
42
44
  }
43
- type ExpressionModules = ReadonlyArray<Record<string, Record<string, unknown>>>;
44
45
  type ResolvedExpressions = ExpressionImplementations;
45
- export declare const resolveExpressionModules: (modules: ExpressionModules, aliasMap: Record<string, readonly string[]>) => ResolvedExpressions;
46
- export declare const resolveComponentModules: <ComponentOptic>(modules: ReadonlyArray<ComponentOptic | readonly ComponentOptic[]>) => readonly ComponentOptic[];
46
+ /**
47
+ * Validates the expression modules through the resolver the domain builder uses, then expands their
48
+ * aliases. The expansion stays here because the editor rebuilds expressions against the alias map of
49
+ * the spec being edited, where the built app's domain builder holds its own.
50
+ */
51
+ export declare const mergeExpressionModules: (modules: readonly ProjectModule[], aliasMap: Record<string, readonly string[]>) => ResolvedExpressions;
47
52
  export declare const mergeComponentOptics: <ComponentOptic>(generatedComponentOptics: readonly ComponentOptic[], customComponentOptics: readonly ComponentOptic[]) => readonly ComponentOptic[];
48
53
  export declare const getCustomComponentOptics: <ComponentOptic extends {
49
54
  readonly generated?: boolean;
50
55
  }>(componentOptics: readonly ComponentOptic[]) => readonly ComponentOptic[];
51
56
  /**
52
57
  * Owns the should-reload gating and cross-update caching for project implementation files
53
- * (expressions, invariants, components, transformers, handlers, elements). Returns `getImplementationFiles`,
58
+ * (expressions, actions, invariants, components, transformers, handlers, elements). Returns `getImplementationFiles`,
54
59
  * which reloads changed categories and returns the merged set with per-category reload errors.
55
60
  * Invariants also retry failed imports and refresh when their generated declarations change.
56
61
  */
@@ -1 +1 @@
1
- import{useCallback as e,useRef as n}from"react";import{expandAlias as t}from"#package/domain";import{importImplementationFile as r}from"./import-implementation-file.js";let a=e=>e instanceof Error?e.message:String(e),o=async(e,n)=>{let t=Date.now();return Promise.all(e.map(async e=>{let a=await r(`/@fs/${n}/${e}?t=${t}`);return{filePath:e,module:a}}))};export const resolveExpressionModules=(e,n)=>{let r={};for(let n of e)for(let[e,t]of Object.entries(n))r[e]={...r[e],...t};let a={};for(let[e,o]of Object.entries(r))for(let r of t(n,e)){let n=a[r]??{};for(let[t,r]of Object.entries(o))n[t]={...r,origin:{name:t,typeOrAlias:e}};a[r]=n}return a};export const resolveComponentModules=e=>e.flatMap(e=>Array.isArray(e)?e:[e]);export const mergeComponentOptics=(e,n)=>e.concat(n);export const getCustomComponentOptics=e=>e.filter(e=>!0!==e.generated);let s=async(e,n,t)=>{let r=await o(e,t);return resolveExpressionModules(r.map(e=>e.module),n)},i=async(e,n)=>{let t=await o(e,n);return resolveComponentModules(t.map(e=>e.module))},l=async(e,n)=>{let t=await o(e,n),r={};for(let{module:e}of t)for(let[n,t]of Object.entries(e))r[n]=[...r[n]??[],...t];return r},m=async(e,n)=>(await o(e,n)).map(({filePath:e,module:n})=>({name:e.replace(/^.*\//,"").replace(/\.tsx?$/,""),transformer:n})),p=async(e,n)=>(await o(e,n)).map(({filePath:e,module:n})=>({filePath:e,registrations:Array.isArray(n)?n:[n]})),c=async(e,n)=>(await o(e,n)).map(({filePath:e,module:n})=>({filePath:e,registrations:Array.isArray(n)?n:[n]}));export const useImplementationFiles=()=>{let t=n({}),r=n({}),o=n(0),f=n(null),u=n({}),d=n(null),h=n(null),g=n(null),E=n([]),w=n(null),y=n(null),F=n(new Map),I=n(new Map);return{getImplementationFiles:e(async e=>{let{application:n,projectRoot:O}=e,A=++o.current,{applicationSpec:M,categorizedFiles:R}=n,x=[],C=t.current,v=r.current,D=u.current,S=g.current,L=E.current,$=R.expressionsChanged,_=R.componentsChanged,b=R.transformersChanged,N=R.handlersChanged,j=R.elementsChanged,P=Object.fromEntries(R.invariants.map(e=>[e.file.name,e.depHash])),H=d.current,k=JSON.stringify(M.configurator.invariants.entries),T=null===H||h.current!==k||Object.keys(H).length!==R.invariants.length||R.invariants.some(e=>H[e.file.name]!==e.depHash);if(console.info(`[useImplementationFiles] Changed: spec=${R.specChanged}, expressions=${R.expressionsChanged}, adminExpressions=${R.adminExpressionsChanged}, transformers=${R.transformersChanged}, handlers=${R.handlersChanged}, elements=${R.elementsChanged}`),$){console.info("[useImplementationFiles] Reloading expression implementations");try{let e=Object.fromEntries(M.configurator.latestModel.aliases);t.current=C=await s(R.expressions.map(e=>e.file.name),e,O)}catch(e){console.warn("[useImplementationFiles] Failed to reload expressions:",e),x.push({code:"RELOAD_EXPRESSIONS_FAILED",message:a(e)})}}let J=JSON.stringify({projectRoot:O,files:R.adminExpressions.map(e=>[e.file.name,e.depHash]),aliases:[...M.admin.latestModel.aliases]});if(A===o.current&&f.current!==J)try{v=await s(R.adminExpressions.map(e=>e.file.name),Object.fromEntries(M.admin.latestModel.aliases),O),A===o.current&&(r.current=v,f.current=J)}catch(e){x.push({code:"RELOAD_ADMIN_EXPRESSIONS_FAILED",message:a(e)})}if(_){console.info("[useImplementationFiles] Reloading component optics");try{g.current=S=await i(R.components.map(e=>e.file.name),O)}catch(e){console.warn("[useImplementationFiles] Failed to reload components:",e),x.push({code:"RELOAD_COMPONENTS_FAILED",message:a(e)})}}if(T){console.info("[useImplementationFiles] Reloading invariant implementations");try{u.current=D=await l(R.invariants.map(e=>e.file.name),O),d.current=P,h.current=k}catch(e){console.warn("[useImplementationFiles] Failed to reload invariants:",e),x.push({code:"RELOAD_INVARIANTS_FAILED",message:a(e)})}}if(b){console.info("[useImplementationFiles] Reloading transformer implementations");try{E.current=L=await m(R.transformers.map(e=>e.file.name),O)}catch(e){console.warn("[useImplementationFiles] Failed to reload transformers:",e),x.push({code:"RELOAD_TRANSFORMERS_FAILED",message:a(e)})}}let X=null;if(N){console.info("[useImplementationFiles] Reloading handler implementations");try{let e=Object.fromEntries(R.handlers.map(e=>[e.file.name,e.depHash])),n=w.current,t=t=>null===n||n[t]!==e[t],r=I.current,a=R.handlers.map(e=>e.file.name),o=a.filter(e=>t(e)||!r.has(e)),s=await p(o,O),i=new Map(s.map(e=>[e.filePath,e])),l=a.map(e=>{let n=i.get(e)??r.get(e);if(!n)throw Error(`Handler file "${e}" was neither re-imported nor cached from a previous round. This is a hot-reload bookkeeping bug — reload the editor page to recover.`);return n}),m=l.flatMap(e=>e.registrations),c={};for(let{filePath:n,registrations:r}of l){let a=t(n)?e[n]:void 0;if(a)for(let e of r)c[e.name]=a}console.info(`[useImplementationFiles] Staged handlers for registry (${m.length} total)`),X={handlers:m,nameHashes:c},I.current=new Map(l.map(e=>[e.filePath,e])),w.current=e}catch(e){console.warn("[useImplementationFiles] Failed to reload handlers:",e),x.push({code:"RELOAD_HANDLERS_FAILED",message:a(e)})}}let V=null;if(j){console.info("[useImplementationFiles] Reloading element implementations");try{let e=Object.fromEntries(R.elements.map(e=>[e.file.name,e.depHash])),n=y.current,t=t=>null===n||n[t]!==e[t],r=F.current,a=R.elements.map(e=>e.file.name),o=a.filter(e=>t(e)||!r.has(e)),s=await c(o,O),i=new Map(s.map(e=>[e.filePath,e])),l=a.map(e=>{let n=i.get(e)??r.get(e);if(!n)throw Error(`Element file "${e}" was neither re-imported nor cached from a previous round. This is a hot-reload bookkeeping bug — reload the editor page to recover.`);return n}),m=l.flatMap(e=>e.registrations),p={},f=0;for(let{filePath:n,registrations:r}of l){let a=t(n)?e[n]:void 0;for(let e of r){if("entity"===e.type||"layout"===e.type){a&&(p[e.name]=a);continue}a&&(p[`icon:${f}`]=a),f+=1}}console.info(`[useImplementationFiles] Staged elements for registry (${m.length} total)`),V={elements:m,nameHashes:p},F.current=new Map(l.map(e=>[e.filePath,e])),y.current=e}catch(e){console.warn("[useImplementationFiles] Failed to reload elements:",e),x.push({code:"RELOAD_ELEMENTS_FAILED",message:a(e)})}}return{implementations:C,adminImplementations:v,invariantImplementations:D,importedTransformers:L,customComponentOptics:S,handlers:X,elements:V,errors:x}},[])}};
1
+ import{useCallback as e,useRef as n}from"react";import{expandAlias as t,resolveActionModules as a,resolveComponentOpticModules as r,resolveElementModule as o,resolveExpressionModules as s,resolveHandlerModule as i,resolveInvariantModules as l,resolveTransformerModule as m}from"#package/domain";import{importImplementationFile as c}from"./import-implementation-file.js";let p=e=>e instanceof Error?e.message:String(e),f=async(e,n)=>{let t=Date.now();return Promise.all(e.map(async e=>({origin:e,exports:await c(`/@fs/${n}/${e}?t=${t}`)})))},d=async(e,n)=>a(await f(e,n));export const mergeExpressionModules=(e,n)=>{let a={};for(let{expressions:t}of s(e,n))for(let[e,n]of Object.entries(t))a[e]={...a[e],...n};let r={};for(let[e,o]of Object.entries(a))for(let a of t(n,e)){let n=r[a]??{};for(let[t,a]of Object.entries(o))n[t]={...a,origin:{name:t,typeOrAlias:e}};r[a]=n}return r};export const mergeComponentOptics=(e,n)=>e.concat(n);export const getCustomComponentOptics=e=>e.filter(e=>!0!==e.generated);let u=async(e,n,t)=>mergeExpressionModules(await f(e,t),n),g=async(e,n)=>r(await f(e,n)),h=async(e,n)=>l(await f(e,n)),E=async(e,n)=>(await f(e,n)).map(m),F=async(e,n)=>(await f(e,n)).map(e=>({filePath:e.origin,registrations:i(e)})),w=async(e,n)=>(await f(e,n)).map(e=>({filePath:e.origin,registrations:o(e)}));export const useImplementationFiles=()=>{let t=n({}),a=n(null),r=n({}),o=n(0),s=n(null),i=n({}),l=n(null),m=n(null),c=n(null),f=n([]),I=n(null),y=n(null),O=n(new Map),A=n(new Map);return{getImplementationFiles:e(async e=>{let{application:n,projectRoot:R}=e,C=++o.current,{applicationSpec:D,categorizedFiles:L}=n,S=[],x=t.current,M=r.current,_=i.current,$=c.current,b=f.current,v=L.expressionsChanged,N=L.actionsChanged,j=L.componentsChanged,P=L.transformersChanged,H=L.handlersChanged,T=L.elementsChanged,k=Object.fromEntries(L.invariants.map(e=>[e.file.name,e.depHash])),J=l.current,X=JSON.stringify(D.configurator.invariants.entries),V=null===J||m.current!==X||Object.keys(J).length!==L.invariants.length||L.invariants.some(e=>J[e.file.name]!==e.depHash);if(console.info(`[useImplementationFiles] Changed: spec=${L.specChanged}, expressions=${L.expressionsChanged}, actions=${L.actionsChanged}, adminExpressions=${L.adminExpressionsChanged}, transformers=${L.transformersChanged}, handlers=${L.handlersChanged}, elements=${L.elementsChanged}`),v){console.info("[useImplementationFiles] Reloading expression implementations");try{let e=Object.fromEntries(D.configurator.latestModel.aliases);t.current=x=await u(L.expressions.map(e=>e.file.name),e,R)}catch(e){console.warn("[useImplementationFiles] Failed to reload expressions:",e),S.push({code:"RELOAD_EXPRESSIONS_FAILED",message:p(e)})}}let q=a.current;if(N){console.info("[useImplementationFiles] Reloading action implementations");try{a.current=q=await d(L.actions.map(e=>e.file.name),R)}catch(e){console.warn("[useImplementationFiles] Failed to reload actions:",e),S.push({code:"RELOAD_ACTIONS_FAILED",message:p(e)})}}let z=JSON.stringify({projectRoot:R,files:L.adminExpressions.map(e=>[e.file.name,e.depHash]),aliases:[...D.admin.latestModel.aliases]});if(C===o.current&&s.current!==z)try{M=await u(L.adminExpressions.map(e=>e.file.name),Object.fromEntries(D.admin.latestModel.aliases),R),C===o.current&&(r.current=M,s.current=z)}catch(e){S.push({code:"RELOAD_ADMIN_EXPRESSIONS_FAILED",message:p(e)})}if(j){console.info("[useImplementationFiles] Reloading component optics");try{c.current=$=await g(L.components.map(e=>e.file.name),R)}catch(e){console.warn("[useImplementationFiles] Failed to reload components:",e),S.push({code:"RELOAD_COMPONENTS_FAILED",message:p(e)})}}if(V){console.info("[useImplementationFiles] Reloading invariant implementations");try{i.current=_=await h(L.invariants.map(e=>e.file.name),R),l.current=k,m.current=X}catch(e){console.warn("[useImplementationFiles] Failed to reload invariants:",e),S.push({code:"RELOAD_INVARIANTS_FAILED",message:p(e)})}}if(P){console.info("[useImplementationFiles] Reloading transformer implementations");try{f.current=b=await E(L.transformers.map(e=>e.file.name),R)}catch(e){console.warn("[useImplementationFiles] Failed to reload transformers:",e),S.push({code:"RELOAD_TRANSFORMERS_FAILED",message:p(e)})}}let B=null;if(H){console.info("[useImplementationFiles] Reloading handler implementations");try{let e=Object.fromEntries(L.handlers.map(e=>[e.file.name,e.depHash])),n=I.current,t=t=>null===n||n[t]!==e[t],a=A.current,r=L.handlers.map(e=>e.file.name),o=r.filter(e=>t(e)||!a.has(e)),s=await F(o,R),i=new Map(s.map(e=>[e.filePath,e])),l=r.map(e=>{let n=i.get(e)??a.get(e);if(!n)throw Error(`Handler file "${e}" was neither re-imported nor cached from a previous round. This is a hot-reload bookkeeping bug — reload the editor page to recover.`);return n}),m=l.flatMap(e=>e.registrations),c={};for(let{filePath:n,registrations:a}of l){let r=t(n)?e[n]:void 0;if(r)for(let e of a)c[e.name]=r}console.info(`[useImplementationFiles] Staged handlers for registry (${m.length} total)`),B={handlers:m,nameHashes:c},A.current=new Map(l.map(e=>[e.filePath,e])),I.current=e}catch(e){console.warn("[useImplementationFiles] Failed to reload handlers:",e),S.push({code:"RELOAD_HANDLERS_FAILED",message:p(e)})}}let G=null;if(T){console.info("[useImplementationFiles] Reloading element implementations");try{let e=Object.fromEntries(L.elements.map(e=>[e.file.name,e.depHash])),n=y.current,t=t=>null===n||n[t]!==e[t],a=O.current,r=L.elements.map(e=>e.file.name),o=r.filter(e=>t(e)||!a.has(e)),s=await w(o,R),i=new Map(s.map(e=>[e.filePath,e])),l=r.map(e=>{let n=i.get(e)??a.get(e);if(!n)throw Error(`Element file "${e}" was neither re-imported nor cached from a previous round. This is a hot-reload bookkeeping bug — reload the editor page to recover.`);return n}),m=l.flatMap(e=>e.registrations),c={},p=0;for(let{filePath:n,registrations:a}of l){let r=t(n)?e[n]:void 0;for(let e of a){if("entity"===e.type||"layout"===e.type){r&&(c[e.name]=r);continue}r&&(c[`icon:${p}`]=r),p+=1}}console.info(`[useImplementationFiles] Staged elements for registry (${m.length} total)`),G={elements:m,nameHashes:c},O.current=new Map(l.map(e=>[e.filePath,e])),y.current=e}catch(e){console.warn("[useImplementationFiles] Failed to reload elements:",e),S.push({code:"RELOAD_ELEMENTS_FAILED",message:p(e)})}}return{implementations:x,actionImplementations:q,adminImplementations:M,invariantImplementations:_,importedTransformers:b,customComponentOptics:$,handlers:B,elements:G,errors:S}},[])}};