@salsita-ai/sdk 0.50.0-develop.1cc8da993f → 0.50.0-develop.231285e85a

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 (508) hide show
  1. package/README.md +5 -1
  2. package/dist/application-spec/core/enhanced-json-value.d.ts +2 -31
  3. package/dist/application-spec/core/enhanced-json-value.js +1 -1
  4. package/dist/application-spec/core/index.d.ts +1 -3
  5. package/dist/application-spec/core/index.js +1 -1
  6. package/dist/application-spec/core/json-schema.d.ts +2 -52
  7. package/dist/application-spec/core/markers/index.d.ts +1 -1
  8. package/dist/application-spec/core/markers/index.js +1 -1
  9. package/dist/application-spec/core/markers/msg-marker.d.ts +2 -28
  10. package/dist/application-spec/core/markers/msg-marker.js +1 -1
  11. package/dist/application-spec/core/markers/raw-eval-write-marker.d.ts +1 -1
  12. package/dist/application-spec/core/markers/raw-eval-write-marker.js +1 -1
  13. package/dist/application-spec/core/markers/raw-read-write-marker.js +1 -1
  14. package/dist/application-spec/errors/diagnostic-codes.d.ts +8 -1
  15. package/dist/application-spec/errors/diagnostic-codes.js +1 -1
  16. package/dist/application-spec/errors/diagnostic-messages.d.ts +15 -1
  17. package/dist/application-spec/errors/diagnostic-messages.js +1 -1
  18. package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
  19. package/dist/application-spec/generate-application/code/templates/index.d.ts +2 -6
  20. package/dist/application-spec/generate-application/code/templates/index.js +1 -1
  21. package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.d.ts +10 -0
  22. package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.js +7 -0
  23. package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
  24. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +1 -1
  25. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +1 -1
  26. package/dist/application-spec/generate-application/implementations/phx-model.d.ts +1 -1
  27. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +1 -2
  28. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +1 -2
  29. package/dist/application-spec/generate-application/runtime/factory-data/factory-data-runtime.d.ts +1 -2
  30. package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.d.ts +1 -1
  31. package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.js +1 -1
  32. package/dist/application-spec/generate-application/runtime/factory-data/static-violations.d.ts +1 -2
  33. package/dist/application-spec/generate-application/runtime/factory-data/static-violations.js +1 -1
  34. package/dist/application-spec/generate-application/runtime/generate-runtime-instance.d.ts +1 -1
  35. package/dist/application-spec/generate-application/runtime/generate-runtime-instance.js +1 -1
  36. package/dist/application-spec/generate-application/runtime/sections/actions-runtime.d.ts +1 -2
  37. package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.d.ts +1 -1
  38. package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.js +1 -1
  39. package/dist/application-spec/generate-application/runtime/sections/build-user-bound-optic.d.ts +1 -1
  40. package/dist/application-spec/generate-application/runtime/sections/component-optic.d.ts +1 -2
  41. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +1 -2
  42. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
  43. package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.d.ts +1 -2
  44. package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.js +1 -1
  45. package/dist/application-spec/generate-application/runtime/sections/preset-runtime.d.ts +2 -3
  46. package/dist/application-spec/generate-application/runtime/sections/reflection-constants-runtime.d.ts +1 -1
  47. package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.d.ts +1 -1
  48. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +96 -31
  49. package/dist/application-spec/generate-application/runtime-spec/spec-code-id.d.ts +1 -1
  50. package/dist/application-spec/parse-application-files/merge/merged-assistant.d.ts +13 -4
  51. package/dist/application-spec/parse-application-files/merge/merged-assistant.js +1 -1
  52. package/dist/application-spec/parse-application-files/merge/merged-infra.d.ts +4 -11
  53. package/dist/application-spec/parse-application-files/merge/merged-transformers.d.ts +2 -4
  54. package/dist/application-spec/parse-application-files/parse-application-files.js +1 -1
  55. package/dist/application-spec/parse-application-files/raw-spec/raw-acl.d.ts +2 -2
  56. package/dist/application-spec/parse-application-files/raw-spec/raw-acl.js +1 -1
  57. package/dist/application-spec/parse-application-files/raw-spec/raw-admin-pages.d.ts +3 -24
  58. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +25 -20
  59. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
  60. package/dist/application-spec/parse-application-files/raw-spec/raw-expressions.d.ts +1 -1
  61. package/dist/application-spec/parse-application-files/raw-spec/raw-expressions.js +1 -1
  62. package/dist/application-spec/parse-application-files/raw-spec/raw-resources.d.ts +19 -64
  63. package/dist/application-spec/parse-application-files/spec/application/admin-spec/admin-pages.d.ts +3 -20
  64. package/dist/application-spec/parse-application-files/spec/application/admin-spec/states.d.ts +3 -5
  65. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/states.d.ts +3 -8
  66. package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding.d.ts +3 -13
  67. package/dist/application-spec/parse-application-files/spec/components/bindings/write-binding.d.ts +4 -32
  68. package/dist/application-spec/parse-application-files/spec/components/component-filter.d.ts +4 -10
  69. package/dist/application-spec/parse-application-files/spec/components/components.d.ts +3 -4
  70. package/dist/application-spec/parse-application-files/spec/components/index.d.ts +1 -2
  71. package/dist/application-spec/parse-application-files/spec/components/index.js +1 -1
  72. package/dist/application-spec/parse-application-files/spec/components/sdk-component-entry.d.ts +1 -1
  73. package/dist/application-spec/parse-application-files/spec/components/user-component-entry.d.ts +2 -3
  74. package/dist/application-spec/parse-application-files/spec/components/user-component-entry.js +1 -1
  75. package/dist/application-spec/parse-application-files/spec/components/user-components.d.ts +2 -3
  76. package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.d.ts +2 -2
  77. package/dist/application-spec/parse-application-files/spec/expressions/expressions.d.ts +7 -29
  78. package/dist/application-spec/parse-application-files/spec/expressions/index.d.ts +0 -1
  79. package/dist/application-spec/parse-application-files/spec/expressions/memo-eval-plan.d.ts +4 -71
  80. package/dist/application-spec/parse-application-files/spec/expressions/memo-eval-plan.js +1 -1
  81. package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.d.ts +2 -2
  82. package/dist/application-spec/parse-application-files/spec/invariants/invariant.d.ts +5 -21
  83. package/dist/application-spec/parse-application-files/spec/invariants/invariants.d.ts +4 -14
  84. package/dist/application-spec/parse-application-files/spec/model/aliases.d.ts +3 -9
  85. package/dist/application-spec/parse-application-files/spec/model/common-types.d.ts +6 -14
  86. package/dist/application-spec/parse-application-files/spec/model/defaults.d.ts +6 -31
  87. package/dist/application-spec/parse-application-files/spec/model/entity-types.d.ts +3 -8
  88. package/dist/application-spec/parse-application-files/spec/model/model-version-key.d.ts +3 -3
  89. package/dist/application-spec/parse-application-files/spec/model/names/action-name.d.ts +3 -7
  90. package/dist/application-spec/parse-application-files/spec/model/names/alias-name.d.ts +3 -7
  91. package/dist/application-spec/parse-application-files/spec/model/names/entity-or-alias-name.d.ts +3 -8
  92. package/dist/application-spec/parse-application-files/spec/model/names/entity-type-name.d.ts +3 -8
  93. package/dist/application-spec/parse-application-files/spec/model/names/expression-name.d.ts +3 -6
  94. package/dist/application-spec/parse-application-files/spec/model/names/instance-name.d.ts +3 -7
  95. package/dist/application-spec/parse-application-files/spec/model/names/invariant-name.d.ts +3 -3
  96. package/dist/application-spec/parse-application-files/spec/model/names/shape-property-name.d.ts +3 -11
  97. package/dist/application-spec/parse-application-files/spec/model/names/violation-type-name.d.ts +3 -3
  98. package/dist/application-spec/parse-application-files/spec/model/presets.d.ts +6 -29
  99. package/dist/application-spec/parse-application-files/spec/sections/actions.d.ts +6 -23
  100. package/dist/application-spec/parse-application-files/spec/sections/app-metadata.d.ts +3 -18
  101. package/dist/application-spec/parse-application-files/spec/sections/application-version.d.ts +3 -7
  102. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
  103. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant.js +1 -1
  104. package/dist/application-spec/parse-application-files/spec/sections/data-spec/chunks.d.ts +6 -23
  105. package/dist/application-spec/parse-application-files/spec/sections/data-spec/custom-data-spec.d.ts +1 -16
  106. package/dist/application-spec/parse-application-files/spec/sections/data-spec/data-entry-key.d.ts +3 -9
  107. package/dist/application-spec/parse-application-files/spec/sections/data-spec/data-spec.d.ts +1 -10
  108. package/dist/application-spec/parse-application-files/spec/sections/data-spec/swatch-data-spec.d.ts +1 -14
  109. package/dist/application-spec/parse-application-files/spec/sections/state-value.d.ts +3 -7
  110. package/dist/application-spec/parse-application-files/spec/sections/theme.d.ts +3 -10
  111. package/dist/application-spec/parse-application-files/spec/sections/transformers.d.ts +4 -11
  112. package/dist/application-spec/parse-application-files/spec/sections/ui.d.ts +3 -12
  113. package/dist/client/authorized-client.js +1 -1
  114. package/dist/client/contract.d.ts +17 -5
  115. package/dist/client/contract.js +1 -1
  116. package/dist/client/phoenix-api.d.ts +32 -5
  117. package/dist/configurator/ConfiguratorApp.js +1 -1
  118. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +51 -6
  119. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  120. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +19 -3
  121. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
  122. package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.d.ts +70 -56
  123. package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.js +1 -1
  124. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +15 -0
  125. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  126. package/dist/configurator/application-runtime/extensions/systems/graphql-system/violations.d.ts +40 -0
  127. package/dist/configurator/application-runtime/extensions/systems/graphql-system/violations.js +1 -0
  128. package/dist/configurator/common/configurator-interface.d.ts +2 -2
  129. package/dist/configurator/common/configurator-interface.js +1 -1
  130. package/dist/configurator/configurator-context/configurator-hooks/index.d.ts +0 -1
  131. package/dist/configurator/configurator-context/configurator-hooks/index.js +1 -1
  132. package/dist/configurator/configurator-context/configurator-hooks/layout-hooks.js +1 -1
  133. package/dist/configurator/configurator-context/index.d.ts +0 -5
  134. package/dist/configurator/configurator-context/index.js +1 -1
  135. package/dist/configurator/pages/ConfiguratorNotFoundPage.js +1 -1
  136. package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
  137. package/dist/configurator/pages/NewConfiguratorPage.js +1 -1
  138. package/dist/configurator/pages/error-boundaries/DevContextFallback.js +1 -1
  139. package/dist/configurator/pages/error-boundaries/DevLoadingFallback.js +1 -1
  140. package/dist/configurator/ui/assistant/AssistantChips.js +1 -1
  141. package/dist/configurator/ui/assistant/AssistantComposer.d.ts +6 -0
  142. package/dist/configurator/ui/assistant/AssistantComposer.js +2 -1
  143. package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
  144. package/dist/configurator/ui/assistant/attachments/MessageImages.d.ts +11 -0
  145. package/dist/configurator/ui/assistant/attachments/MessageImages.js +1 -0
  146. package/dist/configurator/ui/assistant/attachments/index.d.ts +2 -0
  147. package/dist/configurator/ui/assistant/attachments/index.js +1 -0
  148. package/dist/configurator/ui/assistant/attachments/prepare-image.d.ts +19 -0
  149. package/dist/configurator/ui/assistant/attachments/prepare-image.js +1 -0
  150. package/dist/configurator/ui/assistant/screenshots/index.d.ts +1 -0
  151. package/dist/configurator/ui/assistant/screenshots/index.js +1 -1
  152. package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.d.ts +4 -4
  153. package/dist/configurator/ui/assistant/thread-items.d.ts +2 -0
  154. package/dist/configurator/ui/assistant/thread-items.js +1 -1
  155. package/dist/configurator/ui/assistant/tool-chip.d.ts +19 -9
  156. package/dist/configurator/ui/assistant/tool-chip.js +1 -1
  157. package/dist/configurator/ui/configurator-layout/slots/canvas/GPUAccelerationDisabled.js +1 -1
  158. package/dist/configurator/ui/configurator-layout/slots/canvas/WebGLNotSupported.js +1 -1
  159. package/dist/configurator/ui/configurator-layout/slots/readonly-banner/CloneToEditDialog.js +1 -1
  160. package/dist/configurator/ui/configurator-layout/universal/DesktopPreview.js +1 -1
  161. package/dist/configurator/ui/configurator-layout/universal/MobilePreview.js +1 -1
  162. package/dist/configurator/ui/legacy/chat/MobileChat.js +1 -1
  163. package/dist/configurator/ui/legacy/layout/common/CommonTopNavigation.js +1 -1
  164. package/dist/configurator/ui/legacy/layout/simple/SimpleSidebar.js +1 -1
  165. package/dist/configurator/ui/legacy/layout/simple/SimpleTopNavigation.js +1 -1
  166. package/dist/configurator/ui/legacy/layout/steps/StepsNavigation.js +1 -1
  167. package/dist/configurator/ui/legacy/layout/steps/StepsOwnerLayout.js +1 -1
  168. package/dist/configurator/ui/legacy/layout/steps/StepsSideBar.js +1 -1
  169. package/dist/configurator/ui/legacy/layout/tabs/TabsSidebar.js +1 -1
  170. package/dist/configurator/ui/phoenix-layout-elements/header/common/back-button/use-go-back-action.js +1 -1
  171. package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/StepsNavigation.js +1 -1
  172. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/basic/use-basic-sidebar-footer.js +1 -1
  173. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/PreviousStepButton.js +1 -1
  174. package/dist/configurator/ui/preset-layout/CategoryPresetUi.js +1 -1
  175. package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.js +1 -1
  176. package/dist/docs/3d-scene/cameras/custom.mdx +4 -2
  177. package/dist/docs/drag-and-drop/room-planner.mdx +1 -1
  178. package/dist/docs/index.json +1 -1
  179. package/dist/docs/phoenix/configurator-interface.mdx +1 -1
  180. package/dist/docs/phoenix/domain-model.mdx +4 -1
  181. package/dist/docs/phoenix/layout-slots.mdx +21 -0
  182. package/dist/docs/phoenix/migration-guide.mdx +3 -3
  183. package/dist/docs/phoenix/phoenix-cli.mdx +40 -7
  184. package/dist/docs/phoenix/project-structure.mdx +23 -19
  185. package/dist/docs/phoenix/sdk-builder-workflow.mdx +2 -2
  186. package/dist/docs/phoenix/webhooks.mdx +5 -1
  187. package/dist/domain/application/application-config.d.ts +6 -24
  188. package/dist/domain/application/assistant/assistant-manifest.d.ts +13 -3
  189. package/dist/domain/application/assistant/assistant-manifest.js +1 -1
  190. package/dist/domain/application/assistant/assistant-resolved-manifest.d.ts +5 -9
  191. package/dist/domain/application/assistant/assistant-resolved-manifest.js +1 -1
  192. package/dist/domain/application/assistant/build-assistant-lenses.js +1 -1
  193. package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
  194. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
  195. package/dist/domain/application/assistant/index.d.ts +3 -3
  196. package/dist/domain/application/assistant/index.js +1 -1
  197. package/dist/domain/application/assistant/session-setup/apply-assistant-setup.js +1 -1
  198. package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.d.ts +2 -4
  199. package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.js +1 -1
  200. package/dist/domain/application/assistant-mutations.js +1 -1
  201. package/dist/domain/available-system-components/available-system-components.d.ts +11 -0
  202. package/dist/domain/available-system-components/available-system-components.js +1 -0
  203. package/dist/domain/available-system-components/index.d.ts +1 -0
  204. package/dist/domain/available-system-components/index.js +1 -0
  205. package/dist/domain/{domain-builder.d.ts → domain-builder/domain-builder.d.ts} +2 -2
  206. package/dist/domain/domain-builder/domain-builder.js +1 -0
  207. package/dist/domain/domain-builder/index.d.ts +1 -0
  208. package/dist/domain/domain-builder/index.js +1 -0
  209. package/dist/domain/extensions/export-images/agent-screenshot.d.ts +6 -0
  210. package/dist/domain/extensions/export-images/agent-screenshot.js +1 -1
  211. package/dist/domain/extensions/export-images/index.d.ts +1 -1
  212. package/dist/domain/extensions/export-images/index.js +1 -1
  213. package/dist/domain/extensions/index.d.ts +1 -1
  214. package/dist/domain/extensions/index.js +1 -1
  215. package/dist/domain/index.d.ts +3 -2
  216. package/dist/domain/index.js +1 -1
  217. package/dist/domain/spec/application/admin-pages-section.d.ts +29 -0
  218. package/dist/domain/spec/application/admin-pages.d.ts +26 -0
  219. package/dist/domain/spec/application/admin-states.d.ts +5 -0
  220. package/dist/domain/spec/application/configurator-states.d.ts +8 -0
  221. package/dist/domain/spec/application/configurator-states.js +1 -0
  222. package/dist/domain/spec/application/index.d.ts +5 -0
  223. package/dist/domain/spec/application/index.js +1 -0
  224. package/dist/domain/spec/components/bindings/index.d.ts +2 -0
  225. package/dist/domain/spec/components/bindings/index.js +1 -0
  226. package/dist/domain/spec/components/bindings/read-binding.d.ts +13 -0
  227. package/dist/domain/spec/components/bindings/read-binding.js +1 -0
  228. package/dist/domain/spec/components/bindings/write-binding.d.ts +32 -0
  229. package/dist/domain/spec/components/bindings/write-binding.js +1 -0
  230. package/dist/{application-spec/parse-application-files → domain}/spec/components/component-entry.d.ts +3 -3
  231. package/dist/domain/spec/components/component-entry.js +1 -0
  232. package/dist/{application-spec/core → domain/spec}/components/component-filter.d.ts +3 -2
  233. package/dist/domain/spec/components/component-filters.d.ts +10 -0
  234. package/dist/domain/spec/components/component-filters.js +1 -0
  235. package/dist/domain/spec/components/components.d.ts +4 -0
  236. package/dist/domain/spec/components/components.js +1 -0
  237. package/dist/domain/spec/components/index.d.ts +6 -0
  238. package/dist/domain/spec/enhanced-json/enhanced-json-value.d.ts +30 -0
  239. package/dist/domain/spec/enhanced-json/enhanced-json-value.js +1 -0
  240. package/dist/domain/spec/enhanced-json/index.d.ts +1 -0
  241. package/dist/domain/spec/enhanced-json/index.js +1 -0
  242. package/dist/{application-spec/parse-application-files → domain}/spec/expressions/expression.d.ts +9 -3
  243. package/dist/domain/spec/expressions/expression.js +1 -0
  244. package/dist/domain/spec/expressions/expressions.d.ts +27 -0
  245. package/dist/domain/spec/expressions/expressions.js +1 -0
  246. package/dist/domain/spec/expressions/index.d.ts +5 -0
  247. package/dist/domain/spec/expressions/memo-eval-plan.d.ts +70 -0
  248. package/dist/domain/spec/expressions/memo-eval-plan.js +1 -0
  249. package/dist/domain/spec/expressions/relation-expression-params.js +1 -0
  250. package/dist/domain/spec/index.d.ts +9 -0
  251. package/dist/domain/spec/index.js +1 -0
  252. package/dist/domain/spec/invariants/index.d.ts +2 -0
  253. package/dist/domain/spec/invariants/index.js +1 -0
  254. package/dist/domain/spec/invariants/invariant.d.ts +24 -0
  255. package/dist/domain/spec/invariants/invariant.js +1 -0
  256. package/dist/domain/spec/invariants/invariants.d.ts +14 -0
  257. package/dist/domain/spec/invariants/invariants.js +1 -0
  258. package/dist/domain/spec/json-schema.d.ts +52 -0
  259. package/dist/domain/spec/json-schema.js +1 -0
  260. package/dist/domain/spec/markers/index.d.ts +3 -0
  261. package/dist/domain/spec/markers/index.js +1 -0
  262. package/dist/domain/spec/markers/msg-marker.d.ts +28 -0
  263. package/dist/domain/spec/markers/msg-marker.js +1 -0
  264. package/dist/domain/spec/model/aliases.d.ts +9 -0
  265. package/dist/domain/spec/model/aliases.js +1 -0
  266. package/dist/domain/spec/model/common-types.d.ts +15 -0
  267. package/dist/domain/spec/model/common-types.js +1 -0
  268. package/dist/domain/spec/model/defaults.d.ts +33 -0
  269. package/dist/domain/spec/model/defaults.js +1 -0
  270. package/dist/domain/spec/model/entity-types.d.ts +8 -0
  271. package/dist/domain/spec/model/entity-types.js +1 -0
  272. package/dist/domain/spec/model/index.d.ts +7 -0
  273. package/dist/domain/spec/model/index.js +1 -0
  274. package/dist/domain/spec/model/model-version-key.d.ts +3 -0
  275. package/dist/domain/spec/model/model-version-key.js +1 -0
  276. package/dist/domain/spec/model/names/action-name.d.ts +7 -0
  277. package/dist/domain/spec/model/names/action-name.js +1 -0
  278. package/dist/domain/spec/model/names/alias-name.d.ts +7 -0
  279. package/dist/domain/spec/model/names/alias-name.js +1 -0
  280. package/dist/domain/spec/model/names/entity-or-alias-name.d.ts +8 -0
  281. package/dist/domain/spec/model/names/entity-or-alias-name.js +1 -0
  282. package/dist/domain/spec/model/names/entity-type-name.d.ts +8 -0
  283. package/dist/domain/spec/model/names/entity-type-name.js +1 -0
  284. package/dist/domain/spec/model/names/expression-name.d.ts +6 -0
  285. package/dist/domain/spec/model/names/expression-name.js +1 -0
  286. package/dist/domain/spec/model/names/index.d.ts +9 -0
  287. package/dist/domain/spec/model/names/index.js +1 -0
  288. package/dist/domain/spec/model/names/instance-name.d.ts +7 -0
  289. package/dist/domain/spec/model/names/instance-name.js +1 -0
  290. package/dist/domain/spec/model/names/invariant-name.d.ts +3 -0
  291. package/dist/domain/spec/model/names/invariant-name.js +1 -0
  292. package/dist/domain/spec/model/names/shape-property-name.d.ts +11 -0
  293. package/dist/domain/spec/model/names/shape-property-name.js +1 -0
  294. package/dist/domain/spec/model/names/violation-type-name.d.ts +3 -0
  295. package/dist/domain/spec/model/names/violation-type-name.js +1 -0
  296. package/dist/domain/spec/model/presets.d.ts +30 -0
  297. package/dist/domain/spec/model/presets.js +1 -0
  298. package/dist/domain/spec/sections/actions.d.ts +23 -0
  299. package/dist/domain/spec/sections/actions.js +1 -0
  300. package/dist/domain/spec/sections/app-metadata.d.ts +18 -0
  301. package/dist/domain/spec/sections/app-metadata.js +1 -0
  302. package/dist/domain/spec/sections/application-version.d.ts +7 -0
  303. package/dist/domain/spec/sections/application-version.js +1 -0
  304. package/dist/domain/spec/sections/data-spec/chunks.d.ts +23 -0
  305. package/dist/domain/spec/sections/data-spec/chunks.js +1 -0
  306. package/dist/domain/spec/sections/data-spec/custom-data-spec-entry.d.ts +16 -0
  307. package/dist/domain/spec/sections/data-spec/custom-data-spec-entry.js +1 -0
  308. package/dist/domain/spec/sections/data-spec/data-entry-key.d.ts +9 -0
  309. package/dist/domain/spec/sections/data-spec/data-entry-key.js +1 -0
  310. package/dist/domain/spec/sections/data-spec/index.d.ts +5 -0
  311. package/dist/domain/spec/sections/data-spec/index.js +1 -0
  312. package/dist/domain/spec/sections/data-spec/parsed-data-spec-entries.d.ts +10 -0
  313. package/dist/domain/spec/sections/data-spec/parsed-data-spec-entries.js +1 -0
  314. package/dist/domain/spec/sections/data-spec/swatch-data-spec-entry.d.ts +14 -0
  315. package/dist/domain/spec/sections/data-spec/swatch-data-spec-entry.js +1 -0
  316. package/dist/domain/spec/sections/index.d.ts +9 -0
  317. package/dist/domain/spec/sections/index.js +1 -0
  318. package/dist/domain/spec/sections/infra/acl.d.ts +12 -0
  319. package/dist/domain/spec/sections/infra/acl.js +1 -0
  320. package/dist/domain/spec/sections/infra/index.d.ts +3 -0
  321. package/dist/domain/spec/sections/infra/index.js +1 -0
  322. package/dist/domain/spec/sections/infra/resource-entry.d.ts +46 -0
  323. package/dist/domain/spec/sections/infra/resource-entry.js +1 -0
  324. package/dist/domain/spec/sections/infra/resources-config.d.ts +10 -0
  325. package/dist/domain/spec/sections/infra/resources-config.js +1 -0
  326. package/dist/domain/spec/sections/state-value.d.ts +7 -0
  327. package/dist/domain/spec/sections/state-value.js +1 -0
  328. package/dist/domain/spec/sections/theme.d.ts +10 -0
  329. package/dist/domain/spec/sections/theme.js +1 -0
  330. package/dist/domain/spec/sections/transformers.d.ts +15 -0
  331. package/dist/domain/spec/sections/transformers.js +1 -0
  332. package/dist/domain/spec/sections/ui.d.ts +12 -0
  333. package/dist/domain/spec/sections/ui.js +1 -0
  334. package/dist/domain/system-definitions.js +1 -1
  335. package/dist/domain/utils/index.d.ts +2 -0
  336. package/dist/domain/utils/index.js +1 -0
  337. package/dist/editor/graphql/GraphQLPanel.js +1 -1
  338. package/dist/i18n/locales/cs/messages.js +1 -1
  339. package/dist/i18n/locales/da/messages.js +1 -1
  340. package/dist/i18n/locales/de/messages.js +1 -1
  341. package/dist/i18n/locales/de-AT/messages.js +1 -1
  342. package/dist/i18n/locales/en/messages.js +1 -1
  343. package/dist/i18n/locales/en-AU/messages.js +1 -1
  344. package/dist/i18n/locales/en-GB/messages.js +1 -1
  345. package/dist/i18n/locales/es/messages.js +1 -1
  346. package/dist/i18n/locales/fr/messages.js +1 -1
  347. package/dist/i18n/locales/hu/messages.js +1 -1
  348. package/dist/i18n/locales/it/messages.js +1 -1
  349. package/dist/i18n/locales/nl/messages.js +1 -1
  350. package/dist/i18n/locales/pl/messages.js +1 -1
  351. package/dist/i18n/locales/pt/messages.js +1 -1
  352. package/dist/i18n/locales/ro/messages.js +1 -1
  353. package/dist/i18n/locales/sk/messages.js +1 -1
  354. package/dist/i18n/locales/tr/messages.js +1 -1
  355. package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +2 -2
  356. package/dist/phoenix/application-spec/generate-application-spec-project.d.ts +1 -0
  357. package/dist/phoenix/application-spec/generate-application-spec-project.js +2 -2
  358. package/dist/phoenix/application-spec/generate-project-files.d.ts +1 -0
  359. package/dist/phoenix/application-spec/index.d.ts +1 -0
  360. package/dist/phoenix/application-spec/index.js +1 -1
  361. package/dist/phoenix/application-spec/resolve-deployment-data.d.ts +11 -0
  362. package/dist/phoenix/application-spec/resolve-deployment-data.js +2 -2
  363. package/dist/phoenix/bin.js +1 -1
  364. package/dist/phoenix/cli.js +1 -1
  365. package/dist/phoenix/commands/activate-deployment.js +1 -1
  366. package/dist/phoenix/commands/build.js +1 -1
  367. package/dist/phoenix/commands/changelog.js +1 -1
  368. package/dist/phoenix/commands/check.js +1 -1
  369. package/dist/phoenix/commands/clean.js +1 -1
  370. package/dist/phoenix/commands/cleanup-environment.js +2 -2
  371. package/dist/phoenix/commands/create-environment.js +1 -1
  372. package/dist/phoenix/commands/data.js +1 -1
  373. package/dist/phoenix/commands/deploy.js +1 -1
  374. package/dist/phoenix/commands/deployment-build-envs-command.js +1 -1
  375. package/dist/phoenix/commands/dev.js +5 -5
  376. package/dist/phoenix/commands/docs.js +1 -1
  377. package/dist/phoenix/commands/finish-deployment-command.js +1 -1
  378. package/dist/phoenix/commands/fix.js +1 -1
  379. package/dist/phoenix/commands/generated-env-markers.d.ts +1 -0
  380. package/dist/phoenix/commands/generated-env-markers.js +1 -1
  381. package/dist/phoenix/commands/index.d.ts +1 -1
  382. package/dist/phoenix/commands/index.js +1 -1
  383. package/dist/phoenix/commands/inspect-assets.js +1 -1
  384. package/dist/phoenix/commands/list-environments.js +1 -1
  385. package/dist/phoenix/commands/login.d.ts +4 -1
  386. package/dist/phoenix/commands/login.js +2 -2
  387. package/dist/phoenix/commands/prepare-deployment-command.js +2 -2
  388. package/dist/phoenix/commands/register-deployment.js +1 -1
  389. package/dist/phoenix/commands/scene.js +1 -1
  390. package/dist/phoenix/commands/screenshot.js +1 -1
  391. package/dist/phoenix/commands/state.js +1 -1
  392. package/dist/phoenix/commands/story-build.js +3 -3
  393. package/dist/phoenix/commands/story-create.js +1 -1
  394. package/dist/phoenix/commands/sync.js +1 -1
  395. package/dist/phoenix/commands/variants.js +1 -1
  396. package/dist/phoenix/lingui/index.d.ts +1 -0
  397. package/dist/phoenix/lingui/index.js +1 -0
  398. package/dist/phoenix/lingui/lingui.d.ts +18 -0
  399. package/dist/phoenix/lingui/lingui.js +1 -0
  400. package/dist/phoenix/services/application-spec-project-watcher.d.ts +3 -1
  401. package/dist/phoenix/services/application-spec-project-watcher.js +2 -2
  402. package/dist/phoenix/services/cli-credentials.d.ts +3 -0
  403. package/dist/phoenix/services/cli-credentials.js +1 -1
  404. package/dist/phoenix/services/cli-exit.d.ts +5 -0
  405. package/dist/phoenix/services/cli-exit.js +1 -0
  406. package/dist/phoenix/services/index.d.ts +3 -0
  407. package/dist/phoenix/services/index.js +1 -1
  408. package/dist/phoenix/services/lingui-watcher.js +1 -1
  409. package/dist/phoenix/services/prepare-development-environment.js +1 -1
  410. package/dist/phoenix/services/telemetry/amplitude-telemetry-transport.d.ts +9 -0
  411. package/dist/phoenix/services/telemetry/amplitude-telemetry-transport.js +1 -0
  412. package/dist/phoenix/services/telemetry/index.d.ts +3 -0
  413. package/dist/phoenix/services/telemetry/index.js +1 -0
  414. package/dist/phoenix/services/telemetry/telemetry-client.d.ts +25 -0
  415. package/dist/phoenix/services/telemetry/telemetry-client.js +1 -0
  416. package/dist/phoenix/services/telemetry/telemetry-command.d.ts +2 -0
  417. package/dist/phoenix/services/telemetry/telemetry-command.js +1 -0
  418. package/dist/phoenix/services/telemetry/telemetry-event.d.ts +44 -0
  419. package/dist/phoenix/services/telemetry/telemetry-event.js +1 -0
  420. package/dist/phoenix/services/telemetry/telemetry-state.d.ts +25 -0
  421. package/dist/phoenix/services/telemetry/telemetry-state.js +2 -0
  422. package/dist/phoenix/services/vite-config.js +1 -1
  423. package/dist/react-sdk/application-runtime/domain-application-context/chat-system.d.ts +1 -1
  424. package/dist/{configurator/configurator-context → react-sdk}/configurator-routing/ConfiguratorRoutingProvider.d.ts +1 -1
  425. package/dist/react-sdk/configurator-routing/ConfiguratorRoutingProvider.js +1 -0
  426. package/dist/{configurator/configurator-context → react-sdk}/configurator-routing/OnGoToIndexHandler.d.ts +1 -2
  427. package/dist/react-sdk/configurator-routing/OnGoToIndexHandler.js +1 -0
  428. package/dist/react-sdk/configurator-routing/index.d.ts +3 -0
  429. package/dist/{configurator/configurator-context → react-sdk}/configurator-routing/index.js +1 -1
  430. package/dist/{configurator/configurator-context → react-sdk}/configurator-routing/use-power-routing-lifecycle.d.ts +2 -0
  431. package/dist/react-sdk/configurator-routing/use-power-routing-lifecycle.js +1 -0
  432. package/dist/react-sdk/domain-application-context/ConfigurationPersistSystemFailureHandler.js +1 -1
  433. package/dist/react-sdk/domain-application-context/OnPresetLoadedHandler.js +1 -0
  434. package/dist/react-sdk/domain-application-context/chat-hooks.d.ts +4 -0
  435. package/dist/react-sdk/domain-application-context/chat-hooks.js +1 -0
  436. package/dist/react-sdk/domain-application-context/index.d.ts +2 -0
  437. package/dist/react-sdk/domain-application-context/index.js +1 -1
  438. package/dist/react-sdk/index.d.ts +5 -0
  439. package/dist/react-sdk/index.js +1 -1
  440. package/dist/react-sdk/integration/IntegrationSubscription.js +1 -0
  441. package/dist/react-sdk/integration/index.d.ts +1 -0
  442. package/dist/react-sdk/integration/index.js +1 -0
  443. package/dist/react-sdk/lifecycle-providers/ConfiguratorDataProvider.d.ts +8 -0
  444. package/dist/react-sdk/lifecycle-providers/ConfiguratorDataProvider.js +1 -0
  445. package/dist/react-sdk/lifecycle-providers/LifecycleProviders.js +1 -0
  446. package/dist/react-sdk/lifecycle-providers/index.d.ts +2 -0
  447. package/dist/react-sdk/lifecycle-providers/index.js +1 -0
  448. package/dist/react-sdk/notifications/index.d.ts +1 -0
  449. package/dist/react-sdk/notifications/index.js +1 -0
  450. package/dist/react-sdk/notifications/snackbar-action-button.d.ts +30 -0
  451. package/dist/react-sdk/notifications/snackbar-action-button.js +1 -0
  452. package/dist/react-sdk/preset-selection/PresetSelectionProvider.js +1 -0
  453. package/dist/react-sdk/preset-selection/index.d.ts +1 -0
  454. package/dist/react-sdk/preset-selection/index.js +1 -0
  455. package/dist/ui-sdk/components/snackbar/Snackbar.d.ts +24 -3
  456. package/dist/ui-sdk/components/snackbar/Snackbar.js +1 -1
  457. package/dist/ui-sdk/icons/__generated/Paperclip.d.ts +3 -0
  458. package/dist/ui-sdk/icons/__generated/Paperclip.js +1 -0
  459. package/dist/ui-sdk/icons/__generated/index.d.ts +2 -0
  460. package/dist/ui-sdk/icons/__generated/index.js +1 -1
  461. package/dist/ui-sdk/icons/icons-registry.js +1 -1
  462. package/dist/ui-sdk/theme/types.d.ts +1 -1
  463. package/dist/watch/glob-matcher.d.ts +4 -4
  464. package/dist/watch/glob-matcher.js +1 -1
  465. package/dist/watch/watch.d.ts +4 -4
  466. package/dist/watch/watch.js +1 -1
  467. package/package.json +3 -3
  468. package/schema/domain-spec.json +22 -4
  469. package/dist/application-spec/core/components/index.d.ts +0 -2
  470. package/dist/application-spec/core/expressions/index.d.ts +0 -2
  471. package/dist/configurator/configurator-context/ConfiguratorDataProvider.d.ts +0 -2
  472. package/dist/configurator/configurator-context/ConfiguratorDataProvider.js +0 -1
  473. package/dist/configurator/configurator-context/IntegrationSubscription.js +0 -1
  474. package/dist/configurator/configurator-context/LifecycleProviders.js +0 -1
  475. package/dist/configurator/configurator-context/OnPresetLoadedHandler.js +0 -1
  476. package/dist/configurator/configurator-context/PresetSelectionProvider.js +0 -1
  477. package/dist/configurator/configurator-context/configurator-hooks/chat-hooks.d.ts +0 -1
  478. package/dist/configurator/configurator-context/configurator-hooks/chat-hooks.js +0 -1
  479. package/dist/configurator/configurator-context/configurator-routing/ConfiguratorRoutingProvider.js +0 -1
  480. package/dist/configurator/configurator-context/configurator-routing/OnGoToIndexHandler.js +0 -1
  481. package/dist/configurator/configurator-context/configurator-routing/index.d.ts +0 -2
  482. package/dist/configurator/configurator-context/configurator-routing/use-power-routing-lifecycle.js +0 -1
  483. package/dist/domain/available-system-components.d.ts +0 -11
  484. package/dist/domain/available-system-components.js +0 -1
  485. package/dist/domain/domain-builder.js +0 -1
  486. package/dist/phoenix/services/lingui.d.ts +0 -15
  487. package/dist/phoenix/services/lingui.js +0 -1
  488. /package/dist/{application-spec/core/expressions/relation-expression-params.js → domain/spec/application/admin-pages-section.js} +0 -0
  489. /package/dist/{application-spec/parse-application-files/spec/components/component-entry.js → domain/spec/application/admin-pages.js} +0 -0
  490. /package/dist/{application-spec/parse-application-files/spec/expressions/expression.js → domain/spec/application/admin-states.js} +0 -0
  491. /package/dist/{application-spec/core → domain/spec/application}/application-instance.d.ts +0 -0
  492. /package/dist/{application-spec/core → domain/spec/application}/application-instance.js +0 -0
  493. /package/dist/{application-spec/core → domain/spec}/components/component-filter.js +0 -0
  494. /package/dist/{application-spec/core → domain/spec}/components/index.js +0 -0
  495. /package/dist/{application-spec/core → domain/spec}/components/sdk-code-ref.d.ts +0 -0
  496. /package/dist/{application-spec/core → domain/spec}/components/sdk-code-ref.js +0 -0
  497. /package/dist/{application-spec/core → domain/spec}/expressions/index.js +0 -0
  498. /package/dist/{application-spec/core → domain/spec}/expressions/relation-expression-params.d.ts +0 -0
  499. /package/dist/{application-spec/core → domain/spec}/expressions/sdk-expression-implementation.d.ts +0 -0
  500. /package/dist/{application-spec/core → domain/spec}/expressions/sdk-expression-implementation.js +0 -0
  501. /package/dist/{application-spec/parse-application-files/spec/components → domain/spec/markers}/component-prop-target.d.ts +0 -0
  502. /package/dist/{application-spec/parse-application-files/spec/components → domain/spec/markers}/component-prop-target.js +0 -0
  503. /package/dist/{application-spec/core → domain/spec}/markers/eval-marker.d.ts +0 -0
  504. /package/dist/{application-spec/core → domain/spec}/markers/eval-marker.js +0 -0
  505. /package/dist/{configurator/configurator-context → react-sdk/domain-application-context}/OnPresetLoadedHandler.d.ts +0 -0
  506. /package/dist/{configurator/configurator-context → react-sdk/integration}/IntegrationSubscription.d.ts +0 -0
  507. /package/dist/{configurator/configurator-context → react-sdk/lifecycle-providers}/LifecycleProviders.d.ts +0 -0
  508. /package/dist/{configurator/configurator-context → react-sdk/preset-selection}/PresetSelectionProvider.d.ts +0 -0
@@ -101,10 +101,12 @@ export interface AuthorizedPhoenixApiClient<FINALIZE_DATA extends Record<string,
101
101
  */
102
102
  getAssistantEarlierThread: (configurationId: string, threadId: string, limit: number) => Promise<AssistantEarlierThread>;
103
103
  /**
104
- * Stores a screenshot the assistant took in the open assistant thread of the configuration, while a
105
- * reply runs there, and resolves with the id its tool result references it by. The image is the
106
- * rendered JPEG or PNG blob, sent with its own type. Rejects with an {@link AssistantRequestError}
107
- * when the server refuses.
104
+ * Stores an image in the assistant thread of the configuration, creating the thread when there is
105
+ * none yet: a screenshot the assistant took while a reply runs there, or an image the user attaches
106
+ * to their next message. Resolves with the id a tool result or a message references it by. The
107
+ * image is a JPEG or PNG blob of at most 2 MB, sent with its own type. Rejects with an
108
+ * {@link AssistantRequestError} when the server refuses, marked `threadNotContinuable` when the
109
+ * thread can take no new message until it is compacted.
108
110
  */
109
111
  uploadAssistantImage: (configurationId: string, image: Blob) => Promise<AssistantImageUpload>;
110
112
  /**
@@ -165,9 +167,19 @@ export interface AssistantEarlierThread {
165
167
  export declare class AssistantRequestError extends Error {
166
168
  /** The HTTP status of the answer, which tells a refusal from an outage. */
167
169
  readonly status: number;
170
+ /**
171
+ * True when the server refused because the thread cannot be continued until it is compacted, as
172
+ * its `x-assistant-thread-continuable: false` response header says.
173
+ */
174
+ readonly threadNotContinuable: boolean;
168
175
  constructor(message: string,
169
176
  /** The HTTP status of the answer, which tells a refusal from an outage. */
170
- status: number);
177
+ status: number,
178
+ /**
179
+ * True when the server refused because the thread cannot be continued until it is compacted, as
180
+ * its `x-assistant-thread-continuable: false` response header says.
181
+ */
182
+ threadNotContinuable?: boolean);
171
183
  }
172
184
  export declare class InvalidDeploymentError extends Error {
173
185
  constructor();
@@ -1 +1 @@
1
- export class AssistantRequestError extends Error{status;constructor(e,r){super(e),this.status=r,this.name="AssistantRequestError"}}export class InvalidDeploymentError extends Error{constructor(){super(),this.name="InvalidDeployment",this.message="The referenced deployment is invalid."}}export class InvalidAccessKeyError extends Error{constructor(){super("The access token is no longer valid because it expired or the server rejected it. Open the configuration from a fresh link."),this.name="InvalidAccessKey"}}export class ChunkNotFoundError extends Error{chunkKey;constructor(e){super(`Published chunk "${e}" not found`),this.chunkKey=e,this.name="ChunkNotFound"}}export class OAuthStaleConnectionError extends Error{constructor(){super("OAuth connection is stale"),this.name="OAuthStaleConnectionError"}}export class ConfigurationSchemaMismatchError extends Error{details;constructor(e){super("Preset data does not match the configuration schema registered on the server. Why: the preset/demo entity data was changed without re-registering the schema, or the schema drifted. Fix: re-register/redeploy the domain schema, or update the preset data to match the current schema."),this.details=e,this.name="ConfigurationSchemaMismatchError"}}export const isConfigurationSchemaMismatchError=e=>e instanceof ConfigurationSchemaMismatchError;
1
+ export class AssistantRequestError extends Error{status;threadNotContinuable;constructor(e,t,r=!1){super(e),this.status=t,this.threadNotContinuable=r,this.name="AssistantRequestError"}}export class InvalidDeploymentError extends Error{constructor(){super(),this.name="InvalidDeployment",this.message="The referenced deployment is invalid."}}export class InvalidAccessKeyError extends Error{constructor(){super("The access token is no longer valid because it expired or the server rejected it. Open the configuration from a fresh link."),this.name="InvalidAccessKey"}}export class ChunkNotFoundError extends Error{chunkKey;constructor(e){super(`Published chunk "${e}" not found`),this.chunkKey=e,this.name="ChunkNotFound"}}export class OAuthStaleConnectionError extends Error{constructor(){super("OAuth connection is stale"),this.name="OAuthStaleConnectionError"}}export class ConfigurationSchemaMismatchError extends Error{details;constructor(e){super("Preset data does not match the configuration schema registered on the server. Why: the preset/demo entity data was changed without re-registering the schema, or the schema drifted. Fix: re-register/redeploy the domain schema, or update the preset data to match the current schema."),this.details=e,this.name="ConfigurationSchemaMismatchError"}}export const isConfigurationSchemaMismatchError=e=>e instanceof ConfigurationSchemaMismatchError;
@@ -388,7 +388,7 @@ export interface paths {
388
388
  }
389
389
  readonly get?: never
390
390
  readonly put?: never
391
- /** @description Store a screenshot the browser took for the assistant in the caller's open thread on the configuration, while a run of the assistant answers there. The body is the raw JPEG or PNG image, with its type as the content type. The answer carries the id that tool results reference the image by, as `assistant-image:<imageId>`. Answers 409 when the caller has no open thread on the configuration or the thread is not in the middle of a reply (no run running and no client tool call waiting), and 415 for any other content type. */
391
+ /** @description Store an image in the caller's thread on the configuration: a screenshot the browser took for a run of the assistant, or an image the user attaches to the message they are about to send. Creates the thread when the caller has none yet. The body is the raw JPEG or PNG image of at most 2 MB, with its type as the content type. The answer carries the id that messages and tool results reference the image by, as `assistant-image:<imageId>`. Answers 409 with the `x-assistant-thread-continuable: false` response header when the thread cannot take a new message of the user (closed, started with another setup or at its size limit) and is not in the middle of a reply (no run running and no client tool call waiting); the thread takes images again once it is compacted. Answers 413 for a body over 2 MB and 415 for any other content type. */
392
392
  readonly post: operations['uploadAssistantImage']
393
393
  readonly delete?: never
394
394
  readonly options?: never
@@ -403,7 +403,7 @@ export interface paths {
403
403
  readonly path?: never
404
404
  readonly cookie?: never
405
405
  }
406
- /** @description Load a screenshot of one of the caller's assistant threads on the configuration, the earlier threads of the chain included. The bytes never change, so the answer may be cached for good. Answers 404 for an image that is not in one of the caller's threads on this configuration. */
406
+ /** @description Load an image of one of the caller's assistant threads on the configuration, a screenshot or an image the user attached, the earlier threads of the chain included. The bytes never change, so the answer may be cached for good. Answers 404 for an image that is not in one of the caller's threads on this configuration. */
407
407
  readonly get: operations['getAssistantImage']
408
408
  readonly put?: never
409
409
  readonly post?: never
@@ -1495,6 +1495,13 @@ export interface components {
1495
1495
  */
1496
1496
  readonly scopes?: readonly string[]
1497
1497
  }
1498
+ /** @description Payload Too Large: The request body is larger than the route's limit. */
1499
+ readonly PayloadTooLargeError: {
1500
+ /** @example Request body is too large */
1501
+ readonly message: string
1502
+ /** @enum {number} */
1503
+ readonly statusCode: 413
1504
+ }
1498
1505
  /**
1499
1506
  * @description The slug of the project, used for repository and domain creation.
1500
1507
  * @example my-project
@@ -2054,6 +2061,11 @@ export interface operations {
2054
2061
  readonly 'application/json': {
2055
2062
  /** @description The SDK-builder customer (workspace) the API token acts in. */
2056
2063
  readonly customer: {
2064
+ /**
2065
+ * Format: uuid
2066
+ * @description Internal UUID of the SDK-builder workspace.
2067
+ */
2068
+ readonly id: string
2057
2069
  /**
2058
2070
  * @description Display name of the SDK-builder workspace.
2059
2071
  * @example Acme
@@ -2061,6 +2073,7 @@ export interface operations {
2061
2073
  readonly name: string
2062
2074
  readonly slug: components['schemas']['CustomeSlug']
2063
2075
  }
2076
+ /** @description Stable ID of the authenticated builder user. */
2064
2077
  readonly userId: string
2065
2078
  }
2066
2079
  }
@@ -2193,6 +2206,11 @@ export interface operations {
2193
2206
  readonly 'application/json': {
2194
2207
  /** @description The SDK-builder customer (workspace) the API token acts in. */
2195
2208
  readonly customer: {
2209
+ /**
2210
+ * Format: uuid
2211
+ * @description Internal UUID of the SDK-builder workspace.
2212
+ */
2213
+ readonly id: string
2196
2214
  /**
2197
2215
  * @description Display name of the SDK-builder workspace.
2198
2216
  * @example Acme
@@ -2202,7 +2220,7 @@ export interface operations {
2202
2220
  }
2203
2221
  /** @description The API token (`phx_...`). */
2204
2222
  readonly token: string
2205
- /** @description The user who approved the sign-in. */
2223
+ /** @description Stable ID of the builder user who approved the sign-in. */
2206
2224
  readonly userId: string
2207
2225
  }
2208
2226
  }
@@ -3465,7 +3483,7 @@ export interface operations {
3465
3483
  readonly 'application/json': {
3466
3484
  /**
3467
3485
  * Format: uuid
3468
- * @description The id tool results reference the image by.
3486
+ * @description The id messages and tool results reference the image by.
3469
3487
  */
3470
3488
  readonly imageId: string
3471
3489
  }
@@ -3516,6 +3534,15 @@ export interface operations {
3516
3534
  readonly 'application/json': components['schemas']['ConflictError']
3517
3535
  }
3518
3536
  }
3537
+ /** @description Payload Too Large! */
3538
+ readonly 413: {
3539
+ headers: {
3540
+ readonly [name: string]: unknown
3541
+ }
3542
+ content: {
3543
+ readonly 'application/json': components['schemas']['PayloadTooLargeError']
3544
+ }
3545
+ }
3519
3546
  /** @description Unsupported Media Type! */
3520
3547
  readonly 415: {
3521
3548
  headers: {
@@ -3552,7 +3579,7 @@ export interface operations {
3552
3579
  readonly path: {
3553
3580
  /** @description The configuration on which the caller's assistant thread is used. */
3554
3581
  readonly configurationId: components['schemas']['ConfigurationUuid']
3555
- /** @description The image, as a tool result references it. */
3582
+ /** @description The image, as a message or a tool result references it. */
3556
3583
  readonly imageId: string
3557
3584
  }
3558
3585
  readonly cookie?: never
@@ -1 +1 @@
1
- import{jsx as r,jsxs as e}from"react/jsx-runtime";import{I18nProvider as o}from"@lingui/react";import{QueryClientProvider as i}from"@tanstack/react-query";import n from"mui-modal-provider";import{useEffect as t}from"react";import{standardWebComponentProperties as c}from"#package/domain";import{getAvailableLocales as a,resolveLocale as m}from"#package/i18n";import{ApplicationType as l,ApplicationTypeProvider as d,InvalidDeploymentReload as p,LoaderHost as s,SessionServiceProvider as f,useApplicationQueryClient as u,useI18n as h,useSpecAlwaysExpand as g,useSpecAppLoader as x,useSpecPrefetchTextureUrls as j,useSpecPreview as k,useWebComponentProperty$ as v,useWebComponentPropertySetter as b,useWebComponentPropertyValue as y}from"#package/react-sdk";import{SnackbarProvider as C}from"#package/ui-sdk";import{ConfiguratorDataProvider as w}from"./configurator-context/ConfiguratorDataProvider.js";import{ConfiguratorResponsiveProvider as E}from"./configurator-context/ConfiguratorResponsiveProvider.js";import{usePowerRoutingLifecycle as I}from"./configurator-context/configurator-routing/use-power-routing-lifecycle.js";import{ConfiguratorRoutingProvider as L,OnApplicationStartProvider as P,OnRoutingReadyProvider as Z,OnSessionReadyProvider as q,PresetSelectionProvider as A,PreviewApplicationProvider as B}from"./configurator-context/index.js";import{LoadingErrorBoundary as D}from"./pages/error-boundaries/LoadingErrorBoundary.js";import{GeneralErrorFallback as F,RootPage as R}from"./pages/index.js";import{SceneResourcesProvider as S}from"./scene/index.js";import{EncapsulatedConfiguratorTheme as T}from"./ui/index.js";import{AppLoader as U}from"./ui/phoenix-layout-elements/index.js";export const ConfiguratorApp=()=>{let z=u(),G=h(),H=x(),J=k(),K=g(),M=j(),N=b(c.locale),O=v(c.locale);t(()=>{let r=O.subscribe(r=>{let e=m(r,a(G));G.activate(e)}),e=()=>{N(G.locale)};return G.on("change",e),()=>{r.unsubscribe(),G.removeListener("change",e)}},[O,G,N]);let Q=y(c.containerZIndex),V=y(c.power);return(I(),"off"===V)?null:r(d,{type:l.Configurator,children:r(i,{client:z,children:r(T,{children:r(s,{children:r(E,{containerZIndex:Q,children:r(U,{mode:H,children:r(B,{alwaysExpand:K,preview:J,children:r(o,{i18n:G,children:r(C,{maxSnack:5,children:r(D,{FallbackComponent:F,children:r(S,{prefetchTextureUrls:M,children:r(P,{children:r(f,{children:r(q,{children:"on"===V&&r(L,{children:r(w,{children:r(A,{children:r(Z,{children:e(n,{children:[r(p,{}),r(R,{})]})})})})})})})})})})})})})})})})})})})};
1
+ import{jsx as r,jsxs as e}from"react/jsx-runtime";import{I18nProvider as o}from"@lingui/react";import{QueryClientProvider as i}from"@tanstack/react-query";import n from"mui-modal-provider";import{useEffect as t}from"react";import{standardWebComponentProperties as c}from"#package/domain";import{getAvailableLocales as a,resolveLocale as m}from"#package/i18n";import{ApplicationType as l,ApplicationTypeProvider as d,ConfiguratorDataProvider as p,ConfiguratorRoutingProvider as s,InvalidDeploymentReload as f,LoaderHost as h,OnApplicationStartProvider as u,OnRoutingReadyProvider as x,OnSessionReadyProvider as g,PresetSelectionProvider as j,SessionServiceProvider as k,useApplicationQueryClient as b,useI18n as v,usePowerRoutingLifecycle as y,useSpecAlwaysExpand as C,useSpecAppLoader as w,useSpecPrefetchTextureUrls as E,useSpecPreview as I,useWebComponentProperty$ as L,useWebComponentPropertySetter as Z,useWebComponentPropertyValue as q}from"#package/react-sdk";import{SnackbarProvider as A}from"#package/ui-sdk";import{ConfiguratorResponsiveProvider as B}from"./configurator-context/ConfiguratorResponsiveProvider.js";import{PreviewApplicationProvider as F}from"./configurator-context/index.js";import{LoadingErrorBoundary as P}from"./pages/error-boundaries/LoadingErrorBoundary.js";import{GeneralErrorFallback as R,RootPage as S}from"./pages/index.js";import{SceneResourcesProvider as T}from"./scene/index.js";import{EncapsulatedConfiguratorTheme as U}from"./ui/index.js";import{AppLoader as z}from"./ui/phoenix-layout-elements/index.js";export const ConfiguratorApp=()=>{let D=b(),G=v(),H=w(),J=I(),K=C(),M=E(),N=Z(c.locale),O=L(c.locale);t(()=>{let r=O.subscribe(r=>{let e=m(r,a(G));G.activate(e)}),e=()=>{N(G.locale)};return G.on("change",e),()=>{r.unsubscribe(),G.removeListener("change",e)}},[O,G,N]);let Q=q(c.containerZIndex),V=q(c.power);return(y(),"off"===V)?null:r(d,{type:l.Configurator,children:r(i,{client:D,children:r(U,{children:r(h,{children:r(B,{containerZIndex:Q,children:r(z,{mode:H,children:r(F,{alwaysExpand:K,preview:J,children:r(o,{i18n:G,children:r(A,{maxSnack:5,children:r(P,{FallbackComponent:R,children:r(T,{prefetchTextureUrls:M,children:r(u,{children:r(k,{children:r(g,{children:"on"===V&&r(s,{children:r(p,{children:r(j,{children:r(x,{children:e(n,{children:[r(f,{}),r(S,{})]})})})})})})})})})})})})})})})})})})})};
@@ -56,6 +56,21 @@ export interface AssistantChatSnapshot {
56
56
  /** True while that older thread is being loaded. */
57
57
  readonly isLoadingEarlierThread: boolean;
58
58
  }
59
+ /** What else the caller of {@link AssistantSystem.send} learns about the message. */
60
+ export interface AssistantSendOptions {
61
+ /**
62
+ * Called once the message is handed to the chat, which paints it: after its images were uploaded,
63
+ * and not at all when it is not sent because the thread could not be resumed or an upload failed.
64
+ * The composer keeps the message until then, so a message that is not sent can be sent again.
65
+ */
66
+ readonly onSent?: () => void;
67
+ /**
68
+ * Called when a message that was handed to the chat is gone from it after all: the server refused
69
+ * it because the thread could not continue, the thread was resumed without it, and its images
70
+ * could not be uploaded into the new thread. The caller gets it back, so it can be sent again.
71
+ */
72
+ readonly onUnsent?: () => void;
73
+ }
59
74
  /** A closed thread of the conversation as the panel paints it above the thread that continues it. */
60
75
  export interface AssistantEarlierThreadSnapshot {
61
76
  readonly threadId: string;
@@ -199,6 +214,12 @@ export declare class AssistantSystem implements InitializableSystem {
199
214
  * acted, which the server puts in front of the message for the model. The record is taken only
200
215
  * when there is a chat to send it on, because taking it moves its baseline.
201
216
  *
217
+ * The images the user attached go with the message: they are uploaded into the chat's thread
218
+ * first, and the message references them, one image part after its text each. The text part is
219
+ * left out of a message with images only. Each attempt to send uploads them again, into the
220
+ * thread it sends on. An upload that fails leaves the message unsent, with the failure as the
221
+ * error of the chat; `onSent` is not called then.
222
+ *
202
223
  * A thread can end in a tool call that nothing will answer: its reply parked while no page was
203
224
  * open, or the page that ran the tool was left before the result was sent. The client refuses to
204
225
  * send while it waits on such a call, so the wait is given up first, and the server records for
@@ -209,20 +230,28 @@ export declare class AssistantSystem implements InitializableSystem {
209
230
  *
210
231
  * The chat can be out of date about that: the thread reached its size limit with the reply before
211
232
  * this message, or the assistant's setup changed while the configurator stayed open. The server
212
- * then refuses the message and says that the thread cannot be continued. The message stays
213
- * painted while the thread is resumed, and is then sent again on the new thread, with the change
214
- * record it was first sent with. This happens once: a refusal of the second attempt is the
215
- * failure it is. When resuming fails, the message is left as any message that failed to send:
216
- * painted, with the failure as the error of the chat.
233
+ * then refuses the message, or the upload of one of its images, and says that the thread cannot
234
+ * be continued. The thread is resumed, and the message is then sent again on the new thread, its
235
+ * images uploaded again, with the change record it was first sent with. This happens once: a
236
+ * refusal of the second attempt is the failure it is. When resuming fails, a refused message is
237
+ * left as any message that failed to send: painted, with the failure as the error of the chat; a
238
+ * refused upload leaves the message unsent. When the images of a refused message cannot be
239
+ * uploaded into the new thread, the message is given back through `onUnsent`.
240
+ *
241
+ * A chat that ends while the images upload, because another configuration was loaded or the
242
+ * thread is read again, sends nothing.
217
243
  *
218
244
  * Accepted: when the server refuses the compaction itself with a conflict, because another tab
219
245
  * compacted the thread or a run is still running, the thread is read again (see `resume`) and
220
246
  * the refused message is gone without a notice. It takes two tabs or a run racing the send, and
221
247
  * the user writes the message again, as after any reload of a thread that failed.
222
248
  *
249
+ * Accepted: images uploaded by an attempt that is not sent stay stored in that thread, which no
250
+ * message references.
251
+ *
223
252
  * It never rejects: a message the client could not send is reported as the error of the chat.
224
253
  */
225
- send: (content: string) => Promise<void>;
254
+ send: (content: string, images?: ReadonlyArray<Blob>, { onSent, onUnsent }?: AssistantSendOptions) => Promise<void>;
226
255
  /**
227
256
  * Makes the chat ready for the next message. A thread the server no longer lets this session
228
257
  * continue, because the assistant's setup changed since it was started or the thread reached
@@ -276,6 +305,22 @@ export declare class AssistantSystem implements InitializableSystem {
276
305
  * is no such message. A refused continuation of a reply is not one: its message is stored.
277
306
  */
278
307
  private _findRefusedMessageIndex;
308
+ /** The content of a user message: its text, when it has any, and a reference to each of its images. */
309
+ private _messageContent;
310
+ /**
311
+ * Uploads the images of a message into the chat's thread, in their order, and resolves with their
312
+ * ids. Resolves with `'refused'` when the server refused an upload because the thread cannot be
313
+ * continued, and marks the chat so; then with `null` for any other failure, which is reported as
314
+ * the error of the chat. It never rejects.
315
+ */
316
+ private _uploadImages;
317
+ /**
318
+ * Uploads the images of a message into the thread that was resumed for it. A message the chat
319
+ * refused shows nowhere meanwhile, so the chat stays resuming until the upload is over: nothing
320
+ * else is sent ahead of it.
321
+ */
322
+ private _uploadSuccessorImages;
323
+ private _reportUploadFailure;
279
324
  private _sendOn;
280
325
  private _resume;
281
326
  /**
@@ -1 +1 @@
1
- import{ChatClient as e,fetchServerSentEvents as t}from"@tanstack/ai-client";import{BehaviorSubject as s}from"rxjs";import{skip as i}from"rxjs/operators";import{isShallowEqual as a}from"@salsita-ai/common/utils";import{AssistantRequestError as r}from"#package/client";import{createBrowserDetailsClientTool as n}from"./browser-details.js";import{ChangeRecorder as o}from"./change-recorder.js";import{createApplyClientTool as l,createQueryClientTool as h,toToolResult as d}from"./graphql-tools.js";let c=Object.freeze({messages:Object.freeze([]),isLoading:!1,error:void 0,failedStatus:void 0,isContinuable:!0,isLoaded:!1,isResuming:!1,earlierThreads:Object.freeze([]),hasEarlierThread:!1,isLoadingEarlierThread:!1}),u=Object.freeze({open:!1,hasUnreadReply:!1,isInputFocused:!1}),_=Object.freeze({}),g=d({results:[],committed:!1,sideEffects:[],screenshots:new Map,message:"Nothing was run, because the user closed the configurator while this reply was being written. Do not call any more tools in this reply and end it now. The tools work again as soon as the user writes the next message."}),f=e=>{if(e.getError())return!0;let t=e.getMessages().at(-1)?.parts.at(-1);return t?.type!=="tool-call"&&t?.type!=="tool-result"};export class AssistantSystem{_context;_tools;_chat=new s(c);_panel=new s(u);_activation=null;_current=null;_finishing=new Set;_olderThreadId=null;_resuming=null;_refused=null;_firstAttempt=null;_chain={};_loadingThreadId=null;_recorder;_recording=null;_applyToolCallIds=new WeakMap;_undoTipToolCallId=new s(void 0);_screenshotUrls=new Map;constructor(e){this._context=e;let{configuratorExtensionSelectors:t,domainContextSelectors:s,domainServicesSelectors:i,getAssistantSetup:a}=e;this._recorder=new o({maxEntities:30},{readers:{selectedEntityId:e=>s.getNavigationSystem().getActiveSelectionState(e),navigationState:e=>s.getNavigationSystem().getActiveNavigationState(e),viewState:e=>s.getNavigationSystem().getActiveViewState(e),toolState:e=>s.getNavigationSystem().getActiveToolState(e)},getExposedFields:()=>a().manifest?.fields??_,resolveLocalizable:e=>i.getResolveLocalizable()(e)});let r={getGraphQLSystem:()=>t.getGraphQLSystem(),getStoreSystem:()=>s.getStoreSystem(),getActiveMode:()=>s.getActiveMode(),getIsViewMode:()=>s.getIsViewMode(),clearChanges:()=>this._recorder.clear(this._committedState()),rememberCommit:(e,t)=>{this._applyToolCallIds.set(t,e),this._refreshUndoTip()}};this._tools=[n(),h(r),l(r)],s.getUndoSystem().tip$.subscribe(this._refreshUndoTip)}chat$=this._chat;panel$=this._panel;undoTipToolCallId$=this._undoTipToolCallId;getSessionManifest=()=>this._context.getAssistantSetup().manifest;initialize=()=>{let{committed:e}=this._context.domainContextSelectors.getStoreSystem().stateSlices;this._recording??=e.pipe(i(1)).subscribe(this._recorder.record),this._recorder.reset(e.value.state),this._endChat(),this._patchPanel(u),this._releaseScreenshotUrls(),this._activation&&this._startClient()};activate=()=>{this._endChat();let e={};return this._activation=e,this._startClient(),()=>{this._activation===e&&(this._activation=null,this._endChat())}};send=async e=>{if(!this._chat.value.isContinuable&&!await this.resume())return;let t=this._current;if(!t)return;let s={changes:this._recorder.take(this._committedState())};this._firstAttempt=t;try{await this._sendOn(t,e,s);let i=this._findRefusedMessageIndex(t);if(-1===i)return;this._refused={chat:t,index:i}}finally{this._firstAttempt===t&&(this._firstAttempt=null)}if(!await this.resume())return;let i=this._current;i&&await this._sendOn(i,e,s)};resume=async()=>{let e=this._current;if(!e)return!1;if(this._chat.value.isContinuable)return!0;if(this._resuming)return this._resuming;let t=this._resume(e).finally(()=>{this._resuming===t&&(this._resuming=null)});return this._resuming=t,t};loadScreenshotUrl=e=>{let t=this._screenshotUrls.get(e);if(t)return t;let s=this._current;if(!s)return Promise.reject(Error(`The screenshot ${e} cannot be read, because the assistant chat is not active. Open the assistant panel of the configuration first.`));let i=this._screenshotUrls,a=s.authorizedClient.getAssistantImage(s.configurationId,e).then(e=>URL.createObjectURL(e));return i.set(e,a),a.catch(()=>{i.get(e)===a&&i.delete(e)}),a};loadEarlierThread=async()=>{let e=this._current,t=this._olderThreadId;if(!e||null===t||this._loadingThreadId===t)return;let s=this._chain;this._loadingThreadId=t,this._chat.next({...this._chat.value,isLoadingEarlierThread:!0});try{let i=await e.authorizedClient.getAssistantEarlierThread(e.configurationId,t,50);if(this._chain!==s||this._olderThreadId!==t)return;this._olderThreadId=i.previousThreadId,this._chat.next({...this._chat.value,earlierThreads:[{threadId:t,messages:i.messages},...this._chat.value.earlierThreads],hasEarlierThread:null!==i.previousThreadId})}catch(e){this._context.domainServicesSelectors.getLogger().warn("Could not load the earlier assistant conversation",{error:e})}finally{this._chain===s&&this._loadingThreadId===t&&(this._loadingThreadId=null,this._chat.next({...this._chat.value,isLoadingEarlierThread:!1}))}};stop=async()=>{let e=this._current;if(!e)return;let t=e.client.getCurrentRunId();if(e.client.stop(),null!=t)try{let s=e.getConnection();await fetch(`${s.url}/runs/${encodeURIComponent(t)}/cancel`,{method:"POST",headers:await s.headers()})}catch(e){this._context.domainServicesSelectors.getLogger().warn("Could not cancel the assistant run on the server",{error:e})}};reloadThread=()=>{if(!this._activation)return;let e=this._retireChat();e?.client.stop(),e?.dispose(),this._recorder.reset(this._committedState()),this._startClient()};undoToolCalls=e=>{let t=this._context.domainContextSelectors.getUndoSystem(),s=()=>{let t=this._findTipToolCallId();return void 0!==t&&e.has(t)};for(;s();)t.undo()};setOpen=e=>{this._patchPanel(e?{open:e,hasUnreadReply:!1}:{open:e,isInputFocused:!1})};setInputFocused=e=>{this._patchPanel({isInputFocused:e})};_findRefusedMessageIndex=e=>{var t;let s,{failedStatus:i,isContinuable:a}=this._chat.value;return this._firstAttempt===e&&e.generation.active&&409===i&&!a?(s=(t=e.client.getMessages()).map(e=>e.role).lastIndexOf("user"),t.slice(s+1).every(e=>0===e.parts.length)?s:-1):-1};_sendOn=async(e,t,s)=>{let{client:i}=e;i.getIsLoading()||null===i.getResumeState()||i.stop();try{await i.sendMessage({content:t,metadata:s})}catch(s){let t=s instanceof Error?s:Error(String(s));e.generation.active&&this._chat.next({...this._chat.value,error:t}),this._context.domainServicesSelectors.getLogger().error("The assistant message could not be sent",{},t)}};_resume=async e=>{this._chat.next({...this._chat.value,isResuming:!0,error:void 0,failedStatus:void 0});try{let{previousThreadId:t}=await e.authorizedClient.compactAssistantThread(e.configurationId);if(!e.generation.active)return!1;let{messages:s,earlierThreads:i,hasEarlierThread:a}=this._chat.value,r=this._refused?.chat===e?s.slice(0,this._refused.index):s;return e.generation.active=!1,this._current=null,e.client.stop(),e.dispose(),this._chat.next({...c,earlierThreads:[...i,{threadId:t,messages:r}],hasEarlierThread:a,isLoadingEarlierThread:null!==this._loadingThreadId}),this._startClient(),!0}catch(s){let t=s instanceof Error?s:Error(String(s));if(t instanceof r&&409===t.status)return e.generation.active&&this.reloadThread(),!1;return e.generation.active&&this._chat.next({...this._chat.value,isResuming:!1,error:t,failedStatus:t instanceof r?t.status:void 0}),this._context.domainServicesSelectors.getLogger().error("The assistant thread could not be resumed",{},t),!1}};_findTipToolCallId=()=>{let e=this._context.domainContextSelectors.getUndoSystem(),t=e.tip$.value?.committedState;return void 0!==t&&e.canUndo()?this._applyToolCallIds.get(t):void 0};_refreshUndoTip=()=>{let e=this._findTipToolCallId();e!==this._undoTipToolCallId.value&&this._undoTipToolCallId.next(e)};_committedState=()=>this._context.domainContextSelectors.getStoreSystem().stateSlices.committed.value.state;_patchPanel=e=>{let t={...this._panel.value,...e};a(t,this._panel.value)||this._panel.next(t)};_takeOverThread=e=>{for(let t of this._finishing)t.configurationId===e&&(t.client.stop(),t.dispose())};_startClient=()=>{let s={active:!0},i=this._context.getConfigurationId();this._takeOverThread(i);let r=this._context.getAuthorizedClient(),n=()=>{if(s.active){let{manifest:e,error:t}=this._context.getAssistantSetup();if(t)throw t;if(!e)throw Error("The assistant is disabled for this session.")}return r.getAssistantChatConnection(i)},o=e=>{if(!s.active)return;let t={...this._chat.value,...e};a(t,this._chat.value)||this._chat.next(t)},l=async(e,t)=>{let i=await fetch(e,t).finally(()=>o({isLoaded:!0})),a=i.headers.get("x-assistant-thread-continuable");return null!=a&&i.ok&&s.active&&0===this._chat.value.earlierThreads.length&&(this._olderThreadId=i.headers.get("x-assistant-previous-thread")),o({failedStatus:i.ok?void 0:i.status,...null!=a&&{isContinuable:"false"!==a,hasEarlierThread:null!==this._olderThreadId}}),i},h=async()=>({headers:await n().headers(),fetchClient:l}),d=t(()=>n().url,h),c=t(()=>`${n().url}/runs`,h),u=this._tools.map(e=>({...e,execute:(t,i)=>{if(!s.active)return g;let{manifest:a,error:r}=this._context.getAssistantSetup();return r||!a?{error:r?.message??"The assistant is disabled for this session."}:e.execute?.(t,i)}})),_=new e({threadId:`assistant:${i}`,connection:{...d,joinRun:c.joinRun},persistence:!0,history:{pageSize:50},tools:u,onMessagesChange:e=>o({messages:e}),onLoadingChange:e=>{let t=s.active&&this._chat.value.isLoading;o({isLoading:e}),!e&&f(_)&&(s.active?t&&!this._panel.value.open&&this._patchPanel({hasUnreadReply:!0}):p())},onErrorChange:e=>{s.active&&e!==this._chat.value.error&&(!e||-1===this._findRefusedMessageIndex(v))&&(o({error:e}),e&&this._context.domainServicesSelectors.getLogger().error("The assistant request failed",{status:this._chat.value.failedStatus},e))}}),m=!1,p=()=>{m||(m=!0,this._finishing.delete(v),_.dispose())},v={client:_,configurationId:i,generation:s,authorizedClient:r,getConnection:n,dispose:p};this._current=v,_.attach()};_retireChat=()=>{let e=this._current;return this._current=null,e&&(e.generation.active=!1),this._chain={},this._olderThreadId=null,this._resuming=null,this._refused=null,this._loadingThreadId=null,this._chat.value!==c&&this._chat.next(c),e};_releaseScreenshotUrls=()=>{for(let e of this._screenshotUrls.values())e.then(URL.revokeObjectURL,()=>void 0);this._screenshotUrls=new Map};_endChat=()=>{let e=this._retireChat();if(e){if(!e.client.getIsLoading()&&f(e.client))return void e.dispose();this._finishing.add(e)}}}
1
+ import{ChatClient as e,fetchServerSentEvents as t}from"@tanstack/ai-client";import{BehaviorSubject as i}from"rxjs";import{skip as s}from"rxjs/operators";import{isShallowEqual as a}from"@salsita-ai/common/utils";import{assistantImageReference as r}from"@salsita-ai/contracts/assistant";import{AssistantRequestError as n}from"#package/client";import{createBrowserDetailsClientTool as o}from"./browser-details.js";import{ChangeRecorder as l}from"./change-recorder.js";import{createApplyClientTool as h,createQueryClientTool as c,toToolResult as d}from"./graphql-tools.js";let u=Object.freeze({messages:Object.freeze([]),isLoading:!1,error:void 0,failedStatus:void 0,isContinuable:!0,isLoaded:!1,isResuming:!1,earlierThreads:Object.freeze([]),hasEarlierThread:!1,isLoadingEarlierThread:!1}),_=Object.freeze({open:!1,hasUnreadReply:!1,isInputFocused:!1}),g=Object.freeze({}),f=d({results:[],committed:!1,sideEffects:[],warnings:[],screenshots:new Map,message:"Nothing was run, because the user closed the configurator while this reply was being written. Do not call any more tools in this reply and end it now. The tools work again as soon as the user writes the next message."}),m=e=>{if(e.getError())return!0;let t=e.getMessages().at(-1)?.parts.at(-1);return t?.type!=="tool-call"&&t?.type!=="tool-result"};export class AssistantSystem{_context;_tools;_chat=new i(u);_panel=new i(_);_activation=null;_current=null;_finishing=new Set;_olderThreadId=null;_resuming=null;_refused=null;_firstAttempt=null;_chain={};_loadingThreadId=null;_recorder;_recording=null;_applyToolCallIds=new WeakMap;_undoTipToolCallId=new i(void 0);_screenshotUrls=new Map;constructor(e){this._context=e;let{configuratorExtensionSelectors:t,domainContextSelectors:i,domainServicesSelectors:s,getAssistantSetup:a}=e;this._recorder=new l({maxEntities:30},{readers:{selectedEntityId:e=>i.getNavigationSystem().getActiveSelectionState(e),navigationState:e=>i.getNavigationSystem().getActiveNavigationState(e),viewState:e=>i.getNavigationSystem().getActiveViewState(e),toolState:e=>i.getNavigationSystem().getActiveToolState(e)},getExposedFields:()=>a().manifest?.fields??g,resolveLocalizable:e=>s.getResolveLocalizable()(e)});let r={getGraphQLSystem:()=>t.getGraphQLSystem(),getStoreSystem:()=>i.getStoreSystem(),getActiveMode:()=>i.getActiveMode(),getIsViewMode:()=>i.getIsViewMode(),clearChanges:()=>this._recorder.clear(this._committedState()),rememberCommit:(e,t)=>{this._applyToolCallIds.set(t,e),this._refreshUndoTip()}};this._tools=[o(),c(r),h(r)],i.getUndoSystem().tip$.subscribe(this._refreshUndoTip)}chat$=this._chat;panel$=this._panel;undoTipToolCallId$=this._undoTipToolCallId;getSessionManifest=()=>this._context.getAssistantSetup().manifest;initialize=()=>{let{committed:e}=this._context.domainContextSelectors.getStoreSystem().stateSlices;this._recording??=e.pipe(s(1)).subscribe(this._recorder.record),this._recorder.reset(e.value.state),this._endChat(),this._patchPanel(_),this._releaseScreenshotUrls(),this._activation&&this._startClient()};activate=()=>{this._endChat();let e={};return this._activation=e,this._startClient(),()=>{this._activation===e&&(this._activation=null,this._endChat())}};send=async(e,t=[],{onSent:i,onUnsent:s}={})=>{if(!this._chat.value.isContinuable&&!await this.resume())return;let a=this._current;if(!a)return;let r={changes:this._recorder.take(this._committedState())},n=()=>this._recorder.reset(this._committedState()),o=!1,l=(t,s)=>(o||(o=!0,i?.()),this._sendOn(t,this._messageContent(e,s),r));this._firstAttempt=a;try{let e=0===t.length?[]:await this._uploadImages(a,t);if(null===e||!a.generation.active)return void n();if("refused"!==e){await l(a,e);let t=this._findRefusedMessageIndex(a);if(-1===t)return;this._refused={chat:a,index:t}}}finally{this._firstAttempt===a&&(this._firstAttempt=null)}if(!await this.resume()){o||n();return}let h=this._current,c=h?await this._uploadSuccessorImages(h,t):null;if(!h||null===c||"refused"===c||!h.generation.active){h&&"refused"===c&&this._reportUploadFailure(h,this._chat.value.error),o&&s?.(),n();return}await l(h,c)};resume=async()=>{let e=this._current;if(!e)return!1;if(this._chat.value.isContinuable)return!0;if(this._resuming)return this._resuming;let t=this._resume(e).finally(()=>{this._resuming===t&&(this._resuming=null)});return this._resuming=t,t};loadScreenshotUrl=e=>{let t=this._screenshotUrls.get(e);if(t)return t;let i=this._current;if(!i)return Promise.reject(Error(`The screenshot ${e} cannot be read, because the assistant chat is not active. Open the assistant panel of the configuration first.`));let s=this._screenshotUrls,a=i.authorizedClient.getAssistantImage(i.configurationId,e).then(e=>URL.createObjectURL(e));return s.set(e,a),a.catch(()=>{s.get(e)===a&&s.delete(e)}),a};loadEarlierThread=async()=>{let e=this._current,t=this._olderThreadId;if(!e||null===t||this._loadingThreadId===t)return;let i=this._chain;this._loadingThreadId=t,this._chat.next({...this._chat.value,isLoadingEarlierThread:!0});try{let s=await e.authorizedClient.getAssistantEarlierThread(e.configurationId,t,50);if(this._chain!==i||this._olderThreadId!==t)return;this._olderThreadId=s.previousThreadId,this._chat.next({...this._chat.value,earlierThreads:[{threadId:t,messages:s.messages},...this._chat.value.earlierThreads],hasEarlierThread:null!==s.previousThreadId})}catch(e){this._context.domainServicesSelectors.getLogger().warn("Could not load the earlier assistant conversation",{error:e})}finally{this._chain===i&&this._loadingThreadId===t&&(this._loadingThreadId=null,this._chat.next({...this._chat.value,isLoadingEarlierThread:!1}))}};stop=async()=>{let e=this._current;if(!e)return;let t=e.client.getCurrentRunId();if(e.client.stop(),null!=t)try{let i=e.getConnection();await fetch(`${i.url}/runs/${encodeURIComponent(t)}/cancel`,{method:"POST",headers:await i.headers()})}catch(e){this._context.domainServicesSelectors.getLogger().warn("Could not cancel the assistant run on the server",{error:e})}};reloadThread=()=>{if(!this._activation)return;let e=this._retireChat();e?.client.stop(),e?.dispose(),this._recorder.reset(this._committedState()),this._startClient()};undoToolCalls=e=>{let t=this._context.domainContextSelectors.getUndoSystem(),i=()=>{let t=this._findTipToolCallId();return void 0!==t&&e.has(t)};for(;i();)t.undo()};setOpen=e=>{this._patchPanel(e?{open:e,hasUnreadReply:!1}:{open:e,isInputFocused:!1})};setInputFocused=e=>{this._patchPanel({isInputFocused:e})};_findRefusedMessageIndex=e=>{var t;let i,{failedStatus:s,isContinuable:a}=this._chat.value;return this._firstAttempt===e&&e.generation.active&&409===s&&!a?(i=(t=e.client.getMessages()).map(e=>e.role).lastIndexOf("user"),t.slice(i+1).every(e=>0===e.parts.length)?i:-1):-1};_messageContent=(e,t)=>0===t.length?e:[...e?[{type:"text",content:e}]:[],...t.map(e=>({type:"image",source:{type:"url",value:r(e)}}))];_uploadImages=async(e,t)=>{if(0===t.length)return[];e.generation.active&&this._chat.next({...this._chat.value,error:void 0,failedStatus:void 0});try{return(await Promise.all(t.map(t=>e.authorizedClient.uploadAssistantImage(e.configurationId,t)))).map(({imageId:e})=>e)}catch(i){let t=i instanceof Error?i:Error(String(i));if(t instanceof n&&t.threadNotContinuable)return e.generation.active&&this._chat.next({...this._chat.value,isContinuable:!1,error:t,failedStatus:t.status}),"refused";return this._reportUploadFailure(e,t),null}};_uploadSuccessorImages=async(e,t)=>{if(0===t.length)return[];this._chat.next({...this._chat.value,isResuming:!0});try{return await this._uploadImages(e,t)}finally{e.generation.active&&this._chat.next({...this._chat.value,isResuming:!1})}};_reportUploadFailure=(e,t)=>{e.generation.active&&this._chat.next({...this._chat.value,error:t,failedStatus:t instanceof n?t.status:void 0}),this._context.domainServicesSelectors.getLogger().error("The images of the assistant message could not be uploaded",{},t)};_sendOn=async(e,t,i)=>{let{client:s}=e;s.getIsLoading()||null===s.getResumeState()||s.stop();try{await s.sendMessage({content:t,metadata:i})}catch(i){let t=i instanceof Error?i:Error(String(i));e.generation.active&&this._chat.next({...this._chat.value,error:t}),this._context.domainServicesSelectors.getLogger().error("The assistant message could not be sent",{},t)}};_resume=async e=>{this._chat.next({...this._chat.value,isResuming:!0,error:void 0,failedStatus:void 0});try{let{previousThreadId:t}=await e.authorizedClient.compactAssistantThread(e.configurationId);if(!e.generation.active)return!1;let{messages:i,earlierThreads:s,hasEarlierThread:a}=this._chat.value,r=this._refused?.chat===e?i.slice(0,this._refused.index):i;return e.generation.active=!1,this._current=null,e.client.stop(),e.dispose(),this._chat.next({...u,earlierThreads:[...s,{threadId:t,messages:r}],hasEarlierThread:a,isLoadingEarlierThread:null!==this._loadingThreadId}),this._startClient(),!0}catch(i){let t=i instanceof Error?i:Error(String(i));if(t instanceof n&&409===t.status)return e.generation.active&&this.reloadThread(),!1;return e.generation.active&&this._chat.next({...this._chat.value,isResuming:!1,error:t,failedStatus:t instanceof n?t.status:void 0}),this._context.domainServicesSelectors.getLogger().error("The assistant thread could not be resumed",{},t),!1}};_findTipToolCallId=()=>{let e=this._context.domainContextSelectors.getUndoSystem(),t=e.tip$.value?.committedState;return void 0!==t&&e.canUndo()?this._applyToolCallIds.get(t):void 0};_refreshUndoTip=()=>{let e=this._findTipToolCallId();e!==this._undoTipToolCallId.value&&this._undoTipToolCallId.next(e)};_committedState=()=>this._context.domainContextSelectors.getStoreSystem().stateSlices.committed.value.state;_patchPanel=e=>{let t={...this._panel.value,...e};a(t,this._panel.value)||this._panel.next(t)};_takeOverThread=e=>{for(let t of this._finishing)t.configurationId===e&&(t.client.stop(),t.dispose())};_startClient=()=>{let i={active:!0},s=this._context.getConfigurationId();this._takeOverThread(s);let r=this._context.getAuthorizedClient(),n=()=>{if(i.active){let{manifest:e,error:t}=this._context.getAssistantSetup();if(t)throw t;if(!e)throw Error("The assistant is disabled for this session.")}return r.getAssistantChatConnection(s)},o=e=>{if(!i.active)return;let t={...this._chat.value,...e};a(t,this._chat.value)||this._chat.next(t)},l=async(e,t)=>{let s=await fetch(e,t).finally(()=>o({isLoaded:!0})),a=s.headers.get("x-assistant-thread-continuable");return null!=a&&s.ok&&i.active&&0===this._chat.value.earlierThreads.length&&(this._olderThreadId=s.headers.get("x-assistant-previous-thread")),o({failedStatus:s.ok?void 0:s.status,...null!=a&&{isContinuable:"false"!==a,hasEarlierThread:null!==this._olderThreadId}}),s},h=async()=>({headers:await n().headers(),fetchClient:l}),c=t(()=>n().url,h),d=t(()=>`${n().url}/runs`,h),u=this._tools.map(e=>({...e,execute:(t,s)=>{if(!i.active)return f;let{manifest:a,error:r}=this._context.getAssistantSetup();return r||!a?{error:r?.message??"The assistant is disabled for this session."}:e.execute?.(t,s)}})),_=new e({threadId:`assistant:${s}`,connection:{...c,joinRun:d.joinRun},persistence:!0,history:{pageSize:50},tools:u,onMessagesChange:e=>o({messages:e}),onLoadingChange:e=>{let t=i.active&&this._chat.value.isLoading;o({isLoading:e}),!e&&m(_)&&(i.active?t&&!this._panel.value.open&&this._patchPanel({hasUnreadReply:!0}):p())},onErrorChange:e=>{i.active&&e!==this._chat.value.error&&(!e||-1===this._findRefusedMessageIndex(v))&&(o({error:e}),e&&this._context.domainServicesSelectors.getLogger().error("The assistant request failed",{status:this._chat.value.failedStatus},e))}}),g=!1,p=()=>{g||(g=!0,this._finishing.delete(v),_.dispose())},v={client:_,configurationId:s,generation:i,authorizedClient:r,getConnection:n,dispose:p};this._current=v,_.attach()};_retireChat=()=>{let e=this._current;return this._current=null,e&&(e.generation.active=!1),this._chain={},this._olderThreadId=null,this._resuming=null,this._refused=null,this._loadingThreadId=null,this._chat.value!==u&&this._chat.next(u),e};_releaseScreenshotUrls=()=>{for(let e of this._screenshotUrls.values())e.then(URL.revokeObjectURL,()=>void 0);this._screenshotUrls=new Map};_endChat=()=>{let e=this._retireChat();if(e){if(!e.client.getIsLoading()&&m(e.client))return void e.dispose();this._finishing.add(e)}}}
@@ -7,7 +7,7 @@ import type { GraphQLExecution, GraphQLSystem } from '../graphql-system/graphql-
7
7
  * mode current at that moment, never against ones captured when its reply began streaming.
8
8
  */
9
9
  export interface AssistantToolDependencies {
10
- readonly getGraphQLSystem: () => Pick<GraphQLSystem, 'prepare' | 'execute' | 'readSideEffects' | 'readScreenshots'>;
10
+ readonly getGraphQLSystem: () => Pick<GraphQLSystem, 'prepare' | 'execute' | 'readSideEffects' | 'readWarnings' | 'readScreenshots'>;
11
11
  readonly getStoreSystem: () => {
12
12
  readonly isInitialized: boolean;
13
13
  readonly stateSlices: {
@@ -45,12 +45,16 @@ export declare const toToolResult: ({ preparedState, screenshots, ...execution }
45
45
  /**
46
46
  * Browser implementation of the assistant's `query` tool: prepares the operations from the
47
47
  * committed state and drops their emissions, so mutations in the list show a hypothetical state and
48
- * the configuration, the undo stack and the saved revision stay as they were. The side effects of
49
- * the dropped emissions are still reported, as what the changes would do.
48
+ * the configuration, the undo stack and the saved revision stay as they were. The side effects and
49
+ * the new warnings of the dropped emissions are still reported, as what the changes would do.
50
50
  */
51
51
  export declare const createQueryClientTool: (dependencies: AssistantToolDependencies) => import("@tanstack/ai").ClientTool<{
52
52
  type: string;
53
53
  properties: {
54
+ title: {
55
+ type: string;
56
+ description: string;
57
+ };
54
58
  operations: {
55
59
  type: string;
56
60
  minItems: number;
@@ -80,6 +84,10 @@ export declare const createQueryClientTool: (dependencies: AssistantToolDependen
80
84
  inputSchema: {
81
85
  type: string;
82
86
  properties: {
87
+ title: {
88
+ type: string;
89
+ description: string;
90
+ };
83
91
  operations: {
84
92
  type: string;
85
93
  minItems: number;
@@ -133,6 +141,10 @@ export declare const createQueryClientTool: (dependencies: AssistantToolDependen
133
141
  export declare const createApplyClientTool: (dependencies: AssistantToolDependencies) => import("@tanstack/ai").ClientTool<{
134
142
  type: string;
135
143
  properties: {
144
+ title: {
145
+ type: string;
146
+ description: string;
147
+ };
136
148
  operations: {
137
149
  type: string;
138
150
  minItems: number;
@@ -162,6 +174,10 @@ export declare const createApplyClientTool: (dependencies: AssistantToolDependen
162
174
  inputSchema: {
163
175
  type: string;
164
176
  properties: {
177
+ title: {
178
+ type: string;
179
+ description: string;
180
+ };
165
181
  operations: {
166
182
  type: string;
167
183
  minItems: number;
@@ -1 +1 @@
1
- import{AssistantGraphQLToolInput as e,applyTool as t,assistantImageReference as o,queryTool as i}from"@salsita-ai/contracts/assistant";let a=e=>({results:[],committed:!1,message:e,sideEffects:[],screenshots:new Map});export const toToolResult=({preparedState:e,screenshots:t,...i})=>[{type:"text",content:JSON.stringify(i)},...[...t].flatMap(([e,{imageId:t}])=>[{type:"text",content:e},{type:"image",source:{type:"url",value:o(t)}}])];let s=t=>{let o=e.safeParse(t);if(!o.success){let e=o.error.issues.map(e=>`${e.path.join(".")}: ${e.message}`).join("; ");return{ok:!1,refusal:a(`Nothing was run, because the tool input is not a list of operations (${e}). Send { "operations": [{ "query": "<one GraphQL operation>" }] } with at least one item.`)}}return{ok:!0,operations:o.data.operations.map(({query:e,variables:t,operationName:o})=>({document:e,variables:t??void 0,operationName:o??void 0}))}};export const createQueryClientTool=e=>i.client(async t=>{let o=s(t);if(!o.ok)return toToolResult(o.refusal);let i=e.getStoreSystem();if(!i.isInitialized)return toToolResult(a("Nothing was run, because the configuration is not loaded yet, so there is no state to query. Call the tool again once the configurator has finished loading."));let n=e.getGraphQLSystem(),r=await n.prepare(i.stateSlices.committed.value.state,o.operations);return toToolResult({results:r.map(({result:e})=>e),committed:!1,sideEffects:n.readSideEffects(r),screenshots:n.readScreenshots(r)})});export const createApplyClientTool=e=>t.client(async(t,o)=>{if("finalize"===e.getActiveMode())return toToolResult(a("Nothing was run, because changes cannot be applied in this session: the user may view this configuration but not change it. The query tool still works here, including mutations, to show what a change would do without keeping it."));if(e.getIsViewMode())return toToolResult(a("Nothing was run, because the configuration is read-only right now: the user may view it but not change it. The query tool still works here, including mutations, to show what a change would do without keeping it. Call apply again only once the configuration is editable."));let i=s(t);if(!i.ok)return toToolResult(i.refusal);let n=await e.getGraphQLSystem().execute(i.operations),r=o?.toolCallId;return void 0!==r&&void 0!==n.preparedState&&e.rememberCommit(r,n.preparedState),n.committed&&e.clearChanges(),toToolResult(n)});
1
+ import{AssistantGraphQLToolInput as e,applyTool as t,assistantImageReference as o,queryTool as a}from"@salsita-ai/contracts/assistant";let i=e=>({results:[],committed:!1,message:e,sideEffects:[],screenshots:new Map,warnings:[]});export const toToolResult=({preparedState:e,screenshots:t,...a})=>[{type:"text",content:JSON.stringify(a)},...[...t].flatMap(([e,{imageId:t}])=>[{type:"text",content:e},{type:"image",source:{type:"url",value:o(t)}}])];let s=t=>{let o=e.safeParse(t);if(!o.success){let e=o.error.issues.map(e=>`${e.path.join(".")}: ${e.message}`).join("; ");return{ok:!1,refusal:i(`Nothing was run, because the tool input is not a list of operations (${e}). Send { "operations": [{ "query": "<one GraphQL operation>" }] } with at least one item.`)}}return{ok:!0,operations:o.data.operations.map(({query:e,variables:t,operationName:o})=>({document:e,variables:t??void 0,operationName:o??void 0}))}};export const createQueryClientTool=e=>a.client(async t=>{let o=s(t);if(!o.ok)return toToolResult(o.refusal);let a=e.getStoreSystem();if(!a.isInitialized)return toToolResult(i("Nothing was run, because the configuration is not loaded yet, so there is no state to query. Call the tool again once the configurator has finished loading."));let n=e.getGraphQLSystem(),r=a.stateSlices.committed.value.state,l=await n.prepare(r,o.operations);return toToolResult({results:l.map(({result:e})=>e),committed:!1,sideEffects:n.readSideEffects(l),screenshots:n.readScreenshots(l),warnings:n.readWarnings(r,l)})});export const createApplyClientTool=e=>t.client(async(t,o)=>{if("finalize"===e.getActiveMode())return toToolResult(i("Nothing was run, because changes cannot be applied in this session: the user may view this configuration but not change it. The query tool still works here, including mutations, to show what a change would do without keeping it."));if(e.getIsViewMode())return toToolResult(i("Nothing was run, because the configuration is read-only right now: the user may view it but not change it. The query tool still works here, including mutations, to show what a change would do without keeping it. Call apply again only once the configuration is editable."));let a=s(t);if(!a.ok)return toToolResult(a.refusal);let n=await e.getGraphQLSystem().execute(a.operations),r=o?.toolCallId;return void 0!==r&&void 0!==n.preparedState&&e.rememberCommit(r,n.preparedState),n.committed&&e.clearChanges(),toToolResult(n)});
@@ -1,4 +1,5 @@
1
- import { type $DomainEntity, type AssistantManifest, type AssistantRecipeContext, type DomainEntity, type DomainEntityId, type DomainState, type EntityId, type StateUpdate, type StateUpdateEmission } from '#package/domain';
1
+ import { type $DomainEntity, type AssistantManifest, type AssistantRecipeContext, type DomainEntity, type DomainEntityId, type DomainState, type StateUpdate, type StateUpdateEmission, type StateValidationResult } from '#package/domain';
2
+ import { type ViolationEntry } from './violations.js';
2
3
  type AnyDomainState = DomainState<DomainEntity<string>>;
3
4
  type AnyStateUpdate = StateUpdate<DomainEntity<string>, DomainEntity<string>>;
4
5
  /** An entity and the state it was read on, which everything under its `meta` field resolves against. */
@@ -27,76 +28,89 @@ export interface EntityMetaContext {
27
28
  readonly takeScreenshot: (source: EntityMetaSource, view: string) => Promise<{
28
29
  readonly image: string;
29
30
  } | null>;
30
- }
31
- /** One reason a dry-run reports for a change that cannot be made; a violation can sit on a virtual entity. */
32
- interface DryRunError {
33
- readonly type: string;
34
- readonly entityId: EntityId<DomainEntity<string>> | null;
35
- readonly message: string | null;
31
+ /**
32
+ * Validates a state: the one an entity was read on, for its warnings, or the one a dry-run ran on,
33
+ * whose warnings the dry-run's own are compared with.
34
+ */
35
+ readonly validateState: (state: AnyDomainState) => StateValidationResult<DomainEntity<string>, string>;
36
36
  }
37
37
  /**
38
38
  * The value of an entity's `meta` field: its built-ins, resolved lazily against the state the entity
39
- * was read on. `childRecipes` and `replaceRecipes` list the manifest's recipe groups of their kind
40
- * that are active on the entity there; each options edge lists the choices of its field there, or `null` when its component is not active;
41
- * `screenshot` renders the entity there.
39
+ * was read on. `childRecipes` and `replaceRecipes` hold one field per manifest recipe group of their
40
+ * kind, read only when selected, `null` when the group is not active on the entity there; each
41
+ * options edge lists the choices of its field there, or `null` when its component is not active;
42
+ * `screenshot` renders the entity there, and `warnings` lists the warnings and notices the entity holds there.
42
43
  */
43
44
  export declare const createEntityMeta: (source: EntityMetaSource, context: EntityMetaContext) => {
44
45
  childRecipes: () => {
45
- groupId: string;
46
- name: string;
47
- description: string | null;
48
- recipes: {
49
- key: string;
46
+ [k: string]: () => {
47
+ groupId: string;
50
48
  name: string;
51
49
  description: string | null;
52
- imageUrl: string | null;
53
- dryRun: () => {
54
- ok: boolean;
55
- root: null;
56
- changedEntities: never[];
57
- deletedEntityIds: never[];
58
- sideEffects: never[];
59
- errors: readonly DryRunError[];
60
- } | {
61
- ok: boolean;
62
- root: unknown;
63
- changedEntities: {}[];
64
- deletedEntityIds: DomainEntityId<string>[];
65
- sideEffects: readonly string[];
66
- errors: never[];
67
- } | null;
68
- }[];
69
- }[];
50
+ recipes: ({ keys }: {
51
+ readonly keys?: readonly string[] | null;
52
+ }) => {
53
+ key: string;
54
+ name: string;
55
+ description: string | null;
56
+ imageUrl: string | null;
57
+ dryRun: () => {
58
+ ok: boolean;
59
+ root: null;
60
+ changedEntities: never[];
61
+ deletedEntityIds: never[];
62
+ sideEffects: never[];
63
+ warnings: never[];
64
+ errors: readonly ViolationEntry[];
65
+ } | {
66
+ ok: boolean;
67
+ root: unknown;
68
+ changedEntities: {}[];
69
+ deletedEntityIds: DomainEntityId<string>[];
70
+ sideEffects: readonly string[];
71
+ warnings: () => readonly import("./violations.js").AssistantWarning[];
72
+ errors: never[];
73
+ } | null;
74
+ }[];
75
+ } | null;
76
+ };
70
77
  replaceRecipes: () => {
71
- groupId: string;
72
- name: string;
73
- description: string | null;
74
- recipes: {
75
- key: string;
78
+ [k: string]: () => {
79
+ groupId: string;
76
80
  name: string;
77
81
  description: string | null;
78
- imageUrl: string | null;
79
- dryRun: () => {
80
- ok: boolean;
81
- root: null;
82
- changedEntities: never[];
83
- deletedEntityIds: never[];
84
- sideEffects: never[];
85
- errors: readonly DryRunError[];
86
- } | {
87
- ok: boolean;
88
- root: unknown;
89
- changedEntities: {}[];
90
- deletedEntityIds: DomainEntityId<string>[];
91
- sideEffects: readonly string[];
92
- errors: never[];
93
- } | null;
94
- }[];
95
- }[];
82
+ recipes: ({ keys }: {
83
+ readonly keys?: readonly string[] | null;
84
+ }) => {
85
+ key: string;
86
+ name: string;
87
+ description: string | null;
88
+ imageUrl: string | null;
89
+ dryRun: () => {
90
+ ok: boolean;
91
+ root: null;
92
+ changedEntities: never[];
93
+ deletedEntityIds: never[];
94
+ sideEffects: never[];
95
+ warnings: never[];
96
+ errors: readonly ViolationEntry[];
97
+ } | {
98
+ ok: boolean;
99
+ root: unknown;
100
+ changedEntities: {}[];
101
+ deletedEntityIds: DomainEntityId<string>[];
102
+ sideEffects: readonly string[];
103
+ warnings: () => readonly import("./violations.js").AssistantWarning[];
104
+ errors: never[];
105
+ } | null;
106
+ }[];
107
+ } | null;
108
+ };
96
109
  screenshot: ({ view }: {
97
110
  readonly view: string;
98
111
  }) => Promise<{
99
112
  readonly image: string;
100
113
  } | null>;
114
+ warnings: () => readonly import("./violations.js").AssistantWarning[];
101
115
  };
102
116
  export {};
@@ -1 +1 @@
1
- import{findAssistantFieldOptions as e,findAssistantRecipeGroups as t,modifyEntityUpdateTag as i,prepareAssistantRecipeUpdates as r,readAssistantFieldOptions as n,readAssistantRecipeGroup as o,systemUpdateFactory as s}from"#package/domain";import{readSideEffects as a}from"./side-effects.js";let d=e=>({ok:!1,root:null,changedEntities:[],deletedEntityIds:[],sideEffects:[],errors:e}),l=(e,{state:t},{recipes:i,prepareStateEmission:r,find$Entity:n})=>{let{validity:o,state:s,updates:l}=r(e,t,"committed");if(o.valid){let e=new Map(t.entities.map(e=>[e.id,e])),r=new Set(s.entities.map(e=>e.id));return{ok:!0,root:n(s.rootEntityId,s),changedEntities:s.entities.filter(t=>e.get(t.id)!==t).flatMap(e=>n(e.id,s)??[]),deletedEntityIds:t.entities.map(e=>e.id).filter(e=>!r.has(e)),sideEffects:a(l,i.resolveLocalizable),errors:[]}}return d("uncaught"===o.severity?[{type:"uncaught",entityId:null,message:o.error.message}]:o.entityViolations.filter(({violation:e})=>e.severity===o.severity).map(({entityId:e,violation:t})=>({type:t.type,entityId:e,message:void 0===t.message?null:i.resolveLocalizable(t.message)})))};export const createEntityMeta=(a,u)=>{let c=e=>()=>t(u.manifest,e,a.entity.type).flatMap(t=>{let i=o(e,t,a.entity.id,a.state,u.recipes);return i?[((e,t,i)=>{let{group:n,label:o,description:s,recipes:a}=e,{resolveLocalizable:u}=i.recipes;return{groupId:n.groupId,name:void 0===o?n.instanceName:u(o),description:n.description??(void 0===s?null:u(s)),recipes:a.map(n=>((e,t,i,n)=>{let{key:o,item:s}=e,{resolveLocalizable:a}=n.recipes;return{key:o,name:a(s.title),description:void 0===s.description?null:a(s.description),imageUrl:void 0===s.thumbnailUrl?null:a(s.thumbnailUrl),dryRun:()=>t.group.dryRuns?((e,t,i,n)=>{let{updates:o,error:s}=((e,t,{entity:i,state:n},{recipes:o})=>{try{return{updates:r(e,t,i.id,n,o),error:void 0}}catch(e){if("child"===t.target.kind)throw e;return{updates:void 0,error:e instanceof Error?e.message:String(e)}}})(e,t,i,n);return void 0===o?d([{type:"uncaught",entityId:null,message:s}]):l(o,i,n)})(e,t,i,n):null}})(n,e,t,i))}})(i,a,u)]:[]});return{...Object.fromEntries(e(u.manifest,a.entity.type).map(e=>[e.edgeName,()=>n(e,a.entity.id,a.state,u.recipes)?.map(t=>({...t,dryRun:()=>e.dryRuns?(({field:e},{value:t},r,n)=>{let{entity:o}=r,a=Object.entries(Object.entries(n.manifest.writableFields??{}).find(([e])=>e===o.type)?.[1]??{}).find(([t])=>t===e)?.[1];if(void 0===a)throw Error(`The options of "${e}" on "${o.id}" cannot be dry-run: the schema lists them, but the configurator has no writable field "${e}" on ${o.type}. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let u=r.state.entities.find(e=>e.id===o.id);if(!u)throw Error(`The options of "${e}" on "${o.id}" cannot be dry-run: entity "${o.id}" does not exist. It may have been deleted by an earlier operation or field. Query the current entities and use an id they return.`);let c={[a]:t},p=n.validateEntity({...u,...c});return p.success?l([s.DomainEntityModification({entityId:o.id,stateDelta:c,updateTag:i})],r,n):d([{type:"uncaught",entityId:o.id,message:`Writing ${JSON.stringify(t)} to "${e}" would make "${o.id}" an invalid ${o.type}: ${p.errors.join("; ")}. The option comes from the configurator and cannot be corrected from here, so do not write it.`}])})(e,t,a,u):null}))??null])),childRecipes:c("child"),replaceRecipes:c("replace"),screenshot:({view:e})=>u.takeScreenshot(a,e)}};
1
+ import e from"lodash-es/isEqual.js";import{findAssistantFieldOptions as t,findAssistantRecipeGroups as i,modifyEntityUpdateTag as r,prepareAssistantRecipeUpdates as n,readAssistantFieldOptions as o,readAssistantRecipeGroup as a,systemUpdateFactory as s}from"#package/domain";import{readSideEffects as d}from"./side-effects.js";import{readEntityWarnings as l,readStateWarnings as c,readViolationEntries as u}from"./violations.js";let p=e=>({ok:!1,root:null,changedEntities:[],deletedEntityIds:[],sideEffects:[],warnings:[],errors:e}),m=(e,{state:t},{recipes:i,prepareStateEmission:r,find$Entity:n,validateState:o})=>{let{validity:a,state:s,updates:l}=r(e,t,"committed");if(a.valid){let e=new Map(t.entities.map(e=>[e.id,e])),r=new Set(s.entities.map(e=>e.id));return{ok:!0,root:n(s.rootEntityId,s),changedEntities:s.entities.filter(t=>e.get(t.id)!==t).flatMap(e=>n(e.id,s)??[]),deletedEntityIds:t.entities.map(e=>e.id).filter(e=>!r.has(e)),sideEffects:d(l,i.resolveLocalizable),warnings:()=>c(a,o(t),i.resolveLocalizable),errors:[]}}return p(u(a,i.resolveLocalizable))};export const createEntityMeta=(d,c)=>{let u=e=>()=>Object.fromEntries(i(c.manifest,e,d.entity.type).map(t=>[t.groupId,()=>{let i=a(e,t,d.entity.id,d.state,c.recipes);return i?((e,t,i)=>{let{group:r,label:o,description:a,recipes:s}=e,{resolveLocalizable:d}=i.recipes;return{groupId:r.groupId,name:void 0===o?r.instanceName:d(o),description:void 0===a?null:d(a),recipes:({keys:r})=>s.filter(e=>!r||r.includes(e.key)).map(r=>((e,t,i,r)=>{let{key:o,item:a}=e,{resolveLocalizable:s}=r.recipes;return{key:o,name:s(a.title),description:void 0===a.description?null:s(a.description),imageUrl:void 0===a.thumbnailUrl?null:s(a.thumbnailUrl),dryRun:()=>t.group.dryRuns?((e,t,i,r)=>{let{updates:o,error:a}=((e,t,{entity:i,state:r},{recipes:o})=>{try{return{updates:n(e,t,i.id,r,o),error:void 0}}catch(e){if("child"===t.target.kind)throw e;return{updates:void 0,error:e instanceof Error?e.message:String(e)}}})(e,t,i,r);return void 0===o?p([{type:"uncaught",entityId:null,message:a}]):m(o,i,r)})(e,t,i,r):null}})(r,e,t,i))}})(i,d,c):null}]));return{...Object.fromEntries(t(c.manifest,d.entity.type).map(t=>[t.edgeName,({values:i})=>o(t,d.entity.id,d.state,c.recipes)?.filter(t=>!i||i.some(i=>e(i,t.value))).map(e=>({...e,dryRun:()=>t.dryRuns?(({field:e},{value:t},i,n)=>{let{entity:o}=i,a=Object.entries(Object.entries(n.manifest.writableFields??{}).find(([e])=>e===o.type)?.[1]??{}).find(([t])=>t===e)?.[1];if(void 0===a)throw Error(`The options of "${e}" on "${o.id}" cannot be dry-run: the schema lists them, but the configurator has no writable field "${e}" on ${o.type}. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let d=i.state.entities.find(e=>e.id===o.id);if(!d)throw Error(`The options of "${e}" on "${o.id}" cannot be dry-run: entity "${o.id}" does not exist. It may have been deleted by an earlier operation or field. Query the current entities and use an id they return.`);let l={[a]:t},c=n.validateEntity({...d,...l});return c.success?m([s.DomainEntityModification({entityId:o.id,stateDelta:l,updateTag:r})],i,n):p([{type:"uncaught",entityId:o.id,message:`Writing ${JSON.stringify(t)} to "${e}" would make "${o.id}" an invalid ${o.type}: ${c.errors.join("; ")}. The option comes from the configurator and cannot be corrected from here, so do not write it.`}])})(t,e,d,c):null}))??null])),childRecipes:u("child"),replaceRecipes:u("replace"),screenshot:({view:e})=>c.takeScreenshot(d,e),warnings:()=>l(d.entity.id,c.validateState(d.state),c.recipes.resolveLocalizable)}};
@@ -1,6 +1,7 @@
1
1
  import { type ExecutionResult } from 'graphql';
2
2
  import { type Localizable } from '@salsita-ai/common/utils';
3
3
  import { type $DomainEntity, type AgentScreenshotComponent, type ComponentSnapshot, type DomainContextSelectors, type DomainEntity, type DomainServicesSelectors, type DomainState, type InitializationGeneration, type SessionAssistantSetup, type SpecSelectors, type StateUpdateEmission } from '#package/domain';
4
+ import { type AssistantWarning } from './violations.js';
4
5
  /** One single-operation GraphQL document with its own variables, as executed by {@link GraphQLSystem}. */
5
6
  export interface GraphQLOperation {
6
7
  readonly document: string;
@@ -61,6 +62,12 @@ export interface GraphQLExecution {
61
62
  readonly message?: string;
62
63
  /** What the configurator did, or would do, beyond what the operations asked for, in applied order. */
63
64
  readonly sideEffects: readonly string[];
65
+ /**
66
+ * The warnings and notices the prepared changes newly cause, whether or not they were committed:
67
+ * those of the prepared state that the state the operations started from did not have. Empty when
68
+ * nothing changed or an operation failed.
69
+ */
70
+ readonly warnings: readonly AssistantWarning[];
64
71
  /**
65
72
  * The state the operations prepared, when it was committed or held for the user's approval; a
66
73
  * held state is the one committed if the user approves. A caller can recognize its own change in
@@ -97,6 +104,8 @@ export declare class GraphQLSystem {
97
104
  constructor(_context: GraphQLSystemContext);
98
105
  private readonly _get$Entity;
99
106
  private readonly _find$Entity;
107
+ private readonly _validateState;
108
+ private readonly _validateCached;
100
109
  private readonly _recipeContext;
101
110
  /** Root field resolvers, called by the executor with the field arguments and the operation context. */
102
111
  private readonly _rootValue;
@@ -151,6 +160,12 @@ export declare class GraphQLSystem {
151
160
  readSideEffects: (prepared: readonly PreparedOperation[]) => readonly string[];
152
161
  /** The screenshots of prepared operations, by label, in the order they were taken. */
153
162
  readScreenshots: (prepared: readonly PreparedOperation[]) => ReadonlyMap<string, GraphQLScreenshot>;
163
+ /**
164
+ * The warnings and notices prepared operations newly cause: those of the state their last emission
165
+ * left that `originalState`, the state they were prepared from, did not have. Empty when nothing
166
+ * changed or an operation failed, so the original state is validated only for a change.
167
+ */
168
+ readWarnings: (originalState: AnyDomainState, prepared: readonly PreparedOperation[]) => readonly AssistantWarning[];
154
169
  private readonly _prepareAndCommit;
155
170
  /**
156
171
  * Prepares the operations from the committed state and commits their changes as one emission,