@salsita-ai/sdk 0.50.0-develop.f9cd9b3a12 → 0.50.0-develop.fda84314a5

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 (240) hide show
  1. package/dist/application/index.d.ts +1 -0
  2. package/dist/application/index.js +1 -1
  3. package/dist/application/mount-application.d.ts +1 -1
  4. package/dist/application/mount-application.js +1 -1
  5. package/dist/application/mount-configurator.d.ts +19 -0
  6. package/dist/application/mount-configurator.js +1 -0
  7. package/dist/application/mounted-application-runtime.d.ts +4 -0
  8. package/dist/application/mounted-application-runtime.js +1 -0
  9. package/dist/application/register-web-component.d.ts +2 -0
  10. package/dist/application/register-web-component.js +1 -0
  11. package/dist/application-spec/generate-application/implementations/phx-application-types.d.ts +25 -0
  12. package/dist/application-spec/generate-application/implementations/phx-application-types.js +1 -0
  13. package/dist/application-spec/generate-application/implementations/phx-domain.d.ts +36 -0
  14. package/dist/application-spec/generate-application/implementations/phx-domain.js +1 -0
  15. package/dist/application-spec/generate-application/implementations/phx-model.d.ts +24 -0
  16. package/dist/application-spec/generate-application/implementations/phx-model.js +1 -0
  17. package/dist/application-spec/generate-application/implementations/phx.d.ts +22 -0
  18. package/dist/application-spec/generate-application/implementations/phx.js +1 -0
  19. package/dist/application-spec/generate-application/index.d.ts +2 -0
  20. package/dist/application-spec/generate-application/index.js +1 -1
  21. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +3 -3
  22. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +7 -4
  23. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
  24. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.d.ts +16 -0
  25. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.js +1 -0
  26. package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +17 -4
  27. package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
  28. package/dist/application-spec/generate-application/runtime/application-spec-slice.d.ts +71 -0
  29. package/dist/application-spec/generate-application/runtime/application-spec-slice.js +1 -0
  30. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +3 -3
  31. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +7 -5
  32. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
  33. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.d.ts +16 -0
  34. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.js +1 -0
  35. package/dist/application-spec/generate-application/runtime/create-application.d.ts +57 -0
  36. package/dist/application-spec/generate-application/runtime/create-application.js +1 -0
  37. package/dist/application-spec/generate-application/runtime/index.d.ts +8 -0
  38. package/dist/application-spec/generate-application/runtime/index.js +1 -0
  39. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +9 -3
  40. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
  41. package/dist/application-spec/generate-application/runtime/spec-runtime.d.ts +21 -0
  42. package/dist/application-spec/generate-application/runtime/spec-runtime.js +1 -0
  43. package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +3 -2
  44. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +44 -9
  45. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -1
  46. package/dist/client/authorized-client.d.ts +3 -1
  47. package/dist/client/authorized-client.js +1 -1
  48. package/dist/client/contract.d.ts +17 -0
  49. package/dist/client/index.d.ts +1 -1
  50. package/dist/client/local-authorized-client.d.ts +3 -1
  51. package/dist/client/local-authorized-client.js +1 -1
  52. package/dist/client/memory-authorized-client.d.ts +4 -1
  53. package/dist/client/memory-authorized-client.js +1 -1
  54. package/dist/client/phoenix-api.d.ts +228 -0
  55. package/dist/configurator/ConfiguratorApp.js +1 -1
  56. package/dist/configurator/app-loader-content/index.d.ts +0 -1
  57. package/dist/configurator/app-loader-content/index.js +1 -1
  58. package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
  59. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +13 -0
  60. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  61. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +2 -1
  62. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
  63. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +15 -9
  64. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  65. package/dist/configurator/common/configurator-interface.d.ts +3 -5
  66. package/dist/configurator/common/configurator-interface.js +1 -1
  67. package/dist/configurator/configuration-not-found-page/BuiltInConfigurationNotFoundPage.d.ts +5 -0
  68. package/dist/configurator/configuration-not-found-page/BuiltInConfigurationNotFoundPage.js +1 -0
  69. package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.d.ts +0 -6
  70. package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.js +1 -1
  71. package/dist/configurator/configuration-not-found-page/index.d.ts +2 -2
  72. package/dist/configurator/configuration-not-found-page/index.js +1 -1
  73. package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.d.ts +3 -3
  74. package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.js +1 -1
  75. package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.d.ts +0 -5
  76. package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.js +1 -1
  77. package/dist/configurator/configurator-error-page/index.d.ts +1 -2
  78. package/dist/configurator/configurator-error-page/index.js +1 -1
  79. package/dist/configurator/index.d.ts +9 -2
  80. package/dist/configurator/index.js +1 -1
  81. package/dist/configurator/pages/default-configurator-elements.js +1 -1
  82. package/dist/configurator/pages/error-boundaries/LoadingErrorBoundary.js +1 -1
  83. package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.d.ts +1 -1
  84. package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.js +1 -1
  85. package/dist/configurator/ui/assistant/screenshots/tool-screenshots.d.ts +12 -4
  86. package/dist/configurator/ui/assistant/screenshots/tool-screenshots.js +1 -1
  87. package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.d.ts +8 -0
  88. package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.js +1 -0
  89. package/dist/configurator/ui/configurator-layout/slots/canvas/LayoutCanvas.js +1 -1
  90. package/dist/configurator/ui/configurator-layout/slots/canvas/SharedCanvas.js +1 -1
  91. package/dist/configurator/ui/legacy/layout/common/ReactiveInterfaceLayout.js +1 -1
  92. package/dist/configurator/ui/phoenix-layout-elements/AppLoader.d.ts +0 -7
  93. package/dist/configurator/ui/phoenix-layout-elements/AppLoader.js +2 -2
  94. package/dist/configurator/ui/phoenix-layout-elements/index.d.ts +8 -1
  95. package/dist/configurator/ui/phoenix-layout-elements/index.js +1 -1
  96. package/dist/configurator/ui/preset-layout/PresetUi.d.ts +0 -2
  97. package/dist/configurator/ui/preset-layout/PresetUi.js +1 -1
  98. package/dist/configurator/ui/preset-layout/index.d.ts +6 -1
  99. package/dist/configurator/ui/preset-layout/index.js +1 -1
  100. package/dist/docs/index.json +34 -1
  101. package/dist/docs/layouts/gallery/corvid-drone.mdx +3428 -0
  102. package/dist/docs/layouts/gallery/nightjar-guitar.mdx +3698 -0
  103. package/dist/docs/layouts/gallery/tidepool-aquascape.mdx +5203 -0
  104. package/dist/docs/phoenix/configurator-interface.mdx +4 -3
  105. package/dist/docs/phoenix/sdk-builder-workflow.mdx +4 -2
  106. package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
  107. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
  108. package/dist/domain/application/configurator-builder.d.ts +7 -1
  109. package/dist/domain/application/configurator-builder.js +1 -1
  110. package/dist/domain/application/index.d.ts +1 -1
  111. package/dist/domain/application/index.js +1 -1
  112. package/dist/domain/application/standard-properties.js +1 -1
  113. package/dist/domain/domain-builder.d.ts +9 -3
  114. package/dist/domain/domain-builder.js +1 -1
  115. package/dist/domain/domain-runtime/application.d.ts +39 -0
  116. package/dist/domain/domain-runtime/application.js +1 -0
  117. package/dist/domain/domain-runtime/domain-runtime.d.ts +36 -4
  118. package/dist/domain/domain-runtime/domain-runtime.js +1 -1
  119. package/dist/domain/domain-runtime/environment/initialize.d.ts +1 -1
  120. package/dist/domain/domain-runtime/errors/implementation-error-collector.d.ts +2 -0
  121. package/dist/domain/domain-runtime/errors/implementation-error-collector.js +1 -1
  122. package/dist/domain/domain-runtime/index.d.ts +2 -1
  123. package/dist/domain/domain-runtime/index.js +1 -1
  124. package/dist/domain/domain-runtime/spec/index.d.ts +1 -1
  125. package/dist/domain/domain-runtime/spec/index.js +1 -1
  126. package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +1 -0
  127. package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -1
  128. package/dist/domain/domain-runtime/spec/module-checks/merge-expression-modules.d.ts +23 -0
  129. package/dist/domain/domain-runtime/spec/module-checks/merge-expression-modules.js +1 -0
  130. package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.d.ts +3 -4
  131. package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.js +1 -1
  132. package/dist/domain/domain-runtime/web-component/actions.d.ts +3 -0
  133. package/dist/domain/domain-runtime/web-component/actions.js +1 -1
  134. package/dist/domain/domain-runtime/web-component/initialize.d.ts +1 -0
  135. package/dist/domain/domain-runtime/web-component/initialize.js +1 -1
  136. package/dist/domain/domain-runtime/web-component/selectors.d.ts +2 -0
  137. package/dist/domain/domain-runtime/web-component/selectors.js +1 -1
  138. package/dist/domain/domain-runtime/web-component/types.d.ts +6 -3
  139. package/dist/domain/mocks/create-mock-domain-runtime.d.ts +5 -0
  140. package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
  141. package/dist/editor/domain-editors/apply-spec-update.d.ts +2 -1
  142. package/dist/editor/domain-editors/apply-spec-update.js +1 -1
  143. package/dist/editor/domain-editors/use-implementation-files.d.ts +6 -14
  144. package/dist/editor/domain-editors/use-implementation-files.js +1 -1
  145. package/dist/react-sdk/application-runtime/common-services/analytics/analytics-service.d.ts +1 -1
  146. package/dist/react-sdk/application-runtime/common-services/initialize.d.ts +2 -2
  147. package/dist/react-sdk/application-runtime/hooks/index.d.ts +1 -0
  148. package/dist/react-sdk/application-runtime/hooks/index.js +1 -1
  149. package/dist/react-sdk/application-runtime/hooks/loading/index.d.ts +5 -0
  150. package/dist/react-sdk/application-runtime/hooks/loading/index.js +1 -0
  151. package/dist/react-sdk/application-runtime/hooks/loading/loader-host-context.d.ts +11 -0
  152. package/dist/react-sdk/application-runtime/hooks/loading/loader-host-context.js +1 -0
  153. package/dist/react-sdk/application-runtime/hooks/loading/use-is-awaiting-loading-phase.d.ts +8 -0
  154. package/dist/react-sdk/application-runtime/hooks/loading/use-is-awaiting-loading-phase.js +1 -0
  155. package/dist/react-sdk/application-runtime/hooks/loading/use-is-loader-hosted.d.ts +7 -0
  156. package/dist/react-sdk/application-runtime/hooks/loading/use-is-loader-hosted.js +1 -0
  157. package/dist/react-sdk/application-runtime/hooks/loading/use-loading-actions.d.ts +9 -0
  158. package/dist/react-sdk/application-runtime/hooks/loading/use-loading-actions.js +1 -0
  159. package/dist/react-sdk/application-runtime/hooks/loading/use-loading-application.d.ts +24 -0
  160. package/dist/react-sdk/application-runtime/hooks/loading/use-loading-application.js +1 -0
  161. package/dist/react-sdk/application-runtime/hooks/use-access-service.js +1 -1
  162. package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.d.ts +4 -11
  163. package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.js +1 -1
  164. package/dist/react-sdk/application-runtime/hooks/use-web-component.d.ts +5 -0
  165. package/dist/react-sdk/application-runtime/hooks/use-web-component.js +1 -1
  166. package/dist/react-sdk/application-runtime/host-properties/actions.d.ts +15 -0
  167. package/dist/react-sdk/application-runtime/host-properties/actions.js +1 -0
  168. package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.d.ts +30 -0
  169. package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.js +1 -0
  170. package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.d.ts +7 -0
  171. package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.js +1 -0
  172. package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.d.ts +21 -0
  173. package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.js +1 -0
  174. package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.d.ts +42 -0
  175. package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.js +1 -0
  176. package/dist/react-sdk/application-runtime/host-properties/index.d.ts +8 -0
  177. package/dist/react-sdk/application-runtime/host-properties/index.js +1 -0
  178. package/dist/react-sdk/application-runtime/host-properties/initialize.d.ts +7 -0
  179. package/dist/react-sdk/application-runtime/host-properties/initialize.js +1 -0
  180. package/dist/react-sdk/application-runtime/host-properties/selectors.d.ts +54 -0
  181. package/dist/react-sdk/application-runtime/host-properties/selectors.js +1 -0
  182. package/dist/react-sdk/application-runtime/host-properties/types.d.ts +18 -0
  183. package/dist/react-sdk/application-runtime/index.d.ts +2 -0
  184. package/dist/react-sdk/application-runtime/loading/actions.d.ts +45 -0
  185. package/dist/react-sdk/application-runtime/loading/actions.js +1 -0
  186. package/dist/react-sdk/application-runtime/loading/index.d.ts +4 -0
  187. package/dist/react-sdk/application-runtime/loading/index.js +1 -0
  188. package/dist/react-sdk/application-runtime/loading/initialize.d.ts +3 -0
  189. package/dist/react-sdk/application-runtime/loading/initialize.js +1 -0
  190. package/dist/react-sdk/application-runtime/loading/selectors.d.ts +18 -0
  191. package/dist/react-sdk/application-runtime/loading/selectors.js +1 -0
  192. package/dist/react-sdk/application-runtime/loading/types.d.ts +59 -0
  193. package/dist/react-sdk/application-runtime/loading/types.js +1 -0
  194. package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
  195. package/dist/react-sdk/application-runtime/provider/ApplicationRuntime.d.ts +6 -0
  196. package/dist/react-sdk/application-runtime/provider/ApplicationRuntime.js +1 -1
  197. package/dist/react-sdk/application-runtime/provider/ApplicationType.d.ts +7 -0
  198. package/dist/react-sdk/application-runtime/provider/ApplicationType.js +1 -1
  199. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +218 -8
  200. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
  201. package/dist/react-sdk/domain-application-context/BackendDataProvider.js +1 -1
  202. package/dist/react-sdk/domain-application-context/FrontendDataProvider.js +1 -1
  203. package/dist/react-sdk/domain-application-context/PublishedDataProvider.js +1 -1
  204. package/dist/react-sdk/elements/index.d.ts +0 -1
  205. package/dist/react-sdk/index.d.ts +1 -0
  206. package/dist/react-sdk/index.js +1 -1
  207. package/dist/react-sdk/loading-state/LoaderHost.d.ts +20 -0
  208. package/dist/react-sdk/loading-state/LoaderHost.js +1 -0
  209. package/dist/react-sdk/loading-state/built-in-loading-phase.d.ts +9 -0
  210. package/dist/react-sdk/loading-state/built-in-loading-phase.js +1 -0
  211. package/dist/react-sdk/loading-state/create-app-loader.d.ts +18 -0
  212. package/dist/react-sdk/loading-state/create-app-loader.js +1 -0
  213. package/dist/react-sdk/loading-state/index.d.ts +4 -2
  214. package/dist/react-sdk/loading-state/index.js +1 -1
  215. package/dist/react-sdk/loading-state/{LoadingStateProvider.d.ts → loading-state-hooks.d.ts} +3 -12
  216. package/dist/react-sdk/loading-state/loading-state-hooks.js +1 -0
  217. package/dist/react-sdk/page-elements/ConfigurationNotFoundPagePropsProvider.d.ts +17 -0
  218. package/dist/react-sdk/page-elements/ConfigurationNotFoundPagePropsProvider.js +1 -0
  219. package/dist/react-sdk/page-elements/ConfiguratorErrorPagePropsProvider.d.ts +17 -0
  220. package/dist/react-sdk/page-elements/ConfiguratorErrorPagePropsProvider.js +1 -0
  221. package/dist/react-sdk/page-elements/configurator-error-page-props.js +1 -0
  222. package/dist/{configurator/configuration-not-found-page → react-sdk/page-elements}/create-configuration-not-found-page.d.ts +7 -1
  223. package/dist/react-sdk/page-elements/create-configuration-not-found-page.js +1 -0
  224. package/dist/{configurator/configurator-error-page → react-sdk/page-elements}/create-configurator-error-page.d.ts +6 -1
  225. package/dist/react-sdk/page-elements/create-configurator-error-page.js +1 -0
  226. package/dist/react-sdk/page-elements/create-preset-ui.d.ts +9 -0
  227. package/dist/react-sdk/page-elements/create-preset-ui.js +1 -0
  228. package/dist/react-sdk/page-elements/index.d.ts +6 -0
  229. package/dist/react-sdk/page-elements/index.js +1 -0
  230. package/dist/react-sdk/session/SessionServiceProvider.js +1 -1
  231. package/package.json +3 -3
  232. package/dist/configurator/app-loader-content/app-loader-content-name.d.ts +0 -5
  233. package/dist/configurator/app-loader-content/app-loader-content-name.js +0 -1
  234. package/dist/configurator/configuration-not-found-page/create-configuration-not-found-page.js +0 -1
  235. package/dist/configurator/configurator-error-page/create-configurator-error-page.js +0 -1
  236. package/dist/react-sdk/loading-state/LoadingStateProvider.js +0 -1
  237. package/dist/react-sdk/loading-state/loading-state-manager.d.ts +0 -37
  238. package/dist/react-sdk/loading-state/loading-state-manager.js +0 -1
  239. /package/dist/react-sdk/{elements/configurator-error-page-props.js → application-runtime/host-properties/types.js} +0 -0
  240. /package/dist/react-sdk/{elements → page-elements}/configurator-error-page-props.d.ts +0 -0
@@ -379,6 +379,40 @@ export interface paths {
379
379
  readonly patch?: never
380
380
  readonly trace?: never
381
381
  }
382
+ readonly '/configurations/{configurationId}/assistant/images': {
383
+ readonly parameters: {
384
+ readonly query?: never
385
+ readonly header?: never
386
+ readonly path?: never
387
+ readonly cookie?: never
388
+ }
389
+ readonly get?: never
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. */
392
+ readonly post: operations['uploadAssistantImage']
393
+ readonly delete?: never
394
+ readonly options?: never
395
+ readonly head?: never
396
+ readonly patch?: never
397
+ readonly trace?: never
398
+ }
399
+ readonly '/configurations/{configurationId}/assistant/images/{imageId}': {
400
+ readonly parameters: {
401
+ readonly query?: never
402
+ readonly header?: never
403
+ readonly path?: never
404
+ readonly cookie?: never
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. */
407
+ readonly get: operations['getAssistantImage']
408
+ readonly put?: never
409
+ readonly post?: never
410
+ readonly delete?: never
411
+ readonly options?: never
412
+ readonly head?: never
413
+ readonly patch?: never
414
+ readonly trace?: never
415
+ }
382
416
  readonly '/configurations/{configurationId}/chat': {
383
417
  readonly parameters: {
384
418
  readonly query?: never
@@ -1503,6 +1537,13 @@ export interface components {
1503
1537
  /** @enum {number} */
1504
1538
  readonly statusCode: 401
1505
1539
  }
1540
+ /** @description Unsupported Media Type: The request body is of a content type the route does not accept. */
1541
+ readonly UnsupportedMediaTypeError: {
1542
+ /** @example Unsupported Media Type! */
1543
+ readonly message: string
1544
+ /** @enum {number} */
1545
+ readonly statusCode: 415
1546
+ }
1506
1547
  /** @description A webhook resource to which the deployment can send requests. */
1507
1548
  readonly Webhook: {
1508
1549
  /**
@@ -3397,6 +3438,193 @@ export interface operations {
3397
3438
  }
3398
3439
  }
3399
3440
  }
3441
+ readonly uploadAssistantImage: {
3442
+ readonly parameters: {
3443
+ readonly query?: never
3444
+ readonly header?: never
3445
+ readonly path: {
3446
+ /** @description The configuration on which the caller's assistant thread is used. */
3447
+ readonly configurationId: components['schemas']['ConfigurationUuid']
3448
+ }
3449
+ readonly cookie?: never
3450
+ }
3451
+ /** @description The JPEG or PNG image. */
3452
+ readonly requestBody: {
3453
+ readonly content: {
3454
+ readonly 'image/jpeg': string
3455
+ readonly 'image/png': string
3456
+ }
3457
+ }
3458
+ readonly responses: {
3459
+ /** @description The image was stored in the thread. */
3460
+ readonly 200: {
3461
+ headers: {
3462
+ readonly [name: string]: unknown
3463
+ }
3464
+ content: {
3465
+ readonly 'application/json': {
3466
+ /**
3467
+ * Format: uuid
3468
+ * @description The id tool results reference the image by.
3469
+ */
3470
+ readonly imageId: string
3471
+ }
3472
+ }
3473
+ }
3474
+ /** @description Bad Request! */
3475
+ readonly 400: {
3476
+ headers: {
3477
+ readonly [name: string]: unknown
3478
+ }
3479
+ content: {
3480
+ readonly 'application/json': components['schemas']['BadRequestError']
3481
+ }
3482
+ }
3483
+ /** @description Unauthorized! */
3484
+ readonly 401: {
3485
+ headers: {
3486
+ readonly [name: string]: unknown
3487
+ }
3488
+ content: {
3489
+ readonly 'application/json': components['schemas']['UnauthorizedError']
3490
+ }
3491
+ }
3492
+ /** @description Forbidden! */
3493
+ readonly 403: {
3494
+ headers: {
3495
+ readonly [name: string]: unknown
3496
+ }
3497
+ content: {
3498
+ readonly 'application/json': components['schemas']['ForbiddenError']
3499
+ }
3500
+ }
3501
+ /** @description Not Found! */
3502
+ readonly 404: {
3503
+ headers: {
3504
+ readonly [name: string]: unknown
3505
+ }
3506
+ content: {
3507
+ readonly 'application/json': components['schemas']['NotFoundError']
3508
+ }
3509
+ }
3510
+ /** @description Conflict! */
3511
+ readonly 409: {
3512
+ headers: {
3513
+ readonly [name: string]: unknown
3514
+ }
3515
+ content: {
3516
+ readonly 'application/json': components['schemas']['ConflictError']
3517
+ }
3518
+ }
3519
+ /** @description Unsupported Media Type! */
3520
+ readonly 415: {
3521
+ headers: {
3522
+ readonly [name: string]: unknown
3523
+ }
3524
+ content: {
3525
+ readonly 'application/json': components['schemas']['UnsupportedMediaTypeError']
3526
+ }
3527
+ }
3528
+ /** @description Bad Gateway! */
3529
+ readonly 502: {
3530
+ headers: {
3531
+ readonly [name: string]: unknown
3532
+ }
3533
+ content: {
3534
+ readonly 'application/json': components['schemas']['BadGatewayError']
3535
+ }
3536
+ }
3537
+ /** @description An unexpected error occurred! */
3538
+ readonly default: {
3539
+ headers: {
3540
+ readonly [name: string]: unknown
3541
+ }
3542
+ content: {
3543
+ readonly 'application/json': components['schemas']['DefaultResponse']
3544
+ }
3545
+ }
3546
+ }
3547
+ }
3548
+ readonly getAssistantImage: {
3549
+ readonly parameters: {
3550
+ readonly query?: never
3551
+ readonly header?: never
3552
+ readonly path: {
3553
+ /** @description The configuration on which the caller's assistant thread is used. */
3554
+ readonly configurationId: components['schemas']['ConfigurationUuid']
3555
+ /** @description The image, as a tool result references it. */
3556
+ readonly imageId: string
3557
+ }
3558
+ readonly cookie?: never
3559
+ }
3560
+ readonly requestBody?: never
3561
+ readonly responses: {
3562
+ /** @description The image. */
3563
+ readonly 200: {
3564
+ headers: {
3565
+ readonly [name: string]: unknown
3566
+ }
3567
+ content: {
3568
+ readonly 'image/jpeg': unknown
3569
+ readonly 'image/png': unknown
3570
+ }
3571
+ }
3572
+ /** @description Bad Request! */
3573
+ readonly 400: {
3574
+ headers: {
3575
+ readonly [name: string]: unknown
3576
+ }
3577
+ content: {
3578
+ readonly 'application/json': components['schemas']['BadRequestError']
3579
+ }
3580
+ }
3581
+ /** @description Unauthorized! */
3582
+ readonly 401: {
3583
+ headers: {
3584
+ readonly [name: string]: unknown
3585
+ }
3586
+ content: {
3587
+ readonly 'application/json': components['schemas']['UnauthorizedError']
3588
+ }
3589
+ }
3590
+ /** @description Forbidden! */
3591
+ readonly 403: {
3592
+ headers: {
3593
+ readonly [name: string]: unknown
3594
+ }
3595
+ content: {
3596
+ readonly 'application/json': components['schemas']['ForbiddenError']
3597
+ }
3598
+ }
3599
+ /** @description Not Found! */
3600
+ readonly 404: {
3601
+ headers: {
3602
+ readonly [name: string]: unknown
3603
+ }
3604
+ content: {
3605
+ readonly 'application/json': components['schemas']['NotFoundError']
3606
+ }
3607
+ }
3608
+ /** @description Bad Gateway! */
3609
+ readonly 502: {
3610
+ headers: {
3611
+ readonly [name: string]: unknown
3612
+ }
3613
+ content: {
3614
+ readonly 'application/json': components['schemas']['BadGatewayError']
3615
+ }
3616
+ }
3617
+ /** @description An unexpected error occurred! */
3618
+ readonly default: {
3619
+ headers: {
3620
+ readonly [name: string]: unknown
3621
+ }
3622
+ content: {
3623
+ readonly 'application/json': components['schemas']['DefaultResponse']
3624
+ }
3625
+ }
3626
+ }
3627
+ }
3400
3628
  readonly getChatConversation: {
3401
3629
  readonly parameters: {
3402
3630
  readonly query?: 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,LoadingStateProvider 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,useWebComponentReadonlySync as C}from"#package/react-sdk";import{SnackbarProvider as w}from"#package/ui-sdk";import{ConfiguratorDataProvider as E}from"./configurator-context/ConfiguratorDataProvider.js";import{ConfiguratorResponsiveProvider as I}from"./configurator-context/ConfiguratorResponsiveProvider.js";import{usePowerRoutingLifecycle as L}from"./configurator-context/configurator-routing/use-power-routing-lifecycle.js";import{ConfiguratorRoutingProvider as P,OnApplicationStartProvider as Z,OnRoutingReadyProvider as q,OnSessionReadyProvider as A,PresetSelectionProvider as B,PreviewApplicationProvider as D}from"./configurator-context/index.js";import{LoadingErrorBoundary as F}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 G=u(),H=h(),J=x(),K=k(),M=g(),N=j(),O=b(c.locale),Q=v(c.locale);C(),t(()=>{let r=Q.subscribe(r=>{let e=m(r,a(H));H.activate(e)}),e=()=>{O(H.locale)};return H.on("change",e),()=>{r.unsubscribe(),H.removeListener("change",e)}},[Q,H,O]);let V=y(c.containerZIndex),W=y(c.power);return(L(),"off"===W)?null:r(d,{type:l.Configurator,children:r(i,{client:G,children:r(U,{children:r(s,{children:r(I,{containerZIndex:V,children:r(z,{mode:J,children:r(D,{alwaysExpand:M,preview:K,children:r(o,{i18n:H,children:r(w,{maxSnack:5,children:r(F,{FallbackComponent:R,children:r(T,{prefetchTextureUrls:N,children:r(Z,{children:r(f,{children:r(A,{children:"on"===W&&r(P,{children:r(E,{children:r(B,{children:r(q,{children:e(n,{children:[r(p,{}),r(S,{})]})})})})})})})})})})})})})})})})})})})};
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,2 +1 @@
1
- export { AppLoaderContentName } from './app-loader-content-name.js';
2
1
  export { DefaultAppLoaderContent } from './DefaultAppLoaderContent.js';
@@ -1 +1 @@
1
- export{AppLoaderContentName}from"./app-loader-content-name.js";export{DefaultAppLoaderContent}from"./DefaultAppLoaderContent.js";
1
+ export{DefaultAppLoaderContent}from"./DefaultAppLoaderContent.js";
@@ -1 +1 @@
1
- import{createSelector as e}from"@salsita-ai/common/utils";import{createSessionAssistant as t,isAssistantSetupHandler as n}from"#package/domain";import{AnimationSystem as s,AssistantSystem as o,CameraControlSystem as r,CameraSystem as a,CanvasSystem as i,DragAndDropSystem as g,ExportSystem as m,GraphQLSystem as c,ImageRenderingSystem as l,LayoutSystem as S,SketchingSystem as d}from"./systems/index.js";export const createConfiguratorExtensionSelectors=u=>{let{getState:y,domainContextSelectors:w,specSelectors:C,domainServicesSelectors:f,accessSelectors:p,commonServicesSelectors:h}=u,x=e.withTypes()([C.selectConfiguratorSpec,w.selectInitializationContext],(e,s)=>t({resolved:e.assistant,handler:e.handlers.find(n),inputs:s&&s.access?{role:s.role,sessionData:s.sessionData,access:s.access}:null})),A={getConfigurationId:()=>p.getConfiguratorConfigurationId(),getAuthorizedClient:()=>h.getConfiguratorAuthorizedClient(),getAssistantSetup:()=>x(y()),domainContextSelectors:w,domainServicesSelectors:f,specSelectors:C},I={getSystems:()=>Q,getCanvasSystem:()=>D,getCameraControlSystem:()=>v,getAnimationSystem:()=>b,getDragAndDropSystem:()=>z,getImageRenderingSystem:()=>G,getLayoutSystem:()=>T,getSketchingSystem:()=>j,getExportSystem:()=>k,getCameraSystem:()=>F,getGraphQLSystem:()=>L,getAssistantSystem:()=>R},E={...A,configuratorExtensionSelectors:I},D=new i(A),v=new r({configuratorExtensionSelectors:I}),z=new g(E),b=new s(A),k=new m(E),L=new c({...A,renderScreenshot:async(e,t)=>{let[n]=await I.getImageRenderingSystem().generateImagesFromComponents([e],t,{},{awaitSettledState:!0});if(!n)throw Error("The canvas rendered no image.");return n.blob}}),R=new o(E),T=new S(A),j=new d(E),F=new a(E),G=new l(E),Q={cameraControlSystem:v,layoutSystem:T,sketchingSystem:j,dragAndDropSystem:z,canvasSystem:D,cameraSystem:F,exportSystem:k,imageRenderingSystem:G,animationSystem:b,graphQLSystem:L,assistantSystem:R};return I};
1
+ import{createSelector as e}from"@salsita-ai/common/utils";import{createSessionAssistant as t,isAssistantSetupHandler as n}from"#package/domain";import{AnimationSystem as s,AssistantSystem as o,CameraControlSystem as r,CameraSystem as a,CanvasSystem as i,DragAndDropSystem as g,ExportSystem as m,GraphQLSystem as l,ImageRenderingSystem as c,LayoutSystem as S,SketchingSystem as d}from"./systems/index.js";export const createConfiguratorExtensionSelectors=u=>{let{getState:y,domainContextSelectors:C,specSelectors:p,domainServicesSelectors:w,accessSelectors:f,commonServicesSelectors:h}=u,A=e.withTypes()([p.selectConfiguratorSpec,C.selectInitializationContext],(e,s)=>t({resolved:e.assistant,handler:e.handlers.find(n),inputs:s&&s.access?{role:s.role,sessionData:s.sessionData,access:s.access}:null})),I={getConfigurationId:()=>f.getConfiguratorConfigurationId(),getAuthorizedClient:()=>h.getConfiguratorAuthorizedClient(),getAssistantSetup:()=>A(y()),domainContextSelectors:C,domainServicesSelectors:w,specSelectors:p},x={getSystems:()=>Q,getCanvasSystem:()=>z,getCameraControlSystem:()=>D,getAnimationSystem:()=>b,getDragAndDropSystem:()=>v,getImageRenderingSystem:()=>G,getLayoutSystem:()=>T,getSketchingSystem:()=>j,getExportSystem:()=>k,getCameraSystem:()=>F,getGraphQLSystem:()=>L,getAssistantSystem:()=>R},E={...I,configuratorExtensionSelectors:x},z=new i(I),D=new r({configuratorExtensionSelectors:x}),v=new g(E),b=new s(I),k=new m(E),L=new l({...I,renderScreenshot:async(e,t)=>{let[n]=await x.getImageRenderingSystem().generateImagesFromComponents([e],t,{},{awaitSettledState:!0});if(!n)throw Error("The canvas rendered no image.");return n.blob},uploadScreenshot:e=>I.getAuthorizedClient().uploadAssistantImage(I.getConfigurationId(),e)}),R=new o(E),T=new S(I),j=new d(E),F=new a(E),G=new c(E),Q={cameraControlSystem:D,layoutSystem:T,sketchingSystem:j,dragAndDropSystem:v,canvasSystem:z,cameraSystem:F,exportSystem:k,imageRenderingSystem:G,animationSystem:b,graphQLSystem:L,assistantSystem:R};return x};
@@ -136,6 +136,11 @@ export declare class AssistantSystem implements InitializableSystem {
136
136
  */
137
137
  private readonly _applyToolCallIds;
138
138
  private readonly _undoTipToolCallId;
139
+ /**
140
+ * Object URLs of the screenshots read so far, by image id. An uploaded image never changes, so
141
+ * each is read once and kept while the configuration stays loaded.
142
+ */
143
+ private _screenshotUrls;
139
144
  constructor(_context: AssistantSystemContext);
140
145
  /** The conversation. It never completes, and holds the empty chat whenever no chat is active. */
141
146
  readonly chat$: ObservableWithLastValue<AssistantChatSnapshot>;
@@ -231,6 +236,12 @@ export declare class AssistantSystem implements InitializableSystem {
231
236
  * refuses with a conflict is not a failure: the thread is read again and `false` is returned.
232
237
  */
233
238
  resume: () => Promise<boolean>;
239
+ /**
240
+ * An object URL of a screenshot of the conversation, by the id its tool result references it by.
241
+ * It is read from the server through the client of the current chat, once per image; a read that
242
+ * failed is forgotten, so it can be asked for again. Rejects without a chat or when the read fails.
243
+ */
244
+ loadScreenshotUrl: (imageId: string) => Promise<string>;
234
245
  /**
235
246
  * Loads the thread before the oldest painted one and paints it above. Does nothing when there is
236
247
  * none or one is being loaded. A load that fails is logged and can be asked for again.
@@ -300,6 +311,8 @@ export declare class AssistantSystem implements InitializableSystem {
300
311
  * it is: whether it finishes its reply or is cut off is the caller's decision.
301
312
  */
302
313
  private _retireChat;
314
+ /** Revokes the object URLs of the screenshots read for the configuration that was loaded, also those still being read. */
315
+ private _releaseScreenshotUrls;
303
316
  /** Ends the current chat without cutting its reply off. */
304
317
  private _endChat;
305
318
  }
@@ -1 +1 @@
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{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."}),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(c);_panel=new i(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 i(void 0);constructor(e){this._context=e;let{configuratorExtensionSelectors:t,domainContextSelectors:i,domainServicesSelectors:s,getAssistantSetup:a}=e;this._recorder=new o({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??_,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=[n(),h(r),l(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(u),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 i={changes:this._recorder.take(this._committedState())};this._firstAttempt=t;try{await this._sendOn(t,e,i);let s=this._findRefusedMessageIndex(t);if(-1===s)return;this._refused={chat:t,index:s}}finally{this._firstAttempt===t&&(this._firstAttempt=null)}if(!await this.resume())return;let s=this._current;s&&await this._sendOn(s,e,i)};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};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};_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({...c,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 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 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}),d=t(()=>n().url,h),c=t(()=>`${n().url}/runs`,h),u=this._tools.map(e=>({...e,execute:(t,s)=>{if(!i.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,s)}})),_=new e({threadId:`assistant:${s}`,connection:{...d,joinRun:c.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))}}),f=!1,p=()=>{f||(f=!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!==c&&this._chat.next(c),e};_endChat=()=>{let e=this._retireChat();if(e){if(!e.client.getIsLoading()&&m(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 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)}}}
@@ -35,7 +35,8 @@ export interface AssistantToolDependencies {
35
35
  /**
36
36
  * A tool result as the chat client accepts it: content parts, the execution's JSON as a text part
37
37
  * followed, per screenshot, by its label as a text part and its picture as an image part, so the
38
- * model reads each picture under the label its `image` field returned. The client deep-clones a
38
+ * model reads each picture under the label its `image` field returned; the image part references the picture the browser uploaded, which the server
39
+ * inlines only for the model. The client deep-clones a
39
40
  * result and rejects anything that is not plain JSON, so the `GraphQLError` instances of a result
40
41
  * are formatted through their `toJSON` and `undefined` members are dropped. The prepared state stays
41
42
  * in the browser.
@@ -1 +1 @@
1
- import{AssistantGraphQLToolInput as e,applyTool as t,queryTool as o}from"@salsita-ai/contracts/assistant";let a=e=>({results:[],committed:!1,message:e,sideEffects:[],screenshots:new Map});export const toToolResult=({preparedState:e,screenshots:t,...o})=>[{type:"text",content:JSON.stringify(o)},...[...t].flatMap(([e,{data:t,mimeType:o}])=>[{type:"text",content:e},{type:"image",source:{type:"data",value:t,mimeType:o}}])];let i=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=>o.client(async t=>{let o=i(t);if(!o.ok)return toToolResult(o.refusal);let s=e.getStoreSystem();if(!s.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(s.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 s=i(t);if(!s.ok)return toToolResult(s.refusal);let n=await e.getGraphQLSystem().execute(s.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 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)});
@@ -11,19 +11,25 @@ export interface GraphQLOperation {
11
11
  export interface GraphQLScreenshot {
12
12
  readonly entityId: string;
13
13
  readonly view: string;
14
- /** The picture as base64 data. */
15
- readonly data: string;
16
- readonly mimeType: 'image/jpeg' | 'image/png';
14
+ /** The id the server stored the picture under, which the tool result references it by. */
15
+ readonly imageId: string;
17
16
  }
18
17
  export interface GraphQLSystemContext {
19
18
  /** The assistant the initialized session runs: the operations are validated and executed against its schema. */
20
19
  readonly getAssistantSetup: () => SessionAssistantSetup;
21
20
  /**
22
21
  * Renders the picture an `agentScreenshot` component of a state declares, behind every export
23
- * already queued; `null` from an executor that renders no pictures. The only async step of an
24
- * execution, and the only one that needs a canvas.
22
+ * already queued, as a JPEG or PNG blob; `null` from an executor that renders no pictures. One of
23
+ * the two async steps of an execution, and the only one that needs a canvas.
25
24
  */
26
25
  readonly renderScreenshot: (component: ComponentSnapshot<AgentScreenshotComponent>, state: AnyDomainState) => Promise<Blob | null>;
26
+ /**
27
+ * Stores a rendered screenshot in the assistant thread on the server and resolves with the id the
28
+ * tool result references it by. The other async step of an execution, run right after each render.
29
+ */
30
+ readonly uploadScreenshot: (image: Blob) => Promise<{
31
+ readonly imageId: string;
32
+ }>;
27
33
  readonly specSelectors: SpecSelectors;
28
34
  readonly domainContextSelectors: DomainContextSelectors;
29
35
  readonly domainServicesSelectors: DomainServicesSelectors;
@@ -97,7 +103,7 @@ export declare class GraphQLSystem {
97
103
  private readonly _resolveType;
98
104
  private _generation;
99
105
  /**
100
- * The picture of an entity of a state from one `agentScreenshot` view, as base64 of the view's
106
+ * The picture of an entity of a state from one `agentScreenshot` view, as a blob of the view's
101
107
  * file format; `null` when the view is not attached to the entity there or nothing renders it.
102
108
  */
103
109
  private readonly _renderScreenshot;
@@ -118,9 +124,9 @@ export declare class GraphQLSystem {
118
124
  private readonly _runMutation;
119
125
  /**
120
126
  * Takes a screenshot once every one asked for before it in the execution has been taken, so they
121
- * render and spend the budget in document order. A failure nulls only its own field and fails
122
- * nothing else: the user kept changing the configuration, the image did not fit the budget, or
123
- * rendering failed. Once the budget is spent, no later screenshot renders.
127
+ * render in document order, and uploads it as soon as it has rendered. A failure nulls only its
128
+ * own field and fails nothing else: the user kept changing the configuration, rendering failed,
129
+ * or the server did not store the picture.
124
130
  */
125
131
  private readonly _takeScreenshot;
126
132
  private readonly _setup;
@@ -1 +1 @@
1
- import{GraphQLError as e,NoSchemaIntrospectionCustomRule as t,defaultFieldResolver as i,execute as n,getNamedType as r,parse as o,specifiedRules as s,validate as a,validateSchema as l}from"graphql";import{assertExistence as c,createSelector as h,isMessageDescriptor as d,isMultilingualString as u}from"@salsita-ai/common/utils";import{DomainEntityIdSchema as f,agentScreenshotComponent as m,createAssistantExecutionSchema as p,findAssistantMutation as g}from"#package/domain";import{ExportBusyError as y}from"../export-system/export-busy-error.js";import{closeUnclosedBraces as v}from"./close-unclosed-braces.js";import{createEntityMeta as S}from"./entity-meta.js";import{injectAssistantLenses as w}from"./inject-assistant-lenses.js";import{readSideEffects as _}from"./side-effects.js";let x={errors:[new e("The configurator does not provide this request. This is a fault in the configurator, not in your request. Tell the user this is not available.")]},$={errors:[new e("The configuration is not loaded yet, so there is no state to query. Run the query again once the configurator has finished loading.")]},b="Not taken: another configuration was loaded while this request ran. Query the current configuration before asking for screenshots again.",E="Not taken: the screenshots of this tool call have used up its image size budget. Ask for this screenshot in another call, and for fewer in one call.",T=async e=>{let t=new Uint8Array(await e.arrayBuffer()),i="";for(let e=0;e<t.length;e+=32768)i+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(i)},C=new RegExp(f.pattern),M=[...s,t],k=e=>"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"id"in e&&"string"==typeof e.id,j=(e,t)=>"object"==typeof e&&null!==e?Reflect.get(e,t):void 0,R=e=>e instanceof Error?e.message:String(e),A=e=>/[.!?]$/.test(e)?e:`${e}.`,N=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype,z=(e,t)=>{let i=N(e)?e._raw:void 0;if(k(i))return i;if(!Array.isArray(e)&&!N(e))return e;if(t.has(e))throw Error("The value contains itself.");let n=new Set([...t,e]);return Array.isArray(e)?e.map(e=>z(e,n)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,z(t,n)]))};export const localize=(e,t)=>Array.isArray(e)?e.map(e=>localize(e,t)):"string"==typeof e||d(e)||u(e)?t(e):e;let q=t=>new e(`The configurator cannot handle this request: ${A(t)} This is a fault in the configurator, not in your request. Tell the user this is not available.`),L="SCREENSHOT_NOT_TAKEN",F=(t,i)=>new e(t,{originalError:i,extensions:{code:L}}),O=e=>(e.errors??[]).some(e=>e.extensions.code!==L),V=t=>({errors:[new e(`Not run: operation ${t+1} failed, so the operations after it were skipped and no change of the list takes effect. Fix the failing operation and send the whole list again.`)]});export class GraphQLSystem{_context;_selectSchema=h([h.leaf(e=>e)],e=>{try{let t=p(e),i=l(t);return i.length>0?q(i.map(e=>e.message).join(" ")):t}catch(e){return q(R(e))}});_selectLenses=h([h.leaf(e=>e)],e=>o(e));_selectFieldResolver=h([h.leaf(e=>e)],t=>(n,o,s,a)=>{if(a.parentType===a.schema.getQueryType())return i(n,o,s,a);if(a.parentType===a.schema.getMutationType())return this._resolveMutation(a.fieldName,String(a.path.key),o,s);if(!k(n))return i(n,o,s,a);if("meta"===a.fieldName){let e;return S({entity:n,state:("object"==typeof(e=j(n,"_state"))&&null!==e&&"entities"in e&&"rootEntityId"in e?e:void 0)??s.state},{manifest:s.manifest,recipes:this._recipeContext(),prepareStateEmission:(e,t,i)=>this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(e,t,i),find$Entity:(e,t)=>this._find$Entity(e,t),validateEntity:e=>this._context.domainContextSelectors.getDomain().validateEntity(e),takeScreenshot:(e,t)=>this._takeScreenshot(e,t,s)})}let{source:l,localized:c}=t[a.parentType.name]?.[a.fieldName]??{source:a.fieldName},h=((t,i)=>{try{return j(t,i)}catch(n){throw new e(`Expression "${i}" failed on ${k(t)?t.id:"an entity"}: ${A(R(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l);return c?localize(h,this._context.domainServicesSelectors.getResolveLocalizable()):l.startsWith("$")&&"JSON"===r(a.returnType).name?((t,i,n)=>{try{return z(n,new Set)}catch(n){throw new e(`Expression "${i}" returned a value that is not plain serializable data on ${k(t)?t.id:"an entity"}: ${A(R(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l,h):h});constructor(e){this._context=e}_get$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().get$Entity(e,t);_find$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().getEntity(e,t)?this._get$Entity(e,t):null;_recipeContext=()=>({componentReader:this._context.domainContextSelectors.getComponentReader(),recipeCooker:this._context.domainContextSelectors.getRecipeCookerSystem(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});_rootValue={root:(e,{state:t})=>this._get$Entity(t.rootEntityId,t),entities:({ids:t},{state:i})=>{if(null==t)return i.entities.map(e=>this._get$Entity(e.id,i));var n=i.rootEntityId;let r=t.filter(e=>!C.test(e));if(r.length>0)throw new e(`${r.map(e=>`"${e}"`).join(", ")} ${1===r.length?"is not an entity id":"are not entity ids"}. Entity ids have the form "<Type>-<number>", e.g. "${n}". Use ids as returned by the "id" field.`);return t.map(e=>C.test(e)?this._find$Entity(e,i):null)},selectedEntity:(e,{state:t})=>this._find$Entity(this._context.domainContextSelectors.getNavigationSystem().getActiveSelectionState(t),t),navigation:(e,{state:t})=>{let i=this._context.domainContextSelectors.getNavigationSystem();return{navigationState:i.getActiveNavigationState(t),viewState:i.getActiveViewState(t),toolState:i.getActiveToolState(t)}}};_resolveType=e=>k(e)?e.type:void 0;_generation={active:!0};_renderScreenshot=async(e,t,i)=>{let n=this._context.domainContextSelectors.getComponentReader().readOneComponent({entityId:e,componentType:m,instanceName:t},i);if(!n)return null;let r=await this._context.renderScreenshot(n,i);return null===r?null:{data:await T(r),mimeType:"JPEG"===n.state.fileFormat?"image/jpeg":"image/png"}};initialize=()=>{this._generation.active=!1,this._generation={active:!0}};_resolveMutation=(t,i,n,r)=>{if(void 0!==r.failedMutationField)throw new e(`Not run: the earlier field "${r.failedMutationField}" of this operation failed, so "${i}" was skipped and no change of the operation takes effect. Fix the failing field and send the operation again.`);try{return this._runMutation(t,n,r)}catch(e){throw r.failedMutationField=i,e}};_runMutation=(t,i,n)=>{let r=g(t,n.manifest);if(!r)throw new e(`The schema declares the mutation "${t}", but the configurator has no implementation for it. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let o=n.state,s=r.implementation(i,o,{manifest:n.manifest,action:this._context.domainContextSelectors.getActionSystem().createContext(o),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});if(s.updates.length>0){let i=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(s.updates,o,"committed");if(!i.validity.valid)throw new e(`The changes of "${t}" were not applied, because the resulting configuration is invalid: ${(e=>{if("uncaught"===e.severity)return`validating it threw: ${A(R(e.error))}`;let t=[...new Set(e.entityViolations.filter(({violation:t})=>t.severity===e.severity).map(({entityId:e})=>e))];return`it has ${e.severity} violations on ${t.join(", ")}.`})(i.validity)} Change the request so the configuration stays valid.`);n.emissions.push(i),n.state=i.state}return s.readResult({previousState:o,state:n.state})};_takeScreenshot=({entity:t,state:i},n,r)=>{let o=r.manifest.screenshots?.[t.type]?.find(e=>e.view===n);if(!o)return Promise.reject(new e(`The schema declares the screenshot view "${n}" on ${t.type}, but the configurator has no view of that name. This is a fault in the configurator, not in your request. Tell the user this is not available.`));let s=r.lastScreenshot.then(async()=>{if(!r.generation.active)throw F(b);if(r.screenshotBudget<=0)throw F(E);let e=await this._renderScreenshot(t.id,o.instanceName,i).catch(e=>{throw F(e instanceof y?"User made concurrent actions that prevented the screenshot from being taken, try again":`The screenshot of ${t.id} from "${n}" could not be taken: ${A(R(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)});if(!r.generation.active)throw F(b);if(null===e)return null;if(e.data.length>r.screenshotBudget)throw r.screenshotBudget=0,F(E);r.screenshotBudget-=e.data.length;let s=`${t.id}/${n}`,a=[...r.screenshots.values()].filter(e=>e.entityId===t.id&&e.view===n).length,l=0===a?s:`${s}#${a+1}`;return r.screenshots.set(l,{entityId:t.id,view:n,...e}),{image:l}});return r.lastScreenshot=s.catch(()=>void 0),s};_setup=()=>{let{manifest:t,error:i}=this._context.getAssistantSetup();if(i)return{ready:!1,result:{errors:[new e(i.message,{originalError:i})]}};if(!t)return{ready:!1,result:x};let n=this._selectSchema(t.sdl);return n instanceof e?{ready:!1,result:{errors:[n]}}:{ready:!0,assistant:t,schema:n,lenses:t.lenses?.definitions?this._selectLenses(t.lenses.definitions):void 0,fieldResolver:this._selectFieldResolver(t.fields)}};_run=(t,i,r,s)=>{let l;try{l=o(t)}catch(t){return{errors:[t instanceof e?t:new e(R(t))]}}let c=a(r.schema,l,M);return c.length>0?{errors:c}:n({schema:r.schema,document:l,rootValue:this._rootValue,contextValue:s,variableValues:i.variables,operationName:i.operationName,fieldResolver:r.fieldResolver,typeResolver:this._resolveType})};prepare=async(t,i,n=this._generation)=>{let r,o=this._setup();if(!o.ready)return i.map(()=>({result:o.result,emissions:[],screenshots:new Map}));let s={manifest:o.assistant,state:t,emissions:[],failedMutationField:void 0,screenshots:new Map,screenshotBudget:14e5,lastScreenshot:Promise.resolve(),generation:n},a=[];for(let[t,n]of i.entries())if(void 0===r){let i=s.emissions.length,l=s.screenshots.size;s.failedMutationField=void 0;let c=v(n.document),h=o.lenses?w(c,o.lenses):c,d=h instanceof e?{errors:[h]}:await this._run(h,n,o,s);await s.lastScreenshot,a.push({result:d,emissions:s.emissions.slice(i),screenshots:new Map([...s.screenshots].slice(l))}),O(d)&&(r=t)}else a.push({result:V(r),emissions:[],screenshots:new Map});return a};readSideEffects=e=>{let t=this._context.domainServicesSelectors.getResolveLocalizable();return e.flatMap(({emissions:e})=>e.flatMap(e=>_(e.updates,t)))};readScreenshots=e=>new Map(e.flatMap(({screenshots:e})=>[...e]));_prepareAndCommit=async(e,t)=>{let i,n,r,o=this._context.domainContextSelectors.getStoreSystem(),s=await this.prepare(o.stateSlices.committed.value.state,e,t),a=s.map(({result:e})=>e),l=this.readSideEffects(s),h=this.readScreenshots(s),d=s.flatMap(e=>e.emissions);if(!t.active)return{results:a,sideEffects:l,screenshots:h,outcome:"conflict"};if(a.some(O)||0===d.length)return{results:a,sideEffects:l,screenshots:h,outcome:"none"};let u=(i=c(d[0]),n=c(d[d.length-1]),r=d.some(e=>void 0!==e.transformationLog),{kind:"committed",previousState:i.previousState,state:n.state,updates:d.flatMap(e=>e.updates),validity:n.validity,transformationLog:r?d.flatMap(e=>e.transformationLog??[]):void 0});return{results:a,sideEffects:l,screenshots:h,outcome:o.commitPrepared(u),preparedState:u.state}};execute=async e=>{let t=this._generation;if(!this._context.domainContextSelectors.getStoreSystem().isInitialized)return{results:e.map(()=>$),committed:!1,sideEffects:[],screenshots:new Map};let i=await this._prepareAndCommit(e,t),{results:n,sideEffects:r,screenshots:o,outcome:s,preparedState:a}="conflict"===i.outcome&&t.active?await this._prepareAndCommit(e,t):i;return"committed"===s?{results:n,committed:!0,sideEffects:r,screenshots:o,preparedState:a}:"held"===s?{results:n,committed:!1,message:"The changes wait for the user's approval and are not applied yet. Do not send them again; the next `[changes]` block lists them once approved.",sideEffects:r,screenshots:o,preparedState:a}:"conflict"===s?{results:n,committed:!1,message:"The changes were not committed, because the configuration changed while they were being applied. The results describe a state that was discarded. Query the current configuration and send the operations again if they still make sense.",sideEffects:r,screenshots:o}:{results:n,committed:!1,sideEffects:r,screenshots:o}}}
1
+ import{GraphQLError as e,NoSchemaIntrospectionCustomRule as t,defaultFieldResolver as i,execute as n,getNamedType as o,parse as r,specifiedRules as s,validate as a,validateSchema as l}from"graphql";import{assertExistence as c,createSelector as h,isMessageDescriptor as d,isMultilingualString as u}from"@salsita-ai/common/utils";import{DomainEntityIdSchema as f,agentScreenshotComponent as m,createAssistantExecutionSchema as p,findAssistantMutation as g}from"#package/domain";import{ExportBusyError as y}from"../export-system/export-busy-error.js";import{closeUnclosedBraces as v}from"./close-unclosed-braces.js";import{createEntityMeta as S}from"./entity-meta.js";import{injectAssistantLenses as _}from"./inject-assistant-lenses.js";import{readSideEffects as w}from"./side-effects.js";let x={errors:[new e("The configurator does not provide this request. This is a fault in the configurator, not in your request. Tell the user this is not available.")]},$={errors:[new e("The configuration is not loaded yet, so there is no state to query. Run the query again once the configurator has finished loading.")]},b="Not taken: another configuration was loaded while this request ran. Query the current configuration before asking for screenshots again.",E=new RegExp(f.pattern),T=[...s,t],C=e=>"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"id"in e&&"string"==typeof e.id,M=(e,t)=>"object"==typeof e&&null!==e?Reflect.get(e,t):void 0,j=e=>e instanceof Error?e.message:String(e),k=e=>/[.!?]$/.test(e)?e:`${e}.`,R=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype,N=(e,t)=>{let i=R(e)?e._raw:void 0;if(C(i))return i;if(!Array.isArray(e)&&!R(e))return e;if(t.has(e))throw Error("The value contains itself.");let n=new Set([...t,e]);return Array.isArray(e)?e.map(e=>N(e,n)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,N(t,n)]))};export const localize=(e,t)=>Array.isArray(e)?e.map(e=>localize(e,t)):"string"==typeof e||d(e)||u(e)?t(e):e;let A=t=>new e(`The configurator cannot handle this request: ${k(t)} This is a fault in the configurator, not in your request. Tell the user this is not available.`),q="SCREENSHOT_NOT_TAKEN",z=(t,i)=>new e(t,{originalError:i,extensions:{code:q}}),L=e=>(e.errors??[]).some(e=>e.extensions.code!==q),F=t=>({errors:[new e(`Not run: operation ${t+1} failed, so the operations after it were skipped and no change of the list takes effect. Fix the failing operation and send the whole list again.`)]});export class GraphQLSystem{_context;_selectSchema=h([h.leaf(e=>e)],e=>{try{let t=p(e),i=l(t);return i.length>0?A(i.map(e=>e.message).join(" ")):t}catch(e){return A(j(e))}});_selectLenses=h([h.leaf(e=>e)],e=>r(e));_selectFieldResolver=h([h.leaf(e=>e)],t=>(n,r,s,a)=>{if(a.parentType===a.schema.getQueryType())return i(n,r,s,a);if(a.parentType===a.schema.getMutationType())return this._resolveMutation(a.fieldName,String(a.path.key),r,s);if(!C(n))return i(n,r,s,a);if("meta"===a.fieldName){let e;return S({entity:n,state:("object"==typeof(e=M(n,"_state"))&&null!==e&&"entities"in e&&"rootEntityId"in e?e:void 0)??s.state},{manifest:s.manifest,recipes:this._recipeContext(),prepareStateEmission:(e,t,i)=>this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(e,t,i),find$Entity:(e,t)=>this._find$Entity(e,t),validateEntity:e=>this._context.domainContextSelectors.getDomain().validateEntity(e),takeScreenshot:(e,t)=>this._takeScreenshot(e,t,s)})}let{source:l,localized:c}=t[a.parentType.name]?.[a.fieldName]??{source:a.fieldName},h=((t,i)=>{try{return M(t,i)}catch(n){throw new e(`Expression "${i}" failed on ${C(t)?t.id:"an entity"}: ${k(j(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l);return c?localize(h,this._context.domainServicesSelectors.getResolveLocalizable()):l.startsWith("$")&&"JSON"===o(a.returnType).name?((t,i,n)=>{try{return N(n,new Set)}catch(n){throw new e(`Expression "${i}" returned a value that is not plain serializable data on ${C(t)?t.id:"an entity"}: ${k(j(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l,h):h});constructor(e){this._context=e}_get$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().get$Entity(e,t);_find$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().getEntity(e,t)?this._get$Entity(e,t):null;_recipeContext=()=>({componentReader:this._context.domainContextSelectors.getComponentReader(),recipeCooker:this._context.domainContextSelectors.getRecipeCookerSystem(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});_rootValue={root:(e,{state:t})=>this._get$Entity(t.rootEntityId,t),entities:({ids:t},{state:i})=>{if(null==t)return i.entities.map(e=>this._get$Entity(e.id,i));var n=i.rootEntityId;let o=t.filter(e=>!E.test(e));if(o.length>0)throw new e(`${o.map(e=>`"${e}"`).join(", ")} ${1===o.length?"is not an entity id":"are not entity ids"}. Entity ids have the form "<Type>-<number>", e.g. "${n}". Use ids as returned by the "id" field.`);return t.map(e=>E.test(e)?this._find$Entity(e,i):null)},selectedEntity:(e,{state:t})=>this._find$Entity(this._context.domainContextSelectors.getNavigationSystem().getActiveSelectionState(t),t),navigation:(e,{state:t})=>{let i=this._context.domainContextSelectors.getNavigationSystem();return{navigationState:i.getActiveNavigationState(t),viewState:i.getActiveViewState(t),toolState:i.getActiveToolState(t)}}};_resolveType=e=>C(e)?e.type:void 0;_generation={active:!0};_renderScreenshot=async(e,t,i)=>{let n=this._context.domainContextSelectors.getComponentReader().readOneComponent({entityId:e,componentType:m,instanceName:t},i);if(!n)return null;let o=await this._context.renderScreenshot(n,i);return null===o?null:new Blob([o],{type:"JPEG"===n.state.fileFormat?"image/jpeg":"image/png"})};initialize=()=>{this._generation.active=!1,this._generation={active:!0}};_resolveMutation=(t,i,n,o)=>{if(void 0!==o.failedMutationField)throw new e(`Not run: the earlier field "${o.failedMutationField}" of this operation failed, so "${i}" was skipped and no change of the operation takes effect. Fix the failing field and send the operation again.`);try{return this._runMutation(t,n,o)}catch(e){throw o.failedMutationField=i,e}};_runMutation=(t,i,n)=>{let o=g(t,n.manifest);if(!o)throw new e(`The schema declares the mutation "${t}", but the configurator has no implementation for it. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let r=n.state,s=o.implementation(i,r,{manifest:n.manifest,action:this._context.domainContextSelectors.getActionSystem().createContext(r),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});if(s.updates.length>0){let i=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(s.updates,r,"committed");if(!i.validity.valid)throw new e(`The changes of "${t}" were not applied, because the resulting configuration is invalid: ${(e=>{if("uncaught"===e.severity)return`validating it threw: ${k(j(e.error))}`;let t=[...new Set(e.entityViolations.filter(({violation:t})=>t.severity===e.severity).map(({entityId:e})=>e))];return`it has ${e.severity} violations on ${t.join(", ")}.`})(i.validity)} Change the request so the configuration stays valid.`);n.emissions.push(i),n.state=i.state}return s.readResult({previousState:r,state:n.state})};_takeScreenshot=({entity:t,state:i},n,o)=>{let r=o.manifest.screenshots?.[t.type]?.find(e=>e.view===n);if(!r)return Promise.reject(new e(`The schema declares the screenshot view "${n}" on ${t.type}, but the configurator has no view of that name. This is a fault in the configurator, not in your request. Tell the user this is not available.`));let s=o.lastScreenshot.then(async()=>{if(!o.generation.active)throw z(b);let e=await this._renderScreenshot(t.id,r.instanceName,i).catch(e=>{throw z(e instanceof y?"User made concurrent actions that prevented the screenshot from being taken, try again":`The screenshot of ${t.id} from "${n}" could not be taken: ${k(j(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)});if(!o.generation.active)throw z(b);if(null===e)return null;let{imageId:s}=await this._context.uploadScreenshot(e).catch(e=>{throw z(`The screenshot of ${t.id} from "${n}" was taken but could not be stored: ${k(j(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)}),a=`${t.id}/${n}`,l=[...o.screenshots.values()].filter(e=>e.entityId===t.id&&e.view===n).length,c=0===l?a:`${a}#${l+1}`;return o.screenshots.set(c,{entityId:t.id,view:n,imageId:s}),{image:c}});return o.lastScreenshot=s.catch(()=>void 0),s};_setup=()=>{let{manifest:t,error:i}=this._context.getAssistantSetup();if(i)return{ready:!1,result:{errors:[new e(i.message,{originalError:i})]}};if(!t)return{ready:!1,result:x};let n=this._selectSchema(t.sdl);return n instanceof e?{ready:!1,result:{errors:[n]}}:{ready:!0,assistant:t,schema:n,lenses:t.lenses?.definitions?this._selectLenses(t.lenses.definitions):void 0,fieldResolver:this._selectFieldResolver(t.fields)}};_run=(t,i,o,s)=>{let l;try{l=r(t)}catch(t){return{errors:[t instanceof e?t:new e(j(t))]}}let c=a(o.schema,l,T);return c.length>0?{errors:c}:n({schema:o.schema,document:l,rootValue:this._rootValue,contextValue:s,variableValues:i.variables,operationName:i.operationName,fieldResolver:o.fieldResolver,typeResolver:this._resolveType})};prepare=async(t,i,n=this._generation)=>{let o,r=this._setup();if(!r.ready)return i.map(()=>({result:r.result,emissions:[],screenshots:new Map}));let s={manifest:r.assistant,state:t,emissions:[],failedMutationField:void 0,screenshots:new Map,lastScreenshot:Promise.resolve(),generation:n},a=[];for(let[t,n]of i.entries())if(void 0===o){let i=s.emissions.length,l=s.screenshots.size;s.failedMutationField=void 0;let c=v(n.document),h=r.lenses?_(c,r.lenses):c,d=h instanceof e?{errors:[h]}:await this._run(h,n,r,s);await s.lastScreenshot,a.push({result:d,emissions:s.emissions.slice(i),screenshots:new Map([...s.screenshots].slice(l))}),L(d)&&(o=t)}else a.push({result:F(o),emissions:[],screenshots:new Map});return a};readSideEffects=e=>{let t=this._context.domainServicesSelectors.getResolveLocalizable();return e.flatMap(({emissions:e})=>e.flatMap(e=>w(e.updates,t)))};readScreenshots=e=>new Map(e.flatMap(({screenshots:e})=>[...e]));_prepareAndCommit=async(e,t)=>{let i,n,o,r=this._context.domainContextSelectors.getStoreSystem(),s=await this.prepare(r.stateSlices.committed.value.state,e,t),a=s.map(({result:e})=>e),l=this.readSideEffects(s),h=this.readScreenshots(s),d=s.flatMap(e=>e.emissions);if(!t.active)return{results:a,sideEffects:l,screenshots:h,outcome:"conflict"};if(a.some(L)||0===d.length)return{results:a,sideEffects:l,screenshots:h,outcome:"none"};let u=(i=c(d[0]),n=c(d[d.length-1]),o=d.some(e=>void 0!==e.transformationLog),{kind:"committed",previousState:i.previousState,state:n.state,updates:d.flatMap(e=>e.updates),validity:n.validity,transformationLog:o?d.flatMap(e=>e.transformationLog??[]):void 0});return{results:a,sideEffects:l,screenshots:h,outcome:r.commitPrepared(u),preparedState:u.state}};execute=async e=>{let t=this._generation;if(!this._context.domainContextSelectors.getStoreSystem().isInitialized)return{results:e.map(()=>$),committed:!1,sideEffects:[],screenshots:new Map};let i=await this._prepareAndCommit(e,t),{results:n,sideEffects:o,screenshots:r,outcome:s,preparedState:a}="conflict"===i.outcome&&t.active?await this._prepareAndCommit(e,t):i;return"committed"===s?{results:n,committed:!0,sideEffects:o,screenshots:r,preparedState:a}:"held"===s?{results:n,committed:!1,message:"The changes wait for the user's approval and are not applied yet. Do not send them again; the next `[changes]` block lists them once approved.",sideEffects:o,screenshots:r,preparedState:a}:"conflict"===s?{results:n,committed:!1,message:"The changes were not committed, because the configuration changed while they were being applied. The results describe a state that was discarded. Query the current configuration and send the operations again if they still make sense.",sideEffects:o,screenshots:r}:{results:n,committed:!1,sideEffects:o,screenshots:r}}}
@@ -1,16 +1,14 @@
1
1
  import { type $DomainEntity, type ConfiguratorBuilder, type CreateCustomPhoenixEntityElement, type CreateCustomPhoenixLayoutElement, type CreateGetThemeHandler, type CreateGetWebComponentOptionsHandler, type CreatePhoenixHandler, type DomainEntity, type IsCreateRecipeUpdate, type IsReplaceRecipeUpdate, type TransformerBuilder, type TransformerFactory, type UpdateFactory, getIdSequence } from '#package/domain';
2
- import { type CreateAddEntityFab, type CreateCollectFrontendDataHandler, type CreateDeleteEntityFab, type CreateFilterPublishedChunksHandler, type CreateNavigationHotspot, type CreateNotAuthenticatedPage, type CreateSelectionHotspot, type CreateToolMenuFab, type IsAngleDimensionUpdate, type IsAttributeSelectionUpdate, type IsAttributeSwitchUpdate, type IsDeleteEntityUpdate, type IsDistanceDimensionUpdate, type IsGenericDimensionUpdate, type IsSwatchSelectionUpdate, type IsTextValueUpdate, type UseAccessService, type UseActiveNavigationState, type UseActiveToolState, type UseActiveViewState, type UseActiveViewports, type UseAnalyticsService, type UseAngleDimension, type UseAttributeSelection, type UseAttributeSwitch, type UseAuthenticatedClient, type UseAuthorizedClient, type UseBackendData, type UseChildEntitySelection, type UseComponent, type UseComponents, type UseComposition, type UseConfigurationId, type UseConfigurationSaveState, type UseConfiguratorMessages, type UseControlViolations, type UseCookRecipes, type UseCookReplaceRecipes, type UseCookedRecipes, type UseCookedReplaceRecipes, type UseCreateAuthorizedClient, type UseDeleteEntity, type UseDeletedEntity, type UseDeselect, type UseDistanceDimension, type UseDistanceDimensionSelection, type UseDomainApplicationContext, type UseDomainApplicationProps, type UseDomainContext, type UseDomainEntityState, type UseEntityPrice, type UseEntitySelector, type UseFinalizeAction, type UseFinalizeActions, type UseFinalizeViolations, type UseFirstComponent, type UseFirstRootComponent, type UseFrontendData, type UseGenericDimension, type UseGroupedRecipeOptions, type UseHoveredDomainEntityId, type UseHoveredEntity, type UseHoveredEntityId, type UseIntegrationService, type UseIntegrationState, type UseIsFullscreenActive, type UseLoadedData, type UseLoadingState, type UseLocaleSwitch, type UseMapViolationHints, type UseNavigate, type UsePopNavigate, type UsePresetEmbeddedState, type UsePublishedData, type UsePushNavigate, type UseRecipeEmbeddedState, type UseReplaceEntityRecipeOptions, type UseRootComponents, type UseRootEntityId, type UseRootEntityPrice, type UseRootEntitySelector, type UseRootEntityState, type UseSelectEntity, type UseSelectParent, type UseSelectedDomainEntityId, type UseSelectedEntity, type UseSelectedEntityId, type UseSession, type UseSessionRole, type UseSessionService, type UseSetFullscreen, type UseSetViewState, type UseShareLinks, type UseSlice, type UseState, type UseStateValidity, type UseStepNavigation, type UseSwatchSelection, type UseSynchronizedSelector, type UseSynchronizedSelector$, type UseTabNavigation, type UseTextValue, type UseUndoRedo, type UseUpdateControl, type UseUpdatedControl, useGenerateShareLink, useLoadingStateValue, useLocalizable, useResolveLocalizable } from '#package/react-sdk';
2
+ import { type CreateAddEntityFab, type CreateAppLoader, type CreateCollectFrontendDataHandler, type CreateConfigurationNotFoundPage, type CreateConfiguratorErrorPage, type CreateDeleteEntityFab, type CreateFilterPublishedChunksHandler, type CreateNavigationHotspot, type CreateNotAuthenticatedPage, type CreatePresetUi, type CreateSelectionHotspot, type CreateToolMenuFab, type IsAngleDimensionUpdate, type IsAttributeSelectionUpdate, type IsAttributeSwitchUpdate, type IsDeleteEntityUpdate, type IsDistanceDimensionUpdate, type IsGenericDimensionUpdate, type IsSwatchSelectionUpdate, type IsTextValueUpdate, type UseAccessService, type UseActiveNavigationState, type UseActiveToolState, type UseActiveViewState, type UseActiveViewports, type UseAnalyticsService, type UseAngleDimension, type UseAttributeSelection, type UseAttributeSwitch, type UseAuthenticatedClient, type UseAuthorizedClient, type UseBackendData, type UseChildEntitySelection, type UseComponent, type UseComponents, type UseComposition, type UseConfigurationId, type UseConfigurationSaveState, type UseConfiguratorMessages, type UseControlViolations, type UseCookRecipes, type UseCookReplaceRecipes, type UseCookedRecipes, type UseCookedReplaceRecipes, type UseCreateAuthorizedClient, type UseDeleteEntity, type UseDeletedEntity, type UseDeselect, type UseDistanceDimension, type UseDistanceDimensionSelection, type UseDomainApplicationContext, type UseDomainApplicationProps, type UseDomainContext, type UseDomainEntityState, type UseEntityPrice, type UseEntitySelector, type UseFinalizeAction, type UseFinalizeActions, type UseFinalizeViolations, type UseFirstComponent, type UseFirstRootComponent, type UseFrontendData, type UseGenericDimension, type UseGroupedRecipeOptions, type UseHoveredDomainEntityId, type UseHoveredEntity, type UseHoveredEntityId, type UseIntegrationService, type UseIntegrationState, type UseIsFullscreenActive, type UseLoadedData, type UseLoadingState, type UseLocaleSwitch, type UseMapViolationHints, type UseNavigate, type UsePopNavigate, type UsePresetEmbeddedState, type UsePublishedData, type UsePushNavigate, type UseRecipeEmbeddedState, type UseReplaceEntityRecipeOptions, type UseRootComponents, type UseRootEntityId, type UseRootEntityPrice, type UseRootEntitySelector, type UseRootEntityState, type UseSelectEntity, type UseSelectParent, type UseSelectedDomainEntityId, type UseSelectedEntity, type UseSelectedEntityId, type UseSession, type UseSessionRole, type UseSessionService, type UseSetFullscreen, type UseSetViewState, type UseShareLinks, type UseSlice, type UseState, type UseStateValidity, type UseStepNavigation, type UseSwatchSelection, type UseSynchronizedSelector, type UseSynchronizedSelector$, type UseTabNavigation, type UseTextValue, type UseUndoRedo, type UseUpdateControl, type UseUpdatedControl, useGenerateShareLink, useLoadingStateValue, useLocalizable, useResolveLocalizable } from '#package/react-sdk';
3
3
  import { type CreatePhoenixIconSet } from '#package/ui-sdk';
4
4
  import { type UseConfiguratorExtensions } from '../application-runtime/index.js';
5
- import { type CreateConfigurationNotFoundPage } from '../configuration-not-found-page/index.js';
6
5
  import { type CreateOnApplicationStartProvider, type CreateOnBackendDataReadyProvider, type CreateOnConfiguratorReadyProvider, type CreateOnFrontendDataReadyProvider, type CreateOnGoToIndexHandler, type CreateOnPresetLoadedHandler, type CreateOnPublishedDataReadyProvider, type CreateOnRoutingReadyProvider, type CreateOnSessionReadyProvider, type UseConfiguratorRouting, type UsePresetSelection, usePreview, usePropertyPageStack, usePropertyPageState } from '../configurator-context/index.js';
7
- import { type CreateConfiguratorErrorPage } from '../configurator-error-page/index.js';
8
6
  import { useCloseAction } from '../integration/index.js';
9
7
  import { type CreateGetTextureProcessingMapHandler } from '../scene/index.js';
10
8
  import type { UseUpdateEntityObjectSelection } from '../scene/scene-entity/drag-and-drop/use-updated-selection.js';
11
9
  import { type UseAssistantPanel, type UseMeasurements, type UseToolbarActions } from '../toolbar-actions/index.js';
12
- import { type CreateAppLoader, type CreateCanvasLoader, type CreateLayoutAdminUi, type CreateLayoutCustomOwnerUi, type CreateLayoutCustomReadUi, type CreateLayoutDialog, type CreateLayoutFooter, type CreateLayoutToolbarDesktop, type CreateLayoutToolbarDesktopFullScreen, type CreateLayoutToolbarReadDesktop, type CreateLayoutToolbarReadDesktopFullScreen, type CreateLayoutUserUi, type CreateToolbarHelp, LayoutSlots, useSceneSafeArea } from '../ui/index.js';
13
- import { type CreatePresetDeviceNotSupported, type CreatePresetPageAction, type CreatePresetUi } from '../ui/preset-layout/PresetUi.js';
10
+ import { type CreateCanvasLoader, type CreateLayoutAdminUi, type CreateLayoutCustomOwnerUi, type CreateLayoutCustomReadUi, type CreateLayoutDialog, type CreateLayoutFooter, type CreateLayoutToolbarDesktop, type CreateLayoutToolbarDesktopFullScreen, type CreateLayoutToolbarReadDesktop, type CreateLayoutToolbarReadDesktopFullScreen, type CreateLayoutUserUi, type CreateToolbarHelp, LayoutSlots, useSceneSafeArea } from '../ui/index.js';
11
+ import { type CreatePresetDeviceNotSupported, type CreatePresetPageAction } from '../ui/preset-layout/PresetUi.js';
14
12
  import { type UseResetCamera } from './use-reset-camera.js';
15
13
  export interface ConfiguratorInterface<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, NAVIGATION_STATES extends string, VIEW_STATES extends string, TOOL_STATES extends string, EXPORT_STATES extends string, FINALIZE_DATA extends Record<string, unknown>, FINALIZE_RESULT extends Record<string, unknown>> {
16
14
  /**
@@ -1 +1 @@
1
- import{createCustomPhoenixEntityElement as e,createCustomPhoenixLayoutElement as o,createGetThemeHandler as r,createGetWebComponentOptionsHandler as t,createPhoenixHandler as i,createTransformer as n,createTransformerBuilder as s,createUpdateFactory as a,getIdSequence as m,isCreateEntityUpdate as p,isReplaceEntityUpdate as d}from"#package/domain";import{createAddEntityFab as f,createCollectFrontendDataHandler as u,createDeleteEntityFab as c,createFilterPublishedChunksHandler as g,createNavigationHotspot as l,createNotAuthenticatedPage as j,createSelectionHotspot as x,createToolMenuFab as k,isAngleDimensionUpdate as y,isAttributeSelectionUpdate as I,isAttributeSwitchUpdate as A,isDeleteEntityUpdate as C,isDistanceDimensionUpdate as S,isGenericDimensionUpdate as w,isSwatchSelectionUpdate as E,isTextValueUpdate as b,useAccessService as q,useActiveNavigationState as B,useActiveToolState as P,useActiveViewState as R,useActiveViewports as U,useAnalyticsService as h,useAngleDimension as v,useAttributeSelection as z,useAttributeSwitch as D,useAuthenticatedClient as F,useAuthorizedClient as G,useBackendData as H,useChildEntitySelection as J,useCommittedSlice as K,useCommittedState as L,useComponent as M,useComponents as N,useComposition as O,useConfigurationId as Q,useConfigurationSaveState as T,useConfiguratorMessages as V,useControlViolations as W,useCookRecipes as X,useCookReplaceRecipes as Y,useCookedRecipes as Z,useCookedReplaceRecipes as $,useCreateAuthorizedClient as _,useDeleteEntity as ee,useDeletedEntity as eo,useDeselect as er,useDistanceDimension as et,useDistanceDimensionSelection as ei,useDomain as en,useDomainApplication as es,useDomainApplicationProps as ea,useDomainEntityRenderedState as em,useDomainEntityState as ep,useEntityPrice as ed,useEntitySelector as ef,useFinalizeAction as eu,useFinalizeActions as ec,useFinalizeViolations as eg,useFirstComponent as el,useFirstRenderedComponent as ej,useFirstRootComponent as ex,useFirstRootRenderedComponent as ek,useFrontendData as ey,useGenerateShareLink as eI,useGenericDimension as eA,useGroupedRecipeOptions as eC,useHoveredDomainEntityId as eS,useHoveredEntity as ew,useHoveredEntityId as eE,useIntegrationService as eb,useIntegrationState as eq,useIsFullscreenActive as eB,useLoadedData as eP,useLoadingState as eR,useLoadingStateValue as eU,useLocaleSwitch as eh,useLocalizable as ev,useMapViolationHints as ez,useNavigate as eD,usePopNavigate as eF,usePresetEmbeddedState as eG,usePublishedData as eH,usePushNavigate as eJ,useRecipeEmbeddedState as eK,useRenderedComponent as eL,useRenderedComponents as eM,useRenderedEntitySelector as eN,useRenderedRootEntitySelector as eO,useRenderedSelector as eQ,useRenderedSelector$ as eT,useRenderedSlice as eV,useRenderedState as eW,useReplaceEntityRecipeOptions as eX,useResolveLocalizable as eY,useRootComponents as eZ,useRootEntityId as e$,useRootEntityPrice as e_,useRootEntityRenderedId as e0,useRootEntityRenderedState as e1,useRootEntitySelector as e2,useRootEntityState as e3,useRootRenderedComponents as e4,useSelectEntity as e5,useSelectParent as e6,useSelectedDomainEntityId as e7,useSelectedEntity as e8,useSelectedEntityId as e9,useSession as oe,useSessionRole as oo,useSessionService as or,useSetFullscreen as ot,useSetViewState as oi,useShareLinks as on,useStateValidity as os,useStepNavigation as oa,useStoreSelector as om,useStoreSelector$ as op,useSwatchSelection as od,useTabNavigation as of,useTextValue as ou,useUndoRedo as oc,useUpdateControl as og,useUpdatedControl as ol}from"#package/react-sdk";import{createPhoenixIconSet as oj}from"#package/ui-sdk";import{useConfigurator as ox}from"../application-runtime/index.js";import{createConfigurationNotFoundPage as ok}from"../configuration-not-found-page/index.js";import{createOnApplicationStartProvider as oy,createOnBackendDataReadyProvider as oI,createOnConfiguratorReadyProvider as oA,createOnFrontendDataReadyProvider as oC,createOnGoToIndexHandler as oS,createOnPresetLoadedHandler as ow,createOnPublishedDataReadyProvider as oE,createOnRoutingReadyProvider as ob,createOnSessionReadyProvider as oq,useConfiguratorRouting as oB,usePresetSelection as oP,usePreview as oR,usePropertyPageStack as oU,usePropertyPageState as oh}from"../configurator-context/index.js";import{createConfiguratorErrorPage as ov}from"../configurator-error-page/index.js";import{useCloseAction as oz}from"../integration/index.js";import{createGetTextureProcessingMapHandler as oD}from"../scene/index.js";import{useUpdateEntityObjectSelection as oF}from"../scene/scene-entity/drag-and-drop/use-updated-selection.js";import{useAssistantPanel as oG,useMeasurements as oH,useToolbarActions as oJ}from"../toolbar-actions/index.js";import{LayoutSlots as oK,createAppLoader as oL,createCanvasLoader as oM,createLayoutAdminUi as oN,createLayoutCustomOwnerUi as oO,createLayoutCustomReadUi as oQ,createLayoutDialog as oT,createLayoutFooter as oV,createLayoutToolbarDesktop as oW,createLayoutToolbarDesktopFullScreen as oX,createLayoutToolbarReadDesktop as oY,createLayoutToolbarReadDesktopFullScreen as oZ,createLayoutUserUi as o$,createToolbarHelp as o_,useSceneSafeArea as o0}from"../ui/index.js";import{createPresetDeviceNotSupported as o1,createPresetPageAction as o2,createPresetUi as o3}from"../ui/preset-layout/PresetUi.js";import{useResetCamera as o4}from"./use-reset-camera.js";export const createConfiguratorInterface=o5=>({updates:a(),getIdSequence:m,createGetWebComponentOptionsHandler:t,createGetThemeHandler:r,createPhoenixHandler:i,createCustomPhoenixEntityElement:e,createCustomPhoenixLayoutElement:o,createPhoenixIconSet:oj,createGetTextureProcessingMapHandler:oD,createCollectFrontendDataHandler:u,createFilterPublishedChunksHandler:g,createOnGoToIndexHandler:oS,createOnApplicationStartProvider:oy,createOnSessionReadyProvider:oq,createOnPublishedDataReadyProvider:oE,createOnFrontendDataReadyProvider:oC,createOnBackendDataReadyProvider:oI,createOnRoutingReadyProvider:ob,createOnConfiguratorReadyProvider:oA,createOnPresetLoadedHandler:ow,createPresetUi:o3,createPresetPageAction:o2,createPresetDeviceNotSupported:o1,createLayoutFooter:oV,createAppLoader:oL,createCanvasLoader:oM,createLayoutDialog:oT,createLayoutToolbarDesktop:oW,createLayoutToolbarDesktopFullScreen:oX,createLayoutToolbarReadDesktop:oY,createLayoutToolbarReadDesktopFullScreen:oZ,createLayoutCustomOwnerUi:oO,createLayoutCustomReadUi:oQ,createLayoutAdminUi:oN,createLayoutUserUi:o$,createToolbarHelp:o_,createNotAuthenticatedPage:j,createConfigurationNotFoundPage:ok,createConfiguratorErrorPage:ov,createAddEntityFab:f,createDeleteEntityFab:c,createSelectionHotspot:x,createNavigationHotspot:l,createToolMenuFab:k,createTransformer:n,transformerBuilder:s(),useAnalytics:h,useAuthenticatedClient:F,useAuthorizedClient:G,useCreateAuthorizedClient:_,useAccessService:q,useConfigurationId:Q,useSession:oe,useSessionRole:oo,useSessionService:or,useDomain:en,useDomainApplication:es,useConfigurator:ox,useConfiguratorRouting:oB,usePresetSelection:oP,usePublishedData:eH,useFrontendData:ey,useBackendData:H,useDomainApplicationProps:ea,useLoadedData:eP,useIntegrationService:eb,useIntegrationState:eq,usePresetEmbeddedState:eG,useRecipeEmbeddedState:eK,useCommittedSlice:K,useRenderedSlice:eV,useCommittedState:L,useRenderedState:eW,useStoreSelector:om,useRenderedSelector:eQ,useStoreSelector$:op,useRenderedSelector$:eT,useEntitySelector:ef,useRenderedEntitySelector:eN,useRootEntitySelector:e2,useRenderedRootEntitySelector:eO,useStateValidity:os,useMapViolationHints:ez,useNavigate:eD,usePopNavigate:eF,usePushNavigate:eJ,useControlViolations:W,useFinalizeViolations:eg,useConfiguratorMessages:V,useConfigurationSaveState:T,useFinalizeAction:eu,useFinalizeActions:ec,useComponent:M,useRenderedComponent:eL,useComponents:N,useRenderedComponents:eM,useFirstComponent:el,useFirstRenderedComponent:ej,useRootComponents:eZ,useRootRenderedComponents:e4,useFirstRootComponent:ex,useFirstRootRenderedComponent:ek,useEntityState:ep,useEntityRenderedState:em,useRootEntityState:e3,useRootEntityRenderedState:e1,useRootEntityId:e$,useRootEntityRenderedId:e0,useEntityPrice:ed,useRootEntityPrice:e_,useSelectedEntity:e8,useSelectedEntityId:e9,useSelectedDomainEntityId:e7,useSelectEntity:e5,useDeselect:er,useSelectParent:e6,useHoveredEntity:ew,useHoveredEntityId:eE,useHoveredDomainEntityId:eS,useActiveNavigationState:B,useActiveViewState:R,useSetViewState:oi,useActiveToolState:P,useIsFullscreenActive:eB,useSetFullscreen:ot,useResetCamera:o4,useUndoRedo:oc,useTabNavigation:of,useStepNavigation:oa,useSceneSafeArea:o0,useActiveViewports:U,usePreview:oR,useCloseAction:oz,useIsCloningAllowed:oK.useIsCloningAllowed,useResolveLocalizable:eY,useLocalizable:ev,useToolbarActions:oJ,useMeasurements:oH,useLocaleSwitch:eh,useShareLinks:on,useAssistantPanel:oG,useComposition:O,useUpdateControl:og,useUpdatedControl:ol,useCookRecipes:X,useCookedRecipes:Z,useCookReplaceRecipes:Y,useCookedReplaceRecipes:$,useDeleteEntity:ee,useDeletedEntity:eo,useSwatchSelection:od,useTextValue:ou,useAttributeSelection:z,useAttributeSwitch:D,useDistanceDimension:et,useDistanceDimensionSelection:ei,useGenericDimension:eA,useAngleDimension:v,useChildEntitySelection:J,useGroupedRecipeOptions:eC,useReplaceEntityRecipeOptions:eX,useUpdateEntityObjectSelection:oF,useGenerateShareLink:eI,useLoadingState:eR,useLoadingStateValue:eU,usePropertyPageStack:oU,usePropertyPageState:oh,isCreateEntityUpdate:p,isReplaceEntityUpdate:d,isDeleteEntityUpdate:C,isAngleDimensionUpdate:y,isDistanceDimensionUpdate:S,isGenericDimensionUpdate:w,isAttributeSelectionUpdate:I,isAttributeSwitchUpdate:A,isTextValueUpdate:b,isSwatchSelectionUpdate:E});
1
+ import{createCustomPhoenixEntityElement as e,createCustomPhoenixLayoutElement as t,createGetThemeHandler as r,createGetWebComponentOptionsHandler as o,createPhoenixHandler as i,createTransformer as n,createTransformerBuilder as s,createUpdateFactory as a,getIdSequence as m,isCreateEntityUpdate as p,isReplaceEntityUpdate as d}from"#package/domain";import{createAddEntityFab as c,createAppLoader as u,createCollectFrontendDataHandler as f,createConfigurationNotFoundPage as l,createConfiguratorErrorPage as g,createDeleteEntityFab as j,createFilterPublishedChunksHandler as x,createNavigationHotspot as k,createNotAuthenticatedPage as y,createPresetUi as I,createSelectionHotspot as A,createToolMenuFab as C,isAngleDimensionUpdate as S,isAttributeSelectionUpdate as w,isAttributeSwitchUpdate as E,isDeleteEntityUpdate as b,isDistanceDimensionUpdate as q,isGenericDimensionUpdate as B,isSwatchSelectionUpdate as P,isTextValueUpdate as R,useAccessService as U,useActiveNavigationState as h,useActiveToolState as v,useActiveViewState as z,useActiveViewports as D,useAnalyticsService as F,useAngleDimension as G,useAttributeSelection as H,useAttributeSwitch as J,useAuthenticatedClient as K,useAuthorizedClient as L,useBackendData as M,useChildEntitySelection as N,useCommittedSlice as O,useCommittedState as Q,useComponent as T,useComponents as V,useComposition as W,useConfigurationId as X,useConfigurationSaveState as Y,useConfiguratorMessages as Z,useControlViolations as $,useCookRecipes as _,useCookReplaceRecipes as ee,useCookedRecipes as et,useCookedReplaceRecipes as er,useCreateAuthorizedClient as eo,useDeleteEntity as ei,useDeletedEntity as en,useDeselect as es,useDistanceDimension as ea,useDistanceDimensionSelection as em,useDomain as ep,useDomainApplication as ed,useDomainApplicationProps as ec,useDomainEntityRenderedState as eu,useDomainEntityState as ef,useEntityPrice as el,useEntitySelector as eg,useFinalizeAction as ej,useFinalizeActions as ex,useFinalizeViolations as ek,useFirstComponent as ey,useFirstRenderedComponent as eI,useFirstRootComponent as eA,useFirstRootRenderedComponent as eC,useFrontendData as eS,useGenerateShareLink as ew,useGenericDimension as eE,useGroupedRecipeOptions as eb,useHoveredDomainEntityId as eq,useHoveredEntity as eB,useHoveredEntityId as eP,useIntegrationService as eR,useIntegrationState as eU,useIsFullscreenActive as eh,useLoadedData as ev,useLoadingState as ez,useLoadingStateValue as eD,useLocaleSwitch as eF,useLocalizable as eG,useMapViolationHints as eH,useNavigate as eJ,usePopNavigate as eK,usePresetEmbeddedState as eL,usePublishedData as eM,usePushNavigate as eN,useRecipeEmbeddedState as eO,useRenderedComponent as eQ,useRenderedComponents as eT,useRenderedEntitySelector as eV,useRenderedRootEntitySelector as eW,useRenderedSelector as eX,useRenderedSelector$ as eY,useRenderedSlice as eZ,useRenderedState as e$,useReplaceEntityRecipeOptions as e_,useResolveLocalizable as e0,useRootComponents as e1,useRootEntityId as e2,useRootEntityPrice as e3,useRootEntityRenderedId as e4,useRootEntityRenderedState as e5,useRootEntitySelector as e6,useRootEntityState as e7,useRootRenderedComponents as e8,useSelectEntity as e9,useSelectParent as te,useSelectedDomainEntityId as tt,useSelectedEntity as tr,useSelectedEntityId as to,useSession as ti,useSessionRole as tn,useSessionService as ts,useSetFullscreen as ta,useSetViewState as tm,useShareLinks as tp,useStateValidity as td,useStepNavigation as tc,useStoreSelector as tu,useStoreSelector$ as tf,useSwatchSelection as tl,useTabNavigation as tg,useTextValue as tj,useUndoRedo as tx,useUpdateControl as tk,useUpdatedControl as ty}from"#package/react-sdk";import{createPhoenixIconSet as tI}from"#package/ui-sdk";import{useConfigurator as tA}from"../application-runtime/index.js";import{createOnApplicationStartProvider as tC,createOnBackendDataReadyProvider as tS,createOnConfiguratorReadyProvider as tw,createOnFrontendDataReadyProvider as tE,createOnGoToIndexHandler as tb,createOnPresetLoadedHandler as tq,createOnPublishedDataReadyProvider as tB,createOnRoutingReadyProvider as tP,createOnSessionReadyProvider as tR,useConfiguratorRouting as tU,usePresetSelection as th,usePreview as tv,usePropertyPageStack as tz,usePropertyPageState as tD}from"../configurator-context/index.js";import{useCloseAction as tF}from"../integration/index.js";import{createGetTextureProcessingMapHandler as tG}from"../scene/index.js";import{useUpdateEntityObjectSelection as tH}from"../scene/scene-entity/drag-and-drop/use-updated-selection.js";import{useAssistantPanel as tJ,useMeasurements as tK,useToolbarActions as tL}from"../toolbar-actions/index.js";import{LayoutSlots as tM,createCanvasLoader as tN,createLayoutAdminUi as tO,createLayoutCustomOwnerUi as tQ,createLayoutCustomReadUi as tT,createLayoutDialog as tV,createLayoutFooter as tW,createLayoutToolbarDesktop as tX,createLayoutToolbarDesktopFullScreen as tY,createLayoutToolbarReadDesktop as tZ,createLayoutToolbarReadDesktopFullScreen as t$,createLayoutUserUi as t_,createToolbarHelp as t0,useSceneSafeArea as t1}from"../ui/index.js";import{createPresetDeviceNotSupported as t2,createPresetPageAction as t3}from"../ui/preset-layout/PresetUi.js";import{useResetCamera as t4}from"./use-reset-camera.js";export const createConfiguratorInterface=t5=>({updates:a(),getIdSequence:m,createGetWebComponentOptionsHandler:o,createGetThemeHandler:r,createPhoenixHandler:i,createCustomPhoenixEntityElement:e,createCustomPhoenixLayoutElement:t,createPhoenixIconSet:tI,createGetTextureProcessingMapHandler:tG,createCollectFrontendDataHandler:f,createFilterPublishedChunksHandler:x,createOnGoToIndexHandler:tb,createOnApplicationStartProvider:tC,createOnSessionReadyProvider:tR,createOnPublishedDataReadyProvider:tB,createOnFrontendDataReadyProvider:tE,createOnBackendDataReadyProvider:tS,createOnRoutingReadyProvider:tP,createOnConfiguratorReadyProvider:tw,createOnPresetLoadedHandler:tq,createPresetUi:I,createPresetPageAction:t3,createPresetDeviceNotSupported:t2,createLayoutFooter:tW,createAppLoader:u,createCanvasLoader:tN,createLayoutDialog:tV,createLayoutToolbarDesktop:tX,createLayoutToolbarDesktopFullScreen:tY,createLayoutToolbarReadDesktop:tZ,createLayoutToolbarReadDesktopFullScreen:t$,createLayoutCustomOwnerUi:tQ,createLayoutCustomReadUi:tT,createLayoutAdminUi:tO,createLayoutUserUi:t_,createToolbarHelp:t0,createNotAuthenticatedPage:y,createConfigurationNotFoundPage:l,createConfiguratorErrorPage:g,createAddEntityFab:c,createDeleteEntityFab:j,createSelectionHotspot:A,createNavigationHotspot:k,createToolMenuFab:C,createTransformer:n,transformerBuilder:s(),useAnalytics:F,useAuthenticatedClient:K,useAuthorizedClient:L,useCreateAuthorizedClient:eo,useAccessService:U,useConfigurationId:X,useSession:ti,useSessionRole:tn,useSessionService:ts,useDomain:ep,useDomainApplication:ed,useConfigurator:tA,useConfiguratorRouting:tU,usePresetSelection:th,usePublishedData:eM,useFrontendData:eS,useBackendData:M,useDomainApplicationProps:ec,useLoadedData:ev,useIntegrationService:eR,useIntegrationState:eU,usePresetEmbeddedState:eL,useRecipeEmbeddedState:eO,useCommittedSlice:O,useRenderedSlice:eZ,useCommittedState:Q,useRenderedState:e$,useStoreSelector:tu,useRenderedSelector:eX,useStoreSelector$:tf,useRenderedSelector$:eY,useEntitySelector:eg,useRenderedEntitySelector:eV,useRootEntitySelector:e6,useRenderedRootEntitySelector:eW,useStateValidity:td,useMapViolationHints:eH,useNavigate:eJ,usePopNavigate:eK,usePushNavigate:eN,useControlViolations:$,useFinalizeViolations:ek,useConfiguratorMessages:Z,useConfigurationSaveState:Y,useFinalizeAction:ej,useFinalizeActions:ex,useComponent:T,useRenderedComponent:eQ,useComponents:V,useRenderedComponents:eT,useFirstComponent:ey,useFirstRenderedComponent:eI,useRootComponents:e1,useRootRenderedComponents:e8,useFirstRootComponent:eA,useFirstRootRenderedComponent:eC,useEntityState:ef,useEntityRenderedState:eu,useRootEntityState:e7,useRootEntityRenderedState:e5,useRootEntityId:e2,useRootEntityRenderedId:e4,useEntityPrice:el,useRootEntityPrice:e3,useSelectedEntity:tr,useSelectedEntityId:to,useSelectedDomainEntityId:tt,useSelectEntity:e9,useDeselect:es,useSelectParent:te,useHoveredEntity:eB,useHoveredEntityId:eP,useHoveredDomainEntityId:eq,useActiveNavigationState:h,useActiveViewState:z,useSetViewState:tm,useActiveToolState:v,useIsFullscreenActive:eh,useSetFullscreen:ta,useResetCamera:t4,useUndoRedo:tx,useTabNavigation:tg,useStepNavigation:tc,useSceneSafeArea:t1,useActiveViewports:D,usePreview:tv,useCloseAction:tF,useIsCloningAllowed:tM.useIsCloningAllowed,useResolveLocalizable:e0,useLocalizable:eG,useToolbarActions:tL,useMeasurements:tK,useLocaleSwitch:eF,useShareLinks:tp,useAssistantPanel:tJ,useComposition:W,useUpdateControl:tk,useUpdatedControl:ty,useCookRecipes:_,useCookedRecipes:et,useCookReplaceRecipes:ee,useCookedReplaceRecipes:er,useDeleteEntity:ei,useDeletedEntity:en,useSwatchSelection:tl,useTextValue:tj,useAttributeSelection:H,useAttributeSwitch:J,useDistanceDimension:ea,useDistanceDimensionSelection:em,useGenericDimension:eE,useAngleDimension:G,useChildEntitySelection:N,useGroupedRecipeOptions:eb,useReplaceEntityRecipeOptions:e_,useUpdateEntityObjectSelection:tH,useGenerateShareLink:ew,useLoadingState:ez,useLoadingStateValue:eD,usePropertyPageStack:tz,usePropertyPageState:tD,isCreateEntityUpdate:p,isReplaceEntityUpdate:d,isDeleteEntityUpdate:b,isAngleDimensionUpdate:S,isDistanceDimensionUpdate:q,isGenericDimensionUpdate:B,isAttributeSelectionUpdate:w,isAttributeSwitchUpdate:E,isTextValueUpdate:R,isSwatchSelectionUpdate:P});