@salsita-ai/sdk 0.50.0-develop.fbe43b9a2d → 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.
- package/dist/application/index.d.ts +1 -0
- package/dist/application/index.js +1 -1
- package/dist/application/mount-application.d.ts +1 -1
- package/dist/application/mount-application.js +1 -1
- package/dist/application/mount-configurator.d.ts +19 -0
- package/dist/application/mount-configurator.js +1 -0
- package/dist/application/mounted-application-runtime.d.ts +4 -0
- package/dist/application/mounted-application-runtime.js +1 -0
- package/dist/application/register-web-component.d.ts +2 -0
- package/dist/application/register-web-component.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +11 -5
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +1 -1
- package/dist/application-spec/generate-application/implementations/phx-application-types.d.ts +25 -0
- package/dist/application-spec/generate-application/implementations/phx-application-types.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx-domain.d.ts +36 -0
- package/dist/application-spec/generate-application/implementations/phx-domain.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx-model.d.ts +24 -0
- package/dist/application-spec/generate-application/implementations/phx-model.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx.d.ts +22 -0
- package/dist/application-spec/generate-application/implementations/phx.js +1 -0
- package/dist/application-spec/generate-application/index.d.ts +2 -0
- package/dist/application-spec/generate-application/index.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +3 -3
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +7 -4
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.d.ts +16 -0
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +17 -4
- package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/application-spec-slice.d.ts +71 -0
- package/dist/application-spec/generate-application/runtime/application-spec-slice.js +1 -0
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +3 -3
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +7 -5
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.d.ts +16 -0
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime/create-application.d.ts +57 -0
- package/dist/application-spec/generate-application/runtime/create-application.js +1 -0
- package/dist/application-spec/generate-application/runtime/index.d.ts +8 -0
- package/dist/application-spec/generate-application/runtime/index.js +1 -0
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +9 -3
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/spec-runtime.d.ts +21 -0
- package/dist/application-spec/generate-application/runtime/spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +3 -2
- package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +44 -9
- package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -1
- package/dist/client/authorized-client.d.ts +3 -1
- package/dist/client/authorized-client.js +1 -1
- package/dist/client/contract.d.ts +17 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/local-authorized-client.d.ts +3 -1
- package/dist/client/local-authorized-client.js +1 -1
- package/dist/client/memory-authorized-client.d.ts +4 -1
- package/dist/client/memory-authorized-client.js +1 -1
- package/dist/client/phoenix-api.d.ts +228 -0
- package/dist/configurator/ConfiguratorApp.js +1 -1
- package/dist/configurator/app-loader-content/index.d.ts +0 -1
- package/dist/configurator/app-loader-content/index.js +1 -1
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +17 -3
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +23 -6
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +15 -9
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/common/configurator-interface.d.ts +8 -5
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/configurator/configuration-not-found-page/BuiltInConfigurationNotFoundPage.d.ts +5 -0
- package/dist/configurator/configuration-not-found-page/BuiltInConfigurationNotFoundPage.js +1 -0
- package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.d.ts +0 -6
- package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.js +1 -1
- package/dist/configurator/configuration-not-found-page/index.d.ts +2 -2
- package/dist/configurator/configuration-not-found-page/index.js +1 -1
- package/dist/configurator/configurator-context/ConfiguratorResponsiveProvider.d.ts +3 -3
- package/dist/configurator/configurator-context/ConfiguratorResponsiveProvider.js +1 -1
- package/dist/configurator/configurator-context/PreviewContextProvider.js +1 -1
- package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.d.ts +3 -3
- package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.js +1 -1
- package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.d.ts +0 -5
- package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.js +1 -1
- package/dist/configurator/configurator-error-page/index.d.ts +1 -2
- package/dist/configurator/configurator-error-page/index.js +1 -1
- package/dist/configurator/index.d.ts +9 -2
- package/dist/configurator/index.js +1 -1
- package/dist/configurator/pages/default-configurator-elements.js +1 -1
- package/dist/configurator/pages/error-boundaries/LoadingErrorBoundary.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.d.ts +1 -1
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.d.ts +12 -4
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.d.ts +8 -0
- package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.js +1 -0
- package/dist/configurator/ui/configurator-layout/slots/canvas/LayoutCanvas.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/canvas/SharedCanvas.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/ReactiveInterfaceLayout.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/AppLoader.d.ts +0 -7
- package/dist/configurator/ui/phoenix-layout-elements/AppLoader.js +2 -2
- package/dist/configurator/ui/phoenix-layout-elements/index.d.ts +8 -1
- package/dist/configurator/ui/phoenix-layout-elements/index.js +1 -1
- package/dist/configurator/ui/preset-layout/PresetUi.d.ts +0 -2
- package/dist/configurator/ui/preset-layout/PresetUi.js +1 -1
- package/dist/configurator/ui/preset-layout/index.d.ts +6 -1
- package/dist/configurator/ui/preset-layout/index.js +1 -1
- package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.js +1 -1
- package/dist/docs/index.json +34 -1
- package/dist/docs/integrations/webcomponent-api/basics.mdx +2 -0
- package/dist/docs/layouts/custom-layout.mdx +318 -158
- package/dist/docs/layouts/gallery/ardent-compressor.mdx +1 -0
- package/dist/docs/layouts/gallery/corvid-drone.mdx +3428 -0
- package/dist/docs/layouts/gallery/fenwick-window.mdx +198 -127
- package/dist/docs/layouts/gallery/nightjar-guitar.mdx +3698 -0
- package/dist/docs/layouts/gallery/sunfold-solar.mdx +16 -4
- package/dist/docs/layouts/gallery/tidepool-aquascape.mdx +5203 -0
- package/dist/docs/phoenix/configurator-interface.mdx +8 -6
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +4 -2
- package/dist/docs/phoenix/sessions-and-access.mdx +2 -0
- package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
- package/dist/domain/application/configurator-builder.d.ts +7 -1
- package/dist/domain/application/configurator-builder.js +1 -1
- package/dist/domain/application/index.d.ts +1 -1
- package/dist/domain/application/index.js +1 -1
- package/dist/domain/application/standard-properties.js +1 -1
- package/dist/domain/application/web-component-property.d.ts +3 -1
- package/dist/domain/application/web-component-property.js +1 -1
- package/dist/domain/domain-builder.d.ts +9 -3
- package/dist/domain/domain-builder.js +1 -1
- package/dist/domain/domain-runtime/application.d.ts +39 -0
- package/dist/domain/domain-runtime/application.js +1 -0
- package/dist/domain/domain-runtime/domain-context/selectors.d.ts +1 -0
- package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
- package/dist/domain/domain-runtime/domain-runtime.d.ts +40 -4
- package/dist/domain/domain-runtime/domain-runtime.js +1 -1
- package/dist/domain/domain-runtime/environment/initialize.d.ts +1 -1
- package/dist/domain/domain-runtime/errors/implementation-error-collector.d.ts +2 -0
- package/dist/domain/domain-runtime/errors/implementation-error-collector.js +1 -1
- package/dist/domain/domain-runtime/index.d.ts +2 -1
- package/dist/domain/domain-runtime/index.js +1 -1
- package/dist/domain/domain-runtime/spec/index.d.ts +1 -1
- package/dist/domain/domain-runtime/spec/index.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +1 -0
- package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/merge-expression-modules.d.ts +23 -0
- package/dist/domain/domain-runtime/spec/module-checks/merge-expression-modules.js +1 -0
- package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.d.ts +3 -4
- package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.js +1 -1
- package/dist/domain/domain-runtime/web-component/actions.d.ts +3 -0
- package/dist/domain/domain-runtime/web-component/actions.js +1 -1
- package/dist/domain/domain-runtime/web-component/initialize.d.ts +1 -0
- package/dist/domain/domain-runtime/web-component/initialize.js +1 -1
- package/dist/domain/domain-runtime/web-component/selectors.d.ts +2 -0
- package/dist/domain/domain-runtime/web-component/selectors.js +1 -1
- package/dist/domain/domain-runtime/web-component/types.d.ts +6 -3
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +7 -0
- package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
- package/dist/editor/domain-editors/apply-spec-update.d.ts +2 -1
- package/dist/editor/domain-editors/apply-spec-update.js +1 -1
- package/dist/editor/domain-editors/use-implementation-files.d.ts +6 -14
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
- package/dist/legacy/domain-cli/utils/cache.js +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/claude-md.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/cursor-rules.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.js +11 -5
- package/dist/react-sdk/application-runtime/common-services/analytics/analytics-service.d.ts +1 -1
- package/dist/react-sdk/application-runtime/common-services/initialize.d.ts +2 -2
- package/dist/react-sdk/application-runtime/hooks/index.d.ts +2 -0
- package/dist/react-sdk/application-runtime/hooks/index.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/loading/index.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/loading/index.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/loader-host-context.d.ts +11 -0
- package/dist/react-sdk/application-runtime/hooks/loading/loader-host-context.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-awaiting-loading-phase.d.ts +8 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-awaiting-loading-phase.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-loader-hosted.d.ts +7 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-loader-hosted.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-actions.d.ts +9 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-actions.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-application.d.ts +24 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-application.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/index.d.ts +3 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/index.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-actions.d.ts +9 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-actions.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.d.ts +26 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-state.d.ts +10 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-state.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.d.ts +24 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/use-access-service.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/use-access-service.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.d.ts +4 -11
- package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-web-component.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/use-web-component.js +1 -1
- package/dist/react-sdk/application-runtime/host-properties/actions.d.ts +15 -0
- package/dist/react-sdk/application-runtime/host-properties/actions.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.d.ts +30 -0
- package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.d.ts +7 -0
- package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.d.ts +21 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.d.ts +42 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/index.d.ts +8 -0
- package/dist/react-sdk/application-runtime/host-properties/index.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/initialize.d.ts +7 -0
- package/dist/react-sdk/application-runtime/host-properties/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/selectors.d.ts +54 -0
- package/dist/react-sdk/application-runtime/host-properties/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/types.d.ts +18 -0
- package/dist/react-sdk/application-runtime/index.d.ts +3 -0
- package/dist/react-sdk/application-runtime/loading/actions.d.ts +45 -0
- package/dist/react-sdk/application-runtime/loading/actions.js +1 -0
- package/dist/react-sdk/application-runtime/loading/index.d.ts +4 -0
- package/dist/react-sdk/application-runtime/loading/index.js +1 -0
- package/dist/react-sdk/application-runtime/loading/initialize.d.ts +3 -0
- package/dist/react-sdk/application-runtime/loading/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/loading/selectors.d.ts +18 -0
- package/dist/react-sdk/application-runtime/loading/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/loading/types.d.ts +59 -0
- package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
- package/dist/react-sdk/application-runtime/provider/ApplicationRuntime.d.ts +6 -0
- package/dist/react-sdk/application-runtime/provider/ApplicationRuntime.js +1 -1
- package/dist/react-sdk/application-runtime/provider/ApplicationType.d.ts +7 -0
- package/dist/react-sdk/application-runtime/provider/ApplicationType.js +1 -1
- package/dist/react-sdk/application-runtime/responsive/actions.d.ts +47 -0
- package/dist/react-sdk/application-runtime/responsive/actions.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/index.d.ts +4 -0
- package/dist/react-sdk/application-runtime/responsive/index.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/initialize.d.ts +3 -0
- package/dist/react-sdk/application-runtime/responsive/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/selectors.d.ts +20 -0
- package/dist/react-sdk/application-runtime/responsive/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/types.d.ts +104 -0
- package/dist/react-sdk/application-runtime/responsive/types.js +1 -0
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +309 -8
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
- package/dist/react-sdk/domain-application-context/BackendDataProvider.js +1 -1
- package/dist/react-sdk/domain-application-context/FrontendDataProvider.js +1 -1
- package/dist/react-sdk/domain-application-context/PublishedDataProvider.js +1 -1
- package/dist/react-sdk/domain-context/common-hooks/index.d.ts +1 -0
- package/dist/react-sdk/domain-context/common-hooks/index.js +1 -1
- package/dist/react-sdk/domain-context/common-hooks/use-configuration-save-state.d.ts +23 -0
- package/dist/react-sdk/domain-context/common-hooks/use-configuration-save-state.js +1 -0
- package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +1 -0
- package/dist/react-sdk/domain-context/index.d.ts +1 -0
- package/dist/react-sdk/domain-context/index.js +1 -1
- package/dist/react-sdk/elements/index.d.ts +0 -1
- package/dist/react-sdk/index.d.ts +1 -1
- package/dist/react-sdk/index.js +1 -1
- package/dist/react-sdk/loading-state/LoaderHost.d.ts +20 -0
- package/dist/react-sdk/loading-state/LoaderHost.js +1 -0
- package/dist/react-sdk/loading-state/built-in-loading-phase.d.ts +9 -0
- package/dist/react-sdk/loading-state/built-in-loading-phase.js +1 -0
- package/dist/react-sdk/loading-state/create-app-loader.d.ts +18 -0
- package/dist/react-sdk/loading-state/create-app-loader.js +1 -0
- package/dist/react-sdk/loading-state/index.d.ts +4 -2
- package/dist/react-sdk/loading-state/index.js +1 -1
- package/dist/react-sdk/loading-state/{LoadingStateProvider.d.ts → loading-state-hooks.d.ts} +3 -12
- package/dist/react-sdk/loading-state/loading-state-hooks.js +1 -0
- package/dist/react-sdk/page-elements/ConfigurationNotFoundPagePropsProvider.d.ts +17 -0
- package/dist/react-sdk/page-elements/ConfigurationNotFoundPagePropsProvider.js +1 -0
- package/dist/react-sdk/page-elements/ConfiguratorErrorPagePropsProvider.d.ts +17 -0
- package/dist/react-sdk/page-elements/ConfiguratorErrorPagePropsProvider.js +1 -0
- package/dist/react-sdk/page-elements/configurator-error-page-props.js +1 -0
- package/dist/{configurator/configuration-not-found-page → react-sdk/page-elements}/create-configuration-not-found-page.d.ts +7 -1
- package/dist/react-sdk/page-elements/create-configuration-not-found-page.js +1 -0
- package/dist/{configurator/configurator-error-page → react-sdk/page-elements}/create-configurator-error-page.d.ts +6 -1
- package/dist/react-sdk/page-elements/create-configurator-error-page.js +1 -0
- package/dist/react-sdk/page-elements/create-preset-ui.d.ts +9 -0
- package/dist/react-sdk/page-elements/create-preset-ui.js +1 -0
- package/dist/react-sdk/page-elements/index.d.ts +6 -0
- package/dist/react-sdk/page-elements/index.js +1 -0
- package/dist/react-sdk/session/SessionServiceProvider.js +1 -1
- package/dist/react-sdk/web-component/create-web-component.js +1 -1
- package/dist/ui-sdk/responsive-application/ResponsiveApplicationProvider.d.ts +2 -2
- package/dist/ui-sdk/responsive-application/responsive-state-store.d.ts +11 -9
- package/dist/ui-sdk/responsive-application/use-store-responsive-info.js +1 -1
- package/package.json +3 -3
- package/dist/configurator/app-loader-content/app-loader-content-name.d.ts +0 -5
- package/dist/configurator/app-loader-content/app-loader-content-name.js +0 -1
- package/dist/configurator/configuration-not-found-page/create-configuration-not-found-page.js +0 -1
- package/dist/configurator/configurator-error-page/create-configurator-error-page.js +0 -1
- package/dist/react-sdk/loading-state/LoadingStateProvider.js +0 -1
- package/dist/react-sdk/loading-state/loading-state-manager.d.ts +0 -37
- package/dist/react-sdk/loading-state/loading-state-manager.js +0 -1
- package/dist/react-sdk/responsive-state/ResponsiveStateProvider.d.ts +0 -25
- package/dist/react-sdk/responsive-state/ResponsiveStateProvider.js +0 -1
- package/dist/react-sdk/responsive-state/canvas-padding.d.ts +0 -14
- package/dist/react-sdk/responsive-state/index.d.ts +0 -5
- package/dist/react-sdk/responsive-state/index.js +0 -1
- package/dist/react-sdk/responsive-state/responsive-state-manager.d.ts +0 -111
- package/dist/react-sdk/responsive-state/responsive-state-manager.js +0 -1
- package/dist/react-sdk/responsive-state/use-responsive-state-manager.d.ts +0 -10
- package/dist/react-sdk/responsive-state/use-responsive-state-manager.js +0 -1
- package/dist/react-sdk/responsive-state/use-responsive-state.d.ts +0 -11
- package/dist/react-sdk/responsive-state/use-responsive-state.js +0 -1
- /package/dist/react-sdk/{elements/configurator-error-page-props.js → application-runtime/host-properties/types.js} +0 -0
- /package/dist/react-sdk/{responsive-state/canvas-padding.js → application-runtime/loading/types.js} +0 -0
- /package/dist/react-sdk/{elements → page-elements}/configurator-error-page-props.d.ts +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
-
import type { ImportedTransformer } from '#package/domain';
|
|
2
|
+
import type { ImplementationErrorCollector, ImportedTransformer, ProjectModule } from '#package/domain';
|
|
3
3
|
import type { RuntimeReferenceStore } from '../../../caching/index.js';
|
|
4
4
|
import type { RuntimeSpec } from '../../runtime-spec/index.js';
|
|
5
|
-
import { FactoryDataRuntime } from '../factory-data/index.js';
|
|
5
|
+
import type { FactoryDataRuntime } from '../factory-data/index.js';
|
|
6
6
|
import { type MigrationModules, MigrationRuntime } from '../migrations/index.js';
|
|
7
7
|
import { ActionsRuntime } from '../sections/actions-runtime.js';
|
|
8
8
|
import { AssistantRuntime } from '../sections/assistant-runtime.js';
|
|
9
9
|
import { ComponentOptics } from '../sections/component-optic.js';
|
|
10
|
-
import {
|
|
10
|
+
import { ExpressionRuntime, type InvariantImplementations, type MissingExpression } from '../sections/expression-runtime.js';
|
|
11
11
|
import { PresetRuntime } from '../sections/preset-runtime.js';
|
|
12
12
|
import { ThemeRuntime } from '../sections/theme-runtime.js';
|
|
13
13
|
import { TransformersRuntime } from '../sections/transformers-runtime.js';
|
|
14
14
|
import type { SpecCodeMap } from '../spec-code/index.js';
|
|
15
|
-
import { ConfiguratorModelRuntime } from './configurator-model-runtime.js';
|
|
15
|
+
import type { ConfiguratorModelRuntime } from './configurator-model-runtime.js';
|
|
16
16
|
import { ConfiguratorStatesRuntime } from './states-runtime.js';
|
|
17
17
|
export type ConfiguratorRuntime = Branded<'ConfiguratorRuntime', {
|
|
18
18
|
readonly modelRuntime: ConfiguratorModelRuntime;
|
|
@@ -33,5 +33,7 @@ export type ConfiguratorRuntimeResult = {
|
|
|
33
33
|
} | {
|
|
34
34
|
readonly ok: false;
|
|
35
35
|
readonly missingExpressions: readonly MissingExpression[];
|
|
36
|
+
/** The migrations the migration modules do not export, as `migrationRuntime.missingMigrations` lists them. */
|
|
37
|
+
readonly missingMigrations: readonly string[];
|
|
36
38
|
};
|
|
37
|
-
export declare const ConfiguratorRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore,
|
|
39
|
+
export declare const ConfiguratorRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore, expressionModules: readonly ProjectModule[], importedTransformers: readonly ImportedTransformer[], invariantImplementations: InvariantImplementations | undefined, migrationModules: MigrationModules, code: SpecCodeMap | undefined, errors: ImplementationErrorCollector) => ConfiguratorRuntimeResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Branded as t}from"@salsita-ai/common/utils";import{
|
|
1
|
+
import{Branded as t}from"@salsita-ai/common/utils";import{MigrationRuntime as e}from"../migrations/index.js";import{ActionsRuntime as i}from"../sections/actions-runtime.js";import{AssistantRuntime as o}from"../sections/assistant-runtime.js";import{ComponentOptics as s}from"../sections/component-optic.js";import{ExpressionRuntime as r}from"../sections/expression-runtime.js";import{PresetRuntime as n}from"../sections/preset-runtime.js";import{ThemeRuntime as m}from"../sections/theme-runtime.js";import{TransformersRuntime as c}from"../sections/transformers-runtime.js";import{ConfiguratorSpecRuntime as u}from"./configurator-spec-runtime.js";import{ConfiguratorStatesRuntime as p}from"./states-runtime.js";export const ConfiguratorRuntime=(a,f,g,R,j,l,x,d)=>{let{modelRuntime:k,factoryDataRuntime:E}=u(a,f,x),S=r(a.configurator,f,g,"configuratorExpressionRuntime",j,x,d),h=e(f,{referenceScope:"configuratorRuntime/migrationRuntime",resolvedVersions:a.configurator.resolvedVersions,latestEntities:k.entities,migrationModules:l});return S.ok?{ok:!0,runtime:t({modelRuntime:k,componentOptics:s(f,{components:a.configurator.components,referenceScope:"configuratorRuntime/componentOptics",modelRuntime:k,code:x}),presetRuntime:n(f,{referenceScope:"configuratorRuntime/presetRuntime",presets:a.configurator.presets.presets}),statesRuntime:p(a,f),expressionRuntime:S.runtime,themeRuntime:m(a,f),transformersRuntime:c(a,f,R),assistantRuntime:o(a,f),actionsRuntime:i(a.configurator.actions,f),migrationRuntime:h,factoryDataRuntime:E})}:{ok:!1,missingExpressions:S.missing,missingMigrations:h.missingMigrations}};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
+
import type { RuntimeReferenceStore } from '../../../caching/index.js';
|
|
3
|
+
import type { RuntimeSpec } from '../../runtime-spec/index.js';
|
|
4
|
+
import { FactoryDataRuntime } from '../factory-data/index.js';
|
|
5
|
+
import type { SpecCodeMap } from '../spec-code/index.js';
|
|
6
|
+
import { ConfiguratorModelRuntime } from './configurator-model-runtime.js';
|
|
7
|
+
/**
|
|
8
|
+
* The sections of the configurator domain that the spec alone determines: its model and the data
|
|
9
|
+
* of its `phx.domain` factories. `ConfiguratorRuntime` builds its own from this function, so a
|
|
10
|
+
* build of either in the same reference store returns the same objects.
|
|
11
|
+
*/
|
|
12
|
+
export type ConfiguratorSpecRuntime = Branded<'ConfiguratorSpecRuntime', {
|
|
13
|
+
readonly modelRuntime: ConfiguratorModelRuntime;
|
|
14
|
+
readonly factoryDataRuntime: FactoryDataRuntime;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const ConfiguratorSpecRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore, code: SpecCodeMap | undefined) => ConfiguratorSpecRuntime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Branded as t}from"@salsita-ai/common/utils";import{FactoryDataRuntime as r}from"../factory-data/index.js";import{ConfiguratorModelRuntime as a}from"./configurator-model-runtime.js";export const ConfiguratorSpecRuntime=(i,o,e)=>{let n=a(i.configurator,o,e);return t({modelRuntime:n,factoryDataRuntime:r(o,{referenceScope:"configuratorRuntime/factoryDataRuntime",invariants:i.configurator.invariants,defaults:i.configurator.defaults,aliases:n.aliases,entities:n.entities})})};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Messages } from '@lingui/core';
|
|
2
|
+
import { type Application, type ElementRegistration, type ProjectModule } from '#package/domain';
|
|
3
|
+
import type { RuntimeReferenceStore } from '../../caching/index.js';
|
|
4
|
+
import type { RuntimeSpec } from '../runtime-spec/index.js';
|
|
5
|
+
import { type ThemePresets } from './application-spec-slice.js';
|
|
6
|
+
import type { MigrationModules } from './migrations/index.js';
|
|
7
|
+
import type { SpecCodeModule } from './spec-code/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* The project modules of an application, as the generated barrels list them: each file of a
|
|
10
|
+
* convention folder as `{ origin, exports }`, unchecked; the migration modules of both domains keyed
|
|
11
|
+
* by project path (`src/migrations/v2.ts`); and the message catalogs of `src/locales/<locale>/`,
|
|
12
|
+
* keyed by locale. `components` holds the files of `src/components/` and the frontend component
|
|
13
|
+
* files, in that order, and `elements` every element file the application mounts.
|
|
14
|
+
*/
|
|
15
|
+
export interface ApplicationModules {
|
|
16
|
+
readonly expressions: readonly ProjectModule[];
|
|
17
|
+
readonly invariants: readonly ProjectModule[];
|
|
18
|
+
readonly actions: readonly ProjectModule[];
|
|
19
|
+
readonly components: readonly ProjectModule[];
|
|
20
|
+
readonly handlers: readonly ProjectModule[];
|
|
21
|
+
readonly elements: readonly ProjectModule[];
|
|
22
|
+
readonly transformers: readonly ProjectModule[];
|
|
23
|
+
readonly adminExpressions: readonly ProjectModule[];
|
|
24
|
+
readonly adminInvariants: readonly ProjectModule[];
|
|
25
|
+
readonly adminComponents: readonly ProjectModule[];
|
|
26
|
+
readonly migrations: MigrationModules;
|
|
27
|
+
readonly catalogs: Readonly<Record<string, Messages>>;
|
|
28
|
+
}
|
|
29
|
+
export interface CreateApplicationInput {
|
|
30
|
+
/** The runtime spec, `.phoenix/application-spec.json` decoded with `decodeRuntimeSpec`. */
|
|
31
|
+
readonly spec: RuntimeSpec;
|
|
32
|
+
/** The store `createPhx` built the `phx` values in. */
|
|
33
|
+
readonly referenceStore: RuntimeReferenceStore;
|
|
34
|
+
/** The generated `.phoenix/spec-code.ts` module of the same generation as `spec`. */
|
|
35
|
+
readonly specCode?: SpecCodeModule | undefined;
|
|
36
|
+
readonly modules: ApplicationModules;
|
|
37
|
+
/** The SDK's default elements of the application kind; a project element with the same name replaces one. */
|
|
38
|
+
readonly defaultElements: readonly ElementRegistration[];
|
|
39
|
+
/** The SDK's theme presets by name, `getPhoenixThemes()`. */
|
|
40
|
+
readonly themePresets: ThemePresets;
|
|
41
|
+
readonly environment?: Application['environment'] | undefined;
|
|
42
|
+
/** The services a host provides; i18n is built from the catalogs. */
|
|
43
|
+
readonly services?: Omit<Application['services'], 'i18n'> | undefined;
|
|
44
|
+
/** The tag the web component mounts as; by default the spec's `webComponentTag`, else `salsita-configurator`. */
|
|
45
|
+
readonly tag?: string | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Builds an application from its runtime spec and its project modules, ready to mount, with no
|
|
49
|
+
* `ConfiguratorBuilder` and no `ApplicationConfig`: the full `ApplicationRuntime` in the store
|
|
50
|
+
* `createPhx` built the `phx` values in, the spec slice of the domain runtime, the initial published
|
|
51
|
+
* data and i18n.
|
|
52
|
+
*
|
|
53
|
+
* Every mistake of the project's files is reported at once, as one `ImplementationErrors`: a file
|
|
54
|
+
* that breaks its folder's contract, an expression defined twice or one the spec already gives a
|
|
55
|
+
* value, a declared expression no file implements and a migration no file exports.
|
|
56
|
+
*/
|
|
57
|
+
export declare const createApplication: <TYPES = unknown>(input: CreateApplicationInput) => Application<TYPES>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{setupI18n as e}from"@lingui/core";import{initConsoleLogger as t}from"@salsita-ai/common/utils";import{ImplementationError as i,NoopAnalyticsSystem as n,checkSingleInstanceHandlers as o,createDomainRuntime as a,createImplementationErrorCollector as r,createInitialPublishedData as s,resolveActionModules as m,resolveComponentOpticModules as c,resolveElementModule as l,resolveHandlerModule as p,resolveInvariantModules as u,resolveTransformerModule as d}from"#package/domain";import{defaultI18n as f,mergeCatalogs as g,sdkCatalog as h}from"#package/i18n";import{ApplicationRuntime as v}from"./application-runtime.js";import{applicationSpecSlice as E}from"./application-spec-slice.js";let M=(e,t,i)=>e.filter(e=>i.attempt(()=>(t(e),!0),!1)),w=(e,t,i)=>e.flatMap(e=>i.attempt(()=>t(e),[]));export const createApplication=I=>{let{spec:T,referenceStore:b,specCode:k,modules:x,environment:A={}}=I,C=r(),R=w(x.handlers,p,C),y=w(x.elements,l,C),N=w(x.transformers,e=>[d(e)],C),P=w(x.components,e=>c([e]),C),S=w(x.adminComponents,e=>c([e]),C),O=M(x.invariants,e=>u([e]),C),j=M(x.adminInvariants,e=>u([e]),C),L=M(x.actions,e=>m([e]),C),U=v(T,b,x.expressions,N,u(O),x.adminExpressions,u(j),x.migrations,k,C);if((U.ok?[...U.runtime.configurator.migrationRuntime.missingMigrations,...U.runtime.admin.migrationRuntime.missingMigrations]:U.missingMigrations).forEach(e=>C.add((e=>{let[t=e,n="migrateToVN"]=e.split("#");return new i({code:"MISSING_IMPLEMENTATION",origin:t,problem:`The migration ${n} is missing`,fix:`The spec declares the model version this file migrates to, so the file must export ${n}, the function that turns a state of the previous version into one of this version; without it a saved configuration of an earlier version cannot load. Add or rename the export.`})})(e))),C.throwIfAny(),!U.ok)throw Error("The application runtime could not be built, but no implementation error was recorded.");o(R);let $=E({runtime:U.runtime,spec:T,modules:{handlers:{handlers:R},elements:{elements:y},customComponentOptics:P,actionImplementations:m(L)},customAdminComponentOptics:S,defaultElements:I.defaultElements,themePresets:I.themePresets,environmentResourcesUrl:A.defaultEnvs?.resourcesUrl}),D=t(),F=s({adminDomainFactory:$.admin.factory,domainRuntime:a({application:{spec:$,environment:A},services:{analyticsService:new n,i18n:f,logger:D}}),adminPresets:U.runtime.admin.presetRuntime.presets,handlers:$.configurator.handlers,dataSpec:$.dataConfig??void 0,chunks:$.chunks,logger:D});return{spec:{...$,initialPublishedData:F},environment:A,services:{...I.services,i18n:e({messages:g([h,x.catalogs]),locale:T.configurator.ui.availableLocales[0]})},tag:I.tag??T.appMetadata.webComponentTag??"salsita-configurator"}};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ApplicationRuntime, type ApplicationRuntimeResult } from './application-runtime.js';
|
|
2
|
+
export { AdminModelRuntime } from './admin-runtime/admin-model-runtime.js';
|
|
3
|
+
export { ConfiguratorModelRuntime } from './configurator-runtime/configurator-model-runtime.js';
|
|
4
|
+
export { SpecRuntime } from './spec-runtime.js';
|
|
5
|
+
export * from './factory-data/index.js';
|
|
6
|
+
export * from './migrations/index.js';
|
|
7
|
+
export * from './sections/index.js';
|
|
8
|
+
export * from './spec-code/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ApplicationRuntime}from"./application-runtime.js";export{AdminModelRuntime}from"./admin-runtime/admin-model-runtime.js";export{ConfiguratorModelRuntime}from"./configurator-runtime/configurator-model-runtime.js";export{SpecRuntime}from"./spec-runtime.js";export*from"./factory-data/index.js";export*from"./migrations/index.js";export*from"./sections/index.js";export*from"./spec-code/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
-
import type { DomainEntity, Expression as DomainExpression, Invariant as DomainInvariant } from '#package/domain';
|
|
2
|
+
import type { DomainEntity, Expression as DomainExpression, Invariant as DomainInvariant, ImplementationErrorCollector, ProjectModule } from '#package/domain';
|
|
3
3
|
import type { RuntimeReferenceStore } from '../../../caching/index.js';
|
|
4
4
|
import type { Expressions } from '../../../parse-application-files/index.js';
|
|
5
5
|
import { type RuntimeModelVersion } from '../../runtime-spec/index.js';
|
|
@@ -39,11 +39,17 @@ interface ExpressionRuntimeSpec {
|
|
|
39
39
|
*
|
|
40
40
|
* Dispatches on `expression.implementation.kind`:
|
|
41
41
|
* - `relation` / `violations` — calls the matching SDK factory with params + runtime context
|
|
42
|
-
* - `user` — uses the
|
|
42
|
+
* - `user` — uses the implementation of the project files `expressionModules` (`src/expressions/`,
|
|
43
|
+
* or `src/admin/expressions/`), merged with the spec's aliases by `mergeExpressionModules`, or the
|
|
44
|
+
* one `builtIn` holds
|
|
43
45
|
* - `value` — evaluates the parsed {@link MemoEvalPlan}; stabilized per
|
|
44
46
|
* {@link canonicalEnhancedJsonValueKey} so identical values reuse the same
|
|
45
47
|
* evaluator across rebuilds. Its `$eval` code comes from `code`, the domain's map of the generated
|
|
46
48
|
* code module, when that holds it.
|
|
49
|
+
*
|
|
50
|
+
* A file that is wrong, or that defines an expression another file, the spec or `builtIn` already
|
|
51
|
+
* defines, is recorded in `errors` as an `ImplementationError` and left out. So is every declared
|
|
52
|
+
* expression without an implementation, which also makes the result an error.
|
|
47
53
|
*/
|
|
48
|
-
export declare const ExpressionRuntime: (spec: ExpressionRuntimeSpec, referenceStore: RuntimeReferenceStore,
|
|
54
|
+
export declare const ExpressionRuntime: (spec: ExpressionRuntimeSpec, referenceStore: RuntimeReferenceStore, expressionModules: readonly ProjectModule[], referenceScopePrefix: string, invariantImplementations: InvariantImplementations | undefined, code: SpecCodeMap | undefined, errors: ImplementationErrorCollector, builtIn?: ExpressionImplementations) => ExpressionRuntimeResult;
|
|
49
55
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"lodash-es/isEqual.js";import{Branded as t}from"@salsita-ai/common/utils";import{createRelationFactory as
|
|
1
|
+
import e from"lodash-es/isEqual.js";import{Branded as t}from"@salsita-ai/common/utils";import{ImplementationError as i,createRelationFactory as n,mergeExpressionModules as a}from"#package/domain";import{canonicalEnhancedJsonValueKey as r,isSdkExpressionImplementation as o}from"../../../core/index.js";import{specCodeExpressionKey as l}from"../../runtime-spec/index.js";import{generateMemoEvalPlanRuntime as s}from"./generate-memo-eval-plan-runtime.js";let p={},m=["0-1","1-1","0-N","1-N"],d={relation:(e,t)=>{let i=t[0];if(!("object"==typeof i&&null!==i&&"kind"in i&&"target"in i&&"string"==typeof i.target&&"cardinality"in i&&m.includes(i.cardinality)&&("allOfType"===i.kind||("direct"===i.kind||"indirect"===i.kind)&&"field"in i&&"string"==typeof i.field)))throw Error("Cannot create the relation expression because its parameter is not a relation declaration. The application spec is inconsistent; rebuild it from a valid relations declaration.");return n(e.aliasMap)(i)},violations:(e,t)=>{let i=t[0];if("object"!=typeof i||null===i||!("entityType"in i)||"string"!=typeof i.entityType)throw Error("Cannot create the violations expression because its entityType parameter is missing. The application spec is inconsistent; rebuild it from a valid invariants declaration.");let n=i.entityType,a=Object.entries(e.invariantImplementations).flatMap(([t,i])=>{let a=e.aliasMap[t];return t===n||a?.includes(n)?i:[]});return{origin:{name:"$violations",typeOrAlias:n},evaluate:(e,t,i)=>a.flatMap(n=>n.evaluate(e,t,i)),meta:{}}}},f=e=>{let t=s(e.plan,l(e.entityOrAlias,e.name),e.code);return{origin:{name:e.name,typeOrAlias:e.entityOrAlias},evaluate:(e,i,n)=>t(n.domain.get$Entity(e,i),i,n),meta:{}}},u=e=>({...(0,d[e.kind])({aliasMap:e.aliasMap,invariantImplementations:e.invariantImplementations},e.params),origin:{name:e.name,typeOrAlias:e.entityOrAlias}});export const ExpressionRuntime=(n,l,s,m,d=p,c,g,y={})=>{let v={};for(let[e,t]of n.latestModel.aliases)v[String(e)]=t.map(String);let x={...y};for(let[e,t]of Object.entries(a(s,v,g,((e,t,i)=>{let n=new Map,a=(e,t)=>{n.set(e,(n.get(e)??new Set).add(t))};for(let[i,n]of e.expressions.expressions)for(let[e,r]of n)if("user"!==r.implementation.kind)for(let n of t[String(i)]??[String(i)])a(n,String(e));for(let[e,t]of Object.entries(i))for(let i of Object.keys(t))a(e,i);return n})(n,v,y))))x[e]={...x[e],...t};let S=l.createBuilder(`${m}/sdk`,{build:u,getKey:e=>`sdk::${e.entityOrAlias}::${e.name}`,compare:(t,i)=>t.kind===i.kind&&e(t.params,i.params)&&e(t.aliasMap,i.aliasMap)&&("violations"!==i.kind||t.invariantImplementations===i.invariantImplementations)}),h=l.createBuilder(`${m}/user`,{build:e=>e.impl,getKey:e=>`user::${e.entityType}::${e.name}`,compare:(e,t)=>{let i,n;return(i=e.impl)===(n=t.impl)||i.evaluate===n.evaluate&&i.meta===n.meta&&i.origin.name===n.origin.name&&i.origin.typeOrAlias===n.origin.typeOrAlias}}),O=l.createBuilder(`${m}/value`,{build:f,getKey:e=>`value::${e.entityOrAlias}::${e.name}`,compare:(e,t)=>e.valueKey===t.valueKey&&e.code===t.code}),b={},k=!1,$=new Set,M=new Set,j=new Set;for(let[e,t]of n.expressions.expressions)for(let[,i]of t){let t=v[String(e)]??[String(e)];if(o(i.implementation)){let n={entityOrAlias:String(e),name:String(i.name),kind:i.implementation.kind,params:i.implementation.params,aliasMap:v,invariantImplementations:d},a=S.build(n);for(let e of(a.changed&&(k=!0),$.add(S.getKey(n)),t))b[e]||(b[e]={}),b[e][String(i.name)]=a.output;continue}if("value"===i.implementation.kind){let n=i.implementation.value,a={entityOrAlias:String(e),name:String(i.name),valueKey:r(n),plan:i.implementation.plan,code:c},o=O.build(a);for(let e of(o.changed&&(k=!0),j.add(O.getKey(a)),t))b[e]||(b[e]={}),b[e][String(i.name)]=o.output;continue}}for(let[e,t]of Object.entries(x))for(let[i,n]of Object.entries(t)){let t={entityType:e,name:i,impl:n},a=h.build(t);a.changed&&(k=!0),M.add(h.getKey(t)),b[e]||(b[e]={}),b[e][i]=a.output}S.cleanup($)&&(k=!0),h.cleanup(M)&&(k=!0),O.cleanup(j)&&(k=!0);let A=[];for(let[e,t]of n.expressions.entityExpressions)for(let i of t.shapeGroups){let t=n.expressions.expressions.get(i);if(t)for(let[i]of t)b[String(e)]?.[String(i)]||A.push({entityType:String(e),exprName:String(i)})}return A.length>0?(A.forEach(e=>g.add(new i({code:"MISSING_IMPLEMENTATION",origin:null,problem:`Missing implementation of expression ${e.entityType}.${e.exprName}`,fix:"The spec declares it without a value of its own ($eval, $msg or a read), so a project file implements it: a default export of phx.domain.implementCustomExpressions({ ... }) in src/expressions/, or of phx.domain.admin.implementCustomExpressions({ ... }) in src/admin/expressions/ for an admin entity type. Implement it, or remove the declaration from the spec."}))),{ok:!1,missing:A}):{ok:!0,runtime:t({merged:b,changed:k})}};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
+
import type { RuntimeReferenceStore } from '../../caching/index.js';
|
|
3
|
+
import type { RuntimeSpec } from '../runtime-spec/index.js';
|
|
4
|
+
import { AdminSpecRuntime } from './admin-runtime/admin-spec-runtime.js';
|
|
5
|
+
import { ConfiguratorSpecRuntime } from './configurator-runtime/configurator-spec-runtime.js';
|
|
6
|
+
import type { SpecCodeModule } from './spec-code/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* The sections of both domains that the spec alone determines, without a project module: each
|
|
9
|
+
* domain's model and the data of its `phx.domain` factories.
|
|
10
|
+
*
|
|
11
|
+
* An application is built in two steps in one reference store. This is the first: it runs before
|
|
12
|
+
* the project's modules load, because they call the `phx.domain` factories while they are evaluated.
|
|
13
|
+
* The second, `ApplicationRuntime` with the loaded modules, builds the same sections through the
|
|
14
|
+
* same functions, so it returns the same objects: `phx.domain.model.X` is the reflection the
|
|
15
|
+
* application's domain validates with.
|
|
16
|
+
*/
|
|
17
|
+
export type SpecRuntime = Branded<'SpecRuntime', {
|
|
18
|
+
readonly configurator: ConfiguratorSpecRuntime;
|
|
19
|
+
readonly admin: AdminSpecRuntime;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const SpecRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore, specCode: SpecCodeModule | undefined) => SpecRuntime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Branded as i}from"@salsita-ai/common/utils";import{AdminSpecRuntime as r}from"./admin-runtime/admin-spec-runtime.js";import{ConfiguratorSpecRuntime as o}from"./configurator-runtime/configurator-spec-runtime.js";export const SpecRuntime=(m,t,n)=>i({configurator:o(m,t,n?.configurator),admin:r(m,t,n?.admin)});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The version of the JSON format `encodeRuntimeSpec` writes. Raise it with every change to the
|
|
3
|
-
* format or to the shape of `RuntimeSpec
|
|
4
|
-
* or newer SDK wrote instead of building a
|
|
3
|
+
* format or to the shape of `RuntimeSpec` once a released SDK has written the current version, so
|
|
4
|
+
* that `decodeRuntimeSpec` refuses an artifact an older or newer SDK wrote instead of building a
|
|
5
|
+
* runtime from data it does not understand.
|
|
5
6
|
*/
|
|
6
7
|
export declare const RUNTIME_SPEC_FORMAT_VERSION = 1;
|
|
7
8
|
/** One step from a value into a part of it: an object key or an array index. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdminSpec, ApplicationSpec, ConfiguratorSpec, EntitySchema, Infra, ModelVersion, ResolvedModelVersion, ResolvedVersions } from '../../parse-application-files/index.js';
|
|
1
|
+
import type { AdminSpec, ApplicationSpec, AssistantSpec, ConfiguratorSpec, DataSchemaEntry, DataSchemas, DataSpec, EntitySchema, Infra, ModelVersion, ResolvedModelVersion, ResolvedVersions, Shape } from '../../parse-application-files/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* The part of a parsed entity schema the runtime reads: the entity type and the schema of its
|
|
4
4
|
* shape, from which it builds the entity's reflection. The full schema with `id` and `type` is
|
|
@@ -8,12 +8,22 @@ import type { AdminSpec, ApplicationSpec, ConfiguratorSpec, EntitySchema, Infra,
|
|
|
8
8
|
export type RuntimeEntitySchema = Pick<EntitySchema, 'entityType' | 'shapeSchema'>;
|
|
9
9
|
/**
|
|
10
10
|
* The part of a parsed model version the runtime reads: the entity types, the aliases, the common
|
|
11
|
-
* types and the schema of every entity's shape. The
|
|
12
|
-
* parser and the type generator
|
|
11
|
+
* types and the schema of every entity's shape. The shapes and the resolved shapes only serve the
|
|
12
|
+
* parser and the type generator, except the runtime schemas of the latest version's shapes (see
|
|
13
|
+
* `RuntimeLatestModelVersion`).
|
|
13
14
|
*/
|
|
14
15
|
export type RuntimeModelVersion = Pick<ModelVersion, 'versionKey' | 'entityTypes' | 'rootEntityTypes' | 'aliases' | 'commonTypes'> & {
|
|
15
16
|
readonly entitySchemas: readonly RuntimeEntitySchema[];
|
|
16
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* The latest model version of a domain as the runtime reads it: a model version plus the runtime
|
|
20
|
+
* schema of every shape, which `phx.domain.model` reflects as `<Name>Shape`.
|
|
21
|
+
*/
|
|
22
|
+
export type RuntimeLatestModelVersion = RuntimeModelVersion & {
|
|
23
|
+
readonly shapes: ReadonlyMap<Shape['name'], RuntimeShapeSchema>;
|
|
24
|
+
};
|
|
25
|
+
/** The part of a parsed shape the runtime reads: its name and its runtime JSON schema. */
|
|
26
|
+
export type RuntimeShapeSchema = Pick<Shape, 'name' | 'runtimeSchema'>;
|
|
17
27
|
/** One model version of a domain as the runtime reads it, with the migration file that leads to it. */
|
|
18
28
|
export type RuntimeResolvedModelVersion = Omit<ResolvedModelVersion, 'modelVersion'> & {
|
|
19
29
|
readonly modelVersion: RuntimeModelVersion;
|
|
@@ -24,15 +34,39 @@ export type RuntimeResolvedVersions = Pick<ResolvedVersions, 'latestVersion'> &
|
|
|
24
34
|
};
|
|
25
35
|
/** The model of a domain as the runtime reads it: the latest version and every earlier one. */
|
|
26
36
|
interface RuntimeDomainModel {
|
|
27
|
-
readonly latestModel:
|
|
37
|
+
readonly latestModel: RuntimeLatestModelVersion;
|
|
28
38
|
readonly resolvedVersions: RuntimeResolvedVersions;
|
|
29
39
|
}
|
|
40
|
+
/** The part of a parsed data schema the runtime reads: the JSON schema it validates the data with. */
|
|
41
|
+
export type RuntimeDataSchemaEntry = Pick<DataSchemaEntry, 'runtimeSchema'>;
|
|
42
|
+
/**
|
|
43
|
+
* The data schemas as the runtime reads them: the JSON schema of each kind of data and the hash of
|
|
44
|
+
* the published data. The enhanced schemas, with Phoenix references, only serve the type generator.
|
|
45
|
+
*/
|
|
46
|
+
export type RuntimeDataSchemas = Pick<DataSchemas, 'publishedDataHash'> & {
|
|
47
|
+
readonly [KIND in Exclude<keyof DataSchemas, 'publishedDataHash' | 'backendData'>]: RuntimeDataSchemaEntry;
|
|
48
|
+
} & {
|
|
49
|
+
readonly backendData: RuntimeDataSchemaEntry | undefined;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The assistant as the runtime reads it: its resolved manifest. The parsed assistant schema the
|
|
53
|
+
* manifest is resolved from only serves the parser.
|
|
54
|
+
*/
|
|
55
|
+
export type RuntimeAssistantSpec = Pick<NonNullable<AssistantSpec>, 'resolved'> | null;
|
|
56
|
+
/**
|
|
57
|
+
* The data spec as the runtime reads it: the data entries and their chunks. The data entries and
|
|
58
|
+
* admin data pages the parser derives from them only serve the admin spec and the type generator.
|
|
59
|
+
*/
|
|
60
|
+
export type RuntimeDataSpec = Pick<DataSpec, 'entries' | 'chunks'>;
|
|
30
61
|
/**
|
|
31
62
|
* The configurator part of the runtime spec. It leaves out the configuration schema and its
|
|
32
63
|
* version, which only a deployment registers, and the assistant's server settings (instructions
|
|
33
64
|
* and AI settings), which must never reach the browser of a customer.
|
|
34
65
|
*/
|
|
35
|
-
export type RuntimeConfiguratorSpec = Pick<ConfiguratorSpec, 'components' | 'presets' | 'expressions' | 'actions' | 'invariants' | '
|
|
66
|
+
export type RuntimeConfiguratorSpec = Pick<ConfiguratorSpec, 'components' | 'presets' | 'expressions' | 'actions' | 'invariants' | 'defaults' | 'states' | 'theme' | 'ui' | 'transformers'> & RuntimeDomainModel & {
|
|
67
|
+
readonly dataSchemas: RuntimeDataSchemas;
|
|
68
|
+
readonly assistant: RuntimeAssistantSpec;
|
|
69
|
+
};
|
|
36
70
|
/**
|
|
37
71
|
* The admin part of the runtime spec. It leaves out the configuration schema and its version, which
|
|
38
72
|
* only a deployment registers.
|
|
@@ -54,15 +88,16 @@ export type RuntimeInfra = Pick<Infra, 'acl' | 'resources' | 'resourcesConfig'>;
|
|
|
54
88
|
* leaves out what only the parser, the type generator or a deployment use, and holds plain data,
|
|
55
89
|
* Maps and Sets only, so it can be encoded as JSON.
|
|
56
90
|
*/
|
|
57
|
-
export interface RuntimeSpec extends Pick<ApplicationSpec, 'appMetadata'
|
|
91
|
+
export interface RuntimeSpec extends Pick<ApplicationSpec, 'appMetadata'> {
|
|
92
|
+
readonly dataSpec: RuntimeDataSpec;
|
|
58
93
|
readonly configurator: RuntimeConfiguratorSpec;
|
|
59
94
|
readonly admin: RuntimeAdminSpec;
|
|
60
95
|
readonly infra: RuntimeInfra;
|
|
61
96
|
}
|
|
62
97
|
/**
|
|
63
|
-
* Takes from a parsed application spec the part the runtime reads.
|
|
64
|
-
*
|
|
65
|
-
* runtime does not read.
|
|
98
|
+
* Takes from a parsed application spec the part the runtime reads. It reuses the sections it keeps
|
|
99
|
+
* whole, and builds trimmed copies of the model versions, data schemas, assistant and data spec
|
|
100
|
+
* without what the runtime does not read.
|
|
66
101
|
*/
|
|
67
102
|
export declare const toRuntimeSpec: (spec: ApplicationSpec) => RuntimeSpec;
|
|
68
103
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=e=>({versionKey:e.versionKey,entityTypes:e.entityTypes,rootEntityTypes:e.rootEntityTypes,aliases:e.aliases,commonTypes:e.commonTypes,entitySchemas:e.entitySchemas.map(e=>({entityType:e.entityType,shapeSchema:e.shapeSchema}))}),s=
|
|
1
|
+
let e=e=>({versionKey:e.versionKey,entityTypes:e.entityTypes,rootEntityTypes:e.rootEntityTypes,aliases:e.aliases,commonTypes:e.commonTypes,entitySchemas:e.entitySchemas.map(e=>({entityType:e.entityType,shapeSchema:e.shapeSchema}))}),s=e=>({runtimeSchema:e.runtimeSchema}),a=s=>{let a;return{latestModel:{...e(a=s.latestModel),shapes:new Map([...a.shapes].map(([e,s])=>[e,{name:s.name,runtimeSchema:s.runtimeSchema}]))},resolvedVersions:{latestVersion:s.resolvedVersions.latestVersion,versionedModels:s.resolvedVersions.versionedModels.map(s=>({version:s.version,key:s.key,isLatest:s.isLatest,migrationFile:s.migrationFile,modelVersion:e(s.modelVersion)}))}}};export const toRuntimeSpec=e=>{let t,{configurator:n,admin:i,infra:r}=e;return{configurator:{components:n.components,presets:n.presets,expressions:n.expressions,actions:n.actions,invariants:n.invariants,dataSchemas:{publishedDataHash:(t=n.dataSchemas).publishedDataHash,publishedData:s(t.publishedData),sessionData:s(t.sessionData),frontendData:s(t.frontendData),backendData:t.backendData&&s(t.backendData),finalizeData:s(t.finalizeData),prefetchedFinalizeData:s(t.prefetchedFinalizeData),finalizeResult:s(t.finalizeResult),callbackData:s(t.callbackData)},defaults:n.defaults,states:n.states,theme:n.theme,ui:n.ui,transformers:n.transformers,assistant:n.assistant&&{resolved:n.assistant.resolved},...a(n)},admin:{components:i.components,presets:i.presets,expressions:i.expressions,invariants:i.invariants,defaults:i.defaults,states:i.states,adminPages:i.adminPages,...a(i)},appMetadata:e.appMetadata,infra:{acl:r.acl,resources:r.resources,resourcesConfig:r.resourcesConfig},dataSpec:{entries:e.dataSpec.entries,chunks:e.dataSpec.chunks}}};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AccessLevel } from '@salsita-ai/contracts/api';
|
|
2
2
|
import { type ChatStreamChunk } from '@salsita-ai/contracts/chat';
|
|
3
|
-
import { type AssistantChatConnection, type AssistantEarlierThread, type AssistantThreadCompaction, type AuthorizedPhoenixApiClient, type ChatToolCall, type ChatToolCallResult, type ConfigurationPayload, type ConfigurationSchema, type waitForFinalizationResultSettings } from './contract.js';
|
|
3
|
+
import { type AssistantChatConnection, type AssistantEarlierThread, type AssistantImageUpload, type AssistantThreadCompaction, type AuthorizedPhoenixApiClient, type ChatToolCall, type ChatToolCallResult, type ConfigurationPayload, type ConfigurationSchema, type waitForFinalizationResultSettings } from './contract.js';
|
|
4
4
|
import type { components } from './phoenix-api.js';
|
|
5
5
|
export declare class AuthorizedClient<FINALIZE_DATA extends Record<string, unknown>, FINALIZE_RESULT extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>> implements AuthorizedPhoenixApiClient<FINALIZE_DATA, FINALIZE_RESULT, FRONTEND_DATA> {
|
|
6
6
|
private readonly _baseUrl;
|
|
@@ -28,6 +28,8 @@ export declare class AuthorizedClient<FINALIZE_DATA extends Record<string, unkno
|
|
|
28
28
|
getAssistantChatConnection: (configurationId: string) => AssistantChatConnection;
|
|
29
29
|
compactAssistantThread: (configurationId: string) => Promise<AssistantThreadCompaction>;
|
|
30
30
|
getAssistantEarlierThread: (configurationId: string, threadId: string, limit: number) => Promise<AssistantEarlierThread>;
|
|
31
|
+
uploadAssistantImage: (configurationId: string, image: Blob) => Promise<AssistantImageUpload>;
|
|
32
|
+
getAssistantImage: (configurationId: string, imageId: string) => Promise<Blob>;
|
|
31
33
|
sendMessage: (configurationId: string, content: string, context?: Record<string, string>) => Promise<ReadableStream<ChatStreamChunk>>;
|
|
32
34
|
sendToolCallResults: (configurationId: string, calls: ChatToolCall[], results: ChatToolCallResult[], agent?: string) => Promise<ReadableStream<ChatStreamChunk>>;
|
|
33
35
|
generateShareLink: (configurationId: string, revisionId: string, expiration: number, access: AccessLevel, baseUrl: string | undefined) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{match as t}from"ts-pattern";import{InfoError as a}from"@salsita-ai/common/utils";import{isChatError as e}from"@salsita-ai/contracts/chat";import{createApiBaseClient as r}from"./base-client.js";import{AssistantRequestError as i,InvalidAccessKeyError as
|
|
1
|
+
import{match as t}from"ts-pattern";import{InfoError as a}from"@salsita-ai/common/utils";import{isChatError as e}from"@salsita-ai/contracts/chat";import{createApiBaseClient as r}from"./base-client.js";import{AssistantRequestError as i,InvalidAccessKeyError as s}from"./contract.js";let o=()=>new TransformStream({transform(t,a){a.enqueue(t)}}),n=async(t,a)=>{for(;;){let{done:r,value:i}=await t.read();if(r){await a.close();break}for(let t of i.split("\n").filter(t=>""!==t.trim()).map(t=>JSON.parse(t))){if(e(t))return void await a.abort(Error(t.error));await a.write(t)}}},h=(e,r)=>{let i=`${r} API request failed: ${JSON.stringify(e)}`;return t(e).with({statusCode:403,invalidAccessKey:!0},()=>new s).with({statusCode:403},()=>new a(i)).otherwise(()=>Error(i))};export class AuthorizedClient{_baseUrl;_getAccessToken;_getSessionToken;_client;constructor(t,a,e){this._baseUrl=t,this._getAccessToken=a,this._getSessionToken=e,this._client=r(this._baseUrl)}_authHeaders=async()=>{let t=this._getAccessToken(),a=await this._getSessionToken();return{"X-Access-Key":t,Authorization:`Bearer ${a}`}};getConfiguration=async t=>{let a=await this._authHeaders(),e=await this._client.GET("/configurations/{configurationId}",{params:{path:{configurationId:t}},headers:a});if(e.error)throw h(e.error,"getConfiguration");return e.data};updateConfiguration=async(t,a)=>{let e=await this._authHeaders(),r=await this._client.PUT("/configurations/{configurationId}",{params:{path:{configurationId:t}},body:a,headers:e});if(r.error)throw h(r.error,"updateConfiguration");return r.data};finalize=async(t,a,e,r,i)=>{let s=await this._authHeaders(),o=await this._client.POST("/configurations/{configurationId}/{finalizationUuid}/finalize",{params:{path:{configurationId:t,finalizationUuid:a},query:{locale:r}},body:{finalizeData:e,frontendData:i},headers:s});if(o.error)throw h(o.error,"finalize")};waitForFinalizationToComplete=async(t,a,e)=>{let r=e?.pollingFrequency??500,i=Math.ceil((e?.pollingTimeout??3e4)/r);for(let e=0;e<i;e++){let e=await this._authHeaders(),i=await this._client.GET("/configurations/{configurationId}/{finalizationUuid}/state",{params:{path:{configurationId:t,finalizationUuid:a}},headers:e});if(i.error)throw h(i.error,"getFinalizeJobState");let s=i.data;if("completed"===s.state)return s.result[0];if("failed"===s.state)throw Error("finalization failed");if("unknown"===s.state)throw Error("finalization state is unknown");await new Promise(t=>setTimeout(t,r))}throw Error("finalization did not complete within the specified timeout")};getConfigurationRevision=async(t,a)=>{let e=await this._authHeaders(),r=await this._client.GET("/configurations/{configurationId}/revisions/{revisionId}",{params:{path:{configurationId:t,revisionId:a}},headers:e});if(r.error)throw h(r.error,"getConfigurationRevision");return r.data};getChatConversation=async t=>{let a=await this._authHeaders(),e=await this._client.GET("/configurations/{configurationId}/chat",{params:{path:{configurationId:t}},headers:a});if(e.error)throw h(e.error,"getChatConversation");return e.data};getSpeechToText=async(t,a)=>{let e=await this._authHeaders(),r=new FormData;r.append("voiceFile",a,"voice.wav");let i=await this._client.POST("/configurations/{configurationId}/chat/stt",{params:{path:{configurationId:t}},headers:e,body:r,bodySerializer:()=>r});if(i.error)throw h(i.error,"getSpeechToText");return i.data.text};getTextToSpeech=async(t,a)=>{let e=await this._authHeaders(),r=await this._client.POST("/configurations/{configurationId}/chat/tts",{params:{path:{configurationId:t}},body:{content:a},headers:e,parseAs:"arrayBuffer"});if(r.error)throw h(r.error,"getTextToSpeech");return new Blob([r.data],{type:"audio/mp3"})};getAssistantChatConnection=t=>({url:new URL(`configurations/${encodeURIComponent(t)}/assistant/chat`,`${this._baseUrl}/`).toString(),headers:this._authHeaders});compactAssistantThread=async t=>{let a=await this._authHeaders(),e=await this._client.POST("/configurations/{configurationId}/assistant/chat/compact",{params:{path:{configurationId:t}},headers:{...a,"Content-Type":null}});if(e.error)throw new i(`compactAssistantThread API request failed: ${JSON.stringify(e.error)}`,e.response.status);return e.data};getAssistantEarlierThread=async(t,a,e)=>{let r=await this._authHeaders(),s=await this._client.GET("/configurations/{configurationId}/assistant/chat/threads/{threadId}",{params:{path:{configurationId:t,threadId:a},query:{limit:e}},headers:r});if(s.error)throw new i(`getAssistantEarlierThread API request failed: ${JSON.stringify(s.error)}`,s.response.status);let{messages:o}=s.data;return{threadId:a,messages:Array.isArray(o)?o:[],previousThreadId:s.response.headers.get("x-assistant-previous-thread")}};uploadAssistantImage=async(t,a)=>{let e=await this._authHeaders(),r=await this._client.POST("/configurations/{configurationId}/assistant/images",{params:{path:{configurationId:t}},headers:{...e,"Content-Type":a.type},body:a.type,bodySerializer:()=>a});if(r.error)throw new i(`uploadAssistantImage API request failed: ${JSON.stringify(r.error)}`,r.response.status);return{imageId:r.data.imageId}};getAssistantImage=async(t,a)=>{let e=await this._authHeaders(),r=await this._client.GET("/configurations/{configurationId}/assistant/images/{imageId}",{params:{path:{configurationId:t,imageId:a}},headers:e,parseAs:"blob"});if(r.error)throw new i(`getAssistantImage API request failed: ${JSON.stringify(r.error)}`,r.response.status);return r.data};sendMessage=async(t,a,e)=>{let r=await this._authHeaders(),i=await this._client.POST("/configurations/{configurationId}/chat/message",{params:{path:{configurationId:t}},body:{content:a,context:e},headers:r,parseAs:"stream"});if(i.error)throw h(i.error,"sendMessage");let s=i.data?.pipeThrough(new TextDecoderStream).getReader();if(!s)throw Error("sendMessage API response did not contain a readable stream");let u=o();return n(s,u.writable.getWriter()),u.readable};sendToolCallResults=async(t,a,e,r)=>{let i=await this._authHeaders(),s=await this._client.POST("/configurations/{configurationId}/chat/tool-calls",{params:{path:{configurationId:t}},body:{agent:r,calls:a,results:e},headers:i,parseAs:"stream"});if(s.error)throw h(s.error,"sendToolCallResults");let u=s.data?.pipeThrough(new TextDecoderStream).getReader();if(!u)throw Error("sendMessage API response did not contain a readable stream");let c=o();return n(u,c.writable.getWriter()),c.readable};generateShareLink=async(t,a,e,r,i)=>{let s=await this._authHeaders(),o=await this._client.POST("/configurations/{configurationId}/share-link",{params:{path:{configurationId:t}},body:{revisionId:a,expiration:e,access:r,baseUrl:i},headers:s});if(o.error)throw h(o.error,"generateShareLink");return o.data};generateUploadLinks=async(t,a,e)=>{let r=await this._authHeaders(),i=await this._client.POST("/configurations/{configurationId}/{finalizationUuid}/image-upload-links",{params:{path:{configurationId:t,finalizationUuid:a}},body:{names:e},headers:r});if(i.error)throw h(i.error,"generateUploadLinks");return i.data.links};getConfigurationPublicUploadLink=async(t,a)=>{let e=await this._authHeaders(),r=await this._client.GET("/configurations/{configurationId}/resources/{key}/public/upload",{params:{path:{configurationId:t,key:a}},headers:e});if(r.error)throw h(r.error,"getConfigurationPublicUploadLink");return r.data};getConfigurationPrivateUploadLink=async(t,a)=>{let e=await this._authHeaders(),r=await this._client.GET("/configurations/{configurationId}/resources/{key}/private/upload",{params:{path:{configurationId:t,key:a}},headers:e});if(r.error)throw h(r.error,"getConfigurationPrivateUploadLink");return r.data};getConfigurationPrivateResourceLink=async(t,a)=>{let e=await this._authHeaders(),r=await this._client.GET("/configurations/{configurationId}/resources/{key}/private",{params:{path:{configurationId:t,key:a}},headers:e});if(r.error)throw h(r.error,"getConfigurationPrivateUploadLink");return r.data};cloneConfiguration=async(t,a)=>{let e=await this._authHeaders(),r=await this._client.POST("/configurations/{configurationId}/revisions/{revisionId}/clone",{params:{path:{configurationId:t,revisionId:a}},headers:{...e,"Content-Type":null}});if(r.error)throw h(r.error,"cloneConfiguration");return r.data}}
|
|
@@ -100,6 +100,18 @@ export interface AuthorizedPhoenixApiClient<FINALIZE_DATA extends Record<string,
|
|
|
100
100
|
* `limit` of its newest messages. Rejects with an {@link AssistantRequestError} when the server refuses.
|
|
101
101
|
*/
|
|
102
102
|
getAssistantEarlierThread: (configurationId: string, threadId: string, limit: number) => Promise<AssistantEarlierThread>;
|
|
103
|
+
/**
|
|
104
|
+
* Stores a screenshot the assistant took in the open assistant thread of the configuration, while a
|
|
105
|
+
* reply runs there, and resolves with the id its tool result references it by. The image is the
|
|
106
|
+
* rendered JPEG or PNG blob, sent with its own type. Rejects with an {@link AssistantRequestError}
|
|
107
|
+
* when the server refuses.
|
|
108
|
+
*/
|
|
109
|
+
uploadAssistantImage: (configurationId: string, image: Blob) => Promise<AssistantImageUpload>;
|
|
110
|
+
/**
|
|
111
|
+
* Reads a screenshot of an assistant thread of the configuration by the id its tool result
|
|
112
|
+
* references it by. Rejects with an {@link AssistantRequestError} when the server refuses.
|
|
113
|
+
*/
|
|
114
|
+
getAssistantImage: (configurationId: string, imageId: string) => Promise<Blob>;
|
|
103
115
|
getSpeechToText: (configurationId: string, blob: Blob) => Promise<string>;
|
|
104
116
|
getTextToSpeech: (configurationId: string, text: string) => Promise<Blob>;
|
|
105
117
|
sendMessage: (configurationId: string, message: string, state?: Record<string, string>) => Promise<ReadableStream<ChatStreamChunk>>;
|
|
@@ -137,6 +149,11 @@ export interface AssistantThreadCompaction {
|
|
|
137
149
|
/** The closed thread the new one continues. */
|
|
138
150
|
readonly previousThreadId: string;
|
|
139
151
|
}
|
|
152
|
+
/** A screenshot stored in an assistant thread. */
|
|
153
|
+
export interface AssistantImageUpload {
|
|
154
|
+
/** The id a tool result references the image by, as `assistant-image:<imageId>`. */
|
|
155
|
+
readonly imageId: string;
|
|
156
|
+
}
|
|
140
157
|
/** A closed assistant thread, as the panel paints it above the thread that continues it. */
|
|
141
158
|
export interface AssistantEarlierThread {
|
|
142
159
|
readonly threadId: string;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export { MemoryAuthorizedPhoenixApiClient } from './memory-authorized-client.js'
|
|
|
9
9
|
export { MemoryAuthenticatedClientPhoenixApiClient, memoryStorage } from './memory-authenticated-client.js';
|
|
10
10
|
export { createUnsignedJWT } from './unsigned-jwt.js';
|
|
11
11
|
export type { components as ApiTypes } from './phoenix-api.js';
|
|
12
|
-
export type { ConfigurationPayload, ConfigurationSchema, ChatConfiguration, ChatConversation, ChatEmbedding, ChatMessageParam, ChatToolCallResult, Entity, UnauthenticatedPhoenixApiClient, AuthenticatedClientPhoenixApiClient, AuthorizedPhoenixApiClient, AssistantChatConnection, AssistantEarlierThread, AssistantThreadCompaction, OAuthProvider, OAuthAccessTokenResult, GoogleOAuthConfig, ReleaseToProductionResult, SharePointSiteConfig, } from './contract.js';
|
|
12
|
+
export type { ConfigurationPayload, ConfigurationSchema, ChatConfiguration, ChatConversation, ChatEmbedding, ChatMessageParam, ChatToolCallResult, Entity, UnauthenticatedPhoenixApiClient, AuthenticatedClientPhoenixApiClient, AuthorizedPhoenixApiClient, AssistantChatConnection, AssistantEarlierThread, AssistantImageUpload, AssistantThreadCompaction, OAuthProvider, OAuthAccessTokenResult, GoogleOAuthConfig, ReleaseToProductionResult, SharePointSiteConfig, } from './contract.js';
|
|
13
13
|
export { AssistantRequestError, InvalidAccessKeyError, InvalidDeploymentError, ChunkNotFoundError, OAuthStaleConnectionError, ConfigurationSchemaMismatchError, isConfigurationSchemaMismatchError, } from './contract.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChatMessageContentChunk, ChatToolCalls } from '@salsita-ai/contracts/chat';
|
|
2
|
-
import type { AssistantChatConnection, AssistantEarlierThread, AssistantThreadCompaction, AuthorizedPhoenixApiClient, ConfigurationPayload, ConfigurationSchema } from './contract.js';
|
|
2
|
+
import type { AssistantChatConnection, AssistantEarlierThread, AssistantImageUpload, AssistantThreadCompaction, AuthorizedPhoenixApiClient, ConfigurationPayload, ConfigurationSchema } from './contract.js';
|
|
3
3
|
import { LocalStorageAuthenticatedClientPhoenixApiClient } from './local-authenticated-client.js';
|
|
4
4
|
/**
|
|
5
5
|
* Local storage implementation for local dev, it does not check for schema changes, so you may need to create new configuration if the schema changes and
|
|
@@ -17,6 +17,8 @@ export declare class LocalStorageAuthorizedPhoenixApiClient<FINALIZE_DATA extend
|
|
|
17
17
|
getAssistantChatConnection: () => AssistantChatConnection;
|
|
18
18
|
compactAssistantThread: () => Promise<AssistantThreadCompaction>;
|
|
19
19
|
getAssistantEarlierThread: () => Promise<AssistantEarlierThread>;
|
|
20
|
+
uploadAssistantImage: () => Promise<AssistantImageUpload>;
|
|
21
|
+
getAssistantImage: () => Promise<Blob>;
|
|
20
22
|
getChatConversation: (configurationId: string) => Promise<readonly {
|
|
21
23
|
readonly augmentation?: import("./phoenix-api.js").components['schemas']['ChatMessageAugmentation'];
|
|
22
24
|
readonly content?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"uuid";import{ChunkType as e}from"@salsita-ai/contracts/chat";import{LocalStorageAuthenticatedClientPhoenixApiClient as
|
|
1
|
+
import*as t from"uuid";import{ChunkType as e}from"@salsita-ai/contracts/chat";import{LocalStorageAuthenticatedClientPhoenixApiClient as r}from"./local-authenticated-client.js";let o=(t,r)=>{let o={role:"assistant",content:["I see","Yes","Definitely"][Math.round(2*Math.random())]};return localStorage.setItem(`${r}-chat`,JSON.stringify([...t,o])),Promise.resolve(new ReadableStream({start(t){t.enqueue({type:e.content,content:o.content??""}),t.close()}}))};export class LocalStorageAuthorizedPhoenixApiClient extends r{getConfigurationData=t=>{let e=JSON.parse(localStorage.getItem(t)??"[]");if(!e||0===e.length)throw Error("Configuration not found!");return e};getConfiguration=t=>{let e=this.getConfigurationData(t);return Promise.resolve(e[e.length-1])};updateConfiguration=(e,r)=>{let o=this.getConfigurationData(e),n=t.v4(),a={...r,configurationId:e,revisionId:n,modelVersion:this._modelVersion};return localStorage.setItem(e,JSON.stringify([...o,a])),Promise.resolve({revisionId:n})};finalize=()=>{throw Error("Not implemented!")};waitForFinalizationToComplete=()=>{throw Error("Not implemented!")};getConfigurationRevision=(t,e)=>{let r=this.getConfigurationData(t).find(t=>t.revisionId===e);if(!r)throw Error("Revision not found!");return Promise.resolve(r)};getAssistantChatConnection=()=>{throw Error("The assistant chat needs the Phoenix server. Run the configurator against a server deployment.")};compactAssistantThread=async()=>{throw Error("The assistant chat needs the Phoenix server. Run the configurator against a server deployment.")};getAssistantEarlierThread=async()=>{throw Error("The assistant chat needs the Phoenix server. Run the configurator against a server deployment.")};uploadAssistantImage=async()=>{throw Error("The assistant chat needs the Phoenix server. Run the configurator against a server deployment.")};getAssistantImage=async()=>{throw Error("The assistant chat needs the Phoenix server. Run the configurator against a server deployment.")};getChatConversation=async t=>JSON.parse(localStorage.getItem(`${t}-chat`)??"[]");sendMessage=async(t,e)=>{let r=await this.getChatConversation(t);return localStorage.setItem(`${t}-chat`,JSON.stringify([...r,e])),o(r,t)};getSpeechToText=async()=>{throw Error("Not implemented!")};getTextToSpeech=async()=>{throw Error("Not implemented!")};sendToolCallResults=async t=>o(await this.getChatConversation(t),t);generateShareLink=async()=>({link:"https://yourcompany.com/configurator/link-will-not-work-it-is-dummy-link"});generateUploadLinks=async()=>{throw Error("Not implemented!")};getConfigurationPublicUploadLink=async()=>{throw Error("Not implemented!")};getConfigurationPrivateUploadLink=async()=>{throw Error("Not implemented!")};getConfigurationPrivateResourceLink=async()=>{throw Error("Not implemented!")};cloneConfiguration=async(t,e)=>{let r=localStorage.getItem(t);if(!r)throw Error("Configuration not found");let o=JSON.parse(r).find(t=>t.revisionId===e);if(!o)throw Error("Revision not found");return this.createConfiguration(o)}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssistantChatConnection, AssistantEarlierThread, AssistantThreadCompaction, AuthorizedPhoenixApiClient, ConfigurationPayload, ConfigurationSchema } from './contract.js';
|
|
1
|
+
import type { AssistantChatConnection, AssistantEarlierThread, AssistantImageUpload, AssistantThreadCompaction, AuthorizedPhoenixApiClient, ConfigurationPayload, ConfigurationSchema } from './contract.js';
|
|
2
2
|
import { MemoryAuthenticatedClientPhoenixApiClient } from './memory-authenticated-client.js';
|
|
3
3
|
/**
|
|
4
4
|
* Memory implementation for local dev, it does not check for schema changes, so you may need to create new configuration if the schema changes and
|
|
@@ -17,6 +17,9 @@ export declare class MemoryAuthorizedPhoenixApiClient<FINALIZE_DATA extends Reco
|
|
|
17
17
|
getAssistantChatConnection: () => AssistantChatConnection;
|
|
18
18
|
compactAssistantThread: () => Promise<AssistantThreadCompaction>;
|
|
19
19
|
getAssistantEarlierThread: () => Promise<AssistantEarlierThread>;
|
|
20
|
+
private readonly _assistantImages;
|
|
21
|
+
uploadAssistantImage: (configurationId: string, image: Blob) => Promise<AssistantImageUpload>;
|
|
22
|
+
getAssistantImage: (configurationId: string, imageId: string) => Promise<Blob>;
|
|
20
23
|
sendMessage: () => Promise<never>;
|
|
21
24
|
getSpeechToText: () => Promise<never>;
|
|
22
25
|
getTextToSpeech: () => Promise<never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as t from"uuid";import{MemoryAuthenticatedClientPhoenixApiClient as e,memoryStorage as r}from"./memory-authenticated-client.js";export class MemoryAuthorizedPhoenixApiClient extends e{getConfigurationData=t=>{let e=r.get(t);if(!e||!e||0===e.length)throw Error("Configuration not found!");return e};getConfiguration=t=>{let e=this.getConfigurationData(t);return Promise.resolve(e[e.length-1])};updateConfiguration=(e,o)=>{let n=this.getConfigurationData(e),i=t.v4(),a={...o,configurationId:e,revisionId:i,modelVersion:this._modelVersion};return r.set(e,[...n,a]),Promise.resolve({revisionId:i})};finalize=()=>{throw Error("Not implemented!")};waitForFinalizationToComplete=()=>{throw Error("Not implemented!")};getConfigurationRevision=(t,e)=>{let r=this.getConfigurationData(t).find(t=>t.revisionId===e);if(!r)throw Error("Revision not found!");return Promise.resolve(r)};getChatConversation=async()=>{throw Error("Not implemented!")};getAssistantChatConnection=()=>{throw Error("The assistant chat needs the Phoenix server. Run the configurator against a server deployment.")};compactAssistantThread=async()=>{throw Error("The assistant chat needs the Phoenix server. Run the configurator against a server deployment.")};getAssistantEarlierThread=async()=>{throw Error("The assistant chat needs the Phoenix server. Run the configurator against a server deployment.")};_assistantImages=new Map;uploadAssistantImage=async(e,r)=>{let o=t.v4();return this._assistantImages.set(`${e}/${o}`,r),{imageId:o}};getAssistantImage=async(t,e)=>{let r=this._assistantImages.get(`${t}/${e}`);if(!r)throw Error(`Assistant image ${e} was not uploaded for configuration ${t} through this client. Upload it before reading it.`);return r};sendMessage=async()=>{throw Error("Not implemented!")};getSpeechToText=async()=>{throw Error("Not implemented!")};getTextToSpeech=async()=>{throw Error("Not implemented!")};sendToolCallResults=async()=>{throw Error("Not implemented!")};generateShareLink=async()=>({link:"https://yourcompany.com/configurator/link-will-not-work-it-is-dummy-link"});generateUploadLinks=async()=>{throw Error("Not implemented!")};getConfigurationPublicUploadLink=async()=>{throw Error("Not implemented!")};getConfigurationPrivateUploadLink=async()=>{throw Error("Not implemented!")};getConfigurationPrivateResourceLink=async()=>{throw Error("Not implemented!")};cloneConfiguration=async(t,e)=>{let o=r.get(t);if(!o)throw Error("Configuration not found");let n=o.find(t=>t.revisionId===e);if(!n)throw Error("Revision not found");return this.createConfiguration(n)}}
|